Forum

> > CS2D > Scripts > bot select knife when there are no enemies nearby
Forums overviewCS2D overview Scripts overviewLog in to reply

English bot select knife when there are no enemies nearby

4 replies
To the start Previous 1 Next To the start

old bot select knife when there are no enemies nearby

khaled1968
User Off Offline

Quote
Hi, I was trying to make bots select knife when there are no enemies nearby them, to make bots performance better ofc, so I used this code...

1
2
3
4
5
6
7
8
9
10
addhook("second","enemycheck")
function enemycheck()
for id=1,32 do
if player(id,"exists") and player(id,"bot") then
if ai_findtarget(id)==0 then
ai_selectweapon(id,50)
end
end
end
end

But the problem is that bots are putting knife ONLY in first time when they spawn, after that, if they faced an enemy they just put there weapons and never bring the knife back again! The code activate only for one time and idk why!
edited 1×, last 07.08.22 02:18:03 am

old Re: bot select knife when there are no enemies nearby

LoaderFRA
User Off Offline

Quote
I use this in Standard IA.lua
1
2
3
4
5
if vai_mode[id]==0 then
		-- ############################################################ 0: IDLE -> decide what to do next
		vai_timer[id]=0; vai_smode[id]=0
		ai_selectweapon(id,50)
		fai_decide(id)
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview