How to check if a single object was looked at

Started by Sylvr, Mon 25/03/2013 15:40:53

Previous topic - Next topic

Sylvr

Perhaps this doesn't belong in the beginner's forum, but since it seems a simpler problem than my reference thread....

My goal here is to have the player only able to get the waffle from the freezer, if the menu, as an inventory item, was looked at first. The only thread on the matter I could find was this one, but I can't figure out how to simplify the code for just one single item. I understand that it needs to involve the global script though, since iMenu could be looked at in any room.

My current fix is "if player has iMenu, waffles are attainable. just click on the freezer door."

Thanks!
| Ben304: "Peeing is a beautiful thing, Sylvr" |

Khris

Just add a global bool variable in the Global Variables pane (name: looked_at_menu, initial value: false)

In iMenu's Lookat: looked_at_menu = true;

In the freezer's code, do
Code: ags
  if (looked_at_menu) {
    // get waffles
  }
  else {
    player.Say("I'm not sure what to look for.");
  }

Sylvr

Totally forgot about global variables. Thanks so much!
| Ben304: "Peeing is a beautiful thing, Sylvr" |

SMF spam blocked by CleanTalk