-
Notifications
You must be signed in to change notification settings - Fork 1
Lua instance reference
"Instances" are what Vana uses to refer to exclusive collections of events and data. In game terms, these are all instances:
- Minidungeons
- Party quests
- Competitive quests (e.g. Monster Carnival)
- Major bosses
- Boat rides, elevators, etc.
- Major boss signups
- GM events
- Weddings
- Sometimes quests
The Lua design is very different from other kinds of scripts (such as NPC or portal scripts) because instances are event-driven. Instances allow you to execute some code when an event occurs. There are a few pre-defined events. You only need to implement functions that apply to your instance. If, for example, you don't use playerDisconnect for anything, you can leave that out and the system is fine.
A full list of events can be found at any time in /scripts/instances/_reference_script_read_first.lua.
Arguments: N/A
Notes: Occurs the instant that createInstance is called
Arguments:
- playerId: The ID of the player that died
Arguments:
- playerId: The ID of the player that disconnected
- isPartyLeader: A boolean indicating whether or not the player was a party leader
Arguments:
- name: A string indicating the identifier of the timer
- fromTimer: A boolean indicating whether or not the timer ended normally
- mobId: The mob template ID (e.g. Snail is 100100)
- mapMobId: The map-specific ID for a particular instance of the mob
- mapId: The ID of the map where the mob died
Arguments:
- mobId: The mob template ID (e.g. Snail is 100100)
- mapMobId: The map-specific ID for a particular instance of the mob
- mapId: The ID of the map where the mob spawned
Arguments:
- mobId: The mob template ID (e.g. Snail is 100100)
- mapMobId: The map-specific ID for a particular instance of the mob
- mapId: The ID of the map where the friendly mob was hit
- hp: The current HP level of the friendly mob
- maxHp: The maximum HP level of the friendly mob
Arguments:
- playerId: The ID of the player that switched maps either to or from a map that is registered with the instance
- newMap: The ID of the destination map
- oldMap: The ID of the source map
- isPartyLeader: A boolean indicating whether or not the player is a party leader
Note that this occurs before the player is removed from the old map, so assuming the player is the only one on either map, the following invariants will hold:
getNumPlayers(newMap) == 0 getNumPlayers(oldMap) == 1
Arguments:
- partyId: The ID of the party that disbanded
Arguments:
- playerId: The ID of the player that was removed
- partyId: The ID of the party that the member was a part of