i did this for my first mud (FF rules)..below is how i'd code it if i were
going to add this feature to another mud..i haven't tested this code, so i
don't know if it'll work this way, but i think it will..obviously you'll
have to change the method of extracting your called mob after a period of
time if you don't have an event system..perhaps making an AFF_CALLED
would work..
syntax would be 'call chocabo'..no funny quotes, and no using do_cast..
siv
ACMD(do_call)
{
int i, skill, duration, mob_vnum = -1;
int new_mana = GET_MANA(ch);
struct caller_event_obj *ev_o;
struct char_data *mob;
struct caller_info {
char *name;
int skill_num;
int mob_num;
} creatures[] = {
{ "chocabo", SPELL_CALL_CHOC, 1297 },
{ "imp", SPELL_CALL_IMP, 1298 },
{ "\n", -1}
};
one_argument(argument, arg);
for (i = 0; creatures[i] == "\n"; i++)
if (!str_cmp(arg, creatures[i].name)) {
skill = creatures[i].skill;
mob_vnum = creatures[i].mob_num;
}
if (mob_vnum == -1) {
send_to_char("You cannot call that creature.\r\n", ch);
return;
}
if (!GET_SKILL(ch, skill)) {
send_to_char("You don't know how to call that creature.\r\n", ch);
return;
}
if ((new_mana -= mag_manacost(ch, skill)) < 0) {
send_to_char("You don't have enough mana to call that creature.\r\n", ch);
return;
}
GET_MANA(ch) = new_mana;
if (!check_skill(ch, skill)) {
send_to_char("You fail!\r\n", ch);
return;
}
mob = read_mobile(mob_num, VIRTUAL);
GET_EXP(mob) = 0;
SET_BIT(AFF_FLAGS(mob), AFF_CHARM);
char_to_room(mob, ch->in_room);
add_follower(mob, ch, 0);
CREATE(ev_o, struct caller_event_obj, 1);
ev_o->mob = mob;
ev_o->caller = ch;
duration = MAX(1, GET_LEVEL(mob) - GET_LEVEL(ch)) * 3;
add_event(duration, caller_event, ev_o, mob);
/* Called mobs can't get/carry/use/wield/wear items */
IS_CARRYING_W(pet) = 1000;
IS_CARRYING_N(pet) = 100;
send_to_char(OK, ch);
act("$N arrives in a puff of smoke, and begins following $n.", FALSE,
ch, 0, pet, TO_ROOM);
}
+------------------------------------------------------------+
| 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