Modding Help I keep breaking the game with this sword... [KILLED THREAD/SOLVED]

Discussion in 'Starbound Modding' started by MetaFace, Oct 28, 2016.

  1. MetaFace

    MetaFace Guest

    I need someone who understands this lua far better than me. I'm making a sword and trying to make a alt ability that's based off the broadswordcombo. I realized the reason my sword didn't work with any abilities is because I wasn't modifying the animation file for the sword (and once I did I knew I did it wrong) and didn't know how, so now it's back to phase one where you can't use the sword due to my stupidity. Since I could never find an up to date tutorial on this, I hope you professionals could show a scrub how it's done.

    Really the ability here is just a place holder until I figure this out, my plan is to replace the third attack in the combo with a physicalshockwave that is far more powerful. Don't mind the size of the sprite or the broken hitbox, at this point the hitbox isn't my biggest issue.
     

    Attached Files:

  2. lazarus78

    lazarus78 The Waste of Time

    Look in your starbound.log for the error being thrown when the game crashes. It will point you in the right direction.
     
  3. MetaFace

    MetaFace Guest

    It says something is wrong in the weapon.lua and meleeweapon.lua, things I can't risk touching.
     
  4. lazarus78

    lazarus78 The Waste of Time

    Cant risk? What is the risk? You can just re-extract the assets.

    But anyhoo, the issue is probably more like your weapon is set up incorrectly so the lua is crapping out.
     
  5. Chofranc

    Chofranc Pangalactic Porcupine

    When it say that is because your customweapon is sending wrong parameters which mean that you have an error in one of your custom files, it doesn't meant that those 2 files have an error.
     
  6. MetaFace

    MetaFace Guest

    I know something is wrong with the weapon. I just don't know how to fix it. I got the sword ability to finally appear on the weapon, but I didn't know how to properly modify the animation file so it'd work, and the log instead of saying something is wrong with my weapon, says it's the weapon an meleeweapon.lua's fault. So I don't know where to go with it. Like I've said, done lua, but not this "level" of lua.
     
  7. lazarus78

    lazarus78 The Waste of Time

    Post your whole log so we can see the exact error.

    It will say what part of the Lua is failing thus you can trace it back to your weapon.
     
  8. MetaFace

    MetaFace Guest

    I don't have the log right now but I remember it saying error in line 245 in the weapon.lua for set.stance, and an error in the meleeweapon.lua at line 11. I screwed up at the stances in the animation file because I wasn't sure what was happening. I'll upload when I'm on the computer that has the files. If you need I can give the .animation and .weaponability files, those are where the error truly happens since I was just trying a new approach when I was trying to get the weapon ability to show on the weapon. It shows now, but you can no longer use the weapon because an error when it comes to stance.

    edit: Here is the error. Report

    Code:
    [20:35:29.257] [Error] Exception while calling script init: (LuaException) Error code 2, [string "/items/active/weapons/weapon.lua"]:245: attempt to index a nil value (local 'stance')
    stack traceback:
        [C]: in metamethod '__index'
        [string "/items/active/weapons/weapon.lua"]:245: in method 'setStance'
        [string "/items/active/weapons/melee/meleecombo.lua"]:11: in method 'init'
        [string "/items/active/weapons/weapon.lua"]:27: in method 'init'
        [string "/items/active/weapons/melee/meleeweapon.lua"]:23: in function <[string "/items/active/weapons/melee/meleeweapon.lua"]:5>
    [0] 10b513a Star::captureStack
    [1] 10b4058 Star::StarException::StarException
    [2] 1089d95 Star::LuaException::LuaException
    [3] 108ffe9 Star::LuaEngine::handleError
    [4] 11d9297 Star::LuaEngine::callFunction<>
    [5] 11dc083 Star::LuaFunction::invoke<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData> >
    [6] 153e12b Star::LuaContext::invokePath<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData> >
    [7] 153f3e8 Star::LuaBaseComponent::init
    [8] 11fe35e Star::LuaWorldComponent<Star::LuaBaseComponent>::init
    [9] 1503332 Star::ActiveItem::init
    [10] 13f91b6 Star::ToolUser::initPrimaryHandItem
    [11] 13f8ff1 Star::ToolUser::init
    [12] 12dbe5a Star::Player::init
    [13] 1469d2b Star::WorldClient::initWorld
    [14] 146819c Star::WorldClient::handleIncomingPackets
    [15] 1405f44 Star::UniverseClient::handlePackets
    [16] 1406f69 Star::UniverseClient::update
    [17] 1020bb6 Star::ClientApplication::updateRunning
    [18] 101f805 Star::ClientApplication::update
    [19] 15dcc1f Star::SdlPlatform::run
    [20] 15dce66 Star::runMainApplication
    [21] 10225bc WinMain
    [22] 16f6a66 __scrt_common_main_seh
    [23] 7762ef1c BaseThreadInitThunk
    [24] 77723648 RtlInitializeExceptionChain
    [25] 7772361b RtlInitializeExceptionChain
     
    Last edited by a moderator: Oct 31, 2016
  9. MetaFace

    MetaFace Guest

    I've actually fixed the sword as far as being able to use it, there was a missing section in the weapon ability for stances, now I just got to figure out how to make the final hit in the combo do the physicalshockwave (which as far as I can remember is the one that travels in both directions).

    Edit:
    I tried and failed, anyone have a clue how to make the third hit in the broadswordcombo do the physical shock wave that hammers have?
     
    Last edited by a moderator: Nov 2, 2016
  10. MetaFace

    MetaFace Guest

    I need to incorporate the shockwave in this ability file:
    Code:
    {
      "animationParts" : { },
      "animationCustom" : {
        "sounds" : {
          "fire" : [ "/sfx/melee/swing_broadsword.ogg" ],
          "fire2" : [ "/sfx/melee/swing_shortsword.ogg" ],
          "fire3" : [ "/sfx/melee/swing_spear.ogg" ]
        }
      },
    
      "ability" : {
        "name" : "Heavy Combo Slash",
        "type" : "greatslashcombo",
        "scripts" : ["/items/active/weapons/melee/meleecombo.lua"],
        "class" : "MeleeCombo",
    
        "comboSteps" : 3,
    
        "flashTime" : 0.15,
        "flashDirectives" : "fade=FFFFFFFF=0.15",
    
        "swooshOffsetRegions" : [
          [0.75, 0.0, 4.25, 5.0],
          [3.0, -0.5, 6.5, 2.0],
          [1.5, -1.0, 5.5, 1.0]
        ],
    
        // cooldown time multiplier for steps after the first, compounded per combo step
        "comboSpeedFactor" : 0.9,
    
        "edgeTriggerGrace" : 0.25,
    
        "fireTime" : 0.8,
        "baseDps" : 25.0,
    
        "damageConfig" : {
          "damageSourceKind" : "broadsword",
          "statusEffects" : [ ],
          "knockbackMode" : "facing",
          "timeout" : 0.5
        },
        "stepDamageConfig" : [
          {
            "baseDamageFactor" : 1.0,
            "knockback" : 35
          },
          {
            "baseDamageFactor" : 0.5,
            "knockback" : 30
          },
          {
            "baseDamageFactor" : 1.0,
            "knockback" : 65
          }
        ],
    
        "stances" : {
          "windup1" : {
            "duration" : 0.1,
            "armRotation" : 90,
            "weaponRotation" : -10,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : true
          },
          "preslash1" : {
            "duration" : 0.025,
            "armRotation" : 55,
            "weaponRotation" : -45,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : false
          },
          "fire1" : {
            "duration" : 0.15,
            "armRotation" : -45,
            "weaponRotation" : -55,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : false
          },
          "wait1" : {
            "duration" : 0.2,
            "armRotation" : -45,
            "weaponRotation" : -55,
            "allowRotate" : false,
            "allowFlip" : true,
            "twoHanded" : true
          },
          "windup2" : {
            "duration" : 0.15,
            "armRotation" : -15,
            "weaponRotation" : -60,
            "weaponOffset" : [0, 0],
            "twoHanded" : true,
            "allowFlip" : true,
            "allowRotate" : false
          },
          "fire2" : {
            "duration" : 0.2,
            "armRotation" : -150,
            "weaponRotation" : 55,
            "weaponOffset" : [0, 0],
            "twoHanded" : true,
            "allowFlip" : true,
            "allowRotate" : false
          },
          "wait2" : {
            "duration" : 0.2,
            "armRotation" : -150,
            "weaponRotation" : 55,
            "weaponOffset" : [0, 0],
            "allowRotate" : false,
            "allowFlip" : true,
            "twoHanded" : true
          },
          "windup3" : {
            "duration" : 0.15,
            "armRotation" : -150,
            "weaponRotation" : 55,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : true
          },
          "fire3" : {
            "duration" : 0.3,
            "armRotation" : 0,
            "weaponRotation" : -90,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : true
          }
        }
      }
    }
    
    I need it only fire here though,
    "fire3" : {
    "duration" : 0.3,
    "armRotation" : 0,
    "weaponRotation" : -90,
    "twoHanded" : true,

    "allowRotate" : false,
    "allowFlip" : true
    }
    }
     
  11. G.Xyon

    G.Xyon Space Kumquat

    From what I see, if you're trying to incorporate two weapon abilities in one, then you might have to create a script to get the ability to do as you want. If you look a bit closer, you can note that the file you currently have uses:
    Code:
    "ability" : {
        "name" : "Heavy Combo Slash",
        "scripts" : ["/items/active/weapons/melee/meleecombo.lua"]
    }
    
    while the shockwave ability uses
    Code:
    "ability" : {
      "name" : "Shockwave",
      "scripts" : ["/items/active/weapons/melee/abilities/hammer/shockwave/shockwave.lua"]
    }
    
    These scripts determine a lot of components in the actual abilities, such as what to do when transitioning through stances, the collision boxes for the swooshes, among other technical things. From what I see, using the meleecombo.lua as base, you will need to incorporate the block of code that spawns the shockwave when the hammer is released (from shockwave.lua) when the last swing is made.

    I suggest you take a very close look at both the scripts and the *.weaponability files they're used on, and if you're not all too experienced with these, then it's a very good incentive to start learning how to code lua (and even seek some help if you're stuck)!
     
  12. MetaFace

    MetaFace Guest

    I managed to get the scripts on there before, and working, before I made the previous post... one of my many tries to make it work, there was no errors but no progress. I'd appreciate an example if possible, I understand if its not worth your time. Thanks for responding anyways though.
     
  13. MetaFace

    MetaFace Guest

    I think it's official, this thread is dead... But I'll still need help. I have a whole fancy mod I was going to make for my friend to make the game seem more... Role play-y, by adding armor and weapons for our characters. But anyways, killing this thread.
     

Share This Page