Problem with "lost of zone" control

thevoden

New Member
Reaction score
5
Basically I want it so that whenever a unit dies (a building; fire, grass or rock edifaces) that the "zone of control" is lost.

The rules are simple:
- Whenever you build an ediface in a region, you "gain" control of that region.
- So lets say you build 3 edifaces in that region, the opponent must destroy 3 in order for you to "lose" control of that region.

The problem comes into play when an opponent only destroys 1 ediface it causes the player to "lose" control of their region (while they have 2 other buildings / edifaces in that same region ). I want it to somehow make the player "lose" control of the region when he / she has no more edifaces built in that certain region.

So far this is what I have.



JASS:
Region Control Lost
    Events
        Unit - A unit Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                Or - Any (Conditions) are true
                    Conditions
                        (Unit-type of (Dying unit)) Equal to Fire Ediface
                        (Unit-type of (Dying unit)) Equal to Grass Ediface
                        (Unit-type of (Dying unit)) Equal to Rock Ediface
    Actions
        Game - Display to (All players) the text: Step 1 Control Lost...
        For each (Integer A) from 1 to 16, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (start_REGION_set[(Integer A)] contains (Dying unit)) Equal to True
                        build_REGIONS_controlled[(Integer A)] Equal to True
                        (start_REGION_set[(Integer A)] contains (Dying unit)) Equal to False
                    Then - Actions
                        Game - Display to (All players) the text: Step 2 Control Lost...
                        Set build_REGIONS_controlled[(Integer A)] = False
                        Set Player_Number_RegionsControl[(Player number of (Triggering player))] = (Player_Number_RegionsControl[(Player number of (Triggering player))] - 1)
                        Game - Display to (All players) the text: (You have lost a zone!  + (You now control  + ((String(Player_Number_RegionsControl[(Player number of (Triggering player))])) +  zone(s). )))
                    Else - Actions


p.s. - how do you remove the Press Any Key To Continue on your map loading? I want it to start the game automatically.

I tried inserting game texts with this too so I can know when the trigger fires and such.
 

Menelaus

New Member
Reaction score
9
Code:
Untitled Trigger 001
    Events
        Unit - A unit finishes construction
    Conditions
        (zone1 <gen> contains (Constructed structure)) Equal to True
    Actions
        Unit Group - Add (Triggering unit) to zonegroup[1]


that should add the unit to a group and then u can check if all the units in the group died
 

thevoden

New Member
Reaction score
5
I need like an exact trigger please. I tried doing it but there was always something messed up.
 

Technomancer

New Member
Reaction score
14
You don't have a check to see if there are no more units in the region. First you need a way to get the region from the dying unit; you can look it up through location if you want, then the rest should be easy enough.
 

thevoden

New Member
Reaction score
5
You don't have a check to see if there are no more units in the region. First you need a way to get the region from the dying unit; you can look it up through location if you want, then the rest should be easy enough.

How can I look up a dying unit through a location? Can you give like an example? But yeah what did i do wrong with my triggers?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top