• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to 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
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,248
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'
 
Level 3
Joined
Mar 15, 2015
Messages
53
  • 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.
Top