HiddenTradition_PRC8/_module/nss/nw_o2_trapdoor.nss
2024-06-20 15:47:42 -04:00

92 lines
2.8 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Trap door that takes you to a waypoint that
//:: is stored into the Destination local string.
//::
//:://////////////////////////////////////////////
/*
This is the standard Bioware hidden wall door
movement script, with an additional functionality:
the PC's familiar, henchman, etc will move with him
by means of my own "MoveCompanions" function.
If you don't want this (i.e. you want to go
back to the original bioware system) then
turn it off by setting AutoMoveCompanions = FALSE.
*/
//:://////////////////////////////////////////////
//:: Created By: Modified by Avlorleth
//:: Created On: July 11, 2003
//:://////////////////////////////////////////////
// Set this TRUE to auto move the companions, FALSE not to.
int AutoMoveCompanions = TRUE;
// MoveCompanions( oPC, lDest)
// Move the compaions of oPC to the location lDest.
void MoveCompanions( object oPC, location lDest) {
object oAnimal = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oPC);
int iAnimal = GetIsObjectValid(oAnimal);
object oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oPC);
int iDominated = GetIsObjectValid(oDominated);
object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oPC);
int iFamiliar = GetIsObjectValid(oFamiliar);
object oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oPC);
int iHenchman = GetIsObjectValid(oHenchman);
object oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oPC);
int iSummoned = GetIsObjectValid(oSummoned);
if (iAnimal == TRUE) {
AssignCommand( oAnimal, JumpToLocation(lDest));
}
if (iDominated == TRUE) {
AssignCommand( oDominated, JumpToLocation(lDest));
}
if (iFamiliar == TRUE) {
AssignCommand( oFamiliar, JumpToLocation(lDest));
}
if (iHenchman == TRUE) {
AssignCommand( oHenchman, JumpToLocation(lDest));
}
if (iSummoned == TRUE) {
AssignCommand( oSummoned, JumpToLocation(lDest));
}
}
void main()
{
object oidUser;
object oidDest;
string sDest;
location lDest;
if (!GetLocked(OBJECT_SELF))
{
if (GetIsOpen(OBJECT_SELF))
{
sDest = GetLocalString(OBJECT_SELF,"Destination");
oidUser = GetLastUsedBy();
oidDest = GetObjectByTag(sDest);
location lDest = GetLocation(oidDest); // Added by Avorleth
AssignCommand(oidUser,ActionJumpToObject(oidDest,FALSE));
// Added by Avorleth -- starts here
if (AutoMoveCompanions == TRUE ) {
MoveCompanions(oidUser, lDest);
} // end additions
PlayAnimation(ANIMATION_PLACEABLE_CLOSE);
} else
{
PlayAnimation(ANIMATION_PLACEABLE_OPEN);
}
} else
{
// ActionUseSkill
}
}