• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Gain gold based on hero's damage?

Status
Not open for further replies.
Level 4
Joined
Aug 13, 2010
Messages
60
Any one have any idea to how :
to use pillage or GUI Trigger ( must have a special item ) to get gold ?? . The gold amout we get is base on damage.
So example our hero damage is 50 and everytimes (with a chance 50%) we hit we will get 50 gold and if the hero damage increase to 100 everytimes we hit we will (with a chance 50% ) get 100 gold.
So... everytimes our hero damage increase , the gold amount we get will increase too according to the hero damage. Include building , we will gain gold too if we attacking building

Like this map : http://www.epicwar.com/maps/142539/ ( Troll and Elves Map )

Note : the gold is given immediately when attacking but with a chance 20%. So every times the hero with a special item attacking, the hero will gain gold base on damage with a chance 20%.

example : Like using MOtred hero on dota , You have a 12% chance to cast Coup de Grace on every attack to the enemy. same as gold gain , You have 20% chance to gain gold and the amount of gold is base on the hero damage in everytime you attacking enemy.
 
Last edited:
Level 17
Joined
Feb 11, 2011
Messages
1,860
Hmmm, I know how to do everything except add gold according to the damage...

  • Gold
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has an item of type [your item]) Equal to True
      • (Random integer number between 1 and 2) Equal to 1
    • Actions
      • [give gold according to damage]
 
Actually Mr_Bean, I think he wanted something like this:


  • Gold
    • Events
      • Game - DamageEvent becomes Equal To 1.00
    • Conditions
      • (Random integer number between 1 and 2) Equal to 1
    • Actions
      • // Here, you'd give gold to the player equal to the variable DamageEventAmount
For this, you need Bribe's DamageEvent in the Spells section.
 
Level 4
Joined
Aug 13, 2010
Messages
60
When the bounty is given? When unit dies or immidiately after attack?

the gold is given immediately when attacking but with a chance 20%
everytime attacking to any enemy ( include building ) with a chance 20%.
example : Like using MOtred hero on dota , You have a 12% chance to cast Coup de Grace on every attack to the enemy. same as gold gain , You have 20% chance to gain gold and the amount of gold is base on the hero damage in everytime you attacking enemy.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Then why you haven't used Maggy's trigger? I will post complete version:
Requires Unit Indexer and Damage Event.

  • Gold
    • Events
      • Game - DamageEvent becomes Equal To 1.00
    • Conditions
      • (Random integer number between 1 and 5) Equal to 1
    • Actions
      • Player - Add (DamageEventAmount) to (Owner of (DamageEventSource)) Current gold
Just add condition about units. Which units are allowed to take bounty, and which are not.
 
Last edited:
Level 4
Joined
Aug 13, 2010
Messages
60
so... We must need Unit Indexer and Damage Event. ????

Just add condition about units. Which units are allowed to take bounty, and which are not.
so if we want only hero that able to gain gold if we have a special item , Then we add "Hero manipulate item Mask of death equal to true" < something like that then we no need to make which units are allowed to take bounty right ????
 
Level 6
Joined
Jan 29, 2010
Messages
213
You can name me a noob or something like that(becouse of my trigger lenght, for using wait, and without that im calculating damage done with variables.^^), but here's my version:

  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Owner of (Attacked unit)) Not equal to (Owner of (Attacking unit))
  • Actions
    • Set damage = (Integer((Life of (Attacked unit))))
    • Wait 0.50 seconds
    • If (((Random integer number between 0 and 10) Less than or equal to 2) and (damage Greater than (Integer((Life of (Attacked unit)))))) then do (Player - Add (damage - (Integer((Life of (Attacked unit))))) to (Owner of (Attacking unit)) Current gold) else do (Do nothing)
BUT it's 100% working!
 
You can name me a noob or something like that(becouse my trigger is very long,uses wait, and without that im calculating damage done with variables.^^), but here's my version:

  • dmg for gold Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Attacked unit)) Not equal to (Owner of (Attacking unit))
    • Actions
      • Set chanse = (Random integer number between 0 and 10)
      • Set damage[1] = (Integer((Life of (Attacked unit))))
      • Wait 0.50 seconds
      • Set damage[2] = (Integer((Life of (Attacked unit))))
      • If (chanse Less than or equal to 2) then do (Player - Add (damage[1] - damage[2]) to (Owner of (Attacking unit)) Current gold) else do (Do nothing)
BUT it's 100% working!

"A unit is attacked" event can be abused easily, while spamming the "Stop" order, right in the beginning of the attack animation of the unit (which is triggering the said event). A damage detection system is the proper and efficient way to go ;]
 
