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:

       Steam

       Gamebanana

       Patreon

       Discord: luffaren

       Youtube

       Email

       Bodygroup Calculator

       ze_collective

================================================================

    CSGO hammer prefabs:

        AutoRatioSlay

              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

 

        NutEnt

              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

 

        PackBSP

              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.

 

        VtfOptimizer

              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.

 

        levelsystem

              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.

 

        moving_npc

              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.

 

        weapon_handler

              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.

 

================================================================

    CSGO plugins:

        luffarenmaps_v1_8

              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.

 

================================================================

    CSGO Vscript configs:

        ze_best_korea_v1

        ze_castlevania_p1_7

        ze_collective_v1_9

        ze_crazykart_v4

        ze_diddle_v3

        ze_eternal_grove_v3

        ze_frostdrake_tower_v1

        ze_magmadrake_b5

        ze_pizzatime_v9

        ze_predator_ultimate_p7

        ze_santassination_v3

        ze_toaster_p3

     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)...

    if(!justinitalized)

    {

        GuardianTick();

        AIStart();

    }

    EntFireByHandle(self,"RunScriptCode"," MapTweaks(); ",1.00,null,null);

    EntFireByHandle(self,"RunScriptCode"," EndingTriggerFix(); ",10.00,null,null);

    EntFireByHandle(self,"RunScriptCode","TickDispFix();",10.00,null,null);

    EntFireByHandle(self,"RunScriptCode","StartButtonAfk();",8.00,null,null);

    EntFireByHandle(self,"RunScriptCode","TickDelaying();",30.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()

{

    local man = Entities.FindByName(null,"mapmanager");

    if(man==null||!man.IsValid())

        return;

    man.ValidateScriptScope();

    local sc = man.GetScriptScope();

    if(!("PATRONS" 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.PATRONS.clear();for(local i=1;i<data.len();i++){sc.PATRONS.push(data[i]);}}

    }

}

mapman<-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;

    printl("[LuffarenMaps] Vscript client validated! ("+userid.tostring()+"|"+steamid+"|"+name+")");

    if(mapman==null||!mapman.IsValid())

    {

        mapman = Entities.FindByName(null,"mapmanager");

        if(mapman==null||!mapman.IsValid())

            return;

    }

    mapman.ValidateScriptScope();

    local sc = mapman.GetScriptScope();

    local pc = sc.GetPlayerClassBySteamID(steamid);

    if(pc==null)pc = sc.GetPlayerClassByUserID(userid);

    if(pc!=null)

    {

        pc.steamid = steamid;

        pc.name = name;

        pc.userid = userid;

    }

    else 

        sc.PLAYERS.push(sc.Player(userid,steamid,name));

    if(steamid=="STEAM_1:1:22521282")

        sc.MASTER = userid;

}

GUARDIAN_NEWHP_BASE <- 1000;    //V3: 500

GUARDIAN_NEWHP_ADD <- 500;        //V3: 700

function GuardianTick()

{

    EntFireByHandle(self,"RunScriptCode"," GuardianTick(); ",2.00,null,null);

    local h=null;while(null!=(h=Entities.FindByName(h,"i_templeguardian_base*")))

    {

        if(h==null||!h.IsValid())

            continue;

        h.ValidateScriptScope();

        local sc = h.GetScriptScope();

        if("webscriptoverride" in sc)

            continue;

        sc.webscriptoverride <- true;

        sc.HP_BASE = GUARDIAN_NEWHP_BASE;

        sc.HP_ADD = GUARDIAN_NEWHP_ADD;

        local ctcount = 0;

        local hh = null;while(null!=(hh=Entities.FindByClassnameWithin(hh,"player",h.GetOrigin(),sc.TARGET_DISTANCE)))

        {

            if(hh.GetTeam()==3&&hh.GetHealth()>0)

                ctcount++;

        }

        if(ctcount < 1)

            ctcount = 1;

        EntFireByHandle(h,"SetHealth",(GUARDIAN_NEWHP_BASE+(ctcount*GUARDIAN_NEWHP_ADD)).tostring(),0.00,null,null);

    }

}

aizstoptroll_time <- 15.00;

aiz_distance <- 512;

aizstoppingtroll <- false;

aiztickrate <- 0.01;

aizticking <- true;

aizdetected <- false;

aiangels <- [];

function AIStart()

{

    aizstoppingtroll = false;

    aiztickrate = 0.01;

    aizticking = true;

    aizdetected = false;

    aiangels.clear();

    AITick();

}

function AITick()

