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 ➜ About inner workings of SMAUG code

About inner workings of SMAUG code

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


Posted by Uru   Canada  (67 posts)  Bio
Date Tue 14 Feb 2006 12:56 PM (UTC)
Message
Since I'm using AreaEditor, I need to know some things about defaults in the code. If, for instance, I create a MOB, and only fill in some of it's attributes, what do the other values reset to? e.g., MOB1, I set level to 10, but don't fill in AC, HP's, Damage, etc. Will it's values default to something based on its Class and Race?
And, if I leave strength, dexterity, etc. at 13, do they get adjusted according to Race and Class?
I assume some of these things adjust according to level as well.
Thanks.

"What does not kill us makes us stronger."
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Tue 14 Feb 2006 07:05 PM (UTC)
Message
I think that all of this is in db.c. There's a function init_char (or something like that -- but this might not be in db.c) that sets all the defaults for all characters. Then you should go look at fread_mobs in db.c -- that reads mobs from files, and takes crae of defaults and all that.

However it's possible that the area editor itself sets some default values if you don't specify them all. The area files don't allow for very many 'optional' entries. I think you specify "simple" or "complex" mob, and that's about the only option you have -- from that point on, you have to specify everything.

Sorry to not be more precise. I don't have convenient access to the source code from here.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #2 on Tue 14 Feb 2006 08:59 PM (UTC)
Message
The function you need to look at is create_mobile and it is in db.c

Here is a little part of what happens in there, when an instance mobile is created.

if ( pMobIndex->ac )
	mob->armor		= pMobIndex->ac;
    else
	mob->armor		= interpolate( mob->level, 100, -100 );

    if ( !pMobIndex->hitnodice )
	mob->max_hit		= mob->level * 8 + number_range(mob->level * mob->level / 4,
					mob->level * mob->level );


In both these instances, if the index data for the mobile is 0, the code will determine values for you, for AC interpolate does this 100 + moblevel * (-100 - 100) / 32

Hit dice are given as numdie = moblevel * 8 sizedie + a number between 0 and moblevel*moblevel/4

Hope thats helpfull

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

Posted by Uru   Canada  (67 posts)  Bio
Date Reply #3 on Wed 15 Feb 2006 01:08 PM (UTC)
Message
Yes it is helpful, but it wasn't necesary to copy any code in. I just needed to know if SMAUG auto assigns certain values or not. I see it does.
What about Class skills? I read somewhere (I think Hernes) that if a MOB has the Warrior class, it will be capable of warrior skills, whether given them or not.
As an aside note; why have so many NPC monster types? i.e., I looked up a Thule, it's a prehistoric man-type. Why not just create a human?
Anyways, thanks for the help. Seeing the code gives something to go by.

"What does not kill us makes us stronger."
Top

Posted by Conner   USA  (381 posts)  Bio
Date Reply #4 on Sat 18 Feb 2006 03:19 AM (UTC)
Message
In answer to your original question, it only makes the adjustments automatically to the stats he cited the code for, the other stats you asked about do not get adjusted and mobs have access to all skills/spells regardless of how you set their race/class, the reason for all the various monster races is so that builders can set their mobs appropriately so that when players cast identify on a mob, they see something reasonable compared to the description of the mob rather than just human warrior every time.

-=Conner=-
--
Come test your mettle in the Land of Legends at telnet://tcdbbs.zapto.org:4000
or, for a little family oriented medieval fun, come join us at The Castle's Dungeon BBS at telnet://tcdbbs.zapto.org
or, if you just want information about either, check our web page at http://tcdbbs.zapto.org
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.


18,232 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.