Liquid Triggers

Discuss map ideas, techniques, and give help.
Post Reply
User avatar
A Huge Pfhan
Born on Board
Posts: 22
Joined: Sep 4th '13, 00:13
Location: Sol

With a combination of map triggers and lua scripting, is it possible for me to trigger a liquid rise in the level when the player kills all of the enemies?
If so, how does one make water rise? It's very strange how the whole system is set up.
What do the tide levels and the parameters do?
Winter Solstice of 2014... Thank God that Treellama, W'rkncacnter, and patrick won't be there...
User avatar
Zott
Vidmaster
Posts: 1666
Joined: Jul 1st '06, 21:14
Location: Earth
Contact:

It sure is. You will have to count the number of monsters on the level, and also account for the player being a monster. That's simple enough. Monsters() iterates through all the monsters, so I'd start there.

If you would like a smooth water rise without using a scripting loop I would imagine it might go like this. Similar to how you deal with tides in Weland/Forge.

Media Light #3 (off) at 50% intensity = Media Height of 50%, Middle between Low Tide and High Tide
Blah blah, monsters dead check:
Using lua; Turn on light #3
Light #3 (on) at 100% intensity = 100% High Tide

Then set light #3's 'becoming active' to 50% intensity, 'active' to 100% intensity, and set the transition to 'smooth' or 'linear' to create the nice gradual rise of the media.

----------------------

As for setting liquid levels directly using lua; you can reference the DynamicWater script I wrote up a while ago which dealt with a similar principle. [Shameless self-promotion] http://simplici7y.com/items/dynamic-water-misc-lua-3

Aleph One does not allow for changing the 'height' of a liquid directly using lua, but you can modify the height indirectly using the high and low tide in tandem. If the liquid does not have an oscillating light associated with it, or is 100% bright, (that is, 100% high tide) then you will only need to mess with the high tide height value.

In short: check to see if all monsters, that are not the player, are defeated.
If so, iterate through all the media/liquids, (or specify the one you want), then modify its high tide value.

Note, this will change the value instantaneously, so will not result in a smooth water movement. If you want the tide to ride smoothly, then you'll need to resort to alternatives such as using Lights above.
User avatar
A Huge Pfhan
Born on Board
Posts: 22
Joined: Sep 4th '13, 00:13
Location: Sol

Zott wrote:It sure is. You will have to count the number of monsters on the level, and also account for the player being a monster. That's simple enough. Monsters() iterates through all the monsters, so I'd start there.

If you would like a smooth water rise without using a scripting loop I would imagine it might go like this. Similar to how you deal with tides in Weland/Forge.

Media Light #3 (off) at 50% intensity = Media Height of 50%, Middle between Low Tide and High Tide
Blah blah, monsters dead check:
Using lua; Turn on light #3
Light #3 (on) at 100% intensity = 100% High Tide

Then set light #3's 'becoming active' to 50% intensity, 'active' to 100% intensity, and set the transition to 'smooth' or 'linear' to create the nice gradual rise of the media.

----------------------

As for setting liquid levels directly using lua; you can reference the DynamicWater script I wrote up a while ago which dealt with a similar principle. [Shameless self-promotion] http://simplici7y.com/items/dynamic-water-misc-lua-3

Aleph One does not allow for changing the 'height' of a liquid directly using lua, but you can modify the height indirectly using the high and low tide in tandem. If the liquid does not have an oscillating light associated with it, or is 100% bright, (that is, 100% high tide) then you will only need to mess with the high tide height value.

In short: check to see if all monsters, that are not the player, are defeated.
If so, iterate through all the media/liquids, (or specify the one you want), then modify its high tide value.

Note, this will change the value instantaneously, so will not result in a smooth water movement. If you want the tide to ride smoothly, then you'll need to resort to alternatives such as using Lights above.
Do you know if I can use the "number of BOBs left" function to make it so that when I'm without backup the leak begins?
Winter Solstice of 2014... Thank God that Treellama, W'rkncacnter, and patrick won't be there...
User avatar
Crater Creator
Vidmaster
Posts: 943
Joined: Feb 29th '08, 03:54
Contact:

Untested pseudocode to get you started:

Code: Select all

Triggers.monster_killed()
   local leak = true
   for m in monsters() do
      if(m.class == "bob") then
         leak = false
      end
   end
   if(leak) then
      Tags[0].active
   end
end
Where the liquid is tied to tag 0. That's how I'd approach it.
User avatar
PerseusSpartacus
Mjolnir Mark IV
Posts: 334
Joined: Apr 30th '12, 05:03
Location: Somewhere in the 19th Century...

Crater Creator wrote:Where the liquid is tied to tag 0.
Shouldn't it be the light assigned as the tide that gets attached to tag 0, rather than the liquid itself?
User avatar
Crater Creator
Vidmaster
Posts: 943
Joined: Feb 29th '08, 03:54
Contact:

Yes, you're right - the liquid doesn't take a tag directly, but the light does. Without trying it, I'm also not sure if you can look up monster.class directly.
User avatar
A Huge Pfhan
Born on Board
Posts: 22
Joined: Sep 4th '13, 00:13
Location: Sol

Crater Creator wrote:Untested pseudocode to get you started:

Code: Select all

Triggers.monster_killed()
   local leak = true
   for m in monsters() do
      if(m.class == "bob") then
         leak = false
      end
   end
   if(leak) then
      Tags[0].active
   end
end
Where the liquid is tied to tag 0. That's how I'd approach it.
So if I insert this into the game will the liquid start at low tide and raise to high tide when all the BOBs die?
Winter Solstice of 2014... Thank God that Treellama, W'rkncacnter, and patrick won't be there...
User avatar
Crater Creator
Vidmaster
Posts: 943
Joined: Feb 29th '08, 03:54
Contact:

Barring any errors, the code will activate tag 0. You need a light tied to tag 0, and you need a liquid tied to that light. Then the liquid will rise or lower depending on the settings of the light. The Forge manual details lights, liquids, and tags - look at tutorial 3.

Actually, you might as well skip the tag and do Lights[l].active = true.
Post Reply