1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

How can i make npcs ignore factions

Discussion in 'Discussion' started by flots, Dec 26, 2012.

  1. Is is possible to do this for mpf, ota and CA? I seen it on a server, turrets would only should citizens but they ignored MPF , CA and OTA units. Anyway to do this? Thanks in advance.
     
  2. RJ

    RJ no pay Legend Clockwork Customer

    You can try using http://www.garrysmod.org/downloads/?a=view&id=121388
    And instead of checking player models you can try if (player:IsCombine) or however it goes. I have no clue if this will work as this is a really old addon and I came across a difficulty where it would only check which faction a player was in when they were created. So if you spawned a metropolice NPC while you were a citizen and had them to attack citizens, they would attack you. If you switched to the combine without respawning the NPC, they'd still attack you.
     
  3. Razor

    Razor Guest

    Editing it to work should be super possible.
     
  4. Uhh, that addon looks like its out-dated. Anyone with good lua knowledge could help me on this?

    Thanks for the replies by the way!
     
  5. Code:
    if player:IsCombine(player) then
    			fact = "f_combine"
    Been a while since I messed with LUA. If that doesn't work then try just player:IsCombine instead of player:IsCombine(player).
     
  6. Sorry If I am being annoying, but where does that go exactly? Thanks for the reply once again.
     
  7. This
    ---------------------------------------------------------------------
    PHP:
    function DoMove(ply,move)
        if 
    ply:GetVar("faction") == nil then
            mdl 
    string.sub(ply:GetModel(),15,-5)
            
    local fact ""
            
    if mdl=="police" || mdl == "combine_soldier" || mdl == "combine_soldier_prisonguard" || mdl == "combine_super_soldier" || mdl == "breen" then
                fact 
    "f_combine"
    ---------------------------------------------------------------------

    To this
    ---------------------------------------------------------------------
    PHP:
    function DoMove(ply,move)
        if 
    ply:GetVar("faction") == nil then
            mdl 
    string.sub(ply:GetModel(),15,-5)
            
    local fact ""
            
    if player:IsCombine(playerthen
                fact 
    "f_combine"
    ---------------------------------------------------------------------
     
  8. Unfortunately that didn't work out for me , I have tried both ways :-\, thanks however.
     
  9. What happens?
     
  10. Razor

    Razor Guest

    Silly you, it's Schema:playerIsCombine(player)
     
  11. RJ

    RJ no pay Legend Clockwork Customer

    +1

    There it is :D
     
  12. Going to try it out, thank you all for helping m out.
     
  13. connall

    connall Guest

    THANK YOU!

    You guys just gave me a brain wave on the easiest way to code this.
     
  14. Warjekk

    Warjekk Games Development Student

    Am I right in thinking this would work in replacing the DoMove? I'm not sure whether when doing GetFaction I have the "Schema:" or not.
    Code:
    function DoMove(ply,move)
    	if ply:GetVar("faction") == nil then
    		local fact = ""
    		if Schema:PlayerIsCombine(ply) or ply:Schema:GetFaction() == FACTION_CWU or ply:Schema:GetClass() == CLASS_ENSLAVED_NORM then
    			fact = "f_combine"
    		elseif ply:Schema:GetFaction() == FACTION_CITIZEN or ply:Schema:GetFaction() == FACTION_RESISTANCE or ply:Schema:GetClass() == CLASS_ENSLAVED_FREED then
    			fact = "f_human"
    		else 
    			fact = "f_human"
    		end
    		ply:SetVar("faction",fact)
    		ply:SetName(fact)
    		ChangeFaction()
    	end
    end
     
  15. connall

    connall Guest

    Why are you using "ply" it should really be "player"

    Also, "ply:SchemaGetFaction()" is not necessary just do something like

    "local faction = player:GetFaction()" or just "player:GetFaction()" then just refer to faction when grabbing player faction.
     
  16. RJ

    RJ no pay Legend Clockwork Customer

    It would actually be ply because of the parameters he's using.
     
  17. Warjekk

    Warjekk Games Development Student

    It's within the plugin. The parameters in DoMove for player is 'ply' by default, and I don't see the need to change it. If this addon is changed to work as a plugin, I'm assuming I'd only need to do ply:GetFaction as opposed to ply:Schema:GetFaction ? Or doesn't it matter which way I do it?
     
  18. Razor

    Razor Guest

    May I ask you what are you even trying to do?
     
  19. Make it so NPC cops don't shoot Combine players.
     
  20. connall

    connall Guest

    If you give me a couple of days I'm actually working on it so cops won't shoot citizens unless given Anti-Citizenship status.
     

Previous Readers (Total: 0)