Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

How does BotBehaviorSet.SearchItemRange work?

Share questions, scripts and tutorials related to the ScriptAPI in SFD.
Forum rules
By using the forum you agree to the following rules.
Post Reply
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

How does BotBehaviorSet.SearchItemRange work?

Post by NearHuscarl » Fri Feb 21, 2020 6:14 pm

I want to limit the radius bots can search for weapons. Currently I have tried multiple values but I am unable to get a result that make sense. I want to do 2 things:

- Draw a search radius to better understand and debug. Something like

Code: Select all

Game.DrawCircle(player.GetWorldPosition(), player.GetBotBehaviorSet().SearchItemRange ??)
- Limit the search range to really close range. Particularly in my case, I want any weapons outside of the blue lines should not be picked up at all. All of the values I tried didn't work so far

Image

EDIT: Here is the map
0 x
Image

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 25

Post by JakSparro98 » Fri Feb 21, 2020 9:18 pm

For debugging the search item range all you need to do is simply enable one of the already available debug features (F7)
Image

Keep in mind that every modification you do on a BotBehaviorSet needs to be reflected on the bot itself(since you are working on a cloned instance and not a reference), you need to set the behavior back like so:

Code: Select all

BotBehaviorSet BehaviorSet=plr.GetBotBehaviorSet();
BehaviorSet.SearchItemRange=45;
plr.SetBotBehaviorSet(BehaviorSet);
0 x

NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Post by NearHuscarl » Fri Feb 21, 2020 9:53 pm

Thanks for the quick response. Now I can properly see the search range. But now the bots still search for weapons that are way outside of the green circle so I am still not sure how does that work.

Image
0 x
Image

User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 25

Post by JakSparro98 » Fri Feb 21, 2020 10:27 pm

Mhn, yeah... I'm conducting some tests and It seems that it's ignoring the new range, that happens not only for item search but for all the others ranged properties, I'm pretty sure it was working as intended in the past, let's wait to @Gurt before saying the last word (that is bug).
0 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Sat Feb 22, 2020 2:56 pm

If a bot has already spotted a weapon before you change the search range the bot will still go for the search item if it's within an extra 300 distance.
Default search range is 250 I think. You may have better luck changing this value as the bot is created instead of changing it afterwards.

Perhaps we should add something to reset the bot's search item if the search range has changed, but don't know if that's the case here.
0 x
Gurt

NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Post by NearHuscarl » Sat Feb 22, 2020 5:07 pm

Pretty sure I spawned the weapon after the range was reset, the bot still went for it

https://i.imgur.com/97DTViz.mp4

UPDATE: it looks like it's been fixed in the latest update 1.3.5
0 x
Image

Post Reply