Spell heroes feast

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
10 months 2 weeks ago - 10 months 2 weeks ago #6850 by JTP
Spell heroes feast was created by JTP
Trying to make a spell that affects everyone in group and in same room, here is what im trying.
Atm code compiles. But noone gets the sent_to_char or gets hunger and thirst 24 or get move points.

So basicly nothing happends.

Whats seems to be wrong ?

ASPELL(heroes_feast)
{
struct char_data *i;

for (i = character_list; i; i = i->next) {
if (CAN_SEE(ch, i) && IN_ROOM(i) != NOWHERE) {
send_to_char(i, "You partake of a magnificent feast!\r\n");
gain_condition(i, HUNGER, 24);
gain_condition(i, THIRST, 24);

GET_MOVE(i) = GET_MAX_MOVE(i);
}
}
}
Last edit: 10 months 2 weeks ago by JTP.

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

More
10 months 2 weeks ago #6851 by thomas
Replied by thomas on topic Spell heroes feast
Whoa! character_list is EVERYONE. Mobs and players alike. Everywhere. But you'd only see the ones in the room, so...

Looping in the room is done many places in the code, and typically uses code like this:
ASPELL(heroes_feast) 
{
  struct char_data *vict;

  // remove this when it works:
  log("INFO: triggered heroes feast at level %d", level);

  for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room) {
    if (CAN_SEE(ch, vict)) {
      send_to_char(i, "You partake of a magnificent feast!\r\n");
      gain_condition(i, HUNGER, 24);
      gain_condition(i, THIRST, 24);

      GET_MOVE(i) = GET_MAX_MOVE(i);
    }
  }
}
Does this work?

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
10 months 2 weeks ago - 10 months 2 weeks ago #6852 by JTP
Replied by JTP on topic Spell heroes feast
changed all the i to vict...it compiles but

casting the spell consumes mana

But no move is restored or hunger or thirst :(

log didnt show up
Last edit: 10 months 2 weeks ago by JTP.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
10 months 2 weeks ago #6853 by JTP
Replied by JTP on topic Spell heroes feast
Dont even get the send_to_char message :(

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

More
10 months 2 weeks ago #6854 by thomas
Replied by thomas on topic Spell heroes feast
So, if the log didn't show up, you're not calling this piece of code. Basically, your problem is elsewhere in the code, not in this spell.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
10 months 2 weeks ago #6855 by JTP
Replied by JTP on topic Spell heroes feast
Here is what iwe done...what is then missing sense you say the code isnt called ?
#define SPELL_HEROES_FEAST          116

  spello(SPELL_HEROES_FEAST, "heroes feast", 100, 80, 2, POS_STANDING,
        TAR_CHAR_ROOM, FALSE, MAG_POINTS,
        NULL);

ASPELL(heroes_feast)
{
struct char_data *vict;

log("INFO: triggered heroes feast at level %d", level);

for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room) {
if (CAN_SEE(ch, vict)) {
send_to_char(vict, "You partake of a magnificent feast!\r\n");
gain_condition(vict, HUNGER, 24);
gain_condition(vict, THIRST, 24);

GET_MOVE(vict) = GET_MAX_MOVE(vict);
}
}
}


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

More
10 months 2 weeks ago #6856 by thomas
Replied by thomas on topic Spell heroes feast

Jan wrote: Here is what iwe done...what is then missing sense you say the code isnt called ?

        TAR_CHAR_ROOM, FALSE, MAG_POINTS,

Here, you're telling the magic system that the spell needs to use the mag_points subfunction.

This would have been alright, had you added the code to the mag_points function instead of making a new one.
However, in this case you need to use MAG_MANUAL instead (since you've "manual"-ly implemented the functionality) and to add the spell definition around line 270 in spell_assign.c:
if (IS_SET(SINFO.routines, MAG_MANUAL))
    switch (spellnum) {
    case SPELL_CHARM:		MANUAL_SPELL(spell_charm); break;
    case SPELL_CREATE_WATER:	MANUAL_SPELL(spell_create_water); break;
    case SPELL_DETECT_POISON:	MANUAL_SPELL(spell_detect_poison); break;
    case SPELL_ENCHANT_WEAPON:  MANUAL_SPELL(spell_enchant_weapon); break;
    case SPELL_IDENTIFY:	MANUAL_SPELL(spell_identify); break;
    case SPELL_LOCATE_OBJECT:   MANUAL_SPELL(spell_locate_object); break;
    case SPELL_SUMMON:		MANUAL_SPELL(spell_summon); break;
    case SPELL_WORD_OF_RECALL:  MANUAL_SPELL(spell_recall); break;
    case SPELL_TELEPORT:	MANUAL_SPELL(spell_teleport); break;
+    case SPELL_HEROES_FEAST: MANUAL_SPELL(spell_heroes_feast);break;
    }
MANUAL_SPELL is a macro that calls the named function.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
10 months 2 weeks ago #6858 by JTP
Replied by JTP on topic Spell heroes feast
That did it.. Now its working. Thanks alot.

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

Time to create page: 1.744 seconds