1
0
EQ2Emu/docs/lua_functions/GetGroup.md

24 lines
832 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### Function: GetGroup(Spawn)
**Description:**
Returns an array of Spawns that the given spawn (player or NPC) belongs to. This can be used to iterate over group members or to perform group-wide actions.
**Parameters:**
- `spawn` (Spawn) - Spawn object representing `spawn`.
**Returns:** An array of Spawn objects that represents the spawns group. If the spawn is not in a group, this may return nil.
**Example:**
```lua
-- From SpawnScripts/Generic/AlexaLockets.lua -- v is the Spawn object reference, k is the position in the array.
function hailed(NPC, Spawn)
if GetTempVariable(NPC, "talking") ~= "true" then
StartDialogLoop(NPC, Spawn)
local player_group = GetGroup(Spawn)
if player_group ~= nil then
for k,v in ipairs(player_group) do
SetPlayerHistory(v, HISTORY.NEK_CASTLE_LIBRARY_ACCESS, 1)
end
```