Editor Tutorials on YouTube - part 15 is out

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!
Post Reply
whackangel
Posts: 49
Joined: Wed Sep 26, 2012 3:50 pm

Re: Editor Tutorials on YouTube - part 9 is out

Post by whackangel »

Oh yeah I'm seconding that idea : a big fat nice juicy scripting tutorial !!
Last edited by whackangel on Thu Oct 30, 2014 10:43 am, edited 1 time in total.
User avatar
Vice Dellos
Posts: 47
Joined: Thu Feb 28, 2013 12:56 pm

Re: Editor Tutorials on YouTube - part 9 is out

Post by Vice Dellos »

Mysterious wrote:Hi. This a dumb question but how do I enter the Game Console like skuggs did?
in "documents\almost human\legend of grimrock 2" you can find grimrock.cfg with all your settings in it there is also the console key (where u can enable it in game and what key it is bound to}

i think 192 is "~" and 220 stands for "\" use whichever you want or something else entirely
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Editor Tutorials on YouTube - part 9 is out

Post by GoldenShadowGS »

I watched your videos and I saw the way you did the lever puzzle. I came up with a different way to do it that has lights that indicate the correct code: In my case there are 5 hidden levers in the dungeon(surface beach, an island actually). I have a corresponding torch light that is lit when each lever is pulled.

Each lever is connected to the LUA twice.
The first connector is to LUA1: When toggled, do function beachlevers1()
The second connector is to LUA1: When toggled do function lightn() ;replace n with the number that matches the lever

The end result is the door opens automatically when all the levers are in the correct position. In my case, I want them all to be activated, but you could change it to make a combination lock or something. I even made one of the switches start already activated with its corresponding light already lit. If you just flip all the levers once, it won't solve the puzzle.

Code: Select all

function beachlevers1()
	if beach_lever_1.lever:isActivated() and 
	beach_lever_2.lever:isActivated() and 
	beach_lever_3.lever:isActivated() and  
	beach_lever_4.lever:isActivated() and
	beach_lever_5.lever:isActivated() then
	beach_door_portcullis_3.door:open()
	else
	beach_door_portcullis_3.door:close()
	end
end

function light1()
	if beach_lever_1.lever:isActivated() then
	light01.light:enable()
	light01.particle:enable()
	else
	light01.light:disable()
	light01.particle:disable()	
	end
end

function light2()
	if beach_lever_2.lever:isActivated() then
	light02.light:enable()
	light02.particle:enable()
	else
	light02.light:disable()
	light02.particle:disable()	
	end
end

function light3()
	if beach_lever_3.lever:isActivated() then
	light03.light:enable()
	light03.particle:enable()
	else
	light03.light:disable()
	light03.particle:disable()	
	end
end

function light4()
	if beach_lever_4.lever:isActivated() then
	light04.light:enable()
	light04.particle:enable()
	else
	light04.light:disable()
	light04.particle:disable()	
	end
end

function light5()
	if beach_lever_5.lever:isActivated() then
	light05.light:enable()
	light05.particle:enable()
	else
	light05.light:disable()
	light05.particle:disable()	
	end
end
YpsiNine
Posts: 36
Joined: Wed Oct 10, 2012 1:08 am

Re: Editor Tutorials on YouTube - part 9 is out

Post by YpsiNine »

Hi Skuggasveinn,

Thanks for these videos. I have now officially started on my mod for LoG 2, I worked on one for LoG 1 but I never released it publicly.

I have a two questions for you though:

1) How did you create a shortcut directly to the editor, without having to fire up the game first?
2) How do you get that FPS and other info in the preview window?

Best
User avatar
Skuggasveinn
Posts: 562
Joined: Wed Sep 26, 2012 5:28 pm

Re: Editor Tutorials on YouTube - part 9 is out

Post by Skuggasveinn »

YpsiNine wrote: I have a two questions for you though:

1) How did you create a shortcut directly to the editor, without having to fire up the game first?
2) How do you get that FPS and other info in the preview window?
1. I didn't , it's just running minimized
2. In the file grimrock.cfg (under "documents\almost human\Legend of Grimrock 2") you can find Debug = False, change that to True

Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
whackangel
Posts: 49
Joined: Wed Sep 26, 2012 3:50 pm

Re: Editor Tutorials on YouTube - part 9 is out

Post by whackangel »

Hello, I have a question : I can't possibly understand why the "wall" items are not only coloured on only one of their 'faces' but that they also are 'collisionable' all the freaking time, even by monsters, even "in game"... why the ackwardness ? What can be done to avoid the effect ?
User avatar
TSotP
Posts: 74
Joined: Tue Oct 15, 2013 8:42 am

Re: Editor Tutorials on YouTube - part 9 is out

