Im trying to make a portal skill, that takes the entire group with the user. Or just the user If alone.
I have the following problems though:
1 - If the user is not grouped and portal something, mud crashes. If in a group it works, both If alone Or with people.
2 - But if a group member is not in the same room as the user of the skill, they are also ported to the target, should only be those in the same room as the user.
3 - The user of the portal skill, see the room description 2 times when arriving at the target.
How one of you can help to solve those 3 issues.
Code:
ACMD(do_portal)
{
char arg[MAX_INPUT_LENGTH];
struct char_data *victim;
room_rnum to_room;
struct char_data *pFoll;
one_argument(argument, arg);
if (arg[0] == '\0') {
send_to_char(ch, "Format: portal [name of player or mob]\r\n");
return;
}
if (GET_MANA(ch) < 100) {
send_to_char(ch, "You do not have enough mana!\r\n");
return;
}
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_PORTAL)) {
send_to_char(ch, "You have no idea how.\r\n");
return;
}
if ((victim = get_char_vis(ch, arg, NULL,FIND_CHAR_WORLD)) == NULL) {
send_to_char(ch, "You sense no pressence such as that.\r\n");
return;
}
to_room = IN_ROOM(victim);
if (ROOM_FLAGGED(to_room, ROOM_NOMAGIC)) {
send_to_char(ch, "You attempt to focus, but cannot seem to!");
return;
}
ch->points.mana -= 100;
act("$n opens a portal through the aether, and step through!!", FALSE, ch, 0, 0, TO_ROOM);
char_from_room(ch);
char_to_room(ch, to_room);
act("A shimmering portal takes shape in the area, and $n steps through.", FALSE, ch, 0, 0, TO_ROOM);
look_at_room(ch, 0);
entry_memory_mtrigger(ch);
greet_mtrigger(victim, -1);
greet_memory_mtrigger(ch);
while((pFoll = (struct char_data *)simple_list(ch->group->members)) != NULL) {
act("$n follows through the portal!", FALSE,pFoll, 0, 0, TO_ROOM);
act("You follow $n, and steps through the portal.", FALSE,pFoll, 0, 0, TO_CHAR);
char_from_room(pFoll);
char_to_room(pFoll, to_room);
entry_memory_mtrigger(pFoll);
greet_mtrigger(victim, -1);
greet_memory_mtrigger(pFoll);
look_at_room(pFoll, 0);
act("$n steps through the portal!", FALSE,pFoll, 0, 0, TO_ROOM);
}
return;
}
If you see any other problems with above code, other then the 3 issues i have, pls let me know to.
Backtrace of the crash:
#0 0x0806a7e9 in do_portal (ch=0xa0bfe98, argument=0xbfc370da " beholder",
cmd=620, subcmd=0) at act.movement.c:1608
1608 while((pFoll = (struct char_data *)simple_list(ch->group->members))$
(gdb) Hangup detected on fd 0
Error detected on fd 0
error detected on stdin