generated from Jaysyn/ModuleTemplate
	
		
			
				
	
	
		
			70 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/* This script has been edited by Luni@luukku.com */
 | 
						|
/* Transport PC and charge 25 xp if PC is at lvl 10 or higher */
 | 
						|
 | 
						|
//Function which removes the requested amount of xp from party
 | 
						|
void RemoveXPFromParty(int nXP, object oPC, int bAllParty=TRUE)
 | 
						|
{
 | 
						|
 | 
						|
if (!bAllParty)
 | 
						|
   {
 | 
						|
   nXP=(GetXP(oPC)-nXP)>=0 ? GetXP(oPC)-nXP : 0;
 | 
						|
   SetXP(oPC, nXP);
 | 
						|
   }
 | 
						|
else
 | 
						|
   {
 | 
						|
   object oMember=GetFirstFactionMember(oPC, TRUE);
 | 
						|
 | 
						|
   while (GetIsObjectValid(oMember))
 | 
						|
      {
 | 
						|
      nXP=(GetXP(oMember)-nXP)>=0 ? GetXP(oMember)-nXP : 0;
 | 
						|
      SetXP(oMember, nXP);
 | 
						|
      oMember=GetNextFactionMember(oPC, TRUE);
 | 
						|
      }
 | 
						|
   }
 | 
						|
}
 | 
						|
 | 
						|
//Main function
 | 
						|
void main()
 | 
						|
{
 | 
						|
 | 
						|
object oPC = GetPCSpeaker();
 | 
						|
 | 
						|
object oTarget;
 | 
						|
location lTarget;
 | 
						|
oTarget = GetWaypointByTag("WP_ToLAlmaKinan");
 | 
						|
 | 
						|
lTarget = GetLocation(oTarget);
 | 
						|
 | 
						|
// If PC is at lvl 10 or higher, take 25 xp
 | 
						|
 | 
						|
if ((GetHitDice(oPC) >=  10)){
 | 
						|
 | 
						|
RemoveXPFromParty(25, oPC, FALSE);
 | 
						|
 | 
						|
}
 | 
						|
//only do the jump if the location is valid.
 | 
						|
//though not flawless, we just check if it is in a valid area.
 | 
						|
//the script will stop if the location isn't valid - meaning that
 | 
						|
//nothing put after the teleport will fire either.
 | 
						|
//the current location won't be stored, either
 | 
						|
 | 
						|
if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
 | 
						|
 | 
						|
AssignCommand(oPC, ClearAllActions());
 | 
						|
 | 
						|
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
 | 
						|
 | 
						|
oTarget = oPC;
 | 
						|
 | 
						|
//Visual effects can't be applied to waypoints, so if it is a WP
 | 
						|
//apply to the WP's location instead
 | 
						|
 | 
						|
int nInt;
 | 
						|
nInt = GetObjectType(oTarget);
 | 
						|
 | 
						|
if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oTarget);
 | 
						|
else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget));
 | 
						|
 | 
						|
}
 | 
						|
 |