whatdoitypehere75
I just exist
Im trying to find a way to thrust the character up, but I dont understand the code. I found A_ZThrust but i dont understand it, and i dont think its lua.
Last edited:
Thx for the help!A_ZThrust is a SOC action, not Lua, but Lua can use SOC actions. The Actions page on the Wiki describes how.
local function ThrustUp(player)
P_SetObjectMomZ(player.mo, 12*FRACUNIT, false)
return true
end
addHook("AbilitySpecial", ThrustUp)
Thx for telling me!Ability example:local function ThrustUp(player) P_SetObjectMomZ(player.mo, 12*FRACUNIT, false) return true end addHook("AbilitySpecial", ThrustUp)
Don't bother with SOC actions when Lua already has a function that does (approximately) the same thing. P_SetObjectMomZ makes the player launch up at a speed of 12 FRACUNITs when they use their ability. You can change the launch speed by changing the number, and whether it'll "add" to your current momentum or replace it by changing the "false" to a true.
https://wiki.srb2.org/wiki/Lua/Functions The wiki page has a detailed explanation on what each function does.
Keep in mind this code will replace EVERY character's ability, so you'll have to make sure player.mo.skin matches first. Or you can just put that line in another hook instead of AbilitySpecial, your call.