English fai_collect : error tactical shield/ammo ?

2 replies
Goto Page
To the start Previous 1 Next To the start
Up
LoaderFRA
User
Offline Off
Hello every one,
I "upgrade" bots by myself and my bots collect ammo if bots don't have ammo (working).

But when bots collect Tactical Shield, CS2D give a error :
Code:
1
2
3
LUA ERROR: bots/includes/collect.lua:62: attempt to call global 'weapon' (a nil value)
 -> bots/includes/collect.lua:62: in function 'fai_collect'
 -> bots/Standard AI.lua:110: in function <bots/Standard AI.lua:85>


Maybe, tactical shield give error because he don't need ammo to work and bots think and try, and give error for that.

I use this "code":
Code:
1
elseif itype>=61 and itype<=62 and weapon(id,"ammoin")==0 then


How fix that ?
Thanks for advance.
Believe in your dreams and never give up.
07.06.18 08:14:30 pm
Up
Masea
Super User
Offline Off
There is no such function called cs2d lua cmd weapon. And this is why that's not working. In order to fix that, you simply need to replace it with cs2d lua cmd item.

Code:
elseif itype >= 61 and itype <= 62 and item(id, "ammoin") == 0 then
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
09.06.18 05:02:44 pm
Up
Cure Pikachu
User
Online On
@user Masea: But the parameter for the
fai_collect
function in the bot AI is for player ID, cs2d lua cmd item's
id
parameter is for the item's internal ID. I'd make use of the cs2d lua cmd playerammo function I suppose.
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
To the start Previous 1 Next To the start