Lua Help: Spawning different debris with A_RingExplode

Status
Not open for further replies.

Joosp

The journey no one knows but you
If you've seen Jasper in Great Divide, he uses an attack that uses A_RingExplode to cause damage. I want to simply duplicate the effects of A_RingExplode except using a different object to spawn instead of MT_NIGHTSSPARKLE (the object is essentially the same, just different sprites). I did look at the page for the action on the Wiki, but I definitely can't read C well enough to understand what is going on. Is there a way to simply change the debris of the action when certain conditions are met, or do I have to recreate the action entirely with P_SpawnParaloop?
 
A_OldRingExplode allows you to select your own objects, but it's probably not the effect you were looking for.
 
Yeah, A_OldRingExplode ends up putting the objects in a different formation than the regular A_RingExplode and kills off said objects in a very short time. I could use it as a ~last resort~ kind of thing but even then I'd probably stick to A_RingExplode.
 
Yeah, you're going to have to recreate the action entirely with Lua, with a different object in place of MT_NIGHTSPARKLE.

Just a note while we're here, P_SpawnParaloop only spawns one loop of objects directed away at a particular vertical angle around the coordinates; it has to be used multiple times in one go for a more spherical arrangement, as done in A_RingExplode itself (the action in question does that 16 times there for 16 multiples of ANGLE_22h, as 22.5° * 16 = 360°).

To recreate THAT particular bit at least in Lua you can do this:
Code:
for d = 0,15
	P_SpawnParaloop(actor.x, actor.y, actor.z+actor.height,
		FixedMul(actor.info.painchance, actor.scale), 16,
		MT_TYPEYOUWANT, d*ANGLE_22h, S_NULL, true)
end

Line breaks included to stop the line being too long. Also, Lua swaps around the angle and state for the function, if you're confused by that at all.
 
Last edited:
Fission Mailed.

Nf2DTpP.gif


I ended up changing actor to player.mo, since that was the only object I had as a reference (and the fact that I'm not sure what actor represents here). I just used MT_NIGHTSPARKLE in this gif as I haven't finished up the alternate sparkle.
 
Works perfectly now. I've already implemented the "exploding" part of the ability with P_RadiusAttack so it looks like smooth sailing from here. Thanks again!
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top