Setting one characters speech shadow color?

Started by piraatlife4me, Thu 08/01/2004 04:42:37

Previous topic - Next topic

piraatlife4me

Hey I have a really quick easy question. Here it goes! How do you set just one characters font shadow color.  I know about game.text_shadow_color but what if I just want each character to have a different color.  I made my own game fonts in SCI studio.  Would I have to make them the color I want  there?  Is there a function for this yet?
Daniel
Winebarger

Ishmael

There's no way I see. If you want a difrent shadow color, you must create custom fucntions that, every time a certain character speaks, the shadow color is set to difrent, then back again.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

piraatlife4me

Hey TK!
It's Dan here! I just was curious what you think is the best way to go about this then.  Should I use game.text_shadow_color =4;
everytime my main character talks, or is there a way to set up some kind of character property?  Also do you know if it is  possible to lower the built in AGS dialog menu manually on the screen?  It works fine on some converations in my game but on others  it takes up too much screen space.
Thanks!
Daniel
Winebarger

Scorpiorus

#3
EDIT: to correct the dialog script (run-script instead of run-dialog)

Yeah, making it a property seems to be a good idea. Next the function similar to:

function CharacterSpeech(int CharID, string speechText) {

   // first saving an old value to restore it later:
   int old_value = game.text_shadow_color;

   // get this character's shadow color:
   game.text_shadow_color = GetCharacterProperty(CharID, "ShadowCol");

   // display speech:
   DisplaySpeech(CharID, speechText);

   // restore the old value:
   game.text_shadow_color = old_value;
}


Implementing the same for the build-in dialog can be like:

function dialog_request(int value) {

   if (value >=0 && value < 150) { // characters' ID range
      game.text_shadow_color = GetCharacterProperty(value, "ShadowCol");
   }

}


then in the dialog script:

@4
run-script 0
ego "blah"

run-script 1
man "blah

etc.

As you see it's more pain as you have to specify character's ID (run-script ID) each time he is talknig


QuoteAlso do you know if it is possible to lower the built in AGS dialog menu manually on the screen? It works fine on some converations in my game but on others it takes up too much screen space.
If you mean that black box window at the bottom of the screen, then afaik no. You can make a custom dialog GUI, though. Then set up Dialog options on GUI option the general settings. Make it a black box if you want so it looks exactly like a standart one. Then through the script you can do SetGUIPosition (DIALOGGUI, newX, newY).

btw, the build-in dialog grows depending on a number of options avaible. So if you low it down then some of them can't be clicked on. :P


~Cheers

piraatlife4me

Hey Scorpius!
It's Dan! So gosh! Thanks again for responding back to me.  But to be honest  I am having a little trouble trouble with figuring this out.  The first batch of code where in my global script should that should go:

function CharacterSpeech(int CharID, string speechText) {

Should I just create a function like that?  And when you use CharID would I just plug in EGO there, and  where there is a "ShadowCol" would I put in the actual number of what color I want?  I also just realized that what if you have background speech running in your game the same time the character is talking.  Is there a way so the game shadow color will only affect one indivdual character?  And one more thing in the dialog script when you have to call a dialog_request function.  Would'nt it be run-script 0 instead of run-dialog? If you can, do you think maybe you could just break what you told me down a little bit more?  
Thanks Scorpius!


Scorpiorus

QuoteThe first batch of code where in my global script should that should go:

function CharacterSpeech(int CharID, string speechText) {

Should I just create a function like that? And when you use CharID would I just plug in EGO there, and where there is a "ShadowCol" would I put in the actual number of what color I want?
Yes, you put the function in the global script and import it via script header. As about ShadowCol it's a property name. To create the ShadowCol property goto the characters panel click properties and add new property. Name it ShadowCol and set its type to Number. Also you may want to set a default value for the shadow color (for ex 16). So, from now you can set a shadow color for each character. As about the CharID command parameter, it can be EGO or MAN or any other character script name. You need to specify it so that the function could retrieve character's ShadowCol property accordingly to his name. Well, that should work. Let me know how it goes.

QuoteI also just realized that what if you have background speech running in your game the same time the character is talking. Is there a way so the game shadow color will only affect one indivdual character?
I'm afraid there is no way currently because  the game.text_shadow_color var affects all text messages that are being displayed currently.

QuoteAnd one more thing in the dialog script when you have to call a dialog_request function. Would'nt it be run-script 0 instead of run-dialog?
Heh, yeah well spotted I meant run-script of course. Fixed now :)

~Cheers

piraatlife4me

#6
Hey Scorpius! It's Dan! Back again!  Thanks for breaking it down, I think I understand everything else you explained to me except for this.  I am already using a dialog request function.  The problem is when I try to run the game it gives me an error that tells me that I already have one.  Would this go in the script header maybe?  Or would I have to change this so it can add on to the dialog request function I already have?:
This is what I put in there:

function dialog_request(int value) {

  if (value >=0 && value < 150) { // characters' ID range
     game.text_shadow_color = GetCharacterProperty(value, "ShadowCol");
  }
}

Oh yeah, where in the code above would you actually set the value for the color I want the text to change when the specified character talks?

This what I had before:

function dialog_request(int dialog) {
if (dialog == 4) {
Wait(5);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,60,0,ALIGN_LEFT);
Wait(5);
AnimateCharacterEx(DEAL,0,6,0,0,1);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,149,0,ALIGN_LEFT);

}
else if (dialog == 5) {
Wait(5);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,60,1,ALIGN_LEFT);
Wait(5);
AnimateCharacterEx(DEAL,1,6,0,0,1);
ReleaseCharacterView(DEAL);
}
else if (dialog == 6) {
Wait(5);
ReleaseCharacterView(FORT);
SetCharacterView(FORT,104);
Wait(5);
AnimateCharacterEx(FORT,0,6,0,0,1);
ReleaseCharacterView(FORT);
}
else if (dialog == 7) {
ccExecuteCommand(PROS, 11);
 }
else if (dialog == 8) {
  ccResumeExecution(OWNE);
  }
else if (dialog == 9) {
  ccResumeExecution(SANT);
  }
else if (dialog == 10) {
Wait(15);
AnimateCharacterEx(SLEE, 0, 9, 0, 1, 1);
ChangeCharacterView(SLEE,161);
SetCharacterSpeechView(SLEE,143);
SetCharacterIdle(SLEE,0,100);
Wait(10);
}
else if (dialog == 11) {
  piss_clerk = 1;
}
else if (dialog == 12) {
ccExecuteCommand(HOME, 6);
}
}

Any ideas on a possible solution here?
Thanks again Scorpius!


Scorpiorus

I expect it to be a problem. Unfortunetly, you can't have two dialog functions and you need to put all the code into the single one. And here the problem appears: both dialog and value vars have the overlapping values range. To distinguish between them you could set a global int in the dialog script before calling the dialog_request function, like:

note: I use global int #33 to choose the right script code.

dialog script:
@1
// set global int 33 value to 1
// this means we want to change character's shadow color
set-globalint 33 1
// run the dialog_request to change the color for man (his number is 4)
run-script 4
man: "hello"
// run the dialog_request to change the color for ego (his number is 0)
run-script 0
ego: "hi there"
// we need to set the global int #33 back to 0 as we have done with speechs
set-globalint 33 0
...
...
...
// we do not set global int so if (dialog == 4) { part will be executed instead:
run-script 4



dialog_request():

function dialog_request(int dialog) {

// if global int #33 set to 1 we want to change a color
if (GetGlobalInt(33)==1) {

// the variable is still have to be named dialog, though:
if (dialog >=0 && dialog < 150) { // characters' ID range
game.text_shadow_color = GetCharacterProperty(dialog, "ShadowCol");
}




} else { //executing other actions


if (dialog == 4) {
Wait(5);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,60,0,ALIGN_LEFT);
Wait(5);
AnimateCharacterEx(DEAL,0,6,0,0,1);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,149,0,ALIGN_LEFT);

}
else if (dialog == 5) {
Wait(5);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,60,1,ALIGN_LEFT);
Wait(5);
AnimateCharacterEx(DEAL,1,6,0,0,1);
ReleaseCharacterView(DEAL);
}
else if (dialog == 6) {
Wait(5);
ReleaseCharacterView(FORT);
SetCharacterView(FORT,104);
Wait(5);
AnimateCharacterEx(FORT,0,6,0,0,1);
ReleaseCharacterView(FORT);
}
else if (dialog == 7) {
ccExecuteCommand(PROS, 11);
}
else if (dialog == 8 ) {
ccResumeExecution(OWNE);
}
else if (dialog == 9) {
ccResumeExecution(SANT);
}
else if (dialog == 10) {
Wait(15);
AnimateCharacterEx(SLEE, 0, 9, 0, 1, 1);
ChangeCharacterView(SLEE,161);
SetCharacterSpeechView(SLEE,143);
SetCharacterIdle(SLEE,0,100);
Wait(10);
}
else if (dialog == 11) {
piss_clerk = 1;
}
else if (dialog == 12) {
ccExecuteCommand(HOME, 6);
}

} // end of  //executing other actions

}




