Grimwold's Grimrock Puzzle Frameworks

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Komag
Posts: 3640
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Komag » Sun Jan 06, 2013 2:43 pm

If you want to simply recreate the level 1 puzzle, all you need is a counter, and link each eye socket to the counter with both activate -> decrement and deactivate -> increment. Set the counter to 2 and link to open the door upon activation.

(you need the statue for looks, and the two invisible sockets for the actual usage)
Finished Dungeons - complete mods to play

Moutrave
Posts: 18
Joined: Fri Nov 16, 2012 5:38 pm
Location: Montreal

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Moutrave » Sun Jan 06, 2013 7:43 pm

Wowo Grimwold thanks a lot ! I'll deinitely be using your code in my dungeon...LUA and other text based scipting systems have always scared me a bit :D I guess it's the inconvenient on only working with visual scripts :(. Anyways, your help is much appreciated by those who easily get confused when trying to write code :) hopefully I won't be asking as many dumb questions about scripting in the future (but I wouldn't count on that...:))

(but beware that people will come at you now for all kinds of scripting questions :p)

Cheers !
!

User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Grimwold » Sun Jan 06, 2013 11:55 pm

Moutrave wrote:Wowo Grimwold thanks a lot ! I'll deinitely be using your code in my dungeon...LUA and other text based scipting systems have always scared me a bit :D I guess it's the inconvenient on only working with visual scripts :(. Anyways, your help is much appreciated by those who easily get confused when trying to write code :) hopefully I won't be asking as many dumb questions about scripting in the future (but I wouldn't count on that...:))

(but beware that people will come at you now for all kinds of scripting questions :p)

Cheers !
Thanks Moutrave... I am aware that people will ask me for help.. and for my part I have tried to help as many people as possible on the forums with their scripting questions.

The420Lizard wrote:Hi Grimwold,
I see you are quite gifted in scripting. I have a problem trying to script a daemon_head_eye_slots to open door puzzle, but I am failing . Could you maybe show me a script I can use to do that?
As Komag says, you don't need to use any scripting, as a counter will suffice..

There is also a thread here: viewtopic.php?f=14&t=4752
that mentions new eye socket types, say if you want to activate using red gems..

The420Lizard
Posts: 2
Joined: Sun Jan 06, 2013 9:30 am

Re: Grimwold's Grimrock Puzzle Frameworks

Post by The420Lizard » Fri Jan 11, 2013 2:12 am

Komag wrote:If you want to simply recreate the level 1 puzzle, all you need is a counter, and link each eye socket to the counter with both activate -> decrement and deactivate -> increment. Set the counter to 2 and link to open the door upon activation.

(you need the statue for looks, and the two invisible sockets for the actual usage)
I'm not looking to recreate something already in existence. I want to create something new, as I hope anyone in creative mode would.
I wish to specify commands to tell the door to open only if the left eye holds a green gem and the right eye holds a blue gem, and in a later puzzle to have a mouth + eyes with same script to open a secret door. please help or I'll never finish this dungeon. I want it to be awesome!

User avatar
Komag
Posts: 3640
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Komag » Fri Jan 11, 2013 2:30 am

well Grimwold's link will help, you'll want to define some new sockets for the colors you want, then set up the counter with the links
Finished Dungeons - complete mods to play

Iiyq
Posts: 2
Joined: Tue Jun 11, 2013 3:29 am

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Iiyq » Tue Jun 11, 2013 5:29 am

Just signed up to say thanks for all the work with the scripts.

User avatar
Eightball
Posts: 48
Joined: Thu Jan 09, 2014 8:21 am

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Eightball » Wed Feb 05, 2014 3:18 am

Has anyone ever tried to recreate the staring contest puzzle? The one where the party must stand on a plate, face a daemon (or particular direction), and wait without changing party facing before a door opens...

I'm trying but flying blind in some points.

Here's what I have:
a plate (which activates a timer)
a timer set to one sec (which connects to a script that checks party facing): connectors to itself (deactivate), the checkfacing script, and the counter (decrement)
a counter (which is set to ten -- or however long you want the party to wait, in seconds -- and is decremented by the timer. if the checkfacing script reveals the party's facing is incorrect, the counter resets)
and doors which open when the counter hits zero.

Here's the script so far:
SpoilerShow

Code: Select all

function checkStare()
   local facing = tonumber(string.sub(self.id,string.len(self.id))) -- replace with 0,1,2,3 if 'single shot'
   for ent in entitiesAt(self.level,self.x,self.y) do -- "self" refers to the triggerer of the script; i.e., the pressure plate
      if (ent.id == "party") then
         if (ent.facing == facing) then
            stareThere_timer:activate()
		else
			counter_4:reset()
         end
      end
	end
end
any ideas? I'm pretty sure I have the part about (ent.id == "party") wrong for one, but don't know for certain how to name the party.

alois
Posts: 103
Joined: Mon Feb 18, 2013 7:29 am

Re: Grimwold's Grimrock Puzzle Frameworks

Post by alois » Wed Feb 05, 2014 9:10 am

Eightball wrote:any ideas? I'm pretty sure I have the part about (ent.id == "party") wrong for one, but don't know for certain how to name the party.
There is no need of looking for the entity 'party'; it is enough to write "if (party.facing == facing) then"... :) [in the same way you can obtain party.x, party.y and party.level]

alois :)

User avatar
Isaac
Posts: 3089
Joined: Fri Mar 02, 2012 10:02 pm

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Isaac » Wed Feb 05, 2014 11:06 am

Staring should probably be checked in the onTurn party hook.

Try this out:
Make a brand new project. Save it, and add the following to its Object.lua:
SpoilerShow

