Charapanga
New Member
- Reaction score
- 46
JASS:
scope Trigger initializer Init
globals
private constant integer ZombieId = 039;nzom039;
// Unit id of the zombie
private constant integer MarineId = 039;hrif039;
//Unit id of the marine
private player p
private player kp
endglobals
private function UnallyMarine takes nothing returns nothing
call SetPlayerAllianceStateBJ(p, GetEnumPlayer(), bj_ALLIANCE_UNALLIED)
endfunction
private function AllyZombie takes nothing returns nothing
call SetPlayerAllianceStateBJ(p, GetEnumPlayer(), bj_ALLIANCE_ALLIED_VISION)
endfunction
private function Actions takes nothing returns nothing
local unit u = GetDyingUnit()
local unit ku = GetKillingUnit()
local location l = GetUnitLoc(u)
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local force f = CreateForce()
local force zf = CreateForce()
set p = GetOwningPlayer(u)
set kp = GetOwningPlayer(ku)
call ForceEnumAllies(f, p, null)
call ForceEnumAllies(zf, kp, null)
if GetUnitTypeId(ku) == ZombieId then
call CreateUnitAtLoc(p, ZombieId, GetPlayerStartLocationLoc(p), 0)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(kp)+" has killed "+GetPlayerName(p)+" and has turned him into a zombie!")
call ForForce(f, function UnallyMarine)
call ForForce(zf, function AllyZombie)
elseif GetUnitTypeId(ku) == MarineId then
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(kp)+" has killed the zombie "+GetPlayerName(p)+"!")
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_DEATH, null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddAction( t, function Actions )
endfunction
endscope
I know there are alot of BJs but..