How do I get Metrocops to act as pre-manhunt cops, where they stand and warn the player when they get too close? For that matter, can this be done inside GMod, and in console? I haven't even begun to delve into Lua, so if I need to start taking masses of code, please tell me some good tutorials that I can read up on.
The Dev Wiki helps a lot with NPC type questions, and you can find metrocop stuff here: [url]http://developer.valvesoftware.com/wiki/Npc_metropolice[/url]
Using Lua, if you made a metrocop you could use npc.AddEntityRelationship along with setting the spawnflags to allow arrests for neutral people.
If that makes no sense, well, I would look into some Lua tutorials first.
All right. So, there's no way to edit the npc's directly from the console, then. I'll look into it. Thanks for the tip.
You can spawn NPCs from console and you might be able to fire particular inputs such that it works, but it's 1000x easier to do it in Lua.
[QUOTE=itak365;18195937]All right. So, there's no way to edit the npc's directly from the console, then. I'll look into it. Thanks for the tip.[/QUOTE]
Edit the metrocops? Nope not really possible. As for making the regular metrocops act like they're policing without the global flag set (which requires mapping) I've looked a bit into it but never managed to get anything useful out of it, but then again that was a long while ago and I didn't have a clue of what I was doing. Best of lucks! :smile:
Put this in a Lua file and execute it whenever. Only needs to be done once per map load
[lua]
local ent = ents.Create( "env_global" );
ent:SetKeyValue( "initialstate", 1 );
ent:SetKeyValue( "globalstate", "gordon_precriminal" );
ent:Spawn();
ent:Activate();
ent:Fire( "TurnOn", 0 );
[/lua]
[editline]09:43AM[/editline]
Fucking around with this and I got myself pet antlions:
[lua]
local ent = ents.Create( "env_global" );
ent:SetKeyValue( "initialstate", 1 );
ent:SetKeyValue( "globalstate", "antlion_allied" );
ent:Spawn();
ent:Activate();
ent:Fire( "TurnOn", 0 );
for _, pl in pairs( player.GetAll() ) do
pl:Give( "weapon_bugbait" );
end
[/lua]
[editline]09:44AM[/editline]
Anyways more info here: [url]http://developer.valvesoftware.com/wiki/Env_global[/url]
[QUOTE=foszor;18203247]Put this in a Lua file and execute it whenever. Only needs to be done once per map load
[lua]
local ent = ents.Create( "env_global" );
ent:SetKeyValue( "initialstate", 1 );
ent:SetKeyValue( "globalstate", "gordon_precriminal" );
ent:Spawn();
ent:Activate();
ent:Fire( "TurnOn", 0 );
[/lua]
[editline]09:43AM[/editline]
Fucking around with this and I got myself pet antlions:
[lua]
local ent = ents.Create( "env_global" );
ent:SetKeyValue( "initialstate", 1 );
ent:SetKeyValue( "globalstate", "antlion_allied" );
ent:Spawn();
ent:Activate();
ent:Fire( "TurnOn", 0 );
for _, pl in pairs( player.GetAll() ) do
pl:Give( "weapon_bugbait" );
end
[/lua]
[editline]09:44AM[/editline]
Anyways more info here: [url]http://developer.valvesoftware.com/wiki/Env_global[/url][/QUOTE]
Oh duh. I probably was really clueless when I didn't manage to do that.
Thanks, guys.
Sorry, you need to Log In to post a reply to this thread.