See I was trying to save my brain by just drawing all the patterns with doors and saying "screw that" to making note of the different configurations I wanted.. i ended up redrawing the whole room a couple times until I finally understood what was wrong. (Thanks to Edsploration for clearing it up over a convo).Xanathar wrote:This was posted on the OneRoom challenge thread. Copying here as it's relevant to this discussion.
I don't know if I have understood the problem properly, so I resume what I understand of it first:
If this is the case you probably can do as following.
- You want to do a maze-kind-of-thing where you have secret doors all around
- Some kind of activator (plates, levers, etc) do change the secret doors to a number of configurations
1) Define a table of tables for configurations:3) find some way (whatever you want) to call activatePattern("config1") etc. etc.SpoilerShowCode: Select all
DOORSPATTERNS = { ["config1"] = { "secret_door_1", "secret_door_5", "secret_door_7" }, ["config2"] = { "secret_door_11", "secret_door_25", "secret_door_37" }, ["config4"] = { "secret_door_2", "secret_door_5", "secret_door_7" }, } ALLDOORS = { "secret_door_1", "secret_door_5", "secret_door_7", ....... etc etc etc }
2) Have an activate configuration method:
Code: Select all
function activatePattern(patternName) for _, doorName in ipairs(ALLDOORS) do local door = findEntity(doorName) door:close() end for _, doorName in ipairs(DOORSPATTERNS[patternName]) do local door = findEntity(doorName) door:open() end end
Notes:
- There is no need to stay all-lower-case inside a scripting entity. Use whatever makes the code clearer (I usually stay with the convention that read-only values are all-upper-case).
- The code above is NOT TESTED.
- Never put objects inside table, always put the id of the objects - otherwise GrimRock crashes when saving.
- Always test the code in the game at regular intervals in time (say, once a day), including saving and reloading.
--
Edited for various fixes.
Now that being said the way i wanted it and the way it is now, the over all feel has shifted from a Jackie Chan Adventures-esque fight scene to more of a minotaur in the maze claustrophobic feel. I originally intended for the room patterns to be more open with more room to move around while groups of 1-3 hit-to-kill baddies appear around you in puffs of dust and try to take you down while the big bad chases you down. Now it's more "oh crap oh crap dead end he's coming! Please change, please change for the better." I have since scrapped the 1 shot baddies as they will probably get you killed.
I will go back at a later date, possibly for my CFD submission with the original idea fully intact.
for now I'm ok with what I have produced, I just have to put in the on monster.die=open all doors script and it's finished. I'm just having a problem getting just a button to open and close all the doors as a bit of a debug check.