Thank
Thank
object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
{
if (entity is Door)
info.damageTypes.ScaleAll(0.5f);
}Havent tested it, but this should do it.
Zugzwangobject OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info) { if (entity is Door) info.damageTypes.ScaleAll(0.5f); }Havent tested it, but this should do it.
its scaling damage, he is about scaling health
RyanFromRust
maybe https://umod.org/plugins/building-health allows adding doors?
Nope, its only for building blocks (it have very strange logic with building blocks. when you multiply it on one - it multiply on all of them)
I want to double or triple my door health on my server.. Anyone know if its possible?Its possible
bool started = false;
void OnServerInitialized()
{
started = true;
}
private void OnEntitySpawned(BaseNetworkable entity)
{
if (entity is Door && (entity as BaseEntity).OwnerID != 0)
{
(entity as BaseCombatEntity)._maxHealth *= 2f;
if (started)
(entity as BaseCombatEntity).health = (entity as BaseCombatEntity).MaxHealth();
}
} ZugzwangThis seems to work, but I haven't tested it extensively.bool started = false; void OnServerInitialized() { started = true; } private void OnEntitySpawned(BaseNetworkable entity) { if (entity is Door && (entity as BaseEntity).OwnerID != 0) { (entity as BaseCombatEntity)._maxHealth *= 2f; if (started) (entity as BaseCombatEntity).health = (entity as BaseCombatEntity).MaxHealth(); } }
has this worked? would be a great plugin on it's own.
Kitty87has this worked? would be a great plugin on it's own.
Yes, but as I said, I never did any extensive testing. It doubles door health on placement and persists through server restarts.
ZugzwangYes, but as I said, I never did any extensive testing. It doubles door health on placement and persists through server restarts.
yeah no idea how to add it into a plugin alrdy existing i'd test it on my modded one but ya no idea on how i would add that code lol
It isn't intended to be a complete plugin, just an example of how to do something.tankurass2daycan someone post complete configuration so we can replace all in it with the one you post please
Merged post
its tricky to know where to putt this and in wich mod you talk about make it simple to understand please
bool started = false;
void OnServerInitialized()
{
started = true;
foreach (Door d in BaseNetworkable.serverEntities.Where(x => x is Door && (x as BaseEntity).OwnerID != 0))
{
(d as BaseCombatEntity)._maxHealth *= 2f;
(d as BaseCombatEntity).health *= 2f;
d.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
}
}
void Unload()
{
foreach (Door d in BaseNetworkable.serverEntities.Where(x => x is Door && (x as BaseEntity).OwnerID != 0))
{
(d as BaseCombatEntity).health /= 2f;
(d as BaseCombatEntity)._maxHealth /= 2f;
d.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
}
}
private void OnEntitySpawned(Door entity)
{
if (started && entity.OwnerID != 0)
{
entity._maxHealth *= 2f;
entity.health *= 2f;
}
}