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

[JASS] Simple Spell erro

Status
Not open for further replies.
Level 4
Joined
Dec 2, 2009
Messages
53
Code not working, but i can't find the error

JASS:
function ArcCod takes nothing returns boolean
    return GetSpellAbilityId()=='ZZZZ'
endfunction

function ArcDam takes nothing returns nothing
local unit Target = GetSpellTargetUnit()
local unit Caster = GetTriggerUnit()
local real d1 = I2R(GetHeroInt(Caster,true)) * 2.5
    call UnitDamageTarget(Caster, Target, d1, false, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
endfunction

// ------------------------- Init Trigger----------------------------
function InitTrig_Arcane_Blast takes nothing returns nothing
    local trigger t
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition(t, Condition( function ArcCod ) )
    call TriggerAddAction(t, function ArcDam )
endfunction

anyone can help me?
+ rep
 
Try changing the line UnitDamageTarget to this:
JASS:
call UnitDamageTarget(Caster, Target, d1, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
Or "true" "true". But anyway, I remember some people having problems if they did not set the attack boolean to true.

If it still doesn't work, then add a BJDebugMsg("text") to the actions and see if it even runs. If it doesn't, then the condition was most likely not met. (either wrong id input or wrong spell cast, w/e)
 
Level 4
Joined
Dec 2, 2009
Messages
53
Spell still does not work but when I put ID into another spell worked

i think this part have some error

JASS:
 function InitTrig_Arcane_Blast takes nothing returns nothing
    local trigger t
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition(t, Condition( function ArcCod ) )
    call TriggerAddAction(t, function ArcDam )
endfunction
 
Level 4
Joined
Dec 2, 2009
Messages
53
I found the error, Arcane Blast isn't name of my trigger them the trigger InitTrig_Arcane_Blast doesn't run

Thx everybody try help me :ogre_kawaii:
 
Status
Not open for further replies.
Top