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)...
//add 2 extra heals
::ITEMS.heal_orb.Spawn(Vector(-1975,7380,-3839)+Vector(0,0,-20));
::ITEMS.heal_orb.Spawn(Vector(838,7614,-3305)+Vector(0,0,-20));
//tweak the health of bosses + flying drakes
try{
local man = Entities.FindByName(null,"script").GetScriptScope();
man.drake_hp_base <- 1000;
man.drake_hp_each <- 1500;
man.drake_hp_set_delay <- 20.00;
man.bosshp_fake_base <- 500;
man.bosshp_fake_each <- 300;
man.bosshp_real_base <- 1000;
man.bosshp_real_each <- 800;
man.bosshp_arm_base <- 300;
man.bosshp_arm_each <- 300;
::flyingdrake_hp_base <- 100;
::flyingdrake_hp_each <- 100;
}catch(e){printl("BossFlyDrakeHPedit ERROR: "+e);}
//fix env_fire being invisible by restarting it (+ try removing smoke for FPS-reasons)
EntFire("env_fire","ExtinguishTemporary","0.00",4.00,null);
EntFire("env_fire","StartFire","",8.00,null);
EntFire("env_fire","AddOutput","spawnflags 15",0.00,null);
EntFire("env_fire","AddOutput","spawnflags 15",0.10,null);
EntFire("env_fire","AddOutput","spawnflags 15",3.00,null);
EntFire("env_fire","AddOutput","spawnflags 15",7.00,null);
EntFire("env_fire","AddOutput","spawnflags 15",9.00,null);
//fix a funky Z-skip, very nasty stuff
try{
local jumpx_2 = Entities.FindByName(null,"jumpx_2");
jumpx_2.ValidateScriptScope();
jumpx_2.GetScriptScope().TouchPostFixupSafe <- function()
{
if(activator.GetOrigin().z > -5225 && activator.GetOrigin().x > -737)
{
activator.SetVelocity(Vector());
activator.SetOrigin(Vector(-191,-1472,-11601));
}
}
EntFireByHandle(jumpx_2,"AddOutput","OnStartTouch !self:RunScriptCode:TouchPostFixupSafe();:2:-1",0.50,null,null);
EntFireByHandle(jumpx_2,"AddOutput","OnStartTouch !self:RunScriptCode:TouchPostFixupSafe();:3:-1",0.50,null,null);
EntFireByHandle(jumpx_2,"AddOutput","OnStartTouch !self:RunScriptCode:TouchPostFixupSafe();:4:-1",0.50,null,null);
}catch(e){printl("TouchPostFixupSafe ERROR: "+e);}
//make shellbert a true mother
::TRAPS.thigh_spider <- {
tickrate = 0.05,
tickrate_idle = 2.00,
target_range = 500,
target_lose_range = 1000,
bite_range = 64,
bite_damage = 4,
bite_delaybuffer = 4,
jump_range = 400,
jump_timeout = 70,
jump_nudge_delay = 0.80,
jump_nudge_force = 20,
jump_after_first = true,
jump_speed = 500,
jump_height = 300,
jump_height_high = 700,
jump_height_high_height = 70,
hp_base = 50,
hp_each_ct = 50,
mother_id = "STEAM_1:0:554317138", //shellbert
function Spawn(pos,rot=null){
if(rot==null)rot = Vector(0,RandomFloat(0,360),0);
::Ent(pos,rot,"hegrenade_projectile",{
rendermode = 1,
renderamt = 0,
},{
mother_found = false,
mother_handle = null,
function TickMother(){
if(mother_found||dead)return;
EntFireByHandle(self,"RunScriptCode","TickMother();",5.00,null,null);
local pc = ::GetPlayerClass(::TRAPS.thigh_spider.mother_id);
if(pc==null)return;
if(pc.handle==null||!pc.handle.IsValid())return;
if(pc.handle.GetHealth()<=0||pc.handle.GetTeam()!=3)return;
mother_found = true;
mother_handle = pc.handle;
},function TargetPlayer(_target){
target = _target;
::Sound("*luffaren/shellbert_despair.mp3",Vector(0,0,15),self,6000,1.50,RandomInt(40,50),10);
},function Die(){
if(dead)return;
dead = true;
EntFireByHandle(model,"SetAnimation","dead",0.00,null,null);
EntFireByHandle(model,"SetDefaultAnimation","dead",0.01,null,null);
EntFireByHandle(model,"fadeandkill","3",7.00,null,null);
EntFireByHandle(self,"Kill","0",10.05,null,null);
self.SetVelocity(Vector(0,0,-300));
standanim = true;
jumptime = 0;
pitch = 0;
jumping = false;
::Sound("*luffaren/shellbert_despair.mp3",Vector(0,0,15),self,5000,2.00,RandomInt(30,35),10);
::Sound("*luffaren/eyelid_flesh.mp3",Vector(0,0,15),self,5000,2.00,RandomInt(30,35),10);
::Sound("*luffaren/eyelid_flesh.mp3",Vector(0,0,15),self,5000,2.00,RandomInt(60,70),10);
},function Tick(){
if(dead)return;
local tick_called = false;
try{
if(self.GetOrigin().z < -15000)Die();
EntFireByHandle(self,"Wake","",0.00,null,null);
self.SetAngles(0,yaw,0);
local mother_just_found = null
if(mother_found)
{
if(mother_handle==null||!
mother_handle.IsValid()||
mother_handle.GetHealth()<=0||
mother_handle.GetTeam()!=3||
mother_handle == target||
::GetDistance(mother_handle.GetOrigin(),self.GetOrigin())>::TRAPS.thigh_spider.target_lose_range||
TraceLine(mother_handle.GetOrigin()+Vector(0,0,48),self.GetOrigin(),self)<1.00){}
else
{
target = null;
mother_just_found = mother_handle;
}
}
if(target==null||!target.IsValid()||target.GetTeam()!=3||target.GetHealth()<=0||
::GetDistance(target.GetOrigin(),self.GetOrigin())>::TRAPS.thigh_spider.target_lose_range)
{
target = null;
if(biting)
{
self.SetVelocity(Vector(0,0,-300));
EntFireByHandle(model,"SetAnimation","idle",0.00,null,null);
EntFireByHandle(model,"SetDefaultAnimation","idle",0.01,null,null);
standanim = true;
jumptime = 0;
pitch = 0;
jumping = false;
}
biting = false;
jumped_once = false;
local candidates = [];
for(local h;h=Entities.FindByClassnameWithin(h,"player",self.GetOrigin(),::TRAPS.thigh_spider.target_range);)
{
if(h==null||!h.IsValid()||h.GetTeam()!=3||h.GetHealth()<=0)continue;
if(TraceLinePlayersIncluded(self.GetOrigin()+Vector(0,0,30),h.GetOrigin()+Vector(0,0,40),h)<1.00)continue;
candidates.push(h);
}
if(candidates.len()>0)
{
TargetPlayer(candidates[RandomInt(0,candidates.len()-1)]);
}
}
if(mother_just_found != null)
{
target = mother_just_found;
jumped_once = true;
}
tick_called = true;
if(target==null)
EntFireByHandle(self,"RunScriptCode","Tick();",::TRAPS.thigh_spider.tickrate_idle,null,null);
else
EntFireByHandle(self,"RunScriptCode","Tick();",::TRAPS.thigh_spider.tickrate,null,null);
if(target!=null)
{
EntFireByHandle(model,"AddOutput","body 1",0.00,null,null);
local dir = (target.GetOrigin()+Vector(0,0,40))-(self.GetOrigin()+Vector(0,0,15));
dir.Norm();
yaw = ::DirToAngles(dir).y;
if(!biting && ::GetDistance(self.GetOrigin()+Vector(0,0,15),target.GetOrigin()+Vector(0,0,30))<=::TRAPS.thigh_spider.bite_range)
{
biting = true;
bite_offset = (::AnglesToDir(Vector(0,RandomFloat(0,360),0))*20)+Vector(0,0,RandomFloat(20,25));
EntFireByHandle(model,"SetAnimation","stuck",0.00,null,null);
EntFireByHandle(model,"SetDefaultAnimation","stuck",0.01,null,null);
::Sound("*luffaren/shellbert_despair.mp3",self.GetOrigin()+Vector(0,0,15),null,1000,0.04,RandomInt(200,220),10);
::Sound("*luffaren/shellbert_despair.mp3",self.GetOrigin()+Vector(0,0,15),null,1000,0.04,RandomInt(240,255),10);
}
if(biting)
{
self.SetOrigin(target.GetOrigin()+bite_offset);
self.SetVelocity(Vector());
if(mother_found && target != null && target == mother_handle)
{
EntFireByHandle(model,"SetAnimation","stuck",0.00,null,null);
}
else
{
pitch = ::DirToAngles(dir).x;
bite_buffer++;
if(bite_buffer > ::TRAPS.thigh_spider.bite_delaybuffer)
{
bite_buffer = 0;
local newhp = target.GetHealth()-::TRAPS.thigh_spider.bite_damage;
EntFireByHandle(target,"SetHealth",newhp.tostring(),0.00,null,null);
::Particle("blood_impact_headshot",target.GetOrigin()+Vector(0,0,35),Vector(90+RandomInt(-15,15),RandomInt(0,360),RandomInt(-15,15)),null,0.05);
}
::Sound("*luffaren/eyelid_flesh.mp3",target.GetOrigin()+Vector(0,0,35),null,1000,0.04,RandomInt(170,180),10);
local tvel = target.GetVelocity();
tvel.x = 0;
tvel.y = 0;
if(tvel.z > 0)tvel.z = 0;
target.SetVelocity(tvel);
}
}
else
{
local jrange = (0+::TRAPS.thigh_spider.jump_range);
if(jumped_once && ::TRAPS.thigh_spider.jump_after_first)jrange = 99999;
if(!jumping && ::GetDistance(target.GetOrigin(),self.GetOrigin())<=jrange)
{
jumping = true;
jumped_once = true;
standanim = false;
::Sound("*luffaren/shellbert_despair.mp3",self.GetOrigin()+Vector(0,0,15),null,5000,0.04,RandomInt(130,140),10);
local jumptime = RandomFloat(1.50,3.00);
self.SetOrigin(self.GetOrigin()+Vector(0,0,1));
EntFireByHandle(model,"SetAnimation","jumping",0.00,null,null);
EntFireByHandle(model,"SetDefaultAnimation","jumping",0.01,null,null);
dir.z = 0.00;
dir.Norm();
local jheight = (0+::TRAPS.thigh_spider.jump_height);
if(target.GetOrigin().z > self.GetOrigin().z+::TRAPS.thigh_spider.jump_height_high_height)jheight = (0+::TRAPS.thigh_spider.jump_height_high);
self.SetVelocity((dir*::TRAPS.thigh_spider.jump_speed)+Vector(0,0,jheight));
nudge_buffer = (dir*::TRAPS.thigh_spider.jump_nudge_force);
EntFireByHandle(self,"RunScriptCode","self.SetVelocity(self.GetVelocity()+nudge_buffer);",::TRAPS.thigh_spider.jump_nudge_delay,null,null);
}
else
{
if(jumping)
{
pitch = ::DirToAngles(dir).x;
jumptime++;
}
if(!standanim)
{
if(jumptime>::TRAPS.thigh_spider.jump_timeout||
TraceLinePlayersIncluded(self.GetOrigin()+Vector(0,0,2),self.GetOrigin()+Vector(0,0,-5),self)<1.00)
{
EntFireByHandle(model,"SetAnimation","idle",0.00,null,null);
EntFireByHandle(model,"SetDefaultAnimation","idle",0.01,null,null);
standanim = true;
jumptime = 0;
pitch = 0;
EntFireByHandle(self,"RunScriptCode","jumping=false;",RandomFloat(0.40,0.50),null,null);
}
}
}
}
}
else
EntFireByHandle(model,"AddOutput","body 0",0.00,null,null);
self.SetAngles(pitch,yaw,0);
}catch(e){printl("[::TRAPS.thigh_spider ERROR]: "+e);}
if(!tick_called)EntFireByHandle(self,"RunScriptCode","Tick();",::TRAPS.thigh_spider.tickrate,null,null);
},
dead = false,
bite_offset = Vector(),
yaw = rot.y,
pitch = 0,
target = null,
jumping = false,
jumptime = 0,
jumped_once = false,
standanim = true,
model = null,
biting = false,
nudge_buffer = Vector(),
bite_buffer = 0,
function Run(){
self.SetSize(Vector(-10,-10,0),Vector(10,10,15));
EntFireByHandle(self,"AddOutput","material 3",0.00,null,null);
EntFireByHandle(self,"AddOutput","friction 2",0.00,null,null);
EntFireByHandle(self,"AddOutput","collisiongroup 3",0.00,null,null);
EntFireByHandle(self,"AddOutput","movetype 0",0.00,null,null);
EntFireByHandle(self,"AddOutput","movetype 3",0.93,null,null);
EntFireByHandle(self,"RunScriptCode","Tick();",0.95,null,null);
EntFireByHandle(self,"RunScriptCode","TickMother();",0.93,null,null);
::manager.PrecacheModel("models/luffaren/thigh_spider.mdl");
::Ent(self.GetOrigin()+Vector(0,0,15),self.GetAngles(),"prop_dynamic",{
model="models/luffaren/thigh_spider.mdl",
modelscale = 1.50,
},{
master = self,
function Run(){
master.GetScriptScope().model = self;
EntFireByHandle(self,"SetParent","!activator",0.00,master,null);
EntFireByHandle(self,"SetAnimation","idle",0.00,null,null);
EntFireByHandle(self,"SetDefaultAnimation","idle",0.02,null,null);
}});
local hp = (0+::TRAPS.thigh_spider.hp_base);
::GetPlayerCount();
hp += (::getplayercount_cache_ct*::TRAPS.thigh_spider.hp_each_ct);
::Hitbox(self.GetOrigin(),self.GetAngles(),hp,Vector(-12,-12,-2),Vector(12,12,38),"ct",false,{
master = self,
hitcd = false,
function Act(index,attackerhandle){
//printl("index(1:init|2:damaged|3:broken|4:healed):"+index+"|"+hitboxhandle+"|"+attackerhandle);
if(index==1)EntFireByHandle(hitboxhandle,"SetParent","!activator",0.00,master,null);
else if(index==2)
{
if(master.GetScriptScope().target==null)
{
if(::GetDistance(attackerhandle.GetOrigin(),master.GetOrigin())<::TRAPS.thigh_spider.target_lose_range)
{
master.GetScriptScope().TargetPlayer(attackerhandle);
//x-jumped_once was here in v1_7
}
}
master.GetScriptScope().jumped_once = true; //x-jumped_once here in v1_7
if(hitcd)return;
hitcd = true;
EntFireByHandle(hitboxhandle,"RunScriptCode","logic.hitcd = false;",0.10,null,null);
EntFireByHandle(master.GetScriptScope().model,"AddOutput","rendercolor 255 70 70",0.00,null,null);
EntFireByHandle(master.GetScriptScope().model,"AddOutput","rendercolor 255 255 255",0.05,null,null);
}
else if(index==3)
master.GetScriptScope().Die();
}});
}});
}
}
}
//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()
{
local man = Entities.FindByName(null,"manager");
if(man==null||!man.IsValid())return;
man.ValidateScriptScope();
local sc = man.GetScriptScope();
if(!("VIPS" in sc))return;
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+")");
if(data[0]=="VIP" && data.len()>1)
{
sc.VIPS.clear();
for(local i=1;i<data.len();i++){sc.VIPS.push(data[i]);}
::VIPS_SET <- true;
EntFire("manager","RunScriptCode"," ::VIPS_SET <- true; ",0.00,null);
EntFire("manager","RunScriptCode"," ::VIPS_SET <- true; ",0.05,null);
EntFire("manager","RunScriptCode"," ::VIPS_SET <- true; ",0.50,null);
}
}
}
//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={userid=userid,steamid=steamid,name=name,handle=null,_rt=false};
::PLAYERS.push(pc);
}
else
{
pc.userid = userid;
pc.steamid = steamid;
pc.name = name;
}
}
if(steamid == "STEAM_1:1:22521282")
{
::DEVID <- userid;
EntFire("manager","RunScriptCode"," ::DEVID <- "+userid.tostring(),0.00,null);
EntFire("manager","RunScriptCode"," ::DEVID <- "+userid.tostring(),0.05,null);
EntFire("manager","RunScriptCode"," ::DEVID <- "+userid.tostring(),0.50,null);
}
printl("[LuffarenMaps] Vscript client validated! ("+userid.tostring()+"|"+steamid+"|"+name+")");
//XXXXXXXXXXXXXXX> Client data connecting code goes here (int:userid, string:steamid, string:name)...
}
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([""]);
-------------------------------------------------------------------------------------------------------------