I've made a Call Dragon spell that calls a dragon to carry the caster and
his group (those who are in the same room of the caster) in a room named
ASTRAL_TARGET_ROOM (a vnum). Note that the dragon isn't real, is basically
a teleport group spell.
The spell works, but I don't like the way I used the boolean array stanza[]
to store which people are being transported of the group (I'm not going to
carry PG that aren't in the same room of the caster, or with position <
POS_STANDING).
So, I'm putting in the list the spell, but I would like to have some advice
from you in a more neat way to handle the bool stanza[] thing.
Messages are in italian, but it shouldn't be too difficult to translate if
you can understand the code (anyway mail me to have a translation if
somebody want to use the spell).
TIA
KABIR
Coder of DalilaMUD
dalila.shopitaly.net 4000
--------------------
ASPELL(spell_call_dragon)
{
#define ASTRAL_TARGET_ROOM 11300
struct char_data * k;
struct follow_type * f;
room_rnum room_cast;
bool stanza[1000]; //It's terrible, but it works
int i;
if (ch == NULL)
return;
act("Evochi un potente drago e ci sali sopra, preparandoti a viaggiare.",
TRUE, ch, 0, 0, TO_CHAR);
act("$n evoca un potente drago.", TRUE, ch, 0, 0, TO_ROOM);
if (!IS_AFFECTED(ch, AFF_GROUP))
{
send_to_char("Il drago ti porta in mezzo alle nuvole e poi
scompare.\r\n", ch);
act("$n sale in groppa al drago e scompare.", TRUE, ch, 0, 0, TO_ROOM);
char_from_room(ch);
char_to_room(ch, real_room(ASTRAL_TARGET_ROOM));
act("$n arriva in groppa ad un drago maestoso, scende, e il drago
scompare.", TRUE, ch, 0, 0, TO_ROOM);
look_at_room(ch, 0);
}
else
{
for (i=0; i<1000; i++) stanza[i]=FALSE;
room_cast=ch->in_room;
if (ch->master) k = ch->master;
else k = ch;
if ( (IS_AFFECTED(k, AFF_GROUP)) && (k->in_room==room_cast) &&
(GET_POS(k)>= POS_STANDING) )
{
stanza[0]=TRUE;
act("$n sale in groppa al drago maestoso.", TRUE, k, 0, 0, TO_ROOM);
if (k!=ch) send_to_char("Sali in groppa al drago maestoso,
preparandoti a viaggiare.\r\n", k);
}
i=1;
for (f = k->followers; f; f = f->next)
if ( (IS_AFFECTED(f->follower, AFF_GROUP)) &&
(f->follower->in_room==room_cast) &&
(GET_POS(f->follower)>= POS_STANDING) )
{
if (i>=1000) {log("ERRORE in spell_call_dragon: piu' di mille
giocatori gruppati ?");}
else stanza[i++]=TRUE;
act("$n sale in groppa al drago maestoso.", TRUE, f->follower, 0,
0, TO_ROOM);
if (f->follower!=ch) send_to_char("Sali in groppa al drago maestoso
preparandoti a viaggiare.\r\n", f->follower);
}
send_to_room("Un drago maestoso appare.\r\n",
real_room(ASTRAL_TARGET_ROOM));
if (stanza[0])
{
char_from_room(k);
char_to_room(k, real_room(ASTRAL_TARGET_ROOM));
send_to_char("Il drago maestoso ti trasporta coi tuoi compagni in
mezzo alle nuvole.\r\n", k);
}
i=1;
for (f = k->followers; f; f = f->next)
if (stanza[i++])
{
char_from_room(f->follower);
char_to_room(f->follower, real_room(ASTRAL_TARGET_ROOM));
send_to_char("Il drago maestoso ti trasporta coi tuoi compagni in
mezzo alle nuvole.\r\n", f->follower);
}
send_to_room("Il drago maestoso scompare con tutti i suoi
cavalieri.\r\n", room_cast);
if (stanza[0])
{
act("$n scende dal drago.", TRUE, k, 0, 0, TO_ROOM);
send_to_char("Scendi dal drago maestoso.\r\n", k);
}
i=1;
for (f = k->followers; f; f = f->next)
if (stanza[i++])
{
act("$n scende dal drago.", TRUE, f->follower, 0, 0, TO_ROOM);
send_to_char("Scendi dal drago maestoso.\r\n", f->follower);
}
send_to_room("Il drago maestoso scompare.\r\n",
real_room(ASTRAL_TARGET_ROOM));
if (stanza[0])
look_at_room(k, 0);
i=1;
for (f = k->followers; f; f = f->next)
if (stanza[i++])
look_at_room(f->follower, 0);
}
#undef ASTRAL_TARGET_ROOM
}
---------------------------------------------------------------
| __ __ __ __ __ __ |
| __ ( ) ___ ( ) __ ( \/ ) __ / _) __ ( ) |
| / _) /__\ ( ,) )(__ / \ ) ( / \ ( (_ / _) )( |
| ( (_ (_)(_) ) \ (____)( () ) (_/\/\_)( () ) \__)( (_ (__) |
| \__) (_)\_) \__/ \__/ \__) |
| |
| mailto: mocci@tin.it |
| http://volftp.tin.it/IT/IT/ITALIANI/MOCCI |
| http://www.geocities.com/SunsetStrip/Palms/7010 |
---------------------------------------------------------------
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST