Forum

> > CS2D > Scripts > Building stats?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Building stats?

2 replies
To the start Previous 1 Next To the start

old Building stats?

Accurator
User Off Offline

Quote
I needed all buildings HP and upgrade stats, and found them. If someone else needs them, here they are.

Building HP stats >

Building upgrade stats >
edited 3×, last 14.04.14 03:44:17 pm

old Re: Building stats?

Conscience
User Off Offline

Quote
Not tested, but here is how you can get the object health:
1
2
3
4
function _objectdamage(id,damage,player)
	msg(damage+(object(id,"health")))
end
addhook("objectdamage","_objectdamage")
This might print the original health + the damage, or it will print the health it has after the hit and the damage it has taken.

old Re: Building stats?

Accurator
User Off Offline

Quote
Improved that code a bit. First it listed the object's HP before it was hit, plus the damage it had taken. So for example, if a building had 100 HP before hit, then it was hit by a knife (45 damage), it would give the value 145.

I made it list the building's HP before it was hit, without the damage it had taken, then the damage it had taken, and then the HP before it was hit minus the damage it had taken.

1
2
3
4
5
6
7
8
9
10
function _objectdamage(id,damage,player)
	 msg"--OBJECT HIT--"
	 msg"Old HP"
	 msg((object(id,"health")))
	 msg"Damage"
	 msg(damage)
	 msg"New HP"
	 msg((object(id,"health"))-damage)
end
addhook("objectdamage","_objectdamage")

EDIT: After a while I figured out how to show upgrade value as well.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function _objectdamage(id,damage,player)
	 msg"--OBJECT HIT--"
	 msg"Old HP"
	 msg((object(id,"health")))
	 msg"Damage"
	 msg(damage)
	 msg"New HP"
	 msg((object(id,"health"))-damage)
end
addhook("objectdamage","_objectdamage")

function _objectupgrade(id,player,progress,total)
	 msg"Upgrade value"
	 msg(object(id,"upgrade")+1)
	 msg"Needed"
	 msg(total)
end
addhook("objectupgrade","_objectupgrade")
edited 1×, last 14.04.14 03:39:18 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview