- Joined
- May 4, 2007
- Messages
- 2,260
Hi guys, I know we all must be tired from seeing this post but fact is .. I am having problem once more ... Now because I lost O2 and Wolf's codes, when can just say I am in a crappy situation.
Now do the following code works .. for the first second only !! and I don't know why again ... ca you guys help me again plz ?
It uses Katana's Handle System, but I think it is very easy to understand.
If some1 could help again =S
Now do the following code works .. for the first second only !! and I don't know why again ... ca you guys help me again plz ?
JASS:
function GasBomb_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'h000'
endfunction
//==========================================================
function GasBomb_Effect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit bomb = GetHandleUnit(t, "bomb")
local group g = CreateGroup()
local unit f
local player p = GetOwningPlayer(bomb)
local unit dum
call GroupEnumUnitsInRange( g, GetUnitX( bomb ), GetUnitY( bomb ), 250, Filter(null) )
loop
set f = FirstOfGroup(g)
exitwhen (f == null)
call GroupRemoveUnit(g,f)
if IsUnitEnemy(f, p) then
set dum = CreateUnit(p, 'h007', GetUnitX(f), GetUnitY(f), 0)
call UnitAddAbility(dum, 'A007')
call IssueTargetOrder(dum, "shadowstrike", f)
call UnitApplyTimedLife(dum, 'BTLF', 1.5)
endif
endloop
call DestroyGroup(g)
set g = null
set t = null
set p = null
set bomb = null
set dum = null
endfunction
//=========================================================
function GasBomb_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real uX = GetUnitX(u)
local real uY = GetUnitY(u)
local player p = GetOwningPlayer(u)
local timer t = CreateTimer()
local unit eff = CreateUnit(p, 'h008', uX, uY, 0)
call UnitApplyTimedLife(eff, 'BTLF', 10)
call SetHandleHandle(t, "bomb", u)
call TimerStart(t, 1.0, true, function GasBomb_Effect)
call TriggerSleepAction(10.0)
call FlushHandleLocals(t)
call DestroyTimer(t)
set u = null
set p = null
set t = null
set eff = null
endfunction
//===========================================================================
function InitTrig_GasBombs takes nothing returns nothing
set gg_trg_GasBombs = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_GasBombs, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_GasBombs, Condition( function GasBomb_Conditions))
call TriggerAddAction( gg_trg_GasBombs, function GasBomb_Actions )
endfunction
It uses Katana's Handle System, but I think it is very easy to understand.
If some1 could help again =S