• 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.

Limiting Buildings Created in Relation to Capitals

Status
Not open for further replies.
Level 12
Joined
Dec 13, 2008
Messages
1,049
Hello all! I have another question with triggers...again xD haha

So, basically, the 2 types of buildings that are called into question are marketplaces and capitals. There are different marketplaces for each race (Scourge Market, Orc Market, Kvaldir Market, etc). Also, there are about 15-17 different capitals (1 for each race). So, really, the names 'capitals' and 'marketplaces' are a generic term I use to classify those buildings because although they are technically different buildings, they serve the same purpose, respectively.

Now, for the trigger, I would like a maximum of 12 marketplaces to be created for each capital owned. So, for example, if a person owns Icecrown Citadel and Gundrak, that person can build 24 marketplaces. But if the person owns 0 capitals, that person cannot create any marketplaces.

Any help is greatly appreciated. Thanks again!! :goblin_good_job:
 
Level 8
Joined
Aug 21, 2009
Messages
408
Here is a trigger u could use.

  • Untitled Trigger 001
    • Events
      • Unit - A unit owned by Player 1 (Red) Begins construction
    • Conditions
      • Marketplaces[1] Less than MaxMarkets[1]
    • Actions
      • Unit - Remove (Constructing structure) from the game
      • Player - Add 1000 to (Owner of (Constructing structure)) Current gold
      • Player - Add 1000 to (Owner of (Constructing structure)) Current lumber
Make a variable for Marketplaces(keeps track of the marketplaces currently built) and one for MaxMarkets(12 * Xamount of main buildings) using indexes for every player.

This isnt the best form the trigger could be in. let me know if you want to use this and il make it better haha
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
@Graystuff: Nice idea, although food is already used for the units. So that cannot be done.
@Superz_Ze_Man: Is your trigger able to accomodate and change in response to more 'capitals' being captured?
 
Level 5
Joined
Sep 1, 2010
Messages
168
That's why he uses variables... as the name suggests, they can be changed dynamically.
In order to function properly, you'll need more than one trigger for this, though.. 1 trigger that sets all those values to 0 at map ini, another that increseases the count of the buildings when a building of the specified type finishes construction/enters playable map area (depending how you create them - don't know your map) and another one to decrease when one of those units (buidings) is killed.

Personally I'd suggest using 1 variable to store the number of capitals and whenever 1 is finished, I'd limit the number of buildings of type via formula.

Apart from that, it would be better to uses event - a unit finishes a construction
condition - OR, multiple values unit type equal to (capital type 1) and so on
actions - as decribed above, but using convert player number (number of triggering player) and fixing the leak (if no clue: search the forum for 'things that leak').
Makes for a not-player-specific that should fit your cause.
 
Level 8
Joined
Aug 21, 2009
Messages
408
Before looking at this trigger, please note the following:

MarketPlaceCOUNT = This is the variable that keeps track (or counts) the number of marketplaces each player has. It has an index of 12, meaning its basically 12 variables in one. Each index is for each player. If your game will only have 8 players, set the index to 8 NOTE: Make sure the initial value of this tigger is 0!

MaxMarketplaces = This is the variable that keeps track of the max amount of market places each player can have. It has an index of 12, meaning its basically 12 variables in one. Each index is for each player. If your game will only have 8 players, set the index to 8 NOTE: Make sure the initial value of this trigger is The amount of markets you want to allow be built per capital (in this case, i set it to 12. if you want 4 markets per capital, set it to 4)!!
This initial value is only needed if you start with a capital. If you dont start with one, set it to 0.(i dont know how else to explain it)

  • Player number of (Owner of (Constructing structure)
Player number ranges from 1-16 (player red,blue,teal,purple,yellow,orange,etc.. all the way to neutral hostile and neutral passive) We use this player number to select the variable index we want, so MaxMarketplaces[3] Is the variable that shows the max market places PLAYER 3 (teal) Can have. it is VERY important those numbers stay in sink. If MaxMarketplaces[3] was the max market places for player 9, then this trigger wouldnt work.


  • Constructing structure
= this is simply the marketplace the player is trying to build.

---------------------------------------------------------
The trigger is somewhat simple now that i explained the main parts:

  • MarketBuilt
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • (Constructing structure) Equal to MarketPlace
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MarketPlaceCOUNT[(Player number of (Owner of (Constructing structure)))] Less than or equal to MaxMarketplaces[(Player number of (Owner of (Constructing structure)))]
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Unit - Remove (Constructing structure) from the game
          • Game - Display to (Player group((Owner of (Constructing structure)))) the text: You Cannot build th...
          • Player - Add 1000 to (Owner of (Constructing structure)) Current gold
          • Player - Add 250 to (Owner of (Constructing structure)) Current lumber
The REALLLLY long condition = This is a simple 'if X is less than or equal to X' statement. The only reason it is long is because it needs to compare players max marketplaces to the players current amount of marketplaces.

When the trigger displays the text to the player that they cannot build the marketplace, it chooses the (Player group((Owner of (Constructing structure)))), so the person whos building the marketplace.

When your adding the gold to the player (in this case 1000 gold and 250 wood, make sure its the same price as the marketplace)
---------------------------------------------------------
Now to the next trigger, everything else from here on out is easy.


  • Add MarketPlaces
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Constructed structure) Equal to MarketPlace
    • Actions
      • Set MarketPlaceCOUNT[(Player number of (Owner of (Constructed structure)))] = ((Player number of (Owner of (Constructed structure))) + 1)
