Windows Calling alarm on different object

G

Gizimo

Guest
I am trying to create an interactive door that opens when the player presses "x" while close to it. I'm currently trying to work out how to call an alarm on the door when the player presses "x".
 
T

tamation

Guest
I am trying to create an interactive door that opens when the player presses "x" while close to it. I'm currently trying to work out how to call an alarm on the door when the player presses "x".
You can reference alarms and variables from other objects by doing [object name].alarm[0], in your case probably obj_door.alarm[0] = [amount].
Can be a good idea to preface this with "if instance_exists(obj_door)" to avoid potential crashes.
 
R

relic1882

Guest
I am trying to create an interactive door that opens when the player presses "x" while close to it. I'm currently trying to work out how to call an alarm on the door when the player presses "x".
I'd go with place_meeting in the step event for simplicity, depending on the complexity of your situation.

if place_meeting with player object then check for player input. If player input is active, open the door, do whatever you need, set the alarm and proceed.

It's an easy way to check if the player is within range, checking for input, then acting upon it all at once. Not to mention it will work for whatever door instance you create without checking specific variables.

Edit: add more info.
 
Last edited by a moderator:
Top