Page 2 of 4

Re: Requestion some specific helpful tips

Posted: Sat Mar 23, 2013 6:56 pm
by Ryeath_Greystalk
Aleitheo wrote:Thanks a lot Ryeath, I tried it out in a test dungeon and it works nicely.

Since the dungeon I am building is going to have a lot of moving walls triggered by various events, is there a limit I should know of for the amount of custom monsters I can put in?

EDIT: Okay, for some reason when I tried doing the same thing in my main dungeon the new monster wasn't showing up. I thought it was because I was using words that were too long or something for the monster name but even when I copied the snail script which I knew worked and opened up the dungeon after saving, it didn't show up.
Every unique dungeon you make will have it's own Mod_Assets file. If you put the cloneObjects in a test dungeon, then it won't show up in yopur main dungeon. You will need to add the objects there also.

Re: Requestion some specific helpful tips

Posted: Mon Mar 25, 2013 10:05 pm
by Aleitheo
I found the problem. While I had been putting the text into the correct monsters.lua I was trying to think of what was different and the only thing I could think of were the mods I added to the main dungeon. So I checked the init.lua and for some reason the typical sounds/monsters/ect. filepaths weren't there. I don't recall deleting any lines at all, merely adding them as I was adding the mods.

So I copied the appropriate lines from the test dungeon's init.lua into the main one and now it is working.

Re: Requesting some specific helpful tips

Posted: Mon Mar 25, 2013 11:50 pm
by Aleitheo
Well I've current;y gotten a new puzzle that requires a script that is different from the one found in the modding tutorials. It requires you to put one of two certain items (legionary items in this case) on an alcove in order to open up two or more secret doors. What changes would I need to make to the script found here; http://www.grimrock.net/modding/how-to- ... ve-puzzle/

Re: Requestion some specific helpful tips

Posted: Tue Mar 26, 2013 6:35 am
by akroma222
Aleitheo wrote:Thanks a lot Ryeath, I tried it out in a test dungeon and it works nicely.

Since the dungeon I am building is going to have a lot of moving walls triggered by various events, is there a limit I should know of for the amount of custom monsters I can put in?

EDIT: Okay, for some reason when I tried doing the same thing in my main dungeon the new monster wasn't showing up. I thought it was because I was using words that were too long or something for the monster name but even when I copied the snail script which I knew worked and opened up the dungeon after saving, it didn't show up.
Hey Aleitheo,
as far as I know there is not any limit to the number of custom monsters you can have in your dungeon mod. I may well be wrong (someone correct me if I am) but I am pretty sure I have got almost all of the custom monsters the community has shared together so far and I have had no problems.

Also, if you have going to have lots of moving walls triggered by things, here is a script that may be useful for you. It is just a simpler way of opening or closing a lot of walls/doors at the same time.
SpoilerShow

Code: Select all

function activate()
	for i=55,126 do
		local door = findEntity("high_temple_door_portcullis_"..i)
		if door then
			door:open()
		end
	end
end
so I have a pressure plate that is connected to a script entity (no name necessary) with that code in it. In the puzzle room there is a lot of "high_temple_door_portcullis" (high_temple_door_portcullis_55 through to high_temple_door_portcullis_126) that I need to reset to an open state.Instead of having to connect the pressure plate to each of those portcullis... just connect the plate to the script. Hope this can help you out!

Also, welcome! There is a lot of helpful things to read in the forum, best of luck to you :D

Re: Requesting some specific helpful tips

Posted: Tue Mar 26, 2013 7:16 am
by Ryeath_Greystalk
Hi Aleitheo,

Code: Select all

function itemPuzzle()
   -- iterate through all contained items on alcove, checking for a matching name
   for i in itemPuzzleAlcove:containedItems() do
      if i.name == "pitroot_bread" then
         playSound("level_up")
         break
      end
   end
end

What this code does is check every item in an alcove (or altar) and if the name matches then it plays a level up sound.

to adapt it to what you are doing change the following

Code: Select all


  -- iterate through all contained items on alcove, checking for a matching name

function itemPuzzle()                                                 <you can rename your function if you want i.e. checkMyAltar() or legioneersOnly() etc>
   for i in itemPuzzleAlcove:containedItems() do         <name of your altar or alcove i.e legioneersAltar or secretDoorAltar etc.>
      if i.name == "pitroot_bread" then                         < change name to item you want i.e.  if i.name == "legionary_spear" then>
         playSound("level_up")                                       <change to the effect you want i.e. superSecretSpyDoor:open()
         break
      end
   end
end

That will check all items in the altar and if one matches proceeds to do something. If you want there to be more than one option you will need to use an 'or' statement or an 'else' statement.
An 'or" statement is probably the prefered, but I like to use the 'else' statement because I am a simpleton.

So I would probably go

Code: Select all

 
 -- iterate through all contained items on alcove, checking for a matching name (I like to put my descriptions before the function)

function openSecretDoors()
   for i in LegioneersAltar:containedItems() do
      if i.name == "legionary_spear" then
         superSecretDoorOne:open()
         superSecretDoorTwo:open()
         break
     elseif i.name == "legionary_shield" then
        superSecretDoorOne:open()
         superSecretDoorTwo:open()
         break 
      end
   end
end

or a real programmer would probably go

Code: Select all


 -- iterate through all contained items on alcove, checking for a matching name (I like to put my descriptions before the function)

function openSecretDoors()
   for i in LegioneersAltar:containedItems() do
      if i.name == "legionary_spear"  or i.name == "legionary_shield" then
         superSecretDoorOne:open()
         superSecretDoorTwo:open()
        break
     end
   end
