Shandy6661 Posted March 26, 2015 Posted March 26, 2015 i've done this camera mode, but i want to add AIM function, which meant the player is disallowed to shot while running/walking, the player just can shoot when the player Aiming. the question is how to disable the fire while the player is running/walking? i'm thinking it would be similiar to OnStartSprinting function but i just found a row of code, please help.i'm sorry before for my bad englishthankssandityas. Quote
Steve_Yorkshire Posted March 26, 2015 Posted March 26, 2015 See if this helps. In the weapon's datablock file find readyMotion and remove or change the stateTransitionOnTriggerDown[#] so it doesn't go to the Fire state. Quote
Shandy6661 Posted March 27, 2015 Author Posted March 27, 2015 thanks for the reply, sir.i will try to do like what you said.Shandy. Quote
rlranft Posted March 30, 2015 Posted March 30, 2015 Side note: Sprint disables firing - if it's still there you should be able to examine what they did and use it. Quote
rlranft Posted June 22, 2015 Posted June 22, 2015 http://www.garagegames.com/products/torque-3d/fps#/5-weapons - points 6, 7, and 8 cover weapon states, and /game/art/datablocks/weapons/Lurker.cs is the datablock definition file for the Lurker rifle - look around line 389 for the start of the state definitions and around 517 is where the sprint state blocks start. Quote
saindd Posted June 22, 2015 Posted June 22, 2015 What about checking if the player is sprinting inside WeaponImage::onFire? Quote
rlranft Posted June 26, 2015 Posted June 26, 2015 What about checking if the player is sprinting inside WeaponImage::onFire?Why would you do that? It's already handled in the weapon state transitions - it Just Works™.Let me clarify - handling it in the weapon state blocks is better because your onFire() method doesn't grow, stretch, and take longer and longer to execute every time you add another check. The only check is, what, "canFire?" and if it's not true you bail. Not, "if sprinting, else if sneezing, else if eating, else if snoring, else if crawling, else if lickingWindows...." Quote
saindd Posted June 26, 2015 Posted June 26, 2015 I wasn't able to find this "canFire" check. In fact, most checks are done in the onFire method call. Quote
rlranft Posted July 9, 2015 Posted July 9, 2015 It's not a "can fire check" - it's a disabling of transition to the fire state.... "State machine."Try it - just sprint and try to fire.Look here - https://github.com/GarageGames/Torque3D/blob/development/Templates/Full/game/art/datablocks/weapons/Lurker.cs#L784This state block and the next two cover the sprint enter, sprinting, and sprint exit state transitions - note that you cannot transition to the fire state from these states. So no check ever needs to be made anywhere else - you simply can't transition into a firing state because it's not valid.And I don't see any check for canFire in https://github.com/GarageGames/Torque3D/blob/development/Templates/Full/game/scripts/server/weapon.cs#L179 at all.Having said that - do it however you like. Your game, your way. But you did ask, so I thought I'd explain how it was already done. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.