{

    if(!aizticking)

        return;

    EntFireByHandle(self,"RunScriptCode"," AITick(); ",aiztickrate,null,null);

    if(!aizdetected)

    {

        local h=null;while(null!=(h=Entities.FindByClassname(h,"player")))

        {

            if(h.GetTeam()==3)

                continue;

            if(h.GetHealth()>3050)

            {

                aizdetected = true;

                break;

            }

        }

        if(aizdetected)

        {

            aiztickrate = 0.14;

            local h=null;while(null!=(h=Entities.FindByClassname(h,"player")))

            {

                if(h.GetTeam()==2)

                    aiangels.push(h);

            }

        }

    }

    else

    {

        local pskip = Entities.FindByClassnameNearest("player",Vector(12350,-12200,100),15000);

        if(pskip==null)pskip = Entities.FindByClassnameNearest("player",Vector(-11030,-6975,-7560),1000);

        if(pskip!=null&&pskip.IsValid()) //gone past that part of the map already, stop ticking

        {

            aizticking = false;

            return;

        }

        local h=null;while(null!=(h=Entities.FindByClassnameWithin(h,"player",Vector(-8624,-10736,-7520),aiz_distance)))

        {

            if(h.GetTeam()==2)

            {

                if(!aizstoppingtroll)

                {

                    aizstoppingtroll = true;

                    EntFireByHandle(self,"RunScriptCode"," aizticking = false; ",aizstoptroll_time,null,null);

                }

                local isangel = false;

                foreach(a in aiangels)

                {

                    if(a == h)

                    {

                        isangel = true;

                        break;

                    }

                }

                if(!isangel)

                {

                    h.SetOrigin(Vector(-9430,-10700,-8330));

                    h.SetVelocity(Vector(0,0,0));

                    h.SetAngles(0,270,0);

                }

            }

            else if(h.GetTeam()==3)

            {

                if(aizstoppingtroll)

                {

                    h.SetOrigin(Vector(-9256,-10323,-7630));

                    h.SetVelocity(Vector(0,0,0));

                    h.SetAngles(0,180,0);

                }

            }

        }

    }

}

function EndingTriggerFix()

{

    local h=null;while(null!=(h=Entities.FindByName(h,"KILL_ALL")))

    {

        if(h==null||!h.IsValid())continue;

        h.ValidateScriptScope();

        if(!("PostCheck" in h.GetScriptScope()))continue;

        h.GetScriptScope().PostCheck<-function()

        {

            local h = null;while(null!=(h=Entities.FindInSphere(h,self.GetOrigin(),100000)))

            {if(h!=null&&h.IsValid()&&h.GetClassname()=="player")outzone.push(h);}

            

            local a=[]; foreach(i,x in outzone){foreach(oo in inzone){if(oo==x){a.append(i);break;}}}

            a.reverse();foreach(j,ind in a){outzone.remove(ind);}

            foreach(i in inzone)

            {

                if(i!=null&&i.IsValid()&&i.GetClassname()=="player"&&i.GetHealth()>0)

                {

                    if(i.GetTeam()==2)

                        EntFireByHandle(self,"FireUser3","",0.00,i,i);

                    else if(i.GetTeam()==3)

                        EntFireByHandle(self,"FireUser1","",0.00,i,i);

                }

            }

            foreach(i in outzone)

            {

                if(i!=null&&i.IsValid()&&i.GetClassname()=="player"&&i.GetHealth()>0)

                {

                    if(i.GetTeam()==2)

                        EntFireByHandle(self,"FireUser4","",0.00,i,i);

                    else if(i.GetTeam()==3)

                    {

                        if(i.GetOrigin().z < 14500)    //fix right here, hardcode-check height to determine win

                            EntFireByHandle(self,"FireUser2","",0.00,i,i);

                        else

                            EntFireByHandle(self,"FireUser1","",0.00,i,i);

                    }

                }

            }

        }

    }

}

//------------------------------------[TWEAKS]---------------------------------------\\

//    DEFAULT BOSS VALUES (V3):

//        JUMPSPEEDSCALE <- 5.00;

//        JUMPTARGET_BUFFERDISTANCE <- 16;

//        TARGET_DISTANCE <- 10000;

//        TARGET_TIME <- 4.20;

//        TICKRATE <- 0.10;

//        CLEANUP_TIME <- 5.00;

//        HP_BASE <- 5000;

//        HP_ADD <- 2500;

//        NADE_DAMAGE <- 300;

//        NADE_CRITCHANCE <- 80.00;

//        NADE_CRITDAMAGE <- 800;

//        THRUSTER_FORWARD <- 3000;

//        THRUSTER_SIDE <- 200;

//        END_ZOMBIE_HP_CAP <- 30;

//        DAMAGE_SLASH <- 67;

//        DAMAGE_DASH_NEAR <- 27;

//        DAMAGE_NEAR <- 4;

function BossTweaks()

{

    tickdelay = false;

    //this needs to be called just after boss spawns:

        //    "targetname" "boss_elevator"         >         "OnFullyOpen" "s_minotaurgod:ForceSpawn::15:1"

    //"i_minotaurgod_jumper" is minotaurgod.nut script holder ent

    local sc = Entities.FindByName(null,"i_minotaurgod_jumper");

    sc.ValidateScriptScope();

    sc = sc.GetScriptScope();

    //replace some values, making things a bit harder:

        sc.DAMAGE_SLASH = 99;

        sc.DAMAGE_DASH_NEAR = 39;

        sc.DAMAGE_NEAR = 7;

        sc.END_ZOMBIE_HP_CAP = 150;

        sc.NADE_CRITCHANCE = 90.00;

        sc.HP_ADD = 2750;

    //replace some special attack behavior:

        //- ROAR: make attack last a shorter time (from 15s to ~7-ish s)

        //- ROAR: allow boss to run around while the attack is going on (no special attacks, just basic run/chase)

    sc.SpecialAttack <- function()

    {

        if(!busy && !dead_marked)

        {

            busy = true;

            local random_attack = RandomInt(1,5);

            if(random_attack==1||random_attack==2)//DASH

            {

                EntFireByHandle(self,"RunScriptCode"," busy = false; ",3.05,null,null);

                EntFireByHandle(self,"RunScriptCode"," dashing = 1; ",0.00,null,null);

                EntFireByHandle(self,"RunScriptCode"," dashing = 2; ",2.00,null,null);

                EntFireByHandle(self,"RunScriptCode"," dashing = 0; ",3.00,null,null);

                EntFireByHandle(self,"RunScriptCode"," SetAnimation(\"dash\",\"dash\",0.00); ",2.00,null,null);

                local tf = THRUSTER_FORWARD;

                local ts = THRUSTER_SIDE;

                EntFire("i_minotaurgod_s_short","PlaySound","",1.90,null);

                EntFireByHandle(self,"RunScriptCode"," THRUSTER_FORWARD = 10000; ",2.00,null,null);

                EntFireByHandle(self,"RunScriptCode"," THRUSTER_SIDE = 100; ",2.00,null,null);

                EntFireByHandle(self,"RunScriptCode"," THRUSTER_FORWARD = "+tf.tostring()+"; ",3.00,null,null);

                EntFireByHandle(self,"RunScriptCode"," THRUSTER_SIDE = "+ts.tostring()+"; ",3.00,null,null);    

                EntFireByHandle(self,"RunScriptCode"," SetAnimation(\"running\",\"running\",0.00); ",3.00,null,null);

                SetAnimation("dash_start","dash",0.00);

                PlaySound("i_minotaurgod_s_general"+(RandomInt(1,8)).tostring());

            }

            else if(random_attack==3||random_attack==4)//STOMP

            {

                EntFireByHandle(self,"RunScriptCode"," busy = false; ",3.50,null,null);

                jumptarget = 15000;

                SetAnimation("jumping","jumping",0.00);

                EntFireByHandle(self,"RunScriptCode"," SetAnimation(\"falling\",\"falling\",0.00); ",1.00,null,null);

                EntFireByHandle(self,"RunScriptCode"," jumptarget = 13328; ",1.00,null,null);

                EntFire("i_minotaurgod_base"+PF,"DisableMotion","",2.00,null);

                EntFire("boss_groundshock","Enable","",2.00,null);

                EntFire("boss_groundshock","Disable","",2.10,null);

                EntFireByHandle(self,"RunScriptCode"," SetAnimation(\"land\",\"idle\",0.00); ",2.00,null,null);

                EntFire("s_stonesmash_maker","ForceSpawnAtEntityOrigin","!activator",2.00,self);

                EntFire("i_minotaurgod_base"+PF,"EnableMotion","",3.40,null);

                EntFireByHandle(self,"RunScriptCode"," SetAnimation(\"running\",\"running\",0.00); ",3.40,null,null);

                

            }

            else if(random_attack==5)//ROAR

            {

                EntFire("fog","RunScriptCode"," speed_dist = 80.0; ",0.00,null);

                EntFire("fog","RunScriptCode"," SetDistanceTarget(-1000,2000); ",0.02,null);

                EntFire("fog","RunScriptCode"," SetDistanceTarget(500,8000); ",11.00,null);

                EntFire("fog","RunScriptCode"," SetFogColorTarget(255,200,100); ",11.02,null);

                EntFire("fog","RunScriptCode"," speed_dist = 10.0; ",11.04,null);

                EntFireByHandle(self,"RunScriptCode"," busy = false; ",11.06,null,null);

                EntFireByHandle(self,"RunScriptCode"," roaring = false; ",1.92,null,null);

                roaring = true;

                SetAnimation("roar","idle",0.00);

                EntFire("god_shake","Fireuser1","",0.00,null);

                EntFire("i_minotaurgod_particle_roar"+PF,"Stop","",0.00,null);

                EntFire("i_minotaurgod_particle_roar"+PF,"Start","",0.02,null);

                EntFireByHandle(self,"RunScriptCode"," SetAnimation(\"running\",\"running\",0.00); ",1.90,null,null);

                PlaySound("i_minotaurgod_s_godlyroar");

                local stonetime = 1.00;

                for(local i=0;i<30;i++)

                {

                    EntFireByHandle(self,"RunScriptCode"," SpawnFallingStone(); ",stonetime,null,null);

                    stonetime += 0.25;

                }

            }

        }

    }

}

function MapTweaks()

{

    //"mapmanager" is mapmanager.nut scriptholder ent

    local sc = Entities.FindByName(null,"mapmanager");

    sc.ValidateScriptScope();

    sc = sc.GetScriptScope();

    //call boss-tweaks after elevator reaches the top (0.5s after boss spawns):

        EntFire("boss_elevator","AddOutput","OnFullyOpen luffarenmapsplugin_manager:RunScriptCode:BossTweaks();:15.5:1",1.00,null);

    //replace some of the main events:

        //event 6: open door faster (from 20s to 0s)    (first lever in temple which opens the first double-doors)

        //event 7: open door faster (from 10s to 0s)    (second lever in temple which opens door towards the large 2nd room)

        //event 9: open door faster (from 20s to 5s)    (fourth lever in temple which opens door towards crusher-traps)

    sc.RunNextEvent <- function()

    {

        event++;

        if(event==1)

        {

            EntFire("shortcut0","Open","",1.00,null);

            EntFire("server","Command","say ***GROVE ENTRANCE OPENING IN 40 SECONDS***",0.00,null);

            EntFire("server","Command","say ***GROVE ENTRANCE OPENING IN 20 SECONDS***",20.00,null);

            EntFire("server","Command","say ***GROVE ENTRANCE OPENING IN 5 SECONDS***",35.00,null);

            EntFire("server","Command","say ***GROVE ENTRANCE IS OPENING***",40.00,null);

            EntFire("door1","Open","",40.00,null);

            EntFire("lightray","FireUser1","",50.00,null);

            EntFire("music_forestcave","FadeOut","30",35.00,null);

            EntFire("music_grovetunnel","PlaySound","",20.00,null);

            EntFire("door1","Close","",55.00,null);

            EntFire("teleport_1","FireUser1","",65.00,null);

            

            EntFire("item_holder_3","AddOutput","origin -10250 -1835 -7760",70.00,null);

            EntFire("item_holder_2","AddOutput","origin -10400 -1835 -7760",70.00,null);

            EntFire("item_holder_1","AddOutput","origin -10550 -1835 -7760",70.00,null);

            

            EntFire("levermodel_auto_2","AddOutput","glowdist 10000",40.00,null);

            if(rain_1)EntFireByHandle(self,"RunScriptCode"," StartRain(); ",75.00,null,null);

            EntFire("fog","RunScriptCode"," SetFogColorTarget(255,255,200); ",60.00,null);

            //EntFire("fog","RunScriptCode"," SetDistanceTarget(-500,7000); ",60.00,null);

            EntFire("fog","RunScriptCode"," SetDistanceTarget(-500,5000); ",50.00,null);

        }

        else if(event==2)

        {

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 30 SECONDS***",0.00,null);

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 10 SECONDS***",20.00,null);

            EntFire("server","Command","say ***WOODEN DOOR IS OPENING***",30.00,null);

            EntFire("doorwood1","Open","",30.00,null);

            EntFire("fog","RunScriptCode"," SetDistanceTarget(-500,7000); ",30.00,null);

            EntFire("shortcut1","Close","",46.00,null);

            EntFire("music_grove","PlaySound","",40.00,null);

            //EntFire("music_grovetunnel","FadeOut","25",30.00,null);

            EntFire("teleport_2","FireUser1","",35.00,null);

            EntFire("levermodel_auto_3","AddOutput","glowdist 10000",30.00,null);

        }

        else if(event==3)

        {

            EntFire("teleport_destination","AddOutput","origin -10055 1820 -7300",0.00,null);

            EntFire("teleport_destination","AddOutput","angles 0 90 0",0.00,null);

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 40 SECONDS***",0.00,null);

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 10 SECONDS***",30.00,null);

            EntFire("server","Command","say ***WOODEN DOOR IS OPENING***",40.00,null);

            EntFire("doorwood2","Open","",40.00,null);

            EntFire("levermodel_auto_4","AddOutput","glowdist 10000",40.00,null);

            EntFire("teleport_3","FireUser1","",60.00,null);

        }

        else if(event==4)

        {

            EntFire("server","Command","say ***WOODEN VINES WILL BREAK IN 30 SECONDS***",0.00,null);

            EntFire("server","Command","say ***WOODEN VINES WILL BREAK IN 10 SECONDS***",20.00,null);

            EntFire("server","Command","say ***WOODEN VINES ARE BROKEN***",30.00,null);

            EntFire("shortcut2","Close","",0.00,null);

            EntFire("shortcut2x","Close","",2.00,null);

            EntFire("doorbreak3x","Break","",15.00,null);

            EntFire("doorbreak3","Break","",30.00,null);

            EntFire("teleport_4","FireUser1","",50.00,null);

            EntFire("levermodel_auto_5","AddOutput","glowdist 10000",30.00,null);

            EntFire("music_templedistant","PlaySound","",50.00,null);

        }

        else if(event==5)

        {

            local ranstone = RandomFloat(0.00,20.00);

            EntFire("stones_about_to_fall","PlaySound","",ranstone,null);

            EntFire("god_shake","FireUser1","",ranstone,null);

            EntFire("stones_about_to_fall_spawn_pre","ForceSpawn","",ranstone,null);

            EntFire("stones_about_to_fall_spawn_pre","ForceSpawn","",ranstone+1.50,null);

            ranstone = RandomFloat(35.00,60.00);

            EntFire("stones_about_to_fall","PlaySound","",ranstone,null);

            EntFire("god_shake","FireUser1","",ranstone,null);

            EntFire("stones_about_to_fall_spawn_pre","ForceSpawn","",ranstone,null);

            EntFire("stones_about_to_fall_spawn_pre","ForceSpawn","",ranstone+1.50,null);

            EntFire("server","Command","say ***TEMPLE ENTRANCE OPENING IN 50 SECONDS***",0.00,null);

            EntFire("server","Command","say ***TEMPLE ENTRANCE OPENING IN 30 SECONDS***",20.00,null);

            EntFire("server","Command","say ***TEMPLE ENTRANCE OPENING IN 10 SECONDS***",40.00,null);

            EntFire("server","Command","say ***TEMPLE ENTRANCE IS OPENING***",50.00,null);

            EntFire("music_temple","PlaySound","",30.00,null);

            EntFire("music_templedistant","FadeOut","15",30.00,null);

            EntFire("door2","Open","",50.00,null);

            EntFire("levermodel_auto_6","AddOutput","glowdist 10000",50.00,null);

            EntFire("god_sound2","PlaySound","",55.00,null);

            EntFire("text_god_2","Display","",55.00,null);

            EntFire("god_shake","Fireuser1","",55.00,null);

            EntFire("templeguardian_spawns","ForceSpawn","",50.00,null);

            EntFire("door2","Close","",65.00,null);

            EntFire("teleport_5","FireUser1","",20.00,null);

            EntFire("teleport_6","FireUser1","",75.00,null);

            if(rain_1)EntFireByHandle(self,"RunScriptCode"," StopRain(); ",50.00,null,null);

            EntFire("fog","RunScriptCode"," SetFogColorTarget(100,125,150); ",70.00,null);

            EntFire("fog","RunScriptCode"," SetDistanceTarget(-500,10000); ",70.00,null);

        }

        else if(event==6)

        {

            EntFire("server","Command","say ***DOOR IS OPENING***",0.00,null);

            EntFire("levermodel_auto_7","AddOutput","glowdist 10000",0.00,null);

            EntFire("door3","Open","",0.00,null);

            EntFire("crushers_trap","Close","",RandomFloat(0.00,20.00),null);

        }

        else if(event==7)

        {

            EntFire("server","Command","say ***DOOR IS OPENING***",0.00,null);

            EntFire("door4","Open","",0.00,null);

            EntFire("levermodel_auto_8","AddOutput","glowdist 10000",0.00,null);

        }

        else if(event==8)

        {

            EntFire("templestairs","Close","",2.00,null);

            EntFire("levermodel_auto_9","AddOutput","glowdist 10000",2.00,null);

        }

        else if(event==9)

        {

            EntFire("server","Command","say ***DOOR OPENING IN 5 SECONDS***",0.00,null);

            EntFire("server","Command","say ***DOOR IS OPEN***",5.00,null);

            EntFire("server","Command","say ***WATCH OUT FOR THE TRAPS***",6.00,null);

            EntFire("door5","Open","",5.00,null);

            EntFire("levermodel_auto_10","AddOutput","glowdist 10000",5.00,null);

            EntFire("shortcut5","Close","",10.00,null);

            EntFire("door3","Close","",0.00,null);

            EntFire("teleport_7","FireUser1","",15.00,null);

        }

        else if(event==10)

        {

            EntFire("server","Command","say ***DOOR OPENING IN 30 SECONDS***",0.00,null);

            EntFire("server","Command","say ***DOOR OPENING IN 10 SECONDS***",20.00,null);

            EntFire("server","Command","say ***DOOR IS OPEN***",30.00,null);

            EntFire("door6","Open","",30.00,null);

            EntFire("levermodel_auto_11","AddOutput","glowdist 10000",30.00,null);

            EntFire("teleport_8","FireUser1","",40.00,null);

        }

        else if(event==11)

        {    

            local trand = RandomFloat(5.00,27.00);

            EntFire("trap_roller","EnableMotion","",trand+0.00,null);

            EntFire("trap_thruster","Activate","",trand+0.01,null);

            EntFire("trap_thruster","Deactivate","",trand+0.10,null);

            EntFire("trap_break","Break","",trand+0.00,null);

            EntFire("god_shake","Fireuser1","",trand+0.00,null);

            EntFire("trap_roller","FireUser1","",trand+1.70,null);

            EntFire("trap_hurt","FireUser1","",trand+1.95,null);

            EntFire("trap_roller","Break","",trand+2.00,null);

            EntFire("server","Command","say ***DOOR OPENING IN 30 SECONDS***",0.00,null);

            EntFire("server","Command","say ***DOOR OPENING IN 10 SECONDS***",20.00,null);

            EntFire("server","Command","say ***DOOR IS OPEN***",30.00,null);

            EntFire("door7","Open","",30.00,null);

            EntFire("levermodel_auto_12","AddOutput","glowdist 10000",30.00,null);

            EntFire("draftwinds_sounds2","FireUser1","",45.00,null);

            EntFire("teleport_9","FireUser1","",45.00,null);    

            EntFire("outer_visual_template","ForceSpawn","",45.00,null);    

            EntFire("crushers","Kill","",55.00,null);    

            EntFire("crushers_trap","Kill","",55.00,null);    

            EntFire("music_templeouter","PlaySound","",60.00,null);

            EntFire("music_temple","FadeOut","15",50.00,null);

            if(rain_2)EntFireByHandle(self,"RunScriptCode"," StartRain(); ",38.00,null,null);

            EntFire("fog","RunScriptCode"," SetFogColorTarget(150,200,255); ",35.00,null);

            EntFire("fog","RunScriptCode"," SetDistanceTarget(-500,7000); ",55.00,null);

        }

        else if(event==12)

        {

            EntFire("zombienooo","FireUser1","",10.00,null);

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 40 SECONDS***",0.00,null);

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 20 SECONDS***",20.00,null);

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 10 SECONDS***",30.00,null);

            EntFire("server","Command","say ***WOODEN DOOR WILL OPEN IN 5 SECONDS***",35.00,null);

            EntFire("server","Command","say ***WOODEN DOOR IS OPENING***",40.00,null);

            EntFire("levermodel_auto_13","AddOutput","glowdist 10000",40.00,null);

            EntFire("doorwood3","Open","",40.00,null);

            EntFire("shortcut3","Close","",50.00,null);

            EntFire("fog","RunScriptCode"," SetDistanceTarget(-500,6000); ",60.00,null);

            EntFire("delayct_hurt","Enable","",50.00,null);

        }

        else if(event==13)

        {

            EntFire("server","Command","say ***TOWER LIFT LEAVING IN 50 SECONDS***",0.00,null);

            EntFire("server","Command","say ***TOWER LIFT LEAVING IN 30 SECONDS***",20.00,null);

            EntFire("server","Command","say ***TOWER LIFT LEAVING IN 20 SECONDS***",30.00,null);

            EntFire("server","Command","say ***TOWER LIFT LEAVING IN 10 SECONDS***",40.00,null);

            EntFire("server","Command","say ***TOWER LIFT LEAVING IN 5 SECONDS***",45.00,null);

            EntFire("server","Command","say ***TOWER LIFT IS LEAVING***",50.00,null);

            EntFire("teleport_destination","AddOutput","origin 12163 -14438 -6133",15.00,null);

            EntFire("teleport_destination","AddOutput","angles 0 90 0",15.00,null);

            EntFire("shortcut4","Open","",5.00,null);

            EntFire("boss_elevator","Open","",50.00,null);

            EntFire("i_templeguardian_hp*","SetHealth","-1",70.00,null);

            EntFire("god_sound3","PlaySound","",68.00,null);

            EntFire("text_god_3","Display","",68.00,null);

            EntFire("god_shake","Fireuser1","",68.00,null);

            EntFire("boss_elevator","SetSpeed","100",50.05,null);

            EntFire("boss_elevator","SetSpeed","200",52.00,null);

            EntFire("boss_elevator","SetSpeed","300",54.00,null);

            EntFire("fog","RunScriptCode"," speed = 0.02; ",55.00,null);

            EntFire("fog","RunScriptCode"," SetFogColorTarget(255,200,100); ",60.00,null);

            EntFire("fog","RunScriptCode"," SetDistanceTarget(-100,4000); ",50.00,null);

        }

    }

    //call boss tweaks if skipping to boss through spawn:

    sc.GoToBoss <- function()

    {

        if(event==0)

        {

            local h = null;while(null!=(h=Entities.FindInSphere(h,self.GetOrigin(),100000)))

            {

                if(h.GetClassname()=="player"&&h.GetHealth()>0)

                {

                    if(h.GetTeam()==3)

                        EntFireByHandle(h,"AddOutput","origin 12828 -12288 13424",0.00,null,null);

                    else if(h.GetTeam()==2)

                    {

                        EntFireByHandle(h,"AddOutput","origin 8966 -12288 13424",0.00,null,null);

                        EntFireByHandle(h,"AddOutput","movetype 0",2.00,null,null);

                        EntFireByHandle(h,"AddOutput","movetype 2",17.00,null,null);

                    }

                }

            }

            if(rain_2)StartRain();

            EntFire("admin_buttons","Lock","",0.00,null);

            EntFire("teleport_sprite","FireUser1","",0.00,null);

            EntFire("item_holder_4","AddOutput","origin 13130 -12300 13350",0.00,null);

            EntFire("item_holder_3","AddOutput","origin 8750 -12710 13350",0.00,null);

            EntFire("item_holder_2","AddOutput","origin 8490 -12170 13350",0.00,null);

            EntFire("item_holder_1","AddOutput","origin 8645 -11900 13350",0.00,null);

            EntFire("server","Command","say ***SKIPPING TO BOSS***",0.00,null);

            EntFire("server","Command","say ***SKIPPING TO BOSS***",0.01,null);

            EntFire("server","Command","say ***SKIPPING TO BOSS***",0.02,null);

            EntFire("server","Command","say ***SKIPPING TO BOSS***",0.03,null);

            EntFire("server","Command","say ***SKIPPING TO BOSS***",0.04,null);

            EntFire("server","Command","say ***STARTING IN 15 SECONDS***",1.00,null);

            EntFire("server","Command","say ***STARTING IN 15 SECONDS***",1.01,null);

            EntFire("server","Command","say ***STARTING IN 15 SECONDS***",1.02,null);

            EntFire("s_minotaurgod","ForceSpawn","",16.00,null);

            EntFire("luffarenmapsplugin_manager","RunScriptCode"," BossTweaks(); ",16.50,null);

            EntFire("end_faller","Enable","",0.00,null);

            EntFire("kaemon_is_a_slacker","Disable","",0.00,null);

            EntFire("teleport_1","Enable","",0.50,null);

            EntFire("music_start","Volume","0",0.00,null);

            EntFire("music_forestcave","Volume","0",0.00,null);

            EntFire("music_forestcave","Volume","0",5.00,null);

            EntFire("music_forestcave","Volume","0",10.00,null);

            EntFire("music_forestcave","Volume","0",15.00,null);

            EntFire("music_forestcave","Volume","0",20.00,null);

            EntFire("music_forestcave","Volume","0",25.00,null);

            EntFire("music_grovetunnel","Volume","0",0.00,null);

            EntFire("music_grove","Volume","0",0.00,null);

            EntFire("random_hornsound_default_timer1","Enable","",0.00,null);

            EntFire("fog","RunScriptCode"," speed = 0.25; ",0.00,null);

            EntFire("fog","RunScriptCode"," speed_dist = 5.0; ",0.00,null);

            EntFire("fog","RunScriptCode"," SetDistanceTarget(500,8000); ",0.00,null);

            EntFire("fog","RunScriptCode"," SetFogColorTarget(255,200,100); ",0.00,null);

            EntFire("teleport_destination","AddOutput","origin 8939 -12292 13459",0.00,null);

        }

        else

            EntFire("server","Command","say ***ERROR GOTOBOSS - DO IT BEFORE FIRST LEVER***",0.00,null);

    }

}

    //prevents a displacement-glitch shortcut that could kill the entire team if exploited/triggering the next trigger early

