Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Event disabling and re-enabling
Old
SirThorfinn
Senior Member
 
SirThorfinn's Avatar
 
Status: Offline
Posts: 232
Join Date: Sep 2010
Location: Some where Unreal!
Question Event disabling and re-enabling - 09-28-2010, 04:28 PM

Lets say I have a FPS with working ammo counters and stuff but when the counter reaches 0 Alice automatically does the reload animation, during this i want certain events to disable until the animation is over so it doesn't mess with the guns orientation during the reload. (Example: I don't want the player to be able to aim down the sight while reloading)
Any tips?
   
Reply With Quote
Old
Awesomeness
Guest
 
Status:
Posts: n/a
Default 09-28-2010, 06:09 PM

Make a variable that turns on/off whenever you start/stop reloading, and whenever someone say, tries to looks down the sight, make it check if you're reloading with an if else statement.

If you needer a deeper explanation let me know.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 09-28-2010, 06:17 PM

You can make separate boolean variables for each action of your person. For example, lets say you have the ability to look down your sights, but you don't want people to be able to do it while reloading. Create a boolean variable called "isReloading" and keep it set it to default "False". Now in the event where you call upon the gun reloading, just put an if/else statement in the place of that method and put "if(isReloading), do nothing; else, person.aimDownSights". Now in the method where you are reloading, in the method itself before you do anything else, set "isReloading" to "True" in the beginning, and then when the animation finishes, set "isReloading" to "False" again. This way, when you go to reload, it will turn the boolean on, therefore disabling you from aiming down your sights, and as soon as the reloading ends and the boolean turns back to false, you can aim down your sights again. You can repeat this process with all of your other methods that you do not want to happen while reloading. Or you can create difference booleans so that, lets say you cannot reload while you are running, or look down your sights while you are running.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
SirThorfinn
Senior Member
 
SirThorfinn's Avatar
 
Status: Offline
Posts: 232
Join Date: Sep 2010
Location: Some where Unreal!
Talking 09-28-2010, 07:10 PM

Quote:
Originally Posted by Dameria View Post
You can make separate boolean variables for each action of your person. For example, lets say you have the ability to look down your sights, but you don't want people to be able to do it while reloading. Create a boolean variable called "isReloading" and keep it set it to default "False". Now in the event where you call upon the gun reloading, just put an if/else statement in the place of that method and put "if(isReloading), do nothing; else, person.aimDownSights". Now in the method where you are reloading, in the method itself before you do anything else, set "isReloading" to "True" in the beginning, and then when the animation finishes, set "isReloading" to "False" again. This way, when you go to reload, it will turn the boolean on, therefore disabling you from aiming down your sights, and as soon as the reloading ends and the boolean turns back to false, you can aim down your sights again. You can repeat this process with all of your other methods that you do not want to happen while reloading. Or you can create difference booleans so that, lets say you cannot reload while you are running, or look down your sights while you are running.
Thanks for the help it works perfectly
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2018, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.