Assets and introduction to scripting and scripting ref ETA ?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Assets and introduction to scripting and scripting ref ETA ?

Post by cromcrom »

Hello there. Any ETA of the assets download and Introduction to Scripting (with list of Scripting references ) ? Just, erm, you know, I am on holydays next week, and I will have plenty of time to code (that is, if I don't go hiking. Anyways...).
A trip of a thousand leagues starts with a step.
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Assets and introduction to scripting and scripting ref E

Post by Mysterious »

Sorry Crom Crom no luck on that yet but I hope it happens soon, god I need them bad lol.
User avatar
Chimera005ao
Posts: 187
Joined: Sun Jun 29, 2014 8:34 am

Re: Assets and introduction to scripting and scripting ref E

Post by Chimera005ao »

Quite a few of us are waiting. There is much fun to be had.
A trip of a thousand leagues starts with a step.
And ends with Johny dying of dysentery somewhere around Chimney Rock.
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Assets and introduction to scripting and scripting ref E

Post by NutJob »

I agree with this thread. Actually I'm willing to pay to have the documentation at this point. Thank you ADHD for making me want to spend all my money.
User avatar
Jhaelen
Posts: 74
Joined: Fri Oct 19, 2012 10:49 am
Location: Paris, France

Re: Assets and introduction to scripting and scripting ref E

Post by Jhaelen »

NutJob wrote:I agree with this thread. Actually I'm willing to pay to have the documentation at this point. Thank you ADHD for making me want to spend all my money.
I cannot say anything else than "ME TOO" ! The cool thing is that during the waiting I can put on a (numeric) sheet of paper all my futur mod stories and quests.
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Assets and introduction to scripting and scripting ref E

Post by NutJob »

Anyone with a little background on creating custom assets in LoG1 help me with this?

Objective: close a door slower so it doesn't slam shut

So far added this to my objects.lua

Code: Select all

defineObject {
	name = "door_of_closing",
	baseObject = "dungeon_door_portcullis",
	components = {
		class = "door",
		closeVelocity = -0.5,
		closeAcceleration = -50,
	}
}
Reloaded my Project. Woot! It's there.

Added this to a script

Code: Select all

spawn("door_of_closing", 1, 26, 29, 1, 5, "doc1")
doc1.door:setDoorState("open")
floor_trigger_1.floortrigger:addConnector("onActivate", "doc1", "close")
Walked over floor trigger. Works... almost. Door still shuts at the same acceleration and velocity as normal so I think I made my definition completely wrong.

I know one of the dev's gave us a "sample" of the structure (in General Discussion) but I can not, for the life of me, find it again.
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Assets and introduction to scripting and scripting ref E

Post by JohnWordsworth »

I'm afraid I do not have a solution with regards to which keywords to use exactly, but I have spotted on syntax error in your definition which means that the door component is likely not being defined correctly. The "components" property should refer to a list of components (each of which is it's own table), so there should be some extra curly braces in there.

Code: Select all

defineObject {
   name = "door_of_closing",
   baseObject = "dungeon_door_portcullis",
   components = {
     {  
       class = "Door",
       closeVelocity = -0.5,
       closeAcceleration = -50,
     }  
   }
}
Notice the extra set of braces around the component definition. I also expect that "Door" should be capitalised (also changed above). Beyond that, there's no definite way of knowing what you need to put for the open/close velocity - but it's possible the above may work!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Assets and introduction to scripting and scripting ref E

Post by NutJob »

Your example got me back on track and I'm now getting the results I want by removing closeVelocity/Acceleration.

Code: Select all

defineObject {
	name = "door_of_closing",
	baseObject = "dungeon_door_portcullis",
	components = {
		{
			class = "Door"
		}
	}
}
Works exactly how I want; door closes slowly. Now the question is how to speed it up for future Projects. I'm guessing we're waiting to know this kind of information from the LoG2 asset_pack.zip? (unsure what we're waiting for to gain access ~laughs~)
NutJob
Posts: 426
Joined: Sun Oct 19, 2014 6:35 pm

Re: Assets and introduction to scripting and scripting ref E

Post by NutJob »

I have no idea what the range for these method calls are but I got this working.

Code: Select all

spawn("door_of_closing", 1, 26, 29, 0, 5, "doc1")
doc1.door:setDoorState("open")
doc1.door:setCloseVelocity(-2.4)
doc1.door:setCloseAcceleration(-0.7)
floor_trigger_1.floortrigger:addConnector("onActivate", "doc1", "close")
Velocity: -0.1 (slowest) to -100 (fastest). No idea what the actual range is but going lower (faster) than -100 I seen no difference.


--
Edit: the best my perception allows, this...

Code: Select all

doc1.door:setCloseVelocity(-2.9)
doc1.door:setCloseAcceleration(-2.1)
... seems to be about default closing speed.
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: Assets and introduction to scripting and scripting ref E

Post by cromcrom »

May I suggest you guys open a dedicated thread about this door issue, as it might interest other modders, that might not think about looking into this tread :-)
A trip of a thousand leagues starts with a step.
Post Reply