PoA_PRC8/_module/nss/restrict_door.nss
Jaysyn904 8d97886c3f Changed folder name.
Changed folder name.
2022-10-07 21:08:37 -04:00

256 lines
8.2 KiB
Plaintext

/////////////////////////////////////////////////
//Script Name: restrict_door
/////////////////////////////////////////////////
//Ultimate Teleport Script v 1.3 - (TEMPLATE)
/////////////////////////////////////////////////
//Designed By: Amurayi (mschdesign@hotmail.com)
//Modified By: Genisys (galefer003@hotmail.com)
/*Modified On: 8/22/08
/////////////////////////////////////////////////
IMPORTANT: This is a TEMPLATE, so, save it under
a new name FIRST!
NOTE: If you want to require that the party have
an item to open the door, the door should STILL
only be used by the person with the item, however
you can choose the teleport party option, and that
will be how you handle that kind of a restriction.
*/
/////////////////////////////////////////////////////////////////////////
////////////////IMPORTANT SETTINGS///////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
//Teleport Settings..
//Enter the tagname of the waypoint the PC will be teleported to
const string sTagname = "tagname"; //What is the tagname of the waypoint?
//Set to 1 if you want to use fancy Visual Effects in the teleport
const int nVisuals = 0; //(0 = Default, don't play animations)
//Set to 1 if you want to teleport the whole party of the PC
const int iTeleportWholeParty = 0; //(Default = 0, don't teleport party)
//Set to 1 if you want the Associates of the PC to be teleporeted as well.
const int iTeleportAssociateToo = 1; //(Default = 1, teleport associates)
//Restriction settings..
//Set this to 1 if you want to restrict the door use to DM Only!
const int nDM = 0; //0 = Default - Any PC or DM can use the door..
//Set this # to the level required to use the door, note the PC must be
//equal to or higher than this level or the door won't do anything!
const int nPCLevel = 0; //0 = Default No Level Required
//Set this to 1 if you want to Require the PC has an Evil Alignment
const int nEvil = 0; //0 = Default - Evil Alignment is NOT Checked.
//Set this to 1 if you want to Require the PC has a Good Alignment
const int nGood = 0; //0 = Default - Good Alignment is NOT Checked.
//NOTE: This check can only make sure they are neutral, that's it!
//Set this to 1 if you want to Require the PC has ANY Neutral Alignment
const int nNeutral = 0; //0 = Default - Nuetral Alignment is NOT Checked.
//Set this to 1 if you want to Require the PC has a Chaotic Alginament
const int nChaotic = 0; //0 = Default - Chaotic Alignment is NOT Checked.
//Set this to 1 if you want to require the PC has a Lawful Alignment
const int nLawful = 0; //0 = Default - Lawful Alignment is NOT Checked
//Set the tagname below of the item required to use the door.
const string sItemName = "tagname"; //default = "tagname" no item required.
///////////////////////////////////////////////////////////////////////
//NOTE: I did not put in Variable restrictions you will have to code
//this yourself where it says //Add additional code here...(below)
///////////////////////////////////////////////////////////////////////
//OPTIONS END
/////////////////////////////////////////////////////////////////////////
//DON'T TOUCH ANYTHING BELOW Unless your adding code. (Where it says to!)
/////////////////////////////////////////////////////////////////////////
//PROTOTYPE DECLARED
void JumpAssociate(object i_oPC, int i_type, object i_oWP);
//Main Script
void main()
{
//Declare Major Variables..
object oPC;
oPC = GetClickingObject();
object oItem;
///////////////////////////////////////////////////////////////////////
//RESTRICTIONS...
if(nPCLevel != 0)
{
if(GetHitDice(oPC)<nPCLevel)
return;
}
if(nEvil == 1)
{
if(GetGoodEvilValue(oPC)!= ALIGNMENT_EVIL)
{return;}
}
if(nGood == 1)
{
if (GetAlignmentGoodEvil(oPC) != ALIGNMENT_GOOD)
{return;}
}
if(nNeutral ==1)
{
int nPass;
//If Neutral Alignment OK then..
if ((GetAlignmentGoodEvil(oPC) == ALIGNMENT_NEUTRAL ||
GetAlignmentLawChaos(oPC) == ALIGNMENT_NEUTRAL))
{nPass =1;}
//If True Neutral Alignment OK then..
else if ((GetAlignmentGoodEvil(oPC) == ALIGNMENT_NEUTRAL &&
GetAlignmentLawChaos(oPC) == ALIGNMENT_LAWFUL))
{nPass =1;}
else
{nPass = 0; }
//If not a Neutral or True Neutral Alignment stop here..
if(nPass!=1)
{return;}
}
if(nLawful == 1)
{
if (GetAlignmentLawChaos(oPC) != ALIGNMENT_LAWFUL)
{return;}
}
if(nChaotic == 1)
{
if (GetAlignmentLawChaos(oPC) != ALIGNMENT_CHAOTIC)
{return;}
}
if(nDM ==1)
{
if((!GetIsDM(oPC)) || (!GetIsDMPossessed(oPC)))
{return;}
}
if(sItemName != "tagname")
{
if(GetItemPossessedBy(oPC, sItemName)==OBJECT_INVALID)
{return;}
}
/////////////////////////////////////////////////////////////////////
//Optional Settings Conditional Checks End
/////////////////////////////////////////////////////////////////////
//Add Additional Code Here....
////////////////////////////////////////////////////////////////////
///////////WARNING: DON'T TOUCH ANYTHING BELOW!!!///////////////////
////////////////////////////////////////////////////////////////////
//Major Variables
object oDWP = GetWaypointByTag(sTagname);
object oFM;
effect eVis;
////////////////////////////////////////////
//***Conditional***//
//If the destination is not valid, tell the PC, DMs, and log file!
if (oDWP == OBJECT_INVALID)
{
SendMessageToPC(oPC, "Destination not found.");
SendMessageToAllDMs("The Way Point tagnamed: " + sTagname + "WAS NOT FOUND IN THE MODULE!!");
WriteTimestampedLogEntry(sTagname + " Way Point NOT FOUND IN THE MODULE!!**");
return; //Stop the script here..
}
///////The Teleport (depending upon conditionals set above)////////
//If we are teleporting the whole party.
if (iTeleportWholeParty == 1)
{
float fT = 3.0;
oFM = GetFirstFactionMember(oPC);
// Step through the party members.
while(GetIsObjectValid(oFM))
{
//Delay The Teleports properly
fT +=0.1;
//if we are using visual effects (On All PCs only)
if(nVisuals ==1)
{
eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oFM);
}
AssignCommand(oFM, DelayCommand(fT, JumpToObject(oDWP)));
if (iTeleportAssociateToo == 1)
{
// now send the players companions over as well:
DelayCommand(fT+4.3, JumpAssociate(oFM, ASSOCIATE_TYPE_ANIMALCOMPANION, oDWP));
DelayCommand(fT+4.4, JumpAssociate(oFM, ASSOCIATE_TYPE_DOMINATED, oDWP));
DelayCommand(fT+4.5, JumpAssociate(oFM, ASSOCIATE_TYPE_FAMILIAR, oDWP));
DelayCommand(fT+4.6, JumpAssociate(oFM, ASSOCIATE_TYPE_HENCHMAN, oDWP));
DelayCommand(fT+4.7, JumpAssociate(oFM, ASSOCIATE_TYPE_SUMMONED, oDWP));
}
// Select the next member of the faction and loop.
oFM = GetNextFactionMember(oFM);
}
}
//Otherwise just jump the PC (and possibly associates)
else
{
//If we are using visual effects (on the PC only)
if(nVisuals ==1)
{
eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
//Delay The Jump..
AssignCommand(oPC, DelayCommand(3.0, JumpToObject(oDWP)));
}
else
{
//Do a quick jump if no visual is used..
AssignCommand(oPC, DelayCommand(0.1, JumpToObject(oDWP)));
}
//If the Associates are assigned to go as well
if (iTeleportAssociateToo == 1)
{
// now send the players companions over as well:
DelayCommand(3.1, JumpAssociate(oPC, ASSOCIATE_TYPE_ANIMALCOMPANION, oDWP));
DelayCommand(3.2, JumpAssociate(oPC, ASSOCIATE_TYPE_DOMINATED, oDWP));
DelayCommand(3.3, JumpAssociate(oPC, ASSOCIATE_TYPE_FAMILIAR, oDWP));
DelayCommand(3.4, JumpAssociate(oPC, ASSOCIATE_TYPE_HENCHMAN, oDWP));
DelayCommand(3.5, JumpAssociate(oPC, ASSOCIATE_TYPE_SUMMONED, oDWP));
}
}
}
//PROTOTYPE DEFINED
void JumpAssociate(object i_oPC, int i_type, object i_oWP)
{
object oAssociate = GetAssociate(i_type, i_oPC);
if(GetIsObjectValid(oAssociate))
AssignCommand(oAssociate, JumpToObject(i_oWP));
}