Simulating Flooded Areas Becoming Drained

Laraqua
08 Jun 2021, 01:38

So I'd like to make a floor that is flooded and will have a lot of watery descriptions, but once the area has drained, I'd like to have the descriptions all switch to their dry versions. What would be the best way to do this? And is it possible to include a command that automatically switches all the rooms on that level to dry? Such as if someone types Drain Floor A?


DarkLizerd
08 Jun 2021, 06:06

Just set a flag floor.dry=True or floor.dry=False.
If True: dry description
If False: wet/flooded description


Laraqua
09 Jun 2021, 03:21

How would I get all the flags to change so that wet becomes dry on all rooms?


DarkLizerd
09 Jun 2021, 04:34

All you need is just one flag.


jmnevil54
10 Jun 2021, 01:30

Flags and booleans work equally well.


mrangel
10 Jun 2021, 14:56

So I'd like to make a floor that is flooded and will have a lot of watery descriptions, but once the area has drained, I'd like to have the descriptions all switch to their dry versions. What would be the best way to do this? And is it possible to include a command that automatically switches all the rooms on that level to dry? Such as if someone types Drain Floor A?

The easiest way would be to have the room descriptions be something like:

{if not floor_A_drained:You're in a flooded library, where currents in the water make the books move slightly on their shelves.}
{if floor_A_drained:You're in a library full of soggy books, smelling strongly of damp, but at least the water is gone.}

Then when the player drains the library, you can just do:

game.floor_A_drained = true

or (slightly less efficient, but the code is easier to read):

SetObjectFlagOn (game, "floor_A_drained")

or if you're using gamebook mode:

SetFlagOn ("floor_A_drained")