Peasants stealing gold

Dodighead147

New Member
Reaction score
0
Hi, I'm not sure if this is really possible, but i'm wondering if there's a way to make it so that a random peasant of yours steals (a certain percent if possible) of gold from you every like 3 or 4 minutes or so. Also, is there a way to make it so if you kill the peasant you get the gold that it stole. Maybe I could make him drop like an item called gold coins or something. Again, I have NO clue on how to do this, I'm relatively new at World Editor, so help would be REALLY appreciate! Thanks!
 

Squishy

You can change this now in User CP.
Reaction score
127
At map initialization set a variable for the player to a random peasant that they own. Then make a trigger with a periodic event that fires every 240 or so seconds. Make the trigger subtract the amount of gold a player has divided by your percentage. Then increase the selected peasants custom value by the same amount. Make a second trigger that fires when the peasant dies. Make that trigger add on amount of gold to the player equal to the custom value of the peasant that died. I could give you example triggers if you need them.
 

Dodighead147

New Member
Reaction score
0
Wow! It is possible! But the thing is, I have no clue how to do this so the example triggers would be much appreciated! Thanks!!
 

Squishy

You can change this now in User CP.
Reaction score
127
Code:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        Set Unit_Variable = (Random unit from (Units owned by Player 1 (Red) of type Peasant))
Code:
Steal
    Events
        Time - Every 240.00 seconds of game time
    Conditions
    Actions
        Unit - Set the custom value of Unit_Variable to ((Custom value of Unit_Variable) + ((Player 1 (Red) Current gold) / 10))
        Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) - ((Player 1 (Red) Current gold) / 10))
Code:
Killed
    Events
        Unit - A unit Dies
    Conditions
        (Dying unit) Equal to Unit_Variable
    Actions
        Player - Add (Custom value of Unit_Variable) to Player 1 (Red) Current gold
        Trigger - Turn off Steal <gen>
Change the 10 in the second trigger to whatever percent you want.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top