Professional Documents
Culture Documents
Scripting Documentation
Scripting Documentation
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
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.
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.
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).
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.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.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.
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.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.
10
ORK: Okashi RPG Kit for Unity Scripting Documentation
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.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
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.
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.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.
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.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
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.
18
ORK: Okashi RPG Kit for Unity Scripting Documentation
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.
21