Is there a way to have different light classes on the party component and then to enable or disable them? ... for instance.. this spotlight only enabled when party has a certain object on them... or would it be better to add the definition to the object?Khollik wrote: ↑Mon Jun 17, 2019 4:43 pm Hello actually adding the "light" component to the "party" object wasn't the most difficult part:
Code: Select all
defineObject{ name = "party", baseObject = "party", components = { { class = "Party", onDrawGui = function(party, g) end, { class = "Light", type = "spot", range = 12, color = vec(1.3, 0.68, 0.35), brightness = 8, spotAngle = 60, spotSharpness = 0.4, castShadow = true, staticShadows = true, destroyObject = true, shadowMapSize = 256, offset = vec(0, 1.5, -0.4), onUpdate = function(self) local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9 self:setBrightness(noise * 6) end, }, }, }
Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
1
When I'm try to press the preview button, an error message appears
=== Software Failure ===
preview:97547: main function has more than 65536 constants
stack traceback:
[C]: in function 'error'
[string "Dungeon.lua"]: in function 'loadDungeonFile'
[string "DungeonEditor.lua"]: in function 'playPreview'
[string "DungeonEditor.lua"]: in function 'previewButtons'
[string "DungeonEditor.lua"]: in function 'update'
[string "Grimrock.lua"]: in main chunk
2
4GB patch installed
3
I'm trying to make the mod "Xeen's cronicles" part 1 and 2 in a single file.
Total maps are approximately 110-120. All size 32x32
The story and the plot are the same for both parts. I would not like to split the mod into two files ...
When I'm try to press the preview button, an error message appears
=== Software Failure ===
preview:97547: main function has more than 65536 constants
stack traceback:
[C]: in function 'error'
[string "Dungeon.lua"]: in function 'loadDungeonFile'
[string "DungeonEditor.lua"]: in function 'playPreview'
[string "DungeonEditor.lua"]: in function 'previewButtons'
[string "DungeonEditor.lua"]: in function 'update'
[string "Grimrock.lua"]: in main chunk
2
4GB patch installed
3
I'm trying to make the mod "Xeen's cronicles" part 1 and 2 in a single file.
Total maps are approximately 110-120. All size 32x32
The story and the plot are the same for both parts. I would not like to split the mod into two files ...
Re: Ask a simple question, get a simple answer
Functions in Lua are limited to 65536 constants at compile time. Because dungeon.lua uses a string constant for every GameObject id and GameObject ids are unique, every GameObject placed in your dungeon corresponds to at least one constant (more if one of its name, or one of its x,y,facing,elevation,level values has not appeared previously).
The easiest workaround for this would be to move some of your spawn() calls from your dungeon.lua to an external script file.
The easiest workaround for this would be to move some of your spawn() calls from your dungeon.lua to an external script file.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
Thank! All clear.
We'll have to split the mod into two different files ...
We'll have to split the mod into two different files ...
Re: Ask a simple question, get a simple answer
Minmay: is there a way to see beforehand how many constants you have?
Re: Ask a simple question, get a simple answer
I suppose you could compile it with luajit yourself and find the constant count in the resulting bytecode. Not sure why you'd need that information though.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
Code: Select all
defineObject{
name = "party",
baseObject = "party",
components = {
{
class = "Party",
onDrawGui = function(party, g)
end,
},
{
class = "Light",
type = "spot",
range = 4,
color = vec(1.3, 0.68, 0.35),
brightness = 4,
spotAngle = 60,
spotSharpness = 0.4,
castShadow = true,
staticShadows = true,
destroyObject = true,
shadowMapSize = 256,
offset = vec(0, 1.5, -0.4),
onUpdate = function(self)
local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9
self:setBrightness(noise * 6)
end,
},
},
}
Asking this because I want to create a sort of flashlight for the party ... , but I dont want it on all the time
any ideas ?
edit by Zo Kath Ra:
I've put the definition inside <code> tags, to make it more readable.
It's the </> symbol in the formatting bar.
Re: Ask a simple question, get a simple answer
party.light:disable()
party.light:enable()
The party already has a component called 'torch'; that handles the ambient and flaming torch lighting.
party.torch:disable()
party.torch:enable()
party.light:enable()
The party already has a component called 'torch'; that handles the ambient and flaming torch lighting.
party.torch:disable()
party.torch:enable()
Re: Ask a simple question, get a simple answer
Thanks Isaac. That should have been obvious for me, but wasnt
Another question. I can now switch between the party.light and party.torch ... is it possible to make more lightsources attached to the party. Say for instance party.light1 / party.light2 ...
what I am trying to create is a dungeon that has different party light settings when you go deeper in.
Nevermind: I figured it out. Gave them names
Another question. I can now switch between the party.light and party.torch ... is it possible to make more lightsources attached to the party. Say for instance party.light1 / party.light2 ...
what I am trying to create is a dungeon that has different party light settings when you go deeper in.
Nevermind: I figured it out. Gave them names