This trigger adds to the count after a building is finished.
---------------------------------------------------------
This trigger is exactly the same, but rather adding to the count, we remove from the count.

  • MarketPlace Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Constructed structure) Equal to (Picked unit)
    • Actions
      • Set MarketPlaceCOUNT[(Player number of (Owner of (Dying unit)))] = ((Player number of (Owner of (Dying unit))) - 1)
----------------------------------------------------------
Next, we LITTERALLY copy trigger 2, but rather than adding marketplaces, we add capitals.

  • Add Capitals
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Constructed structure) Equal to (Picked unit)
    • Actions
      • Set MaxMarketplaces[(Player number of (Owner of (Constructed structure)))] = (MaxMarketplaces[(Player number of (Owner of (Constructed structure)))] + 12)

This trigger adds 12 to the total amount of marketplaces allowed built. Change the amount it adds if you wish to increase/decrease the amount of markets per capital.
---------------------------------------------------------
And now we do the same thing, but removing from the total.

  • Capital Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Constructed structure) Equal to (Picked unit)
    • Actions
      • Set MaxMarketplaces[(Player number of (Owner of (Dying unit)))] = (MaxMarketplaces[(Player number of (Owner of (Dying unit)))] - 12)
When copying this trigger, make sure to change the "(Owner of (Constructed structure))" to "(Owner of (Dying unit))"
--------------------------------------------------------
Theres the total of 5 triggers needed. Hope this helped, and when you copy this trigger, be Exact! Im sorry for making you wait, i know i hate it when somebody ignores me. But i couldnt reschedule my math exam ^^. I tried to make it up to you by making the post more colourful n stuff :D
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
Okay, I think I understand it. Although I have one question:
The marketplace triggers are all perfect because each race has different marketplaces, so I can differentiate between them depending on the race. However, is there a way the capital triggers can apply to capitals as if they were the same building?
Basically, what I mean, is that there are many different 'capitals'. There is a capital for each race. So is there a way for the trigger to recognize or group all these different buildings into the same 'capital' category??

By the way dude, dont worry bout apologizing. You have done an excellent job!! ^.^


And by the way, if there is not a way that the trigger can group all the different type of 'capitals' into a single capital category, I think I know of a way I can get around that. So no worries if it cannot :)
 
Level 8
Joined
Aug 21, 2009
Messages
408
You could possibly make a long "or" condition, checking for each type of capital. I cant think of any other way at the moment.

Or, you said you could differentiate between the different races marketplaces right? Could you possibly do the same for capitals?
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
Well the reason I could differentiate between the marketplaces is because one race can only control 1 type of marketplace at any given time. so there would be a different trigger to refer to each type of marketplace. but all races can control all different types of capitals. so that method wouldnt work for the capitals
How would i go about making the long ''or'' condition checking for each type of capital?? Could you give me an example?
Here are some of the capitals to help give you an idea: Orgrimmar, Stormwind, Icecrown Citadel, Nordrassil, Thunder Bluff, and Gundrak, but there will be 24
 
Level 8
Joined
Aug 21, 2009
Messages
408
  • Untitled Trigger 002 Copy
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Constructed structure) Equal to (Picked unit)
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Constructed structure)) Equal to Orgrimmar
          • (Unit-type of (Constructed structure)) Equal to Stormwind
          • etc...
    • Actions
      • Set MaxMarketplaces[(Player number of (Owner of (Constructed structure)))] = (MaxMarketplaces[(Player number of (Owner of (Constructed structure)))] + 12)
  • keep in mind, you may have to change the "constructed unit" because the capitals arnt constructed
 
Level 17
Joined
Apr 3, 2010
Messages
1,101
Trigger 5 and 3 can be merged via if then else .

And why is condition

Constructed Structure = Picked unit?
Surely it would be Killed/Dying unit = Unit of unit type Market place/capital.

