I want to have a Unit Enters Region/Point/Range of Unit event, but I can't specify a variable for the region, point or unit. I have a unit that is created via triggers, and I want that unit to be the source of an event whenever player units come within range of it. Anyone know a way to achieve this since I can't "feed" the created unit to the trigger...I have to store it into a global variable to access it, but then I can't seem to have the variable in the event.
That's impossible atm, you can't stick a changing variable into events. (design wise, constant variable still work). Current workaround is to get a region (constant that) and update its position to your unit's position, then use event: unit enter region: that constant region
I was trying to play around with Data Tables right now, since I noticed that you CAN reference a Data Table string in the event. Is it possible to use Data Tables to reference a specifically created unit?
It should be, but only if you create it via code/trigger. Then it's easy.
I think there actually is one event that is possible without datatables, I was working on it but it turned out it wasn't actually what I wanted anyway. I ended up using a periodic timer to check if a unit was in range.
Having said all of that, i think there may actually be another workaround
1. Have a bunch of specific pre-created regions on your map, they can be anywhere, probably in an unused corner
2. Setup your events for these regions, unit enters etc.
3. When you create a hero, attach one of the pre-created regions to the unit, so it may be Hero1Region etc.
I think you can attach a region so it actually moves with a unit? Not 100% sure.
The only thing I'm not sure on, is if you move a region so that the region enters the unit position, will this trigger a unit enters that region event.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I want to have a Unit Enters Region/Point/Range of Unit event, but I can't specify a variable for the region, point or unit. I have a unit that is created via triggers, and I want that unit to be the source of an event whenever player units come within range of it. Anyone know a way to achieve this since I can't "feed" the created unit to the trigger...I have to store it into a global variable to access it, but then I can't seem to have the variable in the event.
Thanks!
@ZarafFaraz: Go
That's impossible atm, you can't stick a changing variable into events. (design wise, constant variable still work). Current workaround is to get a region (constant that) and update its position to your unit's position, then use event: unit enter region: that constant region
Ok thanks.
I was trying to play around with Data Tables right now, since I noticed that you CAN reference a Data Table string in the event. Is it possible to use Data Tables to reference a specifically created unit?
It should be, but only if you create it via code/trigger. Then it's easy.
I think there actually is one event that is possible without datatables, I was working on it but it turned out it wasn't actually what I wanted anyway. I ended up using a periodic timer to check if a unit was in range.
Having said all of that, i think there may actually be another workaround 1. Have a bunch of specific pre-created regions on your map, they can be anywhere, probably in an unused corner 2. Setup your events for these regions, unit enters etc. 3. When you create a hero, attach one of the pre-created regions to the unit, so it may be Hero1Region etc.
I think you can attach a region so it actually moves with a unit? Not 100% sure.
The only thing I'm not sure on, is if you move a region so that the region enters the unit position, will this trigger a unit enters that region event.