1. Hello. I have a problem with get building health.
    I want say in chat like some "/setinv" and click by some building, and change health to 999999 (like invulnerable)

    I know how create chat cmd, get object by raycast. But i don't know which component response for building health.

    Anyone know i can do this?

    p.s. building = entity was created by building plan
     
  2. Use a decompiler to check the BaseEntity. I think there's a setHealth and setStartHealth. I'll check later today but that should get you started.
     
  3. Thank you.
    I don't see that HitInfo has extension with method GetEntity. Now i can change health, and it works. But when i try to change max health, it not changed. And when entity take damage, health is clamped, and it return to max health value. There's one method InitializeHealth(float health, float maxHealth); but max health don't change.
    I use dot peek for decompile.
    In result i use take damage hook for scale damage to zero.
     
  4. Dunno if this'll help with raycast and what not but I have a plugin that sets HP of the parent object and an attached object that is spawned immediately after the parent object spawns like so:
    Code:
    parent.GetComponent<BaseCombatEntity>().health = 50;
                ent.GetComponent<BaseCombatEntity>().startHealth = 50;            ent.UpdateNetworkGroup();
                ent.SendNetworkUpdateImmediate();            ent.Spawn();
    Hopefully someone can correct me if I'm wrong but I don't think you can set max health and have it display correclty. The ent I'm using has like 500 max hp, but when you spawn it it it has 50/500 and acts normally.

    I wish I could set the max HP but I've been messing around with it and it doesn't seem possible as I think the client handles the display of max hp.
     
  5. The max entity health is decided from the max health of the current building grade of the building block. This means you have to set the max health on the current building grade. An example of setting the current building grade's health would be:

    Code:
    var buildingBlock = (BuildingBlock)baseEntity;
    buildingBlock.currentGrade.gradeBase.baseHealth = 50;
    buildingBlock.SendNetworkUpdate();
    // OR buildingBlock.Spawn() if it hasn't been spawned yet, you shouldn't call SendNetworkUpdate on an entity that hasn't spawned yet.
    
    This way the building block would be repaired to the new max health as well.

    It would still show the default max health on the client, there's not anything you can do about that unfortunately.

    Additionally it does not save to the new max health so you would have to set the max health on server startup manually if it's supposed to be persistent.
     
  6. Not easier using zone menager and simoly by command set god mode to building you wish ?
     
  7. I was able to change magic hammer to create walls with more health. I was able to make them cost more and have more hp... hoping to limit how big bases needed to be (quality over quantity). Didn't really make it into production... players seemed to be too stupid to understand this change.
     
  8. I want a plugin like this but instead of having the building to be god mode which you can do with zone manager, I want to set a higher health than usual and if that is complicated, have it so you can make an area (with zone manager or something) to take less damage while inside.