I made this weapon and added an alt fire that almost works, but when I use it, it shoots and freezes the entire weapon. Is there something wrong with this code that's making it do this? { "itemName" : "teslaviolin", "price" : 5000, "inventoryIcon" : "teslaviolinicon.png", "maxStack" : 1, "rarity" : "Legendary", "description" : "Pulverize an entire army of bandits with your sick beats.", "shortdescription" : "Electric Tesla Violin", "tooltipKind" : "gun", "level" : 6, "category" : "uniqueWeapon", "twoHanded" : true, "itemTags" : ["weapon","ranged", "uniqueWeapon"], "animation" : "aegisaltpistol.animation", "animationParts" : { "middle" : "teslaviolin.png", "middleFullbright" : "teslaviolinfullbright.png", "muzzleFlash" : "" }, "animationCustom" : { "sounds" : { "fireStart" : [ "/sfx/gun/aegisaltpistol_start.ogg" ], "fireLoop" : [ "/sfx/gun/aegisaltpistol_loop2.ogg" ], "fireEnd" : [], "beamImpact" : [] } }, "animationScripts" : ["/items/active/effects/chain.lua"], "muzzleOffset" : [1.5625, 0.375], "scripts" : ["/items/active/weapons/ranged/gun.lua"], "elementalType" : "electric", "primaryAbility" : { "scripts" : ["/items/active/weapons/ranged/beamfire.lua"], "class" : "BeamFire", "fireTime" : 0.2, "baseDps" : 20, "energyUsage" : 19.5, "damageConfig" : { "statusEffects" : [ ], "damageSourceKind" : "plasma", "knockback" : 2 }, "beamLength" : 20, "chain" : { "startOffset" : [0, 0], "segmentImage" : "/weapons/teslabeam.png", "endSegmentImage" : "/weapons/teslabeamend.png", "segmentSize" : 0.48, "overdrawLength" : 0.2, "taper" : 0, "waveform" : { "frequency" : 2.0, "amplitude" : 0.125, "movement" : 40.0 }, "fullbright" : true }, "stances" : { "idle" : { "armRotation" : 0, "weaponRotation" : 0, "twoHanded" : true, "allowRotate" : true, "allowFlip" : true }, "fire" : { "duration" : 0, "armRotation" : 0, "weaponRotation" : 0, "twoHanded" : true, "allowRotate" : true, "allowFlip" : true }, "cooldown" : { "duration" : 0.1, "armRotation" : 0, "weaponRotation" : 0, "twoHanded" : true, "allowRotate" : true, "allowFlip" : true } } }, "altAbility" : { "name" : "Electric Tesla Bow", "scripts" : ["/items/active/weapons/ranged/abilities/altfire.lua"], "class" : "AltFireAttack", "fireTime" : 0.5, "energyUsage" : 35, "projectileCount" : 1, "inaccuracy" : 0, "fireType" : "auto", "useParticleEmitter" : false, "projectileType" : "teslabow", "projectileParameters" : {}, "stances" : { "idle" : { "armRotation" : 0, "weaponRotation" : 0, "twoHanded" : true, "allowRotate" : true, "allowFlip" : true }, "fire" : { "duration" : 0, "armRotation" : 0, "weaponRotation" : 0, "twoHanded" : true, "allowRotate" : true, "allowFlip" : true }, "cooldown" : { "duration" : 0.1, "armRotation" : 0, "weaponRotation" : 0, "twoHanded" : true, "allowRotate" : true, "allowFlip" : true } } }, "builder" : "/items/buildscripts/buildunrandweapon.lua" }
Show the console output (if you started it from a console) or show the log file (which is in the storage folder in your Starbound directory). This'll help everyone determine the problem.
I really don't know what a console output is. I just edited the code of the aegesalt pistol and added the alt ability if thats what youre asking. I made the alt ability as the alt fire of the space plasma rifle and it still freezes fyi.
I still might want the logs, however I did build the mod with your code and I may have found your issue. Code: [Warn] Could not spawn Projectile of type 'teslabow', exception caught: (ProjectileDatabaseException) Unknown projectile with typeName teslabow. Everything breaks after that. So, it seems like you tried referencing a projectile that doesn't exist. So, either create your own projectile and name it "teslabow", or use one of the preexisting projectile types (which can be found in /assets/projectiles). If you have created that projectile's files, there's probably another issue that I'm missing. If so, could you attach the mod so I could test it?
i did create the projectile i just didnt think that thats the problem, Ill give you the code for that rn { "projectileName" : "teslabow", "physics" : "laser", "image" : "teslabow.png", "fullbright" : true, "animationCycle" : 0.25, "frameNumber" : 1, "speed" : 80, "timeToLive" : 3, "bounces" : 0, "lightColor" : [90, 180, 230], "damageKind" : "plasma", "power" : 50, "knockback" : 6, "actionOnCollide" : [ { "action" : "sound", "options" : [ "/sfx/projectiles/plasmabullet_ricochet1.ogg", "/sfx/projectiles/plasmabullet_ricochet2.ogg", "/sfx/projectiles/plasmabullet_ricochet3.ogg" ] } ], "actionOnReap" : [ { "action" : "sound", "options" : [ "/sfx/gun/impact_plasma.ogg" ] }, { "action" : "loop", "count" : 111, "body" : [ { "action" : "particle", "specification" : { "type" : "ember", "size" : 1.5, "color" : [90, 180, 230, 255], "light" : [90, 180, 230], "fullbright" : true, "destructionTime" : 0.1, "destructionAction" : "shrink", "fade" : 0.9, "initialVelocity" : [0, 0], "finalVelocity" : [0.0, -50.0], "approach" : [0, 30], "timeToLive" : 0.1, "layer" : "middle", "variance" : { "position" : [0.25, 0.25], "size" : 0.5, "initialVelocity" : [13, 13], "timeToLive" : 0.1 } } } ] } ], "periodicActions" : [ { "time" : 0.015, "repeat" : true, "action" : "particle", "rotate" : false, "specification" : { "type" : "animated", "animation" : "/animations/spaceplasmatrail/spaceplasmatrail.animation", "initialVelocity" : [0.0, 0.0], "timeToLive" : 0.2, "layer" : "middle", "position" : [0.0, 0.0] } } ] }
Did you make sure to register your alt fire ability in a patch for weaponabilities.config in \items\buildscripts?
yeah i did that but it still freezes (when I say freezes I mean the weapon cannot fire or alt fire but if I switch to another weapon and then switch back it will move again)
Check your starbound.log file (found in your storage folder). Spawn in your weapon, try to fire it, and then quit, and the log should hold information regarding what's wrong.
idk what this means but i can see that it says error after it does the alt fire command [C]: in field 'playSound' [string "/items/active/weapons/ranged/abilities/altfir..."]:49: in method 'muzzleFlash' [string "/items/active/weapons/ranged/gunfire.lua"]:105: in function <[string "/items/active/weapons/ranged/gunfire.lua"]:86> stack traceback: [C]: in ? [C]: in function '_ENV.error' [string "/items/active/weapons/weapon.lua"]:104: in method 'setAbilityState' [string "/items/active/weapons/weapon.lua"]04: in method 'setState' [string "/items/active/weapons/ranged/abilities/altfir..."]:28: in method 'update' [string "/items/active/weapons/weapon.lua"]7: in method 'update' [string "/items/active/weapons/ranged/gun.lua"]:53: in function <[string "/items/active/weapons/ranged/gun.lua"]:43> idk why those words turned into emojis