Using character objects in multiple rooms

djakacki
18 Feb 2012, 22:24
I am trying to create several objects (characters) that the player will come across in multiple rooms during the game. For instance, Richard speaks to Clarence (and his guard) in room one and room three. When Richard sees Clarence the second time, they will interact differently - the player will have different questions for Clarence, and Clarence will answer those new questions. How can I do this? Regardless of whether I set the parent object as "none" or a particular room, I get a message that "an element called Clarence already exists in this game." Any suggestions would be very useful, as this is going to be an insurmountable problem if I can't find a way to do this.
Thanks, Diane

sgreig
19 Feb 2012, 06:10
I'm by no means an expert, so I'm not sure how to handle the conversational stuff, but instead of putting multiple versions of the same character, which you can't really do, moving the Clarence object would be the easiest method, I think.

The best way to handle this in your case would be to go to the Scripts tab of the first room, and under 'After leaving the room' add a move object script to move the Clarence object to the new room you want him to appear in. Edit: I just realized it would probably be a good idea to check if the clarence object is in the room first, in case the player goes back. I'm not sure if this would cause an error or not. This is how I would deal with it.


list_room_contents = GetAllChildObjects(Room 1)
foreach (check_for_clarence, list_room_contents) {
if (check_for_clarence = Clarence) {
MoveObject (Clarence, Room 3)
}
}


And as I think about it, you could probably put some conditional elements in the conversational scripts that checks what room is in.. something along these lines:


if (clarence.parent = Room 1) {
Conversation Topic 1
}
else {
Conversation Topic 2
}


Something along those lines anyway. Should be a starting point. I'm sure some of the more experienced people on this forum could elaborate on it if needed. :)

Pertex
19 Feb 2012, 09:59
djakacki wrote:Regardless of whether I set the parent object as "none" or a particular room, I get a message that "an element called Clarence already exists in this game."


You get this message if you change the parent of your object? I only know this message if you try to create an object with the name of an existing object. The name must be unique in the game, so you could create Clarence2, Clarence3... and set the alias of every object to Clarence.

As sgreig said it would be the best to have one object and move it to the spezific rooms (but I don't think its necessary to check the objects room; just move it).

djakacki
19 Feb 2012, 15:14
Thanks!~ I'll try both of these and see which one works more easily. Since Clarence is only in two rooms maybe I'll try moving him. For characters who are in several rooms, I'll experiment with the xx1 xx2 xx3 method.
Cheers! Diane