-- SRB2 Lua Script: Sonic Wind Tornado Ability addHook("PlayerThink", function(player) -- Only for Sonic skins if not (player.mo and player.mo.valid and player.mo.skin == "sonic") then return end -- Trigger "Sonic Wind" Tornado with Custom Button 2 if (player.cmd.buttons & BT_CUSTOM2) and not (player.prevbuttons & BT_CUSTOM2) then S_StartSound(player.mo, sfx_s3k4b) -- Cyclone sound effect local layers = 3 -- Vertical layers of the tornado local per_layer = 8 -- Particles per circle layer -- Create a funnel shape (narrow at bottom, wide at top) for h = 1, layers do local radius = (48 + (h * 32)) * FRACUNIT -- Radius grows with height local z_pos = (h * 32) * FRACUNIT -- Height of this layer for i = 1, per_layer do local ang = i * (ANGLE_MAX / per_layer) + (h * ANGLE_45) -- Offset rotation per layer local x_off = FixedMul(radius, cos(ang)) local y_off = FixedMul(radius, sin(ang)) -- Spawn the "Wind" gusts local wind = P_SpawnMobjFromMobj(player.mo, x_off, y_off, z_pos, MT_THOK) if wind and wind.valid then wind.color = SKINCOLOR_SKY -- Tornado color wind.flags = $|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY wind.fuse = 12 -- Lifespan of each gust wind.scale = (2 + h) * FRACUNIT -- Gets larger as it goes up -- Optional: Give them a slight spin velocity wind.momz = 4*FRACUNIT end end end -- Damage: Hits enemies in a funnel-sized radius (approx 350 units) P_RadiusAttack(player.mo, player.mo, 350*FRACUNIT) end player.prevbuttons = player.cmd.buttons end)