find idems

Started by phillipPbor, Tue 10/11/2015 23:05:37

Previous topic - Next topic

phillipPbor

i need to know something.
if you examine the bed, you go there and finds what is under the bed, you got the key.
if you check again, nothing.

but what do you all think it dose?
I am new here..
need a musician composer though...

Mandle

Are you asking how to make it so that the key item in your game can only be found once?

phillipPbor

i know how inventory item works and how to use them. what i don't know was how to make hotspot react? after click on it once.
I am new here..
need a musician composer though...

Mandle

Ah, gotcha...I have no time to explain right now. Can somebody field this one. Cheers!

Khris

Try this:
Code: ags
function hBed_Interact() {
  // walk over, look at it, etc
  if (Game.DoOnceOnly("find key under bed")) {
    Display("You search under the bed and find a key.");
    player.AddInventory(iKey);
  }
  else {
    Display("There's nothing else to be found.");
  }
}


The text you use for "find key under bed" doesn't really matter, as long as you don't reuse it in another Game.DoOnceOnly() command elsewhere.

Zack Casey

#5
The text you use for "find key under bed" doesn't really matter, as long as you don't reuse it in another Game.DoOnceOnly() command elsewhere.
[/quote]

The power of if-else (and soon switch) statements can't be underestimated. These can help you keep your game persistent, dynamic, and even help you avoid crashes.

Edited by mod: Removed unnecessary quote.

SMF spam blocked by CleanTalk