English Force bot specific melee weapon

3 replies
Goto Page
To the start Previous 1 Next To the start
Up
SkullFace
User
Offline Off
I'm trying to force normal T bots (not zombies) to use Claws instead of Knife/Wrench.

Even though they were stripped away from the default melee weapon, they still get it back when they see an enemy.
I've tested it with setweapon in this order.

1. Equip claws
2. Setweapon to claws
3. Strip knife/wrench
4. Setweapon to knife/wrench; I get an error here telling me the player doesn't have it.
5. The bot sees the enemy and gets the knife back. In my case its wrench.

Setting the bot weapons to melee only; isn't really what I need. As for what I'm doing; varies from bot to bot.
Is it like hardcoded in the game that when a bot doesn't have any firearm they will always use a knife? Even if they had a chainsaw?
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
30.05.18 07:16:04 pm
Up
LoaderFRA
User
Offline Off
Me, i use this code for bots select tactical shield.

PS: i tested with chainsaw, not working but, BUT, it's possible .

I see in server zombie plague, bots with satched charge.
Bots can wearing portal gun but give error (flood command: reload).
You can edit this code , if you want.
Code:
1
2
3
4
5
function selectweapon(id)
     if player(id,"weapontype")~=41 then
     ai_selectweapon(id,41)
     end
end


PS: I add line in file "buy" in folder bots for more "luck".
If they buy tactical shield, shield is selected.
30.05.18 09:28:14 pm
Up
Masea
Super User
Offline Off
I'm afraid you're using cs2d cmd equip in a cs2d lua hook spawn hook, which is a wrong use as mentioned in the documentation.

Code:
1
2
3
4
5
6
addhook("spawn", "_spawn")
function _spawn(id)
     if player(id, "bot") then
          return "78"
     end
end
Maybe this?
Create your UI easy and fast: UI Framework | Go to the deep of darkness and test your bravery: file cs2d Outlast 2 Modification (27)
30.05.18 09:44:22 pm
Up
SkullFace
User
Offline Off
Yeah, I'm using spawn hook but didn't use the equip command.
The bots do equip the claws but when they see the enemy, they get the knife back that was removed from inventory.

This is the part of script that I'm using.

Code:
1
2
3
4
5
6
7
8
elseif c==5 then
          --##Fanatic
          
          
               parse("setmaxhealth "..id.." "..HealthFanatic.."")
               parse("speedmod "..id.." "..SpeedFanatic.."")
               parse("setweapon "..id.." 78")
               return "78";


The reason why I want it to be with claws is to 'animate' a suicide bomber running towards you.

With this part of the script.
Code:
1
2
3
4
5
6
7
8
9
10
11
addhook("hit","FanaticClaws")
function FanaticClaws(id,source,weapon,hpdmg,apdmg,rawdmg,oid)
     if weapon == 78 then
          if player(id,"team") == 1 then
          msg("FANANuke")
          parse("explosion "..player(id,"x").." "..player(id,"y").." 128 500 "..id)
          parse("customkill "..source.." C4 "..id.." ")
          parse("customkill "..source.." C4 "..source.." ")
          end
     end
end
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
To the start Previous 1 Next To the start