[Code] create_spring spell for ranger types classes

linebacker@microlink.net
Date: 12/03/96


Here is another skill, I have it imped as a spell for rangers
but could quite easily be a skill. It creates a spring from
which players can drink from.

You will need to create the object that will be the spring,
(this will be an object of type fountain) I used obj 10051
in the code here.

Add the appropriate segments to spells.h and spell_parser.c.
The spells is manual so you will need to add it to the two
places where MAG_MANUAL's are defined. I believe spells.h
and spell_parser.c.


You will need to add the following check into limits.c (so the
spring will be removed from the game based on the value you
set the timer to  in the spell itself)
I put this at the very end of point_update

----- Limts.c -----

 if (GET_OBJ_RNUM(j) == real_object(10051))
 {
      if (GET_OBJ_TIMER(j) > 0)
        GET_OBJ_TIMER(j)--;
      if (GET_OBJ_TIMER(j) == 1)
      {
 if ((j->in_room != NOWHERE) &&(world[j->in_room].people)) {
 act("$p starts to slow down.", FALSE, world[j->in_room].people, j, 0, TO_ROOM);
 act("$p starts to slow down.", FALSE, world[j->in_room].people, j, 0, TO_CHAR);
        }
      }
      if (GET_OBJ_TIMER(j) == 0)
      {
        if ((j->in_room != NOWHERE) &&(world[j->in_room].people)) {
    	  act("$p has stopped flowing!", FALSE, world[j->in_room].people, j, 0, TO_ROOM);
	  act("$p has stopped flowing!", FALSE, world[j->in_room].people, j, 0, TO_CHAR);
        }
        extract_obj(j);
      }
    }
}

Here is the spell itself..
--------- spells.c ----------

ASPELL(spell_create_spring)
{
  struct obj_data *spring = '\0';
  int spring_num = 10051; 
  *buf = '\0';

  if (GET_SKILL(ch, SPELL_CREATE_SPRING) == 0)
    {
    send_to_char("That spell is unfamiliar to you.\r\n", ch);
    return ;
    }

  if((SECT(ch->in_room) == SECT_INSIDE) || (SECT(ch->in_room) == SECT_CITY))
    {
    send_to_char("You cannot create a spring here!\r\n", ch);
    return ;
    }

  if((SECT(ch->in_room) == SECT_WATER_SWIM) || (SECT(ch->in_room) == SECT_WATER_NOSWIM))
    {
    send_to_char("How can you create a spring in water?\r\n", ch);
    return;
    }

  if(SECT(ch->in_room) == SECT_UNDERWATER)
    {
    send_to_char("You cannot create a spring underwater!\r\n", ch);
    return;
    }

  if (ROOM_FLAGGED(ch->in_room, ROOM_NOMAGIC)) {
   send_to_char("An unforseen force prevents you from casting spells.\r\n", ch);
   return;
   }

  spring = read_object(spring_num, VIRTUAL);
  GET_OBJ_TIMER(spring) = 2; /* you may want to reflect exp or level on */
                            /* this value here, maybe 2 + GET_LEVEL(ch) */ 
  obj_to_room(spring, ch->in_room);
  sprintf(buf, "You have created a small spring!\r\n"); 
 /* You may want a message sent to the room as well */
  send_to_char(buf, ch);
  return;
}


Enjoy..

Linebacker

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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