Jump to content

How To Costumize Player System?


Shandy6661

Recommended Posts

Hi everyone, i recently had unsolved problem (yet). in my project the player had different system to default player system.

in my project the player is need aim system like in this picture



http://s.pro-gmedia.com/videogamer/media/images/xbox360/resident_evil_6/screens/resident_evil_6_48.jpg


by default the player system is already similar,

but i have changed the default player system similar to this picture



http://i.imgur.com/kVBkQWy.jpg

(but the player still can shoot everytimes i press the left mouse button)



the questions is

-how to make a aim system?

-how to make the player characters do aim system and had camera that follow the weapon's direction by pressing certain button(for example "Right mouse Button"?

-how to make the player disallowed to shoot and had orbit camera style(EYE node as the offset) if the player didnt press the "Right Mouse Button"?

-Which script that i have to use to make it possible? C++ or TorqueScript?

Link to comment
Share on other sites

I think the easiest way to tackle the aim system is with a global variable defined inside the bind of the right click with something like:

(in the file default.bind.cs)

$aimsystemflag=false; //This initializes the aim system. You may want to initialize it when each level is restarted, too.

function aimsystem(%val)
{
  $aimsystemflag=%val; //when you hold right click you enter 'true' and when you realease it it goes 'false'
  if(%val)
  {
     //you do other stuff of starting aiming
     //here may go the change perspective
  }
  else
  {
     //here you've ended aiming
     //do quitting aiming stuff like change perspective back to normal
  }
}

moveMap.bind( mouse, button1, aimsystem ); //change 'moveMap' with your Move map if needed
//button1 is the right click of the mouse

 

This way you know $aimsystemflag is only true when aiming.

So inside the shot function you can use an if statement checking if that's true or false and act accordingly.



Now, about changing the eye node... There's a method for TSShapeConstructor to change the location of the a node (like the eye node), bool TSShapeConstructor::setNodeTransform( string name, TransformF txfm, bool isWorld = false )


But I don't know how to use it or if it can be used at run time to change a node in the player as it has a client/server thing, sorry.

Maybe other more experienced user than me can explain its posible use.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...