-
Notifications
You must be signed in to change notification settings - Fork 0
/
ZombiePlaqueEASY.txt
36 lines (35 loc) · 1.19 KB
/
ZombiePlaqueEASY.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("ZombiePlaqueEASY")
--add listeners
function ZombiePlaqueEASY: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 ZombiePlaqueEASY: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(-800)
killer.damage(-100)
else
local infectspawn = ActorManager.CreateAIActor(Team.Red)
infectspawn.SpawnAt(actor.position, Quaternion(0,0,0,0))
infectspawn.Damage(-800)
killer.damage(-100)
actor.Deactivate()
end
end
end
--spawn function with team check
function ZombiePlaqueEASY:OnActorSpawn(actor2)
if actor2.team == Team.Red then
local health_rand2 = Random.Range(-550, -1200)
actor2.damage(health_rand2)
else actor2.damage(-50)
end
end
--update not needed
function ZombiePlaqueEASY:Update()
end