is_player_alived - ryzom/ryzomcore GitHub Wiki


title: Is Player Alived description: published: true date: 2023-03-12T15:39:37.172Z tags: editor: markdown dateCreated: 2023-03-12T15:39:33.679Z

isPlayerAlived

The isPlayerAlived native AI script function tests whether a player with the given entity ID is alive.

Syntax

(success: f)isPlayerAlived(playerId: s)

Arguments

  • playerId (string): The entity ID of the player to check.

Return Value

  • success (float): A flag indicating whether the player is alive. If the player is alive, the function returns 1. If the player is not connected, not in the same continent as the NPC group, or dead, 0 is returned.

Example

($botIndex)getBotIndexByName("boss_3");
($playerId)getCurrentPlayerAggroListTarget($botIndex):
(alived)isPlayerAlived($playerId);
if (alived == 1.0f) {
    // do something
}

This example code checks whether the player targeted by the bot named "boss_3" is alive, and executes code if they are.

⚠️ **GitHub.com Fallback** ⚠️