Post by TSotP »

whackangel wrote:Hello, I have a question : I can't possibly understand why the "wall" items are not only coloured on only one of their 'faces' but that they also are 'collisionable' all the freaking time, even by monsters, even "in game"... why the ackwardness ? What can be done to avoid the effect ?
I'm not expert at scripting (i have less than zero abillity), but one function i have found for them, is to create walls that can be walked through (like in Amiga Classic Knightmare), Saying that though, i don't know if a secret door can have it's collision turned off for the same effect.

Also, i don't know about anyone else, but my editor occasionally crashes when i try and place objects like pillars on the very edge of the game map. I think the crash might be caused because pillars (and secret doors... which is where my point is going) have a component that the game is trying to render outside the game world. These 'wall faces' don't have a second side, and so are not rendered outside the game world if placed at the edge of the world. That might be what they are for lol
User avatar
TSotP
Posts: 74
Joined: Tue Oct 15, 2013 8:42 am

Re: Editor Tutorials on YouTube - part 9 is out

Post by TSotP »

as i've mentioned the last few posts, i'm totally new to scripting, but i managed to convert the Night Fireflies script for use with morning fog using the cemetery_sky for anyone who is interested

Code: Select all

function NightFog()   -- enables Fog Particles during the night and early morning
   if GameMode.getTimeOfDay() > 1.4 and GameMode.getTimeOfDay() < 1.99 or GameMode.getTimeOfDay() > 0.00 and GameMode.getTimeOfDay() < 0.19 then
   cemetery_sky_1.fogparticles:enable()
   else   
   cemetery_sky_1.fogparticles:disable()
   end
end
I tested it out and it works, but for all i know there might be a cleaner way to do this script.
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Editor Tutorials on YouTube - part 9 is out

Post by Drakkan »

TSotP wrote:as i've mentioned the last few posts, i'm totally new to scripting, but i managed to convert the Night Fireflies script for use with morning fog using the cemetery_sky for anyone who is interested

Code: Select all

function NightFog()   -- enables Fog Particles during the night and early morning
   if GameMode.getTimeOfDay() > 1.4 and GameMode.getTimeOfDay() < 1.99 or GameMode.getTimeOfDay() > 0.00 and GameMode.getTimeOfDay() < 0.19 then
   cemetery_sky_1.fogparticles:enable()
   else   
   cemetery_sky_1.fogparticles:disable()
   end
end
I tested it out and it works, but for all i know there might be a cleaner way to do this script.
thanks, that quite helped me !
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
TSotP
Posts: 74
Joined: Tue Oct 15, 2013 8:42 am

Re: Editor Tutorials on YouTube - part 9 is out

Post by TSotP »

You're welcome.

I've also had a thought for a much more ambitious script for a 'weather system'. But I don't have the knowledge to write it. Someone already helped me out with a script that deleted one type of sky and replaced it with another. And that got me thinking. Coupled with the 'TimeOfDay' and the fog particles. A script could be written that would do this:

Forest day
Forest night

Forest day
[[Delete forest sky; spawn cemetery sky, fog deactivated]]
Cemetery evening (no fog)
Cemetery night (with fog)
Cemetery early morning (with fog)
Cemetery day (no fog)
Cemetry night (no fog)
Cemetry late night (with fog)

Cemetry early morning (with fog)
Cemetery morning (no fog)
[[Delete cemetery sky; spawn castle arena sky]]
Castle Arena afternoon
Castle Arena night
Castle Arena day
Castle Arena night
[[Delete castle arena sky; spawn Cemetery sky, no fog]]
Cemetery late night (no fog)

Cemetert early morning (no fog)
[[Delete cemetery sky; spawn forest sky]]
Forest day
Forest night
Forest day
Forest night

Then repeat. It could be used by anyone making an outdoor area (that doesn't want a swamp)

Edit:
I'm not 100% sure, but the script could have a 'day' counter which resets on the last day. Then it's just tying the spawning and particle effects into the times on that particular day. (it's a whole week)

So something like

When GameMode.TimeOfDay() == 0; add 1 to counter
when Day == 2 and TimeOfDay == 1, delete forest_sky; Spawn cemetery_sky, No fogparticles
when Day == 3 and TimeOfDay > 1.4 and <1.99 or > 0 and < 0.19 activate fogparticles
when Day == ...
...
when Day == 8; reset Day Counter

Edit2:
Another possible option is to not try and switch on and off fog particles on the different sky boxes, but instead to spawn in "dungeon fog", but I'm not if it would work on an outside environment, or if it is better. But it might make the script simpler.
Last edited by TSotP on Sun Nov 02, 2014 1:45 pm, edited 5 times in total.
Post Reply