• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Gain +1 all attribute for each unit it kills ability

Status
Not open for further replies.
Level 3
Joined
Mar 15, 2015
Messages
53
I need to make ability that when an unit killed another unit it gain 1+ all attribute. Can anyone help me out? thanks ;D
 
JASS:
scope attribute initializer Event
	private function Actions takes nothing returns nothing
		local unit u = GetTriggerUnit()
		local integer temp
		if GetUnitAbilityLevel(GetKillingUnit(), YOUR_ABILITY) > 0 then
			set temp = GetHeroStr(u, false)
			call SetHeroStr(u, temp + 1, true)
			set temp = GetHeroAgi(u, false)
			call SetHeroAgi(u, temp + 1, true)
			set temp = GetHeroInt(u, false)
			call SetHeroInt(u, temp + 1, true)
		endif
	endfunction
	
	private function Event takes nothing returns nothing
		local trigger t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH )
		call TriggerAddAction(t, function Trig_Untitled_Trigger_001_Actions )
	endfunction
endscope

All you need to do is to change the "YOUR_ABILITY" to 'ability code'
The ability code can be seen by pressing ctrl + d in the object editor.

Example:
'A000'
 
  • Add Attribute
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Attribute Bonus for (Killing unit)) Greater than 0
    • Actions
      • Hero - Modify Strength of (Killing unit): Add 1
      • Hero - Modify Agility of (Killing unit): Add 1
      • Hero - Modify Intelligence of (Killing unit): Add 1
wow i didn't realize that we could do that by using trigger, all the time i still thinking about using item stats gain ability but well :p thanks a lot!
 
Status
Not open for further replies.
Back
Top