Help with this script

Julia

The only SRB2 and Touhou fan ever to exist lmao
When I run this script, it says "')' expected (to close '(' at line 1) near 'end'. Can anyone tell me what I need to do? I'm just starting Lua, mind you.

Legacy Homing Main script (note uses some modified code, this will be credited upon release!):
addHook("ThinkFrame", do
    for player in players.iterate
        if player.mo and player.mo.skin == "sonic" then
            player.charability = CA_HOMINGTHOK
            player.jumpfactor = 1*FRACUNIT + player.speed/150
            and player.speed < 50*FRACUNIT
                player.normalspeed = 40*FRACUNIT
            end
        end
    end
end)


addHook("ThinkFrame", do
    for player in players.iterate
        if player.mo and player.mo.skin == "sonic" then
            if player.pflags & PF_THOKKED
            and (not(player.homing))
            and player.powers[pw_super] == 0
                player.mo.state = S_PLAY_ROLL
            end
        end
    end
end)

addHook("ThinkFrame", do
    for player in players.iterate
        if player.mo and player.mo.skin == "sonic" then
            if player.pflags & PF_JUMPED
                player.mo.state = S_PLAY_ROLL
            end
        end
    end
end)
 
Im not a pro at lua, but the part down below should be changed
Lua:
addHook("ThinkFrame", do
    for player in players.iterate
        if player.mo and player.mo.skin == "sonic" then
            player.charability = CA_HOMINGTHOK
            player.jumpfactor = 1*FRACUNIT + player.speed/150
            and player.speed < 50*FRACUNIT
                player.normalspeed = 40*FRACUNIT
            end
        end
    end
end)

It should be changed to this


Lua:
addHook("ThinkFrame", do
    for player in players.iterate
        if player.mo and player.mo.skin == "sonic" then
            player.charability = CA_HOMINGTHOK
            player.jumpfactor = 1*FRACUNIT + player.speed/150
         end
         if player.speed < 50*FRACUNIT
                player.normalspeed = 40*FRACUNIT
            end
        end
    end
end)
 
It's still complaining about line 1 not having a ) apparently.
Post automatically merged:

Ok, so I've rewritten it a bit to be a bit more condensed:

Legacy Homing Thok Script:
addHook("ThinkFrame", function(player)
    for player in players.iterate
        if player.mo and player.mo.skin == "sonic" then
            player.charability = CA_HOMINGTHOK
            end
            
        if player.mo and player.mo.skin == "sonic" then
            if player.pflags & PF_THOKKED
            and (not(player,homing))
                player.mo.state = S_PLAY_ROLL
                end
                
        if player.mo and player.mo.skin == "sonic" then
            if player.pflags & PF_JUMPED
                player.mo.state = S_PLAY_JUMP
                end
            end
        end
    end
end)

Even still, it says, according to the log, "WARNING: CL_LegacyHoming-v1.wad|LUA_MAIN:9: ')' expected near ','."
Makes me think line 9 is the suspect right now.
 
Last edited:
It's still complaining about line 1 not having a ) apparently.
Post automatically merged:

Ok, so I've rewritten it a bit to be a bit more condensed:

Legacy Homing Thok Script:
addHook("ThinkFrame", function(player)
    for player in players.iterate
        if player.mo and player.mo.skin == "sonic" then
            player.charability = CA_HOMINGTHOK
            end
          
        if player.mo and player.mo.skin == "sonic" then
            if player.pflags & PF_THOKKED
            and (not(player,homing))
                player.mo.state = S_PLAY_ROLL
                end
              
        if player.mo and player.mo.skin == "sonic" then
            if player.pflags & PF_JUMPED
                player.mo.state = S_PLAY_JUMP
                end
            end
        end
    end
end)

Even still, it says, according to the log, "WARNING: CL_LegacyHoming-v1.wad|LUA_MAIN:9: ')' expected near ','."
Makes me think line 9 is the suspect right now.
I think it's the parentheses in the condition:
Line 9:
            and (not(player,homing))
I think this will work:
Line 9:
            and not (player,homing)

Could also add a then to the end.
EDIT: Overall, "(player,homing)" seems weird. What were you trying to do with that?
 

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

Back
Top