Code: Select all

    cloneObject{
    name = "party",
    baseObject = "party",
    onTurn = function(self, direction)
    local dir = self.facing + direction
    if dir < 0 then dir = 3 elseif dir > 3 then dir = 0 end --Makes dir reflect the accurate Party Facing while in the hook.
    print(dir)
    local Name = timerDelay.timerName --Sets Tname to the name of your timer, as defined in the timerDelay script.
    local Tname = findEntity(Name) --Sets Tname as reference to the timer object; used throughout the rest of the code.
    if pressure_plate_hidden_1:isDown() and dir ~= 1 then --Triggers only if the party is on the plate but not looking at the door.
    if Tname ~=nil then --Checks just to make sure there IS an object by that name.
    Tname:destroy() --removes the old timer object.
    spawn('timer', 1,1,1,1, Name) --adds a new timer with connection.
    :setTimerInterval(10)
    :addConnector("activate","dungeon_door_metal_1","open")
    hudPrint("You turned away; the time to wait is reset!") --Player Information
    dungeon_door_metal_1:close()
    print('resetting the clock!')
    return
    end
    elseif pressure_plate_hidden_1:isDown() then hudPrint("Now look me in the eyes!") --Player Information
    if Tname then --Checks just to make sure there IS an object by that name.
    Tname:activate() --Starts the clock when you look at the Deamon Head.
    print('starting the clock!')
    else spawn('timer', 1,1,1,1, Name) --...or adds a new timer with connection.
    :setTimerInterval(10)
    :addConnector("activate","dungeon_door_metal_1","open")
    :activate()
    end
    end
    end
    }
Now erase the Dungeon.lua script and replace it with this one:
SpoilerShow

Code: Select all

-- This file has been generated by Dungeon Editor 1.3.7

--- level 1 ---

mapName("Unnamed")
setWallSet("dungeon")
playStream("assets/samples/music/dungeon_ambient.ogg")
mapDesc([[
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
##############...#...###########
##############.......###########
##############...#...###########
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
]])
spawn("torch_holder", 15,14,0, "torch_holder_1")
	:addTorch()
spawn("dungeon_pressure_plate", 16,15,3, "dungeon_pressure_plate_1")
	:setTriggeredByParty(true)
	:setTriggeredByMonster(true)
	:setTriggeredByItem(true)
spawn("altar", 19,15,3, "altar_1")
	:addItem(spawn("golden_orb"))
spawn("temple_ceiling_lamp", 19,15,1, "temple_ceiling_lamp_1")
spawn("dungeon_door_metal", 17,15,3, "dungeon_door_metal_1")
spawn("daemon_head", 20,15,1, "daemon_head_1")
spawn("pressure_plate_hidden", 16,15,3, "pressure_plate_hidden_1")
	:setTriggeredByParty(true)
	:setTriggeredByMonster(false)
	:setTriggeredByItem(false)
	:setSilent(true)
	:addConnector("activate", "timerDelay", "PlateDown")
	:addConnector("deactivate", "timerDelay", "PlateUp")
spawn("starting_location", 15,16,2, "starting_location")
spawn("dungeon_wall_text_long", 15,16,2, "dungeon_wall_text_long_1")
	:setWallText("Patience... \
Stand on the plate\
and look me in the eyes.\
In ten seconds the door will open.")
spawn("script_entity", 17,13,3, "timerDelay")
	:setSource("timerName = \"delayTimer\"\
    \
    function PlateDown()\
    \9if party.facing == 1 then\
    \9\9if not findEntity(timerName) then\
    \9\9 spawn('timer', 1,1,1,1, timerName) \9\9\9\9\9\9\9--adds a new timer with connection.\
    \9\9\9\9\9\9\9\9:setTimerInterval(10)\
    \9\9\9\9\9\9\9\9:addConnector(\"activate\",\"dungeon_door_metal_1\",\"open\")\
    \9\9\9\9\9\9\9\9:activate()\
    \9\9print(\"Plate is Down AND Party is facing the Door: \",\"starting the clock!\")\
    \9\9end\
    \9end\
    end\
    \
    function PlateUp()\
    \9if findEntity(timerName) ~= nil then findEntity(timerName):destroy() end\
    \9dungeon_door_metal_1:close() \
    \9print(\"Plate is Down: \",\"stopping the clock!\")\
    end\
    \
    ")
spawn("dungeon_ceiling_shaft", 19,15,2, "dungeon_ceiling_shaft_1")
spawn("dungeon_ivy_1", 14,16,2, "dungeon_ivy_1_1")
spawn("dungeon_ivy_1", 16,14,0, "dungeon_ivy_1_2")
spawn("dungeon_ivy_1", 18,14,3, "dungeon_ivy_1_3")
spawn("dungeon_ivy_1", 19,16,2, "dungeon_ivy_1_4")
spawn("dungeon_ivy_1", 20,14,1, "dungeon_ivy_1_5")
spawn("dungeon_ivy_2", 18,16,3, "dungeon_ivy_2_1")
spawn("dungeon_ivy_2", 16,16,2, "dungeon_ivy_2_2")
spawn("dungeon_ivy_2", 14,15,3, "dungeon_ivy_2_3")
spawn("lever", 17,15,0, "lever_1")
	:setLeverState("activated")
	:addConnector("any", "dungeon_door_metal_1", "toggle")
Reload the project and preview it.

User avatar
Komag
Posts: 3640
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Grimwold's Grimrock Puzzle Frameworks

Post by Komag » Wed Feb 05, 2014 1:34 pm

I recreated "all" the original puzzles when making my "Remake" project:
http://www.nexusmods.com/grimrock/mods/230/?
specifically, the source files:
http://www.nexusmods.com/grimrock/download/1000000148
it sounds like you have the idea basically the same
Finished Dungeons - complete mods to play

Post Reply