• Evocity Cleanup + Elevator fix (One Lua Script)
    13 replies, posted
(This seems to be the right place to post this) I made this script a while ago, and thought I might as well release it, it's MAINLY for RP since it cleans up props etc, but the elevator plugin I wrote might be useful elsewhere. [img]http://cloud.steampowered.com/ugc/632989400354811631/FD51E35E327787EBF8227D6D59976ECC12923D4C/[/img] As you can see, it adds a button for each floor, the elevator will now go directly from 2nd floor to 1st, etc, and you can optionally choose to increase the speed of the elevator. As far as the code goes, I haven't optimised it at all, however it is run once, and that's it, so I'm not gonna really bother. [code]-- Run this code once all the entites have been created: hook.Add("InitPostEntity", "LiftPatcher", function () -- Make sure we are on evocity: if string.lower(game.GetMap()) == "rp_evocity_v2d" then --[[ SETTINGS ]] -- These two settings are for the main lift with 4 floors: local patchlift = true -- Do you want to add floor management? local newliftspeed = 200 -- If so, how fast do you want it to move? (Default 100) (It will miss the floors if you set it too high, simply TEST IT) -- Lift Speeds: local othernewliftspeed = 400 -- The speed of the lift in the building with forcefields (Default 100) local underliftspeed = 400 -- The speed of the lift that goes underground (Default 100) -- Note: @ 400 it wont perfectly align with the floors, but it still works, and is FAST! -- Prop cleanup: local removeloseprops = true -- Remove the lose physics objects laying around the map? local removewhalespawner = true -- Remove the whale spawner? -- Focefields that break RP: local RemoveForceFields = true -- Remove the forcefields from that other building with a lift local RemoveJailForceField = true -- Remove the forcefield from the jail? local RemoveLabForceFields = true -- Remove the forcefields from the lab? -- Door Locking: local LockPoliceStuff = true -- Lock the nexas doors? -- Remove breakables: local RemoveBreakableStuff = true -- Remove the breakable doors and stuff from around the map -- Remove the Incinerator local RemoveIncinerator = true -- Remove the Incinerator (It can be used for mass griefing if you know how) -- Move the teleporters up? This is useful for servers were players collide, -- it HELPS to stop them from getting stuck inside eachother local ShiftTeleporters = true --[[ DONT TOUCH ANYTHING BELOW HERE ]] for k,ent in pairs(ents.GetAll()) do -- Remove all the useless props: if removeloseprops then if(ent:GetClass() == "prop_physics_multiplayer") then ent:Remove() end if(ent:GetClass() == "prop_physics") then ent:Remove() end end -- Remove the whale + tyre spawners: if removewhalespawner then if(ent:GetName() == "whaletemp") then ent:Remove() end if(ent:GetName() == "dingotemp") then ent:Remove() end -- Remove the switch that spawns whales + tyres: if(ent:GetPos() == Vector(3586.38,-6770.49,185.64)) then ent:Remove() end end if RemoveForceFields then -- Remove the yukuza door 1: if(ent:GetPos() == Vector(-5379.99,-9377,129.96)) then ent:Remove() end -- Remove the yukuza door 2: if(ent:GetPos() == Vector(-5379.99,-9193,129.96)) then ent:Remove() end -- Remove the yukuza button 1: if(ent:GetPos() == Vector(-5204.61,-9421.51,109.47)) then ent:Remove() end -- Remove the yukuza button 2: if(ent:GetPos() == Vector(-5191.61,-9421.51,109.47)) then ent:Remove() end end if RemoveJailForceField then -- Remove the button 1 from the nexas jail: if(ent:GetPos() == Vector(-6761.5,-9456,890)) then ent:Remove() end -- Remove the button 2 from the nexas jail: if(ent:GetPos() == Vector(-6761.5,-9450,890)) then ent:Remove() end -- Remove the forcefield in the nexas jail: if(ent:GetPos() == Vector(-6768,-9501,900)) then ent:Remove() end end if LockPoliceStuff then --Lock the nexas Doors + Garage: if(ent:GetPos() == Vector(-6792,-8653,136)) then ent:Fire("lock", "", 0) -- Left end if(ent:GetPos() == Vector(-7048,-8653,136)) then ent:Fire("lock", "", 0) -- Right end if(ent:GetPos() == Vector(-7676,-8685,168)) then ent:Fire("lock", "", 0) -- Garage end --Lock the one cell door used in the nexas: if(ent:GetName() == "Cell1") then ent:Fire("lock", "", 0) -- Left end if(ent:GetName() == "Cell2") then ent:Fire("lock", "", 0) -- Left end if(ent:GetName() == "Cell3") then ent:Fire("lock", "", 0) -- Left end if(ent:GetName() == "Cell4") then ent:Fire("lock", "", 0) -- Left end if(ent:GetName() == "Cell5") then ent:Fire("lock", "", 0) -- Left end if(ent:GetName() == "Cell6") then ent:Fire("lock", "", 0) -- Left end if(ent:GetName() == "CellCrazy") then ent:Fire("lock", "", 0) -- Left end end if RemoveBreakableStuff then -- Remove the breakable door on the abandend house: if(ent:GetPos() == Vector(-2878,-129.08,133)) then ent:Remove() end -- Remove the two breakable windows in the abandended house: if(ent:GetPos() == Vector(-2997,334.92,277)) then ent:Remove() end if(ent:GetPos() == Vector(-2997,-87.08,277)) then ent:Remove() end -- Remove those two physboxes on that camping shelter: if(ent:GetPos() == Vector(-1339,-6116.3,116.03)) then -- side one ent:Remove() end if(ent:GetPos() == Vector(-1346.5,-6137.85,167.37)) then -- top one ent:Remove() end end if RemoveIncinerator then -- Remove the incinerator: if(ent:GetPos() == Vector(3042.5,4499.5,138.5)) then ent:Remove() end end if RemoveLabForceFields then -- Remove the doors + buttons from RBL: --[[ Door numbers: 2 3 1 4 5 ]] -- RBL Door 1: if(ent:GetPos() == Vector(10982,-12675.5,-989)) then ent:Remove() end -- RBL Doo
Amazing. This script is absolutely amazing. Nothing worse than the nexus lift. Thanks man!
You shall have a big clap from me, amazing and will help a lot of people!
Nice, sounds useful
I actually had fun making this, learned so much, and It makes me happy that it can help someone else :P
Wow thanks for this, will be very useful! :D
I'm guessing that the focus of this script is function rather than efficiency, but just saying you could make this script a LOT quicker by using the "continue" keyword inside those gigantic for-loops (pretty sure Garry added that into gmod lua). Good work though, looks like a lot of effort went into it.
[QUOTE=Splambob;34429904]I'm guessing that the focus of this script is function rather than efficiency, but just saying you could make this script a LOT quicker by using the "continue" keyword inside those gigantic for-loops (pretty sure Garry added that into gmod lua). Good work though, looks like a lot of effort went into it.[/QUOTE] Never heard of it, I'll google it tomorrow, thanks for the feedback, It executes in like a split second on my local PC anyways, and it is run once, so it doesn't really matter :P
This is insanely awesome. Thanks for this, running it on my server.
Good work, but this could be optimized greatly. Personally, I'd use tables in the giant for loop, and continues (like Splambob said). In general, creating logic_relays just to fire one output is kind of redundant, and since you're firing "Enable" and "Disable" rather than just "Trigger", you're firing 3 outputs in total instead of just one. Also, you have 4 relays just to fire 2 ouputs, I'm not quite sure what the reasoning behind that is, but if it's necessary you could just trigger one relay twice. But that's just my two cents, good script regardless.
[QUOTE=PortalGod;34433067]Good work, but this could be optimized greatly. Personally, I'd use tables in the giant for loop, and continues (like Splambob said). In general, creating logic_relays just to fire one output is kind of redundant, and since you're firing "Enable" and "Disable" rather than just "Trigger", you're firing 3 outputs in total instead of just one. Also, you have 4 relays just to fire 2 ouputs, I'm not quite sure what the reasoning behind that is, but if it's necessary you could just trigger one relay twice. But that's just my two cents, good script regardless.[/QUOTE]Ya, that wouldn't surprise me, the script went through a lot of changes while I was making it, and it sounds like I've left some of those entities in there, as for the entities that are only activated or deactivated, I used them like logic, the lift either has to go up or down, depending on which floor it's on, so I use them to work it out :P
I thought there was an updated version of this map out already?
Good job, however it'd be better on a newer map :)
[QUOTE=_NewBee;34441912]I thought there was an updated version of this map out already?[/QUOTE]I know there is a brand new map, that is an updated version of it, but it's exactly that -- a brand new map, it's completely different, and all the patches I've seen are dodgy, people recompile then recompile the map and it wrecks it, looking in gmod server browser, lots of people still play this map... Feel free to link me to the map if I'm wrong :P
Sorry, you need to Log In to post a reply to this thread.