You like good responses?
'>
Try this one...
// door_port_templ (TEMPLATE SCRIPT)
//////////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 8/30/10
///////////////////////////////////////////////////////////////////////////////
/* This script goes in the OnFailToOpen or OnClicked
Basically it allows you to teleport the clicking PC (and party possibly)
to a waypoint or door (By using a door the PC may end up in the wrong direction).
Make sure you set the door or object to be locked & require a fictious key
to open it. (make up a fake key name)
MAKE SURE you save this script under a new name BEFORE you edit it!
*/
///////////////////////////////////////////////////////////////////////////////
///////////////////IMPORTANT SETTINGS/////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//Set this to the (tagname) of the waypoint or door which is the destination
const string DOOR_OR_WAYPOINT = "tagname";
///////////////////////////////////////////////////////////////////////////////
//Set this to TRUE if you wish to check for a key or item..
const int CHECK_FOR_ITEM_FIRST = FALSE; //Default = FALSE (Don't check)
///////////////////////////////////////////////////////////////////////////////
//Set this to TRUE if you wish to remove the item or key after they are ported
const int TAKE_KEY_ITEM = FALSE; //Default = FALSE (Don't take the key / item)
///////////////////////////////////////////////////////////////////////////////
//Set this to the (tagname) of the item to be checked for..
const string TAGNAME_OF_KEY_ITEM = "tagname";
///////////////////////////////////////////////////////////////////////////////
//Set this to TRUE if you wish to use a VFX constant for visual effect..
const int USE_VFX = FALSE; //Default = FALSE (Don't use VFXs)
///////////////////////////////////////////////////////////////////////////////
//Set this to the Default VFX to use (This MUST be a constant!)
const int VFX_TO_USE = VFX_FNF_SUMMON_MONSTER_3;
///////////////////////////////////////////////////////////////////////////////
//Set this to TRUE if you wish to teleport the WHOLE PARTY!
const int TELEPORT_PARTY = FALSE; //Default = FALSE (Don't Teleport Party)
///////////////////////////////////////////////////////////////////////////////
//Set this to TRUE if the Party Members must to be in the same area!
const int MEMBERS_IN_AREA = FALSE; //Default = FALSE (Teleport All reguardless)
///////////////////////////////////////////////////////////////////////////////
//Set this to FALSE if you don't want to teleport Summons/Familiars Also.
const int SUMMONS_TELEPORT_TOO = TRUE; //Default = TRUE (Teleport All Summons)
///////////////////////////////////////////////////////////////////////////////
/////WARNING: DON'T TOUCH ANYTHING BELOW THIS LINE!!!/////////////////////////
/////////////////////////////////////////////////////////////////////////////
//Main Script
void main()
{
object oPC = GetClickingObject();
object oArea = GetArea(oPC);
object oWay = GetObjectByTag(DOOR_OR_WAYPOINT);
location lLoc = GetLocation(oWay);
object oParty;
object oKey;
effect eVis;
float f1 = 0.0;
float f2 = 0.1;
//Only continue if it's a PC / DM or a DM Possessed Creature...
if (GetIsPC(oPC)|| GetIsDM(oPC) || GetIsDMPossessed(oPC))
{
//First see if we are checking for an item or not...
if(CHECK_FOR_ITEM_FIRST==TRUE)
{
oKey = GetItemPossessedBy(oPC, TAGNAME_OF_KEY_ITEM);
//If they don't have the key, stop here..
if(oKey == OBJECT_INVALID)
{
//Tell the PC why they failed..
FloatingTextStringOnCreature("You do not have the proper item or key to use this door.", oPC, TRUE);
return;
}
//Otherwise they have the key..
else
{
//If we are suppose to kill the key, then do it here..
if(TAKE_KEY_ITEM==TRUE)
{
DestroyObject(oKey, 0.0);
}
}
//End Check for Item..
}
//If we are suppose to use VFXs..
if(USE_VFX == TRUE)
{
eVis = EffectVisualEffect(VFX_TO_USE, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0);
f1 = 2.5;
f2 = 2.6;
}
//First see if we are teleporting the whole party..
if(TELEPORT_PARTY==TRUE)
{
oParty = GetFirstFactionMember(oPC, SUMMONS_TELEPORT_TOO);
while(GetIsObjectValid(oParty))
{
if(MEMBERS_IN_AREA==TRUE)
{
//If the Party Member is in the same area as the PC..
if(GetArea(oParty)==oArea)
{
DelayCommand(f1, AssignCommand(oParty, ClearAllActions()));
DelayCommand(f2, AssignCommand(oParty, ActionJumpToLocation(lLoc)));
}
}
//Otherwise jump all party members!!
else
{
DelayCommand(f1, AssignCommand(oParty, ClearAllActions()));
DelayCommand(f2, AssignCommand(oParty, ActionJumpToLocation(lLoc)));
}
oParty = GetNextFactionMember(oPC, SUMMONS_TELEPORT_TOO);
}
//End Teleport Party Check..
}
//Otherwise see if we should teleport familiars & summons too
else
{
//If we are suppose to teleport Summons / Familiars..
if(SUMMONS_TELEPORT_TOO==TRUE)
{
oParty = GetFirstFactionMember(oPC, TRUE);
while(GetIsObjectValid(oParty))
{
if(GetMaster(oParty)==oPC)
{
DelayCommand(f1, AssignCommand(oParty, ClearAllActions()));
DelayCommand(f2, AssignCommand(oParty, ActionJumpToLocation(lLoc)));
}
oParty = GetNextFactionMember(oPC);
}
}
}
//Always teleport the PC / DM
DelayCommand(f1, AssignCommand(oPC, ClearAllActions()));
DelayCommand(f2, AssignCommand(oPC, ActionJumpToLocation(lLoc)));
//End valid check for PC / DM / Dm Possessed Creatures..
}
//Do nothing if it's not a PC / DM / or DM Possessed Creature..
//Main Script End
}
Modifié par Genisys, 31 août 2010 - 01:21 .