Level 6
Joined
Jan 29, 2010
Messages
213
"A unit is attacked" event can be abused easily, while spamming the "Stop" order, right in the beginning of the attack animation of the unit (which is triggering the said event). A damage detection system is the proper and efficient way to go ;]

  • If (((Random integer number between 0 and 10) Less than or equal to 2) and (damage Greater than (Integer((Life of (Attacked unit)))))) then do (Player - Add (damage - (Integer((Life of (Attacked unit))))) to (Owner of (Attacking unit)) Current gold) else do (Do nothing)
hows about now? ^^
(damage Greater than (Integer((Life of (Attacked unit)))))
 
Level 4
Joined
Aug 13, 2010
Messages
60
  • If (((Random integer number between 0 and 10) Less than or equal to 2) and (damage Greater than (Integer((Life of (Attacked unit)))))) then do (Player - Add (damage - (Integer((Life of (Attacked unit))))) to (Owner of (Attacking unit)) Current gold) else do (Do nothing)
hows about now? ^^
(damage Greater than (Integer((Life of (Attacked unit)))))

is that really ok using a trigger like that without damage detection ? Hmm.... from what others said it will abuse !!
 
Level 4
Joined
Aug 13, 2010
Messages
60
Player - add property

The property is gold

You need to use Conversion - Convert Real to Integer

The real to convert is DamageEventAmount.

Let me know if you still have questions.

its become like this right ??? i have did as you told me. But nothing happen , maybe something wrong ???
  • Player - Add (Integer(DamageEventAmount)) to (Owner of DamageEventSource) Current gold
can i add that only a hero manipulate that manipulate an item can get a gold ?? just add that hero manipulate "Myitem" in condition right ?? and do i need change any thing in action part ?
 
Last edited:
Level 4
Joined
Aug 13, 2010
Messages
60
When i cast a skill i will also gain a gold and the amout of the gold is equal to the damage of hero that manipulate the item.
so.. how to make that the hero (manipulate a special item) only get a gold if the hero hit the enemy normally ( not using any skill just hit normally )
i add the map, maybe you can help me by modify the map to what i want.


  • Gold Gain
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventSource has an item of type Sobi Mask) Equal to True
      • Or - Any (Conditions) are true
        • Or - conditions
          • DamageEventTarget is A Hero Equal to False
          • Owner of DamageEventTarget is an enemy of Owner of DamageEventSource
    • Actions
      • Player - Add (Integer(DamageEventAmount)) to (Owner of DamageEventSource) Current gold
 

Attachments

  • Gold Gain.w3x
    25.3 KB · Views: 51
Last edited:
  • Gain Gold
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventSource has an item of type Sobi Mask) Equal to True
      • (DamageEventTarget is A Hero) Equal to False
    • Actions
      • Player - Add (Integer(DamageEventAmount)) to (Owner of DamageEventSource) Current Gold
This should be your trigger.

Now it's impossible to detect if the damage originated from a spell/attack unless Bribe updates his DamageEvent.
 
Level 4
Joined
Aug 13, 2010
Messages
60
  • Gain Gold
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventSource has an item of type Sobi Mask) Equal to True
      • (DamageEventTarget is A Hero) Equal to False
    • Actions
      • Player - Add (Integer(DamageEventAmount)) to (Owner of DamageEventSource) Current Gold
This should be your trigger.

Now it's impossible to detect if the damage originated from a spell/attack unless Bribe updates his DamageEvent.


  • Conditions
  • Owner of DamageEventTarget is an enemy of Owner of DamageEventSource
<<< Bribe told that by using this trigger you wont get any gold from hitting your ally or your unit but i dont know how to do that. Thats why i ask it.

What i mean is i want is you will only gain a gold if you hitting an enemy normally ( just hitting the enemy ). And i dont want that i able to get an amount of gold equal to that ability when i cast an ability. so the conclusion like this
hitting normally/just hitting = You get a gold , but
Hitting enemy with any ability = you wont get any gold
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
You can't (bug free) detect spell/attack damage with ANY damage
system, unless you trigger all non-physical damage in your map. I
will be making an update to DamageEvent soon to support such
stuff, and also I will have built-in protection against the infinite loop
problem instead of requiring everyone to enable/disable the system.
 
Level 4
Joined
Aug 13, 2010
Messages
60
hmm i think that not what i mean. Because i can gain a gold when using a spell and the amount of gold i gain from spell is equal to that spell damage.

What i want is i dont want gain any gold from any spell that i cast. I just want gain a gold from hitting an enemy normally ( normal attack just hitting not using any skill or spell)

Gain a gold by hitting an enemy normally is already solved
 
Status
Not open for further replies.
Top