end
I always get the syntax mixed up on the 'or' statement so I ted to use the 'else'.

A few things to keep in mind.
What is calling the script. This script only checks for an item, it doesn't care if there are 20 other items in the altar. The point being if the altar is calling the script on activate and there is already something there it won't ever call the script unless you set the altar to active always. If you want the legionary item to be the only thing in the altar, then you can leave the altar as it comes normally and the only way it will call it is if the altar is empty when someone puts something in it, or you can check the number of items and if it is more than one then do not run the script.

Hopefully this will get you going. Note:none of these scripts listed above have been tested, but should work.

Re: Requesting some specific helpful tips

Posted: Wed Mar 27, 2013 1:00 am
by Aleitheo
@ akroma222 - Thanks for the script, it will likely come in useful at some point. Right now however I have only had 5 instances of moving walls. Two of my most recent ones includes a wall that opens up after 10 seconds of standing on the hidden pressure plate that also has a note on it (the player will pick up the note, begin reading it and after a few seconds the wall in front of them begins to open). The other instance is a room which continues to expand after the player enters it with the first set of walls rising after about 5 seconds revealing a new enemy and this repeating a few times with the room getting larger and more dangerous as time goes by.

Though for some reason I am not sure of, since I've added a second instance of door triggering enemies (the kind that trigger a door to open on death), the first ones I tried no longer seem to work.

Code: Select all

-- This file has been generated by Dungeon Editor 1.3.7

-- TODO: place your custom monster definitions here
cloneObject{
   name = "LvlOneCellSkeletonPatrol",
   baseObject = "skeleton_patrol",
   onDie = function(self)
      LvlOneCellCounter:decrement()
      end,
}

cloneObject{
   name = "LvlOneTriangleSnail",
   baseObject = "snail",
   onDie = function(self)
      LvlOneTriangleCounter:decrement()
      end,
}
This is the monsters.lua as it is right now. The first example I have of the skeleton patrol was what I was trying to get working in the first place which then later did. The second one is a series of 6 enemies I added later on. When I did a quick test run through the dungeon the skeleton patrol was no longer triggering the walls to move on death yet the snails were triggering their own. Have I gotten the spacing wrong between these cloned enemies in the code or something?

@ Ryeath - I used the last script and it worked brilliantly.

I expect to be about 75% of the way through this particular floor, when I'm done I hope to upload it for testing and criticism. I admit the overall dungeon is a bit ambitious to begin with (8 planned floors following certain themes and a backstory) but I thought I would just dive in and learn from experience.

Re: Requesting some specific helpful tips

Posted: Wed Mar 27, 2013 3:03 am
by Ryeath_Greystalk
Aleitheo,

Everything looks fine in your cloneObjects(). I put one empty line between my clones also so it should work.

A couple things to try.
1) if you change the name of a function sometimes the connection won't work. You may need to go back reconnect your scripts.
2) when all else fails, try reloading the level.

Re: Requesting some specific helpful tips

Posted: Wed Mar 27, 2013 4:54 am
by akroma222
Aleitheo wrote:@ akroma222 - ......... The other instance is a room which continues to expand after the player enters it with the first set of walls rising after about 5 seconds revealing a new enemy and this repeating a few times with the room getting larger and more dangerous as time goes by.
Haha! Yes I have a very similar set up as a boss in one of the later levels of my mod ;)

>> And yes, your clone objects look fine... As greystalk said, I would double check your connections / counter id's and functions... it can sometimes be easy to mess up a puzzle or something because you have renamed something and a connection is cut off.... hard to say without seeing the rest of your set up in-game...

with your clone objects though, remember that if you clone/define something... and then 'underneath' it or further down the page you clone/define something with the same name... the editor will take the last entry (with the same name) as the final version... I have been tripped up by this sometimes...

Re: Requesting some specific helpful tips

Posted: Thu Mar 28, 2013 8:48 pm
by Aleitheo
I've double checked and the script is named what is should be and hooked up to the right doors as well.

Basically I have a small one tile cell with an item inside it, the player opens the gate(LvlOneCellPort) to the cell via a key (activate, open). when they enter the cell to take the item the gate closes and the opposite wall opens up, both triggered by a hidden pressure plate (wall=activate/open, gate=activate/close, activates once)

In the small room that opens up the player then must defeat a Skeleton Patrol (LvlOneCellSkeletonPatrol) which is supposed to trigger a counter (LvlOneCellCounter initial value=1). This counter is linked up to the gate (LvlOneCellPort activate,open) to open it back up again so the player can leave and a hidden door in this room (LvlOneCellSecret) so the player can continue along this path.

Everything up until the part where the death of the skeleton patrol is supposed to open both the gate and the hidden door does not work. This I do not understand.

Re: Requesting some specific helpful tips

Posted: Thu Mar 28, 2013 9:22 pm
by alois
Aleitheo wrote:Everything up until the part where the death of the skeleton patrol is supposed to open both the gate and the hidden door does not work. This I do not understand.
If you want, you may change the onDie routine for the skeleton to

Code: Select all

cloneObject{
   name = "LvlOneCellSkeletonPatrol",
   baseObject = "skeleton_patrol",
   onDie = function(self)
      LvlOneCellPort:open()
      LvlOneCellSecret:open()
      end,
}
Here I'm assuming that "LvlOneCellPort" and "LvlOneCellSecret" are the ids of the two doors you want to open.

alois :)