Welcome to the Builder Academy

Question Creating Area Spells

More
11 Jun 2012 03:04 - 11 Jun 2012 03:06 #24 by Rumble
Creating Area Spells was created by Rumble
Introduction

I wrote this guide to help people add in basic area spells. It is not meant to be a guide for advanced spells or any other type of spell. It is written, tested, and works on stock tbaMUD. It may or may not work if your game is heavily modified or from an older version.
The Code
Code:
// In spells.h scroll down to the bottom of the spell list and define a new one. Make sure it is +1 from the previous spell. #define SPELL_WATERWALK 51 /* Reserved Skill[] DO NOT CHANGE */ #define SPELL_METEOR 52 /* Meteor of DOOM! */ + #define SPELL_TREMOR 53 /* A miniature Earthquake */ // In spells.h, right under that, there should be #define NUM_SPELLS. Make sure you add one to that since you have defined a new one. + #define NUM_SPELLS 53 // In magic.c search Area Spells (commented out). You should see Earthquake, which is a great example for an area spell. Tremor, the new spell, acts like Earthquake but only weaker. /* Area spells */ case SPELL_EARTHQUAKE: dam = dice(2, 8) + level; break; + case SPELL_TREMOR: + dam = dice(1, 4) + level; + break; // In magic.c still, search for another instance of Earthquake. It will look something like below. Add in another case for the new area spell. switch (spellnum) { case SPELL_EARTHQUAKE: to_char = "You gesture and the earth begins to shake all around you!"; to_room ="$n gracefully gestures and the earth begins to shake violently!"; break; + case SPELL_TREMOR: + to_char = "You gesture and cause a tremor to shake the ground beneath you!"; + to_room = "$n gracefully gestures, causing a tremor to shake the ground beneath you!"; + break; } // In spell_parser.c search for Earthquake since it is an area spell. It will be listed many lines below mag_assign_spells. 40, 25, 3 in Earthquake stands for minimum mana cost of 25, maximum mana cost of 40. Every level the mana cost decreases by 3 but it will never go below 25. So in Tremor the new spell, I lowered the cost because it is weaker. spello(SPELL_EARTHQUAKE, "earthquake", 40, 25, 3, POS_FIGHTING, TAR_IGNORE, TRUE, MAG_AREAS, NULL); + spello(SPELL_TREMOR, "tremor", 30, 15, 2, POS_FIGHTING, + TAR_IGNORE, TRUE, MAG_AREAS, + NULL); // In class.c search for init_spell_levels and add in your new spell into that list. CLASS_CLERIC can be any of the classes that are built into your game. Level "8" is the level of which the Cleric will learn Tremor. spell_level(SPELL_WORD_OF_RECALL, CLASS_CLERIC, 12); spell_level(SPELL_EARTHQUAKE, CLASS_CLERIC, 12); + spell_level(SPELL_TREMOR, CLASS_CLERIC, 8); spell_level(SPELL_DISPEL_EVIL, CLASS_CLERIC, 14); /* Back out of the src directory, and enter the lib director, then misc. Open the file messages, search for the damaging spells, and add in the messages for your new spell. Be sure the number above the messages match the spell number from spells.h. Note: Don't forget the "M" on the line just above the spell number!!! */ + * Tremor + M + 53 + A small crack opens beneath $N's feet and swallows $M whole! + A small crack opens beneath your feet and swallows you whole! + A small crack opens beneath $N's feet and swallows $M whole! + $N desperately tries to keep $S balance as the earth tremors beneath $S feet! + You desperately try to keep your balance as the earth tremors beneath your feet! + $N desperately tries to keep $S balance as the earth tremors beneath $S feet! + $N falls down and hurts $Mself! + You fall down and hurt yourself! + $N falls down and hurts $Mself! + $N holds $S ground as you send a tremor $S way. + You hold your ground as the tremor shakes the place. + $N holds $S ground as a tremor shakes the place.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com
Last edit: 11 Jun 2012 03:06 by Rumble.

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

Time to create page: 0.234 seconds