tommerbob
Minecraft. :D
- Reaction score
- 110
I've got a spell that when a unit comes within 50 of a trap, the unit is ensnared, and the trap is removed from the game. Code:
In the Act method, the trap is supposed to be removed. The problem is, how do I reference the trap?
JASS:
private struct Trap extends array
//! runtextmacro AIDS()
private trigger t
private triggeraction ta
private static method Act takes nothing returns nothing
local thistype d = thistype[GetTriggerUnit()]
call UnitAddAbility(DUMMY, TRAP_ID) //Add dummy buff
call IssueTargetOrder(DUMMY, "ensnare", d.unit)
call UnitRemoveAbility(DUMMY, TRAP_ID)
call RemoveUnit(????) // <---------- How do I reference the trap unit to remove it?
endmethod
private static method AIDS_filter takes unit u returns boolean
return GetUnitTypeId(u) == TRAP
endmethod
private method AIDS_onCreate takes nothing returns nothing
set this.t = CreateTrigger()
set this.ta = TriggerAddAction(this.t,function thistype.Act)
call TriggerRegisterUnitInRange(this.t, this.unit, 50., null)
endmethod
private method AIDS_onDestroy takes nothing returns nothing
call TriggerRemoveAction(this.t, this.ta)
call DestroyTrigger(this.t)
set this.ta = null
set this.t = null
endmethod
endstruct
In the Act method, the trap is supposed to be removed. The problem is, how do I reference the trap?