I need a trigger that removes units within a region, but only if there are two units within that region. Easy probably, but I've been trying to figure out for a good hour or 2.
General - Repeat (Actions) forever
Actions
General - Wait 0.2 Game Time seconds
Unit - Kill (Unit 2 from (Any units in Neutral Die owned by player 0 matching Excluded: Missile, Dead, Hidden, with at most Any Amount))
Make sure you create an event or place a "run trigger" in your map initialization trigger.
I have a region named Kill zone. When there are two units within the kill zone, I want it to kill both of those units, or remove them from the game. Doesnt matter. If there's one unit there, thats fine, but 2 = death. This trig doesnt seem to be doing that?
what this does, if a unit enters your kill zone, it will check to see if there are to of X type, if so, it kills them by adding them to a temp unit group.
General - Repeat (Actions) forever
Actions
General - Wait 0.2 Game Time seconds
Unit - Kill (Unit 2 from (Any units in Neutral Die owned by player 0 matching Excluded: Missile, Dead, Hidden, with at most Any Amount))
What it is saying is "kill 2 units (any unit sin region "neutral die" owned by player X).
k seriously!! Pokeme, this is your frigging 4th thread asking a stupid question you could of found out yourself if you spent 5 minutes reading a tutorial or 10 minutes thru trial and Error. 2 hours my ass.
Next Thread you make, you better show that you atleast TRIED to figure it out.
im sorry gorang, but thats not whats happening it is only killing 1 at a time, but its killing tem so fast, it looks like that. I tried the code myself, it does not work the way the OP needs the code to work. [and that IS a unit group...] the proof of this is, all but 1 unit will die...
for someone who is just starting this editor, that IS "complicated" its not as simple as sc where thats all you have to say, you now if to get the units from the region via unit groups...and you cant just kill them, you have to pick them from a unit group to kill them fast... for a new user, its a lot to do.
Rollback Post to RevisionRollBack
Random Information
Tutorials - Map Development - Galaxy wiki
|Issues? PM me|
Molsters code is right.. the only thing about his code is you also need to make a second trigger that if the unit LEAVEs the region, then he will be removed from that unit group.. that way when a unit enters the region next, it wont insta kill both of them even though they arent both in the region.
Didn't read all the info, but I'd do something like this.
"I have a region named Kill zone. When there are two units within the kill zone, I want it to kill both of those units, or remove them from the game. Doesnt matter. If there's one unit there, thats fine, but 2 = death. This trig doesnt seem to be doing that?"
This takes the region Entry1Left and any time a unit enters it, it does a condition check counting the number of enemy units to player 1 within Entry1Left. if at least 2 enemies are within the region, it continues the trigger. The action picks each unit in the region who are enemies and kills them, but it stops after finding 2.
If you want it to kill all units in the region if there's 2+, (such as if there's 3 units and 2 enter the area at the same time, the 3rd one may stay alive if the previous 2 were killed prior to the second entry code triggering for the 3rd unit occuring), change the "With at most 2" to with at most any. Then it'll trigger if 2+, and kill any in the region when the trigger occurs.
Untitled Trigger 001
Events
Unit - Any Unit Enters Entry1Left
Local Variables
Conditions
(Number of Living units in (Units in Entry1Left having alliance Enemy with player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) >= 2
Actions
Unit Group - Pick each unit in (Units in Entry1Left having alliance Enemy with player 1 matching Excluded: Missile, Dead, Hidden, with at most 2) and do (Actions)
Actions
Unit - Kill (Picked unit)
Edit: Looks like I'm a lot like Molsterrs. Mine doesn't have the problem Padiwana noted either, since it will only kill if units are in the specified region.
I updated it in the 2nd post, its a dynamic unit group, so it remakes the unit group each im a unit enters, so if a unit leaves, they wont be included when the trigger runs again, so ahead of you =)
i trashed what i said,.. lol, molaster i didnt test ur triggers just scanned it lol, oh well.. trashed what ui woulda done as a trigger but what u say is golden lol
Well for my needs I just needed 2 of every unit that enters the zone to die. My code works for this.
Oh bring back the days of simple Age of Empires 2 Conquerors triggers :(
I need a trigger that removes units within a region, but only if there are two units within that region. Easy probably, but I've been trying to figure out for a good hour or 2.
General - Repeat (Actions) forever
Actions
General - Wait 0.2 Game Time seconds
Unit - Kill (Unit 2 from (Any units in Neutral Die owned by player 0 matching Excluded: Missile, Dead, Hidden, with at most Any Amount))
Make sure you create an event or place a "run trigger" in your map initialization trigger.
@gorang: Go
Not sure if this is what I need.
I have a region named Kill zone. When there are two units within the kill zone, I want it to kill both of those units, or remove them from the game. Doesnt matter. If there's one unit there, thats fine, but 2 = death. This trig doesnt seem to be doing that?
Note: Typing this from memory. Don't have the GE on this PC.
Event: Any unit enters region (kill zone)
Condition: Number of unit in region (Kill zone) >= 2
Actions: Pick each unit in unit group (All units in region (kill Zone)) and do Actions
Actions 2: Kill (Picked Unit)
what this does, if a unit enters your kill zone, it will check to see if there are to of X type, if so, it kills them by adding them to a temp unit group.
@Pokemeplx:
Sure it does, look at it.
General - Repeat (Actions) forever
Actions
General - Wait 0.2 Game Time seconds
Unit - Kill (Unit 2 from (Any units in Neutral Die owned by player 0 matching Excluded: Missile, Dead, Hidden, with at most Any Amount))
What it is saying is "kill 2 units (any unit sin region "neutral die" owned by player X).
Done.
It works because I require it for my map too.
@gorang: Go
thts not what the code would do, it would kill unit 2 from hat unit group, aka the 2nd unit placed in that unit group, not 2 units.
same as my one above but moved the IF statmnt to the conditions...works a bit better
@Molsterr:
It kills two units that are placed in the region.
would you like a video?
There is no unitgroup.
I must have watched 2 units die over 1,000 times now every 0.2 game seconds.
I know what the code does.
k seriously!! Pokeme, this is your frigging 4th thread asking a stupid question you could of found out yourself if you spent 5 minutes reading a tutorial or 10 minutes thru trial and Error. 2 hours my ass.
Next Thread you make, you better show that you atleast TRIED to figure it out.
Read a tutorial on Triggers like i did
@gorang: Go
im sorry gorang, but thats not whats happening it is only killing 1 at a time, but its killing tem so fast, it looks like that. I tried the code myself, it does not work the way the OP needs the code to work. [and that IS a unit group...] the proof of this is, all but 1 unit will die...
If units in region owned by player "#" = 2
then kill units.
I dont understand whats so complicated.
@RockJohnAxe: Go
for someone who is just starting this editor, that IS "complicated" its not as simple as sc where thats all you have to say, you now if to get the units from the region via unit groups...and you cant just kill them, you have to pick them from a unit group to kill them fast... for a new user, its a lot to do.
1 at a time, from the SECOND unit.
1 unit, no die
2 units = death
@gorang: Go
but it only will kill 1 unit , Yes it will only kill a unit if 2 are there, but it wont kill them both. There will always be a unit leftover.
@Molsterr: Go
Molsters code is right.. the only thing about his code is you also need to make a second trigger that if the unit LEAVEs the region, then he will be removed from that unit group.. that way when a unit enters the region next, it wont insta kill both of them even though they arent both in the region.
Didn't read all the info, but I'd do something like this.
"I have a region named Kill zone. When there are two units within the kill zone, I want it to kill both of those units, or remove them from the game. Doesnt matter. If there's one unit there, thats fine, but 2 = death. This trig doesnt seem to be doing that?"
This takes the region Entry1Left and any time a unit enters it, it does a condition check counting the number of enemy units to player 1 within Entry1Left. if at least 2 enemies are within the region, it continues the trigger. The action picks each unit in the region who are enemies and kills them, but it stops after finding 2.
If you want it to kill all units in the region if there's 2+, (such as if there's 3 units and 2 enter the area at the same time, the 3rd one may stay alive if the previous 2 were killed prior to the second entry code triggering for the 3rd unit occuring), change the "With at most 2" to with at most any. Then it'll trigger if 2+, and kill any in the region when the trigger occurs.
Untitled Trigger 001
Events
Unit - Any Unit Enters Entry1Left
Local Variables
Conditions
(Number of Living units in (Units in Entry1Left having alliance Enemy with player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) >= 2
Actions
Unit Group - Pick each unit in (Units in Entry1Left having alliance Enemy with player 1 matching Excluded: Missile, Dead, Hidden, with at most 2) and do (Actions)
Actions
Unit - Kill (Picked unit)
Edit: Looks like I'm a lot like Molsterrs. Mine doesn't have the problem Padiwana noted either, since it will only kill if units are in the specified region.
@Padiwanazure: Go
I updated it in the 2nd post, its a dynamic unit group, so it remakes the unit group each im a unit enters, so if a unit leaves, they wont be included when the trigger runs again, so ahead of you =)
@Xackery: Go
I wouldn't use having alliance Enemy with player #, i would simply use units in region unit group. and mine dosnt have a problem =D
i trashed what i said,.. lol, molaster i didnt test ur triggers just scanned it lol, oh well.. trashed what ui woulda done as a trigger but what u say is golden lol
Well for my needs I just needed 2 of every unit that enters the zone to die. My code works for this.
Oh bring back the days of simple Age of Empires 2 Conquerors triggers :(
@gorang: Go
no joke, I love the power we have.. but it comes with a headache haha