Page 1 of 2

Date/Time script help and dungeon testing

Posted: Sun Nov 13, 2016 6:02 am
by Killcannon
Hey guys, it's been a while from me; finally picked up Grimrock 2 and have been working with it to update my Grimrock 1 dungeon. I got two things I could really use some help with.

The first thing is help with a script. I essentially am working on a script that will create a 'time' system inside Grimrock. The premise is pretty simple when the hero's move one tile it increments time forward x minutes (script has it move forward 1 but the integer could be set to anything). What I need help with is some of the coding to get the month and weekday down and how to call the various elements to display in game when called. This is just a fun thing I though about doing and wanted to see if possible to do. Here's the code as I have it so far; I've not really been able to test it either and I'm sure there's tons of errors, but that's why I'm here. :D

Code: Select all

function clocktime

-- minutes = m
-- 24 Hour = h
-- 12 Hour = t
-- Days = d
-- Weekday = w
-- Month = n
-- Monthday = x
-- counter = i

weekday = {{"Monday", 1},{"Tuesday", 2},{"Wednesday", 3},{"Thursday", 4},{"Friday", 5},{"Saturday", 6},{"Sunday", 7}}
month = {{"January", 1},{"february", 2},{"March", 3},{"April", 4},{"May", 5},{"June", 6},{"July", 7},{"August", 8},{"September", 9},{"October", 10},{"November", 11},{"December", 12}}
endmonth = {{"January", 31},{"february", 28},{"March", 31},{"April", 30},{"May", 31},{"June", 30},{"July", 31},{"August", 31},{"September", 30},{"October", 31},{"November", 30},{"December", 31}}

"w, n d t:m"

for i = 1, do
	m = m + i
		if m > 60 then
			m - 60
			h + 1
		andif h > 24 then
			h - 24
			d + 1
		else
			return nil
		end
	end
	if h > 12 then
		t = h - 12
	else
		t = h
	end
	n = month
	if d > endmonth then
		n + 1
	andif n > 12
		n - 12
	else
		return nil
	end
end
The second bit is I've gotten a lot of stuff done inside the dungeon. Done a lot of personal internal testing and made sure that everything is functioning well as designed. Before I delve further I'd like some outside hands to test the mechanics of the traps, bosses, and content as is and provide feedback. I've built this in a 'Call of Cthuhlu' type theme. Where the party is essentially ill equipped to stand toe to toe against the encounters and must think of indirect ways to topple monsters. Things to point out, there's no story elements in the current version and I've not put the solutions to the puzzles in their hidden places either. I'm looking for blind difficulty to resolve the fights and puzzles as they are presented. Any party of any level could technically be used for this, but higher party levels can potentially brute force their way through.

Google Drive link 620 MB:
https://drive.google.com/file/d/0ByvKIU ... sp=sharing

Re: Date/Time script help and dungeon testing

Posted: Sun Nov 13, 2016 6:13 am
by Isaac
Would you please post the dat file size; for those on capped bandwidth. 8-)

Re: Date/Time script help and dungeon testing

Posted: Sun Nov 13, 2016 6:23 am
by Killcannon
Done it's 620 MB and egad; I'd not realized it was that big. I guess I've used a lot more custom assets than I'd realized.

Re: Date/Time script help and dungeon testing

Posted: Sun Nov 13, 2016 11:05 am
by kelly1111
620 mb dat file ? and you had no problems with exporting it do a .dat ?

How many custom (which) did you use?

And I cannot get down the first stairs.. it is leading to nowhere :) So I am stuck

Re: Date/Time script help and dungeon testing

Posted: Sun Nov 13, 2016 6:43 pm
by Killcannon
Whoops that was my bad; I'd been testing something in that room and altered the start location. Then forgot to put it back to where it should be when I'd saved it.

Fixed now, and updated link in original post.

Assets Used:
Northern Dungeon
Dark Elf Temple
Dark Temple
Germmany's ODS set
Golden Statues
Personal LoG 1 converted models and textures.
LoG 1 Monsters
Probably some others I've forgotten.

Speaking of assets, I am having problems getting the double eye socket demon head (forget the name) it's not detecting a second gem being placed in it or triggering anything.

Re: Date/Time script help and dungeon testing

Posted: Mon Nov 14, 2016 12:33 pm
by Duncan1246
Killcannon wrote:
Speaking of assets, I am having problems getting the double eye socket demon head (forget the name) it's not detecting a second gem being placed in it or triggering anything.
Hi, Killcannon,
I have had the same issue in my mod, I do this, and it works:
SpoilerShow

Code: Select all

defineObject{
       name = "dc_daemon_eye_left",
       components = {
          {
             class = "Clickable",
	      name = "lefteye",	
             offset = vec(0.25, 1.65, -0.3, 0),
             size = vec(0.2, 0.2, 0.05, 0),
             },
          {
             class = "Socket",
	     name ="leftslot",
             offset = vec(0.26, 1.58, -0.3),
             },
         },
       placement = "wall",
       editorIcon = 92,
	tags={"dc"}
  }


defineObject{
       name = "dc_daemon_eye_right",
       components = {
	  {
             class = "Clickable",
	      name = "righteye",
             offset = vec(-0.25, 1.65, -0.3, 0),
             size = vec(0.2, 0.2, 0.05, 0),
	      onAcceptItem = function(self, item)
                return (item.go.name == "blue_gem_item" or item.go.name == "dc_yellow_gem_item") and self:count() == 0
                end,
             },
          {
             class = "Socket",
	     name ="rightslot",
             offset = vec(-0.26, 1.58, -0.3),
             },
          },
       placement = "wall",
       editorIcon = 92,
	tags={"dc"}
  }


Re: Date/Time script help and dungeon testing

Posted: Mon Nov 14, 2016 6:16 pm
by Sutekh

Re: Date/Time script help and dungeon testing

Posted: Mon Nov 14, 2016 10:26 pm
by Duncan1246
I do apologize, Sutekh, I should have attributed my source but I have forgotten this thread.... :?
Duncan

Re: Date/Time script help and dungeon testing

Posted: Mon Nov 14, 2016 10:37 pm
by Sutekh
No need to apologize, Duncan, I just thought I'd try and help a bit too. I'm not sure which daemon head / eye sockets Killcannon is trying to use, so hopefully this will cover it.

Re: Date/Time script help and dungeon testing

Posted: Tue Nov 15, 2016 7:16 am
by Killcannon
Thanks Sutekh and Duncan; that helps millions! Exactly what I needed! The double socket one I had was from the Dark Elf Temple set. (dark_elf_temple_daemon_head_eye_slots) It's basically the LoG2 daemon head with a lot of extra script written into it, most of it wasn't working for me though. ~shrug~ This solves that problem for me so I can move on and plan even more disastrous deeds.

Editing this post since it's the last instead of creating a new one.

I'm having a problem converting this code from LoG1 to LoG2. I'm getting an "attempt to call method 'containedItems' (a nil value) X' error when running the script. I am guessing that this is different syntax in LoG2 to do what I want.

Code: Select all

function doorcombo(entity, item)
	for i in entity:containedItems() do
		if i.name == item then
			return true
		end
	end
-- if we get here the item was not found
		return false
end

-- function actually used to check all the alcoves
function doorcheck()
	if doorcombo(frost_hook_alcove_1, "frost_blade") and
		doorcombo(fire_hook_alcove_1, "fire_blade") and
		doorcombo(lightning_hook_alcove_1, "lightning_blade") then
			wardenapt:open()
		else
			wardenapt:close()
	end
end
What I want to happen is this: I have 3 'alcoves' each that requires a specific item to be inside the alcove. That's not an issue as I've made it so only that item can be put in that with the object. So what I'm trying to do is have this script check to make sure that the 3 items are in the alcoves and open the door; but then also close the door if the item is removed.

As a second question, is there a way to only have a single item be able to damage a boss. For example setting that a monster can only be damaged by a vorpal blade?

-------

Adding a third thing to this list that I've ran into. How do I fix the clipping here? It seems that the heightmap absolutely hates itself and simply won't allow you to use flat ground tiles to cover up elevation changes you don't want but need to create cliff edges. I've spent a good 5 hours so far fiddling with it and completely out of ideas except for keeping the heightmap at the lower elevation and creating a 'fake' level above it then hiding the clipping elsewhere on the level where the characters cannot get behind.

Image

------

Any way to shorten this a bit? The script works how I want it but it's a little long.

Code: Select all

function blinkteleportal()
	for i = 1, 76 do
		local teleportspawner = findEntity("fwtele_" .. i)
		teleportspawner.controller:deactivate()
	end
	
	local teleporternumber = math.random(1, 5)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
	local teleporternumber = math.random(6, 10)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
	local teleporternumber = math.random(11, 15)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
	local teleporternumber = math.random(16, 20)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
	local teleporternumber = math.random(21, 25)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
	local teleporternumber = math.random(26, 30)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
	local teleporternumber = math.random(31, 35)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(36, 40)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(41, 45)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(46, 50)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(51, 55)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(56, 60)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(61, 65)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(66, 70)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
	
		local teleporternumber = math.random(71, 76)
		local teleportspawner = findEntity("fwtele_" .. teleporternumber)
	
	teleportspawner.controller:activate()
end