I'm having some issue getting this to work. I am aware what the issue is (I think). How can I make an object visible after a certain interaction with a character? If I am correct the error happens because this part of the interaction is in the global script and the object is part of the room script. So is it possible to even do this? In my example you hand over some money and a ring appears in another part of the room.
If I try it like in the code below, I get this error:
GlobalScript.asc(683): Error (line 683): Undefined token 'oRing'
// GIVE TO
if (Verbs.UsedAction(eGA_GiveTo)) {
if (player.ActiveInventory==iMoney){
player.LoseInventory(iMoney);
Wait(20);
oRing.Visible=true;
}
else {
player.Say("I don't think I want to bother her with that.");
}
object[ID].Visible=true;
If you are in the same room where the object should become visible, then just use the object ID. Otherwise you'll need a variable to check for when you load the room.
Another alternative is to use CallRoomScript (https://adventuregamestudio.github.io/ags-manual/Globalfunctions_General.html#callroomscript) to trigger event in room script, where you may handle this. But that is usually suggested when similar action may be performed in multiple rooms.
Quote from: Cassiebsg on Sun 03/01/2021 16:15:20
object[ID].Visible=true;
If you are in the same room where the object should become visible, then just use the object ID. Otherwise you'll need a variable to check for when you load the room.
Ah, OK. So you use ID's when not in the room script file. Thank you.