Calling a function

Posted by Denisius on Tue 24 Jun 2008 10:47 AM — 3 posts, 15,894 views.

#0
I use CalareyMUD, a derivative of SMAUG.

Now, in the MUD after you die you turn into a ghost, and have to type in 'reborn', to be reborn as a living player again.

There is also a command/spell called 'morph', that does just what the name suggests, it morphs you into another creature.

Now, whenever you die and are reborn, your race should change, and that is working great. The problem is, whenever a place uses the morph command while being a ghost, he enters the world just as he was, with his race intact.

I was thinking of while being a ghost, to not allow any spells or skills to be used, including morph. But I have little idea as to how I should have that done, as I am not very familiar with the SMAUG codebase, and especially one as heavily modified as CalareyMUD is.

Any suggestions are welcomed.
Australia Forum Administrator #1
I don't know personally, you could try asking at www.smaugmuds.org
Australia #2
You could just check if the pc race is a ghost and not let them perform that command.

You would need to look though the code and add that type of check into each skill.

You could also use a flag on each skill, spell and command and then check for the presence of that flag when the command goes into interpret.

There are a number of ways that you an achieve this, how you personally do it tho will depend on how familuar you are with the codebase your using, your understanding of C and how much time you have on your hands to do this.

Preferentially i would use a flag method as i don't like to have a huge amount of redundant if checks all through my code, but seeing that your not very skilled with code i would say the easiest method would be to check for the ghost race in each command, because then its really just an exercise in cut and paste.


if ( !IS_NPC ( ch ) && (ch->race == RACE_GHOST ))
{
   send_to_char("Sorry ghost's are not allowed to do that",ch);
   return;
}


If ch is not an npc and ch's race equals race ghost, peform send_to and exit from the function.