JASS:
library Tag
globals
private group Tagged
private trigger TagT
private constant integer TaggerId = 039;Udre039;
private constant integer ShadowId = 039;u000039;
private constant string Message = "The Tagger has won! All the shadows have been tagged."
private constant string TaggedMessage = "Tagged!"
private constant string ReleaseMessage = "Released!"
private constant string ReleaseMessage2 = "The Tagger has been attacked! He is paused for five seconds."
private constant string ReleaseTaggerMessage = "The Tagger has been unpaused."
endglobals
private function ShadowCheck takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == ShadowId
endfunction
private function Actions takes nothing returns nothing
local integer i
local integer i2
local unit PickedUnit
local unit Attacker = GetEventDamageSource()
local unit Attacked = GetTriggerUnit()
local integer AttackerId = GetUnitTypeId(Attacker)
local integer AttackedId = GetUnitTypeId(Attacked)
local group Check = CreateGroup()
local texttag tag
if AttackerId == TaggerId then
if AttackedId == ShadowId then
call PauseUnit(Attacked, true)
call SetUnitInvulnerable(Attacked, true)
call GroupAddUnit(Tagged, Attacked)
call GroupEnumUnitsInRect(Check, bj_mapInitialPlayableArea, Condition(function ShadowCheck))
set tag = CreateTextTagUnitBJ(TaggedMessage, Attacked, 0, 8., 255, 0, 0, 0)
call SetTextTagVelocityBJ(tag, 15, 90)
call SetTextTagPermanent(tag, false)
call SetTextTagLifespan(tag, 3)
loop
set PickedUnit = FirstOfGroup(Check)
if IsUnitInGroup(PickedUnit, Tagged) then
set i = i + 1
endif
set i2 = i2 + 1
endloop
if i == i2 then
set i = 0
loop
call DisplayTextToPlayer(Player(i), 0, 0, Message)
set i = i + 1
endloop
endif
endif
elseif AttackerId == ShadowId then
if AttackedId == TaggerId then
call DisplayTextToPlayer(Player(i), 0, 0, ReleaseMessage2)
loop
call SetPlayerState(GetOwningPlayer(Attacker), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(Attacker), PLAYER_STATE_RESOURCE_GOLD) + 100)
set PickedUnit = FirstOfGroup(Tagged)
set tag = CreateTextTagUnitBJ(ReleaseMessage, Attacked, 0, 8., 255, 0, 0, 0)
call SetTextTagVelocityBJ(tag, 15, 90)
call SetTextTagPermanent(tag, false)
call SetTextTagLifespan(tag, 3)
call PauseUnit(PickedUnit, false)
call SetUnitInvulnerable(PickedUnit, false)
exitwhen PickedUnit == null
endloop
call PauseUnit(Attacked, true)
call SetUnitInvulnerable(Attacked, true)
call PolledWait(5.)
call DisplayTextToPlayer(Player(i), 0, 0, ReleaseTaggerMessage)
call PauseUnit(Attacked, false)
call SetUnitInvulnerable(Attacked, false)
endif
endif
endfunction
//===========================================================================
function RegisterUnit takes unit u returns nothing
call TriggerRegisterUnitEvent(TagT, u, EVENT_UNIT_DAMAGED)
call TriggerAddAction(TagT, function Actions)
endfunction
endlibrary
Yes, the map I'm using this code for is a tag map. I register the Shadows in their creation trigger and on the tagger's trigger, but this code isnt working at all. Not at all.
This code pauses and makes the tagged runner invulnerable. When another runner attacks the Tagger, every tagged runner will be unpaused and will lose invulnerability and the tagger will be paused and invulnerable for 5 seconds.
I'm working on my friends map, btw. +rep when helped.