Side not.
You can make it so that if a capital dies you loose all Markets equal to the capital. So your Markets are always Limited instead of if you take loada capitals spam markets then loose capitals and keep uber market spam.
This can be merged with trigger 5
Event: Unit dies
Condition: Unit type = City
Action: For each loopinteger A 1-12
If Marketamount>Maxmarketamount
Pick random unit in units owned by ownerofdyingunit
Kill picked unit
Set marketamount =MArketamount-1

Else: Do nothing :p
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
Okay, I see how that trigger works! I think that should fulfill what I need

And well, now with what Brambleclaw said, what should the entire new trigger set look like??
By the way Superz Ze Man, thank you very very much!! You are going above n beyond the call I think =)
 
Level 17
Joined
Apr 3, 2010
Messages
1,101
Just collecting triggers. So as said above no difference just merging. Also wonder did you want it so that the Markets get killed if you cant support them with food. Or would it be okay to have more markets than food limit ?
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
Well, the markets are not supported by food, they are supported by controlling a certain number of these 'capitals'. Yet, with that said, I think I will refrain from having a trigger that destroys the markets when a capital is removed from said player's control. Itd be a huge pain, and capitals generally are not easy to capture.

And Superz_Ze_Man, I did not copy the triggers into my game yet, seeing as I wanted to make sure everything was finalized since we were still discussing stuff. So is it ready to go, should I test it?
 
Level 8
Joined
Aug 21, 2009
Messages
408
i think it would work, however remember to change the "constructed unit" to something more fitting (only for the capitals). If you have capitals change ownership when somebody attacks it (or something) Then you would change it to "attacked unit". <-- thats only for the capital triggers, the other three are fine.

im guessing you already know how somebody is going to take control of a capital?
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
Yes. A Capital is taken control when a player attacks it and it reaches a certain percentage of health.
With that said, should I just change 'constructed unit' to 'attacked unit'?
Because I also have unit transfer triggers so that when capitals reach a certain health, the player control is transferred
 
Level 8
Joined
Aug 21, 2009
Messages
408
why dont you just add to the trigger (that changes ownership of the capitals) the same stuff as in the first capital thing. You can add X to maxmarketplaces of owner of attacking unit and remove X from maxmarketplaces of owner of attacked unit. only 2 lines of triggering added, rather than making 2 entirely new triggers :p
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
Uuh...I'm confused what you mean.
This is what the capital transfer trigger looks like:

  • Gilneas Transfer
    • Events
      • Unit - Light's Dawn Cathedral 0268 <gen> Is attacked
    • Conditions
      • (Owner of (Attacking unit)) Equal to Player 1 (Red)
      • (Life of Gundrak 0998 <gen>) Less than or equal to 500.00
    • Actions
      • Unit - Change ownership of Light's Dawn Cathedral 0268 <gen> to Player 1 (Red) and Change color
      • Unit - Set life of Light's Dawn Cathedral 0268 <gen> to 4500.00
So what would I make that look like instead? By what your saying of combing triggers n such?
 
Level 8
Joined
Aug 21, 2009
Messages
408
Uuh...I'm confused what you mean.
This is what the capital transfer trigger looks like:

  • Gilneas Transfer
    • Events
      • Unit - Light's Dawn Cathedral 0268 <gen> Is attacked
    • Conditions
      • (Owner of (Attacking unit)) Equal to Player 1 (Red)
      • (Life of Gundrak 0998 <gen>) Less than or equal to 500.00
    • Actions
      • Unit - Change ownership of Light's Dawn Cathedral 0268 <gen> to Player 1 (Red) and Change color
      • Unit - Set life of Light's Dawn Cathedral 0268 <gen> to 4500.00
So what would I make that look like instead? By what your saying of combing triggers n such?

All you gotta add is a line saying "add X to maxmarketplaces[player number of (attacking unit)]" AS WELL AS "remove X from maxmarketplaces[player number of(attacked unit)]" into that trigger and you dont need the other capital trigger anymore :p

Please note those triggers are just me trying to remember how to make them, But all you really need to do is add X to maxmarketplaces[player number of (attacking unit)] and remove X from maxmarketplaces[player number of (attacking unit)]
 
Level 12
Joined
Dec 13, 2008
Messages
1,049
So add this:
  • Actions
  • Set MaxMarketplaces[(Player number of (Owner of (Constructed structure)))] = (MaxMarketplaces[(Player number of (Owner of (Constructed structure)))] + 12)
To the capital trigger i showed above?
 
Level 8
Joined
Aug 21, 2009
Messages
408
yup, only remember to change "constructed structure" to "owner of attacking unit" or whatever triggers the trigger.

Once you have done that, you need to remove 12 from the "owner of attacked unit", so you will simply need to copy that trigger, and past it, changing the + to a - and "owner of attacking unit" to "owner of attacked unit"
 
Status
Not open for further replies.
Top