"Character not in the room" error (SOLVED)

Started by mchammer, Mon 10/04/2006 20:56:12

Previous topic - Next topic

mchammer

Not sure if this is a beginners problem but:
1. I change a NPC to different room.
2. I change the player to the same room.
3. I set the NPC to walk different location.

character[RASTA2].ChangeRoom(4, 199, 24);
character[HARRY].ChangeRoom(4, 199, 28);  //HARRY is the player char.
character[RASTA2].Walk(48, 72,eNoBlock,eWalkableAreas);

When I play and the game runs this script, it crashes and a message something like
"Error: Cant move char. Its not in current room." pops up.
My 40 bullets - An action/war game.

DoorKnobHandle

That's because the script stays inside the first room until ALL the functions are executed. Just because you move the player character, that doesn't mean the the script moves with him/her.

So, to fix your problem, you'll need to cut the last of your three lines away from the first rooms script and place it into the "player enters room"-space for the second room. This would be one way to do it.

I hope this helps - although you may need to use variables if the user can acces the second room earlier as well.

mchammer

Thanks for help but the scrpit is in global script at  function repeatedly_execute()
cus i want that character and NPC move everyday in certain time to room 4 and then NPC moves at certain positon in the new room. So its like:

if (time == something) {
character[RASTA2].ChangeRoom(4, 199, 24);
character[HARRY].ChangeRoom(4, 199, 28);  //HARRY is the player char.
character[RASTA2].Walk(48, 72,eNoBlock,eWalkableAreas);
}

My 40 bullets - An action/war game.

SSH

12

mchammer

#4
Thanks a lot, this seems to be perfect module to the game I'm making.
My 40 bullets - An action/war game.

SMF spam blocked by CleanTalk