Difference between revisions of "Faction Documentation"
(→Faction Functions) |
(→Player Override) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
|- | |- | ||
| systems_factions_window_handler.lua || handles the button responses to the faction window | | systems_factions_window_handler.lua || handles the button responses to the faction window | ||
+ | |- | ||
+ | | player_handle_faction.lua || player faction handlers for button responses (admin only really) | ||
|} | |} | ||
+ | |||
==Faction Functions== | ==Faction Functions== | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 18: | Line 21: | ||
! Function Name !! Arguments || Description | ! Function Name !! Arguments || Description | ||
|- | |- | ||
− | | SetFaction || player,faction,value|| | + | | SetFaction || player,faction,value|| sets faction ranking value on a player |
|- | |- | ||
− | | AdjustFaction || player,faction,value,cap|| | + | | AdjustFaction || player,faction,value,cap|| either adds or subtracts the faction with cap limitation support. |
|- | |- | ||
− | | RemoveFaction || player,faction|| | + | | RemoveFaction || player,faction|| removes a faction from a player |
+ | |- | ||
+ | | HasFaction || faction|| returns true if the player has a faction | ||
+ | |- | ||
+ | | GetFactionRank || player,faction|| returns the rank value of a faction from a player | ||
+ | |} | ||
+ | ==Examples== | ||
+ | set the faction of Eldeir Village to 50 on a player<br> | ||
+ | Systems_Factions.SetFaction(object,"Eldeir Village",50)<br> | ||
+ | <br> | ||
+ | adjust that same faction by 25, but dont go over 200 faction<br> | ||
+ | Systems_Factions.AdjustFaction(object,"Eldeir Village",25,200)<br> | ||
+ | ==Script Commands== | ||
+ | {| class="wikitable" | ||
|- | |- | ||
− | + | ! Command !! Description | |
|- | |- | ||
− | | | + | | editfaction || opens up the dynamic window to display the faction for viewing or editing. |
|} | |} | ||
+ | ==HUD Override== | ||
+ | I have in the HUD override a faction ICON attached to the minmap, a gold bordered with black background and a F in the center for now | ||
+ | ==Player Override== | ||
+ | I also have a setup in the player.lua EventType.OnLoadedFromBackup event to allow you to have it add a list of predetermined factions. The system comes with Eldeir Village and Trinit as an example. Go to this list to generate on your players the factions you want to start at zero.<br><br> | ||
+ | file:player_handle_faction.lua<br> | ||
+ | |||
+ | local coreFactions =<br> | ||
+ | {<br> | ||
+ | {"Eldeir Village",0},<br> | ||
+ | {"Trinit",0},<br> | ||
+ | }<br> | ||
+ | this:SetObjVar("Systems_Factions",coreFactions)<br> |
Latest revision as of 18:42, 18 June 2018
back to Project Phoenix#Factions
Contents
About Factions
Some games you player have a faction system to keep track of your reputation or standing with a group of in game npcs, towns, villages or even that rambling drunk who may have that rusty key your looking for. I have created a simple easy to upgrade system as a starting point for any developer to easily merge and create factions for their players to join and work with.
Faction Scripts
File Name | Description |
---|---|
systems_factions.lua | core functions for the faction system |
systems_factions_window.lua | faction display window for players |
systems_factions_window_handler.lua | handles the button responses to the faction window |
player_handle_faction.lua | player faction handlers for button responses (admin only really) |
Faction Functions
Function Name | Arguments | Description |
---|---|---|
SetFaction | player,faction,value | sets faction ranking value on a player |
AdjustFaction | player,faction,value,cap | either adds or subtracts the faction with cap limitation support. |
RemoveFaction | player,faction | removes a faction from a player |
HasFaction | faction | returns true if the player has a faction |
GetFactionRank | player,faction | returns the rank value of a faction from a player |
Examples
set the faction of Eldeir Village to 50 on a player
Systems_Factions.SetFaction(object,"Eldeir Village",50)
adjust that same faction by 25, but dont go over 200 faction
Systems_Factions.AdjustFaction(object,"Eldeir Village",25,200)
Script Commands
Command | Description |
---|---|
editfaction | opens up the dynamic window to display the faction for viewing or editing. |
HUD Override
I have in the HUD override a faction ICON attached to the minmap, a gold bordered with black background and a F in the center for now
Player Override
I also have a setup in the player.lua EventType.OnLoadedFromBackup event to allow you to have it add a list of predetermined factions. The system comes with Eldeir Village and Trinit as an example. Go to this list to generate on your players the factions you want to start at zero.
file:player_handle_faction.lua
local coreFactions =
{
{"Eldeir Village",0},
{"Trinit",0},
}
this:SetObjVar("Systems_Factions",coreFactions)