Thread: [Script] Golden Monitors
View Single Post
Old 04-27-2018   #5
K.S.
Formerly Inuyasha
Retired Staff
 
K.S.'s Avatar
Default

Okay, so, first off, there's absolutely no need for a proximity check, and none of my reference implementations nor the 2.2 implementation have them. (The only reason bubbles need them is because they play sounds on popping.)

Second off, sparkles have three states associated with them, to smoothly fade out. Note that this also eliminates the need for a fuse.

Code:
// Extra animated effect for BIGBOXes
freeslot(
	"MT_BOXSPARKLE",
	"S_BOXSPARKLE1",
	"S_BOXSPARKLE2",
	"S_BOXSPARKLE3"
)

mobjinfo[MT_BOXSPARKLE] = {
	spawnstate = S_BOXSPARKLE1,
	speed = 3*FRACUNIT,
	flags = MF_NOGRAVITY|MF_SCENERY|MF_NOBLOCKMAP|MF_NOCLIPHEIGHT
}
states[S_BOXSPARKLE1] =	{SPR_NSPK, TR_TRANS40, 20, nextstate = S_BOXSPARKLE2}
states[S_BOXSPARKLE2] =	{SPR_NSPK, TR_TRANS60, 10, nextstate = S_BOXSPARKLE3}
states[S_BOXSPARKLE3] =	{SPR_NSPK, TR_TRANS80,  5, nextstate = S_NULL}

function A_BigMonitorSparkle(actor, var1, var2)
	local ngangle = FixedAngle(((leveltime * 21) % 360) << FRACBITS)
	local xofs = sin(ngangle) * (actor.radius>>FRACBITS)
	local yofs = cos(ngangle) * (actor.radius>>FRACBITS)

	for i = FRACUNIT*2,FRACUNIT*3,32767
		P_SetObjectMomZ(P_SpawnMobjFrom(actor, xofs, yofs, 0, MT_BOXSPARKLE), i)
	end
end
Third, the sound effect actually has the SF_X2AWAYSOUND flag applied to it that I don't think you set.

Fourth, the boxes have a radius of 16*FRACUNIT and a height of 36*FRACUNIT.

(Lastly, it ... kinda sucks doing literally everything to make these things from concept to finish, and getting zero credit in the end.)



Also, if you want to see the reference implementation for yourself, drop me a line on discord. The only reason I don't just straight post it is because it's actually a complete rewrite/simplification of the system monitors use, so it also includes regular monitors ... and the fact that it auto-generates mobj types and states, which I don't think SRB2 Doom Builder appreciates.

Last edited by K.S.; 04-27-2018 at 07:22 AM.
K.S. is offline   Reply With Quote