Welcome to the Builder Academy

Question Skill wear off messages

More
02 May 2021 10:45 #9851 by thomas
Replied by thomas on topic Skill wear off messages
Browser code strikes again :D
Code:
+ log("Wearoff: char: %s, af->spell: %d, wear_off_msg: %s", GET_NAME(i), af->spell, spell_info[af->spell].wear_off_msg); + log("((%d > 0) && (%d <= %d)): %d", af->spell, af->spell, MAX_SPELLS, ((af->spell > 0) && (af->spell <= MAX_SPELLS))); + log("second check: %d", (!af->next || (af->next->spell != af->spell) || (af->next->duration > 0))); if ((af->spell > 0) && (af->spell <= MAX_SPELLS)) if (!af->next || (af->next->spell != af->spell) || (af->next->duration > 0)) if (spell_info[af->spell].wear_off_msg) send_to_char(i, "%s\r\n", spell_info[af->spell].wear_off_msg); affect_remove(i, af);
The following user(s) said Thank You: JTP

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

More
02 May 2021 18:50 - 02 May 2021 18:55 #9853 by JTP
Replied by JTP on topic Skill wear off messages
Ok here is the result of the 3 logs:

May 2 12:45:46 :: Wearoff: char: Testchar, af->spell: 201, wear_off_msg: You feel you have meditated all that you can now.

May 2 12:45:46 :: ((201 > 0) && (201 <= 130)): 0

May 2 12:45:46 :: second check: 1


What do you make of it and what’s happening with the missing messages to the player ?
Last edit: 02 May 2021 18:55 by JTP.

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

More
02 May 2021 22:05 #9854 by thomas
Replied by thomas on topic Skill wear off messages
It is obvious which of the if's return false now. And we see we have a comparison between af->spell and 130. But af->spell is 201, which is way higher than 130, so the if returns false, and we never get to the message.

The reason for this is that until you made the changes earlier in this topic, only spells could have wear-off messages. Now, skills can too. So, instead of comparing to MAX_SPELLS, you need to compare to MAX_SKILLS:
Code:
- if ((af->spell > 0) && (af->spell <= MAX_SPELLS)) + if ((af->spell > 0) && (af->spell <= MAX_SKILLS)) if (!af->next || (af->next->spell != af->spell) || (af->next->duration > 0)) if (spell_info[af->spell].wear_off_msg) send_to_char(i, "%s\r\n", spell_info[af->spell].wear_off_msg); affect_remove(i, af);

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

More
03 May 2021 19:35 - 03 May 2021 19:36 #9855 by JTP
Replied by JTP on topic Skill wear off messages
It’s working. Thanks a lot. Much apreciated.
Last edit: 03 May 2021 19:36 by JTP.

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

Time to create page: 0.220 seconds