The Dawn Of Time
The Official Forums for the Dawn Of Time Mud Codebase
 
Log in Register FAQ Memberlist Search The Dawn Of Time Forum Index Goto the Official Dawn Website

Variables in Mob Descriptions

 
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Building
View previous topic :: View next topic  
Author Message
jswilson



Joined: 24 Aug 2012
Posts: 11
Location: Ephrata, PA

PostPosted: Thu Dec 04, 2014 6:39 am    Post subject: Variables in Mob Descriptions Reply with quote

Is there any way to use variables in mob descriptions like we use in mobprogs? For example, I have guards in my town with random genders, and I would like there descriptions to say things like"he/she wears a steel helmet" depending on gender. Simply using "$J" or "$l" in the description doesn't work right now.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kalahn
Codebase Developer


Joined: 18 Jan 2003
Posts: 710
Location: New Zealand

PostPosted: Tue Dec 30, 2014 7:08 pm    Post subject: Reply with quote

A mob's description is shown to a player by show_char_to_char_1() in act_info.cpp.

Where the looker is "ch", and the mob is the "victim".

The following code specifically handles the victim description to the player.
Code:
if ( victim->description[0] != '\0' )
{
    ch->print(victim->description );
}
else
{
    act( "You see nothing special about $M.", ch, NULL, victim, TO_CHAR );
}


As ch->print() is used, a direct copy of the victim's description will be sent to the looker - i.e. no translation of the $ codes.

You could try changing the ch->print(victim->description ) line to something like:
act( victim->description, ch, NULL, victim, TO_CHAR );

Haven't tested the above, so you may need to play around with it.

Good luck,

- Kal



_________________
Kalahn
Developer of the Dawn of Time Codebase
http://www.dawnoftime.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    The Dawn Of Time Forum Index » Building All times are GMT + 13 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2005 phpBB Group
Theme created by Vjacheslav Trushkin