SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 1 Week Ago   #1
Pizza
 
Pizza's Avatar
Default Some more questions

How do i make flight in lua ?

How do i disable super color and make super form not drain rings

How do i add a cap to an energy bar

How do i make an ability to charge the energy bar

Lastly how do i make so flight drains said energy bar

all of this is for a character lua I'm making

I will give credit to however can help me answer these questions
Pizza is offline   Reply With Quote
Old 6 Days Ago   #2
Rapidgame7
bzzzzzzzzzzzzzzzzzzzzz
 
Rapidgame7's Avatar
Default


Quote:
Originally Posted by Pizza View Post
How do i make flight in lua ?
If you want to use the game's flight, set the player's charability to CA_FLY, then adjust actionspd as neccesary.
If you don't want to use the native way, just set the player object's momz to something positive to send the player upwards.


Quote:
Originally Posted by Pizza View Post
How do i disable super color and make super form not drain rings
Natively, you can't prevent super color nor disable the ring cost.
You can fake it by force setting the player object's color to something and giving one ring to the player on the following condition:
Code:
player.powers[pw_super] > 0 and player.powers[pw_super] % TICRATE == 0
Otherwise, you can fake super.


Quote:
Originally Posted by Pizza View Post
How do i add a cap to an energy bar
(assuming "player.energy" holds the player's energy, and "cap" is the maximum value it can reach...)
Just prevent it from increasing once your energy variable is past some value.
if player.energy < cap should do the trick.
You can also use the min function to clamp the value if it goes past the limit, like so:
player.energy = min($, cap)


Quote:
Originally Posted by Pizza View Post
How do i make an ability to charge the energy bar
Uh... that one is very open ended. There are multiple ways to get what you want and lots of factors I don't know.
Just increase your energy variable when something happens?


Quote:
Originally Posted by Pizza View Post
Lastly how do i make so flight drains said energy bar
If using native flight,
if player.panim == PA_ABILITY then player.energy = $-(some value) end
Change the check if that's not the case.



Make sure to keep an eye to the Lua section of the SRB2 Wiki and this Lua tutorial.
__________________


taking a break.
Rapidgame7 is offline   Reply With Quote
Old 6 Days Ago   #3
Pizza
 
Pizza's Avatar
Default

Thank you i'll try it soon
Pizza is offline   Reply With Quote
Old 6 Days Ago   #4
Pizza
 
Pizza's Avatar
Default

I require an example for the first question

Questions 2 and 3 and 4 worked

All is left is flight
Pizza is offline   Reply With Quote
Old 6 Days Ago   #5
Rapidgame7
bzzzzzzzzzzzzzzzzzzzzz
 
Rapidgame7's Avatar
Default

Quite literally player.charability and player.actionspd, respectively.
One takes an integer denoting ability, which the constant CA_FLY provides, and the other also takes an integer on fixed point, which for this ability it would be flight speed.
Code:
player.charability = CA_FLY -- the player can now fly
player.actionspd = 100*FRACUNIT -- Tails' default actionspd
Or you can do it the hard way by forcing the player object's momentum to something else.
Code:
player.mo.momz = 10*FRACUNIT -- This would send the player upwards
Use one or the other, not both, or you'll get unexpected behaviour. Probably.
__________________


taking a break.
Rapidgame7 is offline   Reply With Quote
Old 6 Days Ago   #6
Pizza
 
Pizza's Avatar
Default

Sorry i forgot to tell you
I figure it out sorry
Pizza 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 11:01 AM.


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