CODE: Adding a monster summoning spell. [Help]

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


Hi all,
       Below is the code in my mud at current for adding a monster 
summoning spell. Its pretty much exactly what comes with the mud, with 
stuff I dont need taken out and my case statement added. Firstly will 
this work as is. I will remove the /*'s in my case statement when I make 
the relavent mobs. If it is right what else will I have to do to add the 
spell to my game. Eg, add it in class.c, etc. What type of spello do I 
need? Do I just have to add it to class.c spells.h and add a spello?

Thanks for any help.

Fionn


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;

  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);
  }
}



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