Forum

> > CS2D > Scripts > [Lua] Zombie Damage
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch [Lua] Zombie Damage

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt [Lua] Zombie Damage

Fehu
User Off Offline

Zitieren
Anybody know why this don't work ?
1
2
3
4
5
6
addhook("hit","wtf")
function wtf(id,src,wpn,hpd,apd)
	if dmg[src]>=1 then
		object(id,"health")-(hpd+dmg[src])
	end
end

alt Re: [Lua] Zombie Damage

Surplus
User Off Offline

Zitieren
If you are trying to change the health of the object, im pretty sure its
1
object(id,"health")-(hpd+dmg[src])

alt Re: [Lua] Zombie Damage

Fehu
User Off Offline

Zitieren
user Surplus hat geschrieben
If you are trying to change the health of the object, im pretty sure its
1
object(id,"health")-(hpd+dmg[src])

But this give me error.
1
LUA ERROR: sys/lua/test.lua:64: unexpected symbol near '-'

alt Re: [Lua] Zombie Damage

Fehu
User Off Offline

Zitieren
user kalis hat geschrieben
=.= i think :
1
object(id,"health") =  object(id,"health")-(hpd+dmg[src])

Same error.
1
LUA ERROR: sys/lua/rpg_lol.lua:647: unexpected symbol near '='

alt Re: [Lua] Zombie Damage

Cure Pikachu
User Off Offline

Zitieren
This should do it.
1
2
3
4
5
6
7
8
addhook("objectdamage","wtf")
function wtf(id,ptdmg,pl)
	if object(id,"type") == 30 then
		if dmg[pl] >= 1 then
			object(id,"health") = object(id,"health")-dmg[pl]
		end
	end
end

alt Re: [Lua] Zombie Damage

Fehu
User Off Offline

Zitieren
user Cure Pikachu hat geschrieben
This should do it.
1
2
3
4
5
6
7
8
addhook("objectdamage","wtf")
function wtf(id,ptdmg,pl)
	if object(id,"type") == 30 then
		if dmg[pl] >= 1 then
			object(id,"health") = object(id,"health")-dmg[pl]
		end
	end
end


Same error. O.o

alt Re: [Lua] Zombie Damage

EngiN33R
Moderator Off Offline

Zitieren
The function object() RETURNS a value, it's not a variable hence you can't set it. You need to use a console command to change the health of an object and I don't remember which one if there's one at all.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht