Page 1 of 1

Disabling Specific Events

PostPosted: Fri Aug 18, 2006 8:58 pm
by Hedfone
My game features a ninja who can throw Ninja Stars, but only after having collected them. I need to event disable this event if he has no Stars without disabling EVERY key down event.

How do I do this?

PostPosted: Fri Aug 18, 2006 9:20 pm
by makslane
1) Create a actor variable to control the star number (nstars)
2) In the 'Create Actor' event of ninja, put the action 'Event Disable' key down.
3) In the event are using to collect the stars, put:
Code: Select all
nstars++;


And put the action 'Event Enable' key down.

4) In the event are you using to throw the stars put:
Code: Select all
nstars--;
if(nstars <= 0)
{
   EventDisable("Event Actor", EVENTKEYDOWN); //If the event is in ninja actor
   nstars = 0;
}

PostPosted: Tue Dec 05, 2006 4:47 am
by S0L1Dfake
Makslane, I used that code in my game and it works for stopping the use of the weapon, but when you disable keydown it also stops my character from being able to move ('keydown:right or left') without ammo. I am also having trouble stopping the player from using ammo that is depleted. PLEASE HELP!!!!

PostPosted: Tue Dec 05, 2006 11:50 pm
by makslane
In this case, create an Actor variable to hold the ammo count.
In the Key Down event, put:

if(ammo > 0)
{
//Fire

//Decrease count
ammo--;
}