region as variable, what's wrong?

akuzaid93

New Member
Reaction score
3
Code:
For each (Integer A) from 1 to 15, do (Actions)
    Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Hostile_Spawn_Region[(Integer A)] owned by Neutral Hostile)) Equal to 0
            Then - Actions
                Unit Group - Pick every unit in HostileUnitGroup[(Random integer number between 1 and 15)] and do (Actions)
                    Loop - Actions
                        Unit - Create 1 (Unit-type of (Picked unit)) for Neutral Hostile at (Center of Hostile_Spawn_Region[1]) facing (Random real number between 0.00 and 360.00) degrees
            Else - Actions

Why can't this works?
when the map started, what happen is all the units are created at center of map.
I have set the Unit HostileUnitGroup var and the Hostile_Spawn_Region var.
so what's wrong?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
So everything is working correctly, except for the fact that the units are being created at the center of the map, rather than Hostile_Spawn_Region[1]?

Could you post your code as to setting the Hostile_Spawn_Region[1] variable?
 

akuzaid93

New Member
Reaction score
3
Code:
For each (Integer A) from 1 to 15, do (Actions)
    Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Hostile_Spawn_Region[(Integer A)] owned by Neutral Hostile)) Equal to 0
            Then - Actions
                Unit Group - Pick every unit in HostileUnitGroup[(Random integer number between 1 and 15)] and do (Actions)
                    Loop - Actions
                        Unit - Create 1 (Unit-type of (Picked unit)) for Neutral Hostile at (Center of Hostile_Spawn_Region[(Integer A)]) facing (Random real number between 0.00 and 360.00) degrees
            Else - Actions

edit
Unit - Create 1 (Unit-type of (Picked unit)) for Neutral Hostile at (Center of Hostile_Spawn_Region[(Integer A)]) facing (Random real number between 0.00 and 360.00) degrees

Code:
Actions
    Set Hostile_Spawn_Region[1] = mons Copy 5 <gen>
    Set Hostile_Spawn_Region[2] = mons Copy 4 <gen>
    Set Hostile_Spawn_Region[3] = mons Copy 6 <gen>
    Set Hostile_Spawn_Region[4] = mons Copy 3 <gen>
    Set Hostile_Spawn_Region[5] = mons Copy 7 <gen>
    Set Hostile_Spawn_Region[6] = mons Copy 2 <gen>
    Set Hostile_Spawn_Region[7] = mons Copy 14 <gen>
    Set Hostile_Spawn_Region[8] = mons Copy <gen>
    Set Hostile_Spawn_Region[9] = mons Copy 8 <gen>
    Set Hostile_Spawn_Region[10] = mons <gen>
    Set Hostile_Spawn_Region[11] = mons Copy 11 <gen>
    Set Hostile_Spawn_Region[12] = mons Copy 10 <gen>
    Set Hostile_Spawn_Region[13] = mons Copy 12 <gen>
    Set Hostile_Spawn_Region[14] = mons Copy 13 <gen>
    Set Hostile_Spawn_Region[15] = mons Copy 9 <gen>

this is defined at the first 0.20 second
while the previous tigger only runs every 45 seconds.
 

Parsival

Active Member
Reaction score
6
Hi,

when the map started
while the previous tigger only runs every 45 seconds.
Hmmm. Nice.

this is defined at the first 0.20 second
It can be done during the map initialization.

Well. So weird problem. If everything except place of spawning works, the reason must be elsewhere.
When variable of type 'Region' is not defined, it refers to playable map area.
No idea. :(
 

akuzaid93

New Member
Reaction score
3
sorry, i mean after 45 seconds, what happen is all the units are created at center of map.
 

vypur85

Hibernate
Reaction score
803
This might not address the problem, looking at the symptoms.

But you can try adding values to the array size of your variables (region and unit group), if you haven't already done so.
Can't see any other problems as of yet.

Post complete trigger.
 

akuzaid93

New Member
Reaction score
3
i think the #3 post is complete enough. exept this,,

Code:
HostileUnitGroup Definer
    Events
        Time - Elapsed game time is 2.10 seconds
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in mons <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[6]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[15]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 2 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[7]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 3 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[8]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 4 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[9]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 5 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[10]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 6 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[11]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 7 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[12]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 8 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[13]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 9 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[14]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 10 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[1]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 11 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[2]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 12 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[3]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 13 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[4]
                    Else - Actions
        Unit Group - Pick every unit in (Units in mons Copy 14 <gen>) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit Group - Add (Picked unit) to HostileUnitGroup[5]
                    Else - Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Picked unit)) Equal to Neutral Hostile
                    Then - Actions
                        Unit - Hide (Picked unit)
                        Unit - Move (Picked unit) instantly to (Center of choosehero <gen>)
                        Unit - Pause (Picked unit)
                    Else - Actions
        Unit - Create 1 Frostmourne Pedestal for Neutral Hostile at (Center of Region 047 <gen>) facing Default building facing degrees
        Unit - Create 1 (Unit-type of Salamander Lord 0213 <gen>) for Neutral Hostile at (Center of mons Copy 15 <gen>) facing 0.00 degrees

*if i can make this shorter, tel me how to do that
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top