cycle options

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
Agentarrow
Posts: 1346
Joined: Thu Jun 28, 2007 4:34 pm
Location: Kyiv, Ukraine
Contact:

cycle options

Post by Agentarrow »

how would I go about making weapons cycle when the player hits TAB?
this is much faster in a 4 weapon game like Terra Trooper.
AgentArrow Home
The greater good is but a point of view...
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: cycle options

Post by Juutis »

Check if TAB is pressed. Check if the last weapon (the one with the index 3) is armed and if so, change to the first weapon (with index 0). Otherwise change to the next weapon (current weapon + 1):

Code: Select all

if(IsKeyDown(13))
{
     if(player_weapon = 3)
     {
          SetPlayerWeapon(0);
     }
     else
     {
          SetPlayerWeapon(player_weapon + 1);
     }
}
Pain is only psychological.
Post Reply