OnAreaTransitionClick

From NWN Lexicon

Contents

[edit] OnAreaTransitionClick

The script attached to this event fires when the PC enters an area transition. If a script is specified for this event then you are responsible for setting up and performing the transition manually, as the default transition will no longer function.


[edit] Trigger

When an area transition has been entered.


[edit] Function(s)

GetTransitionTarget(OBJECT_SELF) will return the destination object set up in the "Set Up Area Transition" wizard on the door, which basically uses the tag of the destination object.


[edit] Remarks

OnAreaTransitionClick applies only to doors, not to areas. If this script is not specified, then the default file NW_G0_Transition will fire.


[edit] Example

// Take the clicking object on the door to a waypoint "EVIL" if they are evil,
// "GOOD" if they are good, and "NEUTRAL" if they are neutral.
// It is a simple alignment-based example to move them.
void main()
{
    // Get PC clicker
    object oPC = GetClickingObject();
 
    // Get thier alignment
    int nAlignment = GetAlignmentGoodEvil(oPC);
    // Declare target waypoint
    object oTarget;
 
    // Evil
    if(nAlignment == ALIGNMENT_EVIL)
    {
        oTarget = GetWaypointByTag("EVIL");
    }
    // Good
    else if(nAlignment == ALIGNMENT_GOOD)
    {
        oTarget = GetWaypointByTag("GOOD");
    }
    // Else must be neutral
    else
    {
        oTarget = GetWaypointByTag("NEUTRAL");
    }
 
    // Move oPC, the Player, to oTarget
    AssignCommand(oPC, JumpToObject(oTarget));
}

[edit] See Also

functions: 

GetTransitionTarget()


Personal tools
Categories