- Joined
- Dec 17, 2017
- Messages
- 39
Hey guys,
i try to call a function, but it just doesnt get called.. i cant find the reason:/
please help me
the rows of stars (*****) mark the two important parts:
i try to call a function, but it just doesnt get called.. i cant find the reason:/
please help me
the rows of stars (*****) mark the two important parts:
JASS:
function startAbility takes unit caster, unit target, integer ab, real x, real y, real angle returns nothing
local timer t=CreateTimer()
// ************now this is the important part*************
call DisplayTextToForce( GetPlayersAll(), "startAbility fuction: the call was successful." )
//this message never appears...
// *************************************************
call TimerStart(t, 0.05, false, function participateAbility)
call SaveUnitHandle(udg_TheHashtable1, GetHandleId(t), 1, caster)
call SaveUnitHandle(udg_TheHashtable1, GetHandleId(t), 2, target)
call SaveInteger(udg_TheHashtable1, GetHandleId(t), 3, ab)
call SaveReal( udg_TheHashtable1, GetHandleId(t), 4, x )
call SaveReal( udg_TheHashtable1, GetHandleId(t), 5, y )
call SaveReal( udg_TheHashtable1, GetHandleId(t), 6, angle )
call SaveInteger( udg_TheHashtable1, GetHandleId(t), 7, LoadInteger(udg_TheHashtable1, ab, 1)) //cyclen des timers
set t=null
endfunction
// Melee-Attack:
function Trig_AttackMeleeNewer_Actions takes nothing returns nothing
local unit caster
local unit target
local integer key
local integer i1
set caster=GetAttacker()
set key = GetHandleId(caster)
set i1 = LoadInteger(udg_TheHashtable1, key, udg_hashUnitRanged1)
if ( i1 > 0 ) then
else
// ************now this is the important part*************
// startAbility takes unit caster, unit target, integer ability, real x, real y, real angle
call DisplayTextToForce( GetPlayersAll(), "startAbility fuction is called (from AttackMeleeNewer-Trigger." )
//this message appears on each attack!
call startAbility(caster, target, 'A000', GetUnitX(caster), GetUnitY(caster), GetUnitFacing(caster) )
// *************************************************
endif
set caster=null
set target=null
endfunction
//===========================================================================
function InitTrig_AttackMeleeNewer takes nothing returns nothing
set gg_trg_AttackMeleeNewer = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_AttackMeleeNewer, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_AttackMeleeNewer, function Trig_AttackMeleeNewer_Actions )
endfunction