NWN2Wiki
Register
Advertisement


Placeable Object Help Call

What it Does

When placed on a door (or other interactive placeable object), prompts the object to call for help. This will cause NPCs of the object's faction to come to it's aid, and go hostile on the PC. It's designed for preventing PCs from simply destroying doors and chests in range of guards and such, promoting a more realistic RPG experience.


Notes

Maglazar posted this great little script in a thread I started. It works great and I find it VERY useful, and hope other will too. I'm not sure if this is his script or not, but thanks anyway to Maglazar for pointing this out to me.

The Script

Put In Door's "OnPhysicalAttacked"

//::///////////////////////////////////////////////
//:: Make door call for help when attacked
//:: DOOR_ONATTACKD01
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Determines the attacking object of the door,
    and if the attacker is a valid player in the
    same area, the door will call for help.
*/
//:://////////////////////////////////////////////
//:: Created By: Maglazar@hotmail.com
//:: Created On: August 10, 2002
//:://////////////////////////////////////////////
void main()
{
    // Get the object that attacked the door
    object oPCAttacker = GetLastAttacker();
    // Make sure the attacking object is a valid object AND is a Player Character
    if(GetIsObjectValid(oPCAttacker) && GetIsPC(oPCAttacker))
    {
        // Make sure the attacking object is in the same area
        if(GetArea(oPCAttacker) == GetArea(OBJECT_SELF))
        {
            //Shout Attack my target
            SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
           //Shout that I was attacked
           SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
        }   // end 'if' that checks area
    }       // end 'if' that checks validity of the attacking object
}           // end 'main()'

Put In Door's "OnSpellCastAt


//::///////////////////////////////////////////////
//:: Door calls for help if a spell is cast on it
//:: DOOR_ONCASTAT01
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Determines whether or not the caster of the
    last spell on the door is a valid player in the
    same area, and whether or not the spell was
    harmful. If the player is valid, and in the same
    area as the door, and the spell was harmful,
    the door will call for help.
*/
//:://////////////////////////////////////////////
//:: Created By: Maglazar@hotmail.com
//:: Created On: August 10, 2002
//:://////////////////////////////////////////////
void main()
{
    // Get the last object that cast a spell on the door
    object oCaster = GetLastSpellCaster();
    // Make sure the last spell cast was harmful
    if(GetLastSpellHarmful())
    {
        // Make sure the caster is a valid object AND a valid Player Character
        if(GetIsObjectValid(oCaster) && GetIsPC(oCaster))
        {
            // Make sure the caster is in the same area
            if(GetArea(oCaster) == GetArea(OBJECT_SELF))
            {
                //Shout Attack my target
                SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
                //Shout that I was attacked
                SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
            }   // end 'if' area check
        }       // end 'if' valid PC object
    }           // end 'if' last spell was harmful
}               // end 'main()'

Put In Door's "OnDamaged"

//::///////////////////////////////////////////////
//:: Make door call for help when damaged
//:: DOOR_ONDAMAGED01
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Determines the damaging object of the door,
    and if the damager is a valid player in the
    same area, the door will call for help.
*/
//:://////////////////////////////////////////////
//:: Created By: Maglazar@hotmail.com
//:: Created On: August 10, 2002
//:://////////////////////////////////////////////
void main()
{
    // Get the object that damaged the door
    object oPCDamager = GetLastDamager();
    // Make sure the damaging object is a valid object AND is a Player Character
    if(GetIsObjectValid(oPCDamager) && GetIsPC(oPCDamager))
    {
        // Make sure the damaging object is in the same area
        if(GetArea(oPCDamager) == GetArea(OBJECT_SELF))
        {
            //Shout Attack my target
            SpeakString("NW_ATTACK_MY_TARGET", TALKVOLUME_SILENT_TALK);
           //Shout that I was attacked
           SpeakString("NW_I_WAS_ATTACKED", TALKVOLUME_SILENT_TALK);
        }   // end 'if' that checks area
    }       // end 'if' that checks validity of the damaging object
}           // end 'main()'
Advertisement