Forum

> > CS2D > Scripts > Building stats?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Building stats?

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Building stats?

Accurator
User Off Offline

Zitieren
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 >
3× editiert, zuletzt 14.04.14 15:44:17

alt Re: Building stats?

Conscience
User Off Offline

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

alt Re: Building stats?

Accurator
User Off Offline

Zitieren
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")
1× editiert, zuletzt 14.04.14 15:39:18
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht