def make_blood(userid, color=0, amount=5, spawnflags=1, randomdir=1, headshot=1, valueat=0): index = es.createentity("env_blood") if spawnflags == 1: if headshot: es.entitysetvalue(index, "spawnflags", 4|8|40) else: es.entitysetvalue(index, "spawnflags", 8|40) elif spawnflags == 2: if headshot: es.entitysetvalue(index, "spawnflags", 4|8|20|40) else: es.entitysetvalue(index, "spawnflags", 8|20|40) es.entitysetvalue(index, "amount", amount) es.entitysetvalue(index, "color", color) if headshot: x,y,z = geteyelocation(userid) else: x,y,z = es.getplayerlocation(userid) z += random.randint(20,60) if randomdir == 1: if valueat > 0: vx,vy,vz = playerlib.getPlayer(valueat).viewVector() es.entitysetvalue(index, "spraydir", "%s %s %s" %(vx, vy, vz)) else: es.entitysetvalue(index, "spraydir", "%s %s %s" %(random.randint(-90, 90), random.randint(-90, 90), random.randint(-90, 90))) es.entitysetvalue(index, "origin", "%s %s %s" %(x, y, z)) es.entitysetvalue(index, "classname", "env_blood_%s" %(index)) es.fire(userid, "env_blood_%s" %(index), "emitblood") es.fire(userid, "env_blood_%s" %(index), "kill")
def extinguish(users): '''Extinguish a burning player...''' # Loop through all matching players... for userid in _get_matching_players(users): # Extinguish the player... es.fire(userid, '!self', 'IgniteLifeTime', 0)
def reset(self, amountOverride=None): """ This method resets a player's gravity either back to the default amount or if overridden, then to that amount. @PARAM OPTIONAL amountOverride - if this is set to an integral amount, that value will take presedence over the default value. """ trueAmount = self.amount if amountOverride is not None: trueAmount = amountOverride #es.fire(self.userid, "!self", "addoutput", '"gravity %s"' % trueAmount) es.fire(self.userid, "!self", "addoutput", "gravity %s" % trueAmount)
def round_start(ev): bot_configs() es.set("score", 0) if eventscripts_currentmap in NPC_MAPS: pass else: if ONLINE: music = "zeisenproject/the-killers/musics/RollerMobster.mp3" es.set("music", music) for userid in es.getUseridList(): es.playsound(userid, music, 1.0) for userid in es.getUseridList(): es.fire(userid, "hostage_entity", "kill") break
def fire(users, lifetime=999): '''Ignite a player for the given time...''' # Loop through all matching players... for userid in _get_matching_players(users): # Is the player dead? if es.getplayerprop(userid, 'CBasePlayer.pl.deadflag'): # Don't go further... continue # Ignite the player... es.fire(userid, '!self', 'IgniteLifeTime', lifetime)
def reset(self, amountOverride = None): """ This method resets a player's gravity either back to the default amount or if overridden, then to that amount. @PARAM OPTIONAL amountOverride - if this is set to an integral amount, that value will take presedence over the default value. """ trueAmount = self.amount if amountOverride is not None: trueAmount = amountOverride #es.fire(self.userid, "!self", "addoutput", '"gravity %s"' % trueAmount) es.fire(self.userid, "!self", "addoutput", "gravity %s" % trueAmount)
def rpg_damage(userid, damage, attacker, weapon): player = playerlib.getPlayer(userid) index = es.createentity('point_hurt') es.entitysetvalue(index, 'targetname', index) es.entitysetvalue(index, 'damage', damage) es.entitysetvalue(index, 'damagetype', 2) es.entitysetvalue(index, 'classname', weapon) targetname = es.entitygetvalue(player.index, 'targetname') es.entitysetvalue(player.index, 'targetname', player) es.fire(attacker, index, 'addoutput', 'damagetarget %s' % (userid)) es.fire(attacker, index, 'hurt') es.fire(userid, '!self', 'addoutput', 'targetname %s' % (targetname)) es.fire(userid, index, 'kill')
def player_hurt(event_var): """ When a player is damaged, check for team attacks, then if the wepapon is a hegrenade, then set the player on fire, and delay and extinguish @PARAM event_var - an automatically passed event instance """ userid = event_var['userid'] attacker = event_var['attacker'] if attacker.isdigit() and int(attacker) > 0: """ The attacker did not hurt themselves """ player = sourcerpg.players[attacker] if player is not None: level = player[skillName] if level: """ The player has at least level 1 in napalm nade """ if event_var['es_userteam'] <> event_var['es_attackerteam']: """ It was not a team kill """ if event_var['weapon'] == "hegrenade": """ Was a kill with a grenade """ es.fire(userid, "!self", "IgniteLifetime", 1.0 * level)
def teamplay_round_active(EV): RM.SetRound("SD") gamethread.delayed(1.5,Overlay,("BlueZM/synergized_Disinfection.vtf",4)) if es.getplayercount() > 0: Userid = es.getUseridList()[0] es.fire(Userid,"func_regenerate","setteam",3) es.fire(Userid,"func_regenerate","TeamNum",3) es.fire(Userid,"func_respawnroomvisualizer","solid_to_enemies",1) es.fire(Userid,"trigger_capture_area","area_time_to_cap",500) Reset() Zombify_Random() gamethread.delayedname(50, "Grace", Grace_Off) Request_TeamUpdate()
def make_blood(userid, color=0, amount=5, spawnflags=1, randomdir=1, headshot=1, valueat=0): index = es.createentity("env_blood") if spawnflags == 1: if headshot: es.entitysetvalue(index, "spawnflags", 4 | 8 | 40) else: es.entitysetvalue(index, "spawnflags", 8 | 40) elif spawnflags == 2: if headshot: es.entitysetvalue(index, "spawnflags", 4 | 8 | 20 | 40) else: es.entitysetvalue(index, "spawnflags", 8 | 20 | 40) es.entitysetvalue(index, "amount", amount) es.entitysetvalue(index, "color", color) if headshot: x, y, z = geteyelocation(userid) else: x, y, z = es.getplayerlocation(userid) z += random.randint(20, 60) if randomdir == 1: if valueat > 0: vx, vy, vz = playerlib.getPlayer(valueat).viewVector() es.entitysetvalue(index, "spraydir", "%s %s %s" % (vx, vy, vz)) else: es.entitysetvalue( index, "spraydir", "%s %s %s" % (random.randint(-90, 90), random.randint( -90, 90), random.randint(-90, 90))) es.entitysetvalue(index, "origin", "%s %s %s" % (x, y, z)) es.entitysetvalue(index, "classname", "env_blood_%s" % (index)) es.fire(userid, "env_blood_%s" % (index), "emitblood") es.fire(userid, "env_blood_%s" % (index), "kill")
def Grace_Off(): global Grace Msg("Grace Period Is Over.") Grace = 0 gamethread.cancelDelayed("Grace") if es.getplayercount() > 0: Userid = es.getUseridList()[0] es.fire(Userid,"func_regenerate","setteam",1) es.fire(Userid,"func_regenerate","TeamNum",1) es.fire(Userid,"func_respawnroomvisualizer","solid_to_enemies",0) Msg("Survivor Ammo Lockers Disabled, Spawnroom Guards Disabled")
def removeMapObjective(bomb=True, hostage=True, buyzone=True, userid=None): """ Removes Map Objective. bomb - Defines whether to remove bomb objective or not. Default: True hostage - Defines whether to remove hostage objective or not. Default: True buyzone - Defines whether to remove buying objective or not. Default: True userid - A userid for es.fire to use. If not provided (None), the first lowest userid in the game will be used. """ hostageEntity = ("func_hostage_rescue", "hostage_entity") bombEntity = ("func_bomb_target", "weapon_c4") if userid == None: userid = es.getUseridList()[0] if bomb: for entity in bombEntity: es.fire(userid, entity, "Kill") if hostage: for entity in hostageEntity: es.fire(userid, entity, "Kill") if buyzone: es.fire(userid, "func_buyzone", "Kill")
def Request_WeaponKill_Update(): # 1 = scout, 2 = sniper, 3 = soldier, 4 = demo, 5 = medic, 6 = heavy, 7 = pyro, 8 = spy, 9 = engie Userid = es.getUseridList()[0] for item in ["tf_weapon_builder","tf_weapon_pda_engineer_build","tf_weapon_pda_engineer_destroy","tf_weapon_pda_spy","tf_weapon_invis"]: es.fire(Userid,item,"kill")
def __del__(self): """ Default deconstructor; ensure their gravity is assigned back to 0 """ es.fire(self.userid, "!self", "addoutput", "gravity 1.0")
def kill(self, entity): if self.getUserid(): es.fire(self.userid, entity, 'TurnOff') es.fire(self.userid, entity, 'Kill')
def delete_all_weapons(): for userid in es.getUseridList(): for weapon in allweapons: es.fire(userid, weapon, "kill") break
def unburn(userid): es.fire(userid, "!self", "IgniteLifetime", 0)
def damage(users, _damage, attacker=None, armor=False, weapon=None): '''Damage a player...''' # Is there no player on the server? if not es.getplayercount(): # Don't go further... return # Create a 'point_hurt' entity... index = es.createentity('point_hurt') # Set the entity name... es.setentityname(index, index) # Does we need to apply damage on the player's armor? if armor: # Set the damage type to fall... es.entitysetvalue(index, 'damagetype', 32) # Is any weapon specified? if weapon: # Set the classname to the given weapon... es.entitysetvalue(index, 'classname', weapon) # Set the given damage... es.entitysetvalue(index, 'damage', _damage) # Loop through all matching players... for userid in _get_matching_players(users): # Is the player dead? if es.getplayerprop(userid, 'CBasePlayer.pl.deadflag'): # Don't go further... continue # Is the given damage need to be the player health? if _damage == '#health': # Set the damage to the player health... es.entitysetvalue(index, 'damage', es.getplayerprop(userid, 'CBasePlayer.m_iHealth')) # Get the player index... player_index = es.getindexfromhandle(es.getplayerhandle(userid)) # Store the actual player name... targetname = es.entitygetvalue(index, 'targetname') # Set the player name to his index... es.setentityname(player_index, player_index) # Set the damage target... es.entitysetvalue(index, 'damagetarget', player_index) # Is there's no attacker? if not attacker: # Damage the player... es.fire(userid, index, 'Hurt') # Otherwise... else: # Damage the player... es.fire(attacker, index, 'Hurt') # Set back the player name... es.fire(userid, player_index, 'AddOutput', 'targetname %s' % targetname) # Remove the entity later... gamethread.delayedname(0.5, '_wcs_delay', _remove_entity, index)
def fire(argv): es.fire(*argv)
def CC_PREP(path): if es.getplayercount() > 0: userid = es.getUseridList()[0] es.fire(userid,"BLUEZM_COLOR_CORRECT",'kill') gamethread.delayed(1,color_correct,(path,userid))
def orcspawn(): userid = ev['userid'] give(userid, 'point_tesla') es.fire(userid, 'point_tesla', 'AddOutPut', 'm_Color 255 71 36') es.fire(userid, 'point_tesla', 'AddOutPut', 'm_flRadius 600') es.fire(userid, 'point_tesla', 'AddOutPut', 'beamcount_min 1000') es.fire(userid, 'point_tesla', 'AddOutPut', 'beamcount_max 6000') es.fire(userid, 'point_tesla', 'AddOutPut', 'thick_min 10') es.fire(userid, 'point_tesla', 'AddOutPut', 'thick_max 6') es.fire(userid, 'point_tesla', 'AddOutPut', 'lifetime_min .1') es.fire(userid, 'point_tesla', 'AddOutPut', 'lifetime_max .4') es.fire(userid, 'point_tesla', 'AddOutPut', 'interval_min .1') es.fire(userid, 'point_tesla', 'AddOutPut', 'interval_max .2') es.fire(userid, 'point_tesla', 'AddOutPut', 'texture sprites/lgtning.vmt') es.fire(userid, 'point_tesla', 'DoSpark') gamethread.delayed(0.2, es.fire, (userid, 'point_tesla', 'DoSpark')) gamethread.delayed(0.4, es.fire, (userid, 'point_tesla', 'DoSpark')) gamethread.delayed(0.6, es.fire, (userid, 'point_tesla', 'DoSpark')) gamethread.delayed(0.8, es.fire, (userid, 'point_tesla', 'DoSpark')) gamethread.delayed(1, es.fire, (userid, 'point_tesla', 'DoSpark')) gamethread.delayed(2, es.fire, (userid, 'point_tesla', 'Kill'))
def Prep(self): if es.getplayercount() > 0: es.fire(es.getUseridList()[0],"BLUEZM_OVERLAY",'kill') gamethread.delayed(.5,self.Overlay,())
def Shutdown(self): id = es.getUseridList()[0] es.fire(id,self.NAME,'StopOverlays') gamethread.queue(es.fire,(id,self.NAME,'kill'))