[Modding] Adding a new Faction - salutesh/DayZ-Expansion-Scripts GitHub Wiki

Return to the summary


In this example we are creating a new faction named "Reforger". If you want to create a faction with a different name, simply rename ALL the "Reforger" mentions.

YourMod/Scripts/3_Game

[eAIRegisterFaction(eAIFactionReforger)]
class eAIFactionReforger : eAIFaction
{
	void eAIFactionReforger()
	{
		// The name of your Faction
		m_Name = "Reforger";

		// The name of the loadout your Faction will use by DEFAULT
		// used if the server doesn't specify a loadout
		m_Loadout = "ReforgerLoadout";
		
		// Is this Faction meant to behave like Guards
		m_IsGuard = true;
	}

	// Used to check if the target Faction should be considered Friendly
	override bool IsFriendly(notnull eAIFaction other)
	{
		// If you dont want your own Faction to kill each others make them friendly to their own Faction
		if (other.IsInherited(eAIFactionReforger)) return true;

		if (other.IsInherited(eAIFactionCivilian)) return true;

		return false;
	}

	// Used to check if the target EntityAI should be considered Friendly
	// You do not need to add this function unless if you want a special behavior
	// The default behaviour doesnt require this function.
	override bool IsFriendlyEntity(EntityAI other)
	{
		return other.IsInherited(DayZCreatureAI);
	}
};

This are the default Factions we are providing

eAIFactionCivilian
eAIFactionEast
eAIFactionWest
eAIFactionMercenaries
eAIFactionRaiders
eAIFactionGuards
eAIFactionPassive
eAIFactionShamans