| 01-29-2003, 12:38 AM | #1 |
Guest | I know to check whether a unit is in a region, you use the event= unit enters region and then put down conditions. But what if I need to check something else... such as what the unit is doing? ie.. the Unit- player owned unit event how do I get it to check both? |
| 01-29-2003, 12:52 AM | #2 |
The problem is that Events aren't conditional. If you have 2 Events defined for a trigger, that trigger will fire on either of the Events. The opposite is true for Conditions, where all of them have to be met for the Actions to be executed. Your best bet would to define an Event specifying a unit entering a region, with a condition specifying what region. Then in your actions, you can use an if statement to check what that unit is doing and perform an action if it is doing what you are looking for, otherwise do nothing. |
| 01-29-2003, 01:02 AM | #3 |
Guest | alright, seems like you're right in that regions can only be checked via events, so I made it the event.. I use this trigger basically to move units that have somehow lost their orders (it happens occasionally), and then I need to move them, since they're stuck.. but where they go and what they do is dependent on where they currently are.. say.. in red's area instead of blue's (I've marked out the appropriate areas) here's what I have: event: a unit enters redsarea <gen> condition: owner of triggering unit = player 12 <brown> action: if ((issued order) equal to stop) then do (unit - order (triggering unit) to move to (center of goal region <gen>)) else (do nothing) Will this get stuck units to move to the "goal region"? |
| 01-29-2003, 01:10 AM | #4 |
Guest | hmmmm.. doesn't seem to be working.. I just made a stopped unit. Must be something missing :bangH: |
| 01-29-2003, 01:32 AM | #5 |
The reasons why its not working is that there is no "Issued order." To answer your question however, I would make and Boolean variable array and then just set it True when for every Event complete. Heres an example Trigger 1 Events: Player issued order stop Condition: Put your condition for event above ONLY Actions: set EventCheck[1] = True If (EventCheck[1] = True) and (EventCheck[2] = True) then Run trigger (The one inwhich what happens after both events are complete) without condtions else do nothing set EventCheck[1] = False Trigger 2 Events: Unit enter Region 1 Condtions: same as above conditions Actions: Set EventCheck[2] = True Under this put the same If/then/else statement as above. You also might want to check if the Unit leaves the region too to check off the Eventcheck[2]. Hopefully this helps! |
| 01-29-2003, 01:57 AM | #6 |
Guest | That will probably work.. so thanks.. (unless I'm not thinking of something).. won't i need to reset the array often though? my only concern is this... A lot of units enter through the region.. so it'll fire that 2nd trigger a heck of a lot... i wonder if it'll cause massive lag.. |
| 01-29-2003, 02:08 AM | #7 |
Guest | Actually, there is a problem... you say.. such and such a unit enters a region. The problem is, I don't know what that unit will be since a unit that loses its orders will be random. So I can't make trigger 2 work.. since it's either too general or too specific.. |
| 01-29-2003, 02:15 AM | #8 |
Guest | I see a workaround to it....but will this work? ie... if I can "tag" the unit somehow.. ie... event: unit is issued an order with no target (something like that) condition: unit owner = player 12 action: change the ownership to another player (say.. player 10) event: unit enters red area condition unit owner = player 10 action: make unit move to such and such a point change ownership back to player 12 |
| 01-29-2003, 02:42 AM | #9 |
Guest | hmmm.. this crashed my game.. the changing ownership thing.. i'm not quite sure why... |
| 01-29-2003, 06:20 AM | #10 |
Hah! Just figured out a better way to use the Unit enters trigger. Instead of having 2 triggers just have 1 like this Events:Player unit is issued an order (stop) Conditions: Order = Stop Boolean Condtion:(Units is in unit group)Triggering Unit is Region 1 Actions: Bla bla bla. I think that won't cause lag but test it first. |
| 01-30-2003, 05:17 AM | #11 |
Guest | I ended up doing something different.. the event is.. the unit is issued an order with no target then I move him to the center of the map. except I set up barrier regions which he will run into. That way, I will know where he's coming from and where he should be going. |
