Forum

> > CS2D > Scripts > Issue with BOTs
Forums overviewCS2D overview Scripts overviewLog in to reply

English Issue with BOTs

2 replies
To the start Previous 1 Next To the start

old Issue with BOTs

caxanga334
User Off Offline

Quote
I've started to modify the BOTs AI again and I'm having some problems. I've made some modifications to the item collection code. The item buy code is also modified.
1
2
elseif itype==56 and player(id,"defusekit")==false and player(id,"team")==2 then
collect=true
This code makes the bots collect defuse kits, i'm getting two problems with it. The first problem is, T bots are trying to pick up defuse kits and the second is bots that already have one are also trying.
The problem also happens with gasmasks and armors
1
2
elseif itype==60 and player(id,"gasmask")==false then
collect=true
1
2
elseif itype>=82 and player(id,"armor")<=203 then
collect=true
Bots kept trying to get medic armor despite already having one.
The full code is available on my github.

Edit: the cause of the problem is my code to pick up armor.
Spoiler >
edited 1×, last 13.11.18 01:05:04 pm

old Re: Issue with BOTs

DC
Admin Off Offline

Quote
One thing which is wrong (it might not be the one causing your problems) is how you check the itype in your armor collecting code.

You simply do a
itype>=X
. This is wrong because it will also be true for ALL items with a higher ID. And these might not be armor items at all!
IMG:https://www.cs2d.com/img/ref_items.png


So for the kevlar checks it should be
itype>=X and itype <= 58
instead.
For the special armors it should be
itype>=X and itype <= 84
.
With X being the current value you are already using for the checks.
This way you exclude other items from the armor logic and avoid that a bot tries to - for instance - collect a chainsaw because its armor value is low...
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview