Setting different fonts for each character's speech

Started by SebH, Thu 20/10/2011 01:47:50

Previous topic - Next topic

SebH

Is there a way to make it so that each character can speak in a different font? I'm using a Sprite Font plugin, and at the moment, every character's speech is plain white, and I was thinking that if I could set up multiple sprite fonts of different colours for each character, and have the characters speak in those, that would fix it, but this wouldn't work unless each character could speak in their own font. So is there a way to have everyone speak their own font?

Any help would be much appreciated.

Khris

Unfortunately, the only way to do this is to change the global setting before each character's lines.
To make things more convenient, you can write a wrapper for Character.Say, you have to use that in dialog scripts, too, though.

Code: ags
// top of global script

FontType charfont[];

void SetFont(this Character*, FontType font) {
  charfont[this.ID] = font;
}

void AASay(this Character*, const string message) {
  Game.SpeechFont = charfont[this.ID];
  this.Say(message);
}

// add to game_start()

  charfont = new FontType[Game.CharacterCount];


// add this to GlobalScript.ash

import void SetFont(this Character*, FontType font);

import void AASay(this Character*, const string message);


Now set a characters font like this:
  cEgo.SetFont(eFontSpriteRed);
Then use
  player.AASay("Hello there!");

SMF spam blocked by CleanTalk