Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
I guess I could just add another texture. My resource pack as is with out doing more optimization is around 200 MB. So I think I should be ok.
Re: Ask a simple question, get a simple answer
Well I just found some textures I'm not using at all lol. Now its down to 159 MB
Re: Ask a simple question, get a simple answer
The fragment will still be lit as normal, but the emissive color will be added to the fragment's color at the end. So it's somewhat unfriendly with lighting but not necessarily unusable, depending on how much emissive color you're using and how heavily you expect the model to be lit.
Remember that emissive color values can be negative; vec(0,-0.04,-0.04) will make the model appear redder without brightening it. Unfortunately, both negative and positive values will look silly when the lighting is low enough - positive values make the model appear to glow, and an emissive color of vec(0, -0.04, -0.04) will make the model's hue completely red in low lighting.
So in other words, yeah, you probably want to just use a new texture.
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
While imperfect, it is possible to use negative emissive color values. It comes with visual side effects, but you can decide if it's a good trade-off, and you have precise control over the color values... to balance the tint effect with the off lighting. In the video, as you'll see, the trees in the center clearing are tinted red, blue, and green. The negative values [for the most part] don't cause them to glow in the dark.
The effect is better suited to simple objects rather than complex ones (like sets of trees), as the color will tint the entire object equally, everywhere.
Re: Ask a simple question, get a simple answer
Isaac: could you please share the script for this?
Re: Ask a simple question, get a simple answer
It's not really a script per se—I mean technically it is. minmay shows it above.
You just call the object's model component, and use the setEmissiveColor() function with negative values.
The values that I used for the trees are these:
Code: Select all
forest_oak_cluster_1.model:setEmissiveColor(vec(-.025))
forest_oak_cluster_2.model:setEmissiveColor(vec(-.01,-.005,-.05))
forest_oak_cluster_3.model:setEmissiveColor(vec(0,0,-.01))
forest_oak_cluster_4.model:setEmissiveColor(vec(-.025,-.01))
forest_oak_cluster_5.model:setEmissiveColor(vec(-.01,-.025,-.06))
Re: Ask a simple question, get a simple answer
You can also include it directly in the component definition, which is particularly useful for minimalSaveState objects:
Code: Select all
{
class = "Model",
model = "mod_assets/models/env/goat_statue.fbx",
emissiveColor = vec(0.04, -0.02, 0),
}
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
I wonder how the "onInit" hook work?
Is it triggered on every loading or just once at the first loading and never used again?
per example on this object, it spawns another object:
I'm asking, because I want to add to it minimalSavestate = true , but I don't know if it is ok for that kind of object.
(the under_lava_effects is a tile damager, who has minimal... = true, the lava_volcano_eruption_ground is a particle that stays for a few seconds)
Is it triggered on every loading or just once at the first loading and never used again?
per example on this object, it spawns another object:
I'm asking, because I want to add to it minimalSavestate = true , but I don't know if it is ok for that kind of object.
(the under_lava_effects is a tile damager, who has minimal... = true, the lava_volcano_eruption_ground is a particle that stays for a few seconds)
SpoilerShow
Code: Select all
defineObject{
name = "lava_effects",
components = {
{ class = "Light",
offset = vec(0, -0.5, 0),
range = 6,
color = vec(2.8, 1.2, 0.7),
brightness = 10,
castShadow = true,
shadowMapSize = 64,
staticShadows = true,
staticShadowDistance = 0, -- use static shadows always
},
{ class = "Particle",
particleSystem = "lava_effects",
offset = vec(0, -0.4, 0),
},
{
class = "TileDamager",
attackPower = 3,
damageType = "fire",
repeatCount = math.huge,
repeatDelay = 1,
onInit = function(self)
if self.go.map:getElevation(self.go.x, self.go.y) < self.go.elevation then
spawn("under_lava_effects", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation-1)
end
end,
},
{ class = "Timer",
timerInterval = 1,
currentLevelOnly = true,
triggerOnStart = true,
onActivate = function(self)
for f = 0,3 do spawn("eruption", self.go.level, self.go.x, self.go.y, f, self.go.elevation) end
self.go:playSound("magma_explosion")
spawn("lava_volcano_eruption_ground", self.go.level, self.go.x, self.go.y, self.go.facing, self.go.elevation-1)
self:setTimerInterval(300*(0.1+0.9*math.random()))
end,
onInit = function(self)
self:setTimerInterval(300*math.random())
end,
},
{ class = "Sound",
sound = "fire_pit",
volume = 0.5,
},
},
placement = "floor",
editorIcon = 88,
}
Re: Ask a simple question, get a simple answer
If the object has minimalSaveState then component onInit hooks will run every time the game is loaded, otherwise they will only run once.
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
ok, thanks!
so it's not a good idea to add on this object.
so it's not a good idea to add on this object.