Read Letter Cutscene SOLVED

Started by harmonicapress, Mon 30/12/2013 22:45:21

Previous topic - Next topic

harmonicapress

I'm trying to run a small cutscene where my character reads a letter as soon as I interact with it. I created a the letter as a room, set my characters visibility to false and tried to use ChangeRoom to make it come up, but I keep getting the watch icon then the game crashes and tells me that there is a NewRoom command already open. I poured through the forums looking for an answer for this and couldn't find an older post with the exact same issue, most were examining letters in their inventory.
Here is my code. Thanks Gurus!

Code: AGS

function oLetter_Interact()
{
cSam.Walk(104, 178, eBlock, eWalkableAreas);
oLetter.Visible = false;
cSam.Say("Looks like it's from my brother J.B.");
cSam.ChangeRoom(5, 0, 0);
Wait(600);
cSam.ChangeRoom(cSam.PreviousRoom);
cSam.AddInventory(iLetter);
}

Khris

Here's what the manual has to say about ChangeRoom():
QuoteIMPORTANT: This command does not change the room immediately; instead, it will perform the actual room change once your script function has finished (This is to avoid problems with unloading the script while it is still running). This means that you should not use any other commands which rely on the new room (object positionings, and so on) after this command within the same function.

Basically, move everything after the first ChangeRoom to the letter room's after fadein event.

If you don't want the watch icon during the Wait(600), use mouse.Visible = false;, then turn it back to true afterwards.

harmonicapress

Awesome! that worked with one little hitch...when the room fades back after the letter is read, my character is gone. How can I fix that?

Khris

Instead of this: cSam.ChangeRoom(5, 0, 0);
Use cSam.ChangeRoom(5);

Then open the letter room and in the properties, turn ShowPlayerCharacter to false.

Dualnames

And if you would be so kind as to edit the first post replacing
Code: ags
 with [code =A GS] (without the space between A and G) that would be great, to help future searches of other people.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

harmonicapress

Awesome. Thanks Khris!  The zero's in the x y coordinates were keeping my character from returning to the previous room. SOLVED!

SMF spam blocked by CleanTalk