looking at objects before interaction

Started by spike2k8, Sun 24/05/2020 01:18:04

Previous topic - Next topic

spike2k8

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

Sedgemire

You could declare a boolean variable in the beginning of the room script:

Code: ags
bool LookedPanel = false;


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

Code: ags
LookedPanel = true;


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

Code: ags
if (LookedPanel == true) {
//Your script if player looked at panel before
} else {
// Your script if player didn’t look
}

spike2k8

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.

Sedgemire

No problem, have a great time designing your game!

SMF spam blocked by CleanTalk