Skip to content
Adam edited this page Dec 27, 2017 · 3 revisions

Introduction

Sapphire uses C++ for scripts, this means that most internal functionality can be used within scripts. Currently, there's support for 5 different types of scripts:

  • EventScript - Generally assoicated with actors of some kind, used to implement functionality such as quests, shops, aetherytes, aethernet and etc.
  • ActionScript - Used to implement actions used by players and NPCs
  • StatusEffectScript - Used to implement status effects which have custom behavior. For example, the Sprint status effect does not require a script, whereas something such as Allagan Rot would require a script. Most status effects will require a script of some kind.
  • BattleNpcScript - not implemented
  • ZoneScript - not implemented

Implementation

All scripts must publicly derive from the types listed above. For example, the base definition of a custom EventScript could be:

class ManFst002 : public EventScript
{
public:
   ManFst002() : EventScript( "ManFst002", 65621 ) {}

   void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
   {
       // do stuff
   }
   
   // onTalk, onEnterZone, etc...
}

It's essential that the file name matches the class name exactly, failing to do so will prevent scripts from building.

The downstream class constructors follow the format of {Type}Script( "{ClassName}", {Id} ) where ClassName is whatever the class/file is called and Id is whatever the script should be associated with. For example, ActionScript( "ActionSprint3", 3 ) would associate the script with the action Sprint which has an internal id of 3.

Likewise, EventScript( "ManFst002", 65621 ) assoicates the script ManFst002 with the quest id 65621. Script class names should indicate what game entity they belong to.

FFXIV Sapphire

Deprecated (4.0~5.58)

Getting Started
About
Installation

Installing
Linux
Mac
Windows

Developing
Actor Control
Scripting

Administration
Debug Commands
GM Commands

Other
PS4 Support

Clone this wiki locally