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!

Making a Combine faction?

Discussion in 'Discussion' started by Aquaman661, Feb 20, 2013.

  1. Aquaman661

    Aquaman661 Guest

    Trying to create a new faction for MPF Officers using the Combine Officer models. I've set up the faction and class, but I had a few questions:

    [list type=decimal]
    [*]How do I make the faction considered Combine and able to use the combine locks/dispatch/etc.
    [*]How do I make the scoreboard display it as Civil Protection instead of the custom class Metropolice Officer?
    [/list]

    Thanks!
     
  2. You need to modify the PlayerIsCombine function to have them be considered a Combine character.

    You change the class to do the second thing.
     
  3. Aquaman661

    Aquaman661 Guest

    PlayerIsCombine is inside of it and set to true, but it doesn't work
     
  4. Aquaman661

    Aquaman661 Guest

    Here the faction file:
    Code:
    --[[
    	© 2012 CloudSixteen.com do not share, re-distribute or modify
    	without permission of its author ([email protected]).
    --]]
    
    local FACTION = Clockwork.faction:New("Metropolice Force Command");
    
    FACTION.isCombineFaction = true;
    FACTION.whitelist = true;
    FACTION.material = "halfliferp/factions/mpf";
    FACTION.models = {
    	female = {
    		"models/humans/combine/female_01.mdl",
    		"models/humans/combine/female_02.mdl",
    		"models/humans/combine/female_03.mdl",
    		"models/humans/combine/female_04.mdl",
    		"models/humans/combine/female_06.mdl",
    		"models/humans/combine/female_07.mdl"
    	},
    	male = {
    		"models/humans/combine/male_01.mdl",
    		"models/humans/combine/male_02.mdl",
    		"models/humans/combine/male_03.mdl",
    		"models/humans/combine/male_04.mdl",
    		"models/humans/combine/male_05.mdl",
    		"models/humans/combine/male_06.mdl",
    		"models/humans/combine/male_07.mdl",
    		"models/humans/combine/male_08.mdl",
    		"models/humans/combine/male_09.mdl"
    	};
    };
    
    -- Called when a player's name should be assigned for the faction.
    function FACTION:GetName(player, character)
    	return "MPF-Ofc."..Clockwork.kernel:ZeroNumberToDigits(math.random(1, 99999), 5);
    end;
    
    -- Called when a player is transferred to the faction.
    function FACTION:OnTransferred(player, faction, name)
    	if (faction.name == FACTION_OTA) then
    		if (name) then
    			Clockwork.player:SetName(player, string.gsub(player:QueryCharacter("name"), ".+(%d%d%d%d%d)", "MPF-Ofc.%1"), true);
    		else
    			return false, "You need to specify a name as the third argument!";
    		end;
    	else
    		Clockwork.player:SetName( player, self:GetName( player, player:GetCharacter() ) );
    	end;
    	
    	if (player:QueryCharacter("gender") == GENDER_MALE) then
    		player:SetCharacterData("model", self.models.male[1], true);
    	else
    		player:SetCharacterData("model", self.models.female[1], true);
    	end;
    end;
    
    FACTION_MPFCMD = FACTION:Register();

    And the class file:

    Code:
    --[[
    	© 2012 CloudSixteen.com do not share, re-distribute or modify
    	without permission of its author ([email protected]).
    --]]
    
    local CLASS = Clockwork.class:New("Metropolice Officer");
    	CLASS.color = Color(148, 112, 255, 255);
    	CLASS.wages = 50;
    	CLASS.factions = {FACTION_MPFCMD};
    	CLASS.isDefault = true;
    	CLASS.wagesName = "Allowance";
    	CLASS.description = "A metropolice office working as Civil Protection";
    	CLASS.defaultPhysDesc = "Wearing a neat uniform with a thigh holster.";
    CLASS_MPFOFC = CLASS:Register();
     
  5. Aquaman661

    Aquaman661 Guest

    Actually I think I may have found it in sv_schema.

    Code:
    -- A function to check if a player is Combine.
    function Schema:PlayerIsCombine(player, bHuman)
    	if (IsValid(player) and player:GetCharacter()) then
    		local faction = player:GetFaction();
    		
    		if (self:IsCombineFaction(faction)) then
    			if (bHuman) then
    				if (faction == FACTION_MPF) then
    					return true;
    				end;
    			elseif (bHuman == false) then
    				if (faction == FACTION_MPF) then
    					return false;
    				else
    					return true;
    				end;
    			else
    				return true;
    			end;
    		end;
    	end;
    end;
    I think this is what I'm looking for, now what would I add to make it apply to other factions?
     

Previous Readers (Total: 0)