SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing Help

Reply
 
Thread Tools Search this Thread
Old 1 Week Ago   #1
Singey Yumbo
Hamhock Bartender
 
Singey Yumbo's Avatar
Default How do you check a projectile spawning in Lua?

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)
__________________
Hello! Welcome to the Hamhock Diner, how may I help you today?

One chicken pizza, please.

Alright, coming up!

Last edited by Singey Yumbo; 1 Week Ago at 06:40 PM. Reason: Updated Code
Singey Yumbo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:16 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.