[HL2:DM] looneytrails

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
Painkiller
Senior Member
Posts: 376
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

[HL2:DM] looneytrails

Postby Painkiller » Wed Oct 10, 2018 8:30 pm

I tried it, but there is eventscripts emulator but it does not work.
It's already a slightly customized version for Deathmatch.

I think if it were for all games, even more would be happy.

Syntax: Select all

import es, cfglib, os, random

info = es.AddonInfo()
info.name = 'LooneyTrails'
info.version = '1.2'
info.url = 'http://addons/eventscripts.com/addons/view/LooneyTrails'
info.author = 'Satoon101'
es.ServerVar('looneytrails_version',info.version,'looneytrails_version').makepublic()

gamename = str(es.ServerVar('eventscripts_gamedir')).rsplit(os.sep,1)[~0]

TrailEffects = ['smoke','energy','sparks','dust','beam']

WeaponEntityList = {}

class EntityManager(object):
class Entity:
def __init__(self, entity, name):
self.entity = entity
self.name = name
self.indexes = {}
self.teams = {}

def findIndexes(self):
entlist = es.createentitylist(self.entity)
remove = []
for index in self.indexes:
if not index in entlist:
remove.append(index)
for index in remove:
del self.indexes[index]
for index in entlist:
if not index in self.indexes:
self.indexes[index] = self.Index(index,self.teams[self.getTeamNum(index)],self.entity)
if self.indexes[index].effect is None: continue
self.indexes[index].createTrail()

@staticmethod
def getTeamNum(index):
teamnum = es.getindexprop(index,'CBaseEntity.m_iTeamNum')
if teamnum: return teamnum
owner = es.getindexprop(index,'CBaseEntity.m_hOwnerEntity')
for userid in es.getUseridList():
if es.getplayerhandle(userid) == owner: return es.getplayerteam(userid)
if 0 in self.teams: return 0
return random.choice([x for x in self.teams])

class Index:
def __init__(self,index,team,entity):
self.index = index
self.teamname = team
self.entity = entity
self.location = es.getindexprop(self.index,'CBaseEntity.m_vecOrigin')
self.effect = self.getEffect(str(es.ServerVar('lt_%s_effect_%s'%(self.teamname,self.entity))).lower())

def createTrail(self):
location = es.getindexprop(self.index,'CBaseEntity.m_vecOrigin')
if location == self.location: return
if self.effect == 'smoke':
es.effect('smoke',location,'smoke',5,.1)
if self.effect == 'energy':
es.effect('energysplash',self.location,location,0)
if self.effect == 'sparks':
es.effect('sparks',self.location,1,5,location)
if self.effect == 'dust':
es.effect('dust',self.location,location,5,.1)
if self.effect == 'beam':
colors = str(es.ServerVar('lt_%s_beamcolor_%s'%(self.teamname,self.entity))).split(',')
if not len(colors) == 3: return
model = es.precachemodel(es.ServerVar('lt_beammodel'))
width = es.ServerVar('lt_beamwidth')
es.effect('beam',self.location,location,model,model,0,0,.5,width,width,.5,1,colors[0],colors[1],colors[2],255,30)
self.location = location

@staticmethod
def getEffect(effect):
if not effect in TrailEffects + ['random']: return None
if effect == 'random': return random.choice(TrailEffects)
return effect

class Teams:
def __init__(self, number, name):
self.number = number
self.name = name
self.team_entities = {}

def _registerTeamEntity(self, entity, name):
self.team_entities[entity] = name

def __init__(self):
self.entities = {}
self.teams = {}

def _registerTeam(self, number, name):
self.teams[number] = self.Teams(number, name)

def _registerEntity(self, entity, name, teams):
ent = self.entities[entity] = self.Entity(entity, name)
teams = (teams,) if isinstance(teams, int) else tuple(teams)
for team in teams:
ent.teams[team] = self.teams[team].name.replace(' ','_').lower()
self.teams[team]._registerTeamEntity(entity, name)

def findEntityIndexes(self):
for entity in self.entities:
self.entities[entity].findIndexes()

ageofchivalry = EntityManager()
ageofchivalry._registerTeam(2,'Agatha Knights')
ageofchivalry._registerTeam(3,'Mason Order')
ageofchivalry._registerEntity('aoc_arrow','Arrows',(2,3))
ageofchivalry._registerEntity('crossbow_bolt','Crossbow Bolts',(2,3))
ageofchivalry._registerEntity('weapon_thrown_dagger2','Thrown Daggers',(2,3))
ageofchivalry._registerEntity('weapon_thrown_onehandaxe','Thrown Axes',(2,3))
ageofchivalry._registerEntity('weapon_thrown_spear','Thrown Spears',(2,3))
ageofchivalry._registerEntity('grenade_molotov','Thrown Oilpots',(2,3))
ageofchivalry._registerEntity('aoc_ballista_arrow','Ballista Arrows',(2,3))
ageofchivalry._registerEntity('aoc_eprojectile','Catapult Projectiles',(2,3))

