Looking for specific function - cannot find it anywhere

Started by OldTimeGamer, Sat 15/08/2015 15:27:15

Previous topic - Next topic

OldTimeGamer

Hello,

I need help about one specific script I cannot find anywhere.

I don't know how to explain it exactly, so I will try to say as simple as possible. I'm looking for function that can do this:

When my character does something particular, it will cause something to happen.

Example:
My character talks with stranger, who will reveal new location to the character. Therefore, after this dialog, my character will be able to enter the new location.

I always solve this problem with this aid - I make my character receive some item, so I can create function "Enter location after receiving the item."
Can I somehow do this without receiving an item?

I hope I made myself clear.

Have a nice day,
David

selmiak

just use global variables, preferably bools.
Set the PlayerTalkedAboutX = true; in the dialog (declare it as false before of course), then in the repeadedly execute of the room with the exit to open up or the thing to happen check for
Code: ags

if (PlayerTalkedAboutX == true) {
  //stuff that happens, remove walkable area, remove blocking object...
  PlayerTalkedAboutX=false;
}


set the variable to false at the end of the if clause to make it happen only once. use integers if you want the player to collect a certain amout of coins/stones/buttons/whatever and check for that specific number.

OldTimeGamer

Thank you very much for you quick response.

One more question though. What is "PlayerTalkedAboutX"? Is it e.g. dDialog1?

Slasher

QuoteWhat is "PlayerTalkedAboutX"?
it is just a variable boolean that selmiak added as an example.

PlayerTalkedAboutX could be called anything.

make a boolean in the global pane, give it a name, set it to false.
you can set it true at any point.

this is where you would use selmiak's example but using the boolean name you made.

Basic
Code: ags
if (PlayerTalkedAboutX == true) {
  //Do this
  PlayerTalkedAboutX=false; // else do this
}


simple ;)


OldTimeGamer

Thank you. And sorry for my lack of knowledge. You both helped me a lot. :)

Have a nice day.


SMF spam blocked by CleanTalk