I'm gonna have many regions that you can move between. So for example if you enter region 1 you move to region 2 and from 2 to 3, 3 to 4 and so on.I wanted to put all these regions in a single variable with array, but i cant know which region is which. There is no event called "Unit enters any region" and even if i do get an event up i still need the region in conditions and if i set up "Triggering region == MYREGION[]" i still need to put something between the "[]". So i click it and go to "Preset" and there's a lot of "Any" commands but no "Any integer". How can you do this?
There are several ways to tackling this which is mostly dependent on just how many regions you plan on using and what you are going to do with them. From what it sounds like you need to learn how arrays and loops work especially together. First you can do one of two things; either you have 1 trigger that has multiple events each with an "unit enters" and then specific individual regions. The other option is to run everything in an action definition instead of a trigger and use a loop instead that checks the distance between what i assume would be units and the different regions.
If you plan on using an array to store your regions all in a single variable you need to declare which specific region is which within the array by assigning it an integer value. This will also be very handy for looping through the different regions.
As for conditions you can then either have every region as a condition, use a return action for each region or again your best bet is the run a loop that picks each integer from the region array and does your actions in accordance to which array integer region is equal to the triggering region. Sounds like you've got some fun learning to do. I might have over explained it a little but trust me this is one thing you will want to follow up on (the loops and arrays thing)
Yes ofcourse i know how arrays work but i dont know how u can find them in an event. To be more clear: (All regions are in variable "Move")
Event: Any unit enters "1","2","3"... etc
Action: Move unit instantly to Move[ ]
Inside the [ ] i want to have like "number inside [ ] of the triggering region + 1", but i cant get that to work.
What found be even better is to have my reigons named "1 2", "2 1", "1 3" etc where the first number is the area u are currently in and the second number is the area ur unit will transport to. That way u can easily more back and forth from the different areas. Wht i tried was storing my regions in Global data table with names like "1 2", "2 1" etc and then using the action "Move triggering unit instantly to Center of ("Name" from the Global data table)". In the "Name" i wanted to get the triggering region and tehn just change the the numbers, so if triggering region is "1 2" then the unit would move to "2 1". Only problem is "Name" is a string and although u can convert a lot of types to strings, for some reason i cant find "Convert Region To String". If i just had that everything would work. ishhhhh
Ok, so your nearly there. You won't be able to select the triggering integer as you would like but you have to run a loop. Using the tree array is best. Have a integer loop check if the region (i) is equal to the triggering region and use the integer to select the second destination region.
Was just wondering if you had considered simply using a periodic trigger that goes through all of your regions each time, I know interval of 0.1 seconds shouldn't cause any noticeable lag, but could probably get away with a longer time for what you are doing. Just a thought.
I have now stored all the regions in Data Table with names such as "1.2", "1.3", "2.1" etc. THis mean the units move between 1.2 and 2.1, 1.3 and 3.1 and so on.
I use the "For each real"-loop with increment 0.1 to go through all the region names. Then i use some smart math to change places on the numbers so that "1.2" becomes "2.1" etc. Then use action to move the unit to Center of the region "Name from the Global data table", where Name is the converted real.
The only problem with this is that i dont get that far. because when i do the For Each Real loop, instead of getting nice values like 2.5 and 2.6 , i get 2.50146 and 2.60156 (increases 0.1001 every time when it should be just 0.1). I tried to remove these dumb decimals but wiht no luck. Hahhhh
--------Repeat this for each region-----------
region[region number][1] = starting region
region[region number][2] = ending region
---------------------------------------------
then make a trigger like that:
EVENT:
Unit Enters/Leaves Region
Unit: Any Unit
State: Enters
Region: Convert Preset To Region
Value: Any Region
ACTIONS:
General - Pick each integer from 1 to <number of regions>, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering region) == Regions[(Picked integer)][1]
Then
Unit - Move (Triggering unit) instantly to (Center of Regions[(Picked integer)][2]) (No Blend)
Else
Yes but the problem is was that i have many regions like that i dont know which pair with which when i call it in a variable array. I say "was" becaouse it works now. using real number didnt work as stated above so i just called the regions "1 2", "1 3", "2 1" etc and saves these with the same names in the Global data table (region). Then when a unit enters any of the region the action looks something like this:
For each integer i1 from 1 to 3 with increment 1
For each integer i2 from 1 to 3 with increment 1
set Region (string) = string(i1) + " " + string(i2)
if Region from Global data table == triggering region
Move triggering unit to center of (Word 2 of Region + " " + Word 1 of Region) from the Global data table
So if a unit walk into region "1 2", the trigger changes places of teh number and the units teleport to region "2 1"
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm gonna have many regions that you can move between. So for example if you enter region 1 you move to region 2 and from 2 to 3, 3 to 4 and so on.I wanted to put all these regions in a single variable with array, but i cant know which region is which. There is no event called "Unit enters any region" and even if i do get an event up i still need the region in conditions and if i set up "Triggering region == MYREGION[]" i still need to put something between the "[]". So i click it and go to "Preset" and there's a lot of "Any" commands but no "Any integer". How can you do this?
There are several ways to tackling this which is mostly dependent on just how many regions you plan on using and what you are going to do with them. From what it sounds like you need to learn how arrays and loops work especially together. First you can do one of two things; either you have 1 trigger that has multiple events each with an "unit enters" and then specific individual regions. The other option is to run everything in an action definition instead of a trigger and use a loop instead that checks the distance between what i assume would be units and the different regions.
If you plan on using an array to store your regions all in a single variable you need to declare which specific region is which within the array by assigning it an integer value. This will also be very handy for looping through the different regions.
As for conditions you can then either have every region as a condition, use a return action for each region or again your best bet is the run a loop that picks each integer from the region array and does your actions in accordance to which array integer region is equal to the triggering region. Sounds like you've got some fun learning to do. I might have over explained it a little but trust me this is one thing you will want to follow up on (the loops and arrays thing)
@hobbidude: Go
Yes ofcourse i know how arrays work but i dont know how u can find them in an event. To be more clear: (All regions are in variable "Move")
Event: Any unit enters "1","2","3"... etc
Action: Move unit instantly to Move[ ]
Inside the [ ] i want to have like "number inside [ ] of the triggering region + 1", but i cant get that to work.
What found be even better is to have my reigons named "1 2", "2 1", "1 3" etc where the first number is the area u are currently in and the second number is the area ur unit will transport to. That way u can easily more back and forth from the different areas. Wht i tried was storing my regions in Global data table with names like "1 2", "2 1" etc and then using the action "Move triggering unit instantly to Center of ("Name" from the Global data table)". In the "Name" i wanted to get the triggering region and tehn just change the the numbers, so if triggering region is "1 2" then the unit would move to "2 1". Only problem is "Name" is a string and although u can convert a lot of types to strings, for some reason i cant find "Convert Region To String". If i just had that everything would work. ishhhhh
Ok, so your nearly there. You won't be able to select the triggering integer as you would like but you have to run a loop. Using the tree array is best. Have a integer loop check if the region (i) is equal to the triggering region and use the integer to select the second destination region.
@LaxSalmon: Go
Was just wondering if you had considered simply using a periodic trigger that goes through all of your regions each time, I know interval of 0.1 seconds shouldn't cause any noticeable lag, but could probably get away with a longer time for what you are doing. Just a thought.
@Deadzergling: Go
I have now stored all the regions in Data Table with names such as "1.2", "1.3", "2.1" etc. THis mean the units move between 1.2 and 2.1, 1.3 and 3.1 and so on.
I use the "For each real"-loop with increment 0.1 to go through all the region names. Then i use some smart math to change places on the numbers so that "1.2" becomes "2.1" etc. Then use action to move the unit to Center of the region "Name from the Global data table", where Name is the converted real.
The only problem with this is that i dont get that far. because when i do the For Each Real loop, instead of getting nice values like 2.5 and 2.6 , i get 2.50146 and 2.60156 (increases 0.1001 every time when it should be just 0.1). I tried to remove these dumb decimals but wiht no luck. Hahhhh
generate an array like that:
regions[number of regions][2]
--------Repeat this for each region-----------
region[region number][1] = starting region
region[region number][2] = ending region
---------------------------------------------
then make a trigger like that:
EVENT:
Unit Enters/Leaves Region
Unit: Any Unit
State: Enters
Region: Convert Preset To Region
Value: Any Region
ACTIONS:
General - Pick each integer from 1 to <number of regions>, and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering region) == Regions[(Picked integer)][1]
Then
Unit - Move (Triggering unit) instantly to (Center of Regions[(Picked integer)][2]) (No Blend)
Else
@qwertziopuy: Go
Yes but the problem is was that i have many regions like that i dont know which pair with which when i call it in a variable array. I say "was" becaouse it works now. using real number didnt work as stated above so i just called the regions "1 2", "1 3", "2 1" etc and saves these with the same names in the Global data table (region). Then when a unit enters any of the region the action looks something like this:
For each integer i1 from 1 to 3 with increment 1
For each integer i2 from 1 to 3 with increment 1
set Region (string) = string(i1) + " " + string(i2)
if Region from Global data table == triggering region
Move triggering unit to center of (Word 2 of Region + " " + Word 1 of Region) from the Global data table
So if a unit walk into region "1 2", the trigger changes places of teh number and the units teleport to region "2 1"