Modding Help Can I add extra elements to a species via Lua?

Discussion in 'Starbound Modding' started by DraikNova, Mar 13, 2017.

  1. DraikNova

    DraikNova Spaceman Spiff

    So, I'm working on a species mod, and I am wondering whether I could use Lua to get the game to display an extra set of limbs for my species. Not anything fancy, like holding additional items or anything (boy would that be a nightmare to bugfix), but basically, I want to give them an extra set of limbs that work as grappling hooks, and I was wondering whether this would be possible by having each instance of such an NPC or PC use a Lua script to tell the game to render and take into account these limbs.
     
  2. bk3k

    bk3k Oxygen Tank

    Probably only as a tech if anything. I don't have any specific idea about how that would work.
     
  3. DraikNova

    DraikNova Spaceman Spiff

    My idea was to simply create a special one-handed tool to represent each arm, and then use a script to make them appear at the correct positions.
     
  4. Cyel

    Cyel Scruffy Nerf-Herder

    It depends on what you mean by "take into account"; if you mean "display it", you could probably use anything that has access to the animator table, or just a simple backitem. The HiveMind mod gives it's specie a special wing back, but y'can look at the "fenerox tail" or "vesperan specie" mods, maybe they do it differently.
    If you mean "use the grappling hook", then good luck adding that to the npc's pathfinding I guess

    This could be "easily" done without much trickery tho; you can basically display anything anywhere with any kind of animation via the animator thingy. As an example you can look at the parasol or the dragonhead for Lua scripts that control animations
     
  5. DraikNova

    DraikNova Spaceman Spiff

    Actually using their grappling hooks is something I don't intend for NPCs to do. But I do want the player to be able to use the grappling hooks. The thing I'm mostly wondering about is whether I can get the grappling hooks to move the player properly (especially since they'll have two grappling hooks even if they don't bother to craft another two for their actual hands).
     
  6. Cyel

    Cyel Scruffy Nerf-Herder

    They do move the player "properly" (depending on your expectations, but that can be changed anyway), but it might end up badly
    [​IMG]
     
  7. DraikNova

    DraikNova Spaceman Spiff

    Yes, but I'm wondering how to get grappling hooks that aren't held by the characters hands, as per normal, to move the character (they're grappling hooks made to look like extra limbs and attached via Lua).
     
  8. Cyel

    Cyel Scruffy Nerf-Herder

    Yes, you'd just have to define a different fire point; for example here's with some aribitrary fireOffset, ropeOffset and ropeVisualOffset values:[​IMG]
    Obviously it's glitchy because they're stupid values, but it shows you can make your rope fire from whatever position you'd want.
     
  9. DraikNova

    DraikNova Spaceman Spiff

    No, those are still grappling hooks that are being held by the character. What I'm trying to do is make grappling hooks that aren't actually held by the character, using Lua (also using Lua to make them fire with certain button presses, since they aren't being held).
     
  10. Cyel

    Cyel Scruffy Nerf-Herder

    Ah, I misinterpretted this line then
    I think using a tech would be the way to go then, since they're the only other thing that can get player inputs
     
  11. DraikNova

    DraikNova Spaceman Spiff

    Yeah, but I'm trying to avoid blocking normal game functionality. I wonder if its possible to make a tech that doesn't take up any of the existing (head, torso, leg) slots. If not, I'm either going to have to find another way than techs, or I'm just going to have to make the additional arms nonfunctional.
     
  12. Cyel

    Cyel Scruffy Nerf-Herder

    You can't have a tech that isn't head/torso/legs, but you could add your script to every other tech; altho this would make those extra limbs appear on every other races too.
    I think if it's usable enough, people would be willing to replace the leg techs for that one
     
  13. DraikNova

    DraikNova Spaceman Spiff

    See, the thing is, I'm trying to add extra functionality by messing with existing functionality, not simply replace a preexisting functionality. I guess I'm just going to have to see how much I can mess around with Lua to make a "background" (i.e. not visible in the tech screen, and not replaced when adding a new tech) tech. I found this (https://github.com/Silverfeelin/Starbound-Keybinds) github library, though, so I should be able to bind their abilities to g and h regardless.

    If necessary, I'll just add on the functionality for their arms to all of the possible techs from one slot (by only giving that species access to those techs and only those versions of those techs), and see if that works. But this is mostly just doing a pre-coding check anyway, so I'll see if I can come up with something more elegant.

    EDIT: Plus, if this (http://community.playstarbound.com/threads/howto-keybinding-mk-2.90650/) is still relevant, I might be able to hack in a new action using it to access yet more keys.
     
    Last edited: Mar 16, 2017
  14. Cyel

    Cyel Scruffy Nerf-Herder

    What I meant by "you could add your script to every other tech" is that techs use an array for referencing scripts, so patching a script there doesn't replace pre-existing functionalities
     
  15. DraikNova

    DraikNova Spaceman Spiff

    Ah, okay. In that case, all I have to figure out now is whether there's a way to restrict a tech to only one race (I could make them spawn with an item that automatically gives them the tech, I think, like the item that upgrades your ship), in which case I'll be able to implement it pretty much perfectly.
     
  16. The | Suit

    The | Suit Agent S. Forum Moderator

    Your best option is to do a transformation - similar to
    http://community.playstarbound.com/resources/starbender.2952/

    That way - you activate it - then 2 arms are added when needed.
     

Share This Page