I have set about creating a custom grappling hook. Things have gone well, its working, but its not doing something I wanted it to do. I am attempting to add a flashlight property to the hook, but am currently in a bit of a pickle. I tried putting the beam properties in the item properties but that did nothing. I made the hook have gravity, as that was pretty easy, so this is definitely a success in that. Has a custom sprite too. I'm also not familiar with how to add a blueprint to this thing, but thats only a tutorial later on for sure. SOLVED! http://community.playstarbound.com/resources/spelunking-hook.4823/
I based myself on the flashlight weaponability to do something similar, and I have that in my item's .animation file Code: "lights" : { "flashlight" : { "active" : false, "position" : [0.75, 0], "color" : [220, 220, 255], "pointLight" : true, "pointAngle" : 0.00, "pointBeam" : 2.5 } } } (You might need to tweak the position, it's in blocks) and I use that in my item's lua script Code: function init() animator.setLightActive("flashlight", true) end function uninit() animator.setLightActive("flashlight", false) end
I'm sorry I don't really understand the second half of this, for the lua this is what I have: Code: { "itemName" : "spelunkinghook", "price" : 9001, "inventoryIcon" : "spelunkinghookicon.png", "rarity" : "Legendary", "maxStack" : 1, "description" : "Someone glued a flashlight to this grappling hook. Why is it lavender?", "shortdescription" : "Spelunking Hook", "largeImage" : "spelunkinghookbig.png", "category" : "Tool", "fireTime" : 0, "twoHanded" : false, "scripts" : ["/items/active/grapplinghooks/grapplinghook.lua"], "animationScripts" : ["/items/active/effects/renderrope.lua"], "animation" : "spelunkinghook.animation", "fireOffset" : [0, 0.3], "ropeOffset" : [-1.75, 0.3], "ropeVisualOffset" : [0.75, 0.3], "consumeOnUse" : false, "projectileType" : "climbingropehook", "projectileParameters" : { "speed" : 80, "timeToLive" : 7.0 }, "ropeWidth" : 1.0, "ropeColor" : [120, 80, 30, 255], "reelInDistance" : 3.5, "reelOutLength" : 70, "breakLength" : 100, "minSwingDistance" : 1.5, "reelSpeed" : 20, "controlForce" : 1000, "groundLagTime" : 0.2 } And this is what I think I'm supposed to do in the animation Code: { "animatedParts" : { "parts" : { "rope" : { "properties" : { "centered" : false, "image" : "spelunkinggun.png", "offset" : [-0.6, -0.5] } } } }, "sounds" : { "fire" : ["/sfx/gun/grapplegun.ogg"] }, "lights" : { "flashlight" : { "active" : false, "position" : [0.75, 0], "color" : [220, 220, 255], "pointLight" : true, "pointAngle" : 0.00, "pointBeam" : 2.5 } } }
H'okay so, I needed to specifically add a pointbeam. I looked at flashlight luas and such to see how they work. With this code you can add a flashlight onto ANY held item, while still maintaining a secondary skill if its a two hander. Code: "lights" : { "spelunklightSpread" : { "active" : true, "position" : [0, 0], "color" : [45, 0, 90] }, "spelunklight" : { "active" : true, "position" : [0.5, 0.4], "color" : [220, 220, 220], "pointLight" : true, "pointAngle" : 0.4, "pointBeam" : 5 } }
That actually will be helpful for me since I want to make a gun with a short range secondary. It will be nice to add a flashlight to it.