Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] LiquidArea Problem
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#1
[SOLVED] LiquidArea Problem

Sorry to be posting every day about new issues but this one is easily the worst for me as I really want to use this feature.

There's an old screenshot for original Amnesia of the cistern entrance flooded and I wanted to use that so I have done exactly that. However, when walking on the platform above, it still makes the water walking / running sounds. To understand what I'm stating: https://www.youtube.com/watch?v=9rCmOdgOhKU

I also have two script areas to toggle the liquid area, here it is:

AddEntityCollideCallback("Player", "AreaToggleWater", "CollideToggleWater", false, 1);
AddEntityCollideCallback("Player", "AreaToggleWater_1", "CollideToggleWater_1", false, 1);

//---------------------------------------------------------------------------------------------------------------------

/*Toggle Water
 */
void CollideToggleWater(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("PlayerInWater")==0) return; 
SetLocalVarInt("PlayerInWater",0);

SetEntityActive("LiquidArea_1", false);

SetEntityPos("LiquidArea_1", -4.994, -0.91, 50.263); //To move it away from map for safety

AddDebugMessage("OUT WATER", false);
}

void CollideToggleWater_1(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("PlayerInWater")==1) return; 
SetLocalVarInt("PlayerInWater",1);

SetEntityActive("LiquidArea_1", true);

SetEntityPos("LiquidArea_1", -4.994, -0.91, 0.263); //To move it back to map for safety

AddDebugMessage("IN WATER", false);
}
(This post was last modified: 12-30-2018, 07:43 PM by theyhunger.)
06-23-2018, 05:12 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: LiquidArea Problem

Is this the original Cistern level unmodified? Because that should not happen. Looks like a bug to me, unless you have a water area that extends to the upper portion.

Or do you mean that you have another liquid area higher up that should be disabled? It might be that liquid areas aren't affected by scripts as to enable/disable them.

I can't tell what your script is doing because I don't know where these areas are placed. But seemingly you first collide with an area called CollideToggleWater_1, which will teleport a liquid area "back to map", then later you can collide with the other area which will teleport it away.

(This post was last modified: 06-23-2018, 11:19 PM by Mudbill.)
06-23-2018, 11:12 PM
Find
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#3
RE: LiquidArea Problem

(06-23-2018, 11:12 PM)Mudbill Wrote: Is this the original Cistern level unmodified? Because that should not happen. Looks like a bug to me, unless you have a water area that extends to the upper portion.

Or do you mean that you have another liquid area higher up that should be disabled? It might be that liquid areas aren't affected by scripts as to enable/disable them.

I can't tell what your script is doing because I don't know where these areas are placed. But seemingly you first collide with an area called CollideToggleWater_1, which will teleport a liquid area "back to map", then later you can collide with the other area which will teleport it away.

1) It is the original Cistern level but with few changes, such as more candles and better lighting in the tunnel to the Sewer door, no lever or pipe blocking the ladder (ladder is already down) and the whole level is now flooded as opposed to only the stairs flooded.

2) The only two liquid areas in the level are: https://imgur.com/zXXzLRD and https://imgur.com/bVNJ3Qh

3) What I was trying to do for the script was to do the following:
If player enters CollideToggleWater,
Check if player is in water, if not; set PlayerInWater to 0,
Set the Liquid Area not active and move it to the -4.994, -0.91, 50.263.
This moves it out of the level.

If player enters CollideToggleWater_1,
Check if player is in water, if so; set PlayerInWater to 1,
Set the Liquid Area active and move it to the -4.994, -0.91, 0.263.
This brings it back into its original place.

If you needed to know, AreaToggleWater is at the top of the ladder
and AreaToggleWater_1 is on the ground / water.


If you need any more information or pictures, let me know. Thanks Smile
06-24-2018, 11:13 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: LiquidArea Problem

You can enable a debug toggle in the F1 menu in-game to let you see where areas are. This could help you determine if the area actually moved. Maybe water areas still affect the player even if they're far above.

06-25-2018, 03:46 PM
Find
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#5
RE: LiquidArea Problem

(06-25-2018, 03:46 PM)Mudbill Wrote: You can enable a debug toggle in the F1 menu in-game to let you see where areas are. This could help you determine if the area actually moved. Maybe water areas still affect the player even if they're far above.

