For some reason, the part where it rescues (TraditionalActions) doesnt work. Can anyone tell me why that happens?
Runner is a variable from a different trigger.
Runner is a variable from a different trigger.
JASS:
library Tag initializer Init requires BoolexprUtils
globals
private constant integer WispId = 039;n000039;
group TaggedGroup = CreateGroup()
private integer array RunnerType
integer TaggedAmt = 0
endglobals
private function TraditionalActions takes nothing returns nothing
local unit u = GetEnteringUnit()
local unit PickedUnit
local integer i = 0
if IsUnitType(u, UNIT_TYPE_PEON) == true then
loop
set PickedUnit = FirstOfGroup(TaggedGroup)
exitwhen PickedUnit == null
set TaggedAmt = TaggedAmt - 1
set i = i + 1
call SetUnitX(Runner[GetPlayerId(GetOwningPlayer(PickedUnit))], GetUnitX(PickedUnit))
call SetUnitY(Runner[GetPlayerId(GetOwningPlayer(PickedUnit))], GetUnitY(PickedUnit))
call ShowUnit(Runner[GetPlayerId(GetOwningPlayer(PickedUnit))], true)
call PauseUnit(Runner[GetPlayerId(GetOwningPlayer(PickedUnit))], false)
call IssueImmediateOrder(Runner[GetPlayerId(GetOwningPlayer(PickedUnit))], "stop")
if (GetLocalPlayer() == Runner[GetPlayerId(GetOwningPlayer(PickedUnit))]) then
call ClearSelection()
call SelectUnit(Runner[GetPlayerId(GetOwningPlayer(PickedUnit))], true)
endif
call GroupRemoveUnit(TaggedGroup, PickedUnit)
call RemoveUnit(PickedUnit)
endloop
if i > 0 then
set i = 0
loop
call DisplayTextToPlayer(Player(i), 0, 0, "|c"+PlayerColors[GetPlayerId(GetOwningPlayer(u))]+GetPlayerName(GetOwningPlayer(u))+ColorEnd+" has released the prisoners.")
exitwhen i == 11
set i = i + 1
endloop
endif
endif
set u = null
endfunction
private function SwitchTag takes nothing returns nothing
endfunction
private function FreezeTag takes nothing returns nothing
endfunction
private function Action takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit k = GetEventDamageSource()
local player p = GetOwningPlayer(u)
local unit PickedUnit = null
local group g = CreateGroup()
local integer i = 0
local integer PUI
local unit w
if IsUnitType(u, UNIT_TYPE_PEON) == true and GetUnitAbilityLevel(u, 039;B000039;) == 0 and GetUnitAbilityLevel(u, 039;B003039;) == 0 then
if IsUnitAlly(k, GetOwningPlayer(u)) != true then
set TaggedAmt = TaggedAmt + 1
call ShowUnit(u, false)
call PauseUnit(u, true)
call GroupEnumUnitsOfPlayer(g, p, BOOLEXPR_TRUE)
loop
set PickedUnit = FirstOfGroup(g)
exitwhen PickedUnit == null
if IsUnitType(PickedUnit, UNIT_TYPE_STRUCTURE) == true then
call KillUnit(PickedUnit)
endif
endloop
loop
call DisplayTextToPlayer(Player(i), 0, 0, "|c"+PlayerColors[GetPlayerId(GetOwningPlayer(k))]+GetPlayerName(GetOwningPlayer(k))+ColorEnd+" has tagged "+"|c"+PlayerColors[GetPlayerId(GetOwningPlayer(u))]+GetPlayerName(GetOwningPlayer(u))+ColorEnd+".")
exitwhen i == 11
set i = i + 1
endloop
set w = CreateUnit(p, WispId, GetStartLocationX(GetPlayerStartLocation(p)), GetStartLocationX(GetPlayerStartLocation(p)), 0)
call GroupAddUnit(TaggedGroup, w)
endif
endif
set u = null
set w = null
set k = null
endfunction
function AddTag takes unit u returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_DAMAGED)
call TriggerAddAction(t, function Action)
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local trigger trig = CreateTrigger()
local region TagRegion = CreateRegion()
call RegionAddRect(TagRegion, gg_rct_TagZone)
call TriggerRegisterEnterRegion(trig, TagRegion, BOOLEXPR_TRUE)
call TriggerAddAction(trig, function TraditionalActions)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(t, function Action)
endfunction
endlibrary