HL2DM custom bot weapons
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
HL2DM custom bot weapons
Hello script writers I am using HRC (hurricane bots) and would like a script that would let the bots use custom weapons. The weapons are weapon_ak47, weapon_alyxgun, weapon_mp5, weapon_oicw, weapon_sniper. The bots only seem right now able to use just the normal (stock) weapons, Could someone on here help me out on this, thank you.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: HL2DM custom bot weapons
Hi, do you mean that bots would spawn with the random custom weapons?
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: HL2DM custom bot weapons
cssbestrpg wrote:Hi, do you mean that bots would spawn with the random custom weapons?
Yes, i use sourcemod hl2dm customguns script. The bots will only spawn with the normal weapons.
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: HL2DM custom bot weapons
try this code(Untested) then:
Syntax: Select all
import random
from events import Event
from players.entity import Player
custom_weapons = ['weapon_ak47', 'weapon_alyxgun', 'weapon_mp5', 'weapon_oicw', 'weapon_sniper']
@Event('player_spawn')
def player_spawn(args):
player = Player.from_userid(args['userid'])
if not player.is_bot():
return
primary = player.primary
if not primary is None:
primary.remove()
weapon_to_give = random.choice(custom_weapons)
player.give_named_item(f'{weapon_to_give}')
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: HL2DM custom bot weapons
Ok will do,, here is where i had a scripter write one for me but without custom weapons https://forums.sourcepython.com/viewtopic.php?f=37&t=2521
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: HL2DM custom bot weapons
Update,,,,,Nope does not seem to work,,does not give any errors in log,,,says it loaded, but does nothing, thank you for trying, thses bots do not like custom made weapons i guess lol, ty.daren adler wrote:Ok will do,, here is where i had a scripter write one for me but without custom weapons https://forums.sourcepython.com/viewtopic.php?f=37&t=2521
-
- Senior Member
- Posts: 309
- Joined: Sun May 17, 2020 7:56 am
- Location: Finland
- Contact:
Re: HL2DM custom bot weapons
I guess i need to use different method like the other tread where Kami made a code for random weapons for bots
Edit:
Here is code for other method to give the weapons:
Edit:
Here is code for other method to give the weapons:
Syntax: Select all
import random
from events import Event
from engines.server import queue_command_string
custom_weapons = ['ak47', 'alyxgun', 'mp5', 'oicw', 'sniper']
@Event('player_spawn')
def player_spawn(args):
player = Player.from_userid(args['userid'])
primary = player.primary
if not primary is None:
primary.remove()
weapon_to_give = random.choice(custom_weapons)
queue_command_string(f'hrcbot_player_spawnweapon {weapon_to_give}')
- daren adler
- Senior Member
- Posts: 348
- Joined: Sat May 18, 2019 7:42 pm
Re: HL2DM custom bot weapons
cssbestrpg wrote:I guess i need to use different method like the other tread where Kami made a code for random weapons for bots
Edit:
Here is code for other method to give the weapons:Syntax: Select all
import random
from events import Event
from engines.server import queue_command_string
custom_weapons = ['ak47', 'alyxgun', 'mp5', 'oicw', 'sniper']
@Event('player_spawn')
def player_spawn(args):
player = Player.from_userid(args['userid'])
primary = player.primary
if not primary is None:
primary.remove()
weapon_to_give = random.choice(custom_weapons)
queue_command_string(f'hrcbot_player_spawnweapon {weapon_to_give}')
Nope same as before. i think its the bots, not your fault, thanks for trying tho, I did see i am not updated with the sourcepython,,so before i can say it all does not work,,let me update and get back to ya.
Who is online
Users browsing this forum: No registered users and 9 guests