addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "h.r"
if player.pflags == $2|PF_STARTJUMP|PF_STARTDASH
player.mo.state = S_PLAY_JUMP
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
P_SpawnThokMobj(player)
end
end)
$2
isn't a thing. What you're probably looking for is $1
. So change if player.pflags == $2|PF_STARTJUMP|PF_STARTDASH
to if player.pflags == $1|PF_STARTJUMP|PF_STARTDASH
.$1
in a variable assignment or comparison is a shorthand for the variable you're making the comparison with.if player.pflags == $1|PF_STARTJUMP|PF_STARTDASH
is effectively the same as typing if player.pflags == player.pflags|PF_STARTJUMP|PF_STARTDASH
.$1|PF_STARTJUMP|PF_STARTDASH
is correct syntax. I could be wrong, but I believe it should be $1 & PF_STARTJUMP|PF_STARTDASH
.addHook("PlayerThink", function(player)
if player.mo and player.mo.skin == "h.r"
if player.pflags == $1 & PF_STARTJUMP|PF_STARTDASH
player.mo.state = S_PLAY_JUMP
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
P_SpawnThokMobj(player)
end
end)
I'm an absolute buffoon and I couldn't be more wrong.As far as I'm aware$2
isn't a thing. What you're probably looking for is$1
. So changeif player.pflags == $2|PF_STARTJUMP|PF_STARTDASH
toif player.pflags == $1|PF_STARTJUMP|PF_STARTDASH
.
In SRB2's Lua, using$1
in a variable assignment or comparison is a shorthand for the variable you're making the comparison with.
So typingif player.pflags == $1|PF_STARTJUMP|PF_STARTDASH
is effectively the same as typingif player.pflags == player.pflags|PF_STARTJUMP|PF_STARTDASH
.
On a sidenote I'm not sure if$1|PF_STARTJUMP|PF_STARTDASH
is correct syntax. I could be wrong, but I believe it should be$1 & PF_STARTJUMP|PF_STARTDASH
.
$1
) in this case for some reason. If someone else knows why I'd love to know but anyway:$1
to player.pflags
.I've went ahead and tested this out myself anyway (changingOn a sidenote I'm not sure if $1|PF_STARTJUMP|PF_STARTDASH is correct syntax. I could be wrong, but I believe it should be$1 & PF_STARTJUMP|PF_STARTDASH
.
$1
to player.pflags
) and I didn't run into any errors with either form, so I suppose it is correct syntax.Gave the same error.Lua:addHook("PlayerThink", function(player) if player.mo and player.mo.skin == "h.r" if player.pflags == $1 & PF_STARTJUMP|PF_STARTDASH player.mo.state = S_PLAY_JUMP P_SetObjectMomZ(player.mo, 15*FRACUNIT) P_SpawnThokMobj(player) end end)
This is what it's supposed to be like.
Let me give it a try, am sure this won't error for me.Gave the same error.
Did it work?Let me give it a try, am sure this won't error for me.
Post automatically merged:
It did, werid.
No it didn'tDid it work?
Oh then try to fix it.No it didn't
Well alright, I could revamped it. Let me try.Oh then try to fix it.
When i executed it, it messed up and i didnt press jump and spin and it go upwards forever bruh not helpfulGod. Please just use player.pflags & PF_STARTDASH|PF_STARTJUMP
Its the correct way and please dont spread (probably) misinformation.
Well I have no idea.When i executed it, it messed up and i didnt press jump and spin and it go upwards forever bruh not helpful
Actually its your problem. PF_STARTDASH is when you spindash. PF_STARTJUMP is when you jumped and didnt release jump yet to cut it. Basically the thing wont work unless you set them specifically.When i executed it, it messed up and i didnt press jump and spin and it go upwards forever bruh not helpful
But how would it look like?Actually its your problem. PF_STARTDASH is when you spindash. PF_STARTJUMP is when you jumped and didnt release jump yet to cut it. Basically the thing wont work unless you set them specifically.
If you want to check if you pressed jump and spin then maybe use SpinSpecial with a check if you have PF_JUMPED flag.
if you want to know more about pflags then just check the wiki
But how would it look like?
addHook("SpinSpecial",function(player)
if player.valid
and player.mo.skin == "h.r"
and player.pflags & PF_JUMPED
player.mo.state = S_PLAY_JUMP
P_SetObjectMomZ(player.mo, 15*FRACUNIT)
P_SpawnThokMobj(player)
end
end)
It does the same thing.Could be cool if you checked the wiki a bit more and learned some more stuff.Lua:addHook("SpinSpecial",function(player) if player.valid and player.mo.skin == "h.r" and player.pflags & PF_JUMPED player.mo.state = S_PLAY_JUMP P_SetObjectMomZ(player.mo, 15*FRACUNIT) P_SpawnThokMobj(player) end end)
Then no idea. I have no idea what you want to do.It does the same thing.
Ok then it's ok, so could u help me on making sparkles like super sonic that only works with the skin "h.r" and can kill enemies but not players with the skin "h.r" ?Then no idea. I have no idea what you want to do.
P_SpawnMobjFromMobj and P_RadiusAttack can help youOk then it's ok, so could u help me on making sparkles like super sonic that only works with the skin "h.r" and can kill enemies but not players with the skin "h.r" ?