Home

Module faction

Lua bindings to deal with factions. Use like:
 f = faction.get( "Empire" )
 if f:playerStanding() < 0 then
 -- player is hostile to "Empire"
 end
 

Functions

faction.__eq (f, comp) __eq (equality) metamethod for factions.
faction.allies (f) Gets the allies of the faction.
faction.areAllies (f, a) Checks to see if f is an ally of a.
faction.areEnemies (f, e) Checks to see if f is an enemy of e.
faction.colour (f) Gets the faction colour.
faction.enemies (f) Gets the enemies of the faction.
faction.get (name) Gets the faction based on its name.
faction.known (f) Checks to see if a faction is known by the player.
faction.logoSmall (f) Gets the small faction logo which is 64x64 or smaller.
faction.logoTiny (f) Gets the tiny faction logo which is 24x24 or smaller.
faction.longname (f) Gets the faction's long name.
faction.modPlayer (f, mod) Modifies the player's standing with the faction.
faction.modPlayerRaw (f, mod) Modifies the player's standing with the faction.
faction.modPlayerSingle (f, mod) Modifies the player's standing with the faction.
faction.name (f) Gets the faction's name.
faction.playerStanding (f) Gets the player's standing with the faction.
faction.setKnown (f, b) Sets a faction's known state.
faction.setPlayerStanding (f, value) Sets the player's standing with the faction.


Functions

faction.__eq (f, comp)
__eq (equality) metamethod for factions. You can use the '=' operator within Lua to compare factions with this.

Parameters

  • f: Faction comparing.
  • comp: faction to compare against.

Usage:

if f == faction.get( "Dvaered" ) then

Return value:

true if both factions are the same.
faction.allies (f)
Gets the allies of the faction.

Parameters

  • f: Faction to get allies of.

Usage:

for k,v in pairs(f:allies()) do -- Iterate over faction allies

Return value:

A table containing the allies of the faction.
faction.areAllies (f, a)
Checks to see if f is an ally of a.

Parameters

  • f: Faction to check against.
  • a: Faction to check if is an enemy.

Usage:

if f:areAllies( faction.get( "Pirate" ) ) then

Return value:

true if they are enemies, false if they aren't.
faction.areEnemies (f, e)
Checks to see if f is an enemy of e.

Parameters

  • f: Faction to check against.
  • e: Faction to check if is an enemy.

Usage:

if f:areEnemies( faction.get( "Dvaered" ) ) then

Return value:

true if they are enemies, false if they aren't.
faction.colour (f)
Gets the faction colour.

Parameters

  • f: Faction to get colour from.

Return value:

The faction colour or nil if not applicable.
faction.enemies (f)
Gets the enemies of the faction.

Parameters

  • f: Faction to get enemies of.

Usage:

for k,v in pairs(f:enemies()) do -- Iterates over enemies

Return value:

A table containing the enemies of the faction.
faction.get (name)
Gets the faction based on its name.

Parameters

  • name: Name of the faction to get.

Usage:

f = faction.get( "Empire" )

Return value:

The faction matching name.
faction.known (f)
Checks to see if a faction is known by the player.

Parameters

  • f: Faction to check if the player knows.

Usage:

b = f:known()

Return value:

true if the player knows the faction.
faction.logoSmall (f)
Gets the small faction logo which is 64x64 or smaller.

Parameters

  • f: Faction to get logo from.

Return value:

The small faction logo or nil if not applicable.
faction.logoTiny (f)
Gets the tiny faction logo which is 24x24 or smaller.

Parameters

  • f: Faction to get logo from.

Return value:

The tiny faction logo or nil if not applicable.
faction.longname (f)
Gets the faction's long name.

Parameters

  • f: Faction to get long name of.

Usage:

longname = f:longname()

Return value:

The long name of the faction.
faction.modPlayer (f, mod)
Modifies the player's standing with the faction. Also modifies standing with allies and enemies of the faction.

Parameters

  • f: Faction to modify player's standing with.
  • mod: The modifier to modify faction by.

Usage:

f:modPlayer( -5 ) -- Lowers faction by 5
faction.modPlayerRaw (f, mod)
Modifies the player's standing with the faction. Does not affect other faction standings and is not processed by the faction Lua script, so it indicates exactly the amount to be changed.

Parameters

  • f: Faction to modify player's standing with.
  • mod: The modifier to modify faction by.

Usage:

f:modPlayerRaw( 10 )
faction.modPlayerSingle (f, mod)
Modifies the player's standing with the faction. Does not affect other faction standings.

Parameters

  • f: Faction to modify player's standing with.
  • mod: The modifier to modify faction by.

Usage:

f:modPlayerSingle( 10 )
faction.name (f)
Gets the faction's name.

Parameters

  • f: The faction to get the name of.

Usage:

name = f:name()

Return value:

The name of the faction.
faction.playerStanding (f)
Gets the player's standing with the faction.

Parameters

  • f: Faction to get player's standing with.

Usage:

if f:playerStanding() > 70 then -- Player is an ally

Return value:

The value of the standing and the human readable string.
faction.setKnown (f, b)
Sets a faction's known state.

Parameters

  • f: Faction to set known.
  • b: Whether or not to set as known (defaults to false).

Usage:

f:setKnown( false ) -- Makes faction unknown.
faction.setPlayerStanding (f, value)
Sets the player's standing with the faction.

Parameters

  • f: Faction to set the player's standing for.
  • value: Value to set the player's standing to (from -100 to 100).

Usage:

f:setPlayerStanding(70) -- Make player an ally

Valid XHTML 1.0!