• 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.

Triggering or jass for a hero skill

Status
Not open for further replies.
Level 3
Joined
Nov 12, 2011
Messages
46
I am creating a hero that starts with 1 base stats and gains no stats when leveling. instead he gains 1 stat randomly to agi, str or int each time he kills a unit. im not sure where to begin with this.

And another skill that i need help with is that this hero also has summons. i wanted the summons to gain hp, damage and armor depending on this hero's stats.
 
Level 9
Joined
Dec 12, 2007
Messages
489
for the stat gain on kill,

  • StatOnKill
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) is A Hero) Equal to True
    • Actions
      • Custom script: local unit u = GetKillingUnit()
      • Custom script: local integer i = GetRandomInt(1,3)
      • Custom script: if i == 1 then
      • Custom script: call SetHeroStr(u,GetHeroStr(u,false)+1,true)
      • Custom script: elseif i == 2 then
      • Custom script: call SetHeroAgi(u,GetHeroAgi(u,false)+1,true)
      • Custom script: else
      • Custom script: call SetHeroInt(u,GetHeroInt(u,false)+1,true)
      • Custom script: endif
      • Custom script: set u = null
JASS:
function Trig_StatOnKill_JASS_Conditions takes nothing returns boolean
    return IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO) == true
endfunction

function Trig_StatOnKill_JASS_Actions takes nothing returns nothing
    local unit u    = GetKillingUnit()
    local integer i = GetRandomInt(1,3)
    if i == 1 then
        call SetHeroStr(u,GetHeroStr(u,false)+1,true)
    elseif i == 2 then
        call SetHeroAgi(u,GetHeroAgi(u,false)+1,true)
    else
        call SetHeroInt(u,GetHeroInt(u,false)+1,true)
    endif
    set u = null
endfunction

//===========================================================================
function InitTrig_StatOnKill_JASS takes nothing returns nothing
    set gg_trg_StatOnKill_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_StatOnKill_JASS, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_StatOnKill_JASS, Condition( function Trig_StatOnKill_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_StatOnKill_JASS, function Trig_StatOnKill_Copy_Actions )
endfunction
you need to set the 1 initial stats at Object Editor.


for the summons gain stat based on the hero stat, if you use vJASS, you can use BonusMod to achieve it, or you can try to recreate bonus mod for your own use.
 

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,121
dark, i have a question
if we use this:
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Killing unit) is A Hero) Equal to True
  • Actions
    • Set TempUnit = (Killing unit)
    • Set Randomizer = Random number between 1 and 3
    • If (All Conditions are true) Then (Actions) Else (Actions)
      • If - Conditions
        • Randomizer equal to 1
      • Then - Actions
        • Hero - Add 1 Agility to TempUnit
      • Else - Actions
        • If - Conditions
          • Randomizer equal to 2
        • Then - Actions
          • Hero - Add 1 Strength to TempUnit
          • Else - Actions
            • Hero - Add 1 Inteligence to TempUnit
    • Set TempUnit = No Unit
will it bug?
 
Level 9
Joined
Dec 12, 2007
Messages
489
dark, i have a question
if we use this:
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Killing unit) is A Hero) Equal to True
  • Actions
    • Set TempUnit = (Killing unit)
    • Set Randomizer = Random number between 1 and 3
    • If (All Conditions are true) Then (Actions) Else (Actions)
      • If - Conditions
        • Randomizer equal to 1
      • Then - Actions
        • Hero - Add 1 Agility to TempUnit
      • Else - Actions
        • If - Conditions
          • Randomizer equal to 2
        • Then - Actions
          • Hero - Add 1 Strength to TempUnit
          • Else - Actions
            • Hero - Add 1 Inteligence to TempUnit
    • Set TempUnit = No Unit
will it bug?
supposedly nope it won't, why?
 
Status
Not open for further replies.
Top