cstrike = EntityManager()
cstrike._registerTeam(2,'Terrorists')
cstrike._registerTeam(3,'Counter-Terrorists')
cstrike._registerEntity('flashbang_projectile','Thrown Flashbangs',(2,3))
cstrike._registerEntity('hegrenade_projectile','Thrown Grenades',(2,3))
cstrike._registerEntity('smokegrenade_projectile','Thrown Smoke Grenades',(2,3))

dystopia = EntityManager()
dystopia._registerTeam(2,'Punks')
dystopia._registerTeam(3,'Corps')
dystopia._registerEntity('empgrenade_projectile','Light Grenade',(2,3))
dystopia._registerEntity('grenade_projectile','Medium Grenade',(2,3))
dystopia._registerEntity('spidergrenade_projectile','Spider Grenade',(2,3))
dystopia._registerEntity('boltgun_bolt','Boltgun Bolt',(2,3))
dystopia._registerEntity('launcher_grenade','Launcher Grenade',(2,3))
dystopia._registerEntity('rpg_missile','Rocket',(2,3))
dystopia._registerEntity('basilisk_bomb','Basilisk Bomb',(2,3))

esmod = EntityManager()
esmod._registerTeam(2,'UTF')
esmod._registerTeam(3,'NGM')
esmod._registerEntity('launcher_grenade','Launcher Grenade',(2,3))
esmod._registerEntity('proj_ionpulse','Ion Pulse',(2,3))
esmod._registerEntity('daedalus','Fighter Weapon',3)
esmod._registerEntity('proj_bomberpulse','Bomber Pulse',(2,3))
esmod._registerEntity('proj_flak','Heavy Fighter Flak',(2,3))
esmod._registerEntity('pegasus','Interceptor Weapon',(2,3))

fistful_of_frags = EntityManager()
fistful_of_frags._registerTeam(0,'Co-op')
fistful_of_frags._registerTeam(2,'Vigilantes')
fistful_of_frags._registerTeam(3,'Deperados')
fistful_of_frags._registerEntity('dynamite','Dynamite',(0,2,3))
fistful_of_frags._registerEntity('arrow','Arrows',(0,2,3))
fistful_of_frags._registerEntity('arrow_fiery','Fiery Arrows',(0,2,3))
fistful_of_frags._registerEntity('explosive_arrow','Explosive Arrows',(0,2,3))
fistful_of_frags._registerEntity('thrown_axe','Thrown Axes',(0,2,3))
fistful_of_frags._registerEntity('thrown_knife','Thrown Knives',(0,2,3))

FortressForever = EntityManager()
FortressForever._registerTeam(2,'Blue')
FortressForever._registerTeam(3,'Red')
FortressForever._registerEntity('ff_projectile_nail','Nail Gun',(2,3))
FortressForever._registerEntity('ff_projectile_rocket','Rocket',(2,3))
FortressForever._registerEntity('ff_grenade_normal','Grenade',(2,3))
FortressForever._registerEntity('ff_projectile_gl','Grenade Launcher',(2,3))
FortressForever._registerEntity('ff_projectile_pl','Pipe Launcher',(2,3))
FortressForever._registerEntity('ff_projectile_ic','Incendiary Cannon',(2,3))
FortressForever._registerEntity('ff_projectile_dart','Dart',(2,3))
FortressForever._registerEntity('ff_projectile_rail','Rail Gun',(2,3))

gesource = EntityManager()
gesource._registerTeam(0,'Death Match')
gesource._registerEntity('npc_tknife','Thrown Knives',0)
gesource._registerEntity('npc_grenade','Grenade',0)
gesource._registerEntity('npc_mine','All Mines',0)

hidden = EntityManager()
hidden._registerTeam(2,'Iris')
hidden._registerTeam(3,'Hidden')
hidden._registerEntity('fn303_bolt','Less Lethal Launcher',2)
hidden._registerEntity('grenade_projectile','Grenade',3)

hl2ctf = EntityManager()
hl2ctf._registerTeam(2,'Combine')
hl2ctf._registerTeam(3,'Rebels')
hl2ctf._registerEntity('grenade_ar2','SMG Grenade',(2,3))
hl2ctf._registerEntity('crossbow_bolt','Crossbow Bolts',(2,3))
hl2ctf._registerEntity('rpg_missile','Rocket',(2,3))
hl2ctf._registerEntity('prop_combine_ball','AR2 Ball',(2,3))

hl2mp = EntityManager()
hl2mp._registerTeam(0,'Death Match')
hl2mp._registerTeam(2,'Rebels')
hl2mp._registerTeam(3,'Combine')
hl2mp._registerEntity('crossbow_bolt','Crossbow Bolts',(0,2,3))
hl2mp._registerEntity('grenade_ar2','SMG Grenade',(0,2,3))
hl2mp._registerEntity('npc_grenade_frag','Frag Grenade',(0,2,3))
hl2mp._registerEntity('rpg_missile','Rocket',(0,2,3))
hl2mp._registerEntity('prop_combine_ball','AR2 Ball',(0,2,3))

insurgency = EntityManager()
insurgency._registerTeam(1,'US')
insurgency._registerTeam(2,'Insurgents')
insurgency._registerEntity('grenade_m67','US Grenade',(1,2))
insurgency._registerEntity('grenade_m18','Smoke Grenade',(1,2))
insurgency._registerEntity('m403_grenade','Launcher Grenade',(1,2))
insurgency._registerEntity('grenade_rgd5','Insurgents Grenade',(1,2))
insurgency._registerEntity('missile_rpg7','Rocket',(1,2))

NeotokyoSource = EntityManager()
NeotokyoSource._registerTeam(2,'Jinrai')
NeotokyoSource._registerTeam(3,'NSF')
NeotokyoSource._registerEntity('grenade_projectile','Grenade',(2,3))
NeotokyoSource._registerEntity('smokegrenade_projectile','Grenade',(2,3))

pvkii = EntityManager()
pvkii._registerTeam(2,'Pirates')
pvkii._registerTeam(3,'Vikings')
pvkii._registerTeam(4,'Knights')
pvkii._registerEntity('powderkeg','Thrown Powder Keg',2)
pvkii._registerEntity('npc_parrot','Flying Parrot',2)
pvkii._registerEntity('bird_poop','Parrot Projectile',2)
pvkii._registerEntity('projectile_rocketball','Blunderbuss Special Attack',2)
pvkii._registerEntity('arrow','Arrows',4)
pvkii._registerEntity('crossbow_bolt','Crossbow Bolts',4)
pvkii._registerEntity('throwaxe','Thrown Axe',3)

smashball = EntityManager()
smashball._registerTeam(0,'The Ball')
smashball._registerTeam(2,'Red Rockets')
smashball._registerTeam(3,'Blue Ballers')
smashball._registerEntity('spidermine','Spider Mines',(2,3))
smashball._registerEntity('mirv_missile','Mirv Missiles',(2,3))
smashball._registerEntity('googun_projectile','GooGun',(2,3))
smashball._registerEntity('ball','The Ball',0)

so = EntityManager()
so._registerTeam(3,'Survivors')
so._registerEntity('npc_grenade_frag','Frag Grenade',3)
so._registerEntity('grenade_molotov','Incendiary Grenade',3)
so._registerEntity('rpg_missile','RPG Missile',3)

sourceforts = EntityManager()
sourceforts._registerTeam(2,'Blue')
sourceforts._registerTeam(3,'Red')
sourceforts._registerEntity('rpg_missile','Rocket',(2,3))
sourceforts._registerEntity('npc_grenade_frag','Frag Grenade',(2,3))
sourceforts._registerEntity('crossbow_bolt','Crossbow Bolts',(2,3))

synergy = EntityManager()
synergy._registerTeam(0,'Players')
synergy._registerEntity('npc_grenade_bugbait','Bugbait',0)
synergy._registerEntity('crossbow_bolt','Crossbow Bolts',0)
synergy._registerEntity('npc_grenade_frag','Frag Grenade',0)
synergy._registerEntity('prop_combine_ball','AR2 Ball',0)
synergy._registerEntity('rpg_missile','Rocket',0)
synergy._registerEntity('grenade_ar2','SMG Grenade',0)

zombie_master = EntityManager()
zombie_master._registerTeam(2,'All Players')
zombie_master._registerEntity('grenade_molotov','Molotov',2)

zps = EntityManager()
zps._registerTeam(2,'Humans')
zps._registerEntity('npc_grenade_frag','Grenade',2)

