API Version: 4
The CampUtil script is the primary way most mods should interact with Campfire and contains many helpful functions. To call any of the following functions, download the SDK and in your script include the line:
import CampUtil
Alternatively, you can call CampUtil.FunctionName() without importing CampUtil.
Use the table of contents below, or Ctrl+F in your browser to jump to a function.
Functions
- GetAPIVersion
- GetCampfireVersion
- GetPlayerEquippedHead
- GetPlayerEquippedBody
- GetPlayerEquippedHands
- GetPlayerEquippedFeet
- GetPlayerEquippedBackpack
- GetPlayerEquippedAmmo
- IsRefInInterior
- GetTrackedFollower
- IsTrackedFollower
- GetTrackedFollowerCount
- GetTrackedAnimal
- IsTrackedAnimal
- GetTrackedAnimalCount
- PlayerCanPlaceObjects
- IsPlayerPlacingObject
- LegalToCampHere
- GetAreaCampingFaction
- GetLastUsedCampfire
- GetCurrentTent
- IsTentWaterproof
- IsTentWarm
- TentHasShelter
- IsCurrentTentWaterproof
- IsCurrentTentWarm
- IsCurrentTentConjured
- CurrentTentHasShelter
- IsCrimeToPlaceInTowns
- IsPlaceableObjectTemporary
- IsPlaceableObjectConjured
- RegisterPerkTree
- UnregisterPerkTree
- GetCampfireSettingBool
- GetCampfireSettingInt
Events
Functions
GetAPIVersion
Get the CampUtil API version number.
Api version added
1
Syntax
float function GetAPIVersion() global
Parameters
None
Return Value
The CampUtil API version number. This is NOT the same thing as the version number of Campfire. CampUtil's version number will increment only when changes have been made to the API itself.
Examples
float ver = CampUtil.GetAPIVersion()
GetCampfireVersion
Get the Campfire mod version number.
Api version added
2
Syntax
float function GetCampfireVersion() global
Parameters
None
Return Value
The Campfire version number.
Examples
float ver = CampUtil.GetCampfireVersion()
GetPlayerEquippedHead
Gets the player's currently equipped head armor.
Api version added
1
Syntax
Armor function GetPlayerEquippedHead() global
Parameters
None
Return Value
The player's currently equipped head armor.
Examples
Armor PlayerHelm = GetPlayerEquippedHead()
GetPlayerEquippedBody
Gets the player's currently equipped body armor.
Api version added
1
Syntax
Armor function GetPlayerEquippedBody() global
Parameters
None
Return Value
The player's currently equipped body armor.
Examples
Armor PlayerArmor = GetPlayerEquippedBody()
GetPlayerEquippedHands
Gets the player's currently equipped hand armor.
Api version added
1
Syntax
Armor function GetPlayerEquippedHands() global
Parameters
None
Return Value
The player's currently equipped hand armor.
Examples
Armor PlayerGauntlets = GetPlayerEquippedHands()
GetPlayerEquippedFeet
Gets the player's currently equipped foot armor.
Api version added
1
Syntax
Armor function GetPlayerEquippedFeet() global
Parameters
None
Return Value
The player's currently equipped foot armor.
Examples
Armor PlayerBoots = GetPlayerEquippedFeet()
GetPlayerEquippedBackpack
Gets the player's currently equipped backpack.
Api version added
1
Syntax
Armor function GetPlayerEquippedBackpack() global
Parameters
None
Return Value
The player's currently equipped backpack.
Examples
Armor PlayerBackpack = GetPlayerEquippedBackpack()
Notes
An Armor item is considered to be a backpack if it is in the _Camp_Backpacks FormList.
GetPlayerEquippedAmmo
Gets the player's currently equipped ammo.
Api version added
1
Syntax
Ammo function GetPlayerEquippedAmmo() global
Parameters
None
Return Value
The player's currently equipped ammo.
Examples
Armor PlayerArrows = GetPlayerEquippedAmmo()
IsRefInInterior
Whether or not the reference is in an interior cell, or a cell that "looks like" an interior.
Api version added
1
Syntax
bool function IsRefInInterior(ObjectReference akReference) global
Parameters
- akReference: The object reference to check.
Return Value
True if the reference is in an interior or "interior-like" cell, false otherwise.
Examples
;Is the box in an interior?
if IsRefInInterior(Box)
Debug.Trace("Box is inside!")
endif
Notes
The standard IsInInterior() function can only return whether or not the current cell is marked as an Interior. There are numerous worldspaces (such as AlftandWorld, Blackreach, BlindCliffCaveWorld, etc) that look and act like interiors, but are set as external worldspaces. This can cause IsInInterior() to return undesirable results. This function takes these known base game (and DLC) worldspaces into account when evaluating the object reference's location.
GetTrackedFollower
Returns the tracked follower at the specified index.
Api version added
1
Syntax
Actor function GetTrackedFollower(int aiIndex) global
Parameters
- aiIndex: The index (1 - 3) to check. Returns None if index is out of range or there
is no follower filling the specified index.
Return Value
The Actor occupying this index, or None if no tracked follower in this index.
Examples
int i = 1
while i < 4
debug.trace("Follower " + i + " is " + CampUtil.GetTrackedFollower(i))
i += 1
endWhile
IsTrackedFollower
Whether or not this actor is a tracked follower.
Api version added
1
Syntax
bool function IsTrackedFollower(Actor akActor) global
Parameters
- akActor: The actor to check.
Return Value
True if this actor is a tracked follower; false if not.
Examples
if CampUtil.IsTrackedFollower(myActor)
debug.trace(myActor + " is a follower!")
endif
GetTrackedFollowerCount
Return the number of tracked followers.
Api version added
1
Syntax
int function GetTrackedFollowerCount() global
Parameters
None
Return Value
The number of followers currently being tracked, from 0 to 3.
Examples
debug.trace("I have " + CampUtil.GetTrackedFollowerCount() + " followers.")
GetTrackedAnimal
Returns the tracked animal in the player's service.
Api version added
1
Syntax
Actor function GetTrackedAnimal() global
Parameters
None
Return Value
The tracked animal Actor currently in the player's service, or None if no animal currently following the player.
Examples
debug.trace("My dog is " + CampUtil.GetTrackedAnimal())
IsTrackedAnimal
Whether or not the Actor is a tracked animal.
Api version added
1
Syntax
bool function IsTrackedAnimal(Actor akActor) global
Parameters
None
Return Value
True if the Actor is a tracked animal; False if not.
GetTrackedAnimalCount
Get the number of animals currently in the player's service.
Api version added
1
Syntax
int function GetTrackedAnimalCount() global
Parameters
None
Return Value
The number of animals currently being tracked, from 0 to 1.
Examples
debug.trace("I have " + CampUtil.GetTrackedAnimalCount() + " doggies.")
PlayerCanPlaceObjects
Whether or not the player can currently place Placeable Objects (tents, etc).
Api version added
1
Syntax
bool function PlayerCanPlaceObjects(bool abShowMessage = true, bool abPlayerBusyCheck = true) global
Parameters
abShowMessage: Whether to show an informative message detailing why the player can't place a Placeable Object right now if returning false.
abPlayerBusyCheck: Whether or not to check if the player is already placing an object.
Return Value
True if the player can currently place Placeable Objects, false otherwise.
Examples
if PlayerCanPlaceObjects()
debug.trace("The player can place objects!")
endif
Notes
Reasons that this function might return false are:
The player is already trying to place something.
The player is swimming.
The player is mounted.
The player is sleeping.
The player is sitting down.
The player is using another object (crafting bench, etc).
The player is currently transformed into a Vampire Lord or Werewolf.
IsPlayerPlacingObject
Whether or not the player is currently placing a Placeable Object (tent, etc).
Api version added
1
Syntax
bool function IsPlayerPlacingObject() global
Parameters
None
Return Value
True if the player is currently placing a Placeable Object, false otherwise.
Examples
if IsPlayerPlacingObject()
debug.trace("The player is placing an object right now!")
endif
LegalToCampHere
Whether or not the player's current location is considered a legal camping area.
Api version added
1
Syntax
bool function LegalToCampHere(bool abIgnoreSetting = false) global
Parameters
- abIgnoreSetting: Whether or not to ignore Campfire's "Camping Illegal in Settled Areas" setting. If true, returns the legality of the player's current position regardless of the setting.
Return Value
True if player's location is a legal camping area; false otherwise.
Examples
if !LegalToCampHere()
debug.trace("We can't stop here. This is bat country.")
endif
Notes
In Campfire, it is illegal for the player to place Placeable Objects inside houses, other owned buildings (inns, taverns), and within range of / inside settled areas like towns and cities.
GetAreaCampingFaction
Returns the faction that dictates camping legality in this area.
Api version added
1
Syntax
Faction function GetAreaCampingFaction(ObjectReference akCenter) global
Parameters
akCenter: The object whose surroundings to check.
Return Value
If akCenter is in an illegal camping area, returns the faction responsible for making it illegal, else, returns None.
Examples
Faction property MyCoolFaction auto
if GetAreaCampingFaction() == MyCoolFaction
debug.trace("MyCoolFaction are a bunch of facists for not letting me camp here!")
endif
GetLastUsedCampfire
Returns the last campfire used by the player.
Api version added
1
Syntax
ObjectReference function GetLastUsedCampfire() global
Parameters
None
Return Value
The last campfire used by the player, or None if it no longer exists.
GetCurrentTent
Returns the current tent being used.
Api version added
1
Syntax
ObjectReference function GetCurrentTent() global
Parameters
None
Return Value
The current tent being used, or None if the player is not using a tent.
IsTentWaterproof
Is this tent waterproof?
Api version added
1
Syntax
bool function IsTentWaterproof(ObjectReference akTent) global
Parameters
akTent: The Tent ObjectReference to check. Use the return value of GetCurrentTent(), or use IsCurrentTentWaterproof() instead.
Return Value
True if the tent is flagged as being waterproof, or false if not.
IsTentWarm
Is this tent warm?
Api version added
1
Syntax
bool function IsTentWarm(ObjectReference akTent) global
Parameters
akTent: The Tent ObjectReference to check. Use the return value of GetCurrentTent(), or use IsCurrentTentWarm() instead.
Return Value
True if the tent is flagged as being warm, or false if not.
TentHasShelter
Does this tent have shelter? (Used by Frostfall to determine if the player should warm up additionally when inside it.)
Api version added
3
Syntax
bool function TentHasShelter(ObjectReference akTent) global
Parameters
akTent: The Tent ObjectReference to check. Use the return value of GetCurrentTent(), or use CurrentTentHasShelter() instead.
Return Value
Whether or not this tent has shelter.
IsCurrentTentWaterproof
Is the current tent waterproof?
Api version added
2
Syntax
bool function IsCurrentTentWaterproof() global
Parameters
None
Return Value
True if the current tent is flagged as being waterproof, or false if not or if there is no tent in use by the player.
IsCurrentTentWarm
Is the current tent warm?
Api version added
2
Syntax
bool function IsCurrentTentWarm() global
Parameters
None
Return Value
True if the current tent is flagged as being warm, or false if not or if there is no tent in use by the player.
IsCurrentTentConjured
Is the current tent conjured?
Api version added
4
Syntax
bool function IsCurrentTentConjured() global
Parameters
None
Return Value
True if the current tent is flagged as being conjured, or false if not or if there is no tent in use by the player.
CurrentTentHasShelter
Does the current tent have shelter? (Used by Frostfall to determine if the player should warm up additionally when inside it.)
Api version added
3
Syntax
bool function CurrentTentHasShelter() global
Parameters
None
Return Value
Whether or not the current tent has shelter.
IsCrimeToPlaceInTowns
Is it a crime to place this base object in towns, inside owned houses, etc?
Api version added
1
Syntax
bool function IsCrimeToPlaceInTowns(Form akBaseObject) global
Parameters
akBaseObject: The base object to check.
Return Value
True if the Form is illegal to place in settled areas, or False if not.
Notes
This function returns true or false without regard to the current legality setting.
IsPlaceableObjectTemporary
Returns whether or not this placeable object does not spawn persistently (i.e. won't be cleaned up by a cell reset).
Api version added
2
Syntax
bool function IsPlaceableObjectTemporary(Form akBaseObject) global
Parameters
akBaseObject: The base object to check.
Return Value
True if the Form will spawn non-persistently, False if not.
IsPlaceableObjectConjured
Returns whether or not this placeable object is conjured.
Api version added
4
Syntax
bool function IsPlaceableObjectConjured(Form akBaseObject) global
Parameters
akBaseObject: The base object to check.
Return Value
True if the Form is conjured, False if not or not a placeable object.
RegisterPerkTree
Register a new Campfire perk tree.
Api version added
4
Syntax
bool function RegisterPerkTree(Activator akPerkNodeController, string asPluginName = "Unknown") global
Parameters
akPerkNodeController: The perk node controller to register. asPluginName: The plug-in name that this node controller is from. Only seen in Papyrus logs.
Return Value
True if the perk tree was successfully registered. Returns false if there is no available room for an additional perk tree.
Notes
Unless you have a specific reason to control the availability of the perk tree, you should use the CampPerkSystemRegister script on a Player ReferenceAlias instead of calling this function directly. See the Campfire Skill System Dev Kit tutorial for more info.
UnregisterPerkTree
Unregister a Campfire perk tree.
Api version added
4
Syntax
bool function UnregisterPerkTree(Activator akPerkNodeController, string asPluginName = "Unknown") global
Parameters
akPerkNodeController: The perk node controller to unregister. asPluginName: The mod / plug-in name that this node controller is from. Only seen in Papyrus logs.
Return Value
True if the perk tree was successfully unregistered. Returns false if the perk tree was not found.
Notes
In general, you do not need to manually unregister a perk tree. It will be automatically purged when the mod the node controller belongs to is uninstalled.
GetCampfireSettingBool
Returns the state of the given Campfire setting.
Api version added
2
Syntax
bool function GetCampfireSettingBool(string setting) global
Parameters
setting: The setting which you would like to retrieve. Accepted values (case-sensitive):
ManualFireLighting
CampingGearFlammable
TentRemovePlayerEquipment ; The master setting for whether or not to remove player gear in tents
TentRemovePlayerCuirass
TentRemovePlayerHelm
TentRemovePlayerGauntlets
TentRemovePlayerBoots
TentRemovePlayerBackpack
TentRemovePlayerWeapons
TentRemovePlayerShield
TentRemovePlayerAmmo
TentRemoveFollowerEquipment
FollowerTracking
FollowersUseCampsite
CampingIllegalInTowns
AdvancedPlacementMode
EquippingOverhaulCompatibility
Return Value
True if the feature is enabled, false if disabled or if the setting string is invalid.
Examples
if GetCampfireSettingBool("FollowerTracking") == true
debug.trace("Campfire is tracking followers.")
endif
GetCampfireSettingInt
Returns the value of the given Campfire setting.
Api version added
2
Syntax
int function GetCampfireSettingInt(string setting) global
Parameters
setting: The setting which you would like to retrieve. Accepted values (case-sensitive):
- MaxPlacementThreads
Return Value
The value of the setting, or -1 if the setting string was invalid.
Examples
if GetCampfireSettingInt("MaxPlacementThreads") > 5
debug.trace("Campfire is configured to use over 5 threads for placing objects.")
endif
Events
Campfire_OnObjectPlaced
An SKSE Mod Event that fires when the player places any Campfire placeable object (tents, containers, furniture, etc).
Api version added
2
Syntax
Event Campfire_OnObjectPlaced(Form akPlacedObject, float afPositionX, float afPositionY, float afPositionZ, float afAngleX, float afAngleY, float afAngleZ, bool abIsTent)
Parameters
akPlacedObject: The ObjectReference that was placed. Cast to an ObjectReference (i.e. akPlacedObject as ObjectReference). afXPos: The X position of the object. afYPos: The Y position of the object. afZPos: The Z position of the object. afXAng: The X angle of the object. afYAng: The Y angle of the object. afZAng: The Z angle of the object. abIsTent: Whether or not this object is a Campfire-based tent.
Examples
Event OnInit()
RegisterForModEvent("Campfire_OnObjectPlaced", "Campfire_OnObjectPlaced")
endEvent
Event Campfire_OnObjectPlaced(Form akPlacedObject, float afPositionX, float afPositionY, float afPositionZ, float afAngleX, float afAngleY, float afAngleZ, bool abIsTent)
if abIsTent
debug.trace("The player just placed a tent!")
endif
endEvent
Notes
This event will also be sent when a Campfire Perk Tree is displayed.
Campfire_OnObjectRemoved
An SKSE Mod Event that fires when the player picks up any Campfire placeable object (tents, containers, furniture, etc), or if that object is destroyed by fire.
Api version added
2
Syntax
Event Campfire_OnObjectRemoved(Form akBaseObject, float afPositionX, float afPositionY, float afPositionZ, float afAngleX, float afAngleY, float afAngleZ, bool abIsTent)
Parameters
akPlacedObject: The base object of the object that was removed. afPositionX: The X position of the object. afPositionY: The Y position of the object. afPositionZ: The Z position of the object. afAngleX: The X angle of the object. afAngleY: The Y angle of the object. afAngleZ: The Z angle of the object. abIsTent: Whether or not this object is a Campfire-based tent.
Examples
Event OnInit()
RegisterForModEvent("Campfire_OnObjectRemoved", "Campfire_OnObjectRemoved")
endEvent
Event Campfire_OnObjectRemoved(Form akBaseObject, float afPositionX, float afPositionY, float afPositionZ, float afAngleX, float afAngleY, float afAngleZ, bool abIsTent)
if abIsTent
debug.trace("The player just removed a tent!")
endif
endEvent
Notes
This event does not send the object reference of the object picked up as a parameter because, by the time this event is sent, the reference no longer exists. This event will also be sent when a Campfire Perk Tree is exited.
Campfire_OnBedrollSitLay
An SKSE Mod Event that fires when the player sits down, lies down, or gets up from sitting or laying in a Campfire tent or bed roll.
Api version added
2
Syntax
Event Campfire_OnBedrollSitLay(Form akTent, bool abGettingUp)
Parameters
akTent: The tent the player is sitting on, laying on, or getting up from. Cast to an ObjectReference (i.e. akTent as ObjectReference). abGettingUp: Whether or not the player is getting up from this tent or bed roll.
Examples
Event OnInit()
RegisterForModEvent("Campfire_OnBedrollSitLay", "Campfire_OnBedrollSitLay")
endEvent
Event Campfire_OnBedrollSitLay(Form akTent, bool abGettingUp)
if abGettingUp
debug.trace("The player just got up!")
endif
endEvent
Campfire_OnTentEnter
An SKSE Mod Event that fires when the player "enters" a tent.
Api version added
2
Syntax
Event Campfire_OnTentEnter(Form akTent, bool abHasShelter)
Parameters
akTent: The tent the player just "entered". Cast to an ObjectReference (i.e. akTent as ObjectReference). abHasShelter: Whether or not the tent the player entered has overhead shelter of some kind.
Examples
Event OnInit()
RegisterForModEvent("Campfire_OnTentEnter", "Campfire_OnTentEnter")
endEvent
Event Campfire_OnTentEnter(Form akTent, bool abHasShelter)
if abHasShelter
debug.trace("It's going to be a cold night...")
endif
endEvent
Notes
For some tents created with the Campfire Dev Kit, this event may not fire as soon as the player physically enters the tent. It will instead be sent when the player sits or lies down on their bed roll. (Reason: TentAsset_LargeTentTriggerVolume has not been set.)
Campfire_OnTentLeave
An SKSE Mod Event that fires when the player "leaves" a tent.
Api version added
2
Syntax
Event Campfire_OnTentLeave()
Parameters
None.
Examples
Event OnInit()
RegisterForModEvent("Campfire_OnTentLeave", "Campfire_OnTentLeave")
endEvent
Event Campfire_OnTentLeave()
debug.trace("Back to adventuring!")
endEvent
Notes
This event may fire multiple times for the same tent. This can happen for a number of reasons, such as if the player is standing inside the tent when picking it up. For some tents created with the Campfire Dev Kit, this event may not fire as soon as the player physically enters the tent. It will instead be sent when the player gets up from sitting or lying down on their bed roll. (Reason: TentAsset_LargeTentTriggerVolume has not been set.)
Campfire_Loaded
An SKSE Mod Event that is raised when Campfire is finished starting up, or after loading a save game with Campfire enabled.
Api version added
4
Syntax
Event Campfire_Loaded()
Parameters
None
Examples
Event OnInit()
RegisterForModEvent("Campfire_Loaded", "Campfire_Loaded")
endEvent
Event Campfire_Loaded()
debug.notification("Campfire has finished starting up!")
endEvent
Notes
This event will be raised almost immediately after game start-up, as Campfire is always enabled if loaded.