Page 251 of 396

Re: Ask a simple question, get a simple answer

Posted: Tue Aug 14, 2018 12:02 pm
by Pompidom
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 :)

Re: Ask a simple question, get a simple answer

Posted: Tue Aug 14, 2018 1:13 pm
by akroma222
THOM wrote: Tue Aug 14, 2018 10:57 am The waterfall of Skuggs will come with ORRR3. 8-)
Ahhh good to know :D
Cheers THOM!

Re: Ask a simple question, get a simple answer

Posted: Tue Aug 21, 2018 8:56 am
by AndakRainor
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

Posted: Tue Aug 21, 2018 10:10 am
by minmay
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.

Re: Ask a simple question, get a simple answer

Posted: Wed Aug 22, 2018 2:06 am
by Huff
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:

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

Posted: Wed Aug 22, 2018 6:51 am
by minmay
Try this:

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,
Setting a monster's position is the easiest way to interrupt monster actions.

Re: Ask a simple question, get a simple answer

Posted: Thu Aug 23, 2018 12:40 am
by Huff
Great work minmay, thank you!

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 24, 2018 3:29 am
by akroma222
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? :geek: ) 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)
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 :| :oops: ... 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 :D 8-)
Cheers folks

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 24, 2018 10:28 am
by minmay
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.

Re: Ask a simple question, get a simple answer

Posted: Fri Aug 24, 2018 4:56 pm
by akroma222
minmay wrote: Fri Aug 24, 2018 10:28 am For the injury, context.color(0, 0, 215+math.sin(Time.currentTime()*4)*40, 255) before drawing the overlay.
Absolutely fantastic, many many thanks :P :D
minmay 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.
Ahh I see, I see.. unfortunately I cant use almost all of the vanilla effects shown in menus or attack panels.... reason being
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 :roll: :x
SpoilerShow
Image
SpoilerShow
Image
SpoilerShow
Image
But all good! I wont try to replicate the vanilla heal effect, ill create a diff one instead - Thankyou again kind sir for steering me away from the fruitless time trap of replicating it :D