Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Holy moly, that looks nice
I guess I will keep the flat waterfall walls from zimber as placeholder for now until I can obtain these
I guess I will keep the flat waterfall walls from zimber as placeholder for now until I can obtain these
Re: Ask a simple question, get a simple answer
Ahhh good to know
Cheers THOM!
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
Is it possible to detect a "bad object" without crashing the game? Let's say the bad object is an item inside a container component, can I detect it then remove the item from its slot inside this container?
Re: Ask a simple question, get a simple answer
The "bad object" error message means that either you passed the completely wrong type of argument to a function, or you tried to do something with a reference to a GameObject/Component/etc. that has been destroyed.
Presumably you're talking about the second case, and the answer is no, not really. Merely indexing an object that has already been destroyed will cause an error. The solution is to keep better track of your objects.
The example you're giving seems odd to me. If the game tries to destroy a GameObject that's inside a container, it should cause an error anyway because you're destroying an object that's not on a map. I guess you could cause some havoc by removing just the ItemComponent while it's in a container and leaving the parent GameObject intact...but the only time that would happen is in a user script, which means you have a reference to the ItemComponent anyway and can remove it from the container before destroying it.
Presumably you're talking about the second case, and the answer is no, not really. Merely indexing an object that has already been destroyed will cause an error. The solution is to keep better track of your objects.
The example you're giving seems odd to me. If the game tries to destroy a GameObject that's inside a container, it should cause an error anyway because you're destroying an object that's not on a map. I guess you could cause some havoc by removing just the ItemComponent while it's in a container and leaving the parent GameObject intact...but the only time that would happen is in a user script, which means you have a reference to the ItemComponent anyway and can remove it from the container before destroying it.
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
Is there a way to interrupt a monster's action or immediately set it to idle?
I'm trying to make it so that when the monster:knockback() method from weapons like the Maul will always trigger a knockback, regardless of the monster's current action. The current implementation only allows you to knock back monsters if the monster:getCurrentAction() returns nil, which appears to be the idle state.
Some sample code of what I've tried:
I'm trying to make it so that when the monster:knockback() method from weapons like the Maul will always trigger a knockback, regardless of the monster's current action. The current implementation only allows you to knock back monsters if the monster:getCurrentAction() returns nil, which appears to be the idle state.
Some sample code of what I've tried:
Code: Select all
onHitMonster = function(self, monster)
monster.go.animation:stop()
monster:performAction("idle")
print(monster:getCurrentAction())
monster:knockback(party.facing)
end,
Re: Ask a simple question, get a simple answer
Try this:
Setting a monster's position is the easiest way to interrupt monster actions.
Code: Select all
onHitMonster = function(self, monster)
if monster:isAlive() and not monster:isFalling() and monster:getCurrentAction() ~= "knockback" then
monster.go:setPosition(monster.go.x,monster.go.y,monster.go.facing,monster.go.elevation,monster.go.level)
monster:knockback(party.facing)
end
end,
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
Great work minmay, thank you!
Re: Ask a simple question, get a simple answer
Hey All,
I have 2 questions re animated textures drawn over the champion menus....
1. When wounded / injured, the corresponding Inventory (menu) slot is outlined in bold red, but also there is a red transparent tint than fades out as the tint comes closer to the middle of the injured slot. This tint seems to wax and wane (ever so slightly) every few seconds (is spose to imply throbbing pain? ) This kind of thing ive been replicating by experimenting with gametime and sin / cos / tan.... with varying degrees of tears and boredom as the usual result.
EG
My question is: Does anyone have an exact or similar Math Formula for the fading red inventory slot tint seen if injured???
2. What would be the best way to replicate the blue sparkling 'heal_party' Fx animated over the Attack Panel portraits when a champion is healed?? Ive looked for the thread where Isaac has demonstrated 2D animations by using a particle effect atlas (each frame draws the next version of the particle) ... but I cant find it ... is this the best way to redo the heal party sparkle???
Admittedly, I am hoping someone can help me cut corners here... as Im trying to not sink loads of time into these small nagging things... any help would be marvellous
Cheers folks
I have 2 questions re animated textures drawn over the champion menus....
1. When wounded / injured, the corresponding Inventory (menu) slot is outlined in bold red, but also there is a red transparent tint than fades out as the tint comes closer to the middle of the injured slot. This tint seems to wax and wane (ever so slightly) every few seconds (is spose to imply throbbing pain? ) This kind of thing ive been replicating by experimenting with gametime and sin / cos / tan.... with varying degrees of tears and boredom as the usual result.
EG
Code: Select all
local txtV = party.animatetexturecounter:getValue()
local gt = party.gametime:getValue()
local alpha = (90 * math.sin(gt * 0.65) + 160)
context.color(255, 255, 255, alpha )
-------------------------------------------------------------------------------------------------------------menu glass
context.drawImage2("mod_assets/textures/gui/loopSkyAnimated2Spots.tga", w-f*554, f*291, txtV, (90 * math.sin(fc *0.65)+260), 115, 60, f*517, f*317)
2. What would be the best way to replicate the blue sparkling 'heal_party' Fx animated over the Attack Panel portraits when a champion is healed?? Ive looked for the thread where Isaac has demonstrated 2D animations by using a particle effect atlas (each frame draws the next version of the particle) ... but I cant find it ... is this the best way to redo the heal party sparkle???
Admittedly, I am hoping someone can help me cut corners here... as Im trying to not sink loads of time into these small nagging things... any help would be marvellous
Cheers folks
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: Ask a simple question, get a simple answer
For the injury, context.color(0, 0, 215+math.sin(Time.currentTime()*4)*40, 255) before drawing the overlay.
You can't replicate the healing effect exactly because it uses additive blending, which is not available in GraphicsContext. Even if you're willing to settle for alpha blending, it would not be fun to code, or very efficient. If at all possible, I recommend you just use the real healing effect.
You can't replicate the healing effect exactly because it uses additive blending, which is not available in GraphicsContext. Even if you're willing to settle for alpha blending, it would not be fun to code, or very efficient. If at all possible, I recommend you just use the real healing effect.
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
Absolutely fantastic, many many thanks
Ahh I see, I see.. unfortunately I cant use almost all of the vanilla effects shown in menus or attack panels.... reason beingminmay wrote: ↑Fri Aug 24, 2018 10:28 am You can't replicate the healing effect exactly because it uses additive blending, which is not available in GraphicsContext. Even if you're willing to settle for alpha blending, it would not be fun to code, or very efficient. If at all possible, I recommend you just use the real healing effect.
Ive redrawn all attack panels and menus... hence my recent posts asking for the best ways to re-implement features, fx and other hard coded stuff....
Hopefully the below images should demonstrate my dilemma
SpoilerShow
SpoilerShow
SpoilerShow
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)