| 08-25-2002, 02:33 AM | #1 |
Ok, I have my trigger system all line up everything is finnaly working and bam, I realize lots of important trigs are based on the <gen> units! First I though, No problem just make it a unit variable.. wrong. Ok, enough story.. There is no trigger work around, so Im thinking of coding ( Yes I can code ) but just replacing the <gen> unit with the variable aint gonna work (Or i would be able to in trigs.. right?) I dont suppose anyone has come across this before? I dont really want to brute force this, Im an optimize freak, any suggestions before I go against my morals? |
| 08-25-2002, 10:37 AM | #2 |
The unit specific events will really get bound to units (not to variables) when calling TriggerRegisterUnitEvent. WorldEdit does that during map initialization. That's why you can't use variables: Because they contain no units on map initialization. You must modify your trigger no to do TriggerRegisterUnitEvent on initialization but on the first call. Then you can use the unit from the variable. Make the trigger be called by 'time elapsed 2 seconds' and then check if it's the first call and if it is: call TriggerRegisterUnitEvent That works. |
| 08-25-2002, 05:14 PM | #3 |
So.. as long as I dont run this trigger off initailization, I can replace it with custom text (of the variable I mean)? |
| 08-25-2002, 05:41 PM | #4 |
Almost as you said. But don't just replace. Do it as described: If you have a trigger and it's in the middle of the game, you can change from <gen> to normal variables. 1. Make sure, the variable you want to use is set to a unit. Then convert the trigger: You must DELETE the normal unit event registration (delete <--- means really delete it) and must ADD a new unit event registration IN THE TRIGGER ACTIONS! Here's how: Add an event to the trigger that makes the trigger run after 1 second of elapsed time (or it won't ever run). Then in the action function, make an if statement: Code:
if the trigger runs for the first time:
register my unit event with my variable
else
//My unit event has happened
Do the stuff you want with TriggeringUnit hereNOTICE: If the variable changes, the event does NOT change. The event is bound to the UNIT, not to the variable. |
| 08-25-2002, 05:44 PM | #5 |
Thanks for your help! The variable dosent change.. I guess Ill have to delete / reinstate to get a new guy there. |
