Welcome to the Builder Academy

Question Transport Via Plants ("Tree Travel") - Druid Spell Idea

More
15 Oct 2017 12:17 #6998 by zusuk
Someone was asking for help for a "tree travel" spell, my good friend Brian Williams coded a "transport via plant" druid spell on LuminariMUD a whiles back, so I am posting it here for public usage. To use, you would cast the spell targeting any "plant" object that is located on the person or in the room.
Code:
-------------------------------------------------------------------------------- Help Tag : transport-via-plants Help Keywords : Transport-via-plants Last Updated : 2014-09-25 07:41:57 ------------------------------------------------------------------------------------------------------------------------------------------------- >Usage: cast 'transport via plants' <plant> >Accumulative: No >Duration: Instantaneous >School of Magic: None >Target(s): Plant >Magic Resist: No >Saving Throw: N/A >Damage Type: N/A >Description: This spell allows the caster to truly become one with nature. A druid will actually enter into the plant and is able to travel great distances and come out from another plant of the same type. If no other plant of the same type is found, the caster will be ejected from the plant. See also: SPELLS --------------------------------------------------------------------------------

Here is the manual spell itself, plop in spells.c:
Code:
ASPELL(spell_transport_via_plants) { obj_vnum obj_num = NOTHING; room_rnum to_room = NOWHERE; struct obj_data *dest_obj = NULL, *tmp_obj = NULL; if (ch == NULL) return; if (!obj) { send_to_char(ch, "Your target does not exist!\r\n"); return; } else if (GET_OBJ_TYPE(obj) != ITEM_PLANT) { send_to_char(ch, "That is not a plant!\r\n"); return; } else if (GET_OBJ_SIZE(obj) < SIZE_MEDIUM) { send_to_char(ch, "That plant is not large enough to transport you.\r\n"); return; } obj_num = GET_OBJ_VNUM(obj); // find another of that plant in the world for (tmp_obj = object_list; tmp_obj; tmp_obj = tmp_obj->next) { if (tmp_obj == obj) continue; // we don't want to transport to a plant in someone's inventory if (GET_OBJ_VNUM(tmp_obj) == obj_num && !tmp_obj->carried_by) { dest_obj = tmp_obj; // 5% chance we will just stop at this obj if (!rand_number(0, 10)) break; } } act("$n walks toward $p, and steps inside of it.", FALSE, ch, obj, 0, TO_ROOM); act("You walk toward $p, and step inside of it.", FALSE, ch, obj, 0, TO_CHAR); if (dest_obj != NULL) { to_room = dest_obj->in_room; } if (to_room == NOWHERE) { send_to_char(ch, "You are unable to find another exit, and are ejected from the plant.\r\n"); act("$n comes tumbling out from inside of $p.", FALSE, ch, obj, 0, TO_ROOM); return; } else { if (!valid_mortal_tele_dest(ch, to_room, TRUE)) { send_to_char(ch, "A bright flash prevents your spell from working!\r\n"); act("$n comes tumbling out from inside of $p.", FALSE, ch, obj, 0, TO_ROOM); return; } // transport player to new location char_from_room(ch); char_to_room(ch, to_room); look_at_room(ch, 0); act("You find your destination, and step out through $p.", FALSE, ch, dest_obj, 0, TO_CHAR); act("$n steps out from inside of $p!", FALSE, ch, dest_obj, 0, TO_ROOM); // TODO: make this an event, so player enters into the plant, and sees a couple messages, then comes out the other side } }

Miscellaneous tasks for a new spell, please adjust to your MUD :)
Code:
class.c, or wherever your spell assignment is spell_assignment(CLASS_DRUID, SPELL_TRANSPORT_VIA_PLANTS, 11); spell_parser.c - call_magic(), wherever you handle manual spells in that code: case SPELL_TRANSPORT_VIA_PLANTS: MANUAL_SPELL(spell_transport_via_plants); break; spell_parser.c - mag_assign_spells() spello(SPELL_TRANSPORT_VIA_PLANTS, "transport via plants", 0, 0, 0, POS_STANDING, TAR_OBJ_ROOM, FALSE, MAG_MANUAL, NULL, 8, 17, CONJURATION, FALSE); spells.h - place with your other defines with appropriate number: #define SPELL_TRANSPORT_VIA_PLANTS 308 spells.h - you should see a list of manual spell declarations, throw this there: ASPELL(spell_transport_via_plants);

Then just add the item_type for plants, and then place various "plants" throughout your world as an object in the room

Enjoy!

-Zusuk

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

Time to create page: 0.226 seconds