Modding Help NPC Regenerate health?

Discussion in 'Starbound Modding' started by xSlacker, Apr 12, 2014.

  1. xSlacker

    xSlacker Pangalactic Porcupine

    Is there a way to make an NPC regenerate health?
    I'm digging around in the friendlyguard.npctype file, and at the bottom I see a line saying:
    "energyReplenishmentRate" : 10.0

    I suppose that is the NPC's Enery regen rate. Is there a way for adding a 'Health Regen'?
    I tried adding "healthReplenishmentRate" but the NPC didn't regenerate health after I attacked it. Hmm...

    Anyone with any ideas? :)
     
  2. xSlacker

    xSlacker Pangalactic Porcupine

    After some experimentation I found a line in the .npctyp file at the beginning:
    "inateStatusEffects" :

    I just added this from the 'sitStatusEffects' when using a bed:
    { "kind" : "Health", "amount" : 1.0 }

    Now the NPC actully has a HP regen, but it also constantly has the red healing '+' effect around it...
    Now to find a healing effect that dosn't have it... hmmm...
     
  3. The | Suit

    The | Suit Agent S. Forum Moderator

    Make your own custom status effect
    with only
    Code:
    {
      "kind" : "health"
    }
    give a different name then health.

    The reason the + is coming is because the status effect Health - uses the effect source. Just make the same status effect without that effect source and your gravy
     
  4. xSlacker

    xSlacker Pangalactic Porcupine

    Really? Hmm...
    I could try that. :)

    Can I put this status effect in a mod folder aswell? :eek:
     
  5. xSlacker

    xSlacker Pangalactic Porcupine

    Should I replace 'health' in the code to something else? As Starbound crashes due to duplicate status effects... But what should I put there? :s
     
  6. The | Suit

    The | Suit Agent S. Forum Moderator

    Yes in order to use the new status effect you need to put it in the mod folder first
    [ I am hoping you have a basic understanding of modding ]

    You cannot use the same name as health - just change the file name to something else.statuseffect

    Then call that file name.
    For example look at bandage.statuseffect as an example
     
  7. xSlacker

    xSlacker Pangalactic Porcupine

    Okay, this is what i've done:
    I copied the 'health.statuseffect' and put it into a 'statuseffects' folder inside the mod folder.
    I renamed the file to 'health1.statuseffect'
    and changed the code to just:

    Code:
    {
      "kind" : "health"
    }
    and to assign the NPC with the status effect, should it look like this?

    Code:
    "inateStatusEffects" : [
        {
          "kind" : "Protection",
          "amount" : 1.0
        },
        { "kind" : "health", "amount" : 1 }
      ]
    But now I wonder how am I supposed to tell the game to use MY status effect and not the original one. :s

    Edit: I tried starting the game, still complains about duplicate statuseffects...
     
    Last edited: Apr 12, 2014
  8. xSlacker

    xSlacker Pangalactic Porcupine

    I looked at bandage.statuseffect. It has a different code buildup.

    Code:
    {
      "kind" : "bandage",
      "duration" : 5,
      "primitives" : [
        {
          "name" : "Health",
          "mode" : "max", //don't stack
          "amount" : 0.1450
        }
      ],
      "effectSources" : [ "health" ],
      "mainInterfaceIcon" : "/interface/statuses/heal.png"
    }
    Heck, even if I made a copy and renamed bandage.statuseffect to something else I think it would still complain about duplicate 'kinds' :/
     
  9. The | Suit

    The | Suit Agent S. Forum Moderator

  10. xSlacker

    xSlacker Pangalactic Porcupine

    okay this is my folder structure
    starbound/mods/betterguards*(modinfo file is here)/statuseffects/regen.statuseffect (i renamed it from health.statuseffect to regen.statuseffect)
    (* I did not make this mod, I just wanted to add something to it for personal use.)

    and the regen.statuseffect file contains this code:

    Code:
    {
      "kind" : "health"
    }
    that should remove the "red cross" particles around the character but still give the healing buff.

    and then in the NPC file I put it like this:

    Code:
    "inateStatusEffects" : [
        {
          "kind" : "Protection",
          "amount" : 1.0
        },
        { "kind" : "statuseffects/regen.statuseffect", "amount" : 1 }
      ],
    I have tried just using 'health' and 'statueffects/regen.statuseffect. It still complains about duplicates
     
  11. The | Suit

    The | Suit Agent S. Forum Moderator

    It is finding duplicates of what - show your starbound.log
     
  12. xSlacker

    xSlacker Pangalactic Porcupine

    Code:
    Info: Preparing Star::Root...
    Info: Loading Star::Configuration from '..\starbound.config'
    Info: Done preparing Star::Root.
    Info: Client version 'Beta v. Enraged Koala - Update 6' Protocol: 642
    Info: Running from : D:\Program Files (x86)\Steam\steamapps\common\Starbound\win32\starbound.exe
    Info: Starting from the title screen
    Info: Initialized SDL
    Info: Initialized SDL Video
    Info: Initialized SDL Joystick
    Info: Initialized SDL Sound
    Info: Opened default audio device with 44khz / 16 bit stereo audio, 2048 sample size buffer
    Info: Initializing SDL Window
    Info: Loading Star::Root...
    Info: Loading Star::Configuration from '..\starbound.config'
    Error: Exception raised during Root finishInitialization: StarException: Duplicate status effect asset kind Name health. configfile /statuseffects/regen.statuseffect
      StatusEffectDatabase::load()
      Root::reload()
      _Function_handler<void (), _Bind<ClientApplication::preSplashInitialization()::{lambda()#1} ()> >::(_Any_data)
      ThreadImpl::runThread(void*)
      BaseThreadInitThunk
      RtlInitializeExceptionChain
      RtlInitializeExceptionChain
    
    Info: Created initial window 1016x714
    Info: Initializing SDL Window
    Info: Re-created window 1016x714
    Info: Shutting down Star::Root
    Error: StarException: An error occurred during loading: StarException: Duplicate status effect asset kind Name health. configfile /statuseffects/regen.statuseffect
      StatusEffectDatabase::load()
      Root::reload()
      _Function_handler<void (), _Bind<ClientApplication::preSplashInitialization()::{lambda()#1} ()> >::(_Any_data)
      ThreadImpl::runThread(void*)
      BaseThreadInitThunk
      RtlInitializeExceptionChain
      RtlInitializeExceptionChain
    
      ClientApplication::postSplashInitialization()
      ClientApplication::update()
      StarApplicationBase::run()
      _SDL_main
      _console_main
    The thing I noticed it is complaining that there is a duplicate kind name "health". So how do I make my own "kind" that has the same effects as health? o_O'
     
  13. The | Suit

    The | Suit Agent S. Forum Moderator

    The zip file is the wrong way to do it [right way is through a merge as shown below], but I don't know how you keep getting duplicate

    Code:
    {
      "__merge" : [
      ["delete", "effectSources" ]
      ],
      "kind" : "health"
    }
    But merging requires you first to know how to create a proper directory structure before hand.
    http://community.playstarbound.com/...iding-and-merging-config-files-in-mods.53775/

    Either way the zip file should work fine.
    Remove what ever mod you made and status effects before hand
     

    Attached Files:

  14. xSlacker

    xSlacker Pangalactic Porcupine

    should I add the 'merge' code to the statuseffect file?
    and I have made a proper mod folder structure, heck I even triple check that link you gave me... :s


    EDIT: Agh, I give up. Thanks for your help though. I'll just give the NPCs the "redstim" effect, basically what mini bosses use. :p
     
    Last edited: Apr 12, 2014
  15. glider521al

    glider521al Scruffy Nerf-Herder

Share This Page