Raised This Month: $51 Target: $400
 12% 

[TF2] Give Bots Weapons (04.01.2023)


Post New Thread Reply   
 
Thread Tools Display Modes
Markus_Wyand
Junior Member
Join Date: Aug 2022
Old 09-19-2022 , 09:38   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #121

Quote:
Originally Posted by luki1412 View Post
You're changing the values for GetRandomInt incorrectly.
Remember, it's generating a random number from the specified range, inclusively. 0 means the stock weapon. The game gives them stock weapons and I have to remove them and give them different ones. Stock weapons the game gives them sometimes dont show up correctly when pressing F. If we get a 0 from GetRandomInt, I dont do anything and just move to another slot, if we get a nonzero, we Remove their weapon from that slot and the switch statement gives them another weapon based on the value. So the range in GetRandomInt HAS to have corresponding cases in the switch statement(excluding 0).

I do not know what exactly are you trying to achieve with my plugin. Are you trying to give them all melee weapons only?
Yeah, i guess i could list whatever i wanted to do with your plugin.
GENERAL:
Disable most melee unlocks, skins: i tried to make it simplier by disabling those melees that just dont give a lot of effect, plus bots dont use melee that often.
SCOUT:
primary: default scattergun, FAN, BFB
secondary: bonk!, crit cola, mad milk, cleaver
melee: default bat, candy cane
SOLDIER:
primary: default launcher, black box, liberty, cowmangler
secondary: banners only; buff banner, battalions, concheror
melee: default shovel
PYRO:
primary: default flamethrower
secondary: flares only; flaregun, scorchshot (bots cant detonate detonator, cant extinguish with mannmelter)
melee: default axe
DEMOMAN:
primary: Ali baba wee booties
secondary: chargin targe
melee: eyelander
HEAVY:
primary: default minigun, natascha, tommislav
secondary: default shotgun
melee: default fists
ENGINEER:
primary: default shotgun, frontier justice
secondary: default pistol
melee: the jag
MEDIC:
primary: default syringe gun
secondary: default medigun, kritzkrieg, quick fix
melee: ubersaw (i have an ai improver plugin which enables medic bot melee)
SNIPER:
primary: huntsman
secondary: default smg, jarate, razorback, darwin shield, cozy camper
melee: default melee, trivalian shiv, shahansha, bushwacka
SPY:
secondary(revolvers): default revolver, le'tranger, diamondback
melee: default knife, big earner, YER, ice cicle, kunai
sapper: default sapper, recorder
watch: default watch
Markus_Wyand is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 09-19-2022 , 14:33   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #122

Quote:
Originally Posted by Markus_Wyand View Post
Yeah, i guess i could list whatever i wanted to do with your plugin.
GENERAL:
Disable most melee unlocks, skins: i tried to make it simplier by disabling those melees that just dont give a lot of effect, plus bots dont use melee that often.
SCOUT:
primary: default scattergun, FAN, BFB
secondary: bonk!, crit cola, mad milk, cleaver
melee: default bat, candy cane
SOLDIER:
primary: default launcher, black box, liberty, cowmangler
secondary: banners only; buff banner, battalions, concheror
melee: default shovel
PYRO:
primary: default flamethrower
secondary: flares only; flaregun, scorchshot (bots cant detonate detonator, cant extinguish with mannmelter)
melee: default axe
DEMOMAN:
primary: Ali baba wee booties
secondary: chargin targe
melee: eyelander
HEAVY:
primary: default minigun, natascha, tommislav
secondary: default shotgun
melee: default fists
ENGINEER:
primary: default shotgun, frontier justice
secondary: default pistol
melee: the jag
MEDIC:
primary: default syringe gun
secondary: default medigun, kritzkrieg, quick fix
melee: ubersaw (i have an ai improver plugin which enables medic bot melee)
SNIPER:
primary: huntsman
secondary: default smg, jarate, razorback, darwin shield, cozy camper
melee: default melee, trivalian shiv, shahansha, bushwacka
SPY:
secondary(revolvers): default revolver, le'tranger, diamondback
melee: default knife, big earner, YER, ice cicle, kunai
sapper: default sapper, recorder
watch: default watch
I updated the plugin. Hopefully its easier to do this now.
__________________
luki1412 is offline
Markus_Wyand
Junior Member
Join Date: Aug 2022
Old 09-19-2022 , 19:31   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #123

Quote:
Originally Posted by luki1412 View Post
I updated the plugin. Hopefully its easier to do this now.
"It's like christmass morning" thanks for the stability update, i can see how this can be more stable.
So now i gotta put the weapon slot before the weapon ID?
For example: Force A Nature; 0, 45, 10
0 means primary, 45 is the FAN ID number, and what is the 10?
EDIT:
demomen bots who spawn with shield get this error
L 09/19/2022 - 21:21:15: [GiveBotsWeapons.smx] The created weapon entity [Class name: tf_wearable_demoshield, Item index: 406, Index: 74], failed to equip! This is probably caused by invalid gamedata
I updated the give.bots.weapons after i saw the message, and still got the same error again.
This error causes demos to not equip the shield.

Last edited by Markus_Wyand; 09-19-2022 at 20:24.
Markus_Wyand is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 09-19-2022 , 23:15   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #124