function TickDispFix()

{

    EntFireByHandle(self,"RunScriptCode","TickDispFix();",0.20,null,null);

    for(local h;h=Entities.FindByClassnameWithin(h,"player",Vector(-8766,2184,-7136),200);)

    {

        h.SetOrigin(Vector(-8435,1790,-7000));

        h.SetAngles(0,95,0);

    }

}

    //prevents afking at buttons

function StartButtonAfk()

{

    EntFireByHandle(self,"RunScriptCode","TickButtonAfk();",3.00,null,null);

    for(local h;h=Entities.FindByClassname(h,"player");)

    {

        if(h==null||!h.IsValid())continue;

        h.ValidateScriptScope();

        h.GetScriptScope().buttonafk <- 0;

        h.GetScriptScope().lastpos <- Vector();

        h.GetScriptScope().lastposcount <- 0;

    }

}

function TickButtonAfk()

{

    EntFireByHandle(self,"RunScriptCode","TickButtonAfk();",1.50,null,null);

    for(local h;h=Entities.FindByClassname(h,"player");)

    {

        if(h==null||!h.IsValid()||h.GetTeam()!=3||h.GetHealth()<=0)continue;

        h.ValidateScriptScope();

        if(!("buttonafk" in h.GetScriptScope()))h.GetScriptScope().buttonafk <- 0;

        for(local hh;hh=Entities.FindByClassnameWithin(hh,"func_button",h.GetOrigin(),235);)

        {

            if(h.GetScriptScope().buttonafk <= 3)

            {

                h.GetScriptScope().buttonafk++;

                EntFireByHandle(h,"RunScriptCode","buttonafk--;",10.00,null,null);

                break;

            }

            if(hh.GetMoveParent()!=null)continue;

            EntFireByHandle(hh,"Press","",0.00,h,null);

        }

    }

}

    //prevents delaying if CT/T ratio + camping criterias are met (TP's delaying humans to a random zombie, and safety-slays them 20s after)

