Garry's Mod

Garry's Mod

399 ratings
Control Map Entities - Entity:fire() E2 Function (Wiremod / ent_fire)
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Roleplay
File Size
Posted
Updated
1.054 KB
13 Aug, 2014 @ 2:06am
20 Apr, 2017 @ 12:00pm
6 Change Notes ( view )

Subscribe to download
Control Map Entities - Entity:fire() E2 Function (Wiremod / ent_fire)

In 1 collection by LibertyForce
Horror- & Story-Map Enhancements (Single- and Multiplayer Tools)
6 items
Description
This extension will add a new function to Expression 2 that allows you to fire an entity's input. It works much like the "ent_fire" console command, but without the need for "sv_cheats 1" and directly from within your E2 code.

Now you can easily control map entities:
  • Open, close, lock, unlock every door
  • Enable or disable thumpers, turrets and anything else that is compatible
  • Activate buttons without touching them or block them from being used
  • Start, stop, move forward / backward elevators and other things that use func_tracktrain.
  • Set keyvalues and spawnflags for entities.
All with wired buttons / events / or just anything you can think of (and build).


This is an Wiremod E2 extension. Therefore it requires Wiremod!


Syntax:
Entity:fire([string] input, [string] parameter)
Entity - a variable or function that returns the entity you want to manipulate
input - the entity's input that you want to fire (ex. "open")
parameter = optional: some inputs require additional parameter that you can send here

Entity:setKeyValue([string] keyvalue, [string/number] value)
Entity - a variable or function that returns the entity you want to manipulate
keyvalue - the keyvalue that you want to change (ex. "spawnflags")
value = the value that you want to set - either as number or string

entityMapID([number] id)
Returns entity that has given MapCreationID. Unlike entity(), it will always be the same on same map, no matter how much you clean up or restart it.
ID - the unique MapCreationID of the entity. Use the below function or Easy Entity Inspector to retrieve it.

Entity:getMapID()
Returns entity's MapCreationID. Only works on map entities.
Entity - a variable or function that returns the entity

Entity:getEntityName()
Returns the mapping name of this entity. Only works on (map) entities with an assigned name.
Entity - a variable or function that returns the entity


Example:
MyDoor:fire("lock") # This will lock the door that is assigned the variable "MyDoor". entityMapID(123):fire("kill") # This deletes the map entity with MapCreationID 123 from the map. Turret:setKeyValue("spawnflags",512) # Makes a floor turret friendly (like hacked by Alyx)


Multiplayer Notes:
  • This mod needs to be installed server-side! Clients don't need to install it and can still use the function.
  • This function does NOT allow to manipulate player entities (others or own).
  • Compatible with most Prop Protection addons: It uses the hook "CanProperty" to check if a player is allowed to manipulate an entity. If you don't have Prop Protection, all players are allowed to manipulate everything!
  • Prop Protection can be bypassed with the convar "wire_expression2_entfire_norestriction". If set to 1, it will allow all players to manipulate all entities, regardless of Prop Protection.


Click the following link for a guide that includes a list for inputs that you can fire and how you can get entities in E2. Beginners should read this! Do not ask questions answered in the FAQs.


>>> FAQ's / Documentation <<<

Other useful links:


Tags: wiremod wire expression 2 e2 chip developer input keyvalue key value entity map door combine turret elevator train open close lock unlock fire enable disable manipulate change
Popular Discussions View All (3)
5
28 Dec, 2017 @ 6:35pm
PINNED: Example E2 Codes
LibertyForce
4
21 Oct, 2024 @ 11:19am
PINNED: FAQs / Documentation
LibertyForce
2
20 Nov, 2015 @ 10:13am
E2 Hacker Buddy help
Sykken
28 Comments
Diveryup 24 Dec, 2023 @ 2:01pm 
how can i even use this i cant even find the thing
doofdrew 27 Jul, 2023 @ 1:32pm 
how do i use this?
Intuitive 1 Jul, 2023 @ 8:37pm 
I love this. Thank you!
YellowBanana4201 16 May, 2023 @ 8:33pm 
Can it just allow buttons to be moved with the physgun?
YellowBanana4201 16 May, 2023 @ 8:26pm 
Why do some of the buttons like the combine button point down when ever on a wall?
Benevolence 15 Apr, 2023 @ 10:59pm 
I came across this too many times, because I had limited CPU\RAM, Now I might see this useful!:steamthumbsup:
{SWAG} Kyrator 6 Mar, 2022 @ 3:18pm 
toturial for thumplers please
StrawWagen 1 Sep, 2021 @ 11:58am 
Admincore adds support for e:entsetinput(s) as well as E:entsetkeyvalue(s)
Quite useful if you're looking for something more
Armystuntman 26 Jun, 2020 @ 10:17am 
Or even better, add a version identical to ent_fire's console command variant, which uses the entity map name instead of specifying each map ID individually? This would make it easier to fire multiple entities which have the same name.
Specifying every single ID is a little tedious.
Armystuntman 26 Jun, 2020 @ 10:14am 
Can you make it possible to :fire() multiple entities, like in an array?