Results 1 to 2 of 2

Thread: Lat's Lua catastrophes...

  1. #1
    Join Date
    March 3rd, 2013
    Location
    In France, I believe.
    Posts
    575
    Level
    38

    Lat's Lua catastrophes...

    I am soooo pro in Lua, I got a 11/10 of IGN :O


    Anyways, I am currently editing my Buffgauge for reasons that you may know if you spent 2 seconds of watching the last image but meh, I cannot get it work properly.


    The Hud Drawing functions works properly, but the problem is actually the buffes themselves. The buffes do not affect the player stats. I firstly thought that this was because of repeating some "addHook" thingies, so I put them in separates lumps but meh.


    Here are the codes, for each level...


    Lvl 1
    Code:
    addHook("ThinkFrame", do
        for player in players.iterate
            if not player.mo continue end
            if stplyr.mo.health >= 16
            and stplyr.mo.health < 31
            
                local pa = player.charability
                if pa == CA_THOK
                or pa == CA_HOMINGTHOK
                or pa == CA_JUMPBOOST
                or pa == CA_AIRDRILL
                or pa == CA_FALLSWITCH
                and not stplyr.powers [pw_super]
                    player.acceleration = 43
                    player.accelstart = 103
                elseif pa == CA_FLY
                or pa == CA_SWIM
                or pa == CA_SLOWFALL
                or pa == CA_FLOAT
                or pa == CA_DOUBLEJUMP
                or pa == CA_TELEKINESIS
                or pa == CA_NONE
                and not stplyr.powers [pw_super]
                    player.jumpfactor = 78643
                elseif pa == CA_GLIDEANDCLIMB
                and not stplyr.powers [pw_super]
                    player.actionspd = 32 * FRACUNIT
                end
            else
                local pa = player.charability
                if pa == CA_THOK
                or pa == CA_HOMINGTHOK
                or pa == CA_JUMPBOOST
                or pa == CA_AIRDRILL
                    player.normalspeed = skins[player.mo.skin].normalspeed
                    player.acceleration = skins[player.mo.skin].acceleration
                    player.accelstart = skins[player.mo.skin].accelstart
                elseif pa == CA_FLY
                or pa == CA_SWIM
                or pa == CA_SLOWFALL
                or pa == CA_FLOAT
                or pa == CA_DOUBLEJUMP
                or pa == CA_TELEKINESIS
                    player.jumpfactor = skins[player.mo.skin].jumpfactor
                    player.acceleration = skins[player.mo.skin].acceleration
                    player.accelstart = skins[player.mo.skin].accelstart
                elseif pa == CA_GLIDEANDCLIMB
                    player.actionspd = skins[player.mo.skin].actionspd
                    player.normalspeed = skins[player.mo.skin].normalspeed
                end    
            end
        end
    end)

    Lvl2
    Code:
    addHook("ThinkFrame", do
        for player in players.iterate
            if not player.mo continue end
            
            if stplyr.mo.health >= 31
            and stplyr.mo.health < 61
                local pa = player.charability
                if pa == CA_THOK
                or pa == CA_HOMINGTHOK
                or pa == CA_JUMPBOOST
                or pa == CA_AIRDRILL
                or pa == CA_FALLSWITCH
                and not stplyr.powers [pw_super]
                    player.normalspeed = 42 * FRACUNIT
                    player.acceleration = 43
                    player.accelstart = 103
                elseif pa == CA_FLY
                or pa == CA_SWIM
                or pa == CA_SLOWFALL
                or pa == CA_FLOAT
                or pa == CA_DOUBLEJUMP
                or pa == CA_TELEKINESIS
                or pa == CA_NONE
                and not stplyr.powers [pw_super]
                    player.jumpfactor = 72643
                    player.acceleration = 55
                    player.accelstart = 210
                elseif pa == CA_GLIDEANDCLIMB
                and not stplyr.powers [pw_super]
                    player.actionspd = 32 * FRACUNIT
                    player.normalspeed = 40 * FRACUNIT
                end
            else
                local pa = player.charability
                if pa == CA_THOK
                or pa == CA_HOMINGTHOK
                or pa == CA_JUMPBOOST
                or pa == CA_AIRDRILL
                    player.normalspeed = skins[player.mo.skin].normalspeed
                    player.acceleration = skins[player.mo.skin].acceleration
                    player.accelstart = skins[player.mo.skin].accelstart
                elseif pa == CA_FLY
                or pa == CA_SWIM
                or pa == CA_SLOWFALL
                or pa == CA_FLOAT
                or pa == CA_DOUBLEJUMP
                or pa == CA_TELEKINESIS
                    player.jumpfactor = skins[player.mo.skin].jumpfactor
                    player.acceleration = skins[player.mo.skin].acceleration
                    player.accelstart = skins[player.mo.skin].accelstart
                elseif pa == CA_GLIDEANDCLIMB
                    player.actionspd = skins[player.mo.skin].actionspd
                    player.normalspeed = skins[player.mo.skin].normalspeed
                end
            end
        end
    end)

    LVL 3
    Code:
    addHook("ThinkFrame", do
        for player in players.iterate
            if not player.mo continue end
    
    
            if stplyr.mo.health >= 61        
                local pa = player.charability
                if pa == CA_THOK
                or pa == CA_HOMINGTHOK
                or pa == CA_JUMPBOOST
                or pa == CA_AIRDRILL
                or pa == CA_FALLSWITCH
                and not stplyr.powers [pw_super]
                    player.normalspeed = 46 * FRACUNIT
                    player.acceleration = 43
                    player.accelstart = 103
                elseif pa == CA_FLY
                or pa == CA_SWIM
                or pa == CA_SLOWFALL
                or pa == CA_FLOAT
                or pa == CA_DOUBLEJUMP
                or pa == CA_TELEKINESIS
                or pa == CA_NONE
                and not stplyr.powers [pw_super]
                    player.jumpfactor = 78643
                    player.acceleration = 55
                    player.accelstart = 210
                elseif pa == CA_GLIDEANDCLIMB
                and not stplyr.powers [pw_super]
                    player.actionspd = 37 * FRACUNIT
                    player.normalspeed = 40 * FRACUNIT
                end
            else
                local pa = player.charability
                if pa == CA_THOK
                or pa == CA_HOMINGTHOK
                or pa == CA_JUMPBOOST
                or pa == CA_AIRDRILL
                    player.normalspeed = skins[player.mo.skin].normalspeed
                    player.acceleration = skins[player.mo.skin].acceleration
                    player.accelstart = skins[player.mo.skin].accelstart
                elseif pa == CA_FLY
                or pa == CA_SWIM
                or pa == CA_SLOWFALL
                or pa == CA_FLOAT
                or pa == CA_DOUBLEJUMP
                or pa == CA_TELEKINESIS
                    player.jumpfactor = skins[player.mo.skin].jumpfactor
                    player.acceleration = skins[player.mo.skin].acceleration
                    player.accelstart = skins[player.mo.skin].accelstart
                elseif pa == CA_GLIDEANDCLIMB
                    player.actionspd = skins[player.mo.skin].actionspd
                    player.normalspeed = skins[player.mo.skin].normalspeed
                end
            end
        end
    end)

    They are basically edits of each others.
    Also note that the script worked properly when there was only one level set up
    And again, sorry if I made a stupid misstake, but we learn from our fail...


    (I will keep this thread for my other Lua cataclysms...
    Steam ID: Nymphali Festif | SRB2 Nickname: Lat' | Skype: superrainboom
    > "I'm a boy. What? You're laughing? ...Bitches, please, I'M FABULOUS! "

  2. #2
    Join Date
    March 25th, 2010
    Posts
    1,442
    Level
    58
    What's stplyr? Replacing stplyr with player fixes it.
    Quote Originally Posted by SRB2
    <Mystyc Cheez> I ****ING QUIT
    Mystyc Cheez left the game
    <~Sky> Am I too awesome or something?
    <X\Wind> Why is everyone on red...
    <X\Wind> Is Sky that awesome?
    Quote Originally Posted by Steam
    20:48 - Sky: one does not simply ban him
    20:49 - Wind: we must gather the chaos emeralds and blast him

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •