code not working properly

Talk about making games.

code not working properly

Postby DBGames » Sat Jul 03, 2010 1:03 am

Code: Select all
if(textNumber==0);
{
    EventDisable("Helicopter", EVENTKEYUP);
}


this code should be self explanatory, but when the number of this actor hits 0. i want the key up even to stop making rockets.
ok i added to the code but the sencond part dosent work either now. the whole code is below.
Code: Select all
if(textNumber==0);
{
    EventDisable("Helicopter", EVENTKEYUP);
}
if(textNumber==0);
{
    EventDisable("Rocket_Amount", EVENTALL);
}

for this code, when thxt nubmer is zero i dont want it to lower any more. (no -1's and stuff)
User avatar
DBGames
 
Posts: 113
Joined: Wed Jun 24, 2009 10:13 am
Location: Bismarck, North Dakota
Score: 8 Give a positive score

Re: code not working properly

Postby Bee-Ant » Sat Jul 03, 2010 3:29 am

Don't use "textNumber"...
It's not a real number we can mess with...
Use variable instead.

Go to Script Editor, click Variable and add a new one. Say "Number".
On the text actor, put :
Code: Select all
textNumber=Number;

And fix your code into :
Code: Select all
if(Number==0);
{
    EventDisable("Helicopter", EVENTKEYUP);
}
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: code not working properly

Postby DBGames » Sat Jul 03, 2010 6:11 am

it didnt work, now its always disabling event up
User avatar
DBGames
 
Posts: 113
Joined: Wed Jun 24, 2009 10:13 am
Location: Bismarck, North Dakota
Score: 8 Give a positive score

Re: code not working properly

Postby Bee-Ant » Sat Jul 03, 2010 7:53 am

DBGames wrote:it didnt work, now its always disabling event up

Of course if you didn't edit the code into :
Code: Select all
if(Number==0);
{
    EventDisable("Helicopter", EVENTKEYUP);
}
if(Number==1);
{
    EventEnable("Helicopter", EVENTALL);
}

And put :
Code: Select all
Number=0; //or
Number=1;

somewhere to switch the status...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest