Change Player Character (And Dialog GUI question)

Started by BernieLaraemie, Tue 05/07/2005 08:48:36

Previous topic - Next topic

BernieLaraemie

I want to change the player character for only a dialog, but for whatever reason, the options and things said are in still in the colours of the original player character, so I figure I did something wrong.

This is the code I have:

function hotspot1_a() {
  // script for Hotspot 1 (Precarious Lightbulb Stack): Interact hotspot

character[TW].SetAsPlayer();

RunDialog(7);

character[EJ].SetAsPlayer(); 
}

Any help is mucho appreciated.

~~Bernie
~~~~~
"It doesn't matter whether something is true, just that it is believed." -- Jim Morrison
~~~~~
THIS SPACE FOR RENT

Gilbert

It's a limitation of the AGS text script system, that some of teh functions will be queued up and executed as the last command of the script, one such example is RunDialog().
So the actual order of your codes executed is:

character[TW].SetAsPlayer();
character[EJ].SetAsPlayer();
RunDialog(7);

One way to overcome this is, remove the character[EJ].SetAsPlayer(); line, then let the dialog calls dialog_request() to change the character back when it ends. Here are brief instructions on how to do this:
1. Remove that character[EJ].SetAsPlayer(); line from your interact with hotspot function (can also be done by adding // to the left to make it a commented line).
2. Edit the dialog's script, find where it will end and return to the game and add a line:
run-script 1
3. Open up the global script, and create the following function:
function dialog_request(int parameter) {
if (parameter==1) character[EJ].SetAsPlayer();
}

I know this dialog_request() thingie can be a bit confusing at first, if you want to learn more about it, you can read this.

BernieLaraemie

Thank you--I will read that page as well as try this.

~~Bernie
~~~~~
"It doesn't matter whether something is true, just that it is believed." -- Jim Morrison
~~~~~
THIS SPACE FOR RENT

BernieLaraemie

Thank you, that worked!

One other quick question:
Is it possible to make your dialog option GUI scrollable?

~~Bernie
~~~~~
"It doesn't matter whether something is true, just that it is believed." -- Jim Morrison
~~~~~
THIS SPACE FOR RENT

monkey0506

Only if you're willing to re-write the entire dialog system.  There is currently only one textual dialog system (that I know of that is open-source) and it was written for 2.62.  Look for the Scrolling Dialog Template.  The code was never completed, but if you talk with Geoffkan (sp?) he got a fully working dialog system (scrollable) in 2.7 code based on my template.

Unless you're willing to re-do all your dialogs though, it's not currently possible.

BernieLaraemie

Right, so it's all about keeping the topics to a certain number, then.

Okay.  Thanks for all your help, guys :)

~~Bernie
~~~~~
"It doesn't matter whether something is true, just that it is believed." -- Jim Morrison
~~~~~
THIS SPACE FOR RENT

strazer

Quote
One way to overcome this is, remove the character[EJ].SetAsPlayer(); line, then let the dialog calls dialog_request() to change the character back when it ends.

Another, and in my opinion, easier way for these kinds of things would be to just add a second "Run script" action to the "Interact hotspot" interaction and put everything after the RunDialog command in there.

SMF spam blocked by CleanTalk