Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Venom and Shield Attack Script

DeladanDeladan Posts: 647Member ✭✭✭✭ - Eminent
http://pastebin.com/p7dYnGEK


let me know what revisions can be made, it is works for arms and legs right now, adding the head and torso in would not be hard. 

Comments

  • KenwayKenway San FranciscoPosts: 1,130Member @@ - Legendary Achaean
    You can't envenom with notechis.

    - Limb Counter - Fracture Relapsing -
    "Honestly, I just love that it counts limbs." - Mizik Corten
    Antidas
  • AmranuAmranu Posts: 725Member ✭✭✭✭ - Eminent
    edited May 2015
    You should be using functions to reduce code repetition.

    This entire script uses functions yet is simply what should be perhaps three-four functions in 16 separate ones, repeating the exact same code -several- times.

    Combine all rightarm() etc function into a venomSelect() function
    Combine all rightarmAttack() etc functions into a general combination() function
    Combine all keyCountern() functions into one keyCounter() function
    Combine all KeyCounterResetn() functions into one keyCounterReset() function
  • DeladanDeladan Posts: 647Member ✭✭✭✭ - Eminent
    @Amranu  so I'd do something like this 

    function keyCounterFunction(num)

    keyCounter(num) = keyCounter(num) + 1

    if keyCounter(num) > 5

    then keyCounter(num) = 1

    end

    return keyCounter(num)

    end


    with the variable being 

    keyCounter = {}


    and to call it in the keypad+4 

    I'd do something like

    keyCounterFunction(4)

    leftLeg()

    LeftLegAttack()


    right. 


  • DeladanDeladan Posts: 647Member ✭✭✭✭ - Eminent
    Then I have to initialize the keyCounter variable itself in a script. Which I don't exactly know the best place to initialize it at. 

  • DeladanDeladan Posts: 647Member ✭✭✭✭ - Eminent
    Basically I couldn't decide where to throw the initalization of the variable for the keyCounter at. and I think I might could take out some of the stuff if I added in something like 

    keypad+4

    keyCounterFunction(4)
    leftLeg()
    leftLegAttack()
    limbAttack = "left leg"

    and follow through for the rest of the limbs 

    then I'd be able to cut down all of these leftLeg rightLeg ect attack functions into: 

    function limbAttack()

    if shieldAttack then

    sendAll("clearqueue all",

    "queue add eqbal combination " .. target .. " slice " ..limbAttack..  " " ..venom.. " " ..shieldAttack)

    else

    sendAll("clearqueue all",

    "queue add eqbal combination " .. target .. " slice " ..venom.. "smash")

    end

    end



  • AmranuAmranu Posts: 725Member ✭✭✭✭ - Eminent
    You can just put it in a seperate script.
    You could have "Attack variables" and put all your variables in there, and then "Attack functions" and put the functions down there.

    That's another thing, there's absolutely no reason to be defining your vtab Table 4 times, just throw it in a "vtab Table" script
  • AmranuAmranu Posts: 725Member ✭✭✭✭ - Eminent
    Also instead of having a complex toggle for your shield attacks, just have each key/alias that toggles change a shieldAttack variable that you feed into the combination function in your attack keybinds.

    So:
    F6
    keyCounter(6)
    combination("left leg", venomSelect(), shieldAttack)

    Where venomSelect returns a venom name to be used by combination and shield attack would be "drive" or "smash" and modified by whatever toggle you pressed last.
  • DeladanDeladan Posts: 647Member ✭✭✭✭ - Eminent
    This right ?

    limbTargeted = "left leg"
    keyCounterFunction(4)
    leftLeg()
    limbAttack()



    function keyCounterFunction(num)
    keyCounter(num) = keyCounter(num) + 1 
    if keyCounter(num) > 5
    then keyCounter(num) = 1
    end
    return keyCounter(num)
    end

    function leftLeg()

    if keyCounter(4) == 1 and high == 1 
    then venom = vTab["c"]
    elseif keyCounter(4) == 2 and high == 1
    then venom = vTab["a"]
    elseif keyCounter(4) == 3 and high == 1
    then venom = vTab["k"]
    elseif keyCounter(4) == 4 and high == 1 
    then venom = vTab["k"]
    elseif keyCounter(4) == 5 and high == 1
    then venom = vTab["a"]
    elseif keyCounter(4) == 1 and low == 1 
    then venom = vTab["c"]
    elseif keyCounter(4) == 2 and low == 1
    then venom = vTab["h"]
    elseif keyCounter(4) == 3 and low == 1
    then venom = vTab["i"]
    elseif keyCounter(4) == 4 and low == 1 
    then venom = vTab["c"]
    elseif keyCounter(4) == 5 and low == 1
    then venom = vTab["i"]
    elseif keyCounter(4) == 1 and drive == 1 
    then venom = vTab["c"]
    elseif keyCounter(4) == 2 and drive == 1
    then venom = vTab["a"]
    elseif keyCounter(4) == 3 and drive == 1
    then venom = vTab["n"]
    elseif keyCounter(4) == 4 and drive == 1 
    then venom = vTab["n"]
    elseif keyCounter(4) == 5 and drive == 1
    then venom = vTab["c"]
    elseif keyCounter(4) == 1 and trip == 1 
    then venom = vTab["m"]
    elseif keyCounter(4) == 2 and trip == 1
    then venom = vTab["f"]
    elseif keyCounter(4) == 3 and trip == 1
    then venom = vTab["m"]
    elseif keyCounter(4) == 4 and trip == 1 
    then venom = vTab["f"]
    elseif keyCounter(4) == 5 and trip == 1
    then venom = vTab["m"]
    elseif mid == 1 
    then venom = ""
    else
      vTab = {
                    a       = "aconite",                    
                    b       = "epseth",                     
                    c       = "curare",                     
                    d       = "darkshade",          
                    e       = "digitalis",          --shyness
                    f       = "gecko",                      --slickness
                    g       = "euphorbia",          --vomitting
                    h       = "eurypteria",                 --recklessness
                    i       = "vernalius",          --weakness
                    j       = "kalmia",                     --asthma
                    k       = "larkspur",           --dizziness
                    l       = "monkshood",          --disloyalty
                    m       = "epteth",                     --shivel arms
                    n       = "prefarar",           --sensitivity
                    o      = "notechis",           --haemophilia
                    p       = "vardrax",                    --addiction
                    q       = "slike",                      --anorexia
                    r       = "selarnia",           --animal spirit disruption
                    s       = "xentio",                     --clumsiness
            }
    end
    end

    function limbAttack()
    if shieldAttack then 
    sendAll("clearqueue all",
    "queue add eqbal combination " .. target .. " slice " ..limbTargeted.. " " ..venom.. " " ..shieldAttack)
     else
    sendAll("clearqueue all",
    "queue add eqbal combination " .. target .. " slice " ..venom.. "smash")
    end
    end

  • AmranuAmranu Posts: 725Member ✭✭✭✭ - Eminent
    You shouldn't be defining vtab inside of a function, nevermind an if statement.

Sign In to Comment.