HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Too much cash!

07-06-2004, 01:54 AM#1
CCrew
Ive had this problem in my game, ancient civilizations where you can get way too much gold. Then i got an idea on how to limit it. I have one building, called a gold vault. I want it to be so if you build one gold vault, you can get 500 more gold on the gold cap (starting at 500 already). The only problem is i have no clue on how to do this....
So if anyone would know how to do this, could you tell me on this thread how to do this in triggers. (my comp is screwed up, so there is no hope of me getting a map any way, so please just do me the favor and write out the trigger, Thank you!)

--If you are confused, i mean like what is in most of the missile war maps, with the gold storage wells--
Thanks in advance!
07-06-2004, 03:08 AM#2
Octavius
well i am not sure exactly what the missile war maps do, what i would do is have a integer array variable that sets the maximum allowable gold (player specific) to the number of gold vaults times 500. then i would have it so that if the players gold exceeds that amount, it is automatically reset to the max value. also, make sure it updates the maximum gold variable each time a gold vault is built
or destroyed

p.s. this is all completely algorithmic and ive never tested any of it so dont hold me to anything
07-06-2004, 03:44 AM#3
BlueSpine
Okay then. This is what you do. I'm going to create the five triggers to accomplish this for only ONE (1) Player. Copies of these triggers will be required to produce the same effects for other players.

Variables
Create an Integer Array named NumberofGoldVaults ("#"). The value of the array should equal the number of players who can build the vault. (Since I'm completing this for Player 1 (Red), the array value ("#") will be (1)) The intial value should be zero.

Create an Integer Array named GoldMax ("#"). The value of the array should equal the number of players who can build the vault and these values should correspond to the array values of the NumberofGoldVaults. The intial value should be 500.

Create an Integer Array named CurrentGold ("#"). The value of the array should equal the number of players who can build the vault and these values should correspond to the array values of NumberofGoldVaults and GoldMax. The intial value should be whatever the players' start with.

Triggers
Trigger One: Gold Vault Built for Player 1 (Red)
Event: Unit - A unit owned by "Player 1 (Red)" Finishes construction
Conditions: UNIT-TYPE COMPARSION::: (Unit-type of (Constructed structure)) Equal to Gold Vault :::
Actions: Set NumberofGoldVaults (1) = (NumberofGoldVaults (1) + 1)

Trigger Two: Gold Vault Killed for Player 1 (Red)
Event: Unit - A unit owned by "Player 1 (Red)" Dies
Conditions: UNIT-TYPE COMPARSION::: (Unit-type of (Constructed structure)) Equal to Gold Vault :::
Actions: Set NumberofGoldVaults (1) = (NumberofGoldVaults (1) - 1)

Trigger Three: Setting Gold Max for Player 1 (Red)
Event: Time - Every 1.00 seconds of game time
Conditions:
Actions: Set GoldMax (1) = (500 x NumberofGoldVaults (1))

Now the more obvious method would to do as Octavius stated; check Player 1 (Red)'s Current gold, see if it is greater than GoldMax (1) and reduce it to GoldMax (1). The editor, however, prevents the value of gold in a Player Property Event from being an Integer variable, making it impossible in doing so, requiring another additional trigger.

Trigger Four: Player 1 (Red)'s Current Gold
Event: Time - Player - Player 1 (Red)'s Current gold becomes Greater than 0.00
Conditions:
Actions: Set Current Gold (1) = (Player 1 (Red)'s Current gold)

Trigger Five: Limiting the Gold for Player 1 (Red)
Event: Time - Player - Player 1 (Red) Current gold becomes Greater than 500
Conditions: INTEGER COMPARSION::: Current Gold (1) Greater than Gold Max (1) :::
Actions: Player - Set Player 1 (Red) Current gold to GoldMax (1)

Well that should do it... I hope. Try it, tell me if I was successful or not. The process makes sense in my mind. Good luck to you, if you have any questions, ask away.
07-06-2004, 10:00 PM#4
Octavius
thanks bluespine, thats like exactly what i was thinking, so thanks for putting it in excellent detail for him
07-07-2004, 01:28 AM#5
CCrew
First off, thank you for the great detailed help, but...... o_O

I did all you said, yet whenever player one gets over 500 gold, it is set to 0 for some reason, i dont think i copied wrong, but this is a strange occurance, can you figure out what happened?
07-07-2004, 02:31 AM#6
BlueSpine
Very odd. If it reset it to zero, then that means when you do it, Gold Max (1) must be zero. If Gold Max (1) is zero, then NumberofGoldVaults (1) must be zero. Check to make sure it's exact. Make sure it says (Unit-type of Constructed Structure) and not Triggering Unit or something like that.

After this step it's best to identify the source of the problem. Create a String Array (1) Variable named Debug ("#"). Within the triggers add the following actions at the end:

Set Debug (1) = CONVERT INTEGER TO STRING::: (String(NumberofGoldVaults (1))) :::
Game - Display to (All players) the text: Debug (1)

Test NumberofGoldVaults (1), GoldMax (1), CurrentGold (1) different times and get back to me. We'll get down to the bottom of this.
07-12-2004, 03:03 AM#7
CCrew
Well it seems BlueSpine couldnt figure this out, so i need someone, anyone to fix my problem. I cannot release my map in its current state, as your gold is automatically resetting to 0 once you hit a certain amount of gold.
HELP