MODULE: Character Fonts v1.1 - Different speech font for each character

Started by Alynn, Mon 17/07/2006 21:07:48

Previous topic - Next topic

Alynn

// Script header for module 'CharacterFonts'
/* 
**Ã,  Author: James Favier (Alynn the Yellow Eyed)
**Ã,  Ã, 
**Ã,  Abstract: Allows a user to set individual fonts to each
**Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  character, and display those fonts while
**Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  talking.
**
**Ã,  AGS 2.71 and higher
**
**
** WARNING:
**Ã,  Ã,  Be sure you assign font numbers that actually exist on
**Ã,  Ã,  your game, it will break otherwise. Currently there is
**Ã,  Ã,  no way to check if the font exists beforehand. If that
**Ã,  Ã,  becomes available later I will incorperate it.
**
**---------------------------------------------------------------
** Functions:
**
**Ã,  Ã, SetCharFont(Character *ch, int font)
**Ã,  Ã,  Ã,  This sets the number of the character (ch) and
**Ã,  Ã,  Ã,  assigns it the font number (font).
**
**Ã,  Ã, GetCharFont(Character *ch)
**Ã,  Ã,  Ã,  Returns the font number currently in use by
**Ã,  Ã,  Ã,  the character (ch).
**
**Ã,  Ã, Say(Character *ch, String text)
**Ã,  Ã,  Ã,  Works like Character.Say, but assigns the correct
**Ã,  Ã,  Ã,  font first.
**
**Ã,  Ã, SayAt(Character *ch, int x, int y, int width, String text)
**Ã,  Ã,  Ã,  Works like Character.SayAt, but assigns the correct
**Ã,  Ã,  Ã,  font first.
**
**Ã,  Ã, SayBackground(Character *ch, String text)
**Ã,  Ã,  Ã,  Works like Character.SayBackground, but assigns the
**Ã,  Ã,  Ã,  correct font first.
**
**------------------------------------------------------------------
**
** Version History:
**Ã,  Ã,  1.0 Released upon an unsuspecting population
**Ã,  Ã,  1.1 Should work with AGS 2.71, maxed out the number of
**Ã,  Ã,  Ã,  Ã,  possible characters, now uses pointers for the characters.
**
**------------------------------------------------------------------


Ok looking over what Strazer said I took most of his ideas into consideration... Ok let's just face it I made all the changes.

Changes from version 1.0 to 1.1 are as follows...

  • Uses Character pointers instead of integers for the characters.
  • Compatable with AGS 2.71
  • Calls are now made by CharFont and not cf

The functionality of dialogs still must be done like below if using 2.72.
Code: ags
function dialog_request (int xvalue) {
Ã,  if (xvalue == 1){
Ã,  Ã,  Game.SpeechFont = CharFont.GetCharFont(cShip);
Ã,  }
Ã,  if (xvalue == 2){
Ã,  Ã,  Game.SpeechFont = CharFont.GetCharFont(cTest);
Ã,  }
}


Or this code using 2.71
Code: ags
function dialog_request (int xvalue) {
Ã,  if (xvalue == 1){
Ã,  Ã,  SetSpeechFont(CharFont.GetCharFont(cShip));
Ã,  }
Ã,  if (xvalue == 2){
Ã,  Ã,  SetSpeechFont(CharFont.GetCharFont(cTest));
Ã,  }
}


Replacing cShip and cTest with your Characters it will work as expected.
NOTE: you will have to have a dialog_request for each character you use.

Finally your dialog should look something like this:
Code: ags
run-script 1
ship: hi!
run-script 2
test: Hello!


I'm sorry I couldn't do it within the modual itself, this makes things a bit more difficult for running dialogs. But nothing too unmanagable.

Verified that Character Fonts 1.1 is compatable with AGS 2.71 .

DOWNLOAD HERE 2.71 and Higher

strazer

#1
Good work!

For reference, the tracker entry for this idea is here.

jasonjkay

im not sure what this module is for but i'll add it to my site anyway.
http://www.americangirlscouts.org/agsresources/ - Mods, plugins and templates.

Alynn

Jason, I know my first post was jumbled (it will be edited after the changes tonight) but it was late at night when I posted it and my thoughts aren't always coherant when I'm awake, so half asleep they are probably worse.

Anyway, the current AGS setup there is one speech font that is used by all characters, what this allows you to do is let each character have their own font. For instance, an easy flowing font for a hipple, and a military style font for a drill sergeant. Using this module they can have a conversation each using their own personallized font.

I hope that is a bit better wording... As I said the origional post will be edited once I implement some of the changes that strazer suggested, and put it online with the module coding conventions.

Alynn

Ok... 1.1 is up... I've verified that it works with 2.71. And I also realized I forgot to put the download link on the first post... Origional post fixed and the finalized copy of the scm is on my website for download.

Maybe I should have bumped this, but I was wondering if anyone has tried it out?

SMF spam blocked by CleanTalk