Skill wear off messages

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 1 month ago - 1 year 1 month ago #9793 by JTP
Skill wear off messages was created by JTP
So for a skill like meditate, then I would like it to actually tell players that they stopped meditating.

I set an aff type skill_meditate lasting 2 ticks. But when those two ticks are gone. They never know that they no longer meditate.

have anyone made a skill wear off system, and maybe could show how you made it work ?

much appreciated


Also I have this check:
if(affected_by_spell(ch,SKILL_MEDITATE)) {
 send_to_char(ch, "Your mind is already meditating, so rest and relax.\n\r"); 
return;
 }

But all I get is: Nah... You feel too relaxed to do that..

any idea why ?


 
Last edit: 1 year 1 month ago by JTP.

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

More
1 year 1 month ago #9795 by thomas
Replied by thomas on topic Skill wear off messages
I think the meditation-command has the wrong "minimum position" set in the command list. You're seeing this message because you're in POS_RESTING but the lowest level is something like POS_SITTING or POS_STANDING.

About wear_off-messages: they already exist, but for spells. Since skills are a "spell" structure, you could easily expand them with the wear_off_msg:
github.com/tbamud/tbamud/blob/dceb563a9b.../spell_parser.c#L704
-#define skillo(skill, name) spello(skill, name, 0, 0, 0, 0, 0, 0, 0, NULL);
+#define skillo(skill, name, wearoff) spello(skill, name, 0, 0, 0, 0, 0, 0, 0, wearoff);
A bit lower in the same file:
-  skillo(SKILL_BACKSTAB, "backstab");
-  skillo(SKILL_BASH, "bash");
-  skillo(SKILL_HIDE, "hide");
-  skillo(SKILL_KICK, "kick");
-  skillo(SKILL_PICK_LOCK, "pick lock");
-  skillo(SKILL_RESCUE, "rescue");
-  skillo(SKILL_SNEAK, "sneak");
-  skillo(SKILL_STEAL, "steal");
-  skillo(SKILL_TRACK, "track");
-  skillo(SKILL_WHIRLWIND, "whirlwind");
-  skillo(SKILL_BANDAGE, "bandage");
-  skillo(SKILL_MEDITATE, "meditate");
+  skillo(SKILL_BACKSTAB, "backstab", NULL);
+  skillo(SKILL_BASH, "bash", NULL);
+  skillo(SKILL_HIDE, "hide", NULL);
+  skillo(SKILL_KICK, "kick", NULL);
+  skillo(SKILL_PICK_LOCK, "pick lock", NULL);
+  skillo(SKILL_RESCUE, "rescue", NULL);
+  skillo(SKILL_SNEAK, "sneak", NULL);
+  skillo(SKILL_STEAL, "steal", NULL);
+  skillo(SKILL_TRACK, "track", NULL);
+  skillo(SKILL_WHIRLWIND, "whirlwind", NULL);
+  skillo(SKILL_BANDAGE, "bandage", NULL);
+  skillo(SKILL_MEDITATE, "meditate", "You are no longer meditating.");

 

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 1 month ago #9796 by JTP
Replied by JTP on topic Skill wear off messages
In interpreter.c meditate was set to STANDING...if I change to RESTING then I can keep typing meditate in game and it has no idea that it’s already on.

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

More
1 year 1 month ago #9798 by thomas
Replied by thomas on topic Skill wear off messages
Are you sure you set the affection on the character? Because the check you listed above should work if you do.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 1 month ago #9799 by JTP
Replied by JTP on topic Skill wear off messages
Stat player clearly shows meditate 3 ticks

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

More
1 year 1 month ago #9800 by thomas
Replied by thomas on topic Skill wear off messages
I'd debug a bit if I were you - add in a couple of log statements to see what's going on, maybe run through gdb if you feel up to it.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 1 month ago #9818 by JTP
Replied by JTP on topic Skill wear off messages
Unfortunately it seems that I dont have the memory to do it

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

More
1 year 1 month ago #9819 by thomas
Replied by thomas on topic Skill wear off messages
I mean, in your do_meditate function, add a little debugging:

log("is_affected: %s", affected_by_spell(ch, SKILL_MEDITATE));

And similar

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago #9833 by JTP
Replied by JTP on topic Skill wear off messages
I just added you skill wear off. It compiled just fine...but when my skill ran out, <i received no message :(

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

More
1 year 2 weeks ago #9834 by thomas
Replied by thomas on topic Skill wear off messages
I still think you need to debug. In github.com/tbamud/tbamud/blob/dceb563a9b...b6f5/src/magic.c#L71 the function affect_update(), I suggest you add a bit of temporary logging:
+ log("Wearoff: char: %s, af->spell: %d, wear_off_msg: %s", GET_NAME(i), af->spell, spell_info[af->spell].wear_off_msg);
      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);
This will hopefully give you a clue.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago - 1 year 2 weeks ago #9836 by JTP
Replied by JTP on topic Skill wear off messages
Apr 28 16:25:41 :: Wearoff: char: Slash, af->spell: 201, wear_off_msg: You feel you have meditated all that you can now.
Last edit: 1 year 2 weeks ago by JTP.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago #9837 by JTP
Replied by JTP on topic Skill wear off messages
Next skill also ran out with no displayed message...but log shows:

Apr 28 16:35:41 :: Wearoff: char: Slash, af->spell: 206, wear_off_msg: The red glow fades.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago #9838 by JTP
Replied by JTP on topic Skill wear off messages
Any ideas ?

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

More
1 year 2 weeks ago #9839 by thomas
Replied by thomas on topic Skill wear off messages
Well, it obviously should send it, so something is not right about the states it checks between the log line and the send_to_char() line.

Add another log line beneath the one you have added, where you list the status of the different checks (or use gdb to debug, there's a description of how, somewhere around here):
log("((%d > 0) && (%d <= %d)): %d, second check: %d", 
af->spell, af->spell, MAX_SPELLS, ((af->spell > 0) && (af->spell <= MAX_SPELLS)), 
         (!af->next || (af->next->spell != af->spell) ||
	      (af->next->duration > 0)));

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago #9840 by JTP
Replied by JTP on topic Skill wear off messages
That log wont compile :(

I would really like this skill wear off to work...im not a log expert or code expert.

And gdb wont run with the limited memory... hope you can help

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

More
1 year 2 weeks ago #9841 by thomas
Replied by thomas on topic Skill wear off messages
What error do you get with the log line?

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago #9842 by JTP
Replied by JTP on topic Skill wear off messages
 
Attachments:

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

More
1 year 2 weeks ago #9843 by thomas
Replied by thomas on topic Skill wear off messages
Double check your typing. You seem to have a space somewhere in there.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago #9844 by JTP
Replied by JTP on topic Skill wear off messages
Had forgotten one ) in the last Line but i still get error
Attachments:

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
1 year 2 weeks ago #9845 by JTP
Replied by JTP on topic Skill wear off messages
Here is the code
Attachments:

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

Time to create page: 0.174 seconds