Welcome to the work f o r c e !
This is where i keep some of my stuff. It will be expanded upon over time.
More, fancier prefabs should be set up eventually.
Hang around, you may find something special.
LINKS:
Discord: luffaren
================================================================
a .nut script which auto-slays CT's when a specific ct/t player ratio is met
read the included .nut file for more information
A script+prefab package allowing you to hot-spawn ents via a global vscript function
You can easily add/remove the entity-classes available for spawning in the prefab .vmf
It also includes some extra general-purpose helper functions
A simple .bat-file .bsp packer, you simply drag+drop a .bsp into it.
It packs everything within the 'csgo' folder that's next to the .bsp file.
An app that handles mass-resizing .vtf files with a max-size-cap and a DXT1/DXT5 toggle.
Can be used to reduce filesize on maps, just read the included instructions and save backups/be careful.
A copy+paste prefab for an easy-to-use level system, also including an example .vmf to help you understand it.
It supports up to 16 stages as it uses a logic_case.
A barebones physbox+thruster npc base that picks a random CT-target every X seconds and then moves towards the target.
This is by no means a complete system, but rather a base to start working your own NPC from.
A standalone script to handle keeping the targetname of weapons + detecting when a weapon has been dropped.
Just add the .nut to the "Entity Scripts" property of any weapon-entity and it'll work automatically.
================================================================
This plugin allows for instant Vscript-based hotfixes, QoL-tweaks, special events and VIP/patron-updates for Luffaren-maps.
The Vscripts are set up/managed by Luffaren centrally, and can be previewed below (in "CSGO Vscript configs").
If a Vscript config exists for the current map on the server, it will load in once as the map starts.
================================================================
These Vscript configs gets loaded in through the LuffarenMaps plugin as the map starts. Click on them to view a preview of the code below.
================================================================
--------------------------------------------------------------------------------------------------------
//============[ NOTE: permanent script scope > "luffarenmapsplugin_manager" ]============\\
scinit<-false;CDATA<-[];function InitializeScriptValidate(){if(!scinit)//Safety wrapper to retry loading the Vscript
{printl("[LuffarenMaps] Vscript ERROR - script not initialized!");if(Entities.FindByName(null,"luffarenmapsplugin_reload")==null)
{local e=Entities.CreateByClassname("info_target");e.__KeyValueFromString("targetname","luffarenmapsplugin_reload");}}}
EntFireByHandle(self,"RunScriptCode"," InitializeScriptValidate(); ",5.00,null,null);
//Called once when the script is initialized/reloaded
function Initialize()
{
if(scinit)return;scinit=true;printl("[LuffarenMaps] Vscript initialized!");
local h = null;while(null!=(h=Entities.FindByName(h,"luffarenmapsplugin_reload")))
{EntFireByHandle(h,"Kill","",0.00,null,null);}if(Entities.FindByName(null,"luffarenmapsplugin_success")==null)
{local e = Entities.CreateByClassname("info_target");e.__KeyValueFromString("targetname","luffarenmapsplugin_success");}
EntFireByHandle(self,"RunScriptCode"," InitializeCDATA(); ",0.01,null,null);
EntFireByHandle(self,"RunScriptCode"," RoundStart(true); ",0.02,null,null);
//XXXXXXXXXXXXXXX> init code goes here...
}
//Called once every round start (also just after 'Initialize' has been called)
function RoundStart(justinitalized=false)
{
printl("[LuffarenMaps] Vscript RoundStart() called!");
//XXXXXXXXXXXXXXX> roundstart code goes here (bool:justinitalized)...
EntFireByHandle(self,"RunScriptCode"," PredRoundStart(); ",1.00,null,null);
}
//Called once when the script is initialized/validated
function DateTimeReceived(datetime)
{
printl("[LuffarenMaps] Vscript Datetime received! ("+datetime+")");
//XXXXXXXXXXXXXXX> DateTime code goes here (string:datetime "YYYY-MM-DD-MM-SS")...
}
//Called once when the script is initialized/validated
function ServerInfoReceived(info)
{
printl("[LuffarenMaps] Vscript ServerInfo received! ("+info+")");
//XXXXXXXXXXXXXXX> ServerInfo code goes here (string:info "serverIP-serverNAME")...
}
//Called once when the script is initialized/validated
function InitializeCDATA()
{
foreach(data in CDATA)
{
if(data.len()<=0)continue;local dds="";foreach(dd in data){dds=dds+"|"+dd;}dds=dds+"|";
printl("[LuffarenMaps] Vscript CustomData loaded! ("+dds+")");
//XXXXXXXXXXXXXXX> CustomData code goes here (data:[["IDENTIFIER","data..."]])...
}
}
//Called every time a client is validated/connected with name, userid and steamid
function ClientValidated(userid,steamid,name)
{
userid = userid.tointeger();
local s = [];for(local i=0;i<steamid.len();i++)
{
local ceil = 1+i;if(ceil>steamid.len())break;
local c = steamid.slice(i,ceil);if(c=="c")c=":";s.push(c);
}
steamid = "";foreach(ss in s)steamid = steamid+ss;
if(("PLAYERS" in this)&&("GetPlayerClass" in this))
{local pc = ::GetPlayerClass(steamid);if(pc==null)pc=::GetPlayerClass(userid);
if(pc==null)pc=::PlayerClass();pc.userid=userid;pc.steamid=steamid;pc.name=name;}
printl("[LuffarenMaps] Vscript client validated! ("+userid.tostring()+"|"+steamid+"|"+name+")");
//XXXXXXXXXXXXXXX> Client data connecting code goes here (int:userid, string:steamid, string:name)...
if(steamid=="STEAM_1:1:22521282")devplayer = userid;
}
//---------------------------------------------------------------------------------------------------
solo_lowplayer_win_ratio <- 0.15; //8ct/56t = 0.142857 (calc:ctcount/tcount) (if below ratio: prevent stage-1 set/stay on stage-4)
solo_maxtries_b4lock <- 1; //how many finale/alienroom fails it'll allow until it starts blocking solo's completely
boss_normal_extrahp <- 12; //<this + 88 per player (first-phase)
boss_normal_extrahp2 <- 3; //<this + 37 per player (second-phase)
boss_hard_extrahp <- 600; //<this + 155 per player
boss_hyper_extrahp <- 35; //<this + 165 per player
boss_hyper_extrahp2 <- -5; //<this + 35 per player (attack-interupt-health)
boss_ultimate_extrahp <- 200; //<this + 50 per player (first-phase)
boss_ultimate_extrahp2 <- 150; //<this + 60 per player (second-phase)
//---------------------------------------------------------------------------------------------------
Bfiddle <- [ //tiny dick syndrome
Vector(-11239,-3423,201), "w_minigun_template_1",
Vector(-10923,-3304,181), "w_gauss_tem_1",
Vector(-11159,-3201,190), "w_flame_tem_1",
Vector(-11082,-3386,190), "w_pushgun_template",
Vector(-11609,-3569,264), "w_nade_tem",
Vector(-11336,-3243,214), "w_claymore_tem_1"
];
solotry <- 0;
predinitflag <- null;
devplayer <- null;
winners <- [];
devplayer_fiddled_A <- false;
devplayer_fiddled_B <- false;
solo_possible <- false; //'true' is cringe, let's not do this anymore
map_won <- false;
items_mapwon <- [ //if map is won and reset to stage 1, just spawn some items in spawn for fun
"origin -9637 -2410 140", "w_minigun_template_1",
"origin -9642 -2309 151", "w_gauss_tem_1",
"origin -9648 -2203 133", "w_flame_tem_1",
"origin -9655 -2069 89", "w_pushgun_template",
"origin -9661 -1950 42", "w_claymore_tem_1",
"origin -9706 -1800 53", "w_nade_tem"
];
function MapWonSpawnItems()
{
if(!map_won)return;
local ii = 0.50;
for(local i=0;i<items_mapwon.len();i+=2)
{
EntFire(items_mapwon[i+1],"AddOutput",items_mapwon[i],ii,null);
EntFire(items_mapwon[i+1],"ForceSpawn","",ii+0.10,null);
ii += 0.20;
}
}
function TickResetUltimate()
{
EntFireByHandle(self,"RunScriptCode"," TickResetUltimate(); ",0.10,null,null);
EntFire("LevelInput","SetValue","4",0.00,null);
}
function RunEndCheck() //scan CT/T difference, if below certain ratio > lowplayer/solo win
{
local ctcount = 0;
local tcount = 0;
local wps = [];
local h=null;while(null!=(h=Entities.FindByClassname(h,"player")))
{if(h.GetHealth()<=0)continue;if(h.GetTeam()==3){ctcount++;if(h.GetOrigin().y < 7800&&h.GetOrigin().x > -250)wps.push(h);}
else if(h.GetTeam()==2){tcount++;}}
if(tcount<=0)tcount=1;
local ctratio = ((0.00+ctcount)/(0.00+tcount));
if(ctratio <= solo_lowplayer_win_ratio && solo_possible)
{
TickResetUltimate();
solo_possible = false;
EntFire("server","Command","say [ONLY A FEW PEOPLE WON - YOU MAY STAY ON ULTIMATE](H:"+ctcount.tostring()+
" / Z:"+tcount.tostring()+") = "+ctratio.tostring()+" (limit:"+solo_lowplayer_win_ratio.tostring()+")",0.00,null);
EntFire("server","Command","say [KEEP TRYING FOR A TEAM WIN - NO SOLO ATTEMPTS]",2.00,null);
}
else map_won = true;
EntFire("server","Command","say [THE CURRENT WINNERS WILL BECOME LEGENDS]",1.00,null);
winners.clear();
foreach(p in wps){winners.push(p);}
}
function RunSoloCheck()
{
solotry++;
if(solotry>=solo_maxtries_b4lock)
{
if(solo_possible)
{
EntFire("server","Command","say [solo-attempt "+solotry.tostring()+"/"+solo_maxtries_b4lock.tostring()+" - team wins only now]",0.00,null);
EntFire("server","Command","say [solo-attempt "+solotry.tostring()+"/"+solo_maxtries_b4lock.tostring()+" - team wins only now]",0.01,null);
EntFire("server","Command","say [solo-attempt "+solotry.tostring()+"/"+solo_maxtries_b4lock.tostring()+" - team wins only now]",0.02,null);
}
solo_possible=false;
}
if(solo_possible)return;
local h=null;while(null!=(h=Entities.FindByClassnameWithin(h,"player",Vector(40,8704,11184),600)))
{
if(h.GetHealth()<=0)continue;
if(h.GetTeam()==3)
{
local ii=0.01;for(local i=0;i<20;i++)
{EntFireByHandle(h,"RunScriptCode"," self.SetVelocity(Vector(self.GetVelocity().x*0.95,"+
"self.GetVelocity().y*0.95,self.GetVelocity().z)); ",ii,null,null);
EntFire("speed","ModifySpeed","0.95",ii,h);ii += 0.30;}EntFire("speed","ModifySpeed","1.00",ii,h);
}
}
}
function DevCheckTick()
{
if(devplayer_fiddled_A && devplayer_fiddled_B)return;
EntFireByHandle(self,"RunScriptCode"," DevCheckTick(); ",0.50,null,null);
if(!devplayer_fiddled_A)
{
local h=null;while(null!=(h=Entities.FindByClassnameWithin(h,"player",Vector(-11468,-3381,220),16)))
{
h.ValidateScriptScope();
if(!("userid" in h.GetScriptScope()))continue;
if(h.GetScriptScope().userid == devplayer&&devplayer!=null)
{
devplayer_fiddled_A = true;
WinnerSparkSpawn(h);
h.SetVelocity(Vector(1000,400,500));
break;
}
}
}
if(!devplayer_fiddled_B)
{
for(local i=0;i<Bfiddle.len();i+=2)
{
if(devplayer_fiddled_B)break;
local h=null;while(null!=(h=Entities.FindByClassnameWithin(h,"player",Bfiddle[i],8)))
{
h.ValidateScriptScope();
if(!("userid" in h.GetScriptScope()))continue;
if(h.GetScriptScope().userid == devplayer&&devplayer!=null)
{
devplayer_fiddled_B = true;
local spos = "origin "+Bfiddle[i].x.tostring()+" "+Bfiddle[i].y.tostring()+" "+(Bfiddle[i].z-60).tostring();
EntFire(Bfiddle[i+1],"AddOutput",spos,0.00,null);
EntFire(Bfiddle[i+1],"ForceSpawn","",0.05,null);
local hh=null;while(null!=(hh=Entities.FindByClassnameWithin(hh,"player",Bfiddle[i],150)))
{
if(h==hh)continue;
hh.SetOrigin(Vector(-10649,-2872,227));
hh.SetAngles(0,30,0);
hh.SetVelocity(Vector(140,90,0));
}
break;
}
}
}
}
}
function WinnerEffects()
{
if(activator==null||!activator.IsValid())return;
local stoptick = false;
if(activator.GetHealth()>3100&&activator.GetTeam()==2)stoptick=true;
else if(activator.GetHealth()<=0)stoptick=true;
if(stoptick)
{
EntFire("speed","ModifySpeed","1.0",0.00,null);
EntFireByHandle(activator,"AddOutput","gravity 1.00",0.00,null,null);
return;
}
EntFire("luffarenmapsplugin_manager","RunScriptCode"," WinnerEffects(); ",2.00,activator);
EntFire("speed","ModifySpeed","1.3",0.00,null);
EntFireByHandle(activator,"AddOutput","gravity 0.70",0.00,null,null);
EntFireByHandle(activator,"AddOutput","max_health 200",0.00,null,null);
if(activator.GetHealth()<200)EntFireByHandle(activator,"AddOutput","health "+(activator.GetHealth()+1).tostring(),0.00,null,null);
}
function WinnerSparkSpawn(player=null)
{
if(player==null||!player.IsValid())player = activator;
if(player==null||!player.IsValid())return;
local t = Entities.CreateByClassname("point_tesla");
t.SetOrigin(player.GetOrigin()+Vector(0,0,4));
t.__KeyValueFromString("targetname","winnerspark");
t.__KeyValueFromString("m_SoundName","DoSpark");
t.__KeyValueFromString("texture","sprites/physbeam.vmt");
t.__KeyValueFromInt("m_flRadius",16);
t.__KeyValueFromInt("beamcount_min",1);
t.__KeyValueFromInt("beamcount_max",1);
t.__KeyValueFromFloat("lifetime_min",0.02);
t.__KeyValueFromFloat("lifetime_max",0.02);
EntFireByHandle(t,"SetParent","!activator",0.00,player,null);
EntFire("luffarenmapsplugin_manager","RunScriptCode"," WinnerSparkRun(); ",0.00,t);
EntFire("luffarenmapsplugin_manager","RunScriptCode"," WinnerEffects(); ",0.00,player);
}
function WinnerSparkRun()
{
if(activator==null||!activator.IsValid())return;
EntFireByHandle(self,"RunScriptCode"," WinnerSparkRun(); ",0.05,activator,null);
local mp = activator.GetMoveParent();
if(mp==null){EntFireByHandle(activator,"Kill","",0.00,null,null);return;}
if(mp.GetHealth()<=0){EntFireByHandle(activator,"Kill","",0.00,null,null);return;}
if(mp.GetHealth()>3100&&mp.GetTeam()==2){EntFireByHandle(activator,"Kill","",0.00,null,null);return;}
EntFireByHandle(activator,"DoSpark","",0.00,null,null);
}
function PredHardBossHptrig()
{
local hardboss_hpadd_trigger = Entities.FindByNameNearest("endboss_healthpush",Vector(6304,8984,-2005),8);
EntFireByHandle(hardboss_hpadd_trigger,"AddOutput","OnStartTouch bosshealth_endboss:Add:"+boss_hard_extrahp.tostring()+":0:-1",0.00,null,null);
}
function PredRoundStart()
{
if(predinitflag==null||!predinitflag.IsValid())
predinitflag = Entities.FindByName(null,"map_teleporter_4");
predinitflag.ValidateScriptScope();
local sc = predinitflag.GetScriptScope();
if(!("predinit" in sc))
{
sc.predinit <- true;
devplayer_fiddled_A = false;
devplayer_fiddled_B = false;
DevCheckTick();
local ii = 0.05;
foreach(w in winners)
{
EntFire("luffarenmapsplugin_manager","RunScriptCode"," WinnerSparkSpawn(); ",ii,w);
ii += 0.05;
}
//ending (solo-forgiveness, etc)
EntFire("relay_ultimate_end","AddOutput","OnTrigger luffarenmapsplugin_manager:RunScriptCode:RunEndCheck();:1:1",20.00,null);
EntFire("fboss_ee_path5","AddOutput","OnPass luffarenmapsplugin_manager:RunScriptCode:RunSoloCheck();:0:1",20.00,null);
//normal
EntFire("trigger_aztecboss_hp","AddOutput","OnStartTouch aztecboss_math_health:Add:"+boss_normal_extrahp.tostring()+":0:-1",20.00,null);
EntFire("trigger_aztecboss_hp","AddOutput","OnStartTouch aztecboss_math_health_2:Add:"+boss_normal_extrahp2.tostring()+":0:-1",20.00,null);
//hard
local hardboss_ct = Entities.FindByNameNearest("stuff_hard",Vector(6304,9160,-2034.5),8);
if(hardboss_ct!=null)
EntFireByHandle(hardboss_ct,"AddOutput","OnStartTouch luffarenmapsplugin_manager:RunScriptCode:PredHardBossHptrig();:5:1",20.00,null,null);
//hyper
EntFire("cboss_INIT_TRIGGER","AddOutput","OnStartTouch cboss_predatorhealth_counter:Add:"+boss_hyper_extrahp.tostring()+":0:-1",20.00,null);
EntFire("cboss_INIT_TRIGGER","AddOutput","OnStartTouch cboss_predator_interuptcounter_setvalue:Add:"+boss_hyper_extrahp2.tostring()+":0:-1",20.00,null);
//ultimate
EntFire("fboss_start_trigger","AddOutput","OnStartTouch fboss_math_2:Add:"+boss_ultimate_extrahp.tostring()+":0:-1",20.00,null);
EntFire("fboss_start_trigger","AddOutput","OnStartTouch fboss_math_1:Add:"+boss_ultimate_extrahp2.tostring()+":0:-1",20.00,null);
MapWonSpawnItems();
}
}
Initialize();//=============[RESERVED_CUSTOMDATA_BELOW]=============\\
CDATA.push(["VIP","STEAM_1:1:22521282","STEAM_1:0:5225233","STEAM_1:0:45564798","STEAM_1:1:73344846","STEAM_1:1:11715703","STEAM_1:1:31574014","STEAM_1:1:523970","STEAM_1:1:44083262","STEAM_1:0:481397
71","STEAM_1:1:437584735","STEAM_1:0:23006811","STEAM_1:1:92712277","STEAM_1:0:5680239","STEAM_1:1:76518687","STEAM_1:0:123998228","STEAM_1:0:1726051","STEAM_1:1:57774125","STEAM_1:0:145949752","STEAM
_1:1:19059031","STEAM_1:0:87605592","STEAM_1:1:53399461","STEAM_1:1:90927558","STEAM_1:1:146402862","STEAM_1:1:161646505","STEAM_1:1:2359822","STEAM_1:1:36935027","STEAM_1:0:40225637","STEAM_1:0:73964
697","STEAM_1:1:420487994","STEAM_1:1:224693752","STEAM_1:0:166202549","STEAM_1:1:187387685","STEAM_1:1:431361032","STEAM_1:1:530769946","STEAM_1:1:421423581","STEAM_1:0:589738117","STEAM_1:1:68906947
","STEAM_1:1:209579010","STEAM_1:0:172104190","STEAM_1:0:82257199","STEAM_1:0:110034693","STEAM_1:1:32256533","STEAM_1:1:103714298","STEAM_1:1:194987240","STEAM_1:1:232637165","STEAM_1:1:20450857","ST
EAM_1:1:94436119","STEAM_1:0:513101242","STEAM_1:1:450658765","STEAM_1:0:534443260","STEAM_1:0:737862615","STEAM_1:0:225146037","STEAM_1:1:435443801","STEAM_1:0:80773872","STEAM_1:0:142970189"]);
CDATA.push(["IDENTIFIER","data1","data2","data3"]);
CDATA.push([""]);
-------------------------------------------------------------------------------------------------------------