Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: chip on Mon 05/04/2021 10:24:20

Title: Tumbleweed Door Issue
Post by: chip on Mon 05/04/2021 10:24:20
Hello,

I have recreated some doors with the code from the demo room2

and it seem to work, but on one case I have a door that goes to the left instead of up, the problem here is, when you open the door and then click it, to walk through, the player goes up a bit and then changes the room. But he should go to the left, into this door, instead of up. Is that somehow "hardcoded" in the engine / template or how can I fix this?

The help section on tumbleweed-doors does not mention the walk-through-animation before the room is changed.
Title: Re: Tumbleweed Door Issue
Post by: chip on Mon 05/04/2021 20:53:03
Another problem regarding this topic:

As far as I know it is supposed to work like this:
you design your backgrounds with the doors closed, and then add the opened door as an object, that gets hidden or unhidden in the script..

In my case when the door is open, the open-door-sprite is rendered in the foreground (over the player in z-order), and therefore the player walks behind it, it looks weird and is immersion killing, it should be on a layer under the player, is this possible or am I doing something wrong?


edit: regarding first post, Ive fiddled around with scripts and hotspot extensions and now cant recreate the issue, not sure really what I did
Title: Re: Tumbleweed Door Issue
Post by: Khris on Tue 06/04/2021 08:04:54
Each object has a baseline used to determine the drawing order. You can move it further up so the open door sprite appears behind the player.
Title: Re: Tumbleweed Door Issue
Post by: chip on Tue 06/04/2021 15:36:09
It works,  :grin:

Thank you @Khris, this was an easy fix




Another thing that bugs me with doors at the moment is this:

open/close is working fine, but if you Look at it, the player always says "a solid door", I would like to define my own sentence when the player looks at a door, and not let him use the same predefined speech from the unhandled-event strings for every door. When I use this code the player says my text but still also says the "solid door" sentence


Spoiler
Code (ags) Select

function hDoor3_AnyClick()   
  {
  if(Doors.AnyClick(40, oDoor3.ID, 192, 91, eDirectionUp, 8, 213, 127, eDirectionUp) == 0 ) Verbs.Unhandled();
   
  // OPEN 
  if(Verbs.UsedAction(eGA_Open))
{ player.Say("Event Anyclick Open works");
}
 
  // LOOK AT
  if(Verbs.UsedAction(eGA_LookAt))
{ player.Say("Event Anyclick Look works.");
 
}

 
   
}

[close]




What is wrong with it or how do I get rid of it?
Title: Re: Tumbleweed Door Issue
Post by: Cassiebsg on Tue 06/04/2021 16:20:34
Well, you are telling it check if it's anyclick and run "Verbs.Unhandled()", which of course it is.
Then you check if it's Open, it'll be true if you used Open, and then you check for Look, which will be true if you use Look.

What you want is:

{
  If Open ... do this
  else if Look ... do that
  else  ... do Verbs.Unhandled()
}

Which translates in: Check if it's open, run if it is and end the block. If it's not Open check if it's Look, run the code if it is and end the block. If it's not Open nor Look, then run the Verbs.Unhandled() and end the block.
Title: Re: Tumbleweed Door Issue
Post by: Khris on Tue 06/04/2021 16:23:24
You can use  Doors.SetDoorStrings(...);  to change the text, but that's rather supposed to be used to change the default messages and less to implement individual door descriptions.

However you can probably use something like this:

Code (ags) Select
function hDoor3_AnyClick()   
{
  // LOOK AT
  if(Verbs.UsedAction(eGA_LookAt)) {
    player.Say("A custom description of the door."); // just a regular "look at hotspot" interaction so far
  }

  // all other verbs
  else if (Doors.AnyClick(40, oDoor3.ID, 192, 91, eDirectionUp, 8, 213, 127, eDirectionUp) == 0) Verbs.Unhandled();
}
Title: Re: Tumbleweed Door Issue
Post by: chip on Tue 06/04/2021 16:51:30
Your code works perfect :grin:

Thanks again, very good job, much appreciated!