smilz0 / Left4Bots

Improvements for the L4D2 survivor bots
https://steamcommunity.com/sharedfiles/filedetails/?id=3022416274
39 stars 4 forks source link

Bots float when executing 'wait' order on elevators #2

Closed 4512369781 closed 1 year ago

4512369781 commented 1 year ago

Set "movetype" makes bots do nothing,

NetProps.SetPropInt(self, "movetype", 0);

but set "m_fFlags" can solve the problem,

ATCONTROLS = 64; // Player can't move, but keeps key inputs for controlling another entity
NetProps.SetPropInt(self, "m_fFlags", NetProps.GetPropInt(self, "m_fFlags") | ATCONTROLS);

and also need this to prevent bot Teleport

Convars.SetValue("sb_unstick", 0);
smilz0 commented 1 year ago

Actually i spent some time trying to find the best way to do it. I also tried with different m_fFlags values. The movetype approach seemed the best one to me because the bots don't teleport and you don't have to bother changing sb_unstick. Also because sb_unstick affects all the bots but the new wait order can be given to a single bot. You would have the other bots not teleporting if they get stuck. Btw they still shoot and shove, only their locomotion is stopped.

4512369781 commented 1 year ago

Actually i spent some time trying to find the best way to do it. I also tried with different m_fFlags values. The movetype approach seemed the best one to me because the bots don't teleport and you don't have to bother changing sb_unstick. Also because sb_unstick affects all the bots but the new wait order can be given to a single bot. You would have the other bots not teleporting if they get stuck. Btw they still shoot and shove, only their locomotion is stopped.

Sorry, I misremembered, the bots does shoot and shove. but there are two problems:

  1. bot float when they taking the elevator.
  2. bot will not being dragged by a tongue.

oh, there is another problem, the following code should be moved to the top, otherwise if you execute "return Left4Bots.Settings.bot_think_interval;" in advance, it will not modify "FuncI ", which could result in multiple bots having the same "FuncI".

if (++FuncI > 5)
    FuncI = 1;
smilz0 commented 1 year ago

Actually i spent some time trying to find the best way to do it. I also tried with different m_fFlags values. The movetype approach seemed the best one to me because the bots don't teleport and you don't have to bother changing sb_unstick. Also because sb_unstick affects all the bots but the new wait order can be given to a single bot. You would have the other bots not teleporting if they get stuck. Btw they still shoot and shove, only their locomotion is stopped.

Sorry, I misremembered, the bots does shoot and shove. but there are two problems:

1. bot float when they taking the elevator.

2. bot will not being dragged by a tongue.

oh, there is another problem, the following code should be moved to the top, otherwise if you execute "return Left4Bots.Settings.bot_think_interval;" in advance, it will not modify "FuncI ", which could result in multiple bots having the same "FuncI".

if (++FuncI > 5)
  FuncI = 1;

Lol you are right 20230820170310_1 These are definitely bugs. I will see what i can do to fix them. Thanks.

smilz0 commented 1 year ago

I think i fixed it. Now the current order is automatically paused as soon as the bot is pinned by a special infected and the wait order automatically terminates if the wait location is on a nav area with an elevator.