def _getCurrentGame():
if gamename == 'ageofchivalry':
return ageofchivalry
elif gamename == 'cstrike':
return cstrike
elif gamename == 'dystopia':
return dystopia
elif gamename == 'esmod':
return esmod
elif gamename == 'fistful_of_frags':
return fistful_of_frags
elif gamename == 'FortressForever':
return FortressForever
elif gamename == 'gesource':
return gesource
elif gamename == 'hidden':
return hidden
elif gamename == 'hl2ctf':
return hl2ctf
elif gamename == 'hl2mp':
return hl2mp
elif gamename == 'insurgency':
return insurgency
elif gamename == 'NeotokyoSource':
return NeotokyoSource
elif gamename == 'pvkii':
return pvkii
elif gamename == 'smashball':
return smashball
elif gamename == 'so':
return so
elif gamename == 'sourceforts':
return sourceforts
elif gamename == 'synergy':
return synergy
elif gamename == 'zombie_master':
return zombie_master
elif gamename == 'zps':
return zps
else:
raise NotImplementedError, 'LooneyTrails does not currently support "%s"'%gamename

currentgame = _getCurrentGame()

def load():
es.addons.registerTickListener(tick)
config = cfglib.AddonCFG(es.getAddonPath('looneytrails') + '/lt_config.cfg')
config.text(getCfgText('Weapon Entity Effect Options'))
config.text('Possible choices for effects are "%s", and "random"'%'", "'.join(TrailEffects))
config.text('Simply setting an effect to ANYTHING not listed above will mean there will be no effect for that entity.')
config.text('Choosing "random" will mean each time a new entity is created of that type, it will choose a random effect for that index')
config.text('')
config.text('If you choose "beam" for any effect, please set the Red, Green, and Blue values for that entity')
config.text('Please make sure when setting colors to use the format:\n// <variable> "<red>,<green>,<blue>"')
for x in currentgame.teams:
config.text('\n\n')
team = currentgame.teams[x]
config.text(getCfgText(' Choose Effects for %s Weapons '%team.name))
for entity in team.team_entities:
config.text('\n')
config.text('******** %s %s ********'%(team.name,team.team_entities[entity]))
y = config.cvar('lt_%s_effect_%s'%(team.name.replace(' ','_').lower(),entity),TrailEffects[0],'Set to the effect you wish %s to have for %s'%(team.name,team.team_entities[entity]))
z = config.cvar('lt_%s_beamcolor_%s'%(team.name.replace(' ','_').lower(),entity),'255,255,255','Set the "<red>,<green>,<blue>" values for %s beam color for %s'%(team.name,team.team_entities[entity]))
config.text('\n\n')
config.text(getCfgText('Beam Options'))
lt_beammodel = config.cvar('lt_beammodel','sprites/laser.vmt','Set to model to use for beam effect')
lt_beamwidth = config.cvar('lt_beamwidth',10,'Set to the width of the beam effect (default = 10)')
config.write()
config.execute()

def getCfgText(text):
return '%s\n// ** %s **\n// %s'%('*'*(len(text) + 6),text,'*'*(len(text) + 6))

def unload():
es.addons.unregisterTickListener(tick)

def tick():
currentgame.findEntityIndexes()


lt_config.cfg

Code: Select all

// **********************************
// ** Weapon Entity Effect Options **
// **********************************
// Possible choices for effects are "smoke", "energy", "sparks", "dust", "beam", and "random"
// Simply setting an effect to ANYTHING not listed above will mean there will be no effect for that entity.
// Choosing "random" will mean each time a new entity is created of that type, it will choose a random effect for that index

// If you choose "beam" for any effect, please set the Red, Green, and Blue values for that entity
// Please make sure when setting colors to use the format:
// <variable> "<red>,<green>,<blue>"



// ****************************************************
// **     Choose Effects for Death Match Weapons     **
// ****************************************************


// ******** Death Match Rocket ********

// Set to the effect you wish Death Match to have for Rocket
   lt_death_match_effect_rpg_missile "smoke"

// Set the "<red>,<green>,<blue>" values for Death Match beam color for Rocket
   lt_death_match_beamcolor_rpg_missile "255,255,255"


// ******** Death Match Crossbow Bolts ********

// Set to the effect you wish Death Match to have for Crossbow Bolts
   lt_death_match_effect_crossbow_bolt "smoke"

// Set the "<red>,<green>,<blue>" values for Death Match beam color for Crossbow Bolts
   lt_death_match_beamcolor_crossbow_bolt "255,255,255"


// ******** Death Match SMG Grenade ********

// Set to the effect you wish Death Match to have for SMG Grenade
   lt_death_match_effect_grenade_ar2 "smoke"

// Set the "<red>,<green>,<blue>" values for Death Match beam color for SMG Grenade
   lt_death_match_beamcolor_grenade_ar2 "255,255,255"


