Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Calling a function

Calling a function

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Denisius   (1 post)  Bio
Date Tue 24 Jun 2008 10:47 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 26 Jun 2008 01:09 AM (UTC)
Message
I don't know personally, you could try asking at www.smaugmuds.org

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #2 on Thu 26 Jun 2008 05:12 AM (UTC)

Amended on Thu 26 Jun 2008 05:15 AM (UTC) by Robert Powell

Message
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.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,721 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.