Map with object activated waypoints

Started by harmonicapress, Mon 20/07/2015 03:50:14

Previous topic - Next topic

harmonicapress

Trying to create a map for my character, I created a room and used objects as clickable points that change rooms. I had no problem getting the basic functions to work with cEgo.ChangeRoom but now I want a new waypoint to pop up when my character finds a particular object that provides a clue unlocking the new location. The issue I am having is that the object (a book of matches) is in another room (room 1) and the map is room 2, I tried ...
Code: ags
 
function oMatchbook_Interact()
{
cBingo.Walk(590, 450, eBlock, eWalkableAreas);
cBingo.Say("What have we got here?");
oMatchbook.Visible = false;
cBingo.Say("It says 'Club Oooo'. I better check it out.");
cBingo.AddInventory(iMatches);
oClubo.Visible = true
}

room 1 asc doesn't recognize the object in room2 used as the icon for the new location. Hints? A better system altogether? Thanks!
                                                                             

Slasher

you could either make a global boolean that turns the object in room 1 on or condition if player has inventory (iMatches)

Khris

Like the auto-complete window suggests by not offering to complete the object's name, objects are local to rooms and can't be accessed in other rooms' scripts.
The best route is to use global variables. If you only have a manageable amount of unlockable rooms, create a global bool (inital value: false) for each one in the Global variables pane.

When you find the matchbook, use
Code: ags
  map_club_oooo = true;


In your map room, in before fadein / room_Load, do this:
Code: ags
  if (map_club_oooo) oMatchbook.Visible = true;


(Also note that how to do stuff in other rooms is one of the most frequently asked questions ever, and has been asked and answered dozens of times. Please make sure you exhaust the forum search before opening a thread about really basic stuff.)

SMF spam blocked by CleanTalk