Forum

> > CS2D > Scripts > More than 250hp
Forums overviewCS2D overview Scripts overviewLog in to reply

English More than 250hp

8 replies
To the start Previous 1 Next To the start

old More than 250hp

alluclone1
User Off Offline

Quote
How do i make script i can have more than 250 hp like BlazzingEyed script have?

old Re: More than 250hp

StirlizZ-Fapicon
Super User Off Offline

Quote
Zombies Incoming! at 9 march of 2011.


P.S. Check Blazz`s script for hp. You must keep in mind that turrets decrease zombies hp before script hp will be deleted
edited 1×, last 28.02.11 09:48:29 pm

old Re: More than 250hp

leoska
User Off Offline

Quote
Fapicon spam!!!
you need to create a variable that will change as a function of hook hit
1
2
3
4
5
6
addhook("hit","_hit")
function _hit(p,s,w,h,a)
if player_health > 0 then
player_health = player_health - h;
end;
end;
edited 2×, last 01.03.11 12:28:17 am

old Re: More than 250hp

alluclone1
User Off Offline

Quote
i dont understand blazz's zombie mod. he have too impossible lines for me and i have tried many thinks like. get random hp 1000-4000, but when human shoot me i have only 100 hp

can someone make for me example it easier than blazz's

EDIT: i get this error when i use that hook
1
2
if player_health > 0 then
LUA ERROR: sys/lua/test2.lua:151: attempt to compare number with table

old Re: More than 250hp

alluclone1
User Off Offline

Quote
not work its give same error. do i need make something more?

i add what my script have
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
addhook("spawn","humanspawnz")
function humanspawnz(id)
if (player(id,"team")==2) then
zm_health[id] = 0
dmg_factor[id] = math.random(0, 30)
flamesec[id] = 0
zm_health_set[id] = 0
randspeed[id] = 0
eaten[id] = 0
randminus[id] = 0
end
end

addhook("spawn","update")
function update(id)
zm_knock[id] = math.random(0, 3)
flamesec[id] = 0
advsec[id] = 0
flamed[id] = 0
milsec[id] = 0
flamedsecond[id] = 0
speedmodadv[id] = 0
randspeed[id] = 0
randminus[id] = 0
end

addhook("hit","hits")
function hits(id,source)
if player(id,"team")==1 and player(id,"team")~=player(source,"team") then
if player(source,"y")-16>player(id,"y") then
parse("setpos "..id.." "..player(id,"x").." "..-zm_knock[id]+player(id,"y"))
elseif player(source,"y")+16<player(id,"y") then
parse("setpos "..id.." "..player(id,"x").." "..zm_knock[id]+player(id,"y"))
end
if player(source,"x")-16>player(id,"x") then
parse("setpos "..id.." "..-zm_knock[id]+player(id,"x").." "..player(id,"y"))
elseif player(source,"x")+16<player(id,"x") then
parse("setpos "..id.." "..zm_knock[id]+player(id,"x").." "..player(id,"y"))
end
end
end

addhook("spawn","updatezm")
function updatezm(id)
if (player(id,"team")==1) then
zm_health[id] = math.random(1000, 4000)
zm_health_set[id]=zm_health_set[id]+zm_health[id]
zm_speed[id] = 2
zm_knock[id] = math.random(0, 3)
flamesec[id] = 0
advsec[id] = 0
flamed[id] = 0
milsec[id] = 0
flamedsecond[id] = 0
speedmodadv[id] = 0
zm_health_set[id] = 0
randspeed[id] = 0
randminus[id] = 0
parse('hudtxt2 '..id..' 3 "©255000000HEALTH:   '..zm_health[id]..'" 17 430')
end
end

addhook("startround","setct")
function setct()
local i
for i = 1, 32 do
if player(i,"team")==1 then
parse("makect "..i)
end
end
end

addhook("ms100","hudtxts")
function hudtxts(id)
for h = 1, #player(0,'table') do
if (player(h,"team")==1) then
parse('hudtxt2 '..h..' 3 "©200000000HEALTH:   '..zm_health[h]..'" 17 430')
end
end
end

addhook("hit","_hit")
function _hit(p,s,w,h,a)
if player_health[id] > 0 then
player_health = player_health - h;
end;
end;

old Re: More than 250hp

EngiN33R
Moderator Off Offline

Quote
What do you need all those lines for?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function initArray2(f,v)
	local cmd={}
	for c=1,f do
		cmd[c]=v
	end
	return cmd
end

player_health=initArray2(32,0)

addhook("spawn","sethealth")
function sethealth(id)
	player_health[id]=1000 --set your own value here
end

addhook("hit","ow")
function ow(id,src,_,dmg)
	if (player_health[id]>=dmg) then
		player_health[id]=player_health[id]-dmg
		return 1
	else
		return 0
	end
end1

Should work.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview