wait in JASS

exge

New Member
Reaction score
15
hi, i want to make a wait in jass like the gui function
wait for condition ...
also, my chain spell is below .. im sure .. i will seem like a noob .. so i need your help to make it more jass like and better ..

PHP:
function Trig_chain_venom_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A04G'
endfunction

function Trig_chain_venom_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local location targetloc = GetUnitLoc(target)
local group targetgrp = GetUnitsInRangeOfLocAll(512,targetloc)
local integer max = GetUnitAbilityLevelSwapped('A04G',caster)*4
local integer count = 0
local unit dummy

//=====create dummy and damage target======================================

call CreateNUnitsAtLoc( 1, 'h003', GetOwningPlayer(caster), GetUnitLoc(caster), bj_UNIT_FACING )
set dummy = GetLastCreatedUnit()
call UnitAddAbilityBJ('A04H',dummy)
call IssueTargetOrderBJ(dummy, "shadowstrike",target)
call UnitApplyTimedLifeBJ( 2.00, 'BTLF',dummy)

set count = count + 1
//===========================call GroupRemoveUnitSimple(target,targetgrp)
call PolledWait(2.0)
//=====start loop==========================================================

loop

call CreateNUnitsAtLoc( 1, 'h003', GetOwningPlayer(caster), GetUnitLoc(target), bj_UNIT_FACING )
set dummy = GetLastCreatedUnit()
set target = GroupPickRandomUnit(targetgrp)
call UnitAddAbilityBJ('A04H',dummy)
call IssueTargetOrderBJ(dummy, "shadowstrike",target)
call UnitApplyTimedLifeBJ( 2.00, 'BTLF',dummy)

//===========================call GroupRemoveUnitSimple(target,targetgrp)
set count = count + 1
call PolledWait(1.0)
exitwhen count == max
endloop

//==========================================================================
//===============================Clear the leaks============================
//==========================================================================

set caster = null
set target = null
set dummy = null
call RemoveLocation(targetloc)
call DestroyGroup(targetgrp)

endfunction

//===========================================================================
function InitTrig_chain_venom takes nothing returns nothing
    set gg_trg_chain_venom = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_chain_venom, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_chain_venom, Condition( function Trig_chain_venom_Conditions ) )
    call TriggerAddAction( gg_trg_chain_venom, function Trig_chain_venom_Actions )
endfunction
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top