Skip to content

Duel & Crywolf

Functions for checking PvP duel status and querying the Crywolf event state.


Duel

CheckDuel(lpObj, lpTarget)

Checks if two players are currently engaged in a duel with each other.

  • Parameters:
    • lpObj (GameObject): First player object.
    • lpTarget (GameObject): Second player object.
  • Returns: booleantrue if both players are dueling each other.
function OnPlayerAttack(aIndex, bIndex)
    local attacker = GetUser(aIndex)
    local target = GetUser(bIndex)

    if CheckDuel(attacker, target) then
        LogAdd(LOG_BLUE, "[Duel] %s is dueling %s", attacker.Name, target.Name)
    end
end

Tip

CheckDuel returns true only when both players are matched in the same duel. It will return false if either player is dueling someone else.


Crywolf

GetCrywolfState()

Returns the current state of the Crywolf event.

  • Parameters: None
  • Returns: integer — Current Crywolf state value.
Value State
0 Inactive
1 Notify (announcing)
2 Ready
3 Start (battle in progress)
4 End
function OnPlayerMapMove(aIndex, map)
    if map == 34 then -- Crywolf map
        local state = GetCrywolfState()
        if state == 3 then
            GCNoticeSend(aIndex, 1, "The Crywolf battle is in progress!")
        elseif state == 0 then
            GCNoticeSend(aIndex, 1, "Crywolf is currently peaceful.")
        end
    end
    return 1
end