Peasants stealing gold

Dodighead147

New Member
Reaction score
0
Hi... Well someone was very nice to help me with this post beofe (rep+) but there is ONE problem with it. This code gives +50 gold when you kill the peasant but I want it to give back the 1/5 of your gold that it takes (in the item). Can you please help me? This is the code:
Code:
Trigger 1
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Jew
    Actions
        Item - Create Gold Coins at (Position of (Triggering unit))
        Item - Set the custom value of (Last created item) to (Custom value of (Triggering unit))
Code:
Trigger 2
    Events
        Unit - A unit Acquires an item
    Conditions
        (Custom value of (Item being manipulated)) Greater than 0
    Actions
        Player - Add (Custom value of (Item being manipulated)) to (Owner of (Hero manipulating item)) Current gold
        Floating Text - Create floating text that reads (String((Custom value of (Item being manipulated)))) at (Position of (Hero manipulating item)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
        Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
 

Exide

I am amazingly focused right now!
Reaction score
448
You are creating an item, which probably holds the value of the gold that will be added to the owner of the unit that picks it up. So you'll have to change the value in the Object Editor.
If not, you could add an action to the second trigger which removes X gold from Owner of (Triggering Unit). -That will probably look weird, when playing the game, though.

Your first trigger has a point-leak, and "Jew" probably isn't the best name for a Unit-Type.
 

Anti-krazy

New Member
Reaction score
5
Hmm... try this trigger

Events
Unit - A unit Dies
Conditions
(Unit-type of (Dying Unit)) Equal to Jew
Actions
Hero - Create Gold Coins and give it to (Triggering Unit)
Item - Set the custom value of (Last created item) to (Custom value of (Triggering unit))

But if you want the gold coins to give +50 gold go to items and edit the gold to +50
 

Exide

I am amazingly focused right now!
Reaction score
448
Hmm... try this trigger

Events
Unit - A unit Dies
Conditions
(Unit-type of (Dying Unit)) Equal to Jew
Actions
Hero - Create Gold Coins and give it to (Triggering Unit)
Item - Set the custom value of (Last created item) to (Custom value of (Triggering unit))

But if you want the gold coins to give +50 gold go to items and edit the gold to +50

You should use CODE-Tags around your trigger codes.

Item - Set the custom value of
Probably won't work, since the item (most likely) will disappear, when a unit acquires it.
 

Dodighead147

New Member
Reaction score
0
Do you think this will work?: what if i go back to the original code that doesnt drop and item, and just make it say in text that i got the gold? Should i just do that? Will it look as good?
 

Exide

I am amazingly focused right now!
Reaction score
448
Do you think this will work?: what if i go back to the original code that doesnt drop and item, and just make it say in text that i got the gold? Should i just do that? Will it look as good?

Without the item is better - then no one can come steal the gold from your kill.
 
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