Game authors and players, please read this thread!

Author Topic: Change Player Character (And Dialog GUI question)  (Read 335 times)  Share 

BernieLaraemie

  • Round Hole. Square Peg. Steely Determination.
    • I can help with characters
    •  
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
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
« Last Edit: 05 Jul 2005, 17:01 by BernieLaraemie »
~~~~~
"It doesn't matter whether something is true, just that it is believed." -- Jim Morrison
~~~~~
THIS SPACE FOR RENT

Iceboty V7000a

  • Local Moderator
  • * KILL* * KILL * * KILL *
    • Lifetime Achievement Award Winner
    •  
Re: Change Player Character
« Reply #1 on: 05 Jul 2005, 09:29 »
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

  • Round Hole. Square Peg. Steely Determination.
    • I can help with characters
    •  
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Re: Change Player Character
« Reply #2 on: 05 Jul 2005, 09:39 »
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

  • Round Hole. Square Peg. Steely Determination.
    • I can help with characters
    •  
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Re: Change Player Character
« Reply #3 on: 05 Jul 2005, 17:00 »
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

monkey_05_06

  • AGS Project Admins
  • Has left the building.
Re: Change Player Character (And Dialog GUI question)
« Reply #4 on: 05 Jul 2005, 18:38 »
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.
Let's be honest. Most people suck at coding. I suck at coding, but at least my code is readable. To Hell with anyone too lazy to maintain consistent formatting in their code. I could deal with bad interfaces and structure if I could even read your horrible code. And that's putting it nicely. -monkey

BernieLaraemie

  • Round Hole. Square Peg. Steely Determination.
    • I can help with characters
    •  
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
Re: Change Player Character (And Dialog GUI question)
« Reply #5 on: 06 Jul 2005, 06:43 »
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

Re: Change Player Character (And Dialog GUI question)
« Reply #6 on: 06 Jul 2005, 22:45 »
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.