So I'm just messing around with triggers right now and i have an array that holds 4 regions (one for each player) that i access with the player number during triggers. the problem is that it is initially empty and will create a region when your "hero" moves within range of an enemy unit... kinda like a little battle area type thing. I don't want a fixed region as i want to be able to change the size of the region/add to it if another player enters it but have it always start the same size.
The problem is i cant seem to create any events that will trigger if you or another player enter or leave that area. I am assuming because it is initialized to not having a region i can't seem to pick it as a variable in event triggers... So I thought it would be a good idea to just ask if there was a way around this or if I'm just being stupid as I'm quite new to this and maybe i shouldn't be using triggers or an array for this.
Why don't you just create the 4 regions on your map to begin with, then when a hero is created attach the region to that hero? This will allow you to use them in events.
Alternatively you can probably mess around with the Unit enters range of another unit event and get a similar result, if you need to dynamically create "points"
I don't quite understand your question... but I'm gonna take a shot at answering it...
This "Event" may or may not be what you are looking for...
Unit - Any Unit Enters (Region((Position of (Triggering unit)), 2.0))
The first have is self explanitory, the second half is
Region: (Convert Circle to Region(Center: (Position of Unit: (someUnit), Radius: 2)))
This will tell you when a unit enters within a range of another unit.
If that doesn't answer your question...
Create a region variable, and set this variable to the "last created region" after you create the region... then you can refer to the region via the variable name before the region is created. Just be warned you'll need to check to make sure the region exsists before you try to do anythign to it
what you can do however. is just make a trigger that is only "on" when you need it to be run. then just have it run on a 3 second timer or w/e with a condition
((Closest unit to <i used a point> in <Unit Group you want to as Trigger> is in (Region(<Point>, <Radius>))) == true
Anthius Does that actually work.... From my testing Ive found that the only way to get the event to fire is to base the region off of a pre-existing object
by pre-existing i mean somehing that was added in the terrain editor prior to running the game.
meaning the following Event wont fire
Unit - Any Unit Enters (Region((Position of (Triggering unit)), 2.0)) The first have is self explanitory, the second half is Region: (Convert Circle to Region(Center: (Position of Unit: (someUnit), Radius: 2)))
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
If you create a variable, and store the unit you want to check in the variable as the unit is created (most easily using the last created unit) I don't see why it shouldn't work. If you can't get it to work this way, let me konw and I'll get it working... but it should be...
Global Variable(type unit): someUnit
(NOTE: You may want it to be a unit or a unit group. either way, some functions are going to need you to convert it to the other)
Initialization Trigger (or what ever is creating the unit)
Actions:
Create Unit (unitToTriggerEvent)
Variable: someUnit = last created unit
Then use this variable in your trigger.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
So I'm just messing around with triggers right now and i have an array that holds 4 regions (one for each player) that i access with the player number during triggers. the problem is that it is initially empty and will create a region when your "hero" moves within range of an enemy unit... kinda like a little battle area type thing. I don't want a fixed region as i want to be able to change the size of the region/add to it if another player enters it but have it always start the same size.
The problem is i cant seem to create any events that will trigger if you or another player enter or leave that area. I am assuming because it is initialized to not having a region i can't seem to pick it as a variable in event triggers... So I thought it would be a good idea to just ask if there was a way around this or if I'm just being stupid as I'm quite new to this and maybe i shouldn't be using triggers or an array for this.
@Argonanth: Go
I do believe that Events require Preexisting Regions to be used
The good news is that you can move these regions and resize them and the Event should fucntion properly
This is not the case when using Points for The Events
Why don't you just create the 4 regions on your map to begin with, then when a hero is created attach the region to that hero? This will allow you to use them in events.
Alternatively you can probably mess around with the Unit enters range of another unit event and get a similar result, if you need to dynamically create "points"
I don't quite understand your question... but I'm gonna take a shot at answering it...
This "Event" may or may not be what you are looking for... Unit - Any Unit Enters (Region((Position of (Triggering unit)), 2.0)) The first have is self explanitory, the second half is Region: (Convert Circle to Region(Center: (Position of Unit: (someUnit), Radius: 2)))
This will tell you when a unit enters within a range of another unit.
If that doesn't answer your question... Create a region variable, and set this variable to the "last created region" after you create the region... then you can refer to the region via the variable name before the region is created. Just be warned you'll need to check to make sure the region exsists before you try to do anythign to it
@Argonanth:
short answer you can't
what you can do however. is just make a trigger that is only "on" when you need it to be run. then just have it run on a 3 second timer or w/e with a condition
((Closest unit to <i used a point> in <Unit Group you want to as Trigger> is in (Region(<Point>, <Radius>))) == true
Anthius Does that actually work.... From my testing Ive found that the only way to get the event to fire is to base the region off of a pre-existing object
by pre-existing i mean somehing that was added in the terrain editor prior to running the game.
meaning the following Event wont fire
Unit - Any Unit Enters (Region((Position of (Triggering unit)), 2.0)) The first have is self explanitory, the second half is Region: (Convert Circle to Region(Center: (Position of Unit: (someUnit), Radius: 2)))
If you create a variable, and store the unit you want to check in the variable as the unit is created (most easily using the last created unit) I don't see why it shouldn't work. If you can't get it to work this way, let me konw and I'll get it working... but it should be...
Global Variable(type unit): someUnit (NOTE: You may want it to be a unit or a unit group. either way, some functions are going to need you to convert it to the other)
Initialization Trigger (or what ever is creating the unit) Actions: Create Unit (unitToTriggerEvent) Variable: someUnit = last created unit
Then use this variable in your trigger.