How to create alternate parts of a dungeon ?

Questions about how to create your own dungeons and replacement graphics and sounds.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

How to create alternate parts of a dungeon ?

Post by terkio »

I know how to create walls that exist or don't exist, by means of MOVABLE_WALL s, that I can toggle visible / invisible.
When it comes to SWITCH_LEVER s this doesn't work because toggling doesn't act on the visible / invisible attribute; The act is toggling the switch.
Is there a way to change the visible/invisible attribute of a switch lever ?
What I want to do: I have a regular SWITCH_LEVER and a variant SWITCH_LEVER_2 ( made by cloning ). At some places I want to install the former or the later after entering the dungeon.
SWITCH_LEVER_2 is a clone where I swapped the UP and DOWN bitmaps and set the alternate attribute. This is to have a switch lever that toggles opposite to a regular switch lever ( by opposite, I mean swapping activate / deactivate ).
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: How to create alternate parts of a dungeon ?

Post by Saumun »

The trick is to create two separate levers... one up and one down.
Make sure the alt bitmaps are the same as the primary bitmaps for both levers.
Any toggling of these will switch between visible/invisible.
You can then have each lever toggle both (with the alt lever initially set to invisible) so they switch between up and down, and have separate triggers that toggle single levers visible/invisible.
Alternatively, you can set each lever to change to it's alternate lever by setting it internally via 'Click 1', though this means you would not be able to target the alt lever with triggers because it doesn't exist until you click the original.
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: How to create alternate parts of a dungeon ?

Post by terkio »

Thanks Saumun, I sent you a PM asking for more help.
I do have two separate levers, the regular SWITCH_LEVER and SWITCH_LEVER_2 that I made by cloning where I swapped the up/down bitmaps and set the "alternate" attribute.
When I toggle these, it does not make them visible/invisible, it toggles them up/down.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: How to create alternate parts of a dungeon ?

Post by terkio »

I think, I got it: I should deal with "item is a trigger" ?
So far my switch levers had the "item is a trigger" ON.
I see that with this attribute OFF, when toggled, it actually toggles them visible/invisible ( visible/invisible actually means able/disabled ). This is what I needed.
So far I had not understood the "item is a trigger" attribute, missing the tricks one can do using it.
Thanks, your help put me on the right track.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: How to create alternate parts of a dungeon ?

Post by terkio »

Oups.......
Forget my previous post, it doesn't work as I expected.
Unfortunatly, I have not found a solution yet; I still need more work and help, and am confused.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: How to create alternate parts of a dungeon ?

Post by terkio »

Saumun wrote: Sun Dec 09, 2018 9:32 pm The trick is to create two separate levers... one up and one down.
Make sure the alt bitmaps are the same as the primary bitmaps for both levers.
Any toggling of these will switch between visible/invisible.
Unbeleivable but true. With the same bitmaps the lever behaves a different way :shock: I had never seen programming where bitmaps are used as controls, so I could not beleive such a wacky way.
I finally had a go to this and was amazed to see, it does work that way.
How can one guess this undocumented weird stuff ?
Well, I made some progress.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: How to create alternate parts of a dungeon ?

Post by Saumun »

Sorry for the late reply.
I have not received a pm.

I noticed it because toggling between visible/invisible worked for switches that had no alt bitmap (such as the small and tiny ones), so surmised that it should work for others if the primary and alt bitmaps were set the same.
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: How to create alternate parts of a dungeon ?

Post by terkio »

I made some progress but got stuck further on.
With two switch levers, one that displays the lever up, the other that displays the lever down, toggling them visible/invisible I do get a switch lever that displays the lever toggling up/down as expected. So far, so good.
But I don't get the action right.
I want that switch to toggle a counter. Toggling a counter, i should get -1, +1, -1, +1,
Unfortunalely I get -1, -1, +1, + 1, -1, -1, +1,
I cannot understand this 4 states behaviour. the values of the two switches do not show it. Theses values are either 0,1 or 1,0. ( never 0,0 nor 1,1 ). It seems, the action, when toggling ( activate/deactivate ) has to do with some internal bit, not the item value as, I think it is with a regular switch_lever.
My set up is:
SWITCH_LEVER_UP: Visible, action: toggle to COUNTER, SWITCH_LEVER_UP , SWITCH_LEVER_DOWN, delay 1
SWITCH_LEVER_DOWN: Invisible action: toggle to COUNTER, SWITCH_LEVER_DOWN, SWITCH_LEVER_UP, delay 1

The PM got lost, I made some mistake, I do not see it in the outbox.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
User avatar
Saumun
High Lord
Posts: 2238
Joined: Fri Feb 20, 2009 3:03 am
Location: The Ether

Re: How to create alternate parts of a dungeon ?

Post by Saumun »

I am not certain, but I think it's because it is two separate levers that are both in their initial state... so both will give you -1 on their first use and +1 on the second, rather than a single lever giving -1 then +1.

A way around this would be to set them to activate rather than toggle.
Have a relay toggle the lever up and down, and set up two actions (one to increment the counter and one to decrement it).
Have your up lever activate the toggling relay and the counter decrement action... and your down lever target the same relay and the counter increment.
This should work.
Don't forget you'll need to clone a counter and give it a specific name so that you can set the actions to work.
“Grynix Ernum Quey Ki Skebow Rednim U Os Dey Wefna Enocarn Aquantana” - Anon
User avatar
terkio
Mon Master
Posts: 937
Joined: Tue Jul 10, 2012 8:24 pm

Re: How to create alternate parts of a dungeon ?

Post by terkio »

Thanks, I used activates instead of toggles. Things came nicely and I did not need actions to decrement/increment the counter.
Here is the setup:
LEVER_UP is a cloned SWITCH_LEVER with the alternate bitmaps same as the original bitmaps, that displays a up lever.
LEVER_DOWN is a cloned SWITCH_LEVER with the alternate bitmaps same as the original bitmaps, that displays a down lever.
This way an activate makes them Visible, while a deactivate makes them Invisible. ( Trick, thanks to Saumun ).
An invisible item is not only that, it is completely disabled, it only reacts on an activation that makes it visible = enabled.

To have a toggling behavior: Each lever deactivates itself and activates the other lever.
LEVER_UP is initially Visible, ( when clicked ) it activates LEVER_DOWN and a RELAY that deactivates LEVER_UP
LEVER_DOWN is initially Invisible, ( when clicked ) it activates LEVER_UP and a RELAY that deactivates LEVER_DOWN

I have all I need to implement the incrementing/decrementing of the counter as needed by choosing the right activate and deactivate from the appropriate LEVER_s and asociated RELAYs.

To get +1, -1, +1, -1,,,,, when toggling the lever:
I target the counter
with the deactivate from the relay of the lever_up
and with the activate from the lever_down

To get -1, +1, -1, +1, -1,,,,, when toggling the lever:
I target the counter
with the activate from the lever_up
and with the deactivate from the relay of the lever_down

To remove this switch lever from the dungeon, i deactivate LEVER_UP and LEVER_DOWN. they become invisible, they are disabled.
To enable this switch lever, i activate LEVER_UP if a want its initial state to be UP, or, i activate LEVER_DOWN if I want the initial state to be DOWN.
"You can be on the right track and still get hit by a train!" Alfred E. Neuman
Post Reply