Modding Discussion Connecting a Tool/weapon to a Scriptpane?

Discussion in 'Starbound Modding' started by endertrot, Jul 23, 2018.

  1. endertrot

    endertrot Cosmic Narwhal

    So I've had this idea bouncing around in my head for months now, but I have no idea if it would be even feasible to do within Starbound's code because I know next to nothing about both Scriptpanes and weapons.

    My idea is for a weapon where you can interact with whatever to open the scriptpane, and then use that interface to change what the ability's of the weapon are. Say, you have it set to a sniper loadout where the primary is sniper shots and the secondary a flashlight, then you open up the interface and scroll through to some kind of load out where it shoots the DNA blast projectiles and has an energy spike secondary.

    But heres the catch: I want to make it so you just have to open up the interface and its tied to your character, like the mech bay or matter manipulator, that way you can grab any of these weapons and it will automatically use whatever loadout you have selected, rather than putting the item into the interface and actually changing it to a different item.

    Is this feasible in any way shape or form? Because if so, I'd probably force myself to learn how to make weapons and scriptpanes just to do this.
     
  2. The Avelon

    The Avelon Phantasmal Quasar

    Little bit old thread but it was never answered and seems quite interesting. I
    Short answer: yes, this should be entirely possible.

    While holding any of your weapons you can have a shift-rclick ability to open your scripted pane. This consumes the item. Your uninit will give back the item with whatever your current parameters are. So if you immediately close it you get the exact same weapon back.

    Your pane would have 3 buttons that when clicked cycle through the available options on element, projectile, and ability. The selection overwrites the stored parameter so when you close the pane, the weapon you get back is different.

    Now I'm not intimately familiar with the weapon builder script but I think your best bet is to write your own version of the builder script to be used with your weapons - this would also improve compatibility in the event that some other mod edits the default builder.

    A couple of useful resources to check out would be the Aeginian weapons from Elithian Races, the Backpack mod for pane and an example of the uninit code, and perhaps the CWUS mod (custom weapon upgrade system).

    Also of note is the vanilla adaptable crossbow which has the snippet of code to change ammo types - you won't need to do this exactly but it is useful in case you want to make a gun ability that does similar (perhaps shift-lclick rather than selecting element in the pane).

    Hopefully this helps, and you do indeed make this mod! Looking forward to using it if so. :)
     
    endertrot likes this.

Share This Page