Page 1 of 1

Share Puzzle ideas

Posted: Sun Apr 07, 2013 11:14 am
by LocalFire
I thought I'd start a thread for sharing puzzle/room ideas for dungeons, since sometimes it can be hard to think of good puzzles for an extended dungeon

Let's start with this one:

Enter a room with the wall text "you must fight for what you desire" containing various altars'alcoves containing gear, a script using getItemCount to check if the items are removed, and a bunch of spawners.

So if gear is removed the spawners spawn a monster into the room that the party must fight, the quality of the item determines the power of the spawned monster, and the player must balance risk/reward; is the the item worth a tough fight?

I'd welcome any ideas you might have to improve this puzzle or any ideas for new ones

Re: Share Puzzle ideas

Posted: Sun Apr 07, 2013 1:34 pm
by AdrTru
Hi, easy way is :

Add script entity - ScriptGear with script about:

Code: Select all

function RemoveGear(self)
local item = getMouseItem()
  if item == nil then
    return false
  end
--  print(item.name)
  if item.name == "Gear_1" then              -- Gear_1 ... is name of item for spawning monster
    findEntity("spawner_1"):activate()       -- spawner_1 .. is name(ID) your spawner entity
  elseif  item.name == "Gear_2" then
    findEntity("spawner_2"):activate()
                                                            -- and some next elseif stagements
  end
end
make Alcoves and conectors on your Alcoves -> deactivate : ScriptGear : RemoveGear
make Spawner entities and set them for type of monster by your choice.

When you will make Alcones special for this puzzle, Set them for wo way to put some item in :) :
e.g.
defineObject{
name = "alcove_Gear1",
class = "Alcove",
model = "mod_assets/models/null.fbx", -- there you must write correct model of alcove
replacesWall = false,
anchorPos = vec(0, 1, -0.1),
anchorRotation = vec(0, 0, 0),
targetPos = vec(0, 5, 0),
targetSize = vec(1, 1, 1),
placement = "wall",
editorIcon = 84,
}

or e.g.
cloneObject{
name = "dungeon_alcove_gear",
baseObject = "dungeon_alcove",
targetPos = vec(0, 5, 0),
}

( targetPos is away, is not possible to get item in alcove and make respawn monster ) 8-)

Re: Share Puzzle ideas

Posted: Sun Apr 07, 2013 4:50 pm
by AdrTru
For better function of alcoves is suitible next scripts:

For new alcove use this definition (e.g.):

Code: Select all

cloneObject{
	name = "dungeon_alcove_gear",
	baseObject = "dungeon_alcove",
  onInsertItem = function(self, item)
    return ScriptGear.InsertGear(self, item)
  end,
}
And in script entity ScriptGear put next code:

Code: Select all

function InsertGear(self, item)
local i,j,ent,k
local Alcoves={"dungeon_alcove_gear_1","alcove_Gear1_1"} -- table of Alcove.id for prevent insert gear utems
local Gears={"Gear1","Gear2","Gear3"}                    -- table of Gear.name for preventing to insert

-- Edit: this code disabled insert items when in alcove is Gear item
  if (self:getItemCount() > 0) then
    for ent in self:containedItems() do
      for i = 1,#Gears do
        if ent.name == Gears[i] then
          return false
        end
      end
    end
  end

-- Code for comparing item with alcove for disable inset Gears
  k=false
  i=1
  while (i <= #Gears) and (k == false) do
    if item.name == Gears[i] then
      k = true
      for j = 1, #Alcoves do
        if self.id == Alcoves[j] then
          return false
        end
      end
    end 
    i = i+1
  end

  return true
end   
This script dissable insert Gear object to specify Alcoves, but another items isnt touched (When Gear isnt in alcove).

Re: Share Puzzle ideas

Posted: Mon Apr 08, 2013 12:59 am
by LocalFire
Very nice!