how do you make a command initiated custom super form?

oli

Member
im trying to make a secret command initiated super form for my new character mania sonic (not approved yet) using a lua script but i dont know lua coding can anyone help (make it a bit like roll the dice deluxe idk)
 
Last edited:
i think i can help
ill give the script in conversation
ok this guy didn't answer for 15 days so I'll just do it myself.

There's a Lua function named P_DoSuperTransformation. I'm not sure if it's aimed at the player user data or the player mobj, but it basically sets the player's state into the transformation state, plays the sound and music, and just acts like a regular Super transformation. It also takes a second argument: true if you want to give 50 rings on call or false if not. It still has to check if you have all 7 emeralds. If not, it won't call.

However, if you want a soundless and musicless transformation, the player user data has two variables to help: issuper and powers. For issuper, I think you have to set it to true (try setting it to 1 if true doesn't work). powers, however, is an table that has multiple variables that affect how the player acts in the map. It has pw_super, a variable used internally to count how many tics the player was in super. To point to pw_super, use player.powers[pw_super].

So to properly create a function to turn the player super but silently, use this code:
function goSuperSilent(player)
player.issuper = true // Player goes super
player.powers[pw_super] = 1 // Player is super for 1 tic
end

However, you have only created the function. To assign it to a command, use this code:
COM_AddCommand("gosupersilent", goSuperSilent())

All of the code combined creates a command called gosupersilent that uses the function goSuperSilent. If you want a version that uses the P_DoSuperTransformation function (with ring give), assign it to a command called gosuperloud or just gosuper: depends on your preferences.

If you have any errors, reach out. Though I swear I'm not THAT experienced in Lua, I just like reading the SRB2 Wiki.
 
  • Cool!
Reactions: oli
ok this guy didn't answer for 15 days so I'll just do it myself.

There's a Lua function named P_DoSuperTransformation. I'm not sure if it's aimed at the player user data or the player mobj, but it basically sets the player's state into the transformation state, plays the sound and music, and just acts like a regular Super transformation. It also takes a second argument: true if you want to give 50 rings on call or false if not. It still has to check if you have all 7 emeralds. If not, it won't call.

However, if you want a soundless and musicless transformation, the player user data has two variables to help: issuper and powers. For issuper, I think you have to set it to true (try setting it to 1 if true doesn't work). powers, however, is an table that has multiple variables that affect how the player acts in the map. It has pw_super, a variable used internally to count how many tics the player was in super. To point to pw_super, use player.powers[pw_super].

So to properly create a function to turn the player super but silently, use this code:
function goSuperSilent(player)
player.issuper = true // Player goes super
player.powers[pw_super] = 1 // Player is super for 1 tic
end

However, you have only created the function. To assign it to a command, use this code:
COM_AddCommand("gosupersilent", goSuperSilent())

All of the code combined creates a command called gosupersilent that uses the function goSuperSilent. If you want a version that uses the P_DoSuperTransformation function (with ring give), assign it to a command called gosuperloud or just gosuper: depends on your preferences.

If you have any errors, reach out. Though I swear I'm not THAT experienced in Lua, I just like reading the SRB2 Wiki.
I did in conversation with the guy
 
I did in conversation with the guy
calm down bro
Post automatically merged:

ok this guy didn't answer for 15 days so I'll just do it myself.

There's a Lua function named P_DoSuperTransformation. I'm not sure if it's aimed at the player user data or the player mobj, but it basically sets the player's state into the transformation state, plays the sound and music, and just acts like a regular Super transformation. It also takes a second argument: true if you want to give 50 rings on call or false if not. It still has to check if you have all 7 emeralds. If not, it won't call.

However, if you want a soundless and musicless transformation, the player user data has two variables to help: issuper and powers. For issuper, I think you have to set it to true (try setting it to 1 if true doesn't work). powers, however, is an table that has multiple variables that affect how the player acts in the map. It has pw_super, a variable used internally to count how many tics the player was in super. To point to pw_super, use player.powers[pw_super].

So to properly create a function to turn the player super but silently, use this code:
function goSuperSilent(player)
player.issuper = true // Player goes super
player.powers[pw_super] = 1 // Player is super for 1 tic
end

However, you have only created the function. To assign it to a command, use this code:
COM_AddCommand("gosupersilent", goSuperSilent())

All of the code combined creates a command called gosupersilent that uses the function goSuperSilent. If you want a version that uses the P_DoSuperTransformation function (with ring give), assign it to a command called gosuperloud or just gosuper: depends on your preferences.

If you have any errors, reach out. Though I swear I'm not THAT experienced in Lua, I just like reading the SRB2 Wiki.
This is really useful thanks
 
Last edited:

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

Back
Top