Initial commit. Updated release archive.
This commit is contained in:
144
_module/nss/mw_teleport_inc.nss
Normal file
144
_module/nss/mw_teleport_inc.nss
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
this is for debugging purposes
|
||||
If this file is #include by a Conversation Appears When script
|
||||
comment the following line out
|
||||
*/
|
||||
int StartingConditional() { return TRUE; }
|
||||
|
||||
|
||||
/* Return the number of members in the party oMember belongs to */
|
||||
int mw_NumberInParty(object oMember)
|
||||
{
|
||||
object oPC;
|
||||
int ret;
|
||||
|
||||
oPC = GetFirstFactionMember(oMember);
|
||||
for (ret = 1; GetIsObjectValid(oPC); ret++)
|
||||
oPC = GetNextFactionMember(oMember, TRUE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* checks to see if oQuery belongs to oMember's party */
|
||||
int mw_BelongsToParty(object oMember, object oQuery)
|
||||
{
|
||||
object oPC;
|
||||
|
||||
if (oMember == oQuery)
|
||||
return TRUE;
|
||||
oPC = GetFirstFactionMember(oMember, TRUE);
|
||||
while (GetIsObjectValid(oPC))
|
||||
{
|
||||
if (oPC == oQuery)
|
||||
return TRUE;
|
||||
oPC = GetNextFactionMember(oMember, TRUE);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
object mw_GetAvailablePortal(string sTag, object oTarget)
|
||||
{
|
||||
int i;
|
||||
object oPortal;
|
||||
|
||||
for (i=1; ; i++)
|
||||
{
|
||||
oPortal = GetNearestObjectByTag(sTag, oTarget, i);
|
||||
if (oPortal == OBJECT_INVALID)
|
||||
break;
|
||||
if (GetLocalInt(oPortal, "mw_Taken") == 0)
|
||||
{
|
||||
SetLocalInt(oPortal, "mw_Taken", 1);
|
||||
return oPortal;
|
||||
}
|
||||
}
|
||||
return OBJECT_INVALID;
|
||||
}
|
||||
|
||||
object mw_CreateSinglePortal(object oOwner, string sTemplate, object oLocation)
|
||||
{
|
||||
object oPortal;
|
||||
|
||||
oPortal = CreateObject(OBJECT_TYPE_PLACEABLE, sTemplate, GetLocation(oLocation), TRUE);
|
||||
SetLocalObject(oPortal, "mw_PortalOwner", oOwner);
|
||||
SetLocalObject(oPortal, "mw_PortalLocation", oLocation);
|
||||
SetLocalInt(oPortal, "mw_PortalCharges", 1);
|
||||
return oPortal;
|
||||
}
|
||||
|
||||
//Create a portal usable by all members of the party, once
|
||||
// -oOwner: person who requested the portal to be created
|
||||
// -sTemplate blueprint resref of portal placeable to create
|
||||
// -lLocation
|
||||
object mw_CreatePartyPortal(object oOwner, string sTemplate, object oLocation)
|
||||
{
|
||||
object oPortal;
|
||||
|
||||
oPortal = CreateObject(OBJECT_TYPE_PLACEABLE, sTemplate, GetLocation(oLocation), TRUE);
|
||||
SetLocalObject(oPortal, "mw_PortalOwner", oOwner);
|
||||
SetLocalObject(oPortal, "mw_PortalLocation", oLocation);
|
||||
SetLocalInt(oPortal, "mw_PortalCharges", mw_NumberInParty(oOwner));
|
||||
return oPortal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Removes all spell or feat effects,
|
||||
*/
|
||||
void mw_StripAllEffects(object oCreature)
|
||||
{
|
||||
effect e;
|
||||
|
||||
e = GetFirstEffect(oCreature);
|
||||
while (GetIsEffectValid(e))
|
||||
{
|
||||
RemoveEffect(oCreature, e);
|
||||
e = GetNextEffect(oCreature);
|
||||
}
|
||||
|
||||
}
|
||||
void mw_StripAllCreatures(object oCreature)
|
||||
{
|
||||
object oPet;
|
||||
oPet = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION, oCreature);
|
||||
if (GetIsObjectValid(oPet))
|
||||
DestroyObject(oPet);
|
||||
oPet = GetAssociate(ASSOCIATE_TYPE_DOMINATED, oCreature);
|
||||
if (GetIsObjectValid(oPet))
|
||||
DestroyObject(oPet);
|
||||
oPet = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oCreature);
|
||||
if (GetIsObjectValid(oPet))
|
||||
DestroyObject(oPet);
|
||||
|
||||
/* removed this until can sort out setting IsDestroyable and respawning correctly for SoU henchmen
|
||||
|
||||
oPet = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oCreature);
|
||||
if (GetIsObjectValid(oPet))
|
||||
DestroyObject(oPet);
|
||||
|
||||
*/
|
||||
|
||||
oPet = GetAssociate(ASSOCIATE_TYPE_SUMMONED, oCreature);
|
||||
if (GetIsObjectValid(oPet))
|
||||
DestroyObject(oPet);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
remove all feat/spell effects from the creature, teleport them to the
|
||||
oDestination object (either a waypoint or a creature), apply blindness and
|
||||
stun effects to them upon their arrival
|
||||
*/
|
||||
void mw_TeleportWithEffects(object oCreature, object oDestination, float nSeconds)
|
||||
{
|
||||
mw_StripAllEffects(oCreature);
|
||||
mw_StripAllCreatures(oCreature);
|
||||
AssignCommand(oCreature, ActionJumpToObject(oDestination));
|
||||
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectStunned(), oCreature, nSeconds));
|
||||
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectBlindness(), oCreature, nSeconds));
|
||||
|
||||
// DelayCommand(nSeconds, mw_StripAllEffects(oCreature));
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user