I want a setup where when a unit enters a region, they will be given an order to a point. See bottom of post if you want a little bit more of an in-depth explantion;
I have two options as to how to do this:
1) 12 triggers (each with same/similar actions)
the only difference between these 12 would be the action, which region they are entering. The region they are sent to is a constant point, so I would like to know what I can do in JNPG possible with vJass to set up these points as constant variables.
2) One Trigger that loops through & determines which region was entered.
I don't know if this would be more efficient or not. A variation of this is that perhaps I would have Trigger1 that has the actions I want upon entering say, Regions 1,2,3,5,6,7,8. Then Trigger2 could have actions I want upon entereing 4,9,10,11,12.
Which would be more efficient? (Something else to note is that units are spawned in groups of ~3 and then sent into the grid, so maybe use a UG variable?)
If I used option 2, I would need some indexing with Point variables, so would they still be allowed to be constants?
Explanation of triggers;
[1--2--3--4 ]
[5--6--7--8 ]
[9--10-11-12]
so its a 4x3 grid. All units enter the grid through Region 1. Then, that unit is told to go to either 2 or 5, based on a roll.
IF enters 2: go to --> 3 or 6.
IF enters 5: go to--> 6 or 9.
When a unit enters an edge, they have only 1 option to advance. Examples of this are 4,9,10,11, and 12. My concept of this is still kind of fuzzy. So far ive jsut made 12 triggers, and I may keep it so if it the most efficient route to go.
Here's basically the trig;
I want to remove the 4 lines of code with setting and removing the location variable, and just have, "Order unit to go to REGION2." CasterLoc is a volatile variable thats only good with no waits and stuff, so just ignore it.
*edit*
Sorry, gonna ask two in one here. If I want to get last created item, do I want to call GetLastCreatedItem, or just use bj_lastCreatedItem?
I have two options as to how to do this:
1) 12 triggers (each with same/similar actions)
the only difference between these 12 would be the action, which region they are entering. The region they are sent to is a constant point, so I would like to know what I can do in JNPG possible with vJass to set up these points as constant variables.
2) One Trigger that loops through & determines which region was entered.
I don't know if this would be more efficient or not. A variation of this is that perhaps I would have Trigger1 that has the actions I want upon entering say, Regions 1,2,3,5,6,7,8. Then Trigger2 could have actions I want upon entereing 4,9,10,11,12.
Which would be more efficient? (Something else to note is that units are spawned in groups of ~3 and then sent into the grid, so maybe use a UG variable?)
If I used option 2, I would need some indexing with Point variables, so would they still be allowed to be constants?
Explanation of triggers;
[1--2--3--4 ]
[5--6--7--8 ]
[9--10-11-12]
so its a 4x3 grid. All units enter the grid through Region 1. Then, that unit is told to go to either 2 or 5, based on a roll.
IF enters 2: go to --> 3 or 6.
IF enters 5: go to--> 6 or 9.
When a unit enters an edge, they have only 1 option to advance. Examples of this are 4,9,10,11, and 12. My concept of this is still kind of fuzzy. So far ive jsut made 12 triggers, and I may keep it so if it the most efficient route to go.
Here's basically the trig;
-
Enter3
-
Events
- Unit - A unit enters Region1
- Conditions
-
Actions
- Custom script: if GetRandomInt(1,2)==1 then
- Set CasterLoc = (Center of Region2)
- Unit - Order (Triggering unit) to Attack-Move To CasterLoc
- Custom script: else
- Set CasterLoc = (Center of Region5)
- Unit - Order (Triggering unit) to Attack-Move To CasterLoc
- Custom script: endif
- Custom script: call RemoveLocation(udg_CasterLoc)
-
Events
I want to remove the 4 lines of code with setting and removing the location variable, and just have, "Order unit to go to REGION2." CasterLoc is a volatile variable thats only good with no waits and stuff, so just ignore it.
*edit*
Sorry, gonna ask two in one here. If I want to get last created item, do I want to call GetLastCreatedItem, or just use bj_lastCreatedItem?
Last edited: