-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExtraDummy.opy
32 lines (28 loc) · 1.22 KB
/
ExtraDummy.opy
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
#!mainFile "ZombieEscape.opy"
rule "add or re-add extra dummy":
@Event global
@Condition addExtraDummy and extraDummy == null and getNumberOfPlayers(Team.ALL) < 12
if hostPlayer != null:
#usually, the host player will stay longer than other players
extraDummySlot = hostPlayer.getSlot()
else:
extraDummySlot = random.choice(getAllPlayers()).getSlot()
destroyHudText(cannotPutExtraDummyHud)
createDummy(extraDummyHero, Team.ALL, extraDummySlot, extraDummyPosition, vect(0,0,0))
extraDummy = getLastCreatedEntity()
extraDummy.setMaxHealth(extraDummyMaxHp)
wait()
heal(extraDummy, null, 9999999)
damage(extraDummy, null, extraDummyMaxHp-extraDummyHp)
rule "can't add extra dummy":
@Event global
@Condition addExtraDummy and extraDummy == null and getNumberOfPlayers(Team.ALL) >= 12
hudHeader(getAllPlayers(), "A player needs to leave & rejoin for the map to work correctly!", HudPosition.TOP, -500, Color.RED, HudReeval.VISIBILITY_AND_STRING, SpecVisibility.ALWAYS)
cannotPutExtraDummyHud = getLastCreatedText()
rule "update dummy hp":
@Event global
@Condition extraDummy != null
do:
extraDummyHp = extraDummy.getHealth()
wait()
while RULE_CONDITION