How do you check a projectile spawning in Lua?

Singey Yumbo

Hammock Historian
Specifically, what is the variable, and how do I use it to spawn a trail for my custom projectile?

Here is the code for the functions I'm trying to work on

Code:
addHook("MobjThinker", function(mobj)
    if abs(mobj.momx) + abs(mobj.momy) + abs(mobj.momz) > 0 then
		mobj.fuse = mobj.fuse + 1
	end
	if -abs(mobj.momx) + -abs(mobj.momy) + -abs(mobj.momz) < 0 then
		P_SpawnGhostMobj(MT_ROCK)
	end
end, MT_ROCK)

addHook("SpinSpecial", function(player)
    local mo = player.mo
    if player.mo and player.mo.valid and player.mo.skin == "amperkonova" then -- If the player has a player object in play (not spectating)
        if not (player.pflags & PF_SPINDOWN) then -- If the button wasn't pressed the previous frame...
            -- That means we just tapped the button!
            -- Therefore fire a projectile
            local proj = P_SpawnPlayerMissile(mo, MT_ROCK) -- Create a rock
            proj.target = mo -- Set the rock's target to us - A "target" for projectiles means "who fired it"
			proj.fuse = 4*TICRATE
			//proj.momz = $1 - FRACUNIT/4
            P_InstaThrust(proj, mo.angle + 48*FRACUNIT, 60*FRACUNIT) -- Fire the projectile towards the player's horizontal aim at 60 FRACUNIT speed
        end
    end
end)
 
Last edited:

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

Back
Top