Page 1 of 1

HL2:DM - RANDOM BOT WEAPONS

Posted: Thu Apr 01, 2021 5:48 am
by daren adler
Was wondering if someone could make a random bot weapon script ?. I was using randombotweapon from eventscripts, since i removed es from my server, was wondering if a scripter could make one. heres the way the old one looked.

Code: Select all

event es_map_start
{   
   es_doblock randombotweapon/randomize
}
event player_death
{   
   es_doblock randombotweapon/randomize
}



block randomize
{

     es_setinfo botweapon 0
        es_rand botweapon 1 1100
   
        if (server_var(botweapon) >= 100) do
        {
                hrcbot_player_spawnweapon pistol
       }
      if (server_var(botweapon) >= 150) do
        {
                hrcbot_player_spawnweapon crowbar
        }
      if (server_var(botweapon) >= 200) do
        {
                hrcbot_player_spawnweapon stunstick
        }
      if (server_var(botweapon) >= 250) do
        {
                hrcbot_player_spawnweapon frag
        }       
      if (server_var(botweapon) >= 300) do
        {
                hrcbot_player_spawnweapon smg1
        }
      if (server_var(botweapon) >= 350) do
        {
                hrcbot_player_spawnweapon ar2
        }
      if (server_var(botweapon) >= 400) do
        {
                hrcbot_player_spawnweapon shotgun
        }
      if (server_var(botweapon) >= 450) do
        {
                hrcbot_player_spawnweapon shotgun
        }
      if (server_var(botweapon) >= 500) do
        {
                hrcbot_player_spawnweapon rpg
        }       
      if (server_var(botweapon) >= 550) do
        {
                hrcbot_player_spawnweapon crossbow
        }       
      if (server_var(botweapon) >= 600) do
        {
                hrcbot_player_spawnweapon frag
        }
      if (server_var(botweapon) >= 650) do
        {
                hrcbot_player_spawnweapon pistol
   }
      if (server_var(botweapon) >= 700) do
        {
                hrcbot_player_spawnweapon crowbar
        }
      if (server_var(botweapon) >= 750) do
        {
                hrcbot_player_spawnweapon stunstick
        }
      if (server_var(botweapon) >= 800) do
        {
                hrcbot_player_spawnweapon frag
        }       
      if (server_var(botweapon) >= 850) do
        {
                hrcbot_player_spawnweapon smg1
        }
      if (server_var(botweapon) >= 900) do
        {
                hrcbot_player_spawnweapon ar2
        }
      if (server_var(botweapon) >= 950) do
        {
                hrcbot_player_spawnweapon shotgun
        }
      if (server_var(botweapon) >= 1000) do
        {
                hrcbot_player_spawnweapon shotgun
        }     
      if (server_var(botweapon) >= 1025) do
        {
                hrcbot_player_spawnweapon crossbow
        }       
      if (server_var(botweapon) >= 1050) do
        {
                hrcbot_player_spawnweapon frag
        }     
}

:cool: :cool: PS- i tryed the EventScripts-Emulator but did not work for me. thank you, stay kool.

Re: HL2:DM - RANDOM BOT WEAPONS

Posted: Thu Apr 01, 2021 7:56 pm
by Kami
Hey daren, you can give this a try:

Syntax: Select all

import random
from events import Event
from listeners import OnLevelInit
from engines.server import queue_command_string

types = ['pistol','crowbar','stunstick','frag','smg1','ar2','shotgun','rpg','crossbow']

@OnLevelInit
def _init(map):
choice = random.choice(types)
queue_command_string(f'hrcbot_player_spawnweapon {choice}')

@Event('player_death')
def _death(ev):
choice = random.choice(types)
queue_command_string(f'hrcbot_player_spawnweapon {choice}')

Re: HL2:DM - RANDOM BOT WEAPONS

Posted: Thu Apr 01, 2021 8:04 pm
by daren adler
OK will do, thank you :grin: :grin: Works great,,thank you again for your great work. :cool: :cool: