Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Mon 21/06/2010 23:26:45

Title: Moving an invisible character and Speech Portrait positions **SOLVED**
Post by: Knox on Mon 21/06/2010 23:26:45
Hi guys,

Ive got a character that is never visible on screen but visible for dialogs (a 911 dispatcher). When the player uses the radio, I placed this at the top of the "send" button's script:


 int iPlayerX = player.x;
 if (iPlayerX >= 512) //player is to the right
 {
   cDispatcherA.Move(0, -100); //move DispatcherA to the left
 }
 else if (iPlayerX < 512) //player is to the left
 {
   cDispatcherA.Move(1000, -100); //move DispatcherA to the right    
 }


I figured that by moving the dispatcher character the opposite side of the main player, when they engage in a conversation the portraits speech views would be also opposite each other...however, surprisingly regardless of my above code, the dispatcher's speech portrait is always on  the left, no matter what.

I placed the dispatcher's starting room to "none" and have this code in "on_event" to automatically place the dispatcher character into the room that is being loaded:


void on_event (EventType event, int data)
{
 if ((event == eEventEnterRoomBeforeFadein) && ((data != 0) || (data != 7)))
 {
   cDispatcherA.ChangeRoom(data, -100, -100);
 }
}


Sierra-Style portrait location is set to "BasedOnCharacterPosition" in General Settings.

Any ideas why I cant seem to make the dispatcher's speech portrait to display opposite of the player's speech portrait?
Title: Re: Moving an invisible character and Speech Portrait positions
Post by: Ryan Timothy B on Tue 22/06/2010 00:10:39
If I were to guess, I'd say it's because you're using "move" when the character isn't on walkable areas.  Is there a reason you're not just changing it's X coords?  :P

cDispatcherA.x=1000;
Title: Re: Moving an invisible character and Speech Portrait positions
Post by: Knox on Tue 22/06/2010 00:25:16
Hmm, I thought I "had" to use the move function...ok, much better to do it this way! You're right, using the move function I had to make sure the player is on a walkable area.

Title: Re: Moving an invisible character and Speech Portrait positions
Post by: Ryan Timothy B on Tue 22/06/2010 00:35:58
So did that solve your issue?

And yeah, I know what that's like.  Things I would normally think were easy with CSS for webpages are driving me insane today! :D
Title: Re: Moving an invisible character and Speech Portrait positions
Post by: Calin Leafshade on Tue 22/06/2010 00:39:53
i suggest a useful extender function from a particular module...

although I shall rewrite a similar one here,



function SetPos(this Character*, int x, int y){
 
  this.x = x;
  this.y = y;
 
}

usage:

cEgo.SetPos(100,100);
Title: Re: Moving an invisible character and Speech Portrait positions **SOLVED**
Post by: Knox on Tue 22/06/2010 01:49:47
Oh nice!

Thanks guys...solves it quite beautifully  :)