• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Help with regions

Status
Not open for further replies.
Level 1
Joined
Jan 15, 2013
Messages
61
Hi guys. I am making a tag map like Troll and Elves or Vampirism, and i want to make a thing like this: the map is divided in many small zones with 1 entrance, what i want to make is to be able to build a flag that will allow only you to build in this zone. if someone knows how to do this please help with an example map with triggers included. Thx in advance and +rep
 
This sounds more like a request. Next time, diretly post it in request-section.


There are more ways to do it, you could try following..

Put your regions in region variable[array]. Also make make an Integer[array] variable.
Now lets say Player 3 builds a flag in Region [5] --> Set Integer[5] = 3 (5: because in region 5 ; 3: because Player 3)

Later if some1 wanna built in a region you can check if Integer[Index of affected Region] == PlayerNumberOf(Ownerof(TriggeringUnit)) or == 0 (noone has builded flag yet)

If not --> cancel
 
  • Set Region[1] = Region1
  • Set Region[2] = Region2
  • Set Region[3] = Region3
  • Events
    • Unit - A unit Finished building
  • Conditions
    • (Unit-type of (Triggering unit)) Gleich Flag
    • Aktionen
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (Region[(Integer A)] contains (Position of (Triggering unit))) == True
            • Then - Actions
              • Set OwnerOfRegion[(Integer A)] = (Player number of (Owner of (Triggering unit)))
            • Else - Actions
  • Start Building
    • Events
      • Unit - A unit starts building
    • Conditions
      • Actions
        • For each (Integer A) from 1 to 3, do (Actions)
          • Schleifen - Aktionen
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • 'IF'-Bedingungen
                • (Region[(Integer A)] contains (Position of (Triggering unit))) == True
                • OwnerOfRegion[(Integer A)] !== 0
                • OwnerOfRegion[(Integer A)] !== (Player number of (Owner of (Triggering unit)))
              • Then - Actions
                • -------- Someone else has flag here --------
              • Else - Actions
OwnerOfRegion is of type integer.

Read Things That Leak.

Use your own integer variable instead of using IntegerA in loop.

If flag gets destroyed in a region --> Set OwnerOfRegion[index] = null (to free this region again)

Be aware, I think if you destroy builded unit, player will probably lose some gold. You will have to look here whats best solution for you to abort building.
_______________

Using hashtable would be more efficient instead of loop, but for you loop is maybe recommended, if you have less experience with triggering.
 
Last edited:
Level 1
Joined
Jan 15, 2013
Messages
61
How to make -allow trigger so someone else can build on my base but i will not lose control of it. Or maybe add an ability at the flag that can do that. Whats easier and more effective?

+rep for those who help and big thanks
 
Last edited:
  • Events
    • Player - Player types "-allow" (as substring)
  • Actions
    • Set Integer = S2I(8, Length of Entered Chat String) //S2I means convert string to integer
    • If 0<Integer<13
      • Then - Actions
        • Set AllowBoolean[12x(PlayerNumberOfTriggeringPlayer) + Integer] = true
      • Else - Actions
Later after you have checked if there is already someone else (see my trigger in my post from above), you can check if it's allowed or not.

  • If - Conditions
    • AllowBoolean[12x(OwnerOfRegion[(Integer A)]) + PlayerNumberOfTriggeringPlayer] = true
    • Then - Actions
      • -------- Allow buidling--------
    • Else - Actions
      • -------- Cancel or w/e--------
 
Level 1
Joined
Jan 15, 2013
Messages
61
If its not hard for you can you please make in an example map because i dont quite understand how and from where to make this trigger
 
Level 1
Joined
Jan 15, 2013
Messages
61
I didnt understand nothing. Because in every condition t5here are subconditions that i've got to chose. And i dont know what exactly to chose. Please IcemanBo if it is not hard for you make in an example map the -allow system. The building of flags works ok i did it already. Thx in advance
 
Level 1
Joined
Jan 15, 2013
Messages
61
This still dont solves the -allow system. For example when your base is destroyed and you come to an ally base to rebuild
 
Status
Not open for further replies.
Top