Forum

> > CS2D > Scripts > Issue with BOTs
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Issue with BOTs

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Issue with BOTs

caxanga334
User Off Offline

Zitieren
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 >
1× editiert, zuletzt 13.11.18 13:05:04

alt Re: Issue with BOTs

DC
Admin Off Offline

Zitieren
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...
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht