If previous room was X [SOLVED]

Started by rickious, Wed 25/03/2015 22:04:59

Previous topic - Next topic

rickious

I would like a SFX to play on room load, but only if the player came from a specific room.  What if the best way to do this?

Basically. I have a cabinet in a room.  Otherwise 90% of my rooms are linked by the same method, identical doors.  So on each room load I have a set closing door SFX play.  However in a few rooms, I want to play a specific SFX on room load depending on which room you have arrived from.

I already have a 'Game.StopAudio();' on every room load as this worked as a great way to cross fade music between rooms.  My current SFX for closing a door plays after that and it works pretty well.  Just doesn't translate to when you exit a closeup view of a cabinet.

Thanks
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

Snarky

I would create a global variable to keep track of the previous room, e.g. "int prevRoom". Then I would add a condition to globalscript on_event():

Code: AGS
function on_event(EventType event, int data)
{
  if(event == eEventLeaveRoom)
    prevRoom = player.Room;
}


Now you should be able to just test whether prevRoom is the value you're looking for.

HandsFree

Why not just do
Code: ags

if (player.PreviousRoom == 1)
?

Monsieur OUXX

Yes, the solution is so easy that even Snarky doesn't know it exists. AGS saves the previous room for you. Just use player.PreviousRoom.
 

Snarky


Ghost

No, sorry. Snarky's solution is much truer to the adventure game spirit, which requires each solution to be as complicated and convulted as possible. HandsFree, sorry again, but your solution is only 1/2 Malcolms*, but Snarky manages a full 2 Malcolms PLUS his approach can easily be complicated even further.
__
* A traditional measurement of adventure game puzzle solution convultiveness. 1 Malcoms is the time you need to say "Holy shit I would never have thought of doing it this way but now that I did it makes even less sense" three times in a row while balancing a pinecone on your nose.

Monsieur OUXX

Someone still hasn't digested the "randomly put something on the floor to make Brandon trip without any visual clue that it's even possible" puzzle.

I HAVEN'T EITHER.
 

Mandle

Quote from: Ghost on Thu 26/03/2015 17:04:04
* A traditional measurement of adventure game puzzle solution convultiveness. 1 Malcoms is the time you need to say "Holy shit I would never have thought of doing it this way but now that I did it makes even less sense" three times in a row while balancing a pinecone on your nose.

Shit...I'm not even going to try to calculate your equations while playing "I Have No Mouth And I Must Scream" and just trying to figure out where the exits are and what the verbs needed to use them are...

I'm renaming the game "I Have No Consistant Interface And I Must Play" because it's still one of the most awesome games I've ever played despite it's many flaws and glitches...

rickious

Hahahaha thanks people.

player.PreviousRoom.    (insert DOH! headslap emoticon here)
--COMING SOON--
'Body Pharm' beta demo.

Body Pharm - coming soon!

SMF spam blocked by CleanTalk