Hi,
i have a problem with my trigger.. the mainproblem seems to be in shuriken function... the unit is casting a shuriken and throw it in direktion of the target point... at target point there should be a impact of the shuriken and damage the enemy(damage isnt included jet) but for some reason the shuriken doesnt do the impact every time... sometimes its flying and flying and... so on... can anyone help me with the problem pls cause i cant find the problem :/
have to say iam still learning jass since 4 days so dont be that hard. i know it isnt realy clean code.
I also have a question about the hashtable in my trigger... if its declared like in this trigger is the trigger loosing the mui ability? or is it still mui then? if its not mui can you tell me how to get it mui maybe?^^
i have a problem with my trigger.. the mainproblem seems to be in shuriken function... the unit is casting a shuriken and throw it in direktion of the target point... at target point there should be a impact of the shuriken and damage the enemy(damage isnt included jet) but for some reason the shuriken doesnt do the impact every time... sometimes its flying and flying and... so on... can anyone help me with the problem pls cause i cant find the problem :/
have to say iam still learning jass since 4 days so dont be that hard. i know it isnt realy clean code.
I also have a question about the hashtable in my trigger... if its declared like in this trigger is the trigger loosing the mui ability? or is it still mui then? if its not mui can you tell me how to get it mui maybe?^^
JASS:
scope GiantShuriken initializer InitTrig_Giant_Shuriken
globals
private hashtable table
endglobals
private function Trig_Giant_Shuriken_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
private function shuriken takes nothing returns nothing
local timer t = GetExpiredTimer ()
local unit caster = LoadUnitHandle(table,GetHandleId(t),1)
local unit shuri
local integer i = LoadInteger(table,GetHandleId(t),3)
local location loc_target = LoadLocationHandle(table,GetHandleId(t),2)
local location loc_caster = GetUnitLoc(caster)
local location loc_shuri
local location move
call SaveInteger(table,GetHandleId(t),3,i+1)
if (i==1) or (i==3) or (i==5) or (i==7) or (i==9) then
call CreateNUnitsAtLoc( 1, 'hkni', GetOwningPlayer(caster), loc_caster, bj_UNIT_FACING )
call SetUnitVertexColorBJ( GetLastCreatedUnit(), 100, 100.00, 100.00, 80.00 )
call UnitApplyTimedLifeBJ( 0.01, 'BTLF', GetLastCreatedUnit() )
elseif (i==10) then
call CreateNUnitsAtLoc( 1, 'hmtm', GetOwningPlayer(caster), loc_caster, GetUnitFacing(caster) )
set shuri = GetLastCreatedUnit()
set loc_shuri = GetUnitLoc(shuri)
set move = PolarProjectionBJ(loc_shuri, 50.00, GetUnitFacing(shuri))
call SetUnitPositionLoc( shuri, move )
call SaveUnitHandle(table,GetHandleId(t),4,shuri)
elseif (i>10) then
set shuri=LoadUnitHandle(table,GetHandleId(t),4)
set loc_shuri = GetUnitLoc(shuri)
if (DistanceBetweenPoints(loc_shuri,loc_target) <= 50) then
call SetUnitTimeScalePercent( shuri, 0.00 )
call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(caster), loc_shuri, GetUnitFacing(shuri) )
call SetUnitTimeScalePercent( GetLastCreatedUnit(), 0.00 )
call UnitApplyTimedLife( GetLastCreatedUnit(), 'BTLF',5.00)
call KillUnit( shuri )
call DestroyEffect(AddSpecialEffectLoc("NewDirtEXNofire.mdx",loc_shuri))
call RemoveLocation(loc_target)
call RemoveLocation(loc_caster)
call RemoveLocation(loc_shuri)
call DestroyTimer(GetExpiredTimer())
set t=null
set loc_target=null
set loc_caster=null
set loc_shuri=null
set move=null
set shuri=null
set caster=null
else
set move = PolarProjectionBJ(loc_shuri, 50.00, GetUnitFacing(shuri))
call SetUnitPositionLoc( shuri, move)
call SaveUnitHandle(table,GetHandleId(t),4,shuri)
endif
endif
endfunction
private function Trig_Giant_Shuriken_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit caster = GetTriggerUnit ()
local location loc_caster = GetUnitLoc(caster)
local location loc_target = GetSpellTargetLoc()
local integer i=0
call SaveUnitHandle(table,GetHandleId(t),1,caster)
call SaveLocationHandle(table,GetHandleId(t),2,loc_target)
call SaveInteger(table,GetHandleId(t),3,i)
call SetUnitAnimation( caster, "stand" )
call CreateNUnitsAtLoc( 1, 'hrif', GetOwningPlayer(caster), loc_caster, GetUnitFacing(caster) )
call SetUnitVertexColorBJ( GetLastCreatedUnit(), 17.00, 17.00, 17.00, 0.00 )
call UnitApplyTimedLifeBJ( 0.5, 'BTLF', GetLastCreatedUnit() )
call TimerStart(t,0.05,true,function shuriken)
//set t=null
//set caster=null
//set loc_caster=null
//set loc_target=null
//call RemoveLocation(loc_caster1)
//call RemoveLocation(loc_target1)
endfunction
//===========================================================================
function InitTrig_Giant_Shuriken takes nothing returns nothing
call InitHashtableBJ( )
set table = GetLastCreatedHashtableBJ()
set gg_trg_Giant_Shuriken = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Giant_Shuriken, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Giant_Shuriken, Condition( function Trig_Giant_Shuriken_Conditions ) )
call TriggerAddAction( gg_trg_Giant_Shuriken, function Trig_Giant_Shuriken_Actions )
//set gg_trg_Giant_Shuriken = null
endfunction
endscope