• 🏆 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!

Spell ID's

Status
Not open for further replies.
Level 4
Joined
Jun 23, 2017
Messages
74
You can try this:
  • Get Order ID
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg(I2S(GetIssuedOrderId()))
This will send you a message inside the game saying spell ID
I found it here in hive, in a very old post, when I needed the same thing (Or try as I said killcide above)
Credits: Weep
 
Level 4
Joined
Jan 14, 2017
Messages
75
Killcide, here is the code causing crashes whenever it is enabled.
The spell is Wild Growth (like the WoW spell). It instantly heals 5 allies within 500 yards and then heals them over time. The healing decreases as time progresses. Here are some problems I had with coding:

I couldn't figure out how to make the healing decrease as time progresses. Do I use waits?
Second, the code crashes the game, like I said
Third, there was no HealUnit in the native list, so I didn't know how to heal the allies instantly.

Since you're an expert in coding, you'll probably laugh / facepalm while reading the code.

JASS:
function Trig_Wild_Growth_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Wild_Growth takes nothing returns nothing
    set gg_trg_Wild_Growth = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Wild_Growth, function Trig_Wild_Growth_Actions )
endfunction
function  Wild_Growth_Condition takes nothing returns boolean
return GetSpellAbilityId == 'A002'
endfunction
function Wild_Growth_Actions takes nothing returns nothing
local unit caster
local group allies
local unit temp
local integer count = 5
call GroupEnumUnitsInRangeOfLoc(allies,start_position,500.0,null)
call TriggerRegisterTimeEvent (trg, 8, true)
loop
if IsUnitHeal(temp, GetOwningPlayer(caster)) then  
call SetUnitLifePercentBJ( GetEnumUnit(), ( GetUnitLifePercent(GetEnumUnit()) + 50.00
exitwhen timer = 0
endfunction
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
The function Wild_Growth_Actions need to be above InitTrig_Wild_Growth. Whenever you use a function, the function must be declared before (above) it. So in this case InitTrig_Wild_Growth uses Trig_Wild_Growth_Actions here: call TriggerAddAction( gg_trg_Wild_Growth, function Trig_Wild_Growth_Actions ), so you need to declare Trig_Wild_Growth_Actions above it.
So if you add Wild_Growth_Condition as a condition, you will also have to out it above the init function.
It would also be good, if you indent your code (like you did in the init function).

You should avoid using waits and use timers instead.
To heal units you can use SetWidgetLife():
call SetWidgetLife(u, GetWidgetLife(u) + healAmount)
 
Status
Not open for further replies.
Top