Goldenhog
Wandering Protagonist
Yup.
The best way to learn something is to go all-out, in my opinion. Even though making this was easier than I anticipated(until the point where I am at now, at least), I learned many things about Lua, how it works and how to do stuff with it to use in SRB2. But I'm yet no Lua master and I need help. This wouldn't be in Editing otherwise, right?
Enter the Gravity Shield. Press Spin while jumping to switch from regular gravity to reverse gravity and vice-versa. Following 2.1's steps, this shield has a unique look(compared to the other 2.1 shields anyway) and I made it so that the arrows that appear and the shield itself change color depending on the user's current gravity.
It behaves like the other shields do(for the most part) - it follows you around, it becomes invisible while you're invulnerable, it goes away if you pick up another shield or go super, it makes other shields go away when you pick it up, and you lose it when an enemy hits you.
However, if I intend to put it in Submissions, and I do, there are still some issues that need to be fixed, and I'm gonna need help since some stuff here won't work like I want it to no matter how hard I try:
The best way to learn something is to go all-out, in my opinion. Even though making this was easier than I anticipated(until the point where I am at now, at least), I learned many things about Lua, how it works and how to do stuff with it to use in SRB2. But I'm yet no Lua master and I need help. This wouldn't be in Editing otherwise, right?
Enter the Gravity Shield. Press Spin while jumping to switch from regular gravity to reverse gravity and vice-versa. Following 2.1's steps, this shield has a unique look(compared to the other 2.1 shields anyway) and I made it so that the arrows that appear and the shield itself change color depending on the user's current gravity.
It behaves like the other shields do(for the most part) - it follows you around, it becomes invisible while you're invulnerable, it goes away if you pick up another shield or go super, it makes other shields go away when you pick it up, and you lose it when an enemy hits you.
However, if I intend to put it in Submissions, and I do, there are still some issues that need to be fixed, and I'm gonna need help since some stuff here won't work like I want it to no matter how hard I try:
- I've been trying to use MF2_OBJECTFLIP instead of pw_gravityboots for the reverse gravity effect, but it refuses to work. I wouldn't mind so much if I didn't have to use that blue arrow icon on the top of the screen.
- In order for it to fully act like a shield, it needs to take the hit for the player, like all the other shields do. I can't do it! D: - What I had in mind is using the hook ShouldDamage anytime the player hits anything, then checking if the object the player collided into has a flag that says it's harmful(MF_ENEMY, MF_PAIN, MF_BOSS, etc) and then using P_DoPlayerPain while taking the shield away and restoring gravity. But I don't think it's possible to have ShouldDamage run every time the player collides with something.
- You switch to reverse gravity with Spin, and back to normal with Custom 1. I tried having both use Spin, but when I do then neither works!
- Possibly related to the previous one, I want the player to only be able to change gravity once per jump. Right now you can just mash Spin and Custom 1 and stay in the same spot forever. I tried adding a variable that gets switched on if the player switches gravity(thus making him unable to change gravity anymore) and only switches off when the player touches the floor. Nope, that also makes neither gravity switch button work for some reason.
- If the player dies while wielding the Gravity Shield, this message appears in the console: WARNING: luatest.lua:65: accessed mobj_t doesn't exist anymore, please check 'valid' before using mobj_t. I know what's causing it, I've bolded it below, but I have no idea how to fix it.
- All of these now have been taken care of. Thanks to RedEnchilada for all the help given so far.
Last edited: