Game (functions)

From PMDOWiki
More functions: Script Reference

The game functions are used for various tasks across the game that happen in multiple contexts. Due to the size of the namespace, it is split into subpages based on what each function does.


Zone

Main article: Game (functions)/Zone
Name Description
GetCurrentGround Gets the current ground map.
GetCurrentFloor Gets the current dungeon map.
GetCurrentDungeon Gets the current zone, also known as dungeon.
UnlockDungeon Unlocks a specified dungeon.
DungeonUnlocked Checks if a dungeon is unlocked.
RestartToTitle Leave current map and load up the title screen.
RestartRogue Restarts a Roguelocke run based on the configuration
CutsceneMode Sets the game in cutscene mode. This prevents characters from taking idle action and hides certain UI.

Adventure

Name Description
EnterGroundMap Leave current map, and enter specified ground map within the current zone
EnterGroundMap Leave current map, and enter specified ground map within the current zone
EnterGroundMap Leave current map, and enter specified ground map within a new zone.
EnterDungeon Enters a zone and begins a new adventure.
ContinueDungeon Enters a zone and continues the current adventure. Often used in midpoint rest areas.
EndDungeonRun Ends the current adventure, sending the player to a specified destination.
EnterZone Enters a zone and begins a new adventure.
InRogueMode Checks if the current game is in rogue mode.
GetDailySeed Gets the random seed for the current adventure.

Multiplayer

Name Description
EnterRescue Enters a zone and begins a rescue adventure.
AddAOKRemark TODO: WIP
HasSOSMail TODO
HasAOKMail TODO
HasServerSet Returns true if there is at least one server in the server list.
GetRescueAllowed Checks to see if rescue is allowed.
SetRescueAllowed Sets the value in the player's save file to determine if they can be rescued or not.
If rescue is possible on the Save File level, it can still be prevented by the map.

Camera

Name Description
FadeOutFront Fade out the screen. Waits to complete before continuing.
This fade specifically comes in front of the menu.
FadeInFront Fade in the screen. Waits to complete before continuing.
This fade specifically comes in front of the menu.
FadeOut Fade out the screen. Waits to complete before continuing.
FadeIn Fade into the screen. Waits to complete before continuing.
MoveCamera Centers the camera on a position.
MoveCameraToChara Centers the camera on a character.

As we are simply moving the camera to a character, this will simply set ViewCenter and not ViewOffset.
GetCameraCenter Gets the current center of the camera.
IsCameraOnChar Determines whether the camera is centered relative to the player.

Team

Main article: Game (functions)/Team
Name Description
GetTeamLeaderIndex Returns the index of the currently player controlled entity in the party.
SetTeamLeaderIndex Sets the leader to the chosen index within the party.
SetCanSwitch Prevents or allows the switching of leaders for the save file.
SetCanRecruit Prevents or allows the joining of recruits for the save file.
GetPlayerPartyCount Returns the player party count. Does not include guests.
GetPlayerPartyTable Return the party as a LuaTable. Does not include guests.
GetPlayerPartyMember Gets the character at the specified index within the player's team.
AddPlayerTeam Adds a character to the player's team.
RemovePlayerTeam Removes the character from the team, placing its item back in the inventory.
GetPlayerGuestCount Gets the number of guests currently in the player's party.
GetPlayerGuestTable Return the guests as a LuaTable
GetPlayerGuestMember Gets the character at the specified index within the player's guests.
AddPlayerGuest Adds a character to the player's guests.
RemovePlayerGuest Removes the character from the team's guests, placing its item back in the inventory.
GetPlayerAssemblyCount Gets the number of characters currently in the player's assembly.
GetPlayerAssemblyTable Return the assembly as a LuaTable
GetPlayerAssemblyMember Gets the character at the specified index within the player's assembly.
AddPlayerAssembly Adds a character to the player's assembly.
RemovePlayerAssembly Removes the character from the assembly, placing its item back in the inventory.

Characters

Name Description
SetCharacterNickname Sets a character's nickname
GetCharacterNickname Gets the character nickname
SetTeamName Sets the name of the player's team
GetTeamName Gets the name of the player's team
CanRelearn Checks if the character can relearn any skills.
CanForget Checks if the character can forget any skills.
CanLearn Checks if the character can learn any skills.
CheckLevelSkills Checks the levels gained by a character and prompts to learn all skills along the levels.
Waits until all skills have been accepted or declined before continuing.
TryLearnSkill Attempts to give a new skill to the specified character, prompting to replace an old one if they are full.
Waits until the skill has been accepted or declined before continuing.
LearnSkill Gives a new skill to a specified character.
Fails if the character's skills are full.
ForgetSkill Removed a skill from the specified character.
LockSkill Makes a skill impossible to forget or replace for the specified character.
Note that this only affects normal gameplay. Scripts can still freely get rid of the skill.
UnlockSkill Unlocks a previously locked skill for the specified character, making it possible to be forgotten or replaced during normal gameplay.
SetCharacterSkill Gives a new skill to a specified character, replacing a specifically chosen slot.
GetCharacterSkill Gets the skill from a specified character and specified slot.
CanPromote Checks if the character can be promoted to a new class.
GetAvailablePromotions Gets a list of possible classes that the character can prmote to.
PromoteCharacter Promotes a character ot a new class.

Inventory

Name Description
FindPlayerItem Finds an item in the player's team and returns its slot within the inventory or among its team's equips.
GetPlayerEquippedCount Get the number of items equipped by players. Does not include guests.
GetPlayerBagCount Get the number of items in the bag.
GetPlayerBagLimit Gets the maximum amount of item the player's team can carry.
GetPlayerEquippedItem Gets the equipped item for the character in the specified slot.
GetGuestEquippedItem Gets the equipped item for the character in the specified guest slot.
GivePlayerItem Gives an item and adds it to the player team's bag.
GivePlayerItem Gives an item and adds it to the player team's bag.
GetPlayerBagItem Gets the item found at the specified slot of the player's bag.
TakePlayerBagItem Remove an item from player inventory
TakePlayerEquippedItem Remove the equipped item from a chosen member of the team
TakeGuestEquippedItem Remove the equipped item from a chosen guest of the team
GetPlayerStorageCount Get the amount of items in the player's storage
GetPlayerStorageItemCount Get the amount of a specific item in the player's storage
GivePlayerStorageItem Gives an item and adds it to the player team's storage.
GivePlayerStorageItem Gives an item and adds it to the player team's storage.
TakePlayerStorageItem Takes an item from the storage
DepositAll Takes all items in the player team's bag and equipped items, and deposits them in storage.
GetPlayerMoney Gets the amount of money the player currently has on hand.
AddToPlayerMoney Adds money to the player's wallet.
RemoveFromPlayerMoney Removes money from the player's wallet.
GetPlayerMoneyBank Gets the amount of money in the player's bank
AddToPlayerMoneyBank Adds money to the player's bank.
RemoveFromPlayerMoneyBank Removes money from the player's bank.

Utils

Name Description
IsKeyDown Checks if a player is making a certain physical keyboard input.
IsInputDown Checks if a player is making a certain game input.
QueueLeaderEvent Prepares an event to execute on the next frame.
WaitFrames Waits for a specified number of frames before continuing.
VectorToDirection Turns a vector (preferably a unit vector) into a cardinal or diagonal direction.
VectorToDirection Convenience function to get a vector's components from lua numbers(doubles)
RandomDirection Generates a random direction.

Misc

Main article: Game (functions)/Misc
Name Description
GroundSave Saves the game while in ground mode.
GetModDiff Checks to see if the specified mod has differences from the current save file.
SetupLuaFunctions Initializes any LuaFunctions found in the class.
Automatically on lua initialization.