Moving an invisible character and Speech Portrait positions **SOLVED**

Started by Knox, Mon 21/06/2010 23:26:45

Previous topic - Next topic

Knox

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:

Code: ags
 
  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:

Code: ags

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?
--All that is necessary for evil to triumph is for good men to do nothing.

Ryan Timothy B

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
Code: ags

cDispatcherA.x=1000;

Knox

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.

--All that is necessary for evil to triumph is for good men to do nothing.

Ryan Timothy B

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

Calin Leafshade

i suggest a useful extender function from a particular module...

although I shall rewrite a similar one here,

Code: ags


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

usage: 

cEgo.SetPos(100,100);

Knox

--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk