Modding Help Coding Help: Back Item Swapping In Combat for Crew, and Other Things

Discussion in 'Starbound Modding' started by SureinDragon, Jul 3, 2019.

  1. SureinDragon

    SureinDragon Big Damn Hero

    Hello Again!

    Today I've got some more complicated issues I need help with. I've always been good at Frankenstein my mods together, with just enough coding knowledge to make sure things dont fall apart. Now I'm in a position where I need to code from scratch, or at least partially from scratch, and I don't know where to start.

    I have two goals:
    1. Have Crewmates equip special cosmetic back items only in combat, and unequip out of combat.
    2. Make Crewmates a little more proficient with fist weapons and dual wielding. Or able to use them at all actually. (and potentially other weapons)

    Both of these are going to be applied to my special custom_crewmate.npctype files, and wont be adjusting base game crewmates at all.


    Back Item Switching
    I know there is a function "npc.getItemSlot("back")", which also has "npc.getItemSlot("back").parameters.colorIndex" for keeping the color index (though, color index doesn't really matter for the items I'm switching to.
    But, I don't really know how to detect if the NPC is in or out of combat, and then how to trigger the change of the back slot item. ^^;;

    EDIT:

    I've been doing some reading on Lua and the Starbound tables. I'm starting to think that there is not a good way to check if an npc/crew is currently engaged in combat. I would be happy with being able to set the back item on interact to follow. Since crew switch to an active weapon when called to follow, this should be possible right?
    Just gotta figure this out...


    Fist Weapon Competency/Dual Wielding Competency
    Honestly, I have no idea where to start with this or if it can even be done.

    I have managed to get my npc crewmember to attack and aggro with two fist weapons (using the Melee tag in itemTags), but they only attack with the primary and they only attack once every 2-3 seconds.
    If I add the tag "dagger" to itemTags, the npc attacks at the speed I would like, but they still dont attack with their secondary weapon.

    So, I guess the question here, what would I need to do to get an npc able to attack with their secondary weapon... I know NPCs can have shields, and can use them, but how to I force that onto a melee weapon...

    Actually, after doing more looking, having Supper's Combat Overhaul installed enables my npc to attack fast, and with combos! I'm not sure if I want the whole mod installed though, just the ability for npcs to do combos...


    Don't even get me started on my hopes of having an npc dual wield chakram. ^^;;

    ----

    Anyways! I know I have a lot of lofty goals here, but any help is appreciated! I'm really excited for this mod I'm making with my roommate, and I can't wait to share it when its done.
    I'm also available for extra contact and file exchanging on discord! Let me know here or shoot me a DM.
    Any help provided will deffo be credited when the mod is fully released.
     
    Last edited: Jul 5, 2019

Share This Page