Botvoice2
From EventScripts Community Encyclopedia
// Al3c's BotVoice v2.5.2 Counter-Strike: Source script // // -> Provides an additional radio menu for commands that bots use. // Automatically changes the menu based on team and type of map. // Current map types supported are de_ (bomb), cs_ (hostage), and other. // (Other commands are not team or goal specific) // // -> Install instructions: // 1. Install Mattie's EventScripts plugin (v1.1): // http://mattie.info/cs // // 2. Copy all of this script into a new textfile: // cstrike/addons/eventscripts/botvoice2/es_botvoice2.txt // // 3. Add the following line somewhere in autoexec.cfg: // es_load botvoice2 block config { // SETTINGS: // Set to 1 to enable botvoice (the script will not // work at all unless this is set to 1). mattie_botvoice 1 // Set to 1 in order to allow the server to post instructions, // at the beginning of each round, for enabling the menu. botvoice_announce 1 // Set to 1 to enable debugging mode. botvoice_debug 0 // Key to use to bring up menu if not specified by the client. // This may replace a lot of people's ventrillo or teamspeak binding. // Other possible keys to use include MOUSE3 (press down on wheel), // q, y, h, and b botvoice_bindkey v // Whether to play a sound that will verify whether a client has // turned on or off the botvoice menu. botvoice_verificationsound 1 // Sound to play when menu is activated. botvoice_onsound hl1/fvox/voice_on.wav // Sound to play when menu is deactivated. botvoice_offsound hl1/fvox/voice_off.wav // BOT COMMANDS: // // To change a command or sound in the menu, simplye replace the text after // 'command' corresponding to the menu and slot that you want to change, // as well as the path to the soundfile after 'sound'. // // To add a command to a menu, first change the _size variable corresponding // to the menu that you would like to add to. This is important. If you don't // change it, the new command won't show up. Then add the two lines for command // and sound (simply replicate one of the entries from the menu. // // MENU THAT T's SEE ON BOMB MAPS es_keycreate de_t de_t_size es_keysetvalue de_t de_t_size size 9 es_keycreate de_t 1 es_keysetvalue de_t 1 command "I'm gonna plant the bomb at A..." es_keysetvalue de_t 1 sound bot/im_gonna_plant_the_bomb_at_a.wav es_keycreate de_t 2 es_keysetvalue de_t 2 command "I'm gonna plant the bomb at B..." es_keysetvalue de_t 2 sound bot/im_gonna_plant_the_bomb_at_b.wav es_keycreate de_t 3 es_keysetvalue de_t 3 command "I got A covered!" es_keysetvalue de_t 3 sound bot/i_got_a_covered.wav es_keycreate de_t 4 es_keysetvalue de_t 4 command "I got B covered!" es_keysetvalue de_t 4 sound bot/i_got_b_covered.wav es_keycreate de_t 5 es_keysetvalue de_t 5 command "Planting at A." es_keysetvalue de_t 5 sound bot/planting_at_a.wav es_keycreate de_t 6 es_keysetvalue de_t 6 command "Planting at B." es_keysetvalue de_t 6 sound bot/planting_at_b.wav es_keycreate de_t 7 es_keysetvalue de_t 7 command "Bomb's on the ground here." es_keysetvalue de_t 7 sound bot/bombs_on_the_ground_here.wav es_keycreate de_t 8 es_keysetvalue de_t 8 command "I've got the bomb." es_keysetvalue de_t 8 sound bot/ive_got_the_bomb.wav es_keycreate de_t 9 es_keysetvalue de_t 9 command "Bombsite under control." es_keysetvalue de_t 9 sound bot/bombsite_under_control.wav // MENU THAT CT's SEE ON BOMB MAPS es_keycreate de_ct de_ct_size es_keysetvalue de_ct de_ct_size size 9 es_keycreate de_ct 1 es_keysetvalue de_ct 1 command "I'm gonna camp A." es_keysetvalue de_ct 1 sound bot/im_going_to_camp_a.wav es_keycreate de_ct 2 es_keysetvalue de_ct 2 command "I'm gonna camp B." es_keysetvalue de_ct 2 sound bot/im_going_to_camp_b.wav es_keycreate de_ct 3 es_keysetvalue de_ct 3 command "I see the bomber!!" es_keysetvalue de_ct 3 sound bot/i_see_the_bomber.wav es_keycreate de_ct 4 es_keysetvalue de_ct 4 command "Guarding the dropped bomb." es_keysetvalue de_ct 4 sound bot/guarding_the_dropped_bomb.wav es_keycreate de_ct 5 es_keysetvalue de_ct 5 command "They took the bomb!" es_keysetvalue de_ct 5 sound bot/they_took_the_bomb.wav es_keycreate de_ct 6 es_keysetvalue de_ct 6 command "The bomb's ticking at A!" es_keysetvalue de_ct 6 sound bot/the_bombs_ticking_at_a.wav es_keycreate de_ct 7 es_keysetvalue de_ct 7 command "The bomb's ticking at B!" es_keysetvalue de_ct 7 sound bot/the_bombs_ticking_at_b.wav es_keycreate de_ct 8 es_keysetvalue de_ct 8 command "Bombsite secure. Ready for you to defuse the bomb." es_keysetvalue de_ct 8 sound bot/bombsite_secure_ready_for_you.wav es_keycreate de_ct 9 es_keysetvalue de_ct 9 command "Defusing bomb, now..." es_keysetvalue de_ct 9 sound bot/defusing_bomb_now.wav // MENU THAT T's SEE ON HOSTAGE MAPS es_keycreate cs_t cs_t_size es_keysetvalue cs_t cs_t_size size 9 es_keycreate cs_t 1 es_keysetvalue cs_t 1 command "Camping hostages..." es_keysetvalue cs_t 1 sound bot/camping_hostages.wav es_keycreate cs_t 2 es_keysetvalue cs_t 2 command "Keeping an eye on the hostages..." es_keysetvalue cs_t 2 sound bot/keeping_an_eye_on_the_hostages.wav es_keycreate cs_t 3 es_keysetvalue cs_t 3 command "They're with the hostages!" es_keysetvalue cs_t 3 sound bot/theyre_with_the_hostages.wav es_keycreate cs_t 4 es_keysetvalue cs_t 4 command "They're taking the hostages!!" es_keysetvalue cs_t 4 sound bot/theyre_taking_the_hostages.wav es_keycreate cs_t 5 es_keysetvalue cs_t 5 command "The hostages are gone!!" es_keysetvalue cs_t 5 sound bot/the_hostages_are_gone.wav es_keycreate cs_t 6 es_keysetvalue cs_t 6 command "Guarding the escape zone..." es_keysetvalue cs_t 6 sound bot/guarding_the_escape_zone.wav es_keycreate cs_t 7 es_keysetvalue cs_t 7 command "I'm at the escape zone..." es_keysetvalue cs_t 7 sound bot/im_at_the_escape_zone.wav es_keycreate cs_t 8 es_keysetvalue cs_t 8 command "They're rescuing the hostages!!" es_keysetvalue cs_t 8 sound bot/theyre_rescuing_the_hostages.wav es_keycreate cs_t 9 es_keysetvalue cs_t 9 command "Where are the hostages?" es_keysetvalue cs_t 9 sound bot/where_are_the_hostages.wav // MENU THAT CT's SEE ON HOSTAGE MAPS es_keycreate cs_ct cs_ct_size es_keysetvalue cs_ct cs_ct_size size 9 es_keycreate cs_ct 1 es_keysetvalue cs_ct 1 command "Hostages secure. Ready for you to escort them home." es_keysetvalue cs_ct 1 sound bot/hostages_secure_ready_for_you.wav es_keycreate cs_ct 2 es_keysetvalue cs_ct 2 command "The hostages are ready to go home." es_keysetvalue cs_ct 2 sound bot/the_hostages_are_ready.wav es_keycreate cs_ct 3 es_keysetvalue cs_ct 3 command "I'm at the hostages." es_keysetvalue cs_ct 3 sound bot/im_at_the_hostages.wav es_keycreate cs_ct 4 es_keysetvalue cs_ct 4 command "Talking to hostages." es_keysetvalue cs_ct 4 sound bot/talking_to_hostages.wav es_keycreate cs_ct 5 es_keysetvalue cs_ct 5 command "Rescuing hostages..." es_keysetvalue cs_ct 5 sound bot/rescuing_hostages.wav es_keycreate cs_ct 6 es_keysetvalue cs_ct 6 command "The hostages are with me" es_keysetvalue cs_ct 6 sound bot/the_hostages_are_with_me.wav es_keycreate cs_ct 7 es_keysetvalue cs_ct 7 command "Heading to the rescue zone..." es_keysetvalue cs_ct 7 sound bot/heading_to_the_rescue_zone.wav es_keycreate cs_ct 8 es_keysetvalue cs_ct 8 command "Taking the hostages to safety!" es_keysetvalue cs_ct 8 sound bot/taking_the_hostages_to_safety.wav es_keycreate cs_ct 9 es_keysetvalue cs_ct 9 command "There's not much time left!!!" es_keysetvalue cs_ct 9 sound bot/theres_not_much_time_left.wav // MENU THAT T's SEE ON OTHER MAPS es_keycreate other_t other_t_size es_keysetvalue other_t other_t_size size 9 es_keycreate other_t 1 es_keysetvalue other_t 1 command "Sniper!! " es_keysetvalue other_t 1 sound bot/sniper.wav es_keycreate other_t 2 es_keysetvalue other_t 2 command "Got the sniper..." es_keysetvalue other_t 2 sound bot/got_the_sniper.wav es_keycreate other_t 3 es_keysetvalue other_t 3 command "The sniper's dead." es_keysetvalue other_t 3 sound bot/the_sniper_is_dead.wav es_keycreate other_t 4 es_keysetvalue other_t 4 command "A bunch of 'em!" es_keysetvalue other_t 4 sound bot/a_bunch_of_them.wav es_keycreate other_t 5 es_keysetvalue other_t 5 command "Be right there..." es_keysetvalue other_t 5 sound bot/be_right_there.wav es_keycreate other_t 6 es_keysetvalue other_t 6 command "Two to go!" es_keysetvalue other_t 6 sound bot/two_to_go.wav es_keycreate other_t 7 es_keysetvalue other_t 7 command "One guy left!" es_keysetvalue other_t 7 sound bot/one_guy_left.wav es_keycreate other_t 8 es_keysetvalue other_t 8 command "What happened!?" es_keysetvalue other_t 8 sound bot/what_happened.wav es_keycreate other_t 9 es_keysetvalue other_t 9 command "Owned!! " es_keysetvalue other_t 9 sound bot/owned.wav // MENU THAT CT's SEE ON OTHER MAPS es_keycreate other_ct other_ct_size es_keysetvalue other_ct other_ct_size size 9 es_keycreate other_ct 1 es_keysetvalue other_ct 1 command "Sniper!! " es_keysetvalue other_ct 1 sound bot/sniper.wav es_keycreate other_ct 2 es_keysetvalue other_ct 2 command "Got the sniper..." es_keysetvalue other_ct 2 sound bot/got_the_sniper.wav es_keycreate other_ct 3 es_keysetvalue other_ct 3 command "The sniper's dead." es_keysetvalue other_ct 3 sound bot/the_sniper_is_dead.wav es_keycreate other_ct 4 es_keysetvalue other_ct 4 command "A bunch of 'em!" es_keysetvalue other_ct 4 sound bot/a_bunch_of_them.wav es_keycreate other_ct 5 es_keysetvalue other_ct 5 command "Be right there..." es_keysetvalue other_ct 5 sound bot/be_right_there.wav es_keycreate other_ct 6 es_keysetvalue other_ct 6 command "Two to go!" es_keysetvalue other_ct 6 sound bot/two_to_go.wav es_keycreate other_ct 7 es_keysetvalue other_ct 7 command "One guy left!" es_keysetvalue other_ct 7 sound bot/one_guy_left.wav es_keycreate other_ct 8 es_keysetvalue other_ct 8 command "What happened!?" es_keysetvalue other_ct 8 sound bot/what_happened.wav es_keycreate other_ct 9 es_keysetvalue other_ct 9 command "Owned!! " es_keysetvalue other_ct 9 sound bot/owned.wav } // !!!!!!!!!! DO NOT EDIT BELOW THIS LINE !!!!!!!!!!!! event load { es_log Loading BotVoice... // called whenever the plugin is loaded es_xsetinfo mattie_botvoice 0 es_makepublic mattie_botvoice es_xsetinfo botvoice_bindkey 0 es_xsetinfo botvoice_announce 0 es_xsetinfo botvoice_debug 0 es_xsetinfo botvoice_verificationsound 0 es_xsetinfo botvoice_onsound 0 es_xsetinfo botvoice_offsound 0 es_keygroupdelete de_t es_keygroupdelete de_ct es_keygroupdelete cs_t es_keygroupdelete cs_ct es_keygroupdelete other_t es_keygroupdelete other_ct es_keygroupdelete botvoice_players es_keygroupcreate de_t es_keygroupcreate de_ct es_keygroupcreate cs_t es_keygroupcreate cs_ct es_keygroupcreate other_t es_keygroupcreate other_ct es_keygroupcreate botvoice_players // import the user's configs es_doblock botvoice2/config // needed for while loop es_load corelib } event round_start { if (server_var(botvoice_debug) > 0) then es_xmsg #multi #green[BotVoice-DEBUG]#default event "round_start" entered if (server_var(mattie_botvoice) > 0) do { // announce how to enable menu if (server_var(botvoice_announce) > 0) do { es_msg #multi #green[BotVoice]#default Type#lightgreen !bvon <key>#default to enable Al3c's BotVoice radio menu. es_msg #multi #green[BotVoice]#default <key> is the key you want to use to bring up the menu. Leave blank to use server_var(botvoice_bindkey). es_msg #multi #green[BotVoice]#default Type#lightgreen !bvoff <key>#default to disable it. } } if (event_var(objective) == "BOMB TARGET") do { es_xsetinfo maptype de_ es_xsetinfo maptype_display BOMB } if (event_var(objective) == "HOSTAGE RESCUE") do { es_xsetinfo maptype cs_ es_xsetinfo maptype_display HOSTAGE } if (event_var(objective) == "DEATHMATCH") do { es_xsetinfo maptype other_ es_xsetinfo maptype_display OTHER } if (server_var(botvoice_debug) > 0) then es_xmsg #multi #green[BotVoice-DEBUG]#default maptype is server_var(maptype) } event player_spawn { if (server_var(mattie_botvoice) > 0) do { es_cexec event_var(userid) alias +showmenu "slot10; menuselect !+showmenu" es_cexec event_var(userid) alias -showmenu "" // for completeness es_xsetinfo bvkeyexists 0 es_exists bvkeyexists key botvoice_players event_var(userid) if (server_var(bvkeyexists) == 0) do { es_keycreate botvoice_players event_var(userid) es_keysetvalue botvoice_players event_var(userid) menudisplayed 0 es_keysetvalue botvoice_players event_var(userid) menupage 0 } } } event player_death { if (server_var(mattie_botvoice) > 0) do { es_cexec event_var(userid) menuselect 0 //get rid of menu on death es_xsetinfo bvkeyexists 0 es_exists bvkeyexists key botvoice_players event_var(userid) if (server_var(bvkeyexists) != 0) then es_keydelete botvoice_players event_var(userid) } } event player_disconnect { if (server_var(mattie_botvoice) > 0) do { es_xsetinfo bvkeyexists 0 es_exists bvkeyexists key botvoice_players event_var(userid) if (server_var(bvkeyexists) != 0) then es_keydelete botvoice_players event_var(userid) } } event player_say { if (server_var(botvoice_debug) > 0) then es_xmsg #multi #green[BotVoice-DEBUG]#default event "player_say" entered if (server_var(mattie_botvoice) > 0) do { // tokenize the string to get possible key param es_xsetinfo bv_command 0 es_xsetinfo bv_param 0 es_token bv_command event_var(text) 1 es_token bv_param event_var(text) 2 // bind the menu key to showmenu if (server_var(bv_command) == "!bvon") do { if (server_var(bv_param) != 0) do { es_cexec event_var(userid) bind server_var(bv_param) +showmenu es_tell event_var(userid) #multi #green[BotVoice]#default You have activated the BotVoice menu. Press server_var(bv_param) to use. } else do { es_cexec event_var(userid) bind server_var(botvoice_bindkey) +showmenu es_tell event_var(userid) #multi #green[BotVoice]#default You have activated the BotVoice menu. Press server_var(botvoice_bindkey) to use. } if (server_var(botvoice_verificationsound) > 0) then es_cexec event_var(userid) playgamesound server_var(botvoice_onsound) } // unbind the menu key if (server_var(bv_command) == "!bvoff") do { if (server_var(bv_param) != 0) do { es_cexec event_var(userid) unbind server_var(bv_param) es_tell event_var(userid) #multi #green[BotVoice]#default You have disabled the BotVoice menu. Your server_var(bv_param) key has been unbound. } else do { es_cexec event_var(userid) unbind server_var(botvoice_bindkey) es_tell event_var(userid) #multi #green[BotVoice]#default You have disabled the BotVoice menu. Your server_var(botvoice_bindkey) key has been unbound. } if (server_var(botvoice_verificationsound) > 0) then es_cexec event_var(userid) playgamesound server_var(botvoice_offsound) } } } event es_client_command { if (event_var(command) == menuselect) do { if (server_var(botvoice_debug) > 0) then es_xmsg #multi #green[BotVoice-DEBUG]#default event "es_client_command", command "menuselect" entered es_xsetinfo team SPEC es_setinfo map_and_team server_var(maptype) if (event_var(es_userteam) == 2) do { es_xsetinfo team T es_string map_and_team replace _ _t } if (event_var(es_userteam) == 3) do { es_xsetinfo team CT es_string map_and_team replace _ _ct } if (server_var(botvoice_debug) > 0) then es_xmsg #multi #green[BotVoice-DEBUG]#default map_and_team is server_var(map_and_team) // show botvoice menu if (event_var(commandstring) == "!+showmenu") do { //don't want spectators or dead to display menu if (server_var(team) != SPEC) do { if (event_var(es_userdead) < 1) do { es_keysetvalue botvoice_players event_var(userid) menudisplayed 1 es_keysetvalue botvoice_players event_var(userid) menupage 1 es_setinfo working_userid event_var(userid) es_doblock botvoice2/display_menu } } } // menu option if (event_var(commandstring) != "!+showmenu") do { if (event_var(commandstring) < 10) do { // prevent sound from playing when other menu is activated es_xsetinfo tmp_displayed 0 es_keygetvalue tmp_displayed botvoice_players event_var(userid) menudisplayed if (server_var(tmp_displayed) == 1) do { es_xsetinfo tmp_menu_page 0 es_keygetvalue tmp_menu_page botvoice_players event_var(userid) menupage // menu option 0 (get rid of menu) if (event_var(commandstring) == 0) do { es_keysetvalue botvoice_players event_var(userid) menudisplayed 0 es_keysetvalue botvoice_players event_var(userid) menupage 0 } // menu option 8 (go back) if (event_var(commandstring) == 8) do { //make sure they're not on the first page if (server_var(tmp_menu_page) > 1) do { //subtract 1 from page that client is on and set it back into the database es_math tmp_menu_page - 1 es_keysetvalue botvoice_players event_var(userid) menupage server_var(tmp_menu_page) es_setinfo working_userid event_var(userid) es_doblock botvoice2/display_menu } } // menu option 9 (next page) if (event_var(commandstring) == 9) do { //find number of entries for this menu es_xsetinfo numentries 0 es_format numentries "%1_%2" server_var(map_and_team) size es_keygetvalue numentries server_var(map_and_team) server_var(numentries) size //set numpages = (floor(numentries/7)) + 1 es_setinfo numpages server_var(numentries) es_math numpages / 7 es_math numpages int es_math numpages + 1 //make sure they're not on the last page if (server_var(tmp_menu_page) < server_var(numpages)) do { //add 1 to page that client is on and set it back into the database es_math tmp_menu_page + 1 es_keysetvalue botvoice_players event_var(userid) menupage server_var(tmp_menu_page) es_setinfo working_userid event_var(userid) es_doblock botvoice2/display_menu } } // menu option k (command choice, not exit or next/previous page) if (event_var(commandstring) > 0) do { if (event_var(commandstring) < 8) do { // prevent dead players if (event_var(es_userdead) < 1) do { es_xsetinfo command 0 es_xsetinfo sound 0 es_xsetinfo selection 0 if (event_var(es_userteam) == 2) do { es_xsetinfo soundcmd ma_cexec_t } if (event_var(es_userteam) == 3) do { es_xsetinfo soundcmd ma_cexec_ct } //get page that the client is on es_keygetvalue selection botvoice_players event_var(userid) menupage es_math selection - 1 es_math selection * 7 es_math selection + event_var(commandstring) if (server_var(botvoice_debug) > 0) then es_msg #multi #green[BotVoice-DEBUG]#default selection is: server_var(selection) //number of sound to get from database now is selection = commandstring + (7 * (page-1)) es_keygetvalue command server_var(map_and_team) server_var(selection) command es_keygetvalue sound server_var(map_and_team) server_var(selection) sound es server_var(soundcmd) playgamesound server_var(sound) es_cexec event_var(userid) say_team server_var(command) es_keysetvalue botvoice_players event_var(userid) menudisplayed 0 es_keysetvalue botvoice_players event_var(userid) menupage 0 } } } } } } } } block display_menu { //get current page that the client is looking at es_xsetinfo tmp_menu_page 0 es_keygetvalue tmp_menu_page botvoice_players server_var(working_userid) menupage if (server_var(botvoice_debug) > 0) then es_msg #multi #green[BotVoice-DEBUG]#default tmp_menu_page is: server_var(tmp_menu_page) //find number of entries for this menu es_xsetinfo numentries 0 es_format numentries "%1_%2" server_var(map_and_team) size es_keygetvalue numentries server_var(map_and_team) server_var(numentries) size //set numpages = (floor(numentries/7)) + 1 es_setinfo numpages server_var(numentries) es_math numpages / 7 es_math numpages int es_math numpages + 1 if (server_var(botvoice_debug) > 0) then es_msg #multi #green[BotVoice-DEBUG]#default numpages is: server_var(numpages) //start creating menu es_xsetinfo bv_message 0 if (de in server_var(maptype)) then es_xsetinfo maptypte_display BOMB if (cs in server_var(maptype)) then es_xsetinfo maptypte_display HOSTAGE if (other in server_var(maptype)) then es_xsetinfo maptypte_display OTHER |