Forum

> > CS2D > Scripts > hook kill, bot vampire
Forums overviewCS2D overview Scripts overviewLog in to reply

English hook kill, bot vampire

4 replies
To the start Previous 1 Next To the start

old hook kill, bot vampire

LoaderFRA
User Off Offline

Quote
Hi everyone,
I looking for a make a script for make a bot (yes again ) "vampire" (personnality of bots)

When bot Dracula kill, he win the blood (+ 20 HP)

1
2
3
4
5
6
7
8
9
10
addhook("kill", "bot_vampire")
function bot_vampire(killer, victim, weapon, x, y)
	if player(id,"bot")==true and player(id,"name")=="Dracula" then
		if weapon==50 then
		parse('equip '..id..' '..65) 
else
	return
		end
	end
end

But, have a error(s) : × LUA ERROR: sys/lua/autorun/check vampire.lua:3: bad argument #1 to 'player' (number expected, got nil)
-> [C]: in function 'player'

Thanks for advance.

old Re: hook kill, bot vampire

TimeQuesT
User Off Offline

Quote
id
is not set. I think you mean
killer
in
function bot_vampire(-->killer<--, victim, weapon, x, y)
.

In addition you have one "end" too many.

Here you go, remove
-->
and
<--
to make it work.

1
2
3
4
5
6
7
8
9
10
11
addhook("kill", "bot_vampire")
function bot_vampire(killer, victim, weapon, x, y)
if player(-->killer<---, "bot")==true and player(-->killer<--, "name") == "Dracula" then
	if weapon == 50 then
		-- 65 = bandage
		parse('equip '..id..' '..65) 
	else
		return
	end
	--> End removed <--
end

old Re: hook kill, bot vampire

Hajt
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
addhook("kill", "bot_vampire")
function bot_vampire(id, victim, weapon, x, y)
	if player(id, "bot") == true and player(id, "name") == "Dracula" then
		if weapon == 50 then
			local hp = player(id, "health") + 20
			parse(string.format("sethealth %d %d", id, hp))
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview