Aschbourne_PRC8/_module/nss/_use_map.nss
Jaysyn904 f5ffe7d0b9 Module commit
Module commit.
2024-06-14 10:48:20 -04:00

222 lines
7.5 KiB
Plaintext

void NewLocation(object oPC, location lPC, int iDirection, int iMapSkill);
void main()
{
object oPC = OBJECT_SELF;
object oMap = GetLocalObject(oPC,"oMapUsed");
DeleteLocalObject(oPC,"oMapUsed");
location lNewLoc1;
location lNewLoc2;
location lNewLoc3;
location lNewLoc4;
location lNewLoc5;
location lNewLoc6;
location lNewLoc7;
location lNewLoc8;
location lNewLoc9;
location lNewLoc10;
location lNewLoc11;
location lNewLoc12;
location lNewLoc13;
location lNewLoc14;
location lNewLoc15;
location lNewLoc16;
location lStartLoc = GetLocation(oPC);
string sAreaTag = GetTag(GetArea(oPC));
string sAreaName = GetName(GetArea(oPC));
//Map location variables
string sMapAreaTag = GetLocalString(oMap,"sMapAreaTag");
string sMapAreaName = GetLocalString(oMap,"sMapAreaName");
float fMapUsedX = GetLocalFloat(oMap,"fMapPositionX");
float fMapUsedY = GetLocalFloat(oMap,"fMapPositionY");
float fMapUsedZ = GetLocalFloat(oMap,"fMapPositionZ");
float fMapOrientation = GetFacing(oPC);
object oMapArea = GetObjectByTag(sMapAreaTag);
//May need to filter out all non-area object types in case of
//tag-related issues.. i.e. area tag matching a sword item tag.
vector vMap = Vector(fMapUsedX,fMapUsedY,fMapUsedZ);
int iMapSkill = GetLocalInt(oMap,"iMapUsedSkill");
location lPC = Location(oMapArea,vMap,fMapOrientation);
FloatingTextStringOnCreature("You unfurl the map and attempt to get your bearings...",oPC,FALSE);
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_FIREFORGET_READ,0.2,4.0));
if (sAreaTag!=sMapAreaTag)
{
AssignCommand(oPC,DelayCommand(4.1,FloatingTextStringOnCreature("This map does not apear to be for this area.",oPC,FALSE)));
AssignCommand(oPC,DelayCommand(4.2,ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD,1.0,1.0)));
return;
}
NewLocation(oPC,lPC,1,iMapSkill);
lNewLoc1 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,2,iMapSkill);
lNewLoc2 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,3,iMapSkill);
lNewLoc3 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,4,iMapSkill);
lNewLoc4 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,5,iMapSkill);
lNewLoc5 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,6,iMapSkill);
lNewLoc6 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,7,iMapSkill);
lNewLoc7 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,8,iMapSkill);
lNewLoc8 = GetLocalLocation(oPC,"lLoc1");
if (iMapSkill>700)
{
NewLocation(oPC,lPC,9,iMapSkill);
lNewLoc9 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,10,iMapSkill);
lNewLoc10 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,11,iMapSkill);
lNewLoc11 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,12,iMapSkill);
lNewLoc12 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,13,iMapSkill);
lNewLoc13 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,14,iMapSkill);
lNewLoc14 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,15,iMapSkill);
lNewLoc15 = GetLocalLocation(oPC,"lLoc1");
NewLocation(oPC,lPC,16,iMapSkill);
lNewLoc16 = GetLocalLocation(oPC,"lLoc1");
}
DeleteLocalLocation(oPC,"lLoc1");
//This section of script provides an on-PC 'hook' so that
//you can check for this varibale in any 'trigger' areas
//So that the trigger is not activated by the PC being
//sent to that trigger by this script.. since the PC is not
//really at the trigger location.
SetLocalInt(oPC,"iPCUsedMap",99);
//------ This value is erased after the PC is sent back to
//their original location.
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectCutsceneGhost(),oPC,9.0);
//BlackScreen(oPC);
AssignCommand(oPC,ActionJumpToLocation(lNewLoc1));
DelayCommand(0.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc2)));
DelayCommand(1.0,AssignCommand(oPC,ActionJumpToLocation(lNewLoc3)));
DelayCommand(1.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc4)));
DelayCommand(2.0,AssignCommand(oPC,ActionJumpToLocation(lNewLoc5)));
DelayCommand(2.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc6)));
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToLocation(lNewLoc7)));
DelayCommand(3.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc8)));
if (iMapSkill>700)
{
DelayCommand(4.0,AssignCommand(oPC,ActionJumpToLocation(lNewLoc9)));
DelayCommand(4.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc10)));
DelayCommand(5.0,AssignCommand(oPC,ActionJumpToLocation(lNewLoc11)));
DelayCommand(5.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc12)));
DelayCommand(6.0,AssignCommand(oPC,ActionJumpToLocation(lNewLoc13)));
DelayCommand(6.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc14)));
DelayCommand(7.0,AssignCommand(oPC,ActionJumpToLocation(lNewLoc15)));
DelayCommand(7.5,AssignCommand(oPC,ActionJumpToLocation(lNewLoc15)));
DelayCommand(8.0,AssignCommand(oPC,ActionJumpToLocation(lStartLoc)));
DelayCommand(8.1,AssignCommand(oPC,DeleteLocalInt(oPC,"iPCUsedMap")));
DelayCommand(8.2,AssignCommand(oPC,FloatingTextStringOnCreature("You carefully study the map and get your bearings..",oPC,FALSE)));
}
else
{
DelayCommand(4.0,AssignCommand(oPC,ActionJumpToLocation(lStartLoc)));
DelayCommand(4.1,AssignCommand(oPC,DeleteLocalInt(oPC,"iPCUsedMap")));
DelayCommand(4.2,AssignCommand(oPC,FloatingTextStringOnCreature("You carefully study the map and get your bearings..",oPC,FALSE)));
}
//DelayCommand(4.1,StopFade(oPC));
}
void NewLocation(object oPC, location lPC, int iDirection, int iMapSkill)
{
location lNewLoc;
location lSelf = lPC;
vector vSelf = GetPositionFromLocation(lPC);
object oArea = GetArea(oPC);
vector vNewLoc;
int vDirection;
float fSelf;
float fDistance;
float fDistanceMax;
location lSelf2;
fSelf = GetFacing(oPC);
fDistanceMax = 45.0;
if (iDirection>8)
{
iDirection=iDirection-8;
fDistanceMax=30.0;
}
switch (iDirection)
{
case 1:{fSelf=fSelf+45.0;break;}
case 2:{fSelf=fSelf+90.0;break;}
case 3:{fSelf=fSelf+135.0;break;}
case 4:{fSelf=fSelf+180.0;break;}
case 5:{fSelf=fSelf+225.0;break;}
case 6:{fSelf=fSelf+270.0;break;}
case 7:{fSelf=fSelf+315.0;break;}
default:{break;}
}
fDistance = fDistanceMax / (1000.0/IntToFloat(iMapSkill));
vNewLoc = vSelf + (AngleToVector(fSelf) * fDistance);
lSelf2 = Location(oArea,vNewLoc,fSelf);
SetLocalLocation(oPC,"lLoc1",lSelf2);
return;
}
/*
void main()
{
object oPC = OBJECT_SELF;
FloatingTextStringOnCreature("You unfurl the map and attempt to get your bearings...",oPC,FALSE);
string sAreaResRef = GetResRef(GetArea(oPC));
string sAreaName = GetName(GetArea(oPC));
string sMapArea = GetLocalString(oPC,"sMapAreaResRef");
string sMapName = GetLocalString(oPC,"sMapAreaName");
DeleteLocalString(oPC,"sMapAreaResRef");
DeleteLocalString(oPC,"sMapAreaName");
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_FIREFORGET_READ,0.2,10.0));
if (sAreaResRef!=sMapArea)
{
AssignCommand(oPC,DelayCommand(9.5,FloatingTextStringOnCreature("This map does not apear to be for this area.",oPC,FALSE)));
AssignCommand(oPC,DelayCommand(10.0,ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD,1.0,1.0)));
return;
}
AssignCommand(oPC,DelayCommand(9.5,FloatingTextStringOnCreature("You carefully study the map and get your bearings..",oPC,FALSE)));
AssignCommand(oPC,DelayCommand(10.0,ActionPlayAnimation(ANIMATION_LOOPING_LOOK_FAR,1.0,4.0)));
DelayCommand(10.0,ExploreAreaForPlayer(GetArea(oPC),oPC));
}