SRB2 Message Board

SRB2 Message Board (https://mb.srb2.org/index.php)
-   Editing Help (https://mb.srb2.org/forumdisplay.php?f=64)
-   -   Scriping help (https://mb.srb2.org/showthread.php?t=43584)

Bigadre 08-13-2018 09:09 AM

Scriping help
 
Code:

addHook("ThinkFrame", function()
        for player in players.iterate do
                if player.mo.skin ~= "Euphorica" then
                        continue
                       
                                        if not (player.cmd.buttons & BT_CUSTOM1) then
                        player.objspawntapready = true
                        player.objspawntapping = false
                elseif player.objspawntapready then
                        player.objspawntapping = true
                        player.objspawntapready = false
                else
                        player.objspawntapping = false
                end
 
                if player.objspawntapping then -- New line
                        player.spawnedspring = P_SpawnMobj(player.mo.x+FixedMul(0*FRACUNIT, cos(player.mo.angle)), -- New line
                                        player.mo.y+FixedMul(0*FRACUNIT, sin(player.mo.angle)), player.mo.z, MT_BLUESPRING)
                end -- New line
        end
end)

i may need help .-.

Rapidgame7 08-13-2018 12:06 PM

Quote:

Originally Posted by Bigadre (Post 801815)
i may need help .-.

With?

I assume you're getting an error - Before "end -- New line" an assignment operator is missing. If you're setting player.mo.y to something else, you need an equal sign instead of a plus before FixedMul.

EDIT after reading the reply below: haha whoops i don't know how did i miss that, my b

Zwip-Zwap Zapony 08-13-2018 01:28 PM

Quote:

Originally Posted by Rapidgame7 (Post 801816)
- I assume you're getting an error - Before "end -- New line" an assignment operator is missing. If you're setting player.mo.y to something else, you need an equal sign instead of a plus before FixedMul.

That line is part of the arguments for P_SpawnMobj in the above line. Note that in said "above line", there are 3 ('s but only 2 )'s, while in said "that line", there are 2 ('s but 3 )'s.
Regardless, both of the FixedMul's in the P_SpawnMobj multiply something by 0, so the entire FixedMul functions might as well just be removed (as well as the plusses in front of them).

Lach 08-13-2018 02:24 PM

Assuming this is a player ability for a Euphorica character, I think you may just be missing an "end" after "continue".

Also, player.mo.skin is always composed of lowercase letters, so you should un-capitalize "Euphorica" (replace it with "euphorica").

Bigadre 08-15-2018 01:35 PM

I'm just getting this error now:
WARNING: ./DOWNLOAD/Euphorica.wad|LUA_SPRI:22: ')' expected (to close '(' at line 1) near '<eof>'
Loading main config from ./DOWNLOAD/Euphorica.wad


Code:

addHook("ThinkFrame", function()
        for player in players.iterate do
                if player.mo.skin ~= "euphorica" then
                        continue
                                end
                       
                                        if not (player.cmd.buttons & BT_CUSTOM1) then
                        player.objspawntapready = true
                        player.objspawntapping = false
                elseif player.objspawntapready then
                        player.objspawntapping = true
                        player.objspawntapready = false
                else
                        player.objspawntapping = false
                end
 
                if player.objspawntapping then -- New line
                        player.spawnedspring = P_SpawnMobj(player.mo.x, -- New line
                                        player.mo.y, player.mo.z, MT_BLUESPRING)
                end -- New line
        end
end


Rumia1 08-15-2018 02:25 PM

You forgot your close parenthesis on the last "end".


All times are GMT. The time now is 05:00 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.