NEWBIE: Trying to add a monster summon spell.

From: Fionn Colvin (fcolvin@metz.une.edu.au)
Date: 06/04/96


Hi all,
       Below is the stuff I've added to incldue a monster summoning 
spell. When I try to cast the spell however the mud just freezes, like 
when it encounters a continual loop. What have I missed in adding the 
spell? I add a simple send_to_char at the start of mag_summons function 
in magic.c to see if it got there and it doesn't. So it freezes somewhere 
before then. Someone help please. :)

Thanks in advace

Fionn


*   File: class.c                                       Part of CircleMUD *

..[STUFF]..

void init_spell_levels(void)
{
  /* MAGES */
  spell_level(SPELL_MAGIC_MISSILE, CLASS_MAGIC_USER, 1);
  spell_level(SPELL_MONSTER_SUMMON_I, CLASS_MAGIC_USER, 10);

..[STUFF]..


*   File: magic.c                                       Part of CircleMUD *

..[STUFF]..

void mag_summons(int level, struct char_data * ch, struct obj_data * obj,
		      int spellnum, int savetype)
{
  struct char_data *mob = NULL;
  int pfail = 0;
  int msg = 0, fmsg = 0;
  int a, i;
  int mob_num = 0;
  int num_mobs = 1;

  if (ch == NULL)
    return;

  send_to_char("Got to mag_summons in magic.c.\r\n", ch);

  switch (spellnum) {
  case SPELL_MONSTER_SUMMON_I:
    a = number(1, 12);
    msg = 3;
    fmsg = 6;
    pfail = 0;
    mob_num = 153;
    break;
/*
    switch (a) {
      case 1:
        mob_num = [Giant Ant Num]
        break;
      case 2:
        mob_num = [Huge Bat Num]
        break;
      case 3:
        mob_num = [Fire Beatle Num]
        break;
      case 4:
        mob_num = [Bullywug Num]
        break;
      case 5:
        mob_num = [Goblin Num]
        break;
      case 6:
        mob_num = [Hobgoblin Num]
        break;
      case 7:
        mob_num = [Jermlaine Num]
        num_mobs = dice(3,4);
        break;
      case 8:
        mob_num = [Kobold Num]
        num_mobs = dice(3,4);
        break;
      case 9:
        mob_num = [Giant Leech Num]
        break;
      case 10:
        mob_num = [Muck Dweller Num]
        break;
      case 11:
        mob_num = [Orc Num]
        break;
      case 12:
        mob_num = [Giant Rat Num]
        num_mobs = dice(3,4);
        break;
    }
*/

  default:
    return;
  }

  if (IS_AFFECTED(ch, AFF_CHARM)) {
    send_to_char("You are too giddy to have any followers!\r\n", ch);
    return;
  }

  if (number(0, 101) < pfail) {
    send_to_char(mag_summon_fail_msgs[fmsg], ch);
    return;
  }

  for (i = 0; i < num_mobs; i++) {
    mob = read_mobile(mob_num, VIRTUAL);
    char_to_room(mob, ch->in_room);
    IS_CARRYING_W(mob) = 0;
    IS_CARRYING_N(mob) = 0;
    SET_BIT(AFF_FLAGS(mob), AFF_CHARM);
    add_follower(mob, ch);
    act(mag_summon_msgs[msg], FALSE, ch, 0, mob, TO_ROOM);
  }
}

..[STUFF]..


*   File: spell_parser.c                                Part of CircleMUD *

..[STUFF]..

  "infravision",		/* 50 */
  "waterwalk",
  "whirlwind",
  "monster summon 1",
  "!UNUSED!",

..[STUFF]..

  spello(SPELL_MONSTER_SUMMON_I, 40, 20, 1, POS_STANDING,
	TAR_IGNORE, FALSE, MAG_SUMMONS);

  spello(SPELL_POISON, 50, 20, 3, POS_STANDING,
	TAR_CHAR_ROOM | TAR_NOT_SELF | TAR_OBJ_INV, TRUE, MAG_AFFECTS | MAG_ALTER_OBJS);

..[STUFF]..


*   File: spells.h                                      Part of CircleMUD *

..[STUFF]..

#define SPELL_INFRAVISION	     50 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_WATERWALK		     51 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_WHIRLWIND              52 /* New Spell */
#define SPELL_MONSTER_SUMMON_I       53 /* New Spell */
/* Insert new spells here, up to MAX_SPELLS */
#define MAX_SPELLS		    130

..[STUFF]..



This archive was generated by hypermail 2b30 : 12/18/00 PST