Thanks but I already know about the physics draw option on the debug menu. It shows that it does move away but still doesn't work. I even tried to move it above / below the map and still to no avail. So I'm gonna assume the no matter where the LiquidArea is, whether you are on at the same height but not in the area or above / below the area but in the area; it will always play the water_walk/run sounds as opposed to the rock_water_walk/run sounds. Unless there's any other suggestions, I might have to omit this part and literally copy the original Cistern level. :/
06-25-2018, 08:17 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: LiquidArea Problem

Have you tried moving it horizontally instead?

06-27-2018, 03:35 AM
Find
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#7
RE: LiquidArea Problem

(06-27-2018, 03:35 AM)Mudbill Wrote: Have you tried moving it horizontally instead?

Yes and even diagonally, still not working. The only other suggestion that I can think of is to replace the entity water_plane with a primitive version of it. So when the water is drained via cistern, instead of loading this map, it will load a redux version that makes minor changes and removes that water.

Other than that, ain't got a clue. Thanks for the suggestion anyways.
06-27-2018, 08:48 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: LiquidArea Problem

Ok, I set up a minimap level to reproduce the issue and I found out what's going on.

There seems to be an event triggered when you first ENTER a liquid area which enables the splashing, then another when you LEAVE which disables it.

If you teleport the area away from the player after they have entered it, the LEAVE callback isn't triggered. This means that anywhere you walk will cause splash effects until you enter the area's new location and then leave it again. That's when the LEAVE callback is finally triggered and all the positions seem to be up to date afterwards.

This means you'll have to find a way to work around this issue.

Edit: Setting it inactive has the same effect except it won't trigger the ENTER callback anymore, so you can't reset the state using the inactive area.

Edit 2: Maybe you can avoid the issue by not disabling or teleporting the area until you know the player has already left it. So let the player cause the LEAVE callback, then change the areas. Perhaps using a collide callback script area that hovers in the middle of the ladder across the entire room (make it very thin, but not 0).

(This post was last modified: 06-27-2018, 03:56 PM by Mudbill.)
06-27-2018, 03:42 PM
Find
theyhunger Offline
Junior Member

Posts: 15
Threads: 6
Joined: Jul 2017
Reputation: 0
#9
RE: LiquidArea Problem

(06-27-2018, 03:42 PM)Mudbill Wrote: Ok, I set up a minimap level to reproduce the issue and I found out what's going on.

There seems to be an event triggered when you first ENTER a liquid area which enables the splashing, then another when you LEAVE which disables it.

If you teleport the area away from the player after they have entered it, the LEAVE callback isn't triggered. This means that anywhere you walk will cause splash effects until you enter the area's new location and then leave it again. That's when the LEAVE callback is finally triggered and all the positions seem to be up to date afterwards.

This means you'll have to find a way to work around this issue.

Edit: Setting it inactive has the same effect except it won't trigger the ENTER callback anymore, so you can't reset the state using the inactive area.

Edit 2: Maybe you can avoid the issue by not disabling or teleporting the area until you know the player has already left it. So let the player cause the LEAVE callback, then change the areas. Perhaps using a collide callback script area that hovers in the middle of the ladder across the entire room (make it very thin, but not 0).

Thank you for the information but I have managed to fix this frustrating issue / bug. All I did was made a way to get out of the water before using the ladder as using the ladder doesn't seem to use the LEAVE function of the water as you stated. My new problem was that the ladder was still accessible from the water so I had to place a custom-made invisible box to block the ladder being used and I reworked the ToggleWater script to ToggleInvisBox, so now instead of disabling the water, it now disables that block box so the ladder can be used, but when you enter the water again, it will re-activate the block box.

Here's what I mean: https://imgur.com/a/D6WEskE

/*Toggle Invisible Box - Ladder

 */
void CollideToggleInvisBox(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("invisible_box_1", false);
}

void CollideToggleInvisBox_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("invisible_box_1", true);
}


Again, thank you for all the help. You are a hero! =D


EDIT: I guess I didn't like my idea with the stairs and the block box so I removed it Tongue. However, as I fell asleep that night, I had an idea... and it works great (for the most part). All I did was place another small liquid area above the ladder so when you get off the ladder, it WILL trigger the LEAVE function of the water. Once again, thanks for the help you've provided. Smile

https://imgur.com/a/xlSvL6R
(This post was last modified: 06-29-2018, 08:56 AM by theyhunger.)
06-28-2018, 08:35 PM
Find




Users browsing this thread: 1 Guest(s)