Changing an Interaction later

Started by Nintengame, Mon 29/05/2006 17:55:44

Previous topic - Next topic

Nintengame

I want to have my charecter look in his mailbox, and find it empty But later, after he enters a contest or something, I want there to be something in the mailbox.

Akumayo

What you'll need to do is create a global variable.

In the top of your global script, before any of the functions start, place this:
Code: ags

bool Entered_Contest = false;

export Entered_Contest;


Then, in the global header:
Code: ags

import bool Entered_Contest;


Now the variable Entered_Contest is available in all your rooms.  Whenever the player enteres the contest:
Code: ags

Entered_Contest = true;


Then, in the mailbox interaction:
Code: ags

if (Entered_Contest == false) {
  Display("There is nothing in the mailbox.");
}
else {
  Display("Hey, I got some mail!");
  //other stuff for getting mail here
}


Hope that helps!

-Regards, Akumayo
"Power is not a means - it is an end."

Nathan23

I think this question was asked before, but here is the thing:

a.) Declare a global variable with a initial value.
b.) In the room where is the mailbox, export the variable
c.) Ã, In this room check his value, if is the first time the value would be the initial.
d.) In another room, or an some part of the game where you think the mailbox must be contain something, change the value of the variable, make sure that the variable was exported or you will have a compile error :P.
e.) In the original room where is the mailbox in the part where you check his value add another condition and put the code to do the object appears in the mailbox (a letter o package...)

Thanks to "Nerezza Terra" Akumayo  for the code explanation

SMF spam blocked by CleanTalk