
118 posts
Norazion
joined
#1
Need help! Check my script plz
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?

1,418 posts
Here
joined
#2
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
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
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