HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

plz help whit this trigger

09-08-2002, 09:37 PM#1
tuigi
i want a triger that makes that if there are 5 (X) units beloging to any player at a selected region, somethin happens
09-08-2002, 11:04 PM#2
Guest
I would probably do it this way, course I know there is a better way...

First Trigger:
Event- Unit Enters region
Conditions- Unit Controller and Unit-Type Check
Actions- Set Variable UnitsInRegion to UnitsInRegion+1

Second Trigger
Periodic Events- Checks every 5 seconds
Conditions- Integer Comparison UnitsInRegion = 5
Action- Whatever you want it to do and disable the First Trigger and this trigger.

There is probably a better way, just toy around with it :)
09-08-2002, 11:10 PM#3
Guest
You should open up commando wars. i am sure the trigger he uses for the upgrades would work. although there is a bug with more than 2 units right? :)
09-09-2002, 12:08 AM#4
tuigi
tnkz i will try that
09-09-2002, 11:27 AM#5
Guest
There is a logic flaw with that bit o code. It never checks to see if the unit stays in that spot. A better way would be to do the code : if number of units controlled by that player in that region
09-09-2002, 01:25 PM#6
h0pesfall
or make another trigger that sets the variable -1 if a unit leaves
09-09-2002, 04:45 PM#7
Guest
When a unit enters the region, put all the units in the region owned by the player into a clear unit group. Then do an integer comparison on the "number of units in unit group" in an If statement, which can then enquque or run your next trigger.
09-09-2002, 05:54 PM#8
Guest
Creating a Unit group is unessesary. When you do an Integer comparison, you can count all the units in the region matching any conditions you want.
09-09-2002, 08:05 PM#9
Newhydra
Except units aren't in a region when they set off the "enters region" event...just something to keep in mind (this could have been fixed from beta)
09-09-2002, 09:09 PM#10
Guest
No, it wasn't fixed. You could just create another, slightly larger region around the one that triggers the event though.
09-10-2002, 08:20 PM#11
Newhydra
Yes, I didn't mean it was impossible to get around that problem, and you'd want to make a smaller region that triggers the event (so they'd *have* to be inside the large region to set off the event) not the other way around ; )

Edit-Ah yes, I read that too quickly...saw it as create larger region around the smaller region to trigger the event..
09-10-2002, 09:04 PM#12
Guest
Yes, I said a larger region AROUND the one that triggers the event.
09-11-2002, 11:35 AM#13
tuigi
i just tried the trigger and i cant find this
Actions- Set Variable UnitsInRegion to UnitsInRegion+1
09-11-2002, 07:08 PM#14
tuigi
plz send me a map whit the trigger already made cause i cant find most of the things you say.