[I7] Taking all from an NPC

I have a little issue with taking all from an NPC. In my game an NPC can be killed and it is then possible to take objects from the corpse. This is working fine by create a new “can’t take people’s possessions rule”.

The issue I have is that “GET ALL” is giving an odd response if attempted more than once, when the NPC is no longer carrying anything -

I’ve no idea what I7 thinks I’m trying to take. How do I change this to a more sensible, “…is not carrying anything…” type message?

Try typing “actions on” and repeating the action. This may give you a clearer idea of what the game is interpreting your command as.

“TAKE (something/all) FROM (something)” maps to the removing it from action, not the taking action. So you are falling foul of the can’t remove from people rule. You will need to adapt that one as well as the can’t take people’s possessions rule.

(As CKY says, the ACTIONS command is the way to diagnose this problem.)

If you don’t want to mess extensively with rules, a kludge I’ve used is to add in code so that when an NPC is “killed” all the items held by them are moved to the location. Even fancier, you could swap their possessions to a “corpse” object of the NPC which is a supporter, and move all there possessions to the corpse. That way you get “On the dead body are a pack of gum, a set of keys, and a fitbit.”

Ahhh, didn’t know about the “can’t remove from people rule”. Still having some problems though but I think the moving objects to the location could be the answers. Thanks.

The other moderate difficulty option is to just create your own new verb and redirect to it via check rules:

[code]“Lootfest”

looting is an action applying to one touchable thing, and requiring light. Understand “loot [something]” as looting.

Check looting:
if the noun is not held by a person:
try taking the noun instead.

Check looting:
if the noun is held by yourself:
say “You used to practice pickpocketing yourself, but you’re way past that.” instead.

Before looting:
if the noun is a dead person:
try examining the noun instead.

lootedone is a person that varies.

Carry out looting:
now lootedone is the holder of the noun;
now the player carries the noun.

Report looting:
say “You rifle through [the lootedone]'s possessions and obtain [the noun].”

a person can be dead.

Before taking:
if the noun is held by a person (called victim):
if victim is yourself:
continue the action;
if victim is dead:
try looting the noun instead;
otherwise:
say “That might not be so easy while [the victim] is breathing.” instead.

Den of Thieves is a room.

Bob is a person in Den of Thieves. Bob carries a gold watch. The description of bob is “[if bob is dead]It appears to be the remains of Bob. [end if][if bob holds something]Bob seems to be in possession of [a list of things held by bob].[otherwise]Bob appears to have nothing of value to you on him.[end if]”

Instead of jumping:
now bob is dead;
say “Bob, thinking there is an earthquake, has an instant heart attack and keels over, dead. Good riddance.”
[/code]

And back to your original question, GET ALL now can be accomplished by saying LOOT BOB if you extend the Before Looting rule:

Before looting: if the noun is a dead person: if the noun holds nothing: say "[The noun] has already been picked clean of valuables."; rule fails; otherwise: say "You take [a list of things held by the noun]."; now every thing held by the noun is carried by the player; rule succeeds.

[rant=Entire code with the new rule][code]“Lootfest”

looting is an action applying to one touchable thing, and requiring light. Understand “loot [something]” as looting.

Check looting:
if the noun is not held by a person:
try taking the noun instead.

Check looting:
if the noun is held by yourself:
say “You used to practice pickpocketing yourself, but you’re way past that.” instead.

Before looting:
if the noun is a dead person:
if the noun holds nothing:
say “[The noun] has already been picked clean of valuables.”;
rule fails;
otherwise:
say “You take [a list of things held by the noun].”;
now every thing held by the noun is carried by the player;
rule succeeds.

lootedone is a person that varies.

Carry out looting:
now lootedone is the holder of the noun;
now the player carries the noun.

Report looting:
say “You rifle through [the lootedone]'s possessions and obtain [the noun].”

a person can be dead.

Before taking:
if the noun is held by a person (called victim):
if victim is yourself:
continue the action;
if victim is dead:
try looting the noun instead;
otherwise:
say “That might not be so easy while [the victim] is breathing.” instead.

Den of Thieves is a room.

Bob is a person in Den of Thieves. Bob carries a gold watch. Bob carries a set of dentures. The description of bob is “[if bob is dead]It appears to be the remains of Bob. [end if][if bob holds something]Bob seems to be in possession of [a list of things held by bob].[otherwise]Bob appears to have nothing of value to you on him.[end if]”

Instead of jumping:
now bob is dead;
say “Bob, thinking there is an earthquake, has an instant heart attack and keels over, dead. Good riddance.”

[/code][/rant]

(Nitpick: the looted one should be an action variable, so it’s maintained properly across recursion.)

The looting action has an object called the looted one.

(Action variables are pushed onto the stack before a recursive call, so they can be restored afterward. Globals just get smashed.)

Oh, right, forgot about that. So then how does the “setting action variables for looting…” part work; is it just

Rule for setting action variables for looting:
now the looted one is the holder of the noun.

I’ve done it so infrequently that I’m not sure quite how it works.

Basically that; I tend to write it as “Setting action variables for looting:”. Setting action variables happens before any action processing takes place so you can refer to them in any other action rule.

So:

the looting action has a thing that varies called looted one.

setting action variables for looting:
now looted one is the noun.

?

The looting action has an object called the looted one.

(“Object” so we can use “nothing”, and you don’t need to specifically make it variable.)