S_PLAY_CARRY
that indicated whether or not a player was being carried.addHook("PlayerThink", function(player)
if player.mo.state == S_PLAY_CARRY then
print("Player is being carried!")
end
end)
pw_carry
power:[...]
The values for carry types are as follows:
[...]
Value Name Description 0 CR_NONE Not being carried. 1 CR_GENERIC Generic, default case for miscellaneous objects. 2 CR_PLAYER Being carried by a flying Tails player. 3 CR_NIGHTSMODE The player is currently in NiGHTS mode. 4 CR_NIGHTSFALL The player has ran out of time in NiGHTS. 5 CR_BRAKGOOP Stuck in old Brak Eggman's goop. 6 CR_ZOOMTUBE Using a Zoom Tube. 7 CR_ROPEHANG Using a Rope Hang. 8 CR_MACESPIN Using a Mace swing. 9 CR_MINECART Using a Minecart. 10 CR_ROLLOUT Using a Rollout Rock. 11 CR_PTERABYTE Being carried by a Pterabyte. 12 CR_DUSTDEVIL Being carried by a Dust Devil.
if player.powers[pw_carry] & CR_PLAYER
;if player.powers[pw_carry] == 2
if you don't want to use the constants."PlayerThink"
or "ThinkFrame"
hook, which you'll probably be using anyway for your logic.Thanks, but I already got a way. But for some reason, I can't get player inputs...In SRB2 2.1 there used to be a player stateS_PLAY_CARRY
that indicated whether or not a player was being carried.
Such state is missing from the 2.2 list of states however since the wiki page says that it might be incomplete, I believe it's worth a shot trying it out anyway:
Lua: Checking for S_PLAY_CARRY state:addHook("PlayerThink", function(player) if player.mo.state == S_PLAY_CARRY then print("Player is being carried!") end end)
If this does not work then the state was probably renamed (I doubt it was removed because you can still be carried by Tails).
If this does work however, just beware that the player can be carried by more things than just Tails (Arid Canyon's belts for example). So you might have to throw a bit of extra logic in there to make sure it only works when a player object is carrying the player.
Thanks, but I already got a way. But for some reason, I can't get player inputs...
is custom 3, when i switch player.mo.tracer.player our with player, it works, but not with tracerWould you mind specifying what inputs you want to get? Is it movement inputs or jumping, spindash, custom1/2/3 inputs?
is custom 3, when i switch player.mo.tracer.player our with player, it works, but not with tracer
player
and the player from player.mo.tracer.player
(the last player in the line) as the same thing.addHook("PlayerThink", function(plyr)
-- Whatever code you had up to this point
-- "top level" player is now named plyr as defined in the function parameter.
if plyr.mo.tracer.player.cmd.buttons & BT_CUSTOM3 then
-- Player who is carrying this player is pressing/holding Custom 3
print("Custom 3 is being pressed!")
end
end)
well, it is already named as pI'm not 100% sure, this is an issue I never encountered before, but if I'd take a guess I think it could be because the code is interpreting the player fromplayer
and the player fromplayer.mo.tracer.player
(the last player in the line) as the same thing.
If it's not too much trouble could you rename the player in your hooked function to something else? To anything really.
Do make sure the change any reference to it to the new name you gave it. Liiike so:
Lua:addHook("PlayerThink", function(plyr) -- Whatever code you had up to this point -- "top level" player is now named plyr as defined in the function parameter. if plyr.mo.tracer.player.cmd.buttons & BT_CUSTOM3 then -- Player who is carrying this player is pressing/holding Custom 3 print("Custom 3 is being pressed!") end end)
No actually, when 2.2 was released. S_PLAY_CARRY was renamed to S_PLAY_RIDE, meaning that you're still able to use that sprite for things.In SRB2 2.1 there used to be a player stateS_PLAY_CARRY
that indicated whether or not a player was being carried.
Such state is missing from the 2.2 list of states however since the wiki page says that it might be incomplete.