Changing Room Without Walking (Ending a day/case)

Started by TheVolumeRemote, Fri 04/12/2020 04:24:10

Previous topic - Next topic

TheVolumeRemote

What’s the best way to handle changing a room without having the character(s) exit the room?

My game takes place primarily in single room “days” or levels or cases etc. At the end of a day there’s a small sequence once the final puzzle is solved (see example script) and I’m looking for tips on how I should go about achieving a nice fade out and fade in to the next day or case, once that sequence is completed. Note that at least 2 characters will need to go into the new room together (there’s two main characters).

Thank you for any advice!

Code: ags


function hWall_UseInv()
{
  if (cEgo1.ActiveInventory == iChalk && oGlitterFire.Visible) 
 {
    cEgo1.Walk(211, 172, eBlock, eWalkableAreas);
    cEgo1.LockViewFrame(VEGO1CHALK, 0, 0);
    Wait(40);
    oGlitterFire.Visible = true;
    Wait(40);
    cEgo1.UnlockView(eStopMoving);
    Wait(40);
    cEgo1.Walk(140, 172, eBlock, eWalkableAreas);
    Wait(40);
    cGhost1.SetAsPlayer();
    Wait(80);
    cGhost1.Say("Dialogue.");
    cEgo2.Say("Dialogue.");
    cGhost1.Say("Dialogue.");
    cEgo2.FaceCharacter(cEgo1);
    cGhost1.Walk(190, 172, eBlock, eAnywhere);
    cGhost1.LockViewFrame(VGHOST1BACK, 0, 0);
    Wait(40);
    cGhost1.Transparency = 50;
    Wait(20);
    cGhost1.Transparency = 100;
    oChalkwall.SetView(VCHALKWALL);
    oChalkwall.Animate(0, 3, eOnce, eBlock, eForwards);
    oChalkwall.Transparency = 100;
    oGlitterFire.Visible = false;
    cEgo1.FaceCharacter(cGirl1);
    Wait(40);
    //cEgo1.ChangeRoom(2, 200, 160, eDirectionRight);
    //cEgo2.ChangeRoom(2, 205, 160, eDirectionLeft);
   }
  
  else cEgo1.Say("Dialogue.");
  
  }



Crimson Wizard

#1
Could you please elaborate, this is a question of how to perform fade-out effect in AGS, or you are asking about game design / interface ideas?

If first, have you tried setting corresponding room transition type, and does that work for you?

TheVolumeRemote

#2
Apologies, I’m looking for ideas or tips from anyone who has perhaps done something similar in that they had a game that took place in different days (like Gabriel Knight 1) or took place in on a case by case basis and how they handled ending a day. Right now I’m thinking a cutscene room with text could do the job but I suppose a question I have is should I transition to that cutscene from the final sequence (the code I posted) and then from the cutscene script, transition to the new room/day?

If I were to do it that way that raises another question in how would I assign inventory items from the first day that I want them to start the next day with? Example would be in Day 1 the character acquires say a battery, a jar and a pen. On Day 2 I’d like them to start with just the pen. The catch being I don’t want them to start Day 1 with the pen (so player starts with object would be false) because they have to find it in Day 1.

Thanks for any advice:)

Crimson Wizard

#3
Quote from: TheVolumeRemote on Fri 04/12/2020 20:09:28
Apologies, I’m looking for ideas or tips from anyone who has perhaps done something similar in that they had a game that took place in different days (like Gabriel Knight 1) or took place in on a case by case basis and how they handled ending a day. Right now I’m thinking a cutscene room with text could do the job but I suppose a question I have is should I transition to that cutscene from the final sequence (the code I posted) and then from the cutscene script, transition to the new room/day?

Well, same thing could be done in various ways. You may have a cutscene in the same room script, or you may put cutscene in a global script and call it from the room, or have a separate room for cutscene/transition/intermission. My suggestion is : try different things and find out what is simply convenient for your case. Finding "perfect" solutions only comes with practice.

Quote from: TheVolumeRemote on Fri 04/12/2020 20:09:28
If I were to do it that way that raises another question in how would I assign inventory items from the first day that I want them to start the next day with? Example would be in Day 1 the character acquires say a battery, a jar and a pen. On Day 2 I’d like them to start with just the pen. The catch being I don’t want them to start Day 1 with the pen (so player starts with object would be false) because they have to find it in Day 1.

Inventory items could be given and removed using Character.AddInventory and Character.LoseInventory commands, also Character.InventoryQuantity[] array may be used to set number of certain items using their numeric ID.
For example, you may ensure player does not have anything in inventory by this:
Code: ags

for (int i = 1; i <= Game.InventoryItemCount; i++)
    player.InventoryQuantity[i] = 0;

And then just do player.AddInventory(iPen).
EDIT: you may notice something strange, that above script iterates item index from 1 to count inclusive, but this is because of how inventory item index work in AGS, it's actually 1-based (I don't know why, maybe "historical reasons").

You may do above in the cutscene script, before transitioning to beginning of day 2.

TheVolumeRemote

Thank you so very much Crimson, I truly appreciate the time you take to help all of us noobs. Your advice and tips have helped me countless times- from the advice you just gave me to the dozens of times you and Khris have replied to others in threads that have helped me. I appreciate you mate! Also my apologies for the delay in responding, I had a rather unfortunate ear infection I was dealing with.

I’ll take your advice and just try different approaches to ending and starting days, it is certainly nice to have options :) And thank you for the example code on inventory, that makes it clear and easy to understand how to handle things as I’m just beginning my second day or case or scene (whatever!).

Thanks again mate, cheers

SMF spam blocked by CleanTalk