>i want to compare GET_NAME(ch) with the name (not alias) of a object, in
>this case a corpse. i am thinking of a quick for loop, checking all the
>objects in a room to see if they are: 1) the corpse of GLOK, 2) a corpse.
>can anyone help me with this loop?
The corpse check is the easy part. Here's what I do:
if (GET_OBJ_TYPE(obj) == TYPE_CPNTAINER && GET_OBJ_VAL(obj, 3) == 1) {
// insert your code here
}
Now the comparing thing is a little more difficult. What I did is make
a new int value in the object structures called obj->owner. I made a
macro in utils.h so that I can use GET_OWNER(obj) to get the value there.
This allows me to do things like this:
if (GET_OBJ_TYPE(obj) == TYPE_CPNTAINER && GET_OBJ_VAL(obj, 3) == 1) {
if (GET_OWNER(obj) != GET_IDNUM(ch) && GET_OWNER(obj) != -1) {
send_to_char("Corpse looting is NOT allowed\r\n", ch);
return;
}
}
This will check if the corpse is the owner's and if it isn't then it won't
let them get it. You also have to do something similar in perform_get_from_
container so that they can't type "get sword corpse" or something like that.
Also the -1 is an NPC's corpse which they SHOULD be able to get...see below.
And one more thing. In void make_corpse you'll have to actually set the
owner field. I do something like this:
if (!IS_NPC)
GET_OWNER(corpse) = GET_IDNUM(ch);
else GET_OWNER(corpse) = -1;
Hope that helps you. I don't have a morgue, but I have anti corpse-looting
code. Mine is more complex because I have OUTLAWs who are allowed to loot
other outlaws, etc. I plan to expand this so that players can "trust"
another
player to get their corpse.
-Brian
+----------------------------------+
| Please reply to guil9964@gmi.edu |
+----------------------------------+
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST