Osiris API Tips Queries
Contents
- 1 Queries
- 1.1 CharacterGetEquippedItem
- 1.2 CharacterGetHenchmanPresetPrice
- 1.3 CharacterIsAlly
- 1.4 CharacterIsEnemy
- 1.5 CharacterIsNeutral
- 1.6 CharacterIsPartyFollower
- 1.7 CharacterIsPlayer
- 1.8 CharacterIsSummon
- 1.9 GetClosestAlivePlayer
- 1.10 GetDistanceTo
- 1.11 GetInventoryOwner
- 1.12 GetRandomPositionInTrigger
- 1.13 HasActiveStatus
- 1.14 HasAppliedStatus
- 1.15 IsSpeakerReserved
- 1.16 ItemIsInInventory
Queries
Queries request information about the state of the world from Osiris. They can be used in the part of a rule that checks conditions. Queries almost always succeed, except if you pass an initialised value as an [out] parameter and it does not match the value the query would returns. Below, this will be called the Default Return Value. If a query can also fail under other circumstances, this will be mentioned.
CharacterGetEquippedItem
Full definitions
- query CharacterGetEquippedItem([in](CHARACTERGUID)_Character, [in](STRING)_Slotname, [out](GUIDSTRING)_ItemGUID)
Description
Returns in _ItemGUID the item equipped by _Character in slot _Slotname, if any.
Return values
- <b><b>Success/Failure: </b></b>Fails if _Character does not exist, or if no item is equipped in _Slotname.
- _ItemGuid: The item equipped by _Character in _Slotname.
</ul>
- The valid values for _Slotname are: Helmet, Amulet, Breast, Belt, Gloves, Leggings, Boots, Weapon, Shield, Ring, Ring2.
- CharacterUnequipItem
- query CharacterGetHenchmanPresetPrice([in](STRING)_Preset, [in](CHARACTERGUID)_Character, [out](INTEGER)_Price)
- _Price: The price of the preset scaled to the level of _Character.
- Presets come from the folder ".../DOS2/Data/Mods/Shared/CharacterCreation/HenchmanPresets/"
- Presets can be customized using the following documentation: link
- CharacterApplyHenchmanPreset
- query CharacterIsAlly([in](CHARACTERGUID)_Character, <i><b>[in]</b>(CHARACTERGUID)</i><b>_OtherCharacter</b>,<i><b> [out]</b></i>(INTEGER)_Bool) </ul>
- <b><b>Success/Failure:</b></b> Default return value.
- _Bool: 1 if _Character and _OtherCharacter are allies, 0 if not.
</ul>
- Also works outside combat.
- If _Character or _OtherCharacter is dead or dying, the result solely depends on the characters' alignments (factions). If they are alive, it is also influenced by temporary hostile relations, e.g. induced by attacking a neutral character.
- CharacterIsNeutral
- CharacterIsEnemy
- See CharacterIsAlly for detailed information, except that this query returns whether the characters are enemies.
- CharacterIsAlly
- CharacterIsEnemy
- See CharacterIsAlly for detailed information, except that this query returns whether the characters are neutral.
- CharacterIsAlly
- CharacterIsEnemy
- query CharacterIsPartyFollower([in](CHARACTERGUID)_Character, [out](INTEGER)_Bool)
- <b><b>Success/Failure: </b></b>Fails if _Character does not exist.
- _Bool: 1 if _Character is a party follower, 0 if not.
</ul>
- CharacterIsPlayer will also return true for party followers.
- CharacterIsPlayer
- CharacterFollowCharacter
- query CharacterIsPlayer([in](CHARACTERGUID)_Character, [out](INTEGER)_Bool)
- <b><b>Success/Failure: </b></b>Fails if _Character does not exist.
- _Bool: 1 if _Character is player-controlled, 0 if not.
</ul>
- Apart from avatars and recruited companions, player-controlled characters also include summons and followers.
- CharacterIsPartyFollower
- CharacterIsSummon
- CharacterFollowCharacter
- query CharacterIsSummon([in](CHARACTERGUID)_Character, [out](INTEGER)_Bool)
- <b><b>Success/Failure: </b></b>Fails if _Character does not exist.
- _Bool: 1 if _Character is a summon, 0 if not.
</ul>
- Summons can also be distinguished by the fact that hey have the SUMMON tag.
- If you wish to know whether a summon is player-controlled, also check CharacterIsPlayer.
- CharacterIsPlayer
- query GetClosestAlivePlayer([in](GUIDSTRING)_Target, [out](CHARACTERGUID)_Player)
- <b><b><b>Success/Failure: </b></b></b>Fails if no living player is found.
- _Player: The found player character.
</ul>
- Be careful if you check for extra conditions on the returned player: if any of those conditions fail, no other players will be considered.
- If you want to start a dialog, use ProcGetClosestAvailableCharacterTo
- Helper ProcGetClosestAvailableCharacterTo
- query GetDistanceTo([in](GUIDSTRING)_Object1, [in](GUIDSTRING)_Object2, [out](REAL)_Dist)
- Success/Failure: Fails if if either _Object1 or _Object2 is in a container or in an inventory. Use ItemIsInInventory to check for this.
- _Dist: The distance in metres.
- /
- ItemIsInInventory
- query GetInventoryOwner([in](ITEMGUID)_Item, [out](GUIDSTRING)_Owner)
- Success/Failure: Fails if _Item is not in anyone's inventory nor in a container.
- _Owner: The character or item in whose inventory the item currently resides.
- This call returns the outermost container. I.e., if a character has crate in their inventory, and the crate contains a pouch with the item, this call will return the character.
- ItemIsInInventory
- query GetRandomPositionInTrigger([in](TRIGGERGUID)_Trigger, [out](REAL)_X, [out](REAL)_Y, [out](REAL)_Z)
- Success/Failure: Default return value.
- _Trigger: A box trigger inside which the random position should be gotten.
- _X, _Y, _Z: the coordinates of the random position
- This routine will first get a random position in the trigger, and if this random position is not valid on the AI-grid, the coordinates will be snapped to a nearby valid position on the AI-grid.
- This call does not work for polytriggers
- /
- query HasActiveStatus([in](GUIDSTRING)_Target, [in](STRING)_Status, [out](INTEGER)_Bool)
- Success/Failure: Default return value.
- _Bool: 0 if _Target is currently not under the influence of _Status, 1 if it is.
- /
- HasAppliedStatus
- query HasAppliedStatus([in](GUIDSTRING)_Target, [in](STRING)_Status, [out](INTEGER)_Bool)
- <b>Success/Failure: </b>Default return value.
- _Bool: 0 if _Status has not been applied to _Target, 1 if it has been.
</ul>
- In virtually all cases, use HasActiveStatus instead. The main purpose of this query is for crime reactions, and is only needed due to frame delays between code and Osiris.
- HasActiveStatus
- query IsSpeakerReserved([in](GUIDSTRING)_Speaker, [out](INTEGER)_success)
- <b>Success/Failure: </b>Default return value.
- _success: 0 if _Speaker is currently not in a dialog, 1 otherwise.
</ul>
- /
- DialogStartRequested
- Proc_StartDialog
- query ItemIsInInventory([in](ITEMGUID)_Item, [out](INTEGER)_Bool)
- <b>Success/Failure: </b>Default return value.
- _Bool: 0 if _Item is not in an inventory (as defined above), 1 if it is.
</ul>
- /
- GetInventoryOwner
Notes
See also
CharacterGetHenchmanPresetPrice
Full definitions
Description
Returns the price of the preset scaled to the level of _Character.
Return values
Notes
See also
CharacterIsAlly
Full definitions
Description
Returns whether _Character is an ally of _OtherCharacter.
Return values
Notes
See also
CharacterIsEnemy
Notes
See also
CharacterIsNeutral
Notes
See also
CharacterIsPartyFollower
Full definitions
Description
</div>
Returns whether _Character is a character that follows a player character around. An NPC can be instructed to do so through CharacterFollowCharacter.
Return values
Notes
See also
CharacterIsPlayer
Full definitions
Description
</div>
Returns whether _Character is player-controlled.
Return values
Notes
See also
CharacterIsSummon
Full definitions
Description
Returns whether _Character is a summon. Summon can be player-controlled or not.
Return values
Notes
See also
GetClosestAlivePlayer
Full definitions
Description
</div>
Gets the closest player to _Target that is alive and stores it in _Player.
Return values
Notes
See also
GetDistanceTo
Full definitions
Description
Calculates the distance between _Object1 and _Object2.
Return values
Notes
See also
GetInventoryOwner
Full definitions
Description
Returns the inventory/container that holds _Item in _Owner.
Return values
Notes
See also
GetRandomPositionInTrigger
Full definitions
Description
Returns a random position that is valid on the AI-grid inside _Trigger.
Return values
Notes
See also
HasActiveStatus
Full definitions
Description
Returns whether _Target is currently under the influence of _Status.
Return values
Notes
See also
HasAppliedStatus
Full definitions
Description
Returns whether _Status has been applied to _Target. _Target may or may not yet actually be under its influence.
Return values
Notes
See also
IsSpeakerReserved
Full definitions
Description
Returns whether _Speaker is already in a dialog.
Return values
Notes
See also
ItemIsInInventory
Full definitions
Description
Returns whether _Item is in an inventory. This includes both character and container inventories.
Return values
Notes
See also
</div>