Welcome to the Builder Academy

Question Need help with this meditate skill

More
22 Mar 2016 16:25 #5662 by JTP
Im trying to make meditate. It compiles well. But when i begin to meditate, then i remain in POS_MEDITATE.

It should stop meditating and put me back in resting or atleast as standing, if i move.

How could i fix that ?
Code:
void check_meditate(void) { struct char_data *i, *next_char; int skill_level = 0; int min = 10; int max = 10; /* characters */ for (i = character_list; i; i = next_char) { next_char = i->next; skill_level = GET_SKILL(i, SKILL_MEDITATE); max = min + 20 * skill_level / 100; if (GET_POS(i) == POS_MEDITATE) { send_to_char(i, "You meditate peacefully.\r\n"); GET_MANA(i) += rand_number(min, max); act("$n meditates peacefully.", FALSE, i, 0, 0, TO_ROOM); } if (GET_POS(i) == POS_MEDITATE && GET_MANA(i) >= GET_MAX_MANA(i)) { send_to_char(i, "You stop meditating for you have reached your max.\r\n"); GET_POS(i) = POS_SITTING; act("$n stops meditating.", FALSE, i, 0, 0, TO_ROOM); } } } ACMD(do_meditate) { if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_MEDITATE)) { send_to_char(ch, "You have no idea how to do that.\r\n"); return; } #define POS_DEAD_MSG "You're dead, how much meditating do you need?\r\n" #define POS_MORTALLYW_MSG "You're nearly dead, you need more than meditation.\r\n" #define POS_SLEEPING_MSG "You can't meditate while you sleep.\r\n" #define POS_RESTING_MSG "You can't meditate while resting.\r\n" #define POS_STANDING_MSG "You must be sitting to meditate.\r\n" #define POS_FIGHTING_MSG "Don't you have other things to worry about?\r\n" #define POS_MEDITATE_MSG "You are already meditating.\r\n" #define POS_FLYING_MSG "Shouldn't you concentrate on flying?\r\n" switch(GET_POS(ch)) { case POS_DEAD: send_to_char(ch, POS_DEAD_MSG); return; break; case POS_MORTALLYW: case POS_INCAP: case POS_STUNNED: send_to_char(ch, POS_MORTALLYW_MSG); return; break; case POS_SLEEPING: send_to_char(ch, POS_SLEEPING_MSG); return; break; case POS_RESTING: send_to_char(ch, POS_RESTING_MSG); return; break; case POS_STANDING: send_to_char(ch, POS_STANDING_MSG); return; break; case POS_MEDITATE: send_to_char(ch, POS_MEDITATE_MSG); return; break; case POS_FLYING: send_to_char(ch, POS_FLYING_MSG); return; break; case POS_SITTING: if(GET_MANA(ch) < GET_MAX_MANA(ch)) { send_to_char(ch, "You begin meditating.\r\n"); act("$n begins meditating..", FALSE, ch, 0, 0, TO_ROOM); GET_POS(ch) = POS_MEDITATE; } else { send_to_char(ch, "You have no need to meditate.\r\n"); } return; break; default: send_to_char(ch, "You must be sitting to begin meditating."); } }

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

More
22 Mar 2016 16:29 #5663 by JTP
With this code, then if i sit and meditate. And then write stand.

I get this message: You stop floating around, and put your feet on the ground.


Did i forget something in the code ?

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

More
22 Mar 2016 17:10 #5664 by JTP
Where in perform_move or do_move should i put in something, and what ? to prevent POS_MEDITATE from moving ?

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

More
22 Mar 2016 17:23 - 22 Mar 2016 20:29 #5665 by JTP
Its not possible to move while resting/sleeping. So i grepped: Nah...You feel to relaxed.

its in interpreter.c

there i added:

case POS_MEDITATE:
send_to_char(ch, "You need to finish meditating...
break;

It looked like an easy thing to add, but i can still move, what am i missing ?
Last edit: 22 Mar 2016 20:29 by JTP.

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

More
22 Mar 2016 21:25 #5669 by WhiskyTest
Positions each have a number definition, 0 - 8 by default.
Each command has a minimum position that allows you to perform it, eg movement has POS_STANDING as a minimum position.
This is set in interpreter in that long list of commands. If the position of the character is less than that the command will fail.

The behavior you are describing sounds like the POS_MEDITATE is set to something higher than standing, 9 for example.

Also you'll need to add a case in do_stand for POS_MEDITATE, that's where the floating message comes from.

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

More
22 Mar 2016 21:30 - 22 Mar 2016 21:31 #5670 by zusuk
Is it feasible just to change meditate to be an affection or event that only works when you are sitting? Seems kind of counter-intuitive to make it a character position honestly.

Let us know if you get it working!

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100
Last edit: 22 Mar 2016 21:31 by zusuk.

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

Time to create page: 0.284 seconds