| 04-24-2006, 08:48 AM | #1 |
Say i have a [Baby] when it is trained it is allowed a 5 second grace period before it is replaced by random of 2 options [Male Child] or [Female Child]. How would i go about this? Im guessing i would need to use a (wait) function for the 5 seconds but how would i do the random part. |
| 04-24-2006, 09:27 AM | #2 |
this one is actually pretty simple. you simply need to make a variable and set it to a random number between one and two. now assuming you train this unit from a building the trigger would go as follows. im using if then/else multiple functions because its easier to edit and read. but you can use a singular if/then if you prefer. Trigger: you may need to set the trained baby as a variable due to the wait in the trigger. can't be sure without testing it though. |
| 04-24-2006, 10:21 AM | #3 | |
Quote:
why set it to a variable? Trigger: and i dont think "trained unit" works after a wait. use "triggering unit". but that might refer to the unit that trained the trained unit. should that be the case, store "trained unit" in a variable before the wait. |
| 04-24-2006, 10:32 AM | #4 |
hmm didnt think of putting random integer as a condition. |
| 04-24-2006, 10:48 AM | #5 |
very weird was working earlier with the variable now it isnt.. getting lots of females again |
| 04-24-2006, 12:46 PM | #6 |
Is Fixed Random Seed turned off in the World Editor prefrences? "Test Map" will use non-random generation if this is turned on (i think it's default). |
| 04-24-2006, 01:10 PM | #7 | |
Quote:
Lol. You answered your own question. Don't use triggering unit at all. Never use any of those after a wait, just in case. Set it to a temp variable instead. Make a unit variable called TEMP_Unit in the variable editor, then do this: Trigger: The custom script gives you a local version of the variable, and setting it to 'no unit' at the end cleans up the memory leak. Also make sure you're waiting game-time seconds, as above. |
| 04-24-2006, 07:31 PM | #8 |
Trained unit should work after a wait. The only thing I know for sure that doesn't work after a wait are cast event responses (casting unit, target unit/point of ability being cast). |
