[Trigger Request]Dice Gold per level

A

ashra987

Guest
Can anybody tell me, how to make that you will get random 1 - 4 gold per level?

Briefly, if you kill a lv7 hero, you'll get a random 1 - 4 gold, randomed 7 times. If you kill a lv25 hero, you'll get a random 1 - 4 gold, randomed 25 times.

(I thought of give a random gold of 7 - 28 gold when kill a level 7 hero, but i would like to make a game at 100 level cap.
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
What do you mean? Random 1-4 gold for each level?
So on level 7 you get (Random 1-4)*7?
 
A

ashra987

Guest
Nope. It will random 7 times, meaning
Killing a lv7 hero =
(1 - 4) + (1 - 4) + (1 - 4) + (1 - 4) + (1 - 4) + (1 - 4) + (1 -4) = Golds.

It is not (1 - 4)*7 because that would only be 7, 14, 21 or 28 golds.
 
G

Goauld

Guest
Loop integer A from 1 to (Level of triggering unit)
set integer variable = integer variable + (random integer number between 1 and 4)

After the loop give the variable's amount of gold to the killing unit's owner and then set the variable to 0.
 

Mr Zero

Junior Regular (Got the T-shirt)
Reaction score
64
Code:
Actions
    For each (Integer A) from 1 to Level, do (Actions)
        Loop - Actions
            Set Player_Gold = (Player_Gold + (Random integer number between 1 and 4))
    Player - Add Player_Gold to Player 1 (Red) Current gold
    Set Player_Gold = 0

What variables did I use?:

Level = Integer
Player_Gold = Integer
 
G

Goauld

Guest
You just posted the trigger I wrote freehand in trigger format. Trying to steal credit from me or what?

And, you need only one variable, the gold integer. Level of Triggering unit can be used directly in the loop action.
 

Zoxc

New Member
Reaction score
13
Code:
Hero Dies
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A Hero) Equal to True
    Actions
        Player - Add (Random integer number between (Hero level of (Dying unit)) and (4 x (Hero level of (Dying unit)))) to (Owner of (Killing unit)) Current gold

If you want to use the solution of the offensive newbies you should set Player_Gold to 0 at the start of the trigger instead of the end.
 
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