[JASS] Need help! Check my script plz

Status
Not open for further replies.
Level 5
Joined
May 9, 2006
Messages
162
Code:
function ChargedBolt takes nothing returns nothing
    local unit Caster = GetSpellAbilityUnit()
    local unit Target = GetSpellTargetUnit()
    local unit Launcher
    call CreateNUnitsAtLoc(1, udg_ChargedBoltLauncher[GetUnitAbilityLevelSwapped('A000', Caster)], GetOwningPlayer(Caster), GetUnitLoc(Caster), 270.00)
    set Launcher = GetLastCreatedUnit()
    call UnitApplyTimedLifeBJ( 2.00, 'BTLF', Launcher )
    call IssueTargetOrderBJ( Launcher, "attackonce", Target)
endfunction
WE shows no errors but in game it doesn't work. Can you find an error?
 
if it wasnt for the Locals, i would think it was a convert. you have alot of learning to do.

here we go.

your code

JASS:
function ChargedBolt takes nothing returns nothing
    local unit Caster = GetSpellAbilityUnit()
    local unit Target = GetSpellTargetUnit()
    local unit Launcher
    call CreateNUnitsAtLoc(1, udg_ChargedBoltLauncher[GetUnitAbilityLevelSwapped('A000', Caster)], GetOwningPlayer(Caster), GetUnitLoc(Caster), 270.00)
    set Launcher = GetLastCreatedUnit()
    call UnitApplyTimedLifeBJ( 2.00, 'BTLF', Launcher )
    call IssueTargetOrderBJ( Launcher, "attackonce", Target)
endfunction

cleaned up, and should work

JASS:
function ChargedBolt takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local unit Target = GetSpellTargetUnit()
    local unit launcher = CreateUnit( GetOwningPlayer( Caster ), udg_ChargedBoltLauncher[GetUnitAbilityLevel(Caster,'A000')], GetUnitX( Caster ), GetUnitY( Caster ), 270 )
    call UnitApplyTimedLife( 2.00, 'BTLF', launcher )
    call IssueTargetOrder( launcher, "attackonce", Target)
endfunction

this will ONLY not work if you are using EVENT_PLAYER_UNIT_SPELL_FINISH as your event. instead, use EVENT_PLAYER_UNIT_SPELL_EFFECT
 
Status
Not open for further replies.
Back
Top