Well, I just realized, you'd need to do more stuff to make your new currency required for unit creation.
You're going to need several triggers and a bunch of things set by hand to do it.
But anyway, first things first....
what is the variable pulldown menu?
When you're making a trigger, some things take integers (a.k.a. non-fractional numbers), like for example, if you create an action with "Player - Set Property", then the last number in it (the value to set the property to) is an integer. If you click that, then you get 3 options:
Variable, Function, or Value.
Next to the Variable option is the pulldown menu that lets you select one of your variables to use it.
Now then, to actually make your currency factor in, you will NEED the expansion, because RoC doesn't support variable-sized arrays or multi-function Fors/Conditionals, which are needed for this.
The most tedious part of all this is you need to enter each unit type and cost by hand, and keep it up-to-date so the currency is handled accurately.
Create 5 new variables:
utRestrictedUnitTypes : Unit-Type, Array, size 1
iRestrictedUnitCosts : Integer, Array, size 1
iRestrictedUnitCostsGold : Integer, Array, size 1
iRestrictedUnitCostsLumber : Integer, Array, size 1
iRestrictedUnitCount : Integer, default 0
Create a new trigger like this:
(Events)
| . Map Initialization
(Conditions)
(Actions)
Set Variable
| . iRestrictedUnitCount
| . Arithmetic
| . | . iRestrictedUnitCount
| . | . +
| . | . 1
Set Variable
| . utRestrictedUnitTypes
| . | . [ iRestrictedUnitCount ]
| . UNIT TYPE GOES HERE
Set Variable
| . iRestrictedUnitCostsGold
| . | . [ iRestrictedUnitCount ]
| . UNIT TYPE'S COST IN GOLD GOES HERE
Set Variable
| . iRestrictedUnitCostsLumber
| . | . [ iRestrictedUnitCount ]
| . UNIT TYPE'S COST IN LUMBER GOES HERE
Set Variable
| . iRestrictedUnitCosts
| . | . [ iRestrictedUnitCount ]
| . UNIT TYPE'S COST IN THE NEW CURRENCY GOES HERE
Copy/Paste those actions and change the unit type and cost for each unit. If a unit does NOT have a value under the new currency, don't include it.
Now you've got a lookup table for the costs of various units.
You still need to restrict building/training using that currency though.
Make 5 new variables:
utUnitBeingCheckedType : Unit-Type
bUnitCheckSucceeded : Boolean
iUnitCheckIndex : Integer
iUnitCheckOwner : Integer
iUnitCancelRatio : Integer
Now, create a new one:
NAME: Check Unit Affordability
(Events)
(Conditions)
(Actions)
Set Variable
| . bUnitCheckSucceeded
| . False
Set Variable
| . iUnitCheckIndex
| . 0
For Each Integer A, Do Action
| . 1
| . iRestrictedUnitCount
| . If / Then / Else
| . | . Unit-Type Comparison
| . | . | . utUnitBeingCheckedType
| . | . | . Equal to
| . | . | . | . utRestrictedUnitTypes
| . | . | . | . | . [ For Loop Integer A ]
| . | . Set Variable
| . | . | . iUnitCheckIndex
| . | . | . For Loop Integer A
| . | . No Action
If / Then / Else
| . Integer Comparison
| . | . iUnitCheckIndex
| . | . Equal To
| . | . 0
| . Set Variable
| . | . bUnitCheckSucceeded
| . | . True
| . If / Then / Else
| . | . Integer Comparison
| . | . | . iPlayerCurrency
| . | . | . | . [ iUnitCheckOwner ]
| . | . | . Greater than or equal to
| . | . | . | . iRestrictedUnitCosts
| . | . | . | . | . [ iUnitCheckIndex ]
| . Set Variable
| . | . bUnitCheckSucceeded
| . | . True
| . No Action
You also need a method to refund stuff that can't build, so here's another:
NAME: Fail Unit Creation
(Events)
(Conditions)
(Actions)
Player - Add Property
| . iRestrictedUnitCostsGold
| . | . [ iUnitCheckIndex ]
| . Conversion - Convert Player Index To Player
| . | . iUnitCheckOwner
| . Current gold
Player - Add Property
| . iRestrictedUnitCostsLumber
| . | . [ iUnitCheckIndex ]
| . Conversion - Convert Player Index To Player
| . | . iUnitCheckOwner
| . Current lumber
Also need one to refund cancelled stuff...
NAME: Cancellation Refund
(Events)
(Conditions)
(Actions)
Trigger - Run (Ignoring Conditions)
| . Check Unit Affordability <gen>
If / Then / Else
| . Integer Comparison
| . | . iUnitCheckIndex
| . | . Equal to
| . | . 0
| . Skip remaining actions
| . No Action
Set Variable
| . iPlayerCurrency
| . | . [ iUnitCheckOwner ]
| . Arithmetic
| . | . iPlayerCurrency
| . | . | . [ iUnitCheckOwner ]
| . | . +
| . | . Arithmetic
| . | . | . Arithmetic
| . | . | . | . iUnitCancelRatio
| . | . | . | . x
| . | . | . | . iRestrictedUnitCosts
| . | . | . | . | . [ iUnitCheckIndex ]
| . | . | . /
| . | . | . 100
Those are just recyclable triggers though, you need 4 more to control item production.
Unfortunately, the only way I can think of to effectively cancel unit training is to kill the unit after it spawns. I'm not sure if they can be cancelled in training, but if they could, then you'd still lose money just by TRYING to build it.
New trigger:
(Events)
Unit - Generic Unit Event
| . Finished training a unit
(Conditions)
(Actions)
Set Variable
| . utUnitBeingCheckedType
| . Event Response - Trained Unit-Type
Set Variable
| . iUnitCheckOwner
| . Player - Player Number
| . | . Owner of Unit
| . | . | . Event Response - Triggering Unit
Trigger - Run (Ignoring Conditions)
| . Check Unit Affordability <gen>
If / Then / Else, Multiple Functions
| . (If - Conditions)
| . Boolean Comparison
| . | . bUnitCheckSucceeded
| . | . Equal to
| . | . True
| . (Then - Actions)
| . | . Set Variable
| . | . | . iPlayerCurrency
| . | . | . | . [ iUnitCheckOwner ]
| . | . | . Arithmetic
| . | . | . | . iPlayerCurrency
| . | . | . | . | . [ iUnitCheckOwner ]
| . | . | . | . -
| . | . | . | . iUnitCheckCost
| . (Else - Actions)
| . | . Game - Text Message (Auto-Timed)
| . | . | . Convert Player to Player Group
| . | . | . | . Event Response - Triggering Player
| . | . | . TEXT FOR FAILING UNIT TRAINING GOES HERE
| . | . Unit - Kill
| . | . | . Event Response - Trained Unit
| . | . Trigger - Run (Ignoring Conditions)
| . | . | . Fail Unit Creation <gen>
Another trigger for when buildings start getting made:
(Events)
Unit - Generic Unit Event
| . Begins construction
(Conditions)
(Actions)
Set Variable
| . utUnitBeingCheckedType
| . Unit-Type of Unit
| . | . Event Response - Constructing Structure
Set Variable
| . iUnitCheckOwner
| . Player - Player Number
| . | . Owner of Unit
| . | . | . Event Response - Constructing Structure
Trigger - Run (Ignoring Conditions)
| . Check Unit Affordability <gen>
If / Then / Else, Multiple Functions
| . (If - Conditions)
| . Boolean Comparison
| . | . bUnitCheckSucceeded
| . | . Equal to
| . | . True
| . (Then - Actions)
| . | . Set Variable
| . | . | . iPlayerCurrency
| . | . | . | . [ iUnitCheckOwner ]
| . | . | . Arithmetic
| . | . | . | . iPlayerCurrency
| . | . | . | . | . [ iUnitCheckOwner ]
| . | . | . | . -
| . | . | . | . iUnitCheckCost
| . (Else - Actions)
| . | . Game - Text Message (Auto-Timed)
| . | . | . Convert Player to Player Group
| . | . | . | . Event Response - Triggering Player
| . | . | . TEXT FOR FAILING CONSTRUCTION GOES HERE
| . | . Unit - Remove
| . | . | . Event Response - Constructing Structure
| . | . Trigger - Run (Ignoring Conditions)
| . | . | . Fail Unit Creation <gen>
Not done yet, need to refund if the player cancels units
(Events)
Unit - Generic Unit Event
| . Cancels training a unit
(Conditions)
(Actions)
Set Variable
| . utUnitBeingCheckedType
| . Event Response - Trained Unit-Type
Set Variable
| . iUnitCheckOwner
| . Player - Player Number
| . | . Event Response - Triggering Player
Set Variable
| . iUnitCancelRatio
| . PERCENTAGE OF VALUE TO REFUND ON UNITS GOES HERE
Trigger - Run (Ignoring Conditions)
| . Cancellation Refund <gen>
And another if they cancel a building...
(Events)
Unit - Generic Unit Event
| . Cancels construction
(Conditions)
(Actions)
Set Variable
| . utUnitBeingCheckedType
| . Unit-Type of Unit
| . | . Event Response - Cancelled Structure
Set Variable
| . iUnitCheckOwner
| . Player - Player Number
| . | . Owner of Unit
| . | . | . Event Response - Cancelled Structure
Set Variable
| . iUnitCancelRatio
| . PERCENTAGE OF VALUE TO REFUND ON BUILDINGS GOES HERE
Trigger - Run (Ignoring Conditions)
| . Cancellation Refund <gen>
..... Enjoy.