Find
You are looking at a material called lpas
Created by
omenofdoom
, last updated 09 Mar 2008
Code
if second of gives then checkgift;
if target of hit then setwho;
if target of wakes then respawn;
if reacting to noguard then guardfail;
if reacting to arrives then doitnow;
// slot1 = person who last hit me, will be owner of treasure I drop
// slot2 = weapon I last wielded, which I attempt to keep wielding while alive
// slot3 = object I last guarded, which I attempt to keep guarding while alive
##checkgift:
$gmsg = "[$actor] shrugs at [$init_obj],'I can only accept gifts from my master.";
if $actor's owner ne $init_obj then giveitback else checkgiftw;
##checkgiftw:
$wrth = $actor's worth;
divide $wrth by 10;
$gmsg = "[$actor] shrugs at [$init_obj],'Sorry master, but I can not accept gifts worth more than $wrth pennies.";
if $target's worth > $wrth then giveitback else takegift;
##giveitback:
print "$gmsg";
update $target = "loc='$loc',pose=''";
print "[$actor] drops [$target]";
relook $loc;
##takegift:
print "[$actor] says,'Thank you, master.'";
find $actor,'pouch';
if $found_id > 0 then continue else makepouch;
set $target's loc to $found_id;
print "[$actor] places [$target] inside [$found_id]";
##makepouch:
set $actor's pouch to 'treasure';
print "[$actor] makes a pouch";
find $actor,'pouch';
##setwho:
set $actor's slot1 to $init_obj;
##tickloc:runsub ticked;
##ticked:
if $actor's health > 0 then alive else dead;
##alive:
$weapon is wielded by $actor;
if $weapon > 0 then keepweap else getweap;
$pose = $actor's pose;
if $pose eq 'guarding' then setguard else checkguard;
set $actor's counter to 0;
##dead:
if $actor's counter < 1 then justdied;
$cnt = $actor's counter;
add 1 to $cnt;
set $actor's counter to $cnt;
if $actor's counter > 50 then respawn;
##respawn:
if $actor's health > 0 then continue else respawn2;
##respawn2:
$ahm = $actor's healthmax;
update $actor = "pose='',health='$ahm',counter=0";
print "[$actor] returns to life!";
relook $loc;
##justdied:
$actdead = (slumps to the floor,gasps one last breath then falls,cries out in agony then is silent);
print "[$actor] $actdead.";
find $actor,'pouch';
if $found_id > 0 then picktreasure;
$hm = $actor's healthmax;
multiply $hm by 30;
call "respawn $actor",$hm;
##picktreasure:
find $found_id,random;
if $found_id > 0 then treasure1;
##treasure1:
$wrth = $found_id's worth;
$qty = $found_id's qty;
$pclass = $found_id's pclass;
copy $found_id;
set $found_id's worth to $wrth;
update $new_id = "worth='$wrth',loc='$loc',pwd='',pose='',owner='$who',qty='$qty',pclass='$pclass'";
print "[$actor] drops [$new_id]";
relook $loc;
##keepweap:
if $actor's slot2 ne $weapon then keepweap2;
##keepweap2:
set $actor's slot2 to $weapon;
print "[$actor] looks at [$weapon] and grins wickedly";
##getweap:
$weapon = $actor's slot2;
if $weapon > 0 then getweap2;
##getweap2:
if $weapon's loc eq $actor's loc then wieldit else whereisit;
##wieldit:
call "wield $weapon";
##whereisit:
print "[$actor] looks around the room for [$weapon] but can't see it.";
set $actor's slot2 to '';
##setguard:
if $actor's slot3 > 0 then continue else setguard2;
##setguard2:
$host = $actor's host;
set $actor's slot3 to $host;
print "[$actor] eyes the area for any threat to [$host]";
##checkguard:
$slot3 = $actor's slot3;
if $slot3 > 0 then reguard;
##guardfail:
if $init_obj == $actor then clearguard;
##reguard:
if $slot3's loc eq $loc then reguard2 else clearguard;
##reguard2:
if $slot3's health > 0 then reguard3;
##reguard3:
print "[$actor] returns to guarding [$slot3]";
call "guard $slot3";
##clearguard:
print "[$actor] stops guarding [$slot3]";
set $actor's slot3 to '';
##doitnow:
print "[$actor] says 'Unless you want to end up like that body upstairs, I would suggest you leave. Now.'";