MODULE: Lake v1.3

Started by Kweepa, Sun 09/07/2006 04:16:49

Previous topic - Next topic

Kweepa

Nice work!
(You could also set "Enforce object-based scripting" to false in General Settings and it will work fine. That's not the default though.)
Actually the lake module is now a horrible mish-mash of 2.7 and 3.0 code that will only work with 3.0+. So I might as well just make it AGSv3 only.

http://www.kweepa.com/step/ags/tech/LakeModule13.zip
Still waiting for Purity of the Surf II

cubehouse

Ah ok, not heard of the Enforce object-based scripting thing.
But it's much nicer to have it work "out-of-the-box" so to speak :)

Is a very awesome script  ;D

Quote from: SteveMcCrea on Tue 30/03/2010 03:16:13
Nice work!
(You could also set "Enforce object-based scripting" to false in General Settings and it will work fine. That's not the default though.)
Actually the lake module is now a horrible mish-mash of 2.7 and 3.0 code that will only work with 3.0+. So I might as well just make it AGSv3 only.

http://www.kweepa.com/step/ags/tech/LakeModule13.zip


arj0n


silverwolfpet

#43
I didn't want to write a new topic since we have this one.

I do not understand how you can make characters be reflected in the lake.

32-bit, 1024x756, character sprites are PNGs with transparency.

Any ideas? I've got the latest version of the lake module, and my AGS version is v3.1.2 SP1, February 2009

Help, please?

Code I used in the room:

Code: ags

Lake Room2Lake;

function room_FirstLoad()
{
  Room2Lake.DefaultConstruct();
  Room2Lake.x = 0;
  Room2Lake.y = 500;
  Room2Lake.w = 800;
  Room2Lake.h = 500;
  Room2Lake.yRippleSize = 0.5;
  Room2Lake.xRipplePhaseScale = 0.5;
  Room2Lake.xRipplePhaseScale = 0.5;
}

function room_RepExec()
{
  Room2Lake.Update();
}


EDIT: FOUND the solution!!

For all interested, just play some more with the baselines. You can always use

cEgo.Baseline = 2;  (in the global script)

and then use

Lake.baseline = 4;  (in the room script)

I used to put really low values (like 0 or 1) and it just won't take them. Yay! Fixed it!

But now I has another issue. I'm fading in a title...and as I'm doing that, the lake stops updating.
I tried using

function room_RepExec()
{
 Room2Lake.Update();
}

...but during the fade in of the title (which is an object), the lake won't update. Any ideas? I can move characters while it's fading in...so I have no idea why it's doing that.

EDIT 2: I'm brilliant.

Instead of using a fade IN - fade OUT script, I just (patiently) created 20 sprites (each with +5% transparency) of the title.
THEN I turned it into an object... and I animated that object, specifying not to Block the script (eNoBlock).
Gave it the right timing and voila! It's brilliant!

Thanks :D

placyd

I'm trying to use this module in my game, but I encountered a problem: backgroundFrameIndex doesn't seem to work for me.
I've imported a new background to frame1 and set the code like this:

sea.backgroundFrameIndex=1;

But it isn't working, the water reflects the original background. Can someone help me with this, please?

Another question about the module: is it possible to fully reflect a character which is below the reflection point? For example the character goes into the water. In this case only that part reflects which is above the y coordinate I've set, not the whole character.

Snake

Hello! I'm very sorry, I DO know that there hasn't been any posts in this thread for a very long time :-[

This is a very cool module. I have a blocking animation that stops the water from moving when it is called. Is there a way for this module to ignore blocking commands?
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Dualnames

You could move the lake update to repeatedly_execute_always.
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)

Snake

Hey, Duals, you handsome guy, you. Thank you very much, that is what did the trick! THANKS!
Grim: "You're making me want to quit smoking... stop it!;)"
miguel: "I second Grim, stop this nonsense! I love my cigarettes!"

Julius Dangerous

___________________________________________________________

strangeDetective

I downloaded the Lake module from this site: http://americangirlscouts.org/agsresources/

And got everything working, except the cursor also reflects in the water. I saw that the module was modified to include a baseline for the Lake, to get around this issue. However the version I have does not have anything about setting a baseline in it so it must be an older version. 

The link in the module's forum entry looks like a dead link. Does anyone have an updated version of this module, or know how I can add the code so the lake will have a baseline and not mirror the cursor?

Thanks for any help.

arj0n

@strangeDetective:
I do have v1.2, which was released in 2010.
Not sure if it's updated enough compared to the v1.3 (although v1.2 should work for ags 3.0+ I believe) but you can grab it here if you like.

strangeDetective

Quote from: arj0n on Tue 13/12/2016 22:01:34
@strangeDetective:
I do have v1.2, which was released in 2010.
Not sure if it's updated enough compared to the v1.3 (although v1.2 should work for ags 3.0+ I believe) but you can grab it here if you like.

Thanks a lot, I'll try it out and see. ;-D

strangeDetective

Does anyone who has used the Lake module know how to get the characters tint color to show up in the water reflection? I have the latest updated version, and saw this issue mentioned in the thread but cannot find an example of how to do it?:-\

abstauber

#53
Since I was working on a similar issue, I took the liberty to add these features:
- characters: added tints
- objects: added tints, viewframe animation, scaling and visibility

LakeModule14.zip

Maybe a moderator could update the first post.

--edit:
I just realized, that AGS supports setting all sorts of tints, but getting them seems to impossible. At least I haven't found out if "SetAmbientTint" did something or an object was directly tinted. On the other hand objects seem to ignore region tinting.

Long story short: I only included support for region tinting. For objects you need the object's tint manually to match the region tint (or use SetAmbient Tint)
Also I added this parameter, which has to be set to true in order to apply region tints to objects.

Code: ags

Lake.tintObjects;


Here's an example
Code: ags

Lake pond;

function room_Load()
{
  myObject.IgnoreScaling =false;
  // manually apply the region tint values to the object.
  myObject.Tint(120, 20, 20, 50, 100);
  
  pond.DefaultConstruct();
  // turn on region tinting for object reflections
  pond.tintObjects = true;

  pond.y = 220;
  pond.w = 320;
  pond.h = 160;
  pond.baseline = 160;
  
}



strangeDetective

Quote from: abstauber on Fri 27/01/2017 10:56:36
Since I was working on a similar issue, I took the liberty to add these features:
- characters: added tints
- objects: added tints, viewframe animation, scaling and visibility

Thanks I'll try this out:)

JLM_82

Is there any updates of this module for AGS 3.5 or above?

I downloaded Lake 1.4 (http://shatten.sonores.de/wp-content/uploads/2017/01/LakeModule14.zip), imported it in the "Scripts" -section, and then got the following error when testing the game:

Code: ags
Lake.asc(139): Error (line 139): undefined symbol 'GetViewportY'


What could be a reason, and is there an easy fix available?

Besides, I'd like to know if there is ANYWHERE available proper instructions how the module should be used in the game? For example, how I should tell for the module where the lake is located in the background image?

arj0n

for AGS 3.5 or above, just replace the following in the Lake 1.4 script:

GetViewportY() with Game.Camera.Y
GetViewportX() with Game.Camera.X

JLM_82

#57
Quote from: arj0n on Fri 12/02/2021 10:12:19
for AGS 3.5 or above, just replace the following in the Lake 1.4 script:

GetViewportY() with Game.Camera.Y
GetViewportX() with Game.Camera.X

Thanks for the idea, hopefully that works!

Has anyone instructions how the module should be used in practice? Let's say, if I have a 300x200px -sized lake in my 640x400 -background-image, how the module should be put to work in order to animate the water-area in image? I assume that the lake animation should be started by the room event "After fade-in".

arj0n

#58
For all the available options you can use, see the struct info in the lake script header.
Here's a small and very simplistic roomscript example (game res is 320x200):

Code: ags

// room script file
Lake swimmingPoolSurface;

function room_Load()
{
  swimmingPoolSurface.DefaultConstruct();
  swimmingPoolSurface.baseline = 150;
  swimmingPoolSurface.x = 50;
  swimmingPoolSurface.y = 100;
  swimmingPoolSurface.w = 100;
  swimmingPoolSurface.h = 50;
}

function room_RepExec()
{
  swimmingPoolSurface.Update();
}

JLM_82

Quote from: arj0n on Fri 12/02/2021 10:56:25
For all the available options you can use, see the struct info in the lake script header.
Here's a small and very simplistic roomscript example (game res is 320x200):

Code: ags

// room script file
Lake swimmingPoolSurface;

function room_Load()
{
  swimmingPoolSurface.DefaultConstruct();
  swimmingPoolSurface.baseline = 150;
  swimmingPoolSurface.x = 50;
  swimmingPoolSurface.y = 100;
  swimmingPoolSurface.w = 100;
  swimmingPoolSurface.h = 50;
}

function room_RepExec()
{
  swimmingPoolSurface.Update();
}


Ok, thanks. So it seems the lake must always have a rectangular shape? No way to create lakes with irregular or round borders?

If it works like that, maybe I'll create a rectangular lake and put a couple of large AGS-objects (rocks, trees etc.) in front of the lake to hide the straight (unnatural) shorelines.

SMF spam blocked by CleanTalk