Sorry to be a nuisance, but I can't find a way to trigger an event when any 2 units gets close to each other. It would be even better if I could check if they both have a behav.
Another question, I want to create a cover system. I already have a chance to hit system based on whatever I want (Unit type, range, time spent firing, whether either unit recently moved, veterancy, height difference etc.) but I want to create a system of cover based on a randomly generated terrain (Rocks in the mountains, trees in the forest etc). I'm guessing the best way to go about it would be to draw a line of points between the attacker and the atackee and see if there is anything in the way. Is there a more efficiant way to do this?
There's no trigger with a "units are close" event. What you can do instead is have a periodic trigger that fires every second or so, and check the distance of your two units (use distance between points and then use 'position of unit' to get the points). If it's under whatever value, then run your trigger. Something like this:
Event:Periodic,every1gamesecondConditions:DistancebetweenPoints(PositionofMarine1&PositionofMarine2)<5Actions://Your marines are now close together.//Make sure you turn off the trigger or it's going to keep running every second that they are close together
Rollback Post to RevisionRollBack
Feel free to Send me a PM if you have any questions/concerns!
i was thinking he could create a region and attach it to the unit and when another unit enters it run actions...? but i like how zeldarules28 has it in the conditions. probably would have to make a couple triggers like that one if you want different distances.... <5, <10, >3... and so on. just a thought :D.
Go data and use a search behavior that applies an invisible buff if it finds specified unit. Then do a trigger that checks for that behavior in a unit with a periodic event? I'm guessing that would be less intensive, trigger-wise.
UntitledTrigger001EventsUnit-AnyUnitEntersadistanceof1.0fromUnitLocalVariablesConditions((Triggeringunit)hasBehavior)==TrueActions------- do stuff
This method only works for pre-placed units though, since the event needs a specific unit. However, you can use custom script to add this event to a trigger during runtime, specifying a unit created while playing.
Thank you for all the responses. As much as I hate the data editor, I decided to use Neonsz's idea, and an extra validator made it work just like I wanted. Thank you guys so much :)
Does anyone have any advice for the cover system, or should I just go implement this one?
Whenever a unit attacks, I control the damage and chance to hit via a trigger. I can spawn an invisible unit that runs between the attacker and the defender. If it passes through a certain distance of the 'cover' unit (Whether it be a rock, tree, or building), then it will modify the chance to hit accordingly.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Sorry to be a nuisance, but I can't find a way to trigger an event when any 2 units gets close to each other. It would be even better if I could check if they both have a behav.
Another question, I want to create a cover system. I already have a chance to hit system based on whatever I want (Unit type, range, time spent firing, whether either unit recently moved, veterancy, height difference etc.) but I want to create a system of cover based on a randomly generated terrain (Rocks in the mountains, trees in the forest etc). I'm guessing the best way to go about it would be to draw a line of points between the attacker and the atackee and see if there is anything in the way. Is there a more efficiant way to do this?
I don't quite understand, it seems like your trying to makes a physics engine.
@AnOddRadish: Go
There's no trigger with a "units are close" event. What you can do instead is have a periodic trigger that fires every second or so, and check the distance of your two units (use distance between points and then use 'position of unit' to get the points). If it's under whatever value, then run your trigger. Something like this:
@AnOddRadish:
@zeldarules28:
i was thinking he could create a region and attach it to the unit and when another unit enters it run actions...? but i like how zeldarules28 has it in the conditions. probably would have to make a couple triggers like that one if you want different distances.... <5, <10, >3... and so on. just a thought :D.
@tdhsst: Go
Yours would actually be less intensive actually, and it is the apporach I would recommend.
Go play Antioch Chronicles Remastered!
Also, coming soon, Antioch Episode 3: Thoughts in Chaos!
Dont like mapster's ugly white? Try Mapster's Classic Skin!
Go data and use a search behavior that applies an invisible buff if it finds specified unit. Then do a trigger that checks for that behavior in a unit with a periodic event? I'm guessing that would be less intensive, trigger-wise.
There is also this event:
This method only works for pre-placed units though, since the event needs a specific unit. However, you can use custom script to add this event to a trigger during runtime, specifying a unit created while playing.
Thank you for all the responses. As much as I hate the data editor, I decided to use Neonsz's idea, and an extra validator made it work just like I wanted. Thank you guys so much :)
Does anyone have any advice for the cover system, or should I just go implement this one?
Cover system would require you to implement an entire physics system I think. I believe that's rather difficult ^o^
Nope, I figured it out.
Whenever a unit attacks, I control the damage and chance to hit via a trigger. I can spawn an invisible unit that runs between the attacker and the defender. If it passes through a certain distance of the 'cover' unit (Whether it be a rock, tree, or building), then it will modify the chance to hit accordingly.