Welcome to the Builder Academy

Question Area Spells

More
12 Jul 2012 16:51 #349 by Papaya Pete
Area Spells was created by Papaya Pete
Ok, here's just something I was wondering if anyone has done...

I'm trying to make an area affect damage spell that not only hits those who are outside of your group but also those who are inside of your group. I know in spell_parser.c there is MAG_DAMAGE for dealing damage to a single opponent, MAG_AREAS for doing damage for hitting everyone not in your group, and MAG_GROUPS for group affect spells like group armor.

Any ideas on where to start? I'm taking a look at this a little more right now and am getting an idea of maybe what I have to do, but hard to put it into words, heh.

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

More
12 Jul 2012 17:52 #350 by Papaya Pete
Replied by Papaya Pete on topic Re: Area Spells
Ah ha! Found out how to do it. There is actually a function that was lying around in there unimplemented. So if you want to use MAG_MASSES so that a spell will hit not just others in the room but even ones in your group. I even added a little condition checking to see if it was a specific spell that would even hit the caster.

Code:
/* Mass spells affect every creature in the room except the caster. No spells * of this class currently implemented. */ void mag_masses(int level, struct char_data *ch, int spellnum, int savetype) { struct char_data *tch, *tch_next; const char *to_char = NULL, *to_room = NULL; switch (spellnum) { case SPELL_CONFLAGRATION: to_char = "You harness all the power you can, and scream as you release a massive explosion of fire that envelopes the area!"; to_room = "$n harnesses as much power as $e can and screams, releasing a massive explosion of fire that envelopes the entire area!"; break; } if (to_char != NULL) act(to_char, FALSE, ch, 0, 0, TO_CHAR); if (to_room != NULL) act(to_room, FALSE, ch, 0, 0, TO_ROOM); for (tch = world[IN_ROOM(ch)].people; tch; tch = tch_next) { tch_next = tch->next_in_room; if ((tch == ch) && (spellnum != SPELL_CONFLAGRATION)) // Skips Caster unless using Conflagration continue; if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT) // Skips Immortal continue; if (!CONFIG_PK_ALLOWED && !IS_NPC(ch) && !IS_NPC(tch)) // Skips if No PK continue; mag_damage(level, ch, tch, spellnum, 1); } }

So, another example, if you want to make Earthquake hit even your party members or something, make this change:
Code:
spello(SPELL_EARTHQUAKE, "earthquake", 40, 25, 3, POS_FIGHTING, TAR_IGNORE, TRUE, MAG_AREAS, NULL); // change it to the below statement spello(SPELL_EARTHQUAKE, "earthquake", 40, 25, 3, POS_FIGHTING, TAR_IGNORE, TRUE, MAG_MASSES, NULL);

Anyways, quick example, yes it doesn't check for the victim to be flying, but just using this as a quick sample.

Hope this helps someone else out there.

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

Time to create page: 0.277 seconds