Forum

> > CS2D > Scripts > Zombie HP
Forums overviewCS2D overview Scripts overviewLog in to reply

English Zombie HP

9 replies
To the start Previous 1 Next To the start

old Re: Zombie HP

iii
User Off Offline

Quote
Here is a script.
after you create them you should run this script:
1
2
3
4
5
for _,npcid in pairs(object(0,"table")) do
	if object(npcid,"health")==150 and object(npcid,"type")==30 then
		parse("damageobject "..npcid.." -1850 0")
	end
end

if you always create them you should add a ms100 hook
i think a zombie has 150 hp, for other npc you must get there hp first. or you can change this:"if object(npcid,"health")==150 and" to "if object(npcid,"health")~=2000 and"
a zombie played by a player has max 250 hp, that can be changed with the hook spawn.

old Re: Zombie HP

iii
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook('spawn','_spawn')
function _spawn(id)
if player(id,"team")==1 then
parse('setmaxhealth '..id..' 250')
parse('sethealth '..id..' 250')
else
parse('setmaxhealth '..id..' 100')
parse('sethealth '..id..' 100')
end

old Re: Zombie HP

D-D3ADxPro
User Off Offline

Quote
user CaneCorso: Actually, you are wrong. Zombies are actually team 1(Terrorists). Every zombie script, they use team 1. Every human is on team 2.


user iii: Your lua script has errors. First of all, you did not put a addhook, which leads into a error because it wasnt functioned. Next, you forgot to put on tabs (It's what causes your lua's to get erros).

Heres the fully fixed script:
1
2
3
4
5
6
7
8
9
10
11
12
addhook("spawn","_spawn")
function _spawn(id)
	if player(id,"team")==1 then
	parse('setmaxhealth '..id..' 250')
	parse('sethealth '..id..' 250')
else
	if player(id,"team")==2 then
	parse('setmaxhealth '..id..' 100')
		parse('sethealth '..id..' 100')
		end
	end	
end

Like user iii said, you need to look in the file archive for extra hp scripts

old Re: Zombie HP

CaneCorso
User Off Offline

Quote
user D-D3ADxPro has written
user CaneCorso: Actually, you are wrong. Zombies are actually team 1(Terrorists). Every zombie script, they use team 1. Every human is on team 2.


user iii: Your lua script has errors. First of all, you did not put a addhook, which leads into a error because it wasnt functioned. Next, you forgot to put on tabs (It's what causes your lua's to get erros).

Heres the fully fixed script:
1
2
3
4
5
6
7
8
9
10
11
12
addhook("spawn","_spawn")
function _spawn(id)
	if player(id,"team")==1 then
	parse('setmaxhealth '..id..' 250')
	parse('sethealth '..id..' 250')
else
	if player(id,"team")==2 then
	parse('setmaxhealth '..id..' 100')
		parse('sethealth '..id..' 100')
		end
	end	
end

Like user iii said, you need to look in the file archive for extra hp scripts

You right , but he puted the hook xD, he need use tab
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview