Iscript Code
EVT_EXAMINE
if(ch.level > self.level)
do_cmd("cower");
else if(ch.align < self.align)
do_cmd("spit " + ch.name);
else
do_cmd("bow " + ch.name);
_asm EVT_EXAMINE
0: CHAR_ACCESS t1 ch LEVEL
1: CHAR_ACCESS t2 self LEVEL
2: SGT t3 t1 t2
3: BNZ t3 16
4: CHAR_ACCESS t1 ch ALIGN
5: CHAR_ACCESS t2 self ALIGN
6: SLT t3 t1 t2
7: BNZ t3 12
8: CHAR_ACCESS t1 ch NAME
9: STRCAT str4 str3 t1
10: DO_CMD str4
11: EXIT
12: CHAR_ACCESS t1 ch NAME
13: STRCAT str4 str2 t1
14: DO_CMD str4
15: EXIT
16: DO_CMD str1
17: EXIT
_asm
t1, t2, t3 are temporary places in memory
str1, str2, str3 hold the string consts "bow " "spit " "cower"
str4 is a temp string
self, ch are reserved var names for script owner and evt trigger-er
EVT_MOVE
Object corpse;
Room here;
here = self.room;
if(here.is_occupied)
begin
do_cmd("say Hello, I'm Detective Stuart from Homicide");
end
corpse = select from here.contents where (corpse.is_corpse);
Integer a;
if(corpse)
begin
a = self.check_skill("autopsy", corpse);
if(a)
begin
do_cmd("say hrm...");
ch = corpse.get_killer;
if(ch.is_connected)
begin
do_cmd("Looks like " + ch.name + "'s work again");
self.hunt(ch);
end
else
begin
do_cmd("say Dammit. " + ch.name + " got away again!");
do_cmd("junk corpse");
end
end
else
begin
do_cmd("say Another unsolved murder...");
do_cmd("sigh");
do_cmd("junk corpse");
end
end
_asm EVT_MOVE
0: CHAR_ACCESS here self ROOM
1: ROOM_ACCESS t1 here IS_OCCUPIED
2: BEZ 2
3: DO_CMD str13
4: ROOM_ACCESS t1 here CONTENTS
5: LIST_ACCESS t2 t1 SIZE
6: MOVI t3 0
7: BEQ t3 t2 8
8: LIST_ACCESS t4 t1 ELEMENT t3
9: OBJ_ACCESS t5 t4 IS_CORPSE
10: BNZ t5 3
11: ADDI t3 t3 1
12: JMP -5
13: MOV corpse t4
14: JMP 2
15: MOVI corpse 0
16: BNZ corpse 2
17: EXIT
18: DO_CMD str1
19: CHAR_ACCESS t1 self CHECK_SKILL 584
20: BNZ t1 5
21: DO_CMD str7
22: DO_CMD str8
23: DO_CMD str6
24: EXIT
25: DO_CMD str2
26: OBJ_ACCESS ch corpse GET_KILLER
27: CHAR_ACCESS t1 ch IS_CONNECTED
28: BNZ t1 4
29: DO_CMD str5
30: DO_CMD str6
31: EXIT
32: CHAR_ACCESS str10 ch NAME
33: STRCAT str11 str3 str10
34: STRCAT str10 str11 str4
35: DO_CMD str10
36: CHAR_ACCESS t1 self SET_HUNT ch
37: EXIT
_asm
This script causes a mob to, whenever
he moves between rooms, identify himself and
look for a corpse. If a corpse exists, he
attempts to identify the killer. If he
identifies the killer he attempts to hunt
the killer down.
The Detective in the script knows his name.. to be able to apply the
script to several mobs, you could change the line to:
do_cmd("say Hello, I'm Detective " + self.name + " from Homicide");