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

[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?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
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.
Top