Problem with display messages (SOLVED)

Started by Akumayo, Mon 05/12/2005 00:08:47

Previous topic - Next topic

Akumayo

I am having a problem with a display command.Ã,  It works in every other room but one, and in this room, every other part of the script works, just not the display, which appears off-screen rather than beside the charater.
Code: ags

function GainHealth(int gain) {
Ã,  if ((health + gain)>maxhealth) {
Ã,  Ã,  if (gBattle.Visible == true) {
Ã,  Ã,  DisplayAt(1, 1, 97, "+%d",Ã,  ((((health+gain)-maxhealth)-gain)*(-1)));
Ã,  }
Ã,  else {
Ã,  Ã,  DisplayAt(player.x, player.y, 97, "+%d", ((((health+gain)-maxhealth)-gain)*(-1)));
Ã,  Ã,  }
Ã,  Ã,  health = maxhealth;
Ã,  }
Ã,  else {
Ã,  Ã,  if (gBattle.Visible == true) {
Ã,  Ã,  DisplayAt(1, 1, 97, "+%d", gain);
Ã,  }
Ã,  else {
Ã,  Ã,  DisplayAt(player.x, player.y, 97, "+%d", gain);
Ã,  Ã,  }
Ã,  Ã,  health += gain;
Ã,  }
}


This command (when it screws up) is called when gBattle.Visible == false

The only thing different about the room it screws up in is the resolution (480x600)
Any ideas as to why it displays off-screen (or sometimes onscreen in the wrong place)?

-Regards, Akumayo
"Power is not a means - it is an end."

Ashen

#1
Where exactly is the player standing? I notice it's a scrolling room - player.x/y are room coord (i.e. player.x could be 0-479 in your room) while DisplayAt() uses screen coords (0-319).

Try replacing this bit:
DisplayAt (player.x, player.y, ....

with:
DisplayAt (player.x-GetViewportX(), player.y-GetViewportY(), ....

to allow for the scrolling room.
I know what you're thinking ... Don't think that.

Akumayo

Alas, no good.  The display message still appears far away, off the screen.  I have thought of a simple solution, but it will be sort of like giving up.  I can simply have a narrarator type character speak the display message, but then I will lose the coolness of it being beside the character being healed.
"Power is not a means - it is an end."

Ashen

#3
Unless you make the 'Narrator' an invisible character, move them to (player.x, player.y), and have them 'say' the message. (A character without a speechview in Sierra-style speech behaves like LucasArts-style, it appears at their location.)

I wouldn't give up just yet, though.
I'm not sure why adding the Viewport check hasn't helped any. Obvious thing - did you change both instances of DisplayAt(player.x, player.y...?
Also, can you check if I was on the right track? Add Display("%d, %d", player.x, player.y); to your function - and possibily a check on the Viewport coords, too.
I know what you're thinking ... Don't think that.

Akumayo

Ahh, there was an instance in which I forgot to replace, but in another function, thank you for your help Ashen.
"Power is not a means - it is an end."

SMF spam blocked by CleanTalk