addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "sonic"
if (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround)
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end
end)
addHook("ThinkFrame", function()
for player in players.iterate do
if player.mo.skin ~= "sonic" then
continue
end
if not (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround) then
player.test = true
player.lua = false
elseif player.test then
player.lua = true
player.test = false
else
player.lua = false
end
if player.lua then
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end
end)
enjoy
if dont want activate that skill in some situations put this
if (player.powers[pw_carry] & CR_ROLLOUT) then
player.lua = false
end
that prevent use the custom in the mobile rock in red volcano.
addHook("ThinkFrame", function()
for player in players.iterate do
if player.mo.skin ~= "sonic" then
continue
end
if not (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround) then
player.test = true
player.lua = false
elseif player.test then
player.lua = true
player.test = false
else
player.lua = false
end
if player.lua then
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
if (player.powers[pw_carry] & CR_ROLLOUT) then
player.lua = false
end
end
end)
Post automatically merged:
that is each time you use the button example you want do 2 jumps so press custom 2 2 times
that is 1 press lua.
if you want more prevent just copy rock negate one and replace for
other thing example (player.mo.state == S_PLAY_JUMP)
that negate the skill press button if jump.
addHook("ThinkFrame", function()
for player in players.iterate do
if player.mo.skin ~= "sonic" then
continue
end
if not (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround) then
player.test = true
player.lua = false
elseif player.test then
player.lua = true
player.test = false
else
player.lua = false
end
if player.lua then
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end
end)
enjoy
if dont want activate that skill in some situations put this
if (player.powers[pw_carry] & CR_ROLLOUT) then
player.lua = false
end
that prevent use the custom in the mobile rock in red volcano.
addHook("ThinkFrame", function()
for player in players.iterate do
if player.mo.skin ~= "sonic" then
continue
end
if not (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround) then
player.test = true
player.lua = false
elseif player.test then
player.lua = true
player.test = false
else
player.lua = false
end
if player.lua then
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
if (player.powers[pw_carry] & CR_ROLLOUT) then
player.lua = false
end
end
end)
Post automatically merged:
that is each time you use the button example you want do 2 jumps so press custom 2 2 times
that is 1 press lua.
if you want more prevent just copy rock negate one and replace for
other thing example (player.mo.state == S_PLAY_JUMP)
that negate the skill press button if jump.
addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "sonic"
if (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround)
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end
end)
First of all, you should really explain what exactly you're trying to do and what is the intended behavior. I can kinda sorta work out what this might be trying to do but I can't be certain unless you yourself explain what you're trying to do with this.
Which brings me to the other point... "Once" is a little too vague for this. Once per jump? Once in the water? Once in the air (not exactly the same as once per jump)?
I say this because while P_IsObjectOnGround implies you only want to this while the player is on the ground, P_SetObjectMomZ implies you want to shoot the player upwards so this should only work once anyway.
That being said...
Fix:
addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "sonic" then
if (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround(player.mo)) then
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end
end)
The way you're using P_IsObjectOnGround is wrong. To save you from highly technical stuff, you weren't calling the function (done like so: P_IsObjectOnGround()). On top of that, the function call has a parameter mobj (in your case, the player mobj) that needs to be passed, so even if you called it without anything it'd not work at best and give a console warning at worst.
First of all, you should really explain what exactly you're trying to do and what is the intended behavior. I can kinda sorta work out what this might be trying to do but I can't be certain unless you yourself explain what you're trying to do with this.
Which brings me to the other point... "Once" is a little too vague for this. Once per jump? Once in the water? Once in the air (not exactly the same as once per jump)?
I say this because while P_IsObjectOnGround implies you only want to this while the player is on the ground, P_SetObjectMomZ implies you want to shoot the player upwards so this should only work once anyway.
That being said...
Fix:
addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "sonic" then
if (player.cmd.buttons & BT_CUSTOM2)
and not (player.pflags & PF_JUMPED or player.pflags & PF_SPINNING)
and (P_IsObjectOnGround(player.mo)) then
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end
end)
The way you're using P_IsObjectOnGround is wrong. To save you from highly technical stuff, you weren't calling the function (done like so: P_IsObjectOnGround()). On top of that, the function call has a parameter mobj (in your case, the player mobj) that needs to be passed, so even if you called it without anything it'd not work at best and give a console warning at worst.
addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "sonic"
and player.cmd.buttons & BT_CUSTOM2
and not (player.pflags & PF_THOKKED)
and not (player.pflags & PF_STASIS)
and not (player.pflags & PF_FULLSTASIS)
and (P_IsObjectOnGround(player))
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end)
And it's giving the error bad arugment #1 to 'P_IsObjectOnGround' (MOBJ_T* expected, got userdata)
addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "sonic"
and player.cmd.buttons & BT_CUSTOM2
and not (player.pflags & PF_THOKKED)
and not (player.pflags & PF_STASIS)
and not (player.pflags & PF_FULLSTASIS)
and (P_IsObjectOnGround(player))
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
end
end)
And it's giving the error bad arugment #1 to 'P_IsObjectOnGround' (MOBJ_T* expected, got userdata)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.