SRB2 Message Board

SRB2 Message Board (https://mb.srb2.org/index.php)
-   Editing Help (https://mb.srb2.org/forumdisplay.php?f=64)
-   -   Overriding the glide ability in CA_GLIDEANDCLIMB? (https://mb.srb2.org/showthread.php?t=48433)

JustHenbo 07-21-2020 05:21 PM

Overriding the glide ability in CA_GLIDEANDCLIMB?
 
I have an idea for an Espio character mod that has the ability to walk on walls and the ceiling.

I thought about using CA_GLIDEANDCLIMB as the primary character ability to simplify the process, as I am fairly new to coding, and somehow over-ride the the gliding part of the ability with a Lua script. Would such a feat be possible? Or would I have to rewrite the climb aspect as a new ability?

Goldenhog 07-22-2020 05:42 PM

It's definitely possible to commandeer the base character abilities.

Code:

addHook("AbilitySpecial", function(player)                --"AbilitySpecial" hooks when the "player" tries to use their jump+jump ability
        if player.charability == CA_GLIDEANDCLIMB        --check the player's ability
                return true                                --true: "don't run the rest of the ability code"
        end
end)

This would stop the gliding from working... though you'd need an additional check for walls or otherwise it also stops the climbing from working. Wall checks like that are unfortunately above my Lua level, but maybe someone else will chime in to help with that.

I kinda wanna know what'll you do with the sprites, though. It's gonna take a bunch of them.

JustHenbo 07-22-2020 09:13 PM

Thanks for that snippet of info! I'll give it a quick test and see if it does affect the climbing ability, but I suspect that it might from your descriptions of the code.

EDIT: Just realised I misread what you said about the additional check for walls. Like you said, hopefully someone will chime in with that information!

Quote:

I kinda wanna know what'll you do with the sprites, though. It's gonna take a bunch of them.
My initial idea for "climbing" the wall is basically a top-down view of him walking. But I haven't looked too closely at the amount required to fully animate the ability yet.


All times are GMT. The time now is 05:35 PM.

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