Help with ability switching lua

Status
Not open for further replies.

rocklight124

An Avenger
i am trying to make a switch for a character so they can have a different ability's like the
homing thok but i can't get the
action speed change and then revert to normal




addHook("ThinkFrame", do
for player in players.iterate
if (player.cmd.buttons & BT_CUSTOM2)
and (player.mo and player.mo.skin == "fsonic")
then player.charability = CA_HOMINGTHOK

end
end
end)
 
Alright, what you need to do is store the previous state of BT_CUSTOM2 inside the player, and then only switch the ability if BT_CUSTOM2 is being pressed but wasn't being pressed the previous frame. Then, you can check to see if player.charability is CA_THOK before changing to CA_HOMINGTHOK, and if not then to set it to CA_THOK.

You think you can handle that? I'll give further guidance if necessary.
 
ok

the action speed wont link up to it



addHook("ThinkFrame", do
for player in players.iterate
if (player.cmd.buttons & BT_CUSTOM2)
and (player.mo and player.mo.skin == "fsonic")
and not (player.panim == PA_JUMP)
and not (player.pflags & (PF_ROPEHANG|PF_CARRIED|PF_ITEMHANG|PF_MACESPIN))
and not (player.pflags & PF_SLIDING)
player.charability = CA_HOMINGTHOK
player.actionspd = 100*FRACUNIT

end
end
end)
 
AFAIK, actionspeed shouldn't be multiplied by fracunit.
 
Actually it SHOULD be multiplied by FRACUNIT in Lua. What might be going on is that Homing thok's speed is naturally weaker than regular Thok's. More specifically, it's three times weaker than Thok; so an actionspd of 100 gives Homing thok what would be around 33 for normal thok. So try multiplying your actionspd by 3?
 
Last edited:
ok this is my new line but it still does not work


addHook("ThinkFrame", do
for player in players.iterate
if (player.cmd.buttons & BT_CUSTOM2)
and (player.mo and player.mo.skin == "fsonic")
and not (player.panim == PA_JUMP)
and not (player.pflags & (PF_ROPEHANG|PF_CARRIED|PF_ITEMHANG|PF_MACESPIN))
and not (player.pflags & PF_SLIDING)
player.charability = CA_HOMINGTHOK
player.actionspd = 100
 
According to this script, when you press Custom 2, FSonic gets the homing attack as the new ability?

I think you want FSonic to DO the homing attack when pressing Custom 2, right?
 
No I'm pretty sure he just wants to change the ability to Homing thok, as he explained in a post above.

Question is, what about it doesn't work? does Homing thok not change speed?

(also you totally ignored my post it seems, actionspd does need the *FRACUNIT)
 
ok um Monster Iestyn what you said works but i just figured out that it wont work for just fsonic because of the lua that is already in him any suggestions
to increase the action speed of fsonic custom homing thok
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top