696 lines
22 KiB
Plaintext
696 lines
22 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
// puzzle_h - This is the header file for functions used by the Temple
|
|
// of the Elder Gods Puzzles.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////
|
|
// STRUCTURES
|
|
/////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////
|
|
// GLOBALS
|
|
////////////////////////
|
|
|
|
|
|
|
|
|
|
////////////////////////
|
|
// PROTOTYPES
|
|
////////////////////////
|
|
|
|
|
|
// FILE: puzzle_h FUNCTION: GetPuzzleRuneResRef()
|
|
// Will return the resref for the specified rune number 1-24
|
|
string GetPuzzleRuneResRef(int nRuneNumber);
|
|
|
|
// FILE: puzzle_h FUNCTION: GetPuzzleKeyword()
|
|
// Will return a number for which word to use
|
|
int GetPuzzleKeyword();
|
|
|
|
// FILE: puzzle_h FUNCTION: GetPuzzleKeywordName()
|
|
// Will return the string representation of the keyword indicated
|
|
string GetPuzzleKeywordName(int nKeywordNumber);
|
|
|
|
// FILE: puzzle_h FUNCTION: SetPuzzleKeywordRunes()
|
|
// This will set the puzzle keyword as #.#.#.#.# on sTempleKeyword
|
|
// on the module object.
|
|
void SetPuzzleKeywordRunes(int nKeywordNumber);
|
|
|
|
// FILE: puzzle_h Function: GetPuzzleKeywordRune()
|
|
// This will return the appropriate keyword rune for
|
|
// nLetterPosition is 1 to 5 and the number 0 will be returned
|
|
// if there is no value for that position.
|
|
int GetPuzzleKeywordRune(int nKeywordNumber,int nLetterPosition);
|
|
|
|
// FILE: puzzle_h Function: ResetPuzzle()
|
|
// This function will clear any current puzzle runes, reset the words,
|
|
// and prepare for a new victim. It will also spawn all the various
|
|
// guardians for the areas.
|
|
void ResetPuzzle();
|
|
|
|
// FILE: puzzle_h Function: GetZodiacName()
|
|
// This function will return the name of the zodiac number passed.
|
|
string GetZodiacName(int nZodiacNumber);
|
|
|
|
// FILE: puzzle_h Function: GetZodiacResRef()
|
|
// This will return the ResRef of the zodiac placeable that corresponds
|
|
// to the number passed.
|
|
string GetZodiacResRef(int nZodiacNumber);
|
|
|
|
////////////////////////
|
|
// FUNCTIONS
|
|
////////////////////////
|
|
|
|
string GetPuzzleRuneResRef(int nRuneNumber)
|
|
{ // PURPOSE: Get the resref of an appropriate rune
|
|
if (nRuneNumber==1) return "rune1";
|
|
else if (nRuneNumber>1&&nRuneNumber<10)
|
|
{
|
|
return "rune00"+IntToString(nRuneNumber);
|
|
}
|
|
else if (nRuneNumber>1&&nRuneNumber<25)
|
|
{
|
|
return "rune0"+IntToString(nRuneNumber);
|
|
}
|
|
return "";
|
|
} // GetPuzzleRuneResRef()
|
|
|
|
int GetPuzzleKeyword()
|
|
{ // PURPOSE return a number to use as keyword
|
|
// 1 = GODS (4)
|
|
// 2 = AWAKE (5)
|
|
// 3 = TRUTH (4)
|
|
// 4 = FREE (3)
|
|
// 5 = SLEEPING (5)
|
|
// 6 = POWER (5)
|
|
// 7 = WELL (3)
|
|
// 8 = WEALTH (5)
|
|
// 9 = KINGS (3)
|
|
// 10= FIND (4)
|
|
return d10();
|
|
} // GetPuzzleKeyword()
|
|
|
|
string GetPuzzleKeywordName(int nKeywordNumber)
|
|
{ // PURPOSE: Return the string representation for the keyword
|
|
if (nKeywordNumber==1) return "GODS";
|
|
else if (nKeywordNumber==2) return "AWAKE";
|
|
else if (nKeywordNumber==3) return "TRUTH";
|
|
else if (nKeywordNumber==4) return "FREE";
|
|
else if (nKeywordNumber==5) return "SLEEPING";
|
|
else if (nKeywordNumber==6) return "POWER";
|
|
else if (nKeywordNumber==7) return "WELL";
|
|
else if (nKeywordNumber==8) return "WEALTH";
|
|
else if (nKeywordNumber==9) return "KINGS";
|
|
else if (nKeywordNumber==10) return "FIND";
|
|
return "";
|
|
} // GetPuzzleKeywordName()
|
|
|
|
int GetPuzzleKeywordRune(int nKeywordNumber,int nLetterPosition)
|
|
{ // PURPOSE: This will return the appropriate rune # for the position
|
|
switch(nKeywordNumber)
|
|
{ // switch
|
|
case 1: { // keyword 1
|
|
if (nLetterPosition==1) return 8;
|
|
else if (nLetterPosition==2) return 17;
|
|
else if (nLetterPosition==3) return 3;
|
|
else if (nLetterPosition==4) return 20;
|
|
return 0;
|
|
} // keyword 1
|
|
case 2: { // keyword 2
|
|
if (nLetterPosition==1) return 1;
|
|
else if (nLetterPosition==2) return 24;
|
|
else if (nLetterPosition==3) return 1;
|
|
else if (nLetterPosition==4) return 13;
|
|
else if (nLetterPosition==5) return 4;
|
|
return 0;
|
|
} // keyword 2
|
|
case 3: { // keyword 3
|
|
if (nLetterPosition==1) return 22;
|
|
else if (nLetterPosition==2) return 19;
|
|
else if (nLetterPosition==3) return 23;
|
|
else if (nLetterPosition==4) return 21;
|
|
return 0;
|
|
} // keyword 3
|
|
case 4: { // keyword 4
|
|
if (nLetterPosition==1) return 7;
|
|
else if (nLetterPosition==2) return 19;
|
|
else if (nLetterPosition==3) return 5;
|
|
return 0;
|
|
} // keyword 4
|
|
case 5: { // keyword 5
|
|
if (nLetterPosition==1) return 20;
|
|
else if (nLetterPosition==2) return 14;
|
|
else if (nLetterPosition==3) return 5;
|
|
else if (nLetterPosition==4) return 18;
|
|
else if (nLetterPosition==5) return 10;
|
|
return 0;
|
|
} // keyword 5
|
|
case 6: { // keyword 6
|
|
if (nLetterPosition==1) return 18;
|
|
else if (nLetterPosition==2) return 17;
|
|
else if (nLetterPosition==3) return 24;
|
|
else if (nLetterPosition==4) return 4;
|
|
else if (nLetterPosition==5) return 19;
|
|
return 0;
|
|
} // keyword 6
|
|
case 7: { // keyword 7
|
|
if (nLetterPosition==1) return 24;
|
|
else if (nLetterPosition==2) return 6;
|
|
else if (nLetterPosition==3) return 14;
|
|
return 0;
|
|
} // keyword 7
|
|
case 8: { // keyword 8
|
|
if (nLetterPosition==1) return 24;
|
|
else if (nLetterPosition==2) return 4;
|
|
else if (nLetterPosition==3) return 1;
|
|
else if (nLetterPosition==4) return 14;
|
|
else if (nLetterPosition==5) return 21;
|
|
return 0;
|
|
} // keyword 8
|
|
case 9: { // keyword 9
|
|
if (nLetterPosition==1) return 13;
|
|
else if (nLetterPosition==2) return 10;
|
|
else if (nLetterPosition==3) return 20;
|
|
return 0;
|
|
} // keyword 9
|
|
case 10: { // keyword 10
|
|
if (nLetterPosition==1) return 7;
|
|
else if (nLetterPosition==2) return 11;
|
|
else if (nLetterPosition==2) return 16;
|
|
else if (nLetterPosition==2) return 3;
|
|
return 0;
|
|
} // keyword 10
|
|
default: break;
|
|
} // switch
|
|
return 0;
|
|
} // GetPuzzleKeywordRune()
|
|
|
|
void SetPuzzleKeywordRunes(int nKeywordNumber)
|
|
{ // PURPOSE: Set the keyword values on the module object
|
|
string sKeyword;
|
|
int nN;
|
|
int nV;
|
|
object oMod=GetModule();
|
|
if (nKeywordNumber>0&&nKeywordNumber<10)
|
|
{ // valid number
|
|
sKeyword=GetPuzzleKeywordName(nKeywordNumber);
|
|
SetLocalString(oMod,"sTempleKeywordName",sKeyword);
|
|
sKeyword="";
|
|
nN=1;
|
|
nV=GetPuzzleKeywordRune(nKeywordNumber,nN);
|
|
while(nV>0)
|
|
{ // build keyword string
|
|
if (GetStringLength(sKeyword)<1) sKeyword=IntToString(nV);
|
|
else { sKeyword=sKeyword+"."+IntToString(nV); }
|
|
nN++;
|
|
nV=GetPuzzleKeywordRune(nKeywordNumber,nN);
|
|
} // build keyword string
|
|
SetLocalString(oMod,"sTempleKeyword",sKeyword);
|
|
} // valid number
|
|
} // SetPuzzleKeywordRunes();
|
|
|
|
|
|
void fnDestroyRunes()
|
|
{ // PURPOSE: Destroy runes already present in temple
|
|
object oRune;
|
|
int nN;
|
|
nN=0;
|
|
oRune=GetObjectByTag("RUNIC_PART",nN);
|
|
while(oRune!=OBJECT_INVALID)
|
|
{ // destroy runes
|
|
DelayCommand(0.5,DestroyObject(oRune));
|
|
nN++;
|
|
oRune=GetObjectByTag("RUNIC_PART",nN);
|
|
} // destroy runes
|
|
} // fnDestroyRunes()
|
|
|
|
void fnDestroyCreatures()
|
|
{ // PURPOSE: Destroy the creatures
|
|
object oCreature;
|
|
int nN;
|
|
nN=0;
|
|
oCreature=GetObjectByTag("TEMPLE_GUARDIAN",nN);
|
|
while(oCreature!=OBJECT_INVALID)
|
|
{ // destroy creatures
|
|
DelayCommand(0.7,DestroyObject(oCreature));
|
|
nN++;
|
|
oCreature=GetObjectByTag("TEMPLE_GUARDIAN",nN);
|
|
} // destroy creatures
|
|
nN=0;
|
|
oCreature=GetObjectByTag("SYPHON",nN);
|
|
while(oCreature!=OBJECT_INVALID)
|
|
{ // destroy creatures
|
|
DelayCommand(1.0,DestroyObject(oCreature));
|
|
nN++;
|
|
oCreature=GetObjectByTag("SYPHON",nN);
|
|
} // destroy creatures
|
|
} // fnDestroyCreatures()
|
|
|
|
void fnDestroyZodiacs()
|
|
{ // PURPOSE: Destroy the zodiac signs
|
|
int nN=0;
|
|
object oZodiac=GetObjectByTag("ZODIAC_TEMPLE",nN);
|
|
while(oZodiac!=OBJECT_INVALID)
|
|
{ // destroy
|
|
DelayCommand(0.4,DestroyObject(oZodiac));
|
|
nN++;
|
|
oZodiac=GetObjectByTag("ZODIAC_TEMPLE",nN);
|
|
} // destroy
|
|
} // fnDestroyZodiacs
|
|
|
|
|
|
string fnGuardianResRef()
|
|
{ // PURPOSE: Return a random guardian resref
|
|
string sRet;
|
|
int nRoll=d6();
|
|
if (nRoll==1) sRet="golflesh001";
|
|
else if (nRoll==2) sRet="treant";
|
|
else if (nRoll==3) sRet="invis_stalk";
|
|
else if (nRoll==4) sRet="devour001";
|
|
else if (nRoll==5) sRet="displacerbeast";
|
|
else if (nRoll==6) sRet="nw_shfiend1";
|
|
return sRet;
|
|
} // fnGuardianResRef()
|
|
|
|
string fnGuardianEasy()
|
|
{ // PURPOSE: Return a random resref of the easy side on level 3
|
|
int nRoll=d4();
|
|
if (nRoll==1) return "nw_shadow1";
|
|
else if (nRoll==2) return "wight001";
|
|
else if (nRoll==3) return "minotaur001";
|
|
else if (nRoll==4) return "pygmiewarrior";
|
|
return "";
|
|
} // fnGuardianEasy()
|
|
|
|
string fnGuardianHard()
|
|
{ // PURPOSE: Return a random resref of the hard side on level 3
|
|
int nRoll=Random(7)+1;
|
|
if (nRoll==1) return "sphinx001";
|
|
else if (nRoll==2) return "astraldeva";
|
|
else if (nRoll==3) return "planetar";
|
|
else if (nRoll==4) return "devil002";
|
|
else if (nRoll==5) return "demon001";
|
|
else if (nRoll==6) return "slaaddeth001";
|
|
else if (nRoll==7) return "mummyboss001";
|
|
return "";
|
|
} // fnGuardianHard()
|
|
|
|
void fnSpawnCreatures()
|
|
{ // PURPOSE: spawn the creatures
|
|
object oCreature;
|
|
object oWP;
|
|
int bWest=GetLocalInt(GetModule(),"bZodiacWest");
|
|
int nN;
|
|
oWP=GetWaypointByTag("STAGE2_MONSTER");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianResRef(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("STAGE4_MONSTER");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianResRef(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("STAGE6_MONSTER");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianResRef(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("STAGE8_MONSTER");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianResRef(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
nN=1;
|
|
while(nN<7)
|
|
{ // place level 3 creatures
|
|
if (bWest)
|
|
{ // west is easy
|
|
oWP=GetWaypointByTag("TEMPLE_SPAWNW"+IntToString(nN));
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianEasy(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("TEMPLE_SPAWNE"+IntToString(nN));
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianHard(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
} // west is easy
|
|
else
|
|
{ // east is easy
|
|
oWP=GetWaypointByTag("TEMPLE_SPAWNE"+IntToString(nN));
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianEasy(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("TEMPLE_SPAWNW"+IntToString(nN));
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianHard(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
} // east is easy
|
|
nN++;
|
|
} // place level 3 creatures
|
|
nN=1;
|
|
while(nN<6)
|
|
{ // spawn misc creatures
|
|
oWP=GetWaypointByTag("TEMPLE_SPAWNM"+IntToString(nN));
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,fnGuardianResRef(),GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
nN++;
|
|
} // spawn misc creatures
|
|
// elementals
|
|
oWP=GetWaypointByTag("TEGODS_EARTH");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,"earthmother",GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("TEGODS_AIR");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,"airmother",GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("TEGODS_FIRE");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,"firemother",GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
oWP=GetWaypointByTag("TEGODS_WATER");
|
|
oCreature=CreateObject(OBJECT_TYPE_CREATURE,"watermother",GetLocation(oWP),FALSE,"TEMPLE_GUARDIAN");
|
|
} // fnSpawnCreatures()
|
|
|
|
void fnSpawnZodiacs()
|
|
{ // PURPOSE: spawn the zodiacs
|
|
object oWP;
|
|
object oZodiac;
|
|
int nZodiac;
|
|
string sS;
|
|
int nN;
|
|
int bWest=FALSE;
|
|
object oMod=GetModule();
|
|
if (d100()>50) bWest=TRUE;
|
|
nZodiac=d12();
|
|
sS=GetZodiacName(nZodiac);
|
|
SetLocalString(oMod,"sTempleZodiac",sS);
|
|
SetLocalInt(oMod,"bZodiacWest",bWest);
|
|
sS=GetZodiacResRef(nZodiac);
|
|
if (bWest)
|
|
{ // spawn
|
|
oWP=GetWaypointByTag("ZODIAC_SPAWNW");
|
|
oZodiac=CreateObject(OBJECT_TYPE_PLACEABLE,sS,GetLocation(oWP),FALSE,"ZODIAC_TEMPLE");
|
|
nN=d12();
|
|
while(nN==nZodiac) { nN=d12(); }
|
|
sS=GetZodiacResRef(nN);
|
|
oWP=GetWaypointByTag("ZODIAC_SPAWNE");
|
|
oZodiac=CreateObject(OBJECT_TYPE_PLACEABLE,sS,GetLocation(oWP),FALSE,"ZODIAC_TEMPLE");
|
|
} // spawn
|
|
else
|
|
{ // east
|
|
oWP=GetWaypointByTag("ZODIAC_SPAWNE");
|
|
oZodiac=CreateObject(OBJECT_TYPE_PLACEABLE,sS,GetLocation(oWP),FALSE,"ZODIAC_TEMPLE");
|
|
nN=d12();
|
|
while(nN==nZodiac) { nN=d12(); }
|
|
sS=GetZodiacResRef(nN);
|
|
oWP=GetWaypointByTag("ZODIAC_SPAWNW");
|
|
oZodiac=CreateObject(OBJECT_TYPE_PLACEABLE,sS,GetLocation(oWP),FALSE,"ZODIAC_TEMPLE");
|
|
} // east
|
|
} // fnSpawnZodiacs()
|
|
|
|
int fnGetRandomRune(int nNot)
|
|
{ // PURPOSE: Return any random rune that is not nNot
|
|
int nRet=Random(24)+1;
|
|
while(nRet==nNot)
|
|
{ // try again
|
|
nRet=Random(24)+1;
|
|
} // try again
|
|
return nRet;
|
|
} // fnGetRandomRune()
|
|
|
|
void fnPlaceRandomTreasures()
|
|
{ // PURPOSE: To place 7 piles of gold with 1 to 1000 gold each in them
|
|
object oPlace;
|
|
object oItem;
|
|
object oWP;
|
|
int nN;
|
|
int nAmount;
|
|
nN=1;
|
|
while(nN<8)
|
|
{ // place treasure
|
|
oWP=GetWaypointByTag("TEMPLE_TREASUREM"+IntToString(nN));
|
|
oPlace=GetNearestObjectByTag("pileogold",oWP,1);
|
|
if (oPlace==OBJECT_INVALID||GetDistanceBetween(oPlace,oWP)>1.0)
|
|
{ // place treasure
|
|
nAmount=Random(1000)+1;
|
|
oPlace=CreateObject(OBJECT_TYPE_PLACEABLE,"pileogold",GetLocation(oWP));
|
|
oItem=CreateItemOnObject("nw_it_gold001",oPlace,nAmount);
|
|
} // place treasure
|
|
nN++;
|
|
} // place treasure
|
|
} // fnPlaceRandomTreasures()
|
|
|
|
void fnPurgeWater(int nNotLevel)
|
|
{ // 0 = purge all, 1 = low, 2 = med, 3 = high
|
|
object oWater;
|
|
object oWP=GetWaypointByTag("TEGODS_WATER");
|
|
int nN;
|
|
if (nNotLevel!=1)
|
|
{ // low water
|
|
nN=1;
|
|
oWater=GetNearestObjectByTag("waterlow",oWP,nN);
|
|
while(oWater!=OBJECT_INVALID)
|
|
{ // purge
|
|
DelayCommand(0.2,DestroyObject(oWater));
|
|
nN++;
|
|
oWater=GetNearestObjectByTag("waterlow",oWP,nN);
|
|
} // purge
|
|
} // low water
|
|
if (nNotLevel!=2)
|
|
{ // med water
|
|
nN=1;
|
|
oWater=GetNearestObjectByTag("watermed",oWP,nN);
|
|
while(oWater!=OBJECT_INVALID)
|
|
{ // purge
|
|
DelayCommand(0.2,DestroyObject(oWater));
|
|
nN++;
|
|
oWater=GetNearestObjectByTag("watermed",oWP,nN);
|
|
} // purge
|
|
} // med water
|
|
if (nNotLevel!=3)
|
|
{ // high water
|
|
nN=1;
|
|
oWater=GetNearestObjectByTag("waterhigh",oWP,nN);
|
|
while(oWater!=OBJECT_INVALID)
|
|
{ // purge
|
|
DelayCommand(0.2,DestroyObject(oWater));
|
|
nN++;
|
|
oWater=GetNearestObjectByTag("waterhigh",oWP,nN);
|
|
} // purge
|
|
} // high water
|
|
} // fnPurgeWater()
|
|
|
|
void fnCreate(location lLoc,int nNum=1)
|
|
{
|
|
object oWater;
|
|
if (nNum==1) oWater=CreateObject(OBJECT_TYPE_PLACEABLE,"waterlow",lLoc);
|
|
else if (nNum==2) oWater=CreateObject(OBJECT_TYPE_PLACEABLE,"watermed",lLoc);
|
|
else if (nNum==3) oWater=CreateObject(OBJECT_TYPE_PLACEABLE,"waterhigh",lLoc);
|
|
} // fnCreateLow()
|
|
|
|
void fnSetWaterLevel(int nLevel)
|
|
{ // level 0 = none, 1 = low, 2 = med, 3 = high
|
|
object oWater;
|
|
object oWP=GetWaypointByTag("TEGODS_WATER");
|
|
object oSpawn;
|
|
int nN;
|
|
location lLoc;
|
|
fnPurgeWater(0);
|
|
nN=1;
|
|
if (nLevel>0&&nLevel<4)
|
|
{ // water needed
|
|
oSpawn=GetNearestObjectByTag("WATEREL_SPAWN",oWP,nN);
|
|
while(oSpawn!=OBJECT_INVALID)
|
|
{ // spawn water
|
|
lLoc=GetLocation(oSpawn);
|
|
DelayCommand(0.3,fnCreate(lLoc,nLevel));
|
|
nN++;
|
|
oSpawn=GetNearestObjectByTag("WATEREL_SPAWN",oWP,nN);
|
|
} // spawn water
|
|
} // water needed
|
|
SetLocalInt(GetModule(),"nTempleWaterLevel",nLevel);
|
|
} // fnSetWaterLevel()
|
|
|
|
void fnResetWater()
|
|
{ // PURPOSE: Set Water levels to high
|
|
object oLever;
|
|
int nN=1;
|
|
fnSetWaterLevel(3);
|
|
oLever=GetObjectByTag("WaterLever"+IntToString(nN));
|
|
while(nN<4)
|
|
{ // set levers to useable
|
|
DeleteLocalInt(oLever,"bUsed");
|
|
nN++;
|
|
oLever=GetObjectByTag("WaterLever"+IntToString(nN));
|
|
} // set levers to useable
|
|
} // fnResetWater()
|
|
|
|
|
|
void ResetPuzzle()
|
|
{ // PURPOSE: To reset the entire puzzle
|
|
int nKeywordNumber;
|
|
int nKeyword;
|
|
int nN;
|
|
int nProper;
|
|
int nPos;
|
|
int nR;
|
|
int nStage;
|
|
string sRes;
|
|
object oWP;
|
|
object oRune;
|
|
fnDestroyRunes();
|
|
fnDestroyCreatures();
|
|
fnDestroyZodiacs();
|
|
fnSpawnZodiacs();
|
|
fnSpawnCreatures();
|
|
DelayCommand(2.0,fnResetWater());
|
|
nKeywordNumber=GetPuzzleKeyword();
|
|
SetPuzzleKeywordRunes(nKeywordNumber);
|
|
nStage=1;
|
|
while(nStage<10)
|
|
{ // process stages
|
|
switch(nStage)
|
|
{ // stages
|
|
case 1: { // 4 runes - 1st letter
|
|
nProper=GetPuzzleKeywordRune(nKeywordNumber,1);
|
|
nPos=d4();
|
|
nN=1;
|
|
while(nN<5)
|
|
{ // place runes
|
|
oWP=GetWaypointByTag("STAGE1_"+IntToString(nN));
|
|
if (nN==nPos)
|
|
{ // correct rune
|
|
sRes=GetPuzzleRuneResRef(nProper);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nProper);
|
|
} // correct rune
|
|
else
|
|
{ // other rune
|
|
nR=fnGetRandomRune(nProper);
|
|
sRes=GetPuzzleRuneResRef(nR);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nR);
|
|
} // other rune
|
|
nN++;
|
|
} // place runes
|
|
break;
|
|
} // 4 runes - 1st letter
|
|
case 3: { // 4 runes - 2nd letter
|
|
nProper=GetPuzzleKeywordRune(nKeywordNumber,2);
|
|
nPos=d4();
|
|
nN=1;
|
|
while(nN<5)
|
|
{ // place runes
|
|
oWP=GetWaypointByTag("STAGE3_"+IntToString(nN));
|
|
if (nN==nPos)
|
|
{ // correct rune
|
|
sRes=GetPuzzleRuneResRef(nProper);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nProper);
|
|
} // correct rune
|
|
else
|
|
{ // other rune
|
|
nR=fnGetRandomRune(nProper);
|
|
sRes=GetPuzzleRuneResRef(nR);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nR);
|
|
} // other rune
|
|
nN++;
|
|
} // place runes
|
|
break;
|
|
} // 4 runes - 2nd letter
|
|
case 5: { // 3 runes - 3rd letter
|
|
nProper=GetPuzzleKeywordRune(nKeywordNumber,3);
|
|
nPos=d3();
|
|
nN=1;
|
|
while(nN<4)
|
|
{ // place runes
|
|
oWP=GetWaypointByTag("STAGE5_"+IntToString(nN));
|
|
if (nN==nPos)
|
|
{ // correct rune
|
|
sRes=GetPuzzleRuneResRef(nProper);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nProper);
|
|
} // correct rune
|
|
else
|
|
{ // other rune
|
|
nR=fnGetRandomRune(nProper);
|
|
sRes=GetPuzzleRuneResRef(nR);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nR);
|
|
} // other rune
|
|
nN++;
|
|
} // place runes
|
|
break;
|
|
} // 3 runes - 3rd letter
|
|
case 7: { // 3 runes - 4th letter
|
|
nProper=GetPuzzleKeywordRune(nKeywordNumber,4);
|
|
nPos=d3();
|
|
nN=1;
|
|
while(nN<4)
|
|
{ // place runes
|
|
oWP=GetWaypointByTag("STAGE7_"+IntToString(nN));
|
|
if (nN==nPos)
|
|
{ // correct rune
|
|
sRes=GetPuzzleRuneResRef(nProper);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nProper);
|
|
} // correct rune
|
|
else
|
|
{ // other rune
|
|
nR=fnGetRandomRune(nProper);
|
|
sRes=GetPuzzleRuneResRef(nR);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nR);
|
|
} // other rune
|
|
nN++;
|
|
} // place runes
|
|
break;
|
|
} // 3 runes - 4th letter
|
|
case 9: { // 2 runes - 5th letter
|
|
nProper=GetPuzzleKeywordRune(nKeywordNumber,5);
|
|
nPos=d2();
|
|
nN=1;
|
|
while(nN<3)
|
|
{ // place runes
|
|
oWP=GetWaypointByTag("STAGE9_"+IntToString(nN));
|
|
if (nN==nPos)
|
|
{ // correct rune
|
|
sRes=GetPuzzleRuneResRef(nProper);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nProper);
|
|
} // correct rune
|
|
else
|
|
{ // other rune
|
|
nR=fnGetRandomRune(nProper);
|
|
sRes=GetPuzzleRuneResRef(nR);
|
|
oRune=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP),FALSE,"RUNIC_PART");
|
|
SetLocalInt(oRune,"nValue",nR);
|
|
} // other rune
|
|
nN++;
|
|
} // place runes
|
|
break;
|
|
} // 2 runes - 5th letter
|
|
default: break;
|
|
} // stages
|
|
nStage++;
|
|
} // process stages
|
|
DelayCommand(5.0,fnPlaceRandomTreasures());
|
|
} // ResetPuzzle()
|
|
|
|
|
|
string GetZodiacName(int nZodiacNumber)
|
|
{ // PURPOSE: Return the name of the zodiac for the number
|
|
if (nZodiacNumber==1) return "Aquarius";
|
|
else if (nZodiacNumber==2) return "Aries";
|
|
else if (nZodiacNumber==3) return "Cancer";
|
|
else if (nZodiacNumber==4) return "Capricorn";
|
|
else if (nZodiacNumber==5) return "Gemini";
|
|
else if (nZodiacNumber==6) return "Leo";
|
|
else if (nZodiacNumber==7) return "Libra";
|
|
else if (nZodiacNumber==8) return "Pisces";
|
|
else if (nZodiacNumber==9) return "Sagittarius";
|
|
else if (nZodiacNumber==10) return "Scorpio";
|
|
else if (nZodiacNumber==11) return "Taurus";
|
|
else if (nZodiacNumber==12) return "Virgo";
|
|
return "";
|
|
} // GetZodiacName()
|
|
|
|
string GetZodiacResRef(int nZodiacNumber)
|
|
{ // PURPOSE: Return the ResRef of the zodiac in question
|
|
if (nZodiacNumber==1) return "zodiac1";
|
|
else if (nZodiacNumber==2) return "zodiac002";
|
|
else if (nZodiacNumber==3) return "zodiac003";
|
|
else if (nZodiacNumber==4) return "zodiac004";
|
|
else if (nZodiacNumber==5) return "zodiac005";
|
|
else if (nZodiacNumber==6) return "zodiac006";
|
|
else if (nZodiacNumber==7) return "zodiac007";
|
|
else if (nZodiacNumber==8) return "zodiac008";
|
|
else if (nZodiacNumber==9) return "zodiac009";
|
|
else if (nZodiacNumber==10) return "zodiac010";
|
|
else if (nZodiacNumber==11) return "zodiac011";
|
|
else if (nZodiacNumber==12) return "zodiac012";
|
|
return "";
|
|
} // GetZodiacResRef()
|
|
|
|
//void main(){}
|