Page 219 of 400

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 08, 2018 1:04 am
by AndakRainor
Well my problem is about procedural generated maps. I noticed that I can't spawn a water mesh when needed, so I have them generated at the initialisation of the mod, and they have the size of the full map. At that point I don't know where the stairs to go down to the map below will be placed. I try to find a way to hide the water that floods the stairs. No luck so far with ForceZWrite. I hope I won't have to give stairs a fixed position because of this, or other cheap solutions...

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 08, 2018 4:47 am
by minmay
Ah. WaterSurfaceMeshComponent builds the mesh when:
- the party enters its level and the mesh hasn't been built already
- the game is reloaded

So it won't automatically build the mesh when newly spawned, but you can make it build the mesh by moving the party to another level and then back. HeightmapComponent behaves the same way.
Of course, the resulting mesh is based entirely on which tiles are underwater, and the user scripting interface can't modify the tile map. But if you were to find a way to modify the tile map anyway, it does get saved and loaded, as does the heightmap, so changing it probably works fine...

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 08, 2018 9:48 am
by AndakRainor
Excellent news, as the Pandora box was already half opened :D

Edit: Is it okay to chain both party teleports in the same frame?

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 08, 2018 3:02 pm
by wagtunes
I hope it's okay to post this here even though these questions are for LoG 1. I just starting modding and while I'm pretty clear on the basic stuff, there are a few things I'm a little confused about.

1. I found the command for ending the game. I'm assuming I have to write a Lua script that when whatever event occurs, I simply call that command. My question though has to do with how to customize the game ending. I see the syntax says:

completeGame([cinematicsFile])

I found the info for the file type that the cinematic file has to be and downloaded and installed FFmpeg.

However, in addition to the cinematic file, I want to display text similar to the dream sequence texts in LOG 1 but have no clue how to do that in conjunction with the cinematic file where several messages fade in and fade out, controlled by a timer. So any assistance here will be appreciated. Or do I simply incorporate all script animations into the video file itself? I use Camtasia so I assume that will be capable of giving me what I'm looking for.

2. Would like to create a custom item to be found in a chest in order to trigger the completeGame([cinematicsFile]) command. Is this possible? I've gone through the scripting reference page but might have missed something as it's pretty long. In fact, it's massive.

3. Is there an area where custom Lua scripts like the ones I'm looking for already exist? There is no point in reinventing the wheel if it already exists.

That's about it. Everything else I've pretty much figured out and am through 4 levels of my current dungeon. As a former D&D Dungeon Master, this has been very easy for me story wise.

Any assistance that anybody can give and any other suggestions regarding things that I might not have even thought of would be greatly appreciated.

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 08, 2018 5:31 pm
by Isaac
wagtunes wrote: However, in addition to the cinematic file, I want to display text similar to the dream sequence texts in LOG 1 but have no clue how to do that in conjunction with the cinematic file where several messages fade in and fade out, controlled by a timer. So any assistance here will be appreciated. Or do I simply incorporate all script animations into the video file itself? I use Camtasia so I assume that will be capable of giving me what I'm looking for.
There is a page on this website, that outlines creating cinematics for LoG1.
http://www.grimrock.net/modding_log1/ho ... inematics/
2. Would like to create a custom item to be found in a chest in order to trigger the completeGame([cinematicsFile]) command. Is this possible? I've gone through the scripting reference page but might have missed something as it's pretty long. In fact, it's massive.
You can create a chest that runs the script when opened, or when the item is taken from it—define a new item that runs the script when the party picks it up [via party hook]; or when it is used by them [via item hook].
3. Is there an area where custom Lua scripts like the ones I'm looking for already exist? There is no point in reinventing the wheel if it already exists.
Yes there is: viewtopic.php?f=14&t=3099&hilit=useful+scripts

Re: Ask a simple question, get a simple answer

Posted: Thu Feb 08, 2018 6:00 pm
by wagtunes
Isaac wrote:
wagtunes wrote: However, in addition to the cinematic file, I want to display text similar to the dream sequence texts in LOG 1 but have no clue how to do that in conjunction with the cinematic file where several messages fade in and fade out, controlled by a timer. So any assistance here will be appreciated. Or do I simply incorporate all script animations into the video file itself? I use Camtasia so I assume that will be capable of giving me what I'm looking for.
There is a page on this website, that outlines creating cinematics for LoG1.
http://www.grimrock.net/modding_log1/ho ... inematics/
2. Would like to create a custom item to be found in a chest in order to trigger the completeGame([cinematicsFile]) command. Is this possible? I've gone through the scripting reference page but might have missed something as it's pretty long. In fact, it's massive.
You can create a chest that runs the script when opened, or when the item is taken from it—define a new item that runs the script when the party picks it up [via party hook]; or when it is used by them [via item hook].
3. Is there an area where custom Lua scripts like the ones I'm looking for already exist? There is no point in reinventing the wheel if it already exists.
Yes there is: viewtopic.php?f=14&t=3099&hilit=useful+scripts
Thank you. Appreciate it.

Re: Ask a simple question, get a simple answer

Posted: Fri Feb 09, 2018 2:07 am
by minmay
AndakRainor wrote:Edit: Is it okay to chain both party teleports in the same frame?
Yep.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 11, 2018 11:07 am
by bongobeat
is that possible to change the music of a level permanently with a command?

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 18, 2018 9:52 pm
by Wrathful
Hey all, I was wondering if someone could help me with a scripting question.

I'm having trouble with creating some custom GUI. I don't have any formal experience with Lua.

To get to the point, I have defined a custom onDrawGui hook as follows:

Code: Select all

onDrawGui = function(self, context)
	guiT46.script:guiT46Init(context)
end,
This refers to a script in my dungeon named guiT46, which has this code:

Code: Select all

function guiT46Init(context)
	context.font("large")
	context.drawText("Test", width/2, height/2)
end
However, this gives an error when I run the dungeon, saying that the font field cannot be found. Any tips as to how I can fix this?

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 19, 2018 1:56 am
by akroma222
Wrathful wrote: This refers to a script in my dungeon named guiT46, which has this code:

Code: Select all

function guiT46Init(context)
	context.font("large")
	context.drawText("Test", width/2, height/2)
end
However, this gives an error when I run the dungeon, saying that the font field cannot be found. Any tips as to how I can fix this?
Hey Wrathful,
I usually start any GUI function/script with the following:
SpoilerShow

Code: Select all

function drawChampionInventory(pcomp, context, champion)
	------------------------------------
	local w, h, r = context.width, 		context.height, 	context.width / context.height
	local f = (r < 1.3 and 0.8 or r < 1.4 and 0.9 or 1) * context.height/1080
	local MX, MY = context.mouseX, context.mouseY
	local mLeft, mRight = context.mouseDown(0), context.mouseDown(2)
	
	
	if Editor.isRunning() and context.keyDown("I") and context.mouseDown(0) then 
		context.font("large")																										
		context.color(225, 125, 125, 255)
		local text = "TEST DRAW TEXT"
		-------------------------------
		context.drawText(text, 	w - f * (w / 2  + context.getTextWidth(text)), 	 h - f * h / 2)	
	end
end
The local Var 'f' is used to correct for different screen resolutions .... you then need to multiply X, Y coords by f in subsequent drawTexts / drawImages etc
See how you go with that, happy to help with the GUI stuff :)
Akroma