Another possibility is to add some value to character ID (I'll add 1000)

dialog script

@1
run-script 1004 // (1000+4) setting shadow color for man (it's ID is 4)
man "hello"
run-script 1000 // (1000+0) setting shadow color for ego (it's ID is 0)
ego "hi there"

etc.

function dialog_request(int dialog) {

if (dialog >= (1000 + 0) && dialog < (1000 + 150)) {

//getting property for the actual ID:
game.text_shadow_color = GetCharacterProperty(dialog-1000, "ShadowCol");

}


if (dialog == 4) {
Wait(5);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,60,0,ALIGN_LEFT);
Wait(5);
AnimateCharacterEx(DEAL,0,6,0,0,1);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,149,0,ALIGN_LEFT);

}
else if (dialog == 5) {
Wait(5);
ReleaseCharacterView(DEAL);
SetCharacterViewEx(DEAL,60,1,ALIGN_LEFT);
Wait(5);
AnimateCharacterEx(DEAL,1,6,0,0,1);
ReleaseCharacterView(DEAL);
}
else if (dialog == 6) {
Wait(5);
ReleaseCharacterView(FORT);
SetCharacterView(FORT,104);
Wait(5);
AnimateCharacterEx(FORT,0,6,0,0,1);
ReleaseCharacterView(FORT);
}
else if (dialog == 7) {
ccExecuteCommand(PROS, 11);
}
else if (dialog == 8 ) {
ccResumeExecution(OWNE);
}
else if (dialog == 9) {
ccResumeExecution(SANT);
}
else if (dialog == 10) {
Wait(15);
AnimateCharacterEx(SLEE, 0, 9, 0, 1, 1);
ChangeCharacterView(SLEE,161);
SetCharacterSpeechView(SLEE,143);
SetCharacterIdle(SLEE,0,100);
Wait(10);
}
else if (dialog == 11) {
piss_clerk = 1;
}
else if (dialog == 12) {
ccExecuteCommand(HOME, 6);
}
}


the 2nd method eliminates the neccessarity to set a global int but requires you to specify ID carefully:

ID: 0  DIALOG: 1000
ID: 1  DIALOG: 1001
ID: 2  DIALOG: 1002
..
ID: 10  DIALOG: 1010
ID: 11  DIALOG: 1011
...
ID: 100  DIALOG: 1100
ID: 101  DIALOG: 1101
ID: 102  DIALOG: 1102

ID: 149 DIALOG: 1149


Personally I prefer the 2nd way but it's up to you.

~Cheers

piraatlife4me

Ok Scorpiorus! I almost got it! Just one more thing.  I decided to go with the second solution you gave me(mainly because I need to try and conserve my GlobalInt).  I have it all setup except fo the laast part about specifying this:

ID: 0 DIALOG: 1000
ID: 1 DIALOG: 1001
ID: 2 DIALOG: 1002
..
ID: 10 DIALOG: 1010
ID: 11 DIALOG: 1011
...
ID: 100 DIALOG: 1100
ID: 101 DIALOG: 1101
ID: 102 DIALOG: 1102

ID: 149 DIALOG: 1149

Where would I put this? Say if EGOs shadow color was 4 would his ID be 4?  Right now I got it to run but it dosen't do anything at run time? Any suggestions for this?
Thanks!

Scorpiorus

#9
You put these values in the dialog script before character starts talking

These are char IDs + 1000, not the shadow color. The last one will be retrieved on running a dialog_request.

So if ego's ID is 4 you put:

@3
run-script 1004 // ie. (1000 + EGO's ID)
ego: "hey"

btw, have you set his ShadowCol property?

Are you sure to be using the second variant of dialog_request() with if (dialog >= (1000 + 0) && dialog < (1000 + 150)) etc?

piraatlife4me

One again! Scorpious saves the day! I got it! It works now! I figured out why it was'nt working. I had the whole 1000 character ID numbering system off.  I was setting the wrong value for the wrong character(like ego 1000, npc# 2 1001 etc.) I was putting something like 1012 or something like that in there for character 0.  It all makes complete sense now.  Thanks again man! I really owe you one!
Daniel
Winebarger

SMF spam blocked by CleanTalk