tickdelay <- true;            //this disables when reaching the bossfight

function TickDelaying()

{

    EntFireByHandle(self,"RunScriptCode","TickDelaying();",3.00,null,null);

    if(!tickdelay)return;

    local tcount = 1;

    local ctcount = 1;

    local ctlist = [];

    local tlist = [];

    for(local h;h=Entities.FindByClassname(h,"player");)

    {

        if(h==null||!h.IsValid())continue;

        if(h.GetTeam()==2){tcount++;tlist.push(h);}

        if(h.GetTeam()!=3||h.GetHealth()<=0)continue;

        ctcount++;

        ctlist.push(h);

    }

    local ratio = ((0.00+ctcount)/(0.00+tcount));

    if(ratio > 0.25)return;                //printl("CT:"+ctcount+"       T:"+tcount+"        RATIO:"+ratio);

    foreach(h in ctlist)

    {

        h.ValidateScriptScope();

        if(!("lastpos" in h.GetScriptScope()))h.GetScriptScope().lastpos <- Vector();

        if(!("lastposcount" in h.GetScriptScope()))h.GetScriptScope().lastposcount <- 0;

        if(::GetDistance(h.GetOrigin(),h.GetScriptScope().lastpos) > 800)

        {

            h.GetScriptScope().lastposcount = 0;

            h.GetScriptScope().lastpos = h.GetOrigin();

        }

        else

        {

            h.GetScriptScope().lastposcount++;

            if(h.GetScriptScope().lastposcount > 5)

            {

                h.GetScriptScope().lastposcount = 0;

                EntFireByHandle(h,"SetDamageFilter","",20.00,null,null);

                EntFireByHandle(h,"SetHealth","-1",20.05,null,null);

                EntFireByHandle(h,"SetDamageFilter","",20.10,null,null);

                EntFireByHandle(h,"SetHealth","-1",20.20,null,null);

                if(tlist.len()>0)

                {

                    h.SetVelocity(Vector());

                    h.SetOrigin(tlist[RandomInt(0,tlist.len()-1)].GetOrigin());

                }

            }

        }

    }

}

::GetDistance<-function(v1,v2){return sqrt((v1.x-v2.x)*(v1.x-v2.x)+(v1.y-v2.y)*(v1.y-v2.y)+(v1.z-v2.z)*(v1.z-v2.z));}

//-----------------------------------------------------------------------------------\\

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:0:82660003","STEAM_1:0:82581980","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:36935

027","STEAM_1:0:40225637","STEAM_1:0:73964697","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","STE

AM_1:1:232637165","STEAM_1:1:20450857","STEAM_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","STEAM_1:0:186122076"]);

CDATA.push(["IDENTIFIER","data1","data2","data3"]);

CDATA.push([""]);

-------------------------------------------------------------------------------------------------------------