Is there way to change super transformation button for 2 custom characters?

I mean how to do transformation with custom button 2 not spin button
uhhh last time I checked modern sonic is the only character I know with a custom 2 transformation and if your talking about the vanilla characters they don't use custom button 1 2 or 3
 
Here I wrote some code that might help ya'! :3
It has lots of comments (comments are the text that goes after double slashes //) so you can easily understand the function each single line of code does. Btw comments won't affect the code. They're just like little notes that won't affect the logic!

While I won't ask you for credit me, I would highly appreciate if you did!!!
Aaaand if anything here breaks or stops working, notify me so I can try to fix it ^w^

Basic Superform customization:
// The name of the character!
// The value MUST match the name value of your character
// Make sure the name is between quotes (like "this")
local super_name = "sonic"

// How many Rings we need to be Super?
// SRB2's default is 50
local super_rings = 50

// What button will we use to go Super?
// SRB2's default is BT_SPIN
// See available options here -> https://wiki.srb2.org/wiki/Constants#Button_flags_(BT_*)
local super_button = BT_CUSTOM2

// PlayerThink runs every frame for every player available
addHook("PlayerThink", function(player)
    
    if skins[player.skin].name == super_name // Must be using the specified skin
    
    and player.mo // Make sure we have an assigned object in the level...
    and player.mo.valid // ...and make sure said object exists
    
    and player.mo.health // To transform, u must be alive. Duh.
    
    and skins[super_name].flags & SF_SUPER // Make sure the character's defs allow them to have a Super form
    and not player.powers[pw_super] // If you're ALREADY Super, don't run the code
    and not (player.pflags & PF_THOKKED) // Avoids players from transforming right after using an ability
    and All7Emeralds(emeralds) // Check for the Chaos Emeralds (Singleplayer/Co-op)
        
        // Deleting the Super flag allows us to avoid the player from using Spin to transform!
        player.charflags = $&~SF_SUPER

        if player.pflags & PF_JUMPED // You want to transform during a jump, right?
        and not P_IsObjectOnGround(player.mo) // Just in case, check if we're actually mid-air
        and player.rings >= super_rings // Do we have the required amount of rings?
        and player.cmd.buttons & super_button // Are you pressing the assigned input?
            
            player.charflags = $|SF_SUPER // u can be supah :>
            P_DoSuperTransformation(player) // Now you do the thing!! >:3
            
        end
    end
    
end) // ~ FIN ~

Good luck with your proyect!!
 

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

Back
Top