Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Question template  (Read 2763 times)

0 Members and 1 Guest are viewing this topic.

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Question template
« on: November 30, 2008, 05:47:58 AM »

My game has a scene that asks whether the player wants to play as male or female using the question template for the window.

I'm not very good at getting the control for a button or static in another scene---and changing things like its image in another scene---how would I script the yes button (which is now "male"--the no button is "female"--the question is "Play as male or female?" ) so that in another window the avatar in a static is a male pic?  I would have to be able in the script of the question window to get the control for the static in the other window that contains the male avatar and set that static's image path to its male picture. Any help is appreciated.  :  )

Since I'm having so much trouble getting the button controls in script, I need detailed instructions if possible.  :  )  I usually get the error message var (name of button) is not defined or method "getcontrol" is not defined.

It's important for me to nail this down as in dialogues in the game whether the player is male or female would affect the dialogues and I would have to have an if clause that could access the right global--f.e. global male = true. 

Or this is not possible?  I'm pretty sure it's easy but I just don't have the facility yet.  :  ) 
« Last Edit: November 30, 2008, 07:16:57 AM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Question template
« Reply #1 on: November 30, 2008, 10:30:39 AM »

I think your gender selection window should indeed store the choice in some global variable, so that you can use it throughout the game.
So, the selection window would contain two buttons, named "male" and "female" and the window script would contain something like:

Code: WME Script
  1. ...
  2. on "male"
  3. {
  4.   global g_GenderMale = true;
  5.   this.Close();
  6. }
  7. on "female"
  8. {
  9.   global g_GenderMale = false;
  10.   this.Close();
  11. }
  12.  

Now, your other window(s) would contain something like this in the beginning of their scripts:

Code: WME Script
  1. global g_GenderMale;
  2. var Portrait = this.GetControl("portrait"); // "portrait" being the name of a static control
  3.  
  4. if(g_GenderMale == true) Portrait.SetImage("path\male.png");
  5. else Portrait.SetImage("path\female.png");
  6.  

Similarly you'll be able to use the global variable in dialogues:

Code: WME Script
  1. global g_GenderMale;
  2.  
  3. if(g_GenderMale == true) SomeNPC.Talk("Helo there, sir.");
  4. else SomeNPC.Talk("Helo there, lady.");
  5.  
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: Question template
« Reply #2 on: November 30, 2008, 03:57:26 PM »

Thanks, Mnemonic!!!!!!!!  It works and it's a cool feature!!!  I just added a little script to change the screen to the next after you press either "Male" or "Female".  Of course I could do this with "races" or "class of fighter" (simple fighting) as well as "gender" too now but don't want to complicate things too much yet.  Once one thing works completely, can go from there. ^^   :D

« Last Edit: November 30, 2008, 04:45:45 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  
 

Page created in 0.078 seconds with 21 queries.