• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Item Charge

Status
Not open for further replies.
Level 1
Joined
May 16, 2013
Messages
7
Is it possible to make an item that gives an additional damage based on its number of charge. If yes, how?

THANKS
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
Event

A Unit is Attack

Condition

Attacking unit has an item of (YOUR ITEM)
(YOUR ITEM) carried by Attacking Unit has a charge with not equal to 0

Then

Unit - Cause Attacking Unit to deal (base damage) x (number of item charge) to the attack unit



Using this way.. it is not complicated.. you can add also different conditions and
YOU CAN SET THE DAMAGE TYPE YOU WANT (Sorry for the caps)

You can add also Floating Texts in it!
 
Try this...
http://www.hiveworkshop.com/forums/jass-resources-412/system-physical-damage-detection-228456/

JASS:
scope ChargesDam initializer init

private function onDamage takes nothing returns nothing
   local integer slot = 0
   local integer charges = 0
   local real fullDamage
   local item it
   if damageType == PHYSICAL then
      loop
           set it = UnitItemInSlot(source, slot)
           if GetItemTypeId(it)=='I000' and GetItemCharges(it) > 0 then
              set charges = GetItemCharges(it)
              exitwhen true
           endif
           set slot = slot + 1
           exitwhen slot==6
      endloop
      set fullDamage = charges*amount //this is the damage
      call UnitDamageTarget(source, target, fullDamage, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
   endif
   set it = null
endfunction

private function init takes nothing returns nothing
    call AddDamageHandler(function onDamage)
endfunction

endscope

where 'I000' is the raw ID of the item in the object editor...
 
Last edited:
Status
Not open for further replies.
Top