Modding Help How would I make the Villagers invulnerable and/or block damage?

Discussion in 'Starbound Modding' started by StrikerTheHedgefox, Mar 7, 2014.

  1. StrikerTheHedgefox

    StrikerTheHedgefox Void-Bound Voyager

    I'm trying to make Villagers and other friendly NPCs invulnerable to player damage, but don't know where I should begin. Could anyone with any Starbound Modding knowledge (or someone at ChuckleFish) point me in the right direction?
     
  2. You figure this one out mate... and you will personally have my thanks. Ive been trying to figure this out since Angry.

    As a note... No type of damage team stops this from happening. Ive already tried that route... didnt work.
     
  3. zeidrich

    zeidrich Tentacle Wrangler

    I wonder if you could do something like:

    Modify the meleeattack and rangedattack states of the villagers to test to see if it is a player who attacked them. If it is, don't retaliate.
    If it was the player who attacked them, cause something to create a high potency short duration healing statuseffect on themselves.
    If it was an enemy who attacked them, retaliate as normal.

    It is probably not perfect, but it might be enough to stop you from accidentally killing people or angering them.
     
    Kawa likes this.
  4. while that's nice it still doesn't solve the problem, and NPCs will still take the hit from bullets of intended targets behind them.
     
  5. Jatz

    Jatz Subatomic Cosmonaut

    I had a discussion with a friend about the same exact thing, now this may not be a real option, but here's something,...

    What if you custom wrote a script.lua file so that anytime a villager/npc was attacked it would anti-aggro, and return to normal state.

    Also give them insane amounts of Protection, so that any attack would be blocked regardless, and they would hit the anti-aggro script that you write.


    EDIT: Invisible Invincible Armors? equipped to npc's (it would always block, like you going to a t1 planet in imperv armor) Along with an anti-aggro script.


    EDIT 2: This could even be done possibly, by reverse-coding the aggrostate.lua file.
     
    Last edited: Mar 7, 2014
  6. StrikerTheHedgefox

    StrikerTheHedgefox Void-Bound Voyager

    I once saw a server that had villagers and merchants who'd always show the "Block" text whenever they were hit, and ignore all kinds of player-based damage. I just wish I knew how they did it...
     
  7. OP'd armor.
    Look right above your post mate.
     
    Jatz likes this.
  8. lornlynx

    lornlynx Cosmic Narwhal

    Code:
      --- Gets the entity's damage team
      -- Damage teams control which other entities can be damaged by this entity.
      -- @returns Table (map) of: { type = <numeric>, team = <numeric> }
      damageTeam = function() end,
    from here

    you'd have to find out the function to set the team number and give them a unique one so they can't be damaged by players and monsters
     
  9. Jatz

    Jatz Subatomic Cosmonaut


    I think that's already been tried, as per the second post.

    As I stated this can be done with OP'd invisible armor, and by using a NONagressState.lua type file.

    I also wonder if you can't follow the tile route, and just give them -1 Base Max HP?

    Code:
       "baseMaxHealth" : -1,
        "baseMaxEnergy" : 40,
        "bodyMaterialKind" : "organic",
        "damageConfig" : "/damage/damageresponse/npcs.config",
        "invulnerabilityTime" : 0,
    
    Like that.

    ALSO TO ANYONE: Know what invulnerability timer is? Set it to 9999999999999999999999???
     
  10. telles0808

    telles0808 Cosmic Narwhal

    I already made a NPC invulnerable to player damage, but monsters still hurting them, so, I think it's not possible with the actual lua files. Removing completely the damage system from the luas (or better, duplicating them from custom NPCs) should work better than using team and damage options.
     
  11. StrikerTheHedgefox

    StrikerTheHedgefox Void-Bound Voyager

    If you did this, tell us how. (Post scripts, examples)
     

Share This Page