| 1 |
import Crossfire |
| 2 |
import random |
| 3 |
#This script allows the purple worm to eat players/monsters |
| 4 |
eatmap = '/planes/purpleworm' |
| 5 |
eat_x = 6 |
| 6 |
eat_y = 6 |
| 7 |
|
| 8 |
worm = Crossfire.WhoAmI() |
| 9 |
me = Crossfire.WhoIsOther() |
| 10 |
r = random.random() |
| 11 |
|
| 12 |
if (r <= 0.26): |
| 13 |
if (me.__class__ is Crossfire.Player): |
| 14 |
isplayer = 1 |
| 15 |
elif (me.Alive == True): |
| 16 |
isplayer = 0 |
| 17 |
else: |
| 18 |
isplayer = 2 |
| 19 |
|
| 20 |
if isplayer == 1: |
| 21 |
me.Map.Print("\nYou are swallowed whole by the %s!" % (worm.Name)) |
| 22 |
map = Crossfire.ReadyMap(eatmap) |
| 23 |
if map: |
| 24 |
me.Teleport(map, eat_x, eat_y) |
| 25 |
else: |
| 26 |
Crossfire.Log(Crossfire.LogError, "There is no eat map") |
| 27 |
|
| 28 |
elif isplayer == 0: |
| 29 |
me.Map.Print("\nThe %s is swallowed whole by the %s!" % (me.Name, worm.Name)) |
| 30 |
|
| 31 |
while (me.Inventory is not None): |
| 32 |
me.Inventory.InsertInto(worm) |
| 33 |
|
| 34 |
mexists = Crossfire.WhoIsOther() |
| 35 |
if mexists: |
| 36 |
me.Remove() |
| 37 |
else: |
| 38 |
worm.Map.Print('doesnt exist') |
| 39 |
else: |
| 40 |
me.Map.Print("\nThe %s misses the %s" % (worm.Name, me.Name)) |