Modding Help [RESOLVED] Adaptable Ammo trouble

Discussion in 'Starbound Modding' started by Iaeyan Elyuex, Dec 31, 2017.

  1. Iaeyan Elyuex

    Iaeyan Elyuex Cosmic Narwhal

    [RESOLVED]

    I'm trying to make a weapon based on the Adaptable Crossbow. I'm trying to make an Aetherian-themed Samus gun for my roleplay. The gun is not switching ammo, and the thing is rendering as the entire spritesheet for the gun aligned parallel with my character's arm.

    I changed the sound effect used for switching ammo, the ability.type, the projectiles fired and the energy cost; and I set all the animation motions for firing and switching ammo to 0. I didn't even change what the weapon states were called.

    This represents a good four hours of my time designing the new projectiles, picking sounds and trying to change applicable data.

    I mean, FU did it. Elithian did it. How did they do it? This can't be "impossible". I'm looking over it, and there's no perceptible reason it should be doing this.
     
    Last edited: Mar 2, 2018
  2. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    I'm working on it. I based myself on a free template that was posted somewhere here and it worked except there was some "missing ammo" I have no idea why I get this error since the file normally did not included any custom ammo or whatever.
    Someone who succeeded need to make a tuto and post it on this forum
     
  3. Iaeyan Elyuex

    Iaeyan Elyuex Cosmic Narwhal

    Yeah. There's so many applications for this weapon ability.
     
  4. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    I have had this problem as well. The strange thing was that it was working before, but one day it suddenly "stopped" working. I thought I was the only one experiencing this issue, but apparently I am not.

    What do you mean by this? Was there not 7 ammo entries, as the alt weapon ability for the adaptable crossbow is coded with? When my alternate ammo was working, there was 7 different projectiles the weapon could shoot.
     
  5. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    I don't really know that's the problem. I don't see why the game was asking for an ammo type that don't exist and that I didn't added in the files... the weapon work fine but when I finish switching between all the different ammo the game crash for no apparent reason
     
  6. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    Could you provide a log so that I can try to help?

    It may be a good idea for the people who are experiencing this issue to include their .weaponability file and any lua files that are part of the weapon ability. This would allow anyone to compare all of the files and see if the files share a common piece of code that could be causing the issue.
     
  7. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    Here is what I used for one of the (once) working guns:

    {
    "animationCustom" : {
    "animatedParts" : {
    "stateTypes" : {
    "ammoType" : {
    "default" : "1",
    "states" : {
    "1" : {
    "frames" : 1,
    "properties" : {
    "particleEmittersOff" : [ "fireAmmo", "iceAmmo", "electricAmmo", "poisonAmmo", "hGravityAmmo", "nGravityAmmo" ]
    }
    },
    "2" : {
    "frames" : 1,
    "properties" : {
    "particleEmittersOff" : [ "iceAmmo", "electricAmmo", "poisonAmmo", "hGravityAmmo", "nGravityAmmo" ],
    "particleEmittersOn" : [ "fireAmmo" ]
    }
    },
    "3" : {
    "frames" : 1,
    "properties" : {
    "particleEmittersOff" : [ "fireAmmo", "electricAmmo", "poisonAmmo", "hGravityAmmo", "nGravityAmmo" ],
    "particleEmittersOn" : [ "iceAmmo" ]
    }
    },
    "4" : {
    "frames" : 1,
    "properties" : {
    "particleEmittersOff" : [ "fireAmmo", "iceAmmo", "poisonAmmo", "hGravityAmmo", "nGravityAmmo" ],
    "particleEmittersOn" : [ "electricAmmo" ]
    }
    },
    "5" : {
    "frames" : 1,
    "properties" : {
    "particleEmittersOff" : [ "fireAmmo", "iceAmmo", "electricAmmo", "hGravityAmmo", "nGravityAmmo" ],
    "particleEmittersOn" : [ "poisonAmmo" ]
    }
    },
    "6" : {
    "frames" : 1,
    "properties" : {
    "particleEmittersOff" : [ "fireAmmo", "iceAmmo", "electricAmmo", "poisonAmmo", "nGravityAmmo" ],
    "particleEmittersOn" : [ "hGravityAmmo" ]
    }
    },
    "7" : {
    "frames" : 1,
    "properties" : {
    "particleEmittersOff" : [ "fireAmmo", "iceAmmo", "electricAmmo", "poisonAmmo", "hGravityAmmo" ],
    "particleEmittersOn" : [ "nGravityAmmo" ]
    }
    }
    }
    }
    },

    "parts" : {
    "middle" : {
    "properties" : {
    "image" : null
    },

    "partStates" : {
    "ammoType" : {
    "1" : {
    "properties" : {
    "image" : "<partImage>:wooden.<frame><paletteSwaps>"
    }
    },
    "2" : {
    "properties" : {
    "image" : "<partImage>:explosive.<frame><paletteSwaps>"
    }
    },
    "3" : {
    "properties" : {
    "image" : "<partImage>:ice.<frame><paletteSwaps>"
    }
    },
    "4" : {
    "properties" : {
    "image" : "<partImage>:electric.<frame><paletteSwaps>"
    }
    },
    "5" : {
    "properties" : {
    "image" : "<partImage>:poison.<frame><paletteSwaps>"
    }
    },
    "6" : {
    "properties" : {
    "image" : "<partImage>:hgravity.<frame><paletteSwaps>"
    }
    },
    "7" : {
    "properties" : {
    "image" : "<partImage>:ngravity.<frame><paletteSwaps>"
    }
    }
    }
    }
    }
    }
    },

    "particleEmitters" : {
    "fireAmmo" : {
    "transformationGroups" : ["weapon"],
    "offsetRegion" : [0, 0, 1.5, 0],
    "emissionRate" : 3.0,
    "particles" : [
    { "particle" : "fireember" },
    { "particle" : "fireember" },
    { "particle" : "fireember" }
    ]
    },
    "iceAmmo" : {
    "transformationGroups" : ["weapon"],
    "offsetRegion" : [0, 0, 1.5, 0],
    "emissionRate" : 3.0,
    "particles" : [
    { "particle" : "iceaura" }
    ]
    },
    "electricAmmo" : {
    "transformationGroups" : ["weapon"],
    "offsetRegion" : [0, 0, 1.5, 0],
    "emissionRate" : 1.0,
    "particles" : [
    { "particle" : "teslabolt" },
    { "particle" : "electricalburn" },
    { "particle" : "electricalburn" },
    { "particle" : "electricswoosh2" },
    { "particle" : "electricswoosh2" }
    ]
    },
    "poisonAmmo" : {
    "transformationGroups" : ["weapon"],
    "offsetRegion" : [0, 0, 1.5, 0],
    "emissionRate" : 1.0,
    "particles" : [
    { "particle" : "poisondrip2" },
    { "particle" : "poisondrip2" },
    { "particle" : "poisondrip2" }
    ]
    },
    "hGravityAmmo" : {
    "transformationGroups" : ["weapon"],
    "offsetRegion" : [0, 0, 1.5, 0],
    "emissionRate" : 1.5,
    "particles" : [
    { "particle" : "shadowsmoke" }
    ]
    },
    "nGravityAmmo" : {
    "transformationGroups" : ["weapon"],
    "offsetRegion" : [0, 0, 1.5, 0],
    "emissionRate" : 1.5,
    "particles" : [
    { "particle" : "shadowsmoke" }
    ]
    }

    },

    "sounds" : {
    "switchAmmo" : [ "/sfx/gun/reload/shotgun_reload_clip3.ogg" ]
    }
    },

    "ability" : {
    "type" : "wa_multiflamer",
    "name" : "Multi Flamethrower",
    "scripts" : ["/items/active/weapons/other/multiflamer/wa_multiflamer.lua"],
    "class" : "TerraAmmo1",

    "adaptedAbilityIndex" : 1,

    "ammoTypes" : [
    {
    "projectileType" : "wa_stungas",
    "energyUsage" : 25
    },
    {
    "projectileType" : "flamethrower",
    "energyUsage" : 20
    },
    {
    "projectileType" : "icethrower",
    "energyUsage" : 20
    },
    {
    "projectileType" : "lightningthrower",
    "energyUsage" : 20
    },
    {
    "projectileType" : "poisonthrower",
    "energyUsage" : 20
    },
    {
    "projectileType" : "wa_superflames",
    "energyUsage" : 30
    },
    {
    "projectileType" : "healingstatusprojectile",
    "energyUsage" : 25
    }
    ],

    "stances" : {
    "idle" : {
    "armRotation" : 0,
    "weaponRotation" : 0,
    "twoHanded" : true,
    "allowRotate" : true,
    "allowFlip" : true
    },
    "switch" : {
    "aimAngle" : 0,
    "armRotation" : -40,
    "weaponRotation" : 60,
    "weaponAngularVelocity" : -150,
    "armAngularVelocity" : 100,
    "twoHanded" : true,
    "duration" : 0.4,
    "allowRotate" : false,
    "allowFlip" : true
    }
    }
    }
    }

    The gun uses the same lua file as the terra guns from the namesake mod, only renamed.

    TerraAmmo1 = WeaponAbility:new()

    function TerraAmmo1:init()
    self.ammoIndex = math.min(config.getParameter("ammoIndex", 1), #self.ammoTypes)
    self:adaptAbility()

    self.weapon.onLeaveAbility = function()
    self.weapon:setStance(self.stances.idle)
    end
    end

    function TerraAmmo1:update(dt, fireMode, shiftHeld)
    WeaponAbility.update(self, dt, fireMode, shiftHeld)

    if not self.weapon.currentAbility and self.fireMode == (self.activatingFireMode or self.abilitySlot) then
    self:setState(self.switch)
    end
    end

    function TerraAmmo1:switch()
    self.ammoIndex = (self.ammoIndex % #self.ammoTypes) + 1
    activeItem.setInstanceValue("ammoIndex", self.ammoIndex)

    self:adaptAbility()
    animator.playSound("switchAmmo")

    self.weapon:setStance(self.stances.switch)

    util.wait(self.stances.switch.duration)
    end

    function TerraAmmo1:adaptAbility()
    local ability = self.weapon.abilities[self.adaptedAbilityIndex]
    util.mergeTable(ability, self.ammoTypes[self.ammoIndex])
    animator.setAnimationState("ammoType", tostring(self.ammoIndex))
    end

    function TerraAmmo1:uninit()
    end
     
  8. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    Oops I totally forgot to give you a log, I'll send you one later today
     
  9. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    Anything? I would like to solve this issue.
     
  10. Iaeyan Elyuex

    Iaeyan Elyuex Cosmic Narwhal

    These are two of the versions I tried to do. The omnicannon is an expanded version of the weapon that has more ammo types. The log says nothing about it.
     

    Attached Files:

  11. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    20180118085553_1.jpg 20171106180536_1.jpg and the log
     

    Attached Files:

  12. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    I can already see a problem in your log:
    Code:
    Caused by: (AssetException) No such asset '/projectiles/heround/heround.config'
    
    Either the asset doesn't exist, the code you are using is pointing to the wrong file, or the file is using a different name.

    The omnicannon and the kleuxcannon check out, so the fact that they are not working is incredibly strange...

    Maybe you could provide a log so I can confirm that your files work?
     
    Last edited: Jan 19, 2018
  13. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    Yeah I know, the problem is that I never found any mention of this "heround" or anything strange in any of the files, the weapon shouldn't even search for that
     
  14. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    That is an issue that should be mentioned to whoever provided the assets.
     
  15. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    Yeah but I don't think he is on this forum anymore
     
  16. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    Hey, anyone find out anything? Or is the issue unsolved? :(
     
  17. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    To be honest we should try asking on reddit
     
  18. SpazDiesFirst360.0

    SpazDiesFirst360.0 Phantasmal Quasar

    777JackOfBlades likes this.
  19. Random_NPC1996

    Random_NPC1996 Phantasmal Quasar

    Alright first thing first I have to check for one thing... you guys knows you have to "register" your weaponability before you can assign them into .activeitem or aka your gun/sword for altAbilities right? If you don't (cause from @Iaeyan Elyuex 's file, I don't think there is a patch to "register" it...)the ability is not even available to be used, it will not even appear in your weapons stat place thingy. You guys can find it from this address from the unpacked assets :"/items/buildscripts/weaponabilities.config"... I'm not sure if you guys knew this or not... tell me if I'm wrong but I hit this wall last time... I hope no one hits the same... oh and @777JackOfBlades ... I'm not sure what you got there but what's the deal with heround.config... know anything about... what it was made for? From my prediction you're trying to add a new projectile physics? maybe? I dunno...
     
    Last edited: Feb 6, 2018
  20. 777JackOfBlades

    777JackOfBlades Scruffy Nerf-Herder

    Basically I tried to copy a mod left somwhere here as an open-source (everyone was free to use it) So I used this as a base for understanding the weapon but I think the "heround" thing refer to a custom ammo type that the author abandonned. I've looked into all of this again recently but didn't had time to retry
     

Share This Page