Increasing door health?Solved
I want to double or triple my door health on my server.. Anyone know if its possible?
Thank
object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
{
	if (entity is Door)
		info.damageTypes.ScaleAll(0.5f);
}

Havent tested it, but this should do it.

Zugzwang
object 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

5d66db4201195.jpg?uid=5d66db72ac9cd 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

i would like to know how to increase health on doors as well
This 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();
	}
}​
Zugzwang
This 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.

Kitty87

has 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.

Zugzwang

Yes, 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

Save the text as a .cs and drop it into your plug-ins folder. I think it's missing some stuff and the begining, though.
Has anyone tested this?
Yes, just not extensively.
can 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
tankurass2day
can 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
It isn't intended to be a complete plugin, just an example of how to do something.
Have used this for quite a while now:

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;
	}
}​
Locked automatically