Welcome to the Builder Academy

Question Skill question

More
25 Mar 2018 21:20 - 25 Mar 2018 21:21 #7799 by JTP
Skill question was created by JTP
H

Ok the bash skill has its messages in da da da the messages file.

But what If i want a skills messages to be part of the skill in act.offensive.c

Do i Then need an entry in messages with the skill number but with a 0 in Or something ?

Cus Im working on a skill where it Seem to wanna get messages from the messages file still.

Hope what i wrote makes sense and someone knows what to do
Last edit: 25 Mar 2018 21:21 by JTP.

Please Log in or Create an account to join the conversation.

More
26 Mar 2018 12:33 - 26 Mar 2018 12:34 #7805 by lacrc
Replied by lacrc on topic Skill question
Short answer:
If you don't need custom skill/spell messages then use TYPE_UNDEFINED when you call damage() or hit() functions for your skill/spell. TYPE_UNDEFINED is defined as (-1) and circle will not look for a message if that's the damage type.

Long answer:
Skill messages are used based on SKILL_* types and SPELL_* types defined in your mud.
The messages are used after damage() has been rolled for them, so when you call, for example:
Code:
damage(ch, vict, 0, SKILL_BACKSTAB);
The skill message for SKILL_BACKSTAB (which is skill 131 defined in spells.h) will be used:
Code:
#define SKILL_BACKSTAB 131 /* Reserved Skill[] DO NOT CHANGE */
Since the damage() function was called with 0 it will be considered a miss and a backstab-ery miss message will be displayed.
On the other hand if it were a hit you would call:
Code:
hit(ch, vict, SKILL_BACKSTAB);
The hit() function (defined in fight.c, just like damage()) would then be called to roll the damage for the skill, and if the roll ended up to be positive (let's say 10?) then damage would be called to deal that damage:
Code:
damage(ch, vict, 10, SKILL_BACKSTAB);
This time since damage has a >0 value, a backstab-ery hit message will be displayed.

It is the same for all skills/spells.
If you want to use generic messages for a skill/spell use TYPE_UNDEFINED when you call any of these functions:
Code:
damage(ch, vict, 10, TYPE_UNDEFINED);[ hit(ch, vict, TYPE_UNDEFINED);
This tells circle to not look for a customized message for that hit/damage roll and just display a generic message.
Unrequested friendly advice: you SHOULD use customized messages, they are much better and help to set the mood and keep all the RP in your mud. Just my opinion though hehe.
Last edit: 26 Mar 2018 12:34 by lacrc.
The following user(s) said Thank You: thomas, Chime

Please Log in or Create an account to join the conversation.

More
26 Mar 2018 12:52 - 26 Mar 2018 12:53 #7806 by JTP
Replied by JTP on topic Skill question
Well i cant use the type_undefined because i have other code that does stuff from what kind of damage type it is.

So i need the damage to be skill_*****

But i wanna use act to room/char/vict instead of the messages file, because its a Big skill that does alot of different things with several messages.
Last edit: 26 Mar 2018 12:53 by JTP.

Please Log in or Create an account to join the conversation.

More
26 Mar 2018 13:12 #7807 by JTP
Replied by JTP on topic Skill question
Maybe leaving them blank like this Will allow me to use the act messages. Im not home so cant test atm:

* skillname 250
M
250
#
#
#
#
#
#
#
#
#
#
#
#

Please Log in or Create an account to join the conversation.

More
26 Mar 2018 14:34 - 26 Mar 2018 14:51 #7808 by lacrc
Replied by lacrc on topic Skill question
I see, I apologize, I based that stuff out of TBA stock code.

I suppose that would work (setting all the messages to #) but I can only assume based on stock TBA code.
If you want to double check (again related to TBA code) you have to check load_messages() in msgedit.c and skill_message in fight.c.

In stock code, load_messages(), which is called at boot time to load all the messages from the file, for every message fread_action() is called, and if the text in the message has just a '#' then the message is set to NULL.

In fight.c the skill_message() function is called by damage() to determine if there is a message that can be used, it will check the type of the skill/spell in 'type' variable and, in stock code, only if the message type requested isn't NULL it will be sent through act(), so you don't need to worry about segfaulting.
Last edit: 26 Mar 2018 14:51 by lacrc.

Please Log in or Create an account to join the conversation.

More
26 Mar 2018 16:55 #7809 by JTP
Replied by JTP on topic Skill question
Some Stock messages already have # in them like this one:

* poison 33
M
33
#
Poison burns intensely in your veins... you shiver... you die.
$N screams in pain, keels over and dies.
#
suffer miss victim - should never see.
suffer miss room - should never see.
#
You feel burning poison in your blood, and suffer.
$N looks really sick and shivers uncomfortably.
#
You have become poisoned somehow.
$N has somehow become poisoned.

Please Log in or Create an account to join the conversation.

Time to create page: 0.214 seconds