// ******** Death Match AR2 Ball ********

// Set to the effect you wish Death Match to have for AR2 Ball
   lt_death_match_effect_prop_combine_ball "smoke"

// Set the "<red>,<green>,<blue>" values for Death Match beam color for AR2 Ball
   lt_death_match_beamcolor_prop_combine_ball "255,255,255"


// ******** Death Match Frag Grenade ********

// Set to the effect you wish Death Match to have for Frag Grenade
   lt_death_match_effect_npc_grenade_frag "smoke"

// Set the "<red>,<green>,<blue>" values for Death Match beam color for Frag Grenade
   lt_death_match_beamcolor_npc_grenade_frag "255,255,255"



// ***********************************************
// **     Choose Effects for Rebels Weapons     **
// ***********************************************


// ******** Rebels Rocket ********

// Set to the effect you wish Rebels to have for Rocket
   lt_rebels_effect_rpg_missile "smoke"

// Set the "<red>,<green>,<blue>" values for Rebels beam color for Rocket
   lt_rebels_beamcolor_rpg_missile "255,255,255"


// ******** Rebels Crossbow Bolts ********

// Set to the effect you wish Rebels to have for Crossbow Bolts
   lt_rebels_effect_crossbow_bolt "smoke"

// Set the "<red>,<green>,<blue>" values for Rebels beam color for Crossbow Bolts
   lt_rebels_beamcolor_crossbow_bolt "255,255,255"


// ******** Rebels SMG Grenade ********

// Set to the effect you wish Rebels to have for SMG Grenade
   lt_rebels_effect_grenade_ar2 "smoke"

// Set the "<red>,<green>,<blue>" values for Rebels beam color for SMG Grenade
   lt_rebels_beamcolor_grenade_ar2 "255,255,255"


// ******** Rebels AR2 Ball ********

// Set to the effect you wish Rebels to have for AR2 Ball
   lt_rebels_effect_prop_combine_ball "smoke"

// Set the "<red>,<green>,<blue>" values for Rebels beam color for AR2 Ball
   lt_rebels_beamcolor_prop_combine_ball "255,255,255"


// ******** Rebels Frag Grenade ********

// Set to the effect you wish Rebels to have for Frag Grenade
   lt_rebels_effect_npc_grenade_frag "smoke"

// Set the "<red>,<green>,<blue>" values for Rebels beam color for Frag Grenade
   lt_rebels_beamcolor_npc_grenade_frag "255,255,255"



// ************************************************
// **     Choose Effects for Combine Weapons     **
// ************************************************


// ******** Combine Rocket ********

// Set to the effect you wish Combine to have for Rocket
   lt_combine_effect_rpg_missile "smoke"

// Set the "<red>,<green>,<blue>" values for Combine beam color for Rocket
   lt_combine_beamcolor_rpg_missile "255,255,255"


// ******** Combine Crossbow Bolts ********

// Set to the effect you wish Combine to have for Crossbow Bolts
   lt_combine_effect_crossbow_bolt "smoke"

// Set the "<red>,<green>,<blue>" values for Combine beam color for Crossbow Bolts
   lt_combine_beamcolor_crossbow_bolt "255,255,255"


// ******** Combine SMG Grenade ********

// Set to the effect you wish Combine to have for SMG Grenade
   lt_combine_effect_grenade_ar2 "smoke"

// Set the "<red>,<green>,<blue>" values for Combine beam color for SMG Grenade
   lt_combine_beamcolor_grenade_ar2 "255,255,255"


// ******** Combine AR2 Ball ********

// Set to the effect you wish Combine to have for AR2 Ball
   lt_combine_effect_prop_combine_ball "smoke"

// Set the "<red>,<green>,<blue>" values for Combine beam color for AR2 Ball
   lt_combine_beamcolor_prop_combine_ball "255,255,255"


// ******** Combine Frag Grenade ********

// Set to the effect you wish Combine to have for Frag Grenade
   lt_combine_effect_npc_grenade_frag "smoke"

// Set the "<red>,<green>,<blue>" values for Combine beam color for Frag Grenade
   lt_combine_beamcolor_npc_grenade_frag "255,255,255"



// ******************
// ** Beam Options **
// ******************

// Set to model to use for beam effect
   lt_beammodel "sprites/laser.vmt"

// Set to the width of the beam effect (default = 10)
   lt_beamwidth 10
User avatar
satoon101
Project Leader
Posts: 2573
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] looneytrails

Postby satoon101 » Wed Oct 10, 2018 10:06 pm

Image

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 2 guests