I wanted to create a trigger that kills two units that get too close within one another. I tried using the "Unit Enters/Leaves Range of Unit" event in the trigger editor but it will only allow me to specify a unit that currently exists in the map and only one unit at a time (rather than all units)... I want this condition to exist for all current and future units that are created while the game progresses but I don't know how to implement this. I would greatly appreciate any help.
Create a search behavior that applies a separate behavior on units within radius X with duration 1 and apply the search behavior to every unit. Then in triggers, pick each unit in Entire Map and check if (picked unit) has behavior#2. If TRUE, kill the picked unit, ELSE do nothing. Run this on a loop that repeats every 0.25 seconds or something similar.
use the "Any unit" in your event Unit enters region or use data only solution similiar to bashar but instead of using a behavior effect apply a damage effect with kill flag.
Ah yeah the number of possibilities is relatively high.... but personnally I like triggers cause I worked more with them and the performance between the paths are almost identical.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I wanted to create a trigger that kills two units that get too close within one another. I tried using the "Unit Enters/Leaves Range of Unit" event in the trigger editor but it will only allow me to specify a unit that currently exists in the map and only one unit at a time (rather than all units)... I want this condition to exist for all current and future units that are created while the game progresses but I don't know how to implement this. I would greatly appreciate any help.
@HapticMaster: Go
Create a search behavior that applies a separate behavior on units within radius X with duration 1 and apply the search behavior to every unit. Then in triggers, pick each unit in Entire Map and check if (picked unit) has behavior#2. If TRUE, kill the picked unit, ELSE do nothing. Run this on a loop that repeats every 0.25 seconds or something similar.
@HapticMaster: Go
use the "Any unit" in your event Unit enters region or use data only solution similiar to bashar but instead of using a behavior effect apply a damage effect with kill flag.
You should take bashar's example, but you should put the event when behavior #2 becomes active, so you will take a lot less place in your script.
@tatatatate: Go
Alternatively just have behavior#2 kill the unit ;)
@tatatatate: Go
Alternatively just have behavior#2 kill the unit after a short delay ;)
@BasharTeg: Go
Ah yeah the number of possibilities is relatively high.... but personnally I like triggers cause I worked more with them and the performance between the paths are almost identical.