-
Notifications
You must be signed in to change notification settings - Fork 0
/
ZombiePlaque.txt
36 lines (35 loc) · 1.14 KB
/
ZombiePlaque.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- Register the behaviour
behaviour("ZombiePlaque")
--add listeners
function ZombiePlaque:Start()
GameEvents.onActorDied.AddListener(self, "OnActorDied")
GameEvents.onActorSpawn.AddListener(self, "OnActorSpawn")
end
--On Actor Died call this function with team check and player check
function ZombiePlaque:OnActorDied( actor , killer, isSilent)
if actor.team == Team.Blue and killer.team == Team.Red then
if actor.isPlayer == true then
local infectspawn = ActorManager.CreateAIActor(Team.Red)
infectspawn.SpawnAt(actor.position, Quaternion(0,0,0,0))
infectspawn.Damage(-2000)
killer.damage(-100)
else
local infectspawn = ActorManager.CreateAIActor(Team.Red)
infectspawn.SpawnAt(actor.position, Quaternion(0,0,0,0))
infectspawn.Damage(-2000)
killer.damage(-100)
actor.Deactivate()
end
end
end
--Spawn Function with Team Check
function ZombiePlaque:OnActorSpawn(actor2)
if actor2.team == Team.Red then
local health_rand2 = Random.Range(-1000, -5000)
actor2.damage(health_rand2)
else actor2.damage(-50)
end
end
--update not needed
function ZombiePlaque:Update()
end