Handling crazy amounts of secret doors (new problem)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
HaunterV
Posts: 676
Joined: Mon Apr 16, 2012 9:54 pm
Location: Barrie, Ontario, Canada

Handling crazy amounts of secret doors (new problem)

Post by HaunterV »

Had an idea for a problem I'm trying to tackle, what follows is my rambling thought process.

Ok. So I have planned a multy-stage boss fight that has the room change shape quite a few times via pressure plates triggering the room shifts, so kiting makes things a bit more interesting during the fight.

so, I want to trigger a few things every time the room changes;

- Screen Shake and dust from the ceiling, I can do this myself more or less
- Earthquake-ish sound, i will find a suitable sound for this as the current earthquake sound lasts forever
- many many secret doors open while others close, thus creating different room configurations.


it's that last one that causes me the trouble. I figure I'll settle on 5 room configurations to cycle through beginning to end. Now I want to handle the configuration changes via hidden plates that are monster triggered so that kiting this monster gets interesting. I considered manually doing this with pressure plates but I KNOW there is the multy-similar entity script out there that will help a boatload, I've used it before. However I've never used it the way i think I need to use it now.

One thought on how to minimize the confusion is to name the doors in the configurations individually so like; sd_rm_cfg_1_1, sd_rm_cfg_2_1, etc... the 1st number being the room configuration and sd and rm meaning secret door and room respectively. anyway, as the various plates get triggered i need the script(s) to close or toggle secret doors so dropping ones and opening others in a manner that changes the shape of the room and thus the dynamic of the fight and hopefully the player is kept on their toes.

I'm wondering do I;
SpoilerShow

Code: Select all

 function activate()
      for i=63,85 do
        local door = findEntity("sd_rm_cfg_1_"..i)
        if door then
          door:toggle()
        end
      end
    end

 function activate()
      for i=63,85 do
        local door = findEntity("sd_rm_cfg_2_"..i)
        if door then
          door:toggle()
        end
      end
    end
in the same SE, or do I make probably 5 different SEs? one for each cfg? and if so how do i toggle one set then the other as I have just now realized that there is a potential for the player to get trapped if I do this wrong so I figure i need to step the toggles as in open and shut in ways that will never trap either the monster or the player, merely pen them in or open things up for more kiting.

so room cfgs are as follows;
1)1x7 hallway triggers the monster when the player reaches the end of the hallway.
2)The mid-point of the 1x7 opens up into a 3x3 room for initial combat.
3)Said 3x3 room then closes the remaining of the 1x7 and extends the 3x3 east and west if looking at it from above into a 3x5 room.
4)the 3x5 room can then mutate into a 5x7 north to south.
5)the 5x7 will then collapse to a 3x7 n->s.
or
6)the 5x7 will open up to the entire 7x7.

What I need to work out is the easiest way to do this.

by now I'm thinking of using some sort of "scan area for monster + Player = room cfg change" script.

oo! i could do on death hooks and swap the monster with an identical or possibly similar but with a different particle attached, obviously with a blinding flash/particle effect to hide the change. the hooks can fire off the cfg changes as well... can i possibly set up a "switch to cfg 2" script?




well welcome to the view inside my head... confusing enough for you?

WALL OF TEXT WOOOO!

Edit: on now that ihave it kind of functioning how i want, some walls/secretdoors are walk through-able im looking at about 200 doors now i have to check and replace manually... wtf man this is some frustrating bull.

Edit: fixed it.
Last edited by HaunterV on Fri Nov 09, 2012 4:58 am, edited 4 times in total.
Grimrock Community 'FrankenDungeon 2012. Submit your entry now!: http://tinyurl.com/cnupr7h
SUBMIT YOUR ASSETS! Community Asset Pack (C.A.P.): http://tinyurl.com/bqvykrp
Behold! The HeroQuest Revival!: http://tinyurl.com/cu52ksc
User avatar
Skuggasveinn
Posts: 561
Joined: Wed Sep 26, 2012 5:28 pm

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by Skuggasveinn »

- Earthquake-ish sound, i will find a suitable sound for this as the current earthquake sound lasts forever
you can just redefine the current one with no loop

Code: Select all

defineSound{
       name = "earthquakenoloop",
       filename = "assets/samples/env/earthquake_01.wav",
       loop = false,
       volume = 1,
       minDistance = 1,
       maxDistance = 6,
    }
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
User avatar
Kuningas
Posts: 268
Joined: Wed Apr 11, 2012 10:29 pm
Location: Northern Finland

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by Kuningas »

I can say I've done something like this manually and it was a pain. But it did work. I've not handled scripts like that before, but what you're planning seems sound to me.
BASILEUS
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by msyblade »

Killing the loop makes it end abruptly, I never found a workaround or new sound tho. How are you going to prevent the player and the boss from never getting separated by a room change? I'm sure thats part of your process, just wanna give you a heads up if it hasnt occured to you.(dont wanna haveta redo it 3 times after testing).I think it's a really neat idea tho!I would probably do it straight through the editor and skip the code.It's elaborate enough to hurt my head if i'm trying to map out that much without visual reference.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by Grimwold »

If you name the doors appropriately you could avoid writing the same code over again by creating a table of config names.. and set a variable to remember which the previous config was.

e.g.

Code: Select all

old_config = 1

function changeConfig()
  local configurations = {"sd_rm_cfg_1_", "sd_rm_cfg_2_", "sd_rm_cfg_3_"}
  repeat new_config = math.random(1,#configurations) until new_config ~= old_config

  for i=63,85 do
    local door_open = findEntity(configurations[new_config]..i)
    if door_open then
      door:open()  -- open all doors in new config
    end
    local door_close = findEntity(configurations[old_config]..i)
    if door_close then
      door:close()  -- close all doors in old config
    end
  end

  old_config = new_config
end
(note - this is untested code)

this selects a random config from the table, but you could run them in sequence by using

Code: Select all

new_config = old_config +1
if new_config > #configurations then
new_config = 1
Last edited by Grimwold on Fri Nov 02, 2012 1:13 am, edited 2 times in total.
User avatar
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by TheLastOrder »

Isn't better doing that (changes in a room with different configurations in it walls) through TIMERS that activates different combinations of secret doors???
For example: each 30 seconds one of the 5 configurations take place; you put five timers with the same time on it, initially stopped (each one with 30x5=150seconds but starting at different moments, by using different counters that activates --> starts timers; the 1st one at 30 seconds, the 2nd one at 60 secs, etc...) that toggles different combinations of doors.
Of course you can activate the sequence thanks to hidden pressure plates and you'll deactivate it as soon as the monster dies/the player reach a certain point in the map.

I've tried something similar in a room with eight different teleports configuration, and it works perfectly :D

So if it works for teleports (activate/deactivate), it will be fine for hidden doors (open/close).

There's a lot of work with timers but:
You'll avoid to use complex scripts...

Sorry for my english!! ;)
User avatar
HaunterV
Posts: 676
Joined: Mon Apr 16, 2012 9:54 pm
Location: Barrie, Ontario, Canada

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by HaunterV »

msyblade wrote:Killing the loop makes it end abruptly, I never found a workaround or new sound tho.
There are free sounds out there, there has to be at least one underground earthquake sound.
msyblade wrote:How are you going to prevent the player and the boss from never getting separated by a room change? I'm sure thats part of your process, just wanna give you a heads up if it hasnt occured to you.(dont wanna haveta redo it 3 times after testing).
I believe as I said or may have not said, I will open up the new areas before closing the old ones or freeze the player and monster for the time it takes to toggle the rooms.
msyblade wrote:I think it's a really neat idea tho!I would probably do it straight through the editor and skip the code.It's elaborate enough to hurt my head if i'm trying to map out that much without visual reference.

Graph paper my friend. That and making the 'rooms' off to the side then just moving them all at once into place if I decide to do it manually. thing is I need to toggle one set of walls and another set... its hard to see after abit with all them arrows everywhere.
Grimrock Community 'FrankenDungeon 2012. Submit your entry now!: http://tinyurl.com/cnupr7h
SUBMIT YOUR ASSETS! Community Asset Pack (C.A.P.): http://tinyurl.com/bqvykrp
Behold! The HeroQuest Revival!: http://tinyurl.com/cu52ksc
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by Ancylus »

I threw together the following script:

Code: Select all

function switchRoom(newRoom)
	local wallIds = {
		{6, 7, 10, 11, 14, 15, 29, 32},                -- walls of the 1st config
		{5, 8, 9, 12, 13, 16, 25, 28, 29, 32, 33, 36}, -- walls of the 2nd config
	}
	
	local doorName = "sd_rm_"
	
	for id = 1, 40 do
		local door = findEntity(doorName .. id)
		if door ~= nil then
			door:open()
		end
	end
	
	for i, id in pairs(wallIds[newRoom]) do
		local door = findEntity(doorName .. id)
		if door ~= nil then
			door:close()
		end
	end
end
Just place enough doors into the room to form the walls in all configurations and name them sd_rm_1, sd_rm_2 and so on. Then check which of the doors you want to have as walls in each configuration and put their numbers into the right table in wallIds.

As for making sure that the party and the boss don't get separated, all you need to do is check that they're both inside the bounds of the new configuration before making the switch. The doors will prevent passage as soon as they're ordered to close, so the player can't slip to the other side afterwards.
nichg
Posts: 48
Joined: Thu Oct 11, 2012 12:38 pm

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by nichg »

The way I'd do it for five configurations is I'd give each door a bitstring as part of its name, 1 for if the door is closed in that configuration and 0 if its open (or vice versa, whatever you like). Then I'd use a loop over all entities, use an if statement to restrict it to these particular secret doors, and then when I've found a door I'd use sup to grab the right part of its name for the current configuration and use that to figure out how to set its state.

That way you don't need to have some big mapping between door names, room configurations, and door states. All the information about whether the door is up or down is stored on the door itself.
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: Handling crazy amounts of secret doors(thoughts on the w

Post by SpiderFighter »

I've got a room in my mod (third area of the red zone) that does this 6 times, using pressure plates but, even though the room does change shape, the walls only close. Later on in the last area of the yellow zone, I have another room that starts off with all walls raised, then they lower, creating two different areas approachable by separate entrances (they raise again after the player has finished both areas). My One Room entry takes the last concept (4 entrances) and combines it with changing layouts, like you're describing (is this for the One Room? Lemme know, please, and I'll change my concept, since you're going before me).

It's definitely possible to do this all with plates, counters, and timers, but the most difficult aspect is clutter on the screen. When you have one plate with 25 lines radiating off it to different walls, it becomes extremely difficult to see the wall that you missed connecting to. Moreso, if you are using the same plate to close additional walls. Your best friend, as you've said, is graph paper. I'd recommend picking a direction (clockwise, counterclockwise) and sticking with that as you start connecting things. Regardless of whether you make the connections by hand or by scripting, though, keep your plates 3 squares away from any shifting walls or the player will be able to duck underneath them before they close (that is, two spaces between your plate and the wall).
Post Reply

Return to “Modding”