Change abilities?

SIG7Pro

I hate my life.
is it possible to make a script, but if a button, say custom1, is pressed, it changes the ability thats in the s_skin


say
SRB2Wiki said:
name = Idreia
ability = CA_DOUBLEJUMP
ability2 = CA2_NONE
normalspeed = 36
thrustfactor = 3
accelstart = 112
acceleration = 42
startcolor = 200
prefcolor = Azure
jumpfactor = 1


but instead of ability is CA_DOUBLEJUMP, it says

me said:
name = Idreia
ability = CA_DOUBLEJUMP|CA_AIRDRILL
ability2 = CA2_SPINDASH|CA2_TWINSPIN

And you can switch between actions with custom1
If custom 1 is pressed, it changes it to the next entry, but if it is already on the last entry, it resets itself to the first one
 
I've made something like that for a Superstar Saga Mario Bros. project of mine... I could share it with you
 
Solution

I have something that should work.
Code:
//In this example, p is the player

addHook("PlayerThink", function(p)
    if (p.mo) and (p.mo.skin == "sonic") //Or something else
        if (p.cmd.buttons & BT_CUSTOM1) and (p.pressc1 == true) then //If pressing C1
            if not (p.pflags & PF_THOKKED)
                p.pressc1 = false //We probably want this to run only once per C1 press
                p.pflags = p.pflags + PF_THOKKED
                if (p.charability == CA_DOUBLEJUMP) then 
                    p.charability = CA_AIRDRILL
                else
                    p.charability = CA_DOUBLEJUMP
                end
            end
        end
        if not (p.cmd.buttons & BT_CUSTOM1) then //If NOT pressing C1
            p.pressc1 = true //You can now press it again
        end
    end
end)
It only works for 1 skin and once per C1 press.
Also you cannot use this if you have used your ability and if you use it, you can't use your ability until you touch the ground.
 
Thanks! I might try it, and if it does work, then I might be able to use it for something, thank you for the code!
 

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

Back
Top