Scripting Documentation

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

ORK: Okashi RPG Kit for Unity Scripting Documentation

Scripting Documentation

1
ORK: Okashi RPG Kit for Unity Scripting Documentation

Contents
1 About Scripting With ORK..................................................................................................3
1.1 Getting Data From ORK.............................................................................................3
1.2 Developing Own Scripts.............................................................................................4
2 Data Holder........................................................................................................................5
2.1 Area Names................................................................................................................6
2.2 Armors.........................................................................................................................6
2.3 Battle Animations........................................................................................................7
2.4 Battle System..............................................................................................................7
2.5 Camera Positions.......................................................................................................7
2.6 Characters..................................................................................................................7
2.7 Classes.......................................................................................................................8
2.8 Colors (Text Colors)....................................................................................................8
2.9 Dialogue Positions......................................................................................................9
2.10 Elements...................................................................................................................9
2.11 Enemy AI.................................................................................................................10
2.12 Enemies..................................................................................................................10
2.13 Equipment Parts.....................................................................................................10
2.14 Formulas.................................................................................................................11
2.15 Game Settings........................................................................................................11
2.16 HUDs.......................................................................................................................11
2.17 Items.......................................................................................................................12
2.18 Item Types..............................................................................................................12
2.19 Languages..............................................................................................................13
2.20 Load Save HUD......................................................................................................13
2.21 Main Menu..............................................................................................................13
2.22 Skills........................................................................................................................13
2.23 Skill Types...............................................................................................................14
2.24 Status Effects..........................................................................................................14
2.25 Status Values..........................................................................................................15
2.26 Weapons.................................................................................................................15
2.27 Music.......................................................................................................................16
3 Game Handler..................................................................................................................17
3.1 Game Over, Handlers...............................................................................................17
3.2 Pause Game.............................................................................................................17
3.3 Language..................................................................................................................18
3.4 Control Modes..........................................................................................................18
3.5 Area Name................................................................................................................18
3.6 Game Time...............................................................................................................19
3.7 Party..........................................................................................................................19
3.8 Items.........................................................................................................................19
3.9 Weapons...................................................................................................................20
3.10 Armors.....................................................................................................................20
3.11 Money.....................................................................................................................21
3.12 Game Variables......................................................................................................21

2
ORK: Okashi RPG Kit for Unity Scripting Documentation

1 About Scripting With ORK


There is one simple rule when you want to code your own scripts for ORK or change some
of the scripts ORK comes with:

Don't do it unless you know what you are doing!

This rule especially applies if you want to change scripts that are part of ORK itself, since
you could make the complete RPG Kit unusable and destroy the data of your project!
When you create new scripts, its not as dangerous, but could lead to weird side effects.

1.1 Getting Data From ORK


ORK is designed to allow easy access to the data you set up with it – it uses singleton
holder/handler classes that can deliver you all the data you need to extend the RPG Kit.
These holder/handler classes are used in the editor and in a running game for accessing
the data of your project.
There are the following holders and handlers in ORK:
• Data holder
The data holder is used to access all data you set up with ORK (e.g. items,
characters, dialogue positions, etc.).
• Game handler
The game handler is used to handle the status of a playing game (e.g. inventory,
variables, etc.). It initializes the party handler, music handler and level handler.
• Party handler
The party handler is used to handle the party of the player. It is accessed via the
game handler and initialized by it. You should rather use the event system to access
the party handler's functionality.
• Music handler
The music handler is responsible for playing and fading music clips. Music clips can
be defined in the music editor. You should rather use the MusicPlayer component
or game events to access its functionality.
It is accessed via the game handler and initialized by it. It's attached to a
GameObject that's set to DontDestroyOnLoad, which means it wont be destroyed
if a new level is loaded.
• Save handler
The save handler is used for saving and loading a save game. You should rather
use the SavePoint component to access its functionality.
• Level handler
The level handler is responsible for screen fades and displaying HUDs, dialogues,
etc. - don't touch it, it's very complex and tricky!

3
ORK: Okashi RPG Kit for Unity Scripting Documentation

The level handler will be automatically created when the game handler is initialized.
It's attached to a GameObject that's set to DontDestroyOnLoad, which means it
wont be destroyed if a new level is loaded.

1.2 Developing Own Scripts


When developing your own scripts you should make them dependent on certain
functionality of ORK.
Especially the game handler's control mode and game pause functions are crucial for
depending on certain states of ORK.

E.g. for developing your own players control by using Unity's MonoBehaviour.Update
function:
Make the whole code in the Update function depending on
GameHandler.IsControlField() and !GameHandler.IsGamePaused(). This will prevent
your player controls from being executed in events or battles – the controls would be only
enabled in Field mode and if the game isn't paused.

The same is needed for your own camera system. To prevent your camera system from
interfering with cinematic events (using camera functionality), you need to make your
camera scripts depending on the game handler's control mode functions too (e.g.
IsControlField or IsControlEvent).

The following control modes exist in ORK:


• None
No control whatsoever. This type is used when switching between field and battle
control (and back) and when changing scenes (using the SceneChanger
component).
• Field
You have control over your character, can move around and interact with objects.
• Battle
Used in battles. Your control is limited to the battle menu's.
• Event
Used in events that block the game controls. Your control is limited to accepting
dialogues and selecting choices.
• Menu
Used in the main menu. Will be later used in a game menu add on.
• Save
Used when interacting with save points and the load/save HUD.

4
ORK: Okashi RPG Kit for Unity Scripting Documentation

2 Data Holder
Use the data holder to access the data of your project. It holds the data to the following
data:
• Area names
• Armors
• Battle animations
• Battle system
• Camera positions
• Characters
• Classes
• Colors (text colors)
• Dialogue positions
• Elements
• Enemy AI
• Enemies
• Equipment parts
• Formulas
• Game settings
• HUDs
• Items
• Item types
• Languages
• Load save HUD
• Main menu
• Music
• Skills
• Skill types
• Status effects
• Status values
• Weapons
The following chapters describe the functions (methods) to use.

5
ORK: Okashi RPG Kit for Unity Scripting Documentation

2.1 Area Names


DataHolder.AreaNames().GetDataCount()
Returns the number of area names as an int.
DataHolder.AreaName(int index) or DataHolder.AreaNames().GetName(int index)
Returns the name of area name at index as a string. It will be returned in the currently
active language.
DataHolder.AreaNames().GetDescription(int index)
Returns the description of area name at index as a string. It will be returned in the currently
active language.
DataHolder.AreaNames().GetIcon(int index)
Returns the icon of area name at index as a Texture2D.
DataHolder.AreaNames().GetContent(int index)
Returns the name and icon of area name at index as a GUIContent. It will be returned in
the currently active language.
DataHolder.AreaNames().GetNameList(boolean showIDs)
Returns a list of names of all area names as a string-array. If showIDs is true, the names
will have their index at the start of the string.

2.2 Armors
DataHolder.Armors().GetDataCount()
Returns the number of armors as an int.
DataHolder.Armor(int index)
Returns the armor at index as an Armor.
DataHolder.Armor(int index).GetPrefabInstance()
Instantiates a GameObject from the prefab of armor at index and returns it.
DataHolder.Armors().GetName(int index)
Returns the name of armor at index as a string. It will be returned in the currently active
language.
DataHolder.Armors().GetDescription(int index)
Returns the description of armor at index as a string. It will be returned in the currently
active language.
DataHolder.Armors().GetIcon(int index)
Returns the icon of armor at index as a Texture2D.
DataHolder.Armors().GetContent(int index)
Returns the name and icon of armor at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Armors().GetNameList(boolean showIDs)
Returns a list of names of all armors as a string-array. If showIDs is true, the names will
have their index at the start of the string.

6
ORK: Okashi RPG Kit for Unity Scripting Documentation

2.3 Battle Animations


DataHolder.BattleAnimations().GetDataCount()
Returns the number of battle animations as an int.
DataHolder.BattleAnimation(int index)
Returns the battle animation at index as a BattleAnimation.
DataHolder.BattleAnimations().GetName(int index)
Returns the name of battle animation at index as a string.
DataHolder.BattleAnimations().GetNameList(boolean showIDs)
Returns a list of names of all battle animations as a string-array. If showIDs is true, the
names will have their index at the start of the string.

2.4 Battle System


DataHolder.BattleSystem()
Returns BattleSystemData which holds everything related to the battle system of ORK.
Don't mess with it – highly complex!

2.5 Camera Positions


DataHolder.CameraPositions().GetDataCount()
Returns the number of camera positions as an int.
DataHolder.CameraPosition(int index)
Returns the camera position at index as a CameraPosition.
DataHolder.CameraPositions().GetName(int index)
Returns the name of camera position at index as a string.
DataHolder.CameraPositions().GetNameList(boolean showIDs)
Returns a list of names of all camera positions as a string-array. If showIDs is true, the
names will have their index at the start of the string.

2.6 Characters
DataHolder.Characters().GetDataCount()
Returns the number of characters as an int.
DataHolder.Character(int index)
Returns the character at index as a Character.
DataHolder.Character(int index).CreatePrefabInstance()
Instantiates a GameObject from the prefab of character at index and returns it. If the
character already holds an instance of it's prefab, the old instance will be destroyed.
DataHolder.Characters().GetName(int index)
Returns the name of character at index as a string. It will be returned in the currently active

7
ORK: Okashi RPG Kit for Unity Scripting Documentation

language.
DataHolder.Characters().GetDescription(int index)
Returns the description of character at index as a string. It will be returned in the currently
active language.
DataHolder.Characters().GetIcon(int index)
Returns the icon of character at index as a Texture2D.
DataHolder.Characters().GetContent(int index)
Returns the name and icon of character at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Characters().GetNameList(boolean showIDs)
Returns a list of names of all characters as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.7 Classes
DataHolder.Classes().GetDataCount()
Returns the number of classes as an int.
DataHolder.Class(int index)
Returns the class at index as a Class.
DataHolder.Classes().GetName(int index)
Returns the name of class at index as a string. It will be returned in the currently active
language.
DataHolder.Classes().GetDescription(int index)
Returns the description of class at index as a string. It will be returned in the currently
active language.
DataHolder.Classes().GetIcon(int index)
Returns the icon of class at index as a Texture2D.
DataHolder.Classes().GetContent(int index)
Returns the name and icon of class at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Classes().GetNameList(boolean showIDs)
Returns a list of names of all classes as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.8 Colors (Text Colors)


DataHolder.Colors().GetDataCount()
Returns the number of text colors as an int.
DataHolder.Color(int index)
Returns the text color at index as a Color.

8
ORK: Okashi RPG Kit for Unity Scripting Documentation

DataHolder.Colors().GetName(int index)
Returns the name of text color at index as a string.
DataHolder.Colors().GetNameList(boolean showIDs)
Returns a list of names of all text colors as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.9 Dialogue Positions


DataHolder.DialoguePositions().GetDataCount()
Returns the number of dialogue positions as an int.
DataHolder.DialoguePosition(int index)
Returns the dialogue position at index as a DialoguePosition.
DataHolder.DialoguePositions().GetName(int index)
Returns the name of dialogue position at index as a string.
DataHolder.DialoguePositions().GetNameList(boolean showIDs)
Returns a list of names of all dialogue positions as a string-array. If showIDs is true, the
names will have their index at the start of the string.

2.10 Elements
DataHolder.Elements().GetDataCount()
Returns the number of elements as an int.
DataHolder.Element(int index) or DataHolder.Elements().GetName(int index)
Returns the name of element at index as a string. It will be returned in the currently active
language.
DataHolder.Elements().GetDescription(int index)
Returns the description of element at index as a string. It will be returned in the currently
active language.
DataHolder.Elements().GetIcon(int index)
Returns the icon of element at index as a Texture2D.
DataHolder.Elements().GetContent(int index)
Returns the name and icon of element at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Elements().GetNameList(boolean showIDs)
Returns a list of names of all elements as a string-array. If showIDs is true, the names will
have their index at the start of the string.

9
ORK: Okashi RPG Kit for Unity Scripting Documentation

2.11 Enemy AI
DataHolder.EnemyAIs().GetDataCount()
Returns the number of enemy AIs as an int.
DataHolder.EnemyAI(int index)
Returns the enemy AI at index as a EnemyAI.
DataHolder.EnemyAIs().GetName(int index)
Returns the name of enemy AI at index as a string.
DataHolder.EnemyAIs().GetNameList(boolean showIDs)
Returns a list of names of all enemy AIs as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.12 Enemies
DataHolder.Enemies().GetDataCount()
Returns the number of enemies as an int.
DataHolder.Enemy(int index)
Returns the enemy at index as a Enemy.
DataHolder.Enemy(int index).CreatePrefabInstance()
Instantiates a GameObject from the prefab of enemy at index and returns it. If the enemy
already holds an instance of it's prefab, the old instance will be destroyed.
DataHolder.Enemies().GetName(int index)
Returns the name of enemy at index as a string. It will be returned in the currently active
language.
DataHolder.Enemies().GetDescription(int index)
Returns the description of enemy at index as a string. It will be returned in the currently
active language.
DataHolder.Enemies().GetIcon(int index)
Returns the icon of enemy at index as a Texture2D.
DataHolder.Enemies().GetContent(int index)
Returns the name and icon of enemy at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Enemies().GetNameList(boolean showIDs)
Returns a list of names of all enemies as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.13 Equipment Parts


DataHolder.EquipmentParts().GetDataCount()
Returns the number of equipment parts as an int.

10
ORK: Okashi RPG Kit for Unity Scripting Documentation

DataHolder.EquipmentPart(int index) or DataHolder.Elements().EquipmentParts(int


index)
Returns the name of equipment part at index as a string. It will be returned in the currently
active language.
DataHolder.EquipmentParts().GetDescription(int index)
Returns the description of equipment part at index as a string. It will be returned in the
currently active language.
DataHolder.EquipmentParts().GetIcon(int index)
Returns the icon of equipment part at index as a Texture2D.
DataHolder.EquipmentParts().GetContent(int index)
Returns the name and icon of equipment part at index as a GUIContent. It will be returned
in the currently active language.
DataHolder.EquipmentParts().GetNameList(boolean showIDs)
Returns a list of names of all equipment parts as a string-array. If showIDs is true, the
names will have their index at the start of the string.

2.14 Formulas
DataHolder.Formulas().GetDataCount()
Returns the number of formulas as an int.
DataHolder.Formula(int index)
Returns the formula at index as a Formula.
DataHolder.Formulas().GetName(int index)
Returns the name of formula at index as a string.
DataHolder.Formulas().GetNameList(boolean showIDs)
Returns a list of names of all formulas as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.15 Game Settings


DataHolder.GameSettings()
Returns the game settings as a GameSettingsData.

2.16 HUDs
DataHolder.HUDs().GetDataCount()
Returns the number of HUDs as an int.
DataHolder.HUD(int index)
Returns the HUD at index as a HUD.
DataHolder.HUDs().GetName(int index)

11
ORK: Okashi RPG Kit for Unity Scripting Documentation

Returns the name of HUD at index as a string.


DataHolder.HUDs().GetNameList(boolean showIDs)
Returns a list of names of all HUDs as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.17 Items
DataHolder.Items().GetDataCount()
Returns the number of items as an int.
DataHolder.Item(int index)
Returns the item at index as an Item.
DataHolder.Item(int index).Use(Combatant user, Combatant target)
User uses the item at index on target. A Combatant can be a Character or Enemy.
DataHolder.Items().GetName(int index)
Returns the name of item at index as a string. It will be returned in the currently active
language.
DataHolder.Items().GetDescription(int index)
Returns the description of item at index as a string. It will be returned in the currently active
language.
DataHolder.Items().GetIcon(int index)
Returns the icon of item at index as a Texture2D.
DataHolder.Items().GetContent(int index)
Returns the name and icon of item at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Items().GetNameList(boolean showIDs)
Returns a list of names of all items as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.18 Item Types


DataHolder.ItemTypes().GetDataCount()
Returns the number of item types as an int.
DataHolder.ItemType(int index) or DataHolder.ItemTypes().GetName(int index)
Returns the name of item type at index as a string. It will be returned in the currently active
language.
DataHolder.ItemTypes().GetDescription(int index)
Returns the description of item type at index as a string. It will be returned in the currently
active language.
DataHolder.ItemTypes().GetIcon(int index)
Returns the icon of item type at index as a Texture2D.

12
ORK: Okashi RPG Kit for Unity Scripting Documentation

DataHolder.ItemTypes().GetContent(int index)
Returns the name and icon of item type at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.ItemTypes().GetNameList(boolean showIDs)
Returns a list of names of all item types as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.19 Languages
DataHolder.Languages().GetDataCount()
Returns the number of languages as an int.
DataHolder.Language(int index) or DataHolder.Languages().GetName(int index)
Returns the name of language at index as a string.
DataHolder.Languages().GetNameList(boolean showIDs)
Returns a list of names of all languages as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.20 Load Save HUD


DataHolder.LoadSaveHUD()
Returns the load save HUD settings as a LoadSaveHUDData.

2.21 Main Menu


DataHolder.MainMenu()
Returns the main menu settings as a MainMenuData.

2.22 Skills
DataHolder.Skills().GetDataCount()
Returns the number of skills as an int.
DataHolder.Skill(int index)
Returns the skill at index as a Skill.
DataHolder.Skill(int index).Use(Combatant user, Combatant target)
User uses the skill at index on target. A Combatant can be a Character or Enemy.
DataHolder.Skills().GetName(int index)
Returns the name of item at skill as a string. It will be returned in the currently active
language.
DataHolder.Skills().GetDescription(int index)
Returns the description of skill at index as a string. It will be returned in the currently active

13
ORK: Okashi RPG Kit for Unity Scripting Documentation

language.
DataHolder.Skills().GetIcon(int index)
Returns the icon of skill at index as a Texture2D.
DataHolder.Skills().GetContent(int index)
Returns the name and icon of skill at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Skills().GetNameList(boolean showIDs)
Returns a list of names of all skills as a string-array. If showIDs is true, the names will have
their index at the start of the string.

2.23 Skill Types


DataHolder.SkillTypes().GetDataCount()
Returns the number of skill types as an int.
DataHolder.SkillType(int index) or DataHolder.SkillTypes().GetName(int index)
Returns the name of skill type at index as a string. It will be returned in the currently active
language.
DataHolder.SkillTypes().GetDescription(int index)
Returns the description of skill type at index as a string. It will be returned in the currently
active language.
DataHolder.SkillTypes().GetIcon(int index)
Returns the icon of skill type at index as a Texture2D.
DataHolder.SkillTypes().GetContent(int index)
Returns the name and icon of skill type at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.SkillTypes().GetNameList(boolean showIDs)
Returns a list of names of all skill types as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.24 Status Effects


DataHolder.Effects().GetDataCount()
Returns the number of status effects as an int.
DataHolder.Effect(int index)
Returns the status effect at index as a StatusEffect.
DataHolder.Effects().GetName(int index)
Returns the name of status effect at skill as a string. It will be returned in the currently
active language.
DataHolder.Effects().GetDescription(int index)
Returns the description of status effect at index as a string. It will be returned in the
currently active language.

14
ORK: Okashi RPG Kit for Unity Scripting Documentation

DataHolder.Effects().GetIcon(int index)
Returns the icon of status effect at index as a Texture2D.
DataHolder.Effects().GetContent(int index)
Returns the name and icon of status effect at index as a GUIContent. It will be returned in
the currently active language.
DataHolder.Effects().GetNameList(boolean showIDs)
Returns a list of names of all status effects as a string-array. If showIDs is true, the names
will have their index at the start of the string.

2.25 Status Values


DataHolder.StatusValues().GetDataCount()
Returns the number of status values as an int.
DataHolder.StatusValue(int index)
Returns the status value at index as a StatusValue.
DataHolder.StatusValues().GetName(int index)
Returns the name of status value at skill as a string. It will be returned in the currently
active language.
DataHolder.StatusValues().GetDescription(int index)
Returns the description of status value at index as a string. It will be returned in the
currently active language.
DataHolder.StatusValues().GetIcon(int index)
Returns the icon of status value at index as a Texture2D.
DataHolder.StatusValues().GetContent(int index)
Returns the name and icon of status value at index as a GUIContent. It will be returned in
the currently active language.
DataHolder.StatusValues().GetNameList(boolean showIDs)
Returns a list of names of all status values as a string-array. If showIDs is true, the names
will have their index at the start of the string.

2.26 Weapons
DataHolder.Weapons().GetDataCount()
Returns the number of weapons as an int.
DataHolder.Weapon(int index)
Returns the weapon at index as an Weapon.
DataHolder.Weapon(int index).GetPrefabInstance()
Instantiates a GameObject from the prefab of weapon at index and returns it.
DataHolder.Weapons().GetName(int index)
Returns the name of weapon at index as a string. It will be returned in the currently active
language.

15
ORK: Okashi RPG Kit for Unity Scripting Documentation

DataHolder.Weapons().GetDescription(int index)
Returns the description of weapon at index as a string. It will be returned in the currently
active language.
DataHolder.Weapons().GetIcon(int index)
Returns the icon of weapon at index as a Texture2D.
DataHolder.Weapons().GetContent(int index)
Returns the name and icon of weapon at index as a GUIContent. It will be returned in the
currently active language.
DataHolder.Weapons().GetNameList(boolean showIDs)
Returns a list of names of all weapons as a string-array. If showIDs is true, the names will
have their index at the start of the string.

2.27 Music
DataHolder.Music().GetDataCount()
Returns the number of music clips as an int.
DataHolder.MusicClip(int index)
Returns the music clip at index as a MusicClip.
DataHolder.Music().GetName(int index)
Returns the name of music clip at index as a string.
DataHolder.Music().GetNameList(boolean showIDs)
Returns a list of names of all music clips as a string-array. If showIDs is true, the names
will have their index at the start of the string.

16
ORK: Okashi RPG Kit for Unity Scripting Documentation

3 Game Handler
Use the game handler to access data of a running game. The following data can be
accessed:
• Game paused
• Current language
• Current control mode
• Current area name
• Current game time
• Party handler
• Music handler
• Level handler
• Items (inventory)
• Weapons (inventory)
• Armors (inventory)
• Money (party funds)
• Game Variables

3.1 Game Over, Handlers


GameHandler.GameOver()
Ends the current running game and loads the game over scene.
GameHandler.GetLevelHandler()
Returns the level handler.
GameHandler.GetMusicHandler()
Returns the music handler.

3.2 Pause Game


GameHandler.PauseGame(boolean pause)
Sets the game handler's pause flag. This function is automatically called from the level
handler, if the OnApplicationPause function is called.
GameHandler.IsGamePaused()
Returns the game handler's pause flag status as a boolean. True if the game is paused,
false otherwise.

17
ORK: Okashi RPG Kit for Unity Scripting Documentation

3.3 Language
GameHandler.GetLanguage()
Returns the current language index as an int.
GameHandler.SetLanguage(int id)
Sets the current language index to id.

3.4 Control Modes


GameHandler.GetControlType()
Returns the current control mode of the game as a ControlType.
GameHandler.SetControlType(ControlType ct)
Sets the current control mode of the game to ct.
GameHandler.IsControlNone()
Returns true if the current control mode is None.
GameHandler.IsControlField()
Returns true if the current control mode is Field.
GameHandler.IsControlBattle()
Returns true if the current control mode is Battle.
GameHandler.IsControlEvent()
Returns true if the current control mode is Event.
GameHandler.IsControlMenu()
Returns true if the current control mode is Menu.
GameHandler.IsControlSave()
Returns true if the current control mode is Save.

3.5 Area Name


GameHandler.GetAreaName()
Returns the name of the current area name as a string. It will be returned in the currently
active language.
GameHandler.GetAreaNameID()
Returns the ID of the current area name as an int.
GameHandler.SetAreaNameID(int id)
Sets the current area name to id.
GameHandler.SetAreaName(int id)
Sets the current area name to id. If enabled in the project editor, the area name will be
displayed on screen.

18
ORK: Okashi RPG Kit for Unity Scripting Documentation

3.6 Game Time


GameHandler.GetGameTime()
Returns the current game time as a float.
GameHandler.SetGameTime(float t)
Sets the current game time to t.
GameHandler.AddGameTime(float t)
Adds t to the current game time.
GameHandler.GetTimeString(float t)
Returns the current game time as a string formatted hh:mm:ss.

3.7 Party
GameHandler.Party()
Returns the party handler.
GameHandler.GetPlayer()
Returns the GameObject of the player.
GameHandler.SpawnPlayer(int spawnID)
Spawns the player at spawn point with ID spawnID.

3.8 Items
GameHandler.Items()
Returns all items from the inventory as a Hashtable.
GameHandler.HasItem(int id, int n)
Returns true if the inventory contains n items with ID id.
GameHandler.GetItemCount(int id)
Returns the number of items with ID id.
GameHandler.AddItem(int id)
Adds 1 item with ID id to the inventory.
GameHandler.AddItem(int id, int n)
Adds n items with ID id to the inventory.
GameHandler.RemoveItem(int id)
Removes 1 item with ID id from the inventory.
GameHandler.RemoveItem(int id, int n)
Removes n items with ID id from the inventory.
GameHandler.HasItems()
Returns true if the inventory contains any items.

19
ORK: Okashi RPG Kit for Unity Scripting Documentation

3.9 Weapons
GameHandler.Weapons()
Returns all weapons from the inventory as a Hashtable.
GameHandler.HasWeapon(int id, int n)
Returns true if the inventory contains n weapons with ID id.
GameHandler.GetWeaponCount(int id)
Returns the number of weapons with ID id.
GameHandler.GetEquippedWeaponCount(int id)
Returns the number of equipped weapons with ID id.
GameHandler.AddWeapon(int id)
Adds 1 weapon with ID id to the inventory.
GameHandler.AddWeapon(int id, int n)
Adds n weapon with ID id to the inventory.
GameHandler.RemoveWeapon(int id)
Removes 1 weapon with ID id from the inventory.
GameHandler.RemoveWeapon(int id, int n)
Removes n weapon with ID id from the inventory.

3.10 Armors
GameHandler.Armors()
Returns all armors from the inventory as a Hashtable.
GameHandler.HasArmor(int id, int n)
Returns true if the inventory contains n armors with ID id.
GameHandler.GetArmorCount(int id)
Returns the number of armors with ID id.
GameHandler.GetEquippedArmorCount(int id)
Returns the number of equipped armors with ID id.
GameHandler.AddArmor(int id)
Adds 1 armor with ID id to the inventory.
GameHandler.AddArmor(int id, int n)
Adds n armors with ID id to the inventory.
GameHandler.RemoveArmor(int id)
Removes 1 armor with ID id from the inventory.
GameHandler.RemoveArmor(int id, int n)
Removes n armors with ID id from the inventory.

20
ORK: Okashi RPG Kit for Unity Scripting Documentation

3.11 Money
GameHandler.GetMoney()
Returns the funds of the party as an int.
GameHandler.SetMoney(int m)
Sets the funds of the party to m.
GameHandler.HasEnoughMoney(int m)
Returns true if the funds of the party are equal or greater then m.
GameHandler.AddMoney(int m)
Adds m to the funds of the party.
GameHandler.SubMoney(int m)
Subtracts m from the funds of the party.

3.12 Game Variables


GameHandler.GetVariable(String key)
Returns the value of game variable with key key as a string.
GameHandler.SetVariable(String key, String value)
Sets the game variable with key key to value value.
GameHandler.RemoveVariable(String key)
Removes the game variable with the key key.
GameHandler.CheckVariable(String key, String value)
Returns true if the game variable with key key has the value value.

21

You might also like