Author Topic: looking at objects before interaction  (Read 140 times)

looking at objects before interaction
« on: 24 May 2020, 01:18 »
hi there. now, im totally new to this. im doing a simple little game. no real story, as i just want to get used to the scripting and placing of hotspots and objects. i have managed to create 4 rooms and can get to and from each 1 fine. i can look/interact etc with hotspots/objects and pick objects up.  what i cant get my head around is what to to put in the script to get character to look at object before interacting with it. basically i have a ship with a closed panel housing a circuit board. i can open panel and take board with looking then interacting or i can just interact and do it without. i have got meself confused searching thru posts on here and cant seem to find what im looking for. can some1 either point me in right direction or explain what i need to input in my script.

many thanks

Re: looking at objects before interaction
« Reply #1 on: 24 May 2020, 05:10 »
You could declare a boolean variable in the beginning of the room script:

Code: Adventure Game Studio
  1. bool LookedPanel = false;

After the script what happens after you look at the panel, enter:

Code: Adventure Game Studio
  1. LookedPanel = true;

Then check in the interaction command script, whether the variable checks as true or false:

Code: Adventure Game Studio
  1. if (LookedPanel == true) {
  2. //Your script if player looked at panel before
  3. } else {
  4. // Your script if player didn’t look
  5. }
  6.  

Re: looking at objects before interaction
« Reply #2 on: 24 May 2020, 12:55 »
perfect thank you. slowly getting there. had to do a few tweaks but with some trial and error i managed to get it how i wanted it. didnt help when i wanted to make a copy of my entire script, in case i messed it up, and instead of copying i hit delete. thank you again for ur help.

Re: looking at objects before interaction
« Reply #3 on: 24 May 2020, 18:53 »
No problem, have a great time designing your game!