Forum

> > CS2D > Scripts > [Lua] Zombie Damage
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Lua] Zombie Damage

8 replies
To the start Previous 1 Next To the start

old [Lua] Zombie Damage

Fehu
User Off Offline

Quote
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

old Re: [Lua] Zombie Damage

Surplus
User Off Offline

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

old Re: [Lua] Zombie Damage

Fehu
User Off Offline

Quote
user Surplus has written
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 '-'

old Re: [Lua] Zombie Damage

Fehu
User Off Offline

Quote
user kalis has written
=.= 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 '='

old Re: [Lua] Zombie Damage

Cure Pikachu
User Off Offline

Quote
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

old Re: [Lua] Zombie Damage

Fehu
User Off Offline

Quote
user Cure Pikachu has written
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

old Re: [Lua] Zombie Damage

EngiN33R
Moderator Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview