[Scripts,Assets] Small interesting additions
Re: [Scripts,Assets] Small interesting additions
These are really quite nice additions Davey! Thanks for sharing with us, I am sure to use some of these. Hope to see more from you!
My slow going projects...
viewtopic.php?f=14&t=4538&p=59753#p59753
viewtopic.php?f=14&t=4538&p=59753#p59753
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: [Scripts,Assets] Small interesting additions
I found something while testing some modified monsters, slimes in this case, but the problem is the same with any monster.
When you freeze them with the frostbolt spell for example, they loose their customized material after the frozen effects stops. So slimes for example become green slimes after that attack.
Does anyone know why this happens and if it can be avoided ? I looked at the FrozenMonsterComponent in the scripting reference but it is totally empty.
So a warning to all people here with custom monsters materials; think about testing the frozen condition on your monsters.
- Is there a technical solution ? A TimerComponent checking the monster conditions and material every frame would be brutal.
- Use the bug as a fun element ? All your fire theme monsters not immune to cold would loose their flammes after being frozen... Also alter some other stats of the monster with a onDamage function (changing the attacks damage type for example).
- Make all other defined monsters immune to the frozen condition ? (I don't like this solution as much, very unfair to ice wizards!)
When you freeze them with the frostbolt spell for example, they loose their customized material after the frozen effects stops. So slimes for example become green slimes after that attack.
Does anyone know why this happens and if it can be avoided ? I looked at the FrozenMonsterComponent in the scripting reference but it is totally empty.
So a warning to all people here with custom monsters materials; think about testing the frozen condition on your monsters.
- Is there a technical solution ? A TimerComponent checking the monster conditions and material every frame would be brutal.
- Use the bug as a fun element ? All your fire theme monsters not immune to cold would loose their flammes after being frozen... Also alter some other stats of the monster with a onDamage function (changing the attacks damage type for example).
- Make all other defined monsters immune to the frozen condition ? (I don't like this solution as much, very unfair to ice wizards!)
Re: [Scripts,Assets] Small interesting additions
Yeah, I noticed the same thing when re-texturing some monsters.
My solution was to go back to the old method we had to use with LoG1 - make a copy of the model and re-texture it in the GMT.
My solution was to go back to the old method we had to use with LoG1 - make a copy of the model and re-texture it in the GMT.
Re: [Scripts,Assets] Small interesting additions
Actually, this is pretty easy to fix, assuming that your shortest freeze duration is longer than your shortest animation. No need to waste filesize & memory on an extra copy of the model.
If you're using materialOverrides instead of material, the same solution works:
If your shortest freeze duration is shorter than your shortest animation duration, just add more animationEvents until the time between them is shorter than your shortest freeze duration, like:
This solution takes advantage of the fact that monsters always finish their current animation when frozen (as far as I can tell) and play a new animation (possibly the idle animation) immediately upon becoming unfrozen.
Also, when a frozen monster finishes the animation it was playing when the freeze started, it will play frame 0 of its idle animation but not any further ones, in case that information is useful for something (it's not really relevant to this particular problem though).
The shortest freeze duration in the standard assets is 3.5 seconds (frostbolt_1, frostbolt_2, or frostbolt_3).
Code: Select all
local anims = {
idle = "assets/animations/monsters/goromorg/goromorg_idle.fbx",
moveForward = "assets/animations/monsters/goromorg/goromorg_walk.fbx",
strafeLeft = "assets/animations/monsters/goromorg/goromorg_strafe_left.fbx",
strafeRight = "assets/animations/monsters/goromorg/goromorg_strafe_right.fbx",
turnLeft = "assets/animations/monsters/goromorg/goromorg_turn_left.fbx",
turnRight = "assets/animations/monsters/goromorg/goromorg_turn_right.fbx",
attack = "assets/animations/monsters/goromorg/goromorg_attack.fbx",
getHitFrontLeft = "assets/animations/monsters/goromorg/goromorg_get_hit_front_left.fbx",
getHitFrontRight = "assets/animations/monsters/goromorg/goromorg_get_hit_front_right.fbx",
getHitBack = "assets/animations/monsters/goromorg/goromorg_get_hit_back.fbx",
getHitLeft = "assets/animations/monsters/goromorg/goromorg_get_hit_left.fbx",
getHitRight = "assets/animations/monsters/goromorg/goromorg_get_hit_right.fbx",
fall = "assets/animations/monsters/goromorg/goromorg_get_hit.fbx",
}
for name,anim in pairs(anims) do
defineAnimationEvent{
animation = anim,
event = "hack",
normalizedTime = 0,
}
end
defineObject{
name = "poop_goromorg",
baseObject = "goromorg",
components = {
{
class = "Model",
model = "assets/models/monsters/goromorg.fbx",
storeSourceData = true,
material = "poop",
},
{
class = "Animation",
animations = anims,
currentLevelOnly = true,
onAnimationEvent = function(self, event) if event == "hack" and not self.go.frozen then self.go.model:setMaterial(self.go.model:getMaterial()) end end,
},
},
}
Code: Select all
onAnimationEvent = function(self, event) if event == "hack" and not self.go.frozen then self.go.model:setMaterialOverrides(self.go.model:getMaterialOverrides()) end end
Code: Select all
for name,anim in pairs(anims) do
defineAnimationEvent{
animation = anim,
event = "hack",
normalizedTime = 0,
}
defineAnimationEvent{
animation = anim,
event = "hack",
normalizedTime = 0.5,
}
end
Also, when a frozen monster finishes the animation it was playing when the freeze started, it will play frame 0 of its idle animation but not any further ones, in case that information is useful for something (it's not really relevant to this particular problem though).
The shortest freeze duration in the standard assets is 3.5 seconds (frostbolt_1, frostbolt_2, or frostbolt_3).
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.
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: [Scripts,Assets] Small interesting additions
I tested it and there is still a problem; the material is restored on the next animation, so for a slime who stands still and does not attack immediately after the frozen condition, it stays green for the duration.
So I think the timer solution cannot be avoided in this case:
edit: oops missed your previous post edit, will check it
So I think the timer solution cannot be avoided in this case:
Code: Select all
{ class = "Timer",
timerInterval = 0.001,
triggerOnStart = true,
onActivate = function(self) if not self.go.frozen then self.go.model:setMaterial(self.go.model:getMaterial()) end end,
},
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: [Scripts,Assets] Small interesting additions
So I have to choose between two solutions;
- use a timer component as in my previous post.
- change a freeze spell I made that does not have a minimum duration (duration = power * math.random())
Do you think the timer solution is really nastier compared to animation events ?
- use a timer component as in my previous post.
- change a freeze spell I made that does not have a minimum duration (duration = power * math.random())
Do you think the timer solution is really nastier compared to animation events ?
Re: [Scripts,Assets] Small interesting additions
Nah. The advantage of the animationEvent approach is just that you're making way fewer function calls. Doing it every frame is fine if you need it.
By the way, I found that you can use a timerInterval of 0 to get one activation every frame, in case you want better compatibility with people running the game at 2000 FPS.
By the way, I found that you can use a timerInterval of 0 to get one activation every frame, in case you want better compatibility with people running the game at 2000 FPS.
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.
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: [Scripts,Assets] Small interesting additions
The future of retro-gamingminmay wrote:people running the game at 2000 FPS.