Forum

> > CS2D > Scripts > Force bot specific melee weapon
Forums overviewCS2D overview Scripts overviewLog in to reply

English Force bot specific melee weapon

3 replies
To the start Previous 1 Next To the start

old Force bot specific melee weapon

Casper-
User Off Offline

Quote
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?

old Re: Force bot specific melee weapon

LoaderFRA
User Off Offline

Quote
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.
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.

old Re: Force bot specific melee weapon

Masea
Super User Off Offline

Quote
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.

1
2
3
4
5
6
addhook("spawn", "_spawn")
function _spawn(id)
	if player(id, "bot") then
		return "78"
	end
end
Maybe this?

old Re: Force bot specific melee weapon

Casper-
User Off Offline

Quote
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.

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.
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview