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
mmoritz80



Joined: 21 Sep 2018
Posts: 27
Location: Ohio

PostPosted: Mon Apr 01, 2019 5:04 am    Post subject: Reply with quote

Topic Adjacent..... I've written mprogs that randomly set a mob's gender, name, short and long descriptions.

Quote:
These progs will show you a simple framework for randomly named NPC’s. The example will randomly set the gender, name, short and long description for the NPC. The mob will load a random set of clothing and possibly a piece of loot.

Please note, these MUD Progs were written and tested on a Dawn of Time version 1.69s_beta5 MUD. The scripts do require my snippet to give mobiles access to the SHORT and STRING commands in the MP Commands List.


Randomly Restrung NPC MudProgs: http://bit.ly/2GAf3y5
Mob String and Short MP Command Snippet: http://bit.ly/2V8l5t3[/quote][/code]



_________________
Lands of Oneiro Pending Alpha Test Two

Melissa's Game Dev Blog
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