Quote:
Originally Posted by Markus_Wyand View Post
For example: Force A Nature; 0, 45, 10
0 means primary, 45 is the FAN ID number, and what is the 10?
EDIT:
demomen bots who spawn with shield get this error
A look at the createweapon function within the code will answer your question, and maybe solve the shield error.
Here's the function:
PHP Code:
bool CreateWeapon(int clientchar[] classnameint slotint itemindexint level 0bool wearable false
Weapon index numbers can be found at this link: https://wiki.alliedmods.net/Team_For...nition_Indexes

This tells us that the format is (client, classname of weapon, slot number, weapon index number, weapon level, and the word 'true' if the weapon is wearable, otherwise blank or false).

So... For a level 15 Three-Rune Blade (item 452) in slot 2 we'd do this:
PHP Code:
createweapon(client"tf_weapon_bat"2452. 15
For a level 20 The Chargin Targe (item 131) in slot 1 we'd do this:
PHP Code:
createweapon(client"tf_wearable_demoshield"1131. 20true
To solve the shield error you probably just need to add the word 'true' at the end of your createweapon command when you are trying to equip wearable weapons.
PC Gamer is offline
Markus_Wyand
Junior Member
Join Date: Aug 2022
Old 09-20-2022 , 00:02   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #125

Quote:
Originally Posted by PC Gamer View Post
A look at the createweapon function within the code will answer your question, and maybe solve the shield error.
Here's the function:
PHP Code:
bool CreateWeapon(int clientchar[] classnameint slotint itemindexint level 0bool wearable false
Weapon index numbers can be found at this link: https://wiki.alliedmods.net/Team_For...nition_Indexes

This tells us that the format is (client, classname of weapon, slot number, weapon index number, weapon level, and the word 'true' if the weapon is wearable, otherwise blank or false).

So... For a level 15 Three-Rune Blade (item 452) in slot 2 we'd do this:
PHP Code:
createweapon(client"tf_weapon_bat"2452. 15
For a level 20 The Chargin Targe (item 131) in slot 1 we'd do this:
PHP Code:
createweapon(client"tf_wearable_demoshield"1131. 20true
To solve the shield error you probably just need to add the word 'true' at the end of your createweapon command when you are trying to equip wearable weapons.
The error persists!
The Create weapon always had the "true" (1, 131, _, true) after i saw your comment i reeplaced _ with 20 for a lvl 20 chargin targe and there is still the same error message and results after the demobot spawns.
Tested it further, it not only happens with the shield, but also the booties, and sniper's wearables too.
They all have (1, "respective ID", weapon level, true) in them.
Markus_Wyand is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 09-20-2022 , 01:30   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #126

Quote:
Originally Posted by Markus_Wyand View Post
The error persists!
Good News! You aren't crazy. I tested the latest version and discovered there is indeed a bug with the recently released version 1.3.

Bad News: You'll have to either wait for a fix from the program author or revert to a previous version like version 1.2 which didn't have the bug.
PC Gamer is offline
Markus_Wyand
Junior Member
Join Date: Aug 2022
Old 09-20-2022 , 01:35   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #127

Quote:
Originally Posted by PC Gamer View Post
Good News! You aren't crazy. I tested the latest version and discovered there is indeed a bug with the recently released version 1.3.

Bad News: You'll have to either wait for a fix from the program author or revert to a previous version like version 1.2 which didn't have the bug.
Jesus, i was starting to think i was crazy since most of the errors were mistakes of mine, finally i report an actual bug!
Markus_Wyand is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 09-20-2022 , 04:30   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #128

Quote:
Originally Posted by Markus_Wyand View Post
Jesus, i was starting to think i was crazy since most of the errors were mistakes of mine, finally i report an actual bug!
I checked so many weapons but not wearables...
Anyways, fixed in the new version.
__________________
luki1412 is offline
Markus_Wyand
Junior Member
Join Date: Aug 2022
Old 09-20-2022 , 09:32   Re: [TF2] Give Bots Weapons (10.10.2021)
Reply With Quote #129

Quote:
Originally Posted by luki1412 View Post
I checked so many weapons but not wearables...
Anyways, fixed in the new version.
Many thanks, man!
It works perfectly now, no complains, and i certainly wont add anything more to this plugin.
Unless you got something in mind, of course.
Markus_Wyand is offline
Markus_Wyand
Junior Member
Join Date: Aug 2022
Old 09-22-2022 , 12:44   Re: [TF2] Give Bots Weapons (20.09.2022)
Reply With Quote #130

Damnit, something went wrong.
Bots once again start to lose weapons eventually, usually when i invite players to my server.
I have an idea why this happens:
-the bots changing classes messes up the strict weapons i want them to use (demoman, who is forced to use booties later changes to soldier because a player changed class, and solders gets his rocket launcher removed, i know it sounds weird)
MAYBE when i force them to use a weapon:
if class demoman:
case TFClass_DemoMan:
{
int rnd = GetRandomUInt(1,1);

switch (rnd)
{
case 1:
{
CreateWeapon(client, "tf_wearable", 0, 405, 20, true);
}
}

Later changes to soldier, something goes wrong and the demoman who is now soldier gets his weapons messed up.
AGAIN THIS ISN'T THE CAUSE, MAYBE. ITS JUST SOMETHING I CAME UP WITH. This weird bug its like a ghost in my machine... this is creeping me out.
EDIT: all the Problems this bug causes so far i've seen:
-Demomen A-posing
-Soldiers not using primary
-Medics not using primary or secondary
-Heavies using melee only (rare, seen only once)
-Snipers going melee only (mostly because i set him wearables for secondary, so i guess his primary gets messed up)
-Engineers not building? (rare, seen only once in payload)
Sorry for keeping this up, i may give up after this one i promise.
I'll leave the .sp file here too.
Attached Files
File Type: sp Get Plugin or Get Source (GiveBotsWeapons.sp - 69 views - 23.9 KB)

Last edited by Markus_Wyand; 09-22-2022 at 12:54.
Markus_Wyand is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode