Modding Help Looking Into an Object/NPC Theory!

Discussion in 'Starbound Modding' started by JesseKomm, May 26, 2017.

Tags:
  1. JesseKomm

    JesseKomm Void-Bound Voyager

    Hello everyone, I have not been on these forums in quite some time and dare I say have not done modding for just as long. I'm recently returning to the scene but a great many things have changed, for the most part I am capable of learning what is different... right now I'm looking even further.

    Perhaps some of the experienced modders have attempted this before of not, but regardless I am searching. My question is simple, is it possible to give Object functionality to an NPC/Monster/Pet? The premise here is you would say go to a crew member and you'll be able to craft an item at them, or interact with a pet and the teleportation interface will pop up, ect.

    I've been scouring the assets looking for connections that may allow this, but have found nothing yet. I am hopeful that others may find a way, or already know one.

    Specifics: In my case, I am personally looking to incorporate the Ship AI(Essentially the whole Tech Station) into a "pet" which will allow it to roam around and perhaps even interact with it's environment.

    Thank you in advance to those who respond, and have a nice day.
     
  2. Cyel

    Cyel Scruffy Nerf-Herder

    Yeah, the game allows for interactActions (only used in the Tailor, it seems...)

    Attached is an example of an npcType that'll open the Ai Interface when interacted with; but it could as well be any other "interactAction" you find in any objects: eg. to open a teleporter, you could use
    Code:
      "interactAction" : "OpenTeleportDialog",
      "interactData" : "/interface/warping/shipteleporter.config",
    or even
    Code:
      "interactAction" : "openCockpitInterface",
    This is only useable by npcs because what allows this is the bmain.lua script, which is used for npcs behavior; if you want a pet (= a monster), you'd need to add a custom Lua script and I'm not sure monsters are getting an "interact()" function callback

    Edit: Monsters' scripts do get an interact() callback but you'd need to write some monster behavior to have it running on a "normal" monster, or, as said above, add a custom Lua script

    Edit: done did, the attached file now contains a monster that opens the AI interface; to test,
    Code:
    /spawnmonster interactblackcat
    /spawnmonster human interactable
     

    Attached Files:

    Last edited: May 26, 2017
    JesseKomm likes this.
  3. JesseKomm

    JesseKomm Void-Bound Voyager

    Thank you very much for this information! For the most part I just wanted to know if it was in any way possible, but the information you gave me will certainly help even greater. I'm still a little ways away from going toward this aspect in my mod, but this certainly helps me decide which path I'll choose.
     
  4. Cyel

    Cyel Scruffy Nerf-Herder

    Ah, I didn't saw you answered and just edited my post; I updated the attached file and made an example interactable monster with a custom script. Doing it with a custom behavior would probably be better, but I didn't really played with those before. (I also fixed a silly error I made that was making the NPCs poof out on interaction)
     
    JesseKomm likes this.

Share This Page