Jump to content

Understanding Factions in Sacred 2


Flix

Recommended Posts

I'm choosing some of the lesser known scripts to leave some knowledge for posterity or general use. This is more from a modding/technical perspective than from anything to do with lore.

Factions in Sacred 2

There are 69 different factions defined for Sacred 2 in faction.txt. This file is located in the scripts/server directory of the game.

This file determines what factions of NPC's are hostile or friendly to one another.  This is the full list:

Spoiler

id = 1, name = "FACTION_INVALID",
id = 5, name = "FACTION_ATMO",
id = 7, name = "FACTION_ANIMAL_WILD",
id = 8, name = "FACTION_HERO_GOOD",
id = 9, name = "FACTION_HERO_BAD",
id = 10, name = "FACTION_ANIMAL_ATMO",
id = 12, name = "FACTION_HUMAN",
id = 14, name = "FACTION_HIGHELVE",
id = 16, name = "FACTION_ORC",
id = 17, name = "FACTION_DRYAD",
id = 18, name = "FACTION_MECHANICAL",
id = 19, name = "FACTION_UNDEAD",
id = 20, name = "FACTION_T-MUTATION",
id = 23, name = "FACTION_DRAGON",
id = 24, name = "FACTION_DEMON",
id = 26, name = "FACTION_ENERGY",
id = 27, name = "FACTION_MONSTER",
id = 30, name = "FACTION_SANDPEOPLE",
id = 31, name = "FACTION_DESERTHUMAN",
id = 32, name = "FACTION_LIZARD",
id = 33, name = "FACTION_UNDEADLEGION",
id = 34, name = "FACTION_ORC_GOOD",
id = 35, name = "FACTION_ORC_BAD",
id = 36, name = "FACTION_NUKNUK",
id = 37, name = "FACTION_COBOLD",
id = 40, name = "FACTION_LIZARD_BAD",
id = 41, name = "FACTION_HIGHELVE_PRIEST",
id = 42, name = "FACTION_ENEMY_ALL",
id = 46, name = "FACTION_TROLL",
id = 47, name = "FACTION_SERAPHIM",
id = 54, name = "FACTION_ELEMENTALS",
id = 56, name = "FACTION_GCENEMYTOPLAYER",
id = 57, name = "FACTION_ENEMY_HERO",
id = 58, name = "FACTION_ENEMY_HERO_GOOD",
id = 59, name = "FACTION_ENEMY_HERO_BAD",
id = 66, name = "FACTION_FRIEND_HERO_ALL",
id = 67, name = "FACTION_OUTLAW_ROBBERS",
id = 69, name = "FACTION_ATMO_HUNT_SMALL",
id = 70, name = "FACTION_ATMO_HUNT_MED",
id = 71, name = "FACTION_ATMO_HUNT_LARGE",
id = 72, name = "FACTION_ATMO_NO_HUNT",
id = 73, name = "FACTION_AWILD_HUNTER_SM",
id = 74, name = "FACTION_AWILD_HUNTER_MED",
id = 75, name = "FACTION_AWILD_HUNTER_LARGE",
id = 76, name = "FACTION_DESERTHU_GUARDS",
id = 77, name = "FACTION_DESERTHU_REBELS",
id = 78, name = "FACTION_DRAGON_ARMY",
id = 79, name = "FACTION_DRAGON_REBELS",
id = 80, name = "FACTION_DRYAD_GUARD",
id = 81, name = "FACTION_DRYAD_BLOOD",
id = 82, name = "FACTION_DRYAD_BRIGANT",
id = 83, name = "FACTION_HIGHELVE_GUARD",
id = 84, name = "FACTION_HUMAN_GUARD",
id = 85, name = "FACTION_HUMAN_CRUSADE",
id = 86, name = "FACTION_HUMAN_CULT",
id = 87, name = "FACTION_LIZARD_NEUTRAL_GUARD",
id = 88, name = "FACTION_LIZARD_NEUTRAL",
id = 89, name = "FACTION_LIZARD_GOOD",
id = 90, name = "FACTION_ORC_NEUTRAL_GUARD",
id = 91, name = "FACTION_ORC_NEUTRAL",
id = 92, name = "FACTION_OUTLAW_PIRATE",
id = 93, name = "FACTION_GUARD_GOOD",
id = 94, name = "FACTION_GUARD_BAD",
id = 95, name = "FACTION_JOB_HUNTER",
id = 96, name = "FACTION_WEREWOLF_SWAMP",
id = 97, name = "FACTION_QUEST_VICTIM",
id = 98, name = "FACTION_QUEST_ENEMY",
id = 99, name = "FACTION_HUMAN_MASC",
id = 100, name = "FACTION_GODSPELL",

Factions may be defined as either: ENEMY or FRIENDLY.  Most relationships in faction.txt are defined twice, with a kind of mirroring, for example:

mgr.addFactionRelation { 
	id1 = 19,
	id2 = 34,
	f1name = "FACTION_UNDEAD",
	f2name = "FACTION_ORC_GOOD",
	relation = "FRT_ENEMY",
}

mgr.addFactionRelation { 
	id1 = 34,
	id2 = 19,
	f1name = "FACTION_ORC_GOOD",
	f2name = "FACTION_UNDEAD",
	relation = "FRT_ENEMY",
}

If they were not mirrored, for example if the second entry above was missing or set to "FRT_FRIENDLY", then the first party would attack the second, but the second party would be oblivious and passive as their hitpoints got hacked away.

Factions are assigned in the respective creature entry of a monster/NPC, in creatures.txt, with the following line:

faction_id = 83,

The identical same line can also be inserted into a taskcreature entry, in quest.txt.  This can be useful to make the same base creature have different alignments depending on the quest that they take part in.

The final useful bit of info, is how to make a taskcreature change factions over the course of a single quest or series.  This is also done in quest.txt, within the quest entry itself, by using the "groupchanges" function:

groupchanges = {
{ 8233,7,1,"CM_Begleiter_feige",1 },
},

The first number indicates the taskcreature ID, the second number indicates the quest stage at which the change is to take place. The new behavior is assigned with the text portion. The FINAL number in the string is the new faction ID that the quest creature will receive at the given quest stage.

This can be used to make a quest NPC friendly at first, and then turn hostile and attack, or to make an escort NPC join and then leave the party.  Depending on the faction assigned, the escort may be hostile/vulnerable to enemies, or basically be "invisible" and ignored by enemies.

Summoned Creatures

If an NPC summons a monster via a spell, then the summoned creature does not necessarily have allegiance to the summoner. It will retain its faction ID assigned in creatures.txt.  So care should be given to match the factions of the summoner and the summoned minion.

There seems to be an additional complication when the summoner is a quest creature.  For some reason, when a quest opponent is given a summoning spell, the minions will invariably turn against the summoner, even if the factions match, UNLESS the quest creature is a Boss-class opponent.

I have yet to figure out why this is, because there are so many layers.  In this specific scenario, somewhere along the way the faction ID is being ignored in favor of some kind of "berserk" allegiance for the minions.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
Please Sign In or Sign Up