# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Bonbon's fun classes v_1.5 # # Requires: # # # # Eventscripts 2.0 # # # # add the line es_load bclasses to your autoexec.cfg # # # # Thank you to: # # Mattie who made the Quad mod (for glow) # # SD who made the jump multiplier and pickle thread # # GODJones (who else to point out my mistakes) # # # # # # # # If you have any questions e-mail me at: # # drunkenmousehide@hotmail.com # # or use the PMS on the eventscripts formums # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # import es, playerlib, popuplib, gamethread, usermsg, random player_classes = {} bclasses = None jump_multiplier = 1.5 def load(): bclasses = popuplib.easymenu('example_menu', None, classes_choice) bclasses.settitle("|-Bonbon's Classes-|") classes = ('Zombie', 'Ghost', 'Homer', 'Kitty Kat', 'Assassin', 'Wizard', 'Vampire', 'Chameleon', 'Error') for taco in classes: bclasses.addoption (taco, taco) es.msg('#multi', '#green[#lightgreenBClasses#green]: Loaded') def unload(): es.msg('#multi', '#green[#lightgreenBClasses#green]: Unloaded') def player_connect(event_var): userid = event_var['userid'] player_classes[userid] = 7 # Default class to set def player_disconnect(event_var): userid = event_var['userid'] if player_classes.has_key(userid): del player_classes[userid] def player_spawn(event_var): player = playerlib.getPlayer(event_var['userid']) userid = str(event_var['userid']) es.tell(event_var['userid'], '#multi', "#green[#lightgreenBClasses#green]: #lightgreenBonbon Classes#green are active. Type #lightgreen!bclass #greenor #lightgreen!bhelp #greento chose your class") if player_classes.has_key(userid): if player_classes[userid] == 1: # Zombie player.set('speed', '0.8') player.set('health', '250') es.tell(event_var['userid'], '#multi', '#green[#lightgreenBClasses#green]: You are now a #lightgreenZombie, #greenYou are slow, but you do have extra health!') es.server.queuecmd('est_setgravity %s 1'%event_var['userid']) elif player_classes[userid] == 2: # Ghost es.tell(event_var['userid'], '#multi', '#green[#lightgreenBClasses#green]: You are now a #lightgreenghost,#green You have invisibility, speed and low gravity. Be careful though, You do glow!') es.server.queuecmd('es_xgive %s point_spotlight'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "angles -90 0 0"'%userid) es.server.queuecmd('es_xfire %s point_spotlight setparent !activator'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "spotlightlength 200"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "spotlightwidth 200"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "rendercolor 100 100 100"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "angles -90 0 0"'%userid) es.server.queuecmd('es_xfire %s point_spotlight lighton'%userid) player.set('speed', '1.4') player.set('model', 'shells/shell_9mm') player.set('health', '70') es.server.queuecmd('est_setgravity %s 1'%event_var['userid']) elif player_classes[userid] == 3: # Homer es.tell(event_var['userid'], '#multi', '#green[#lightgreenBClasses#green]: You are now #lightgreenHomer Simpson,#green You are slow, but your fat protects you. But certain events make you drunk.') player.set('speed', '0.7') es.server.queuecmd('est_setgravity %s 1'%event_var['userid']) elif player_classes[userid] == 4: # Kitty es.tell(event_var['userid'], '#multi', '#green[#lightgreenBClasses#green]: You are now a #lightgreenKitty Kat, #greenYou have special jumping powers, can go fast and can stun other people.') player.set('speed', '1.2') player.set('color', '255 163 177 255') es.server.queuecmd('est_setgravity %s 1'%event_var['userid']) elif player_classes[userid] == 5: # Assassin es.tell(event_var['userid'], '#multi', '#green[#lightgreenBClasses#green]: You are now a #lightgreenAssassin, #greenAs long as you do not talk, people may not see you. So do not talk!') player.set('model', 'shells/shell_9mm') es.server.queuecmd('est_setgravity %s 1'%event_var['userid']) elif player_classes[userid] == 6: # Wizard es.tell(event_var['userid'], '#multi', '#green[#lightgreenBClasses#green]: You are now a #lightgreenWizard, #greenYou can respawn by typing !respawn, levitate, regenerate health and flash people') es.server.queuecmd('est_setgravity %s 0.6'%event_var['userid']) es.server.queuecmd('est_give %s weapon_m4a1'%userid) heal(userid) elif player_classes[userid] == 7: # Vampire: es.tell(event_var['userid'], '#multi', '#green[#lightgreenBClasses#green]: You are now a #lightgreenVampire, #greenYou can leech other players health and are partially invisible') player.set('color', '0 0 0 125') elif player_classes[userid] == 8: # Chameleon es.tell(userid, '#multi', '#green[#lightgreenBClasses#green]: You are now a #lightgreenChameleon, #greenYou can morph into objects, type !morph_help for more info') random_player_models = ('props/cs_office/vending_machine', 'props/cs_office/sofa', 'props/cs_havana/bookcase_large', 'props/cs_office/file_cabinet1', 'props/de_train/barrel') random_model_chosen = random.choice(random_player_models) player.set('model', random_model_chosen) elif player_classes[userid] == 9: # Error es.tell(userid, '#multi', '#green[#lightgreenBClasses#green] You are now an #lightgreenERROR, #greenYou fail at shooting and walking, but since god feels bad for you, you have high health') player.set('model', 'error') player.set('speed', '0.6') player.set('health', '500') else: random_class = random.randint(1, 10) player_classes[userid] == random_class def heal(userid): player = playerlib.getPlayer(userid) health = player.attributes['health'] gamethread.delayedname(5, 'heal_%s'%userid, heal, args=(userid)) if health < 150: new_health = health + 3 player.set('health', new_health) def player_say(event_var): userid = event_var['userid'] player = playerlib.getPlayer(userid) player_is_dead = player.get('isdead') if player_classes.has_key(userid): if event_var['text'] == '!zombie': player_classes[userid] = 1 elif event_var['text'] == '!ghost': player_classes[userid] = 2 elif event_var['text'] == '!homer': player_classes[userid] = 3 elif event_var['text'] == '!kitty': player_classes[userid] = 4 elif event_var['text'] == '!assassin': player_classes[userid] = 5 elif event_var['text'] == '!wizard': player_classes[userid] = 6 elif event_var['text'] == '!vampire': player_classes[userid] = 7 elif event_var['text'] == '!chameleon': player_classes[userid] = 8 elif event_var['text'] == '!error': player_classes[userid] = 9 elif event_var['text'] == '!bhelp': es.tell(event_var['userid'], '#multi', "#green[#lightgreenBClasses#green]: To change your class type: #lightgreen!zombie, !ghost, !homer, !assassin, !wizard, !vampire") es.tell(userid, '#multi', '#greenor #lightgreen!kitty') elif event_var['text'] == '!bclass': popuplib.send('bclasses', event_var['userid']) elif player_classes[userid] == 5: es.tell(event_var['userid'], '#multi', '#greenI told you not to talk...') es.server.queuecmd('es_xgive %s point_spotlight'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "angles -90 0 0"'%userid) es.server.queuecmd('es_xfire %s point_spotlight setparent !activator'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "spotlightlength 200"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "spotlightwidth 200"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "rendercolor 100 100 100"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "angles -90 0 0"'%userid) es.server.queuecmd('es_xfire %s point_spotlight lighton'%userid) es.emitsound('player', event_var['userid'], 'hl1/ambience/alien_powernode.wav', '0.5', '0.20') elif event_var['text'] == '!respawn': if player_classes[userid] == 6: if player_is_dead == 1: es.tell(userid, '#multi', '#greenYou will respawn in #lightgreen15 #greenseconds') gamethread.delayed(15, es.server.cmd, 'est_spawn %s'%userid) gamethread.delayed(16, es.server.cmd, 'est_health %s = 75'%userid) gamethread.canceldelayed(heal) else: es.tell(userid, '#multi', '#greenYou may only spawn if you are dead!') else: es.tell(userid, '#multi', '#greenYou may only respawn as a #lightgreenWizard!') elif event_var['text'] == '!morph_help': es.tell(userid, '#multi', '#green[#lightgreenBClasses#green]: You can morph into objects by typing #lightgreen!sofa, !barrel, !vend, !file or !book') elif player_classes[userid] == 8: if event_var['text'] == '!sofa': player.set('model', 'props/cs_office/sofa') elif event_var['text'] == '!barrel': player.set('model', 'props/de_train/barrel') elif event_var['text'] == '!vend': player.set('model', 'props/cs_office/vending_machine') elif event_var['text'] == '!file': player.set('model', 'props/cs_office/file_cabinet1') elif event_var['text'] == '!book': player.set('model', 'props/cs_havana/bookcase_large') def player_jump(event_var): userid = event_var['userid'] temp_multiplier = jump_multiplier - 1 if player_classes.has_key(userid): if player_classes[userid] == 2: es.setplayerprop(userid, 'CBasePlayer.localdata.m_vecBaseVelocity', '%s,%s,%s' % tuple([es.getplayerprop(userid, 'CBasePlayer.localdata.m_vecVelocity[%s]' % x) * temp_multiplier for x in range(3)])) elif player_classes[userid] == 4: es.setplayerprop(userid, 'CBasePlayer.localdata.m_vecBaseVelocity', '%s,%s,%s' % tuple([es.getplayerprop(userid, 'CBasePlayer.localdata.m_vecVelocity[%s]' % x) * temp_multiplier for x in range(3)])) elif player_classes[userid] == 3: es.server.queuecmd('est_drunk %s 1'%event_var['userid']) def classes_choice(userid, choice, popupname): userid = event_var['userid'] if player_classes.has_key(userid): if choice == 'Zombie': player_classes[userid] = 1 elif choice == 'Ghost': player_classes[userid] = 2 elif choice == 'Homer': player_classes[userid] = 3 elif choice == 'Kitty Kat': player_classes[userid] = 4 elif choice == 'Assassin' : player_classes[userid] = 5 elif choice == 'Wizard': player_classes[userid] = 6 elif choice == 'Vampire': player_classes[userid] = 7 elif choice == 'Chameleon': player_classes[userid] = 8 elif choice == 'Error': player_classes[userid] = 9 def player_hurt(event_var): vampire_victim = playerlib.getPlayer(event_var['userid']) vampire_attacker = playerlib.getPlayer(event_var['attacker']) userid = event_var['userid'] attacker = event_var['attacker'] damage_done = int(event_var['dmg_health']) attacker_health = int(event_var['es_attackerhealth']) victim_health = int(event_var['es_userhealth']) if player_classes[attacker] == 4: userid.set('freeze', '1') es.delayed(0.2, 'playerset freeze %s 0'%event_var['userid']) elif player_classes[userid] == 3: es.server.queuecmd('est_drunk %s 0.1'%event_var['userid']) elif player_classes[attacker] == 7: damage_rewarded = damage_done / 3.5 new_attacker_health = damage_rewarded + attacker_health new_victim_health = victim_health - damage_rewarded vampire_victim.set('health', str(new_victim_health)) vampire_attacker.set('health', str(new_attacker_health)) usermsg.centermsg(attacker, 'You have leeched %s health from %s' % (damage_rewarded, event_var['es_username'])) usermsg.centermsg(userid, '%s stole %s health from you' % (event_var['es_attackername'], damage_rewarded)) usermsg.hudhint(attacker, 'You have leeched %s health from %s' % (damage_rewarded, event_var['es_username'])) usermsg.hudhint(userid, '%s stole %s health from you' % (event_var['es_attackername'], damage_rewarded)) elif player_classes[attacker] == 6: vampire_victim.set('flash', ['255 255 255 255', '0.3']) elif player_classes[attacker] == 9: reduced_damage = damage_done / 2 new_error_victim_health = victim_health + reduced_damage vampire_victim.set('health', str(new_error_victim_health)) def bomb_beginplant(event_var): userid = event_var['userid'] if player_classes.has_key(userid): if player_classes[userid] == 3: es.server.queuecmd('est_drunk %s 2'%event_var['userid']) es.tell(event_var['userid'], '#multi', '#greenYour Team is awarding your for starting to plant the bomb by giving you more beer!') def bomb_begindefuse(event_var): userid = event_var['userid'] if player_classes.has_key(userid): if player_classes[userid] == 3: es.server.queuecmd('est_drunk %s 2'%event_var['userid']) es.tell(event_var['userid'], '#multi', '#greenYour Team is awarding you for starting to defuse the bomb by giving you more beer!') def item_pickup(event_var): userid = event_var['userid'] if player_classes.has_key(userid): if player_classes[userid] == 3: es.tell(userid, '#multi', '#greenYou should not bend over, it gives you a major headache') es.server.queuecmd('est_drunk %s 0.5'%userid) def player_radio(event_var): userid = event_var['userid'] if player_classes.has_key(userid): if player_classes[userid] == 5: es.tell(userid, '#multi', '#greenIf you can not talk, what makes you think you may use the radio?') es.server.queuecmd('es_xgive %s point_spotlight'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "angles -90 0 0"'%userid) es.server.queuecmd('es_xfire %s point_spotlight setparent !activator'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "spotlightlength 200"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "spotlightwidth 200"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "rendercolor 100 100 100"'%userid) es.server.queuecmd('es_xfire %s point_spotlight addoutput "angles -90 0 0"'%userid) es.server.queuecmd('es_xfire %s point_spotlight lighton'%userid) es.emitsound('player', event_var['userid'], 'hl1/ambience/alien_powernode.wav', '0.5', '0.20')