• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

TD Player build area limits

Status
Not open for further replies.

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
hello,

i wanted to add a system to my TD map allowing players only to build in "their" areas.

i have made the areas, but i cant find a proper trigger. for example i tried:

event: unit-a unit controlled by player1(red) starts to build


thats close, but i couldnt find the proper action to it, since the worker starts to build and triggers, not the building itself triggers.

i need some help with that
 
Level 7
Joined
Jan 18, 2007
Messages
180
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • region contains (Constructing structure)) Equal to False
    • Actions
      • Unit - Remove (Constructing structure) from the game
      • Game - Display to (Player group((Owner of (Constructing structure)))) the text: You may only build in your area!
 
Last edited:

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
thanks... but isnt "remove constructing structure from the game" as event risky, as it is for a 9 player map, and the trigger might catch the wrong building...?
 
Level 6
Joined
Jul 25, 2005
Messages
221
I doubt it, to do that a player must pin point 0.000 seconds, good luck with that. :D
I'd say it's not humanly possible, do it in a trigger with exact values, that would work >.<
 

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
ok, nice.

its just that i saw similar bugs in other maps, maybe this happens together with lags..?
 
Level 2
Joined
Feb 18, 2008
Messages
21
This is tested and works 100% of the time (I think). It requires a bunch of variable initialization (I think there's an easier way to access the players, but the building orders are a bitch and have to be coded like that). You have to create your regions and select them manually (or you could just create regions of a set size dynamically... since you're moving them it doesn't really matter). For some reason simply ordering a unit to stop does nothing at all, so I've just got them moving to the order location. If you can't beat 'em...replace 'em ;) I haven't tested beyond me and the PC, but it SHOULD work with 12 players, human or otherwise, given that no one is going to order a building at the exact same time as someone else. Not sure about leaks (or how to deal with them really), but since everything's in variables it should be very easy to fix if there are any.

  • Variable Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Set buildings --------
      • Set buildingOrders[0] = humanbarracks
      • Set buildingOrders[1] = townhall
      • Set buildingOrders[2] = humanlumbermill
      • Set buildingOrders[3] = blacksmith
      • Set buildingOrders[4] = farm
      • Set buildingOrders[5] = altarofkings
      • Set buildingOrders[6] = arcanesanctum
      • Set buildingOrders[7] = workshop
      • Set buildingOrders[8] = scouttower
      • Set buildingOrders[9] = arcanevault
      • Set buildingOrders[10] = gryphonaviary
      • Set buildingOrders[11] = greathall
      • Set buildingOrders[12] = orcbarracks
      • Set buildingOrders[13] = warmill
      • Set buildingOrders[14] = watchtower
      • Set buildingOrders[15] = trollburrow
      • Set buildingOrders[16] = altarofstorms
      • Set buildingOrders[17] = spiritlodge
      • Set buildingOrders[18] = beastiary
      • Set buildingOrders[19] = voodoolounge
      • Set buildingOrders[20] = taurentotem
      • Set buildingOrders[21] = necropolis
      • Set buildingOrders[22] = crypt
      • Set buildingOrders[23] = graveyard
      • Set buildingOrders[24] = ziggurat
      • Set buildingOrders[25] = altarofdarkness
      • Set buildingOrders[26] = templeofthedamned
      • Set buildingOrders[27] = slaughterhouse
      • Set buildingOrders[28] = sacrificialpit
      • Set buildingOrders[29] = boneyard
      • Set buildingOrders[30] = tombofrelics
      • Set buildingOrders[31] = treeoflife
      • Set buildingOrders[32] = ancientofwar
      • Set buildingOrders[33] = huntershall
      • Set buildingOrders[34] = ancientprotector
      • Set buildingOrders[35] = moonwell
      • Set buildingOrders[36] = altarofelders
      • Set buildingOrders[37] = ancientoflore
      • Set buildingOrders[38] = ancientofwind
      • Set buildingOrders[39] = ancientofwonders
      • Set buildingOrders[40] = chimaeraroost
      • -------- Set players --------
      • Set players[0] = Player 1 (Red)
      • Set players[1] = Player 2 (Blue)
      • Set players[2] = Player 3 (Teal)
      • Set players[3] = Player 4 (Purple)
      • Set players[4] = Player 5 (Yellow)
      • Set players[5] = Player 6 (Orange)
      • Set players[6] = Player 7 (Green)
      • Set players[7] = Player 8 (Pink)
      • Set players[8] = Player 9 (Gray)
      • Set players[9] = Player 10 (Light Blue)
      • Set players[10] = Player 11 (Dark Green)
      • Set players[11] = Player 12 (Brown)
      • -------- Set player locations --------
      • Set playerZones[0] = Region 000 <gen>
      • Set playerZones[1] = Region 001 <gen>
      • Set playerZones[2] = Region 002 <gen>
      • Set playerZones[3] = Region 003 <gen>
      • Set playerZones[4] = Region 004 <gen>
      • Set playerZones[5] = Region 005 <gen>
      • Set playerZones[6] = Region 006 <gen>
      • Set playerZones[7] = Region 007 <gen>
      • Set playerZones[8] = Region 008 <gen>
      • Set playerZones[9] = Region 009 <gen>
      • Set playerZones[10] = Region 010 <gen>
      • Set playerZones[11] = Region 011 <gen>
      • For each (Integer A) from 0 to 11, do (Region - Center playerZones[(Integer A)] on (players[(Integer A)] start location))
  • CheckBuilding
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Set orderPoint = (Target point of issued order)
      • Set orderedUnit = (Ordered unit)
      • Set playerBuilding = (Owner of orderedUnit)
      • For each (Integer A) from 0 to 11, do (If (playerBuilding Equal to players[(Integer A)]) then do (Set playerBuildingIndex = (Integer A)) else do (Do nothing))
      • Set playerGroupBuilding = (All players matching ((Owner of orderedUnit) Equal to playerBuilding))
      • Set buildingCheck = False
      • For each (Integer A) from 0 to 40, do (If ((Current order of orderedUnit) Equal to (Order(buildingOrders[(Integer A)]))) then do (Set buildingCheck = True) else do (Do nothing))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (playerZones[playerBuildingIndex] contains orderPoint) Equal to False
          • buildingCheck Equal to True
        • Then - Actions
          • Unit - Order orderedUnit to Move To orderPoint
          • Game - Display to playerGroupBuilding the text: You may only build in your area!
        • Else - Actions
          • Do nothing
 
Level 9
Joined
Sep 3, 2007
Messages
375
Event - Unit enters region (the player's specified building area)

Condition - Unit is a structure equal to true
Condition - Unit is not equal to (specified player)

Action - Remove unit from game
Action - Display to player the text "You may only build in your area."
 

mik

mik

Level 4
Joined
Dec 13, 2007
Messages
59
thanks all, i got it. didnt use any of yours suggestions exactly, but there were the needed hints.
 
Status
Not open for further replies.
Top