Checking Functions

CheckTarget

Checks various aspects of the target, and executes events according to it.

Syntax

CheckTarget 1 -- Target is checked

Technical Details

If target is busy and exists, an event called "OnTargetReset" will be fired with the target being the caller, and the NPC that called CheckTarget will get their target nulled out.

If that check fails, NPC will forget their target, look for potential targets, and fire "OnVisible" event with the target being the caller

If even that fails, the event "OnTargetReset" will be fired on the NPC.

Example


// from ai_mission_pdb.p3s
pt_move
{
    actions
    {
        MoveToTarget walk,0
        Wait 2:5
        Say ZOMB_MOAN,ZOMB_CURSE,0
        CheckTarget 1
        Repeat 1
    }
    events
    {
        OnVisible "Pattern pt_barf"
    }
}


CheckLOS

Checks if target is able to see the caller

Syntax

CheckLOS 1 -- Checks target's line of sight

Technical Details

Fires event OnLOS if target is able to see the caller

Example


// from ai_mission_pm2.p3s
pt_loop
{
    actions
    {
        // Target can't see us, perfect, kill ourselves
        IfAttr "Timer:tKill <= 0 Npc kill"
        CheckLOS 1
        Repeat 1
    }
    events
    {
        // The timer's counter will be reset to 3 everytime the target is able to see
        OnLOS "Timer tKill,3"
    }
}