//////////////////////////////////// /// RPG SYSTEM FRAMEWORK /// /// Alpha v.0.81 - 5th June 2014 /// //////////////////////////////////// ///////////////// /// CONSTANTS /// ///////////////// //Counters const int CR_HP = 8; //Sript 2 const int CR_MP = 9; //Script 3 const int CR_HP_MAX = 10; //Script 4 const int CR_MP_MAX = 11; //Script 5 const int CR_XP = 12; //Script 6 const int CR_LEVEL = 13; //Script 7 const int CR_LVL = 13; //Script 7 const int CR_XP_10K = 16; //Script 10 const int CR_MERKS = 20; //Script 14 const int CR_FREE_SPACE = 21; //Script 15 const int AmmoToLoad = 24; //Script 18 const int GunCounter = 31; //Script 25 const int CR_STAT_MUSC = 0; // statsArray[0] const int CR_STAT_BODY = 1; // statsArray[1] const int CR_STAT_MIND = 2; // statsArray[2] const int CR_STAT_MYST = 3; // statsArray[3] const int CR_STAT_INFL = 4; // statsArray[4] const int CR_STAT_LUCK = 5; // statsArray[5] //Combos const int CMB_BLANK = 0; //Leave this be - combo 0 should always be invisible and no properties const int CMB_FREEZEALL = 1708; //Combo with "Freeze all (Except FFCs)" type const int CMB_FREEZEFFC = 1709; //Combo with "Freeze all (FFCs only)" type //FFC Slots const int FFC_FREEZEALL = 31; const int FFC_FREEZEFFC = 32; const int FFC_FREEZE_1 = 31; const int FFC_FREEZE_2 = 32; const int SCREEN_FREEZE_COMBO_1 = 1708; const int SCREEN_FREEZE_COMBO_2 = 1709; //XP System const int HP_DEAD = -999; //Enemy has been counted for EXP (don't touch) const int NPC_MISC_MAXHP = 0; //Which npc->Misc[] value to store HP in (don't touch) const int EXP_HP_RATIO = 1; //Enemy EXP value = HP divided by this const int SFX_LEVEL = 32; //SFX to play when you level up (0 = disable) const int I_FASTWALK = 17; //ID of the fast walk item const int I_LEADERSHIP = 17; //ID of the leadership item const int I_TREASUREHUNTER = 17; //ID of the treasure hunter item const int EXP_LEADERSHIPCHANCE = 10; //One in {this} chance to get +1 exp const int EXP_FASTWALKRATE = 5; //Every {this} frames, walk an extra pixel const int SF_TREASURE = 0; //Which screen flag to check for treasure (default Script1) const int SFX_TREASURESCREEN = 27; //SFX to play when Treasure Hunter activates ///////////////////////// /// Dropset Constants /// ///////////////////////// const int DROP_ENEMY_ID = 0; //Set to the enemy to use for enemy-based dropset functions. ////////////////////////////////// /// Wallet and Money Constants /// ////////////////////////////////// //const int CR_WALLETS = 0; //const int NO_FREE_SPACE = 0; const int NO_FREE_SPACE = 0; //Sets default 'You don;t have the space to carry this item' message. const int NO_SPACE_SFX = 0; //Sets SFX to play when trying to pick up an item that you can't carry. const int CR_SIZE_COINS_CURRENCY = 0; const int CR_DSARI = 0; //////////////////////////////// /// Weapons, Armour, Shields /// //////////////////////////////// const int SHIELD_LOST = 0; //Set message to display when losing a sheild. const int SWORD_LOST = 0; //Set message to display when losing a sword. const int ARMOUR_LOST = 0; //Set message to display when losing armour. //////////////////////// /// Special Movement /// //////////////////////// const int SwimPaddle = 26; //Set to swimming paddle sound. ///////////////// /// VARIABLES /// ///////////////// int gainLevel; bool isSwimming; bool d20Mods = false; //Set to true, to use d20 System calculations, Otherwise, stat mods use... int statModMultiplier = 0.5; ////////////////////////////////// /// Wallet and Money Variables /// ////////////////////////////////// float walletSize = 50; //Sts default space within wallets. Can be changed later in game. int walletsOwned = 1; //Setsa initial number of wallets owned by player. float walletSpaceUsed = 0; //Sets initial amount of used wallet space. int pockets = 2; //Sets initial number of pockets player has. Can be changed with clothing upgrades. float pocketCapacity = 20; // Sets pocket capacity for loose items. float pocketSpaceUsed = 0; //Sets initial pocket space used by player. float totalWalletSpace; float baseWalletSpace; float totalPocketSpace; float totalPocketAndWalletSpace; float CR_CUSTOM_WALLET_SIZE = 0; float freePocketSpace; float freeWalletSpace; float freeSpace; float valueStored; float coinsize; //int totalWalletSpace = ( CR_WALLETSPACE * CR_WALLETS ) //int freeWalletSpace = Game->MCounter[CR_WALLETSPACE] - Game->Counter[CW_WALLETSPACE] bool noFreeSpace = false; bool reduced; //These values should be an array! /////////////////////////// /// SKill Check Globals /// /////////////////////////// int loreSkill; int loreSuccess = 0; int loreRow = 0; int loreColumn = 0; //Create a single pointer, that may not be needed. int loreValue(){ int value = ( loreRow + loreColumn ); return value; } //////////////////////////////// /// Weapons, Armour, Shields /// //////////////////////////////// bool hasShield; bool shieldMessage = true; bool hasSword; bool swordMessage = true; bool hasArmour; bool armourMessage = true; ////////////// /// ARRAYS /// ////////////// int levelStrings[21] = { 61, 61, 61, 61, 60, 59, 59, 59, 59, 61, 59, 59, 59, 59, 59, 62, 59, 59, 59, 63, 85 }; // Element [0] General string, for common use. // Element [1] to [20]The strings to play when gaining levels 1, through 20. int statsArray[6]= {10, 10, 10, 10, 10, 10}; // Muscle, Body, Mind, Myst, infl, Luck // These are the starting values. The function Increase /////////////////////////////// /// Wallet and Money Arrays /// /////////////////////////////// float capacitiyArray[26]={ 0, //baseWalletSpace[0] 50, //walletSize [1] 1, //walletsOwned [2] 0, //CR_CUSTOM_WALLET_SIZE [3] (add space to this for wallets that have a size > walletSize) 50, //totalWalletSpace [4] 2, //pockets [5] 20, //pocketCapacity [6] 40, //totalPocletSpace [7] 90, //totalPocketAndWalletSpace [8] 0, //pocketSpaceUsed [9] 0, //walletSpaceUsed [10] 0, //fineSpaceUsed [11] (for items smaller than 1, multiply this by *0.10, then add this to spaceUsed) 0, //totalSpaceUsed [12] 0, //freePocketSpace [13] 0, //freeWalletSpace [14] 0, //freeFineSpace [15] 0, //freeSpace [16] 0, //valueStored [17] 0, //coinsize [18] 0, //Merks Carried [19] 0, //Value of Dsari banked [20] 0, //Value of Merks banked [21] 0, //Dsari CryDiscs [22] 0, //merks CryDiscs [23] 0, //NO_FREE_SPACE [24] Message 0}; //NO_SPACE_SFX [25] SFX ///////////////// /// FUNCTIONS /// ///////////////// /////////////////////// /// SCREEN FREEZING /// /////////////////////// //WARNING: DO NOT USE IN AN FFC SCRIPT OR THE FFC WILL FREEZE ITSELF! //Use in global scripts only. void freezeScreen(){ ffc freezeAll = Screen->LoadFFC(FFC_FREEZEALL); freezeAll->Data = CMB_FREEZEALL; ffc freezeFFC = Screen->LoadFFC(FFC_FREEZEFFC); freezeFFC->Data = CMB_FREEZEFFC; } void unfreezeScreen(){ ffc freezeAll = Screen->LoadFFC(FFC_FREEZEALL); freezeAll->Data = CMB_BLANK; ffc freezeFFC = Screen->LoadFFC(FFC_FREEZEFFC); freezeFFC->Data = CMB_BLANK; } //WARNING: DO NOT USE IN AN FFC SCRIPT OR THE FFC WILL FREEZE ITSELF! //Use in global scripts only. void freezeAction(){ ffc freezeAll = Screen->LoadFFC(FFC_FREEZEALL); freezeAll->Data = CMB_FREEZEALL; //SuspendGhostZHScripts(); //Un-comment this if you're using ghost.zh } void unfreezeAction(){ ffc freezeAll = Screen->LoadFFC(FFC_FREEZEALL); freezeAll->Data = CMB_BLANK; //ResumeGhostZHScripts(); //Un-comment this if you're using ghost.zh } /////////////////////////////// /// SPECIAL RAND OPERATIONS /// /////////////////////////////// item script produceReRand{ void run(int min, int max, int exclude){ int value = reRand(min, max, exclude); Trace(value); } } int reRand(int min, int max, int exclude){ int value; do{ value = Rand(min, max); } while(value < min || value == exclude); return value; } ///////////////////////// /// DROPSET FUNCTIONS /// ///////////////////////// //void DropItems(int drop, int loc) { // DropItems(drop, ComboX(loc), ComboY(loc));} // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemSet(int drop, int x, int y) { npc n = CreateNPCAt(DROP_ENEMY_ID, x, y); n->HP = HP_SILENT; n->ItemSet = drop; } // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemSet(ffc this, int drop) { npc n = CreateNPCAt(DROP_ENEMY_ID, this->X, this->Y); n->HP = HP_SILENT; n->ItemSet = drop; } // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemExplode(ffc this, int drop) { DropItemSet(this, drop); eweapon explosion = CreateEWeaponAt(EW_BOMBBLAST, this->X, this->Y); //explosion->CollDetection = true; //This is true by default explosion->Damage = 10; } // Drop an item from a dropset. // int dropset: The number of a dropset. // int x, int y or int loc: location of the drop. void DropItemExplodeBig(ffc this, int drop) { DropItemSet(this, drop); // One explosion every 16 frames, 15 times for(int i=0; i<15; i++) { eweapon explosion = CreateEWeaponAt(EW_SBOMBBLAST, this->X, this->Y); //explosion->CollDetection = true; //This is true by default explosion->Damage = 10; } } int randItem(int list, int locX, int locY){ int rollValue; int d100 = rollDie(100); rollValue = d100; int dropItem; if ( list < 2 ) { if ( rollValue > 0 && rollValue < 6 ) { //01%-10% dropItem = 2; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 10 && rollValue < 16 ) { //11%-20% dropItem = 0; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 20 && rollValue < 23 ) { //21%-25% dropItem = 2; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 26 && rollValue < 29 ) { //26%-30% dropItem = 1; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 40 && rollValue < 42 ) { //31%-35% dropItem = 170; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 43 && rollValue < 46 ) { //36%-40% dropItem = 70; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 60 && rollValue < 62 ) { //41%-45% dropItem = 149; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 65 && rollValue < 67 ) { //46%-47% dropItem = 86; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue > 74 && rollValue < 76 ) { //48%-49% dropItem = 171; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue == 80 ) { //50% dropItem = 38; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue == 85 ) { //51% dropItem = 39; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue == 90 ) { //52% dropItem = 87; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue == 95 ) { //53% dropItem = 187; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue == 99 ) { //54% dropItem = 180; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } if ( rollValue == 100 ) { //55% dropItem = 197; item dropThis = Screen->CreateItem(dropItem); dropThis->X = locX; dropThis->Y = locY; } } else { } } //////////////////////// //// Roll Functions //// //////////////////////// int rollDie(int type){ int n = Rand(1, type); return n; } int diePerLevel(int dieType, int dieCap){ int diceTotal = 0; int level = Game->Counter[CR_LEVEL]; int rollLevels = 0; if ( dieCap > 0 ) { rollLevels = dieCap; } else { rollLevels = level; } for (int dice = 1; dice <= rollLevels; dice++){ int roll = Rand(1, dieType); diceTotal = diceTotal+roll; } return diceTotal; } int rollDice(int rollNumber, int dieType){ int diceTotal = 0; for (int dice = 1; dice <= rollNumber; dice++){ int roll = Rand(1, dieType); diceTotal = diceTotal+roll; } return diceTotal; } int rollDiceDW(int rollNumber, int dieType){ int A = 0; int L = 0; int rollTimes = ( rollNumber+ 1 ); //+1, because the loop will end as soon as it is !< rollTimes. do { A += Rand(1,dieType); L ++; } while(L < rollTimes); } int rollDiceII(int dice, int dietype) { int total = 0; for(; dice>0; dice--){ total+=Rand(1, dietype); } return total; } int RollDiceAlucard(int numdice, int dicetype){ int dicetotal = 0; for (int dice = 1; dice <= numdice; dice++){ int roll = Rand(1, dicetype); dicetotal = dicetotal+roll; } return dicetotal; } int rolld4Level(int level) { int total; if ( level == 0 ) { total = ( roll1d4() ); } else if ( level == 1 ) { total = ( roll1d4()); } else if ( level == 2 ) { total = ( roll1d4() + roll1d4() ); } else if ( level == 3 ) { total = ( roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 4 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 5 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 6 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 7 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 8 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 9 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 10 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 11 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 12 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 13 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 14) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 15 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 16 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 17 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 18 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() ); } else if ( level == 19 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() +roll1d4() ); } else if ( level == 20 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() +roll1d4() + roll1d4() ); } else if ( level >= 21 ) { total = ( roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() + roll1d4() +roll1d4() + roll1d4() + roll1d4() ); } return total; } int roll1d4() { int n = Rand(1, 4); return n; } int roll1d6() { int n = Rand(1, 6); return n; } int roll4d6(){ int a = Rand(1, 6); int b = Rand(1, 6); int c = Rand(1, 6); int d = Rand(1, 6); int t = ( a + b + c + d ); return t; } int roll1d8() { int n = Rand(1, 8); return n; } int roll1d10() { int n = Rand(1, 10); return n; } int roll1d12() { int n = Rand(1, 12); return n; } int roll1d20() { int n = Rand(1, 20); return n; } int roll1d50() { int n = Rand(1, 50); return n; } int roll1d100() { int n = Rand(1, 100); return n; } /////////////////////////// /// Statistic Functions /// /////////////////////////// /////////////////////// /// GET STAT VALUES ///////////////////////////////////////////////////////// /// these functions read the present value of a statistic, and return it. /// ///////////////////////////////////////////////////////////////////////////// int getMuscStat(){ int stat = statsArray[0]; return stat; } int getBodyStat(){ int stat = statsArray[1]; return stat; } int getMindStat(){ int stat = statsArray[2]; return stat; } int getMystStat(){ int stat = statsArray[3]; return stat; } int getInflStat(){ int stat = statsArray[4]; return stat; } int getLuckStat(){ int stat = statsArray[5]; return stat; } /// Get Modifiers int getMuscMod(){ int statValue = getMuscStat(); int modifiedValue; if ( d20Mods == true ) { modifiedValue = ( ( statValue * 0.5 ) - 5 ); } else { modifiedValue = ( statValue * statModMultiplier ); } return modifiedValue; } int getBodyMod(){ int statValue = getBodyStat(); int modifiedValue; if ( d20Mods == true ) { modifiedValue = ( ( statValue * 0.5 ) - 5 ); } else { modifiedValue = ( statValue * statModMultiplier ); } return modifiedValue; } int getMindMod(){ int statValue = getMindStat(); int modifiedValue; if ( d20Mods == true ) { modifiedValue = ( ( statValue * 0.5 ) - 5 ); } else { modifiedValue = ( statValue * statModMultiplier ); } return modifiedValue; } int getMystMod(){ int statValue = getMystStat(); int modifiedValue; if ( d20Mods == true ) { modifiedValue = ( ( statValue * 0.5 ) - 5 ); } else { modifiedValue = ( statValue * statModMultiplier ); } return modifiedValue; } int getInflMod(){ int statValue = getInflStat(); int modifiedValue; if ( d20Mods == true ) { modifiedValue = ( ( statValue * 0.5 ) - 5 ); } else { modifiedValue = ( statValue * statModMultiplier ); } return modifiedValue; } int getLuckMod(){ int statValue = getLuckStat(); int modifiedValue; if ( d20Mods == true ) { modifiedValue = ( ( statValue * 0.5 ) - 5 ); } else { modifiedValue = ( statValue * statModMultiplier ); } return modifiedValue; } int getStatModifier(int stat){ int statValue = statsArray[stat]; int modifiedValue; if ( d20Mods == true ) { modifiedValue = ( ( statValue * 0.5 ) - 5 ); } else { modifiedValue = ( statValue * statModMultiplier ); } return modifiedValue; } /////////////////////////////// /// INCREASE STAT FUNCTIONS //////////////////////////////////////// /// These increase statistics by either fixed, or random values. /// //////////////////////////////////////////////////////////////////// //Increases a stat at random, by 1d6 void increaseStat() { int stat = Rand(5); int n = rollDie(6); statsArray[stat] += n; } //increases a random stat at random, with a minimum, and a maximum value set by args. void increaseRandomStat(int min, int max){ int stat = Rand(5); int n = Rand(min, max); statsArray[stat] += n; } //Increases a random stat by 1dX, where X is set as an argument. void increaseRandomStatByDie(int die){ int stat = Rand(5); int n = rollDie(die); statsArray[stat] += n; } void increaseSpecificStat(int stat, int value){ statsArray[stat] += value; } void increaseMuscleStat(int value){ statsArray[CR_STAT_MUSC] += value; } void increaseBodyStat(int value){ statsArray[CR_STAT_BODY] += value; } void increaseMindStat(int value){ statsArray[CR_STAT_MIND] += value; } void increaseMystStat(int value){ statsArray[CR_STAT_MYST] += value; } void increaseInflStat(int value){ statsArray[CR_STAT_INFL] += value; } void increaseLuckStat(int value){ statsArray[CR_STAT_LUCK] += value; } /// Increase specific stats, by a random value. void increaseMuscleStatRandom(int min, int max){ int value = Rand(min, max); statsArray[CR_STAT_MUSC] += value; } void increaseBodyStatRandom(int min, int max){ int value = Rand(min, max); statsArray[CR_STAT_BODY] += value; } void increaseMindStatRandom(int min, int max){ int value = Rand(min, max); statsArray[CR_STAT_MIND] += value; } void increaseMystStatRandom(int min, int max){ int value = Rand(min, max); statsArray[CR_STAT_MYST] += value; } void increaseInflStatRandom(int min, int max){ int value = Rand(min, max); statsArray[CR_STAT_INFL] += value; } void increaseLuckStatRandom(int min, int max){ int value = Rand(min, max); statsArray[CR_STAT_LUCK] += value; } ///Increase specific stats by random number based on a die roll void increaseMuscleStatDie(int dieType){ int value = rollDie(dieType); statsArray[CR_STAT_MUSC] += value; } void increaseBodyStatDie(int dieType){ int value = rollDie(dieType); statsArray[CR_STAT_BODY] += value; } void increaseMindStatDie(int dieType){ int value = rollDie(dieType); statsArray[CR_STAT_MIND] += value; } void increaseMystStatDie(int dieType){ int value = rollDie(dieType); statsArray[CR_STAT_MYST] += value; } void increaseInflStatDie(int dieType){ int value = rollDie(dieType); statsArray[CR_STAT_INFL] += value; } void increaseLuckStatDie(int dieType){ int value = rollDie(dieType); statsArray[CR_STAT_LUCK] += value; } ////////////////////////// /// SET STAT FUNCTIONS //////////////////////////////////////////// /// These set a statistic to the exact value specified as arg0. /// /////////////////////////////////////////////////////////////////// //Sets specified stat to value desired The stat must be passed as an argument.. void setStat(int stat, int value){ statsArray[stat] = value; } //Sets a stat, without passing the value of the stat, by referencing it directly. void setMuscStat(int value){ statsArray[0] = value; } void setBodyStat(int value){ statsArray[1] = value; } void setMindStat(int value){ statsArray[2] = value; } void setMystStat(int value){ statsArray[3] = value; } void setInflStat(int value){ statsArray[4] = value; } void setLuckStat(int value){ statsArray[5] = value; } //////////////////////////// /// MISC STATS FUNCTIONS /// //////////////////////////// /// Selects a statistic at random, and returns its value. int rollStat() { int r = Rand(1, 6); //specific value of 1-6 set at random; if ( r == 1 ) { int stat = statsArray[0]; return stat; } else if ( r == 2 ) { int stat = statsArray[1]; return stat; } else if ( r == 3 ) { int stat = statsArray[2]; return stat; } else if ( r == 4 ) { int stat = statsArray[3]; return stat; } else if ( r == 5 ) { int stat = statsArray[4]; return stat; } else if ( r == 6 ) { int stat = statsArray[5]; return stat; } } // Using Stats // heavy weapon script particles // discover present slot of item // set int of slot of item for bools // when trying to use the item // if CT_MUSC < x // set other slot to 'hand' until item is changed. // // Use Body to affect HP: // Use Body to set HP at level increases. Use to set HP regen rate. // Use MUSC to set-augment weapon damage, via roll1dX rands. // Use MUSC for ability to move objects. // bracelets increase Musc, as well as activating triggers. // Bracelet / gauntlet takes up a slot. Any combination of two rings, or one ring and one bracelet at one time. // Use Luck to set jinx durations. // Use Myst to set spell damage. // Require Myst of certain value to use some spells. // Ue Mind for Lore skills. // Use Mind for raw (untrained) examination checks. // Create LWeapon that deals damage based on dX rolls. // Is there any way to use MUSC and random damage on swords? // Possibly replace rhe power of the LW_SWORD generated with a sword with a different value? // INF should set the strings used on FFC scripts when conversing. // A higher INF would open up more lines of dialogue. ////////////////////// /// Bump Functions ///////////////////// /// These Functions increase HP & MP /// //////////////////////////////////////// /// MP Functions void increaseMP() { int amount = ( rollDie(10) + rollDie(10) + rollDie(10) ); int myst = ( getMystStat() * 0.5 ); int total = ( amount + myst ); Link->MP += total; Link->MaxMP += total; } void increaseMP_ByDietype(int dieType){ int amount = rollDie(dieType); int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->MP += total; Link->MaxMP += total; } void increaseMP_MultipleDice(int dice, int dieType){ int amount = rollDice(dice, dieType); int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->MP += total; Link->MaxMP += total; } void increaseMP_specificAmount_withStatboost(int amount){ int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->MP += total; Link->MaxMP += total; } void increaseMP_specificAmount_noStatBoost(int amount){ Link->MP += amount; Link->MaxMP += amount; } void increaseMP_Random_withStatBoost(int min, int max){ int amount = Rand(min, max); int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->MP += total; Link->MaxMP += total; } void increaseMP_Random_withoutStatBoost(int min, int max){ int amount = Rand(min, max); Link->MP += amount; Link->MaxMP += amount; } /// HP Functions void increaseHP() { int amount = ( rollDie(10) + rollDie(10) + rollDie(10) + rollDie(10) + rollDie(10) ); int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->HP += total; Link->MaxHP += total; } void increaseHP_ByDietype(int dieType){ int amount = rollDie(dieType); int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->HP += total; Link->MaxHP += total; } void increaseHP_MultipleDice(int dice, int dieType){ int amount = rollDice(dice, dieType); int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->HP += total; Link->MaxHP += total; } void increaseHP_specificAmount_withStatboost(int amount){ int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->HP += total; Link->MaxHP += total; } void increaseHP_specificAmount_noStatBoost(int amount){ Link->HP += amount; Link->MaxHP += amount; } void increaseHP_Random_withStatBoost(int min, int max){ int amount = Rand(min, max); int body = ( getBodyStat() * 0.5 ); int total = ( amount + body ); Link->HP += total; Link->MaxHP += total; } void increaseHP_Random_withoutStatBoost(int min, int max){ int amount = Rand(min, max); Link->HP += amount; Link->MaxHP += amount; } ////////////////////////////////// /// Wallet & Pockets Functions /// ////////////////////////////////// void noFreeSpace() { if ( noFreeSpace == false ) { noFreeSpace = true; Screen->Message(NO_FREE_SPACE); //This message will be shown to the player one time, setting noFreeSpace to true. //If the player visits a bank, spends money depleting used space, or ptherwise increases space //then this flag is set back to false. The idea is to prevent displaying a message regularly. } else { Game->PlaySound(NO_SPACE_SFX); } } void spaceFreed() { noFreeSpace = false; //This is a global function that resets the noFreeSpace flag,a nd can be called from anywhere. } void checkFreeSpace() { //This fnction should be in your global while true loop. //It ensures that the noFreeSpace flag is reset if the player spends money, or deposits funds, etc. int walletFreeSpace; int pocketFreeSpace; walletFreeSpace = ( totalWalletSpace - Game->Counter[CR_SIZE_COINS_CURRENCY] ); pocketFreeSpace = ( totalPocketSpace - CR_SIZE_COINS_CURRENCY ); if ( walletFreeSpace > 5 ) { noFreeSpace = false; } if ( walletFreeSpace < 5 ){ if (pocketFreeSpace < coinsize ) { noFreeSpace = false; } } } void storeValue(){ int valueStored = Game->Counter[CR_RUPEES]; } void compareValue(){ if ( valueStored <= Game->Counter[CR_RUPEES] ) { noFreeSpace = true; } else { noFreeSpace = false; } } ///////////////////////////////////////////// /// Armour, Swords, and Shields Functions /// ///////////////////////////////////////////// void checkEatenItems() { //Place this in your main while loop, to display messages to the player if an item is eaten. if ( hasShield == false && shieldMessage == false ){ shieldMessage = true; Screen->Message(SHIELD_LOST); } if ( hasSword == false && swordMessage == false ){ swordMessage = true; Screen->Message(SWORD_LOST); } if ( hasArmour == false && swordMessage == false ){ armourMessage = true; Screen->Message(ARMOUR_LOST); } } /////////////////////// /// SKill Functions /// /////////////////////// void LoreCheckGeneric() { int loreBase; loreBase = ( loreSkill * 10 ); int loreTotal = ( loreBase + getMindStat() ); int loreDifference = ( loreTotal - loreBase ); int loreRoll = rollDie(100); bool success; int loreType; int itemToCheck; int location; int level; int skill; if ( loreRoll < loreTotal ) { //Success loreSuccess = 1; } else { //failure loreSuccess = 2; } } void makeLoreCheck(){ if ( loreSuccess == 0 ){ //do this } } void LoreCheckSuccess(bool success, int loreType, int itemToCheck, int location, int level, int skill ){ if ( loreSuccess == 0 ){ //import results from makeLoreCheck. Create a makeLoreCheck command for each item //that can use it, and each site that can use it. } } void loreLevel(){ loreSuccess = 0; //When increasing Lore, or gaining a level, reset this value. } //Possibly, use a function in the while loop with its own ints and bools. //THis function would store the lore check results and the level of the check //for every item. It wouod compare the result (0, 1, 2) to the character level, and the level at the time //that the player made the check. If the currentLevel > lastLevelForCheck, then it will allow a new check. //if the result is 0, it will always allow a check, and if the result is 2, it gives the new item. //This would keep the variables in the scope of the function, instead of as global constants and global vars. ///////////////// /// XP SYSTEM /// ///////////////// //Check for new enemies and set their max HP void setMaxHP(){ for ( int i = Screen->NumNPCs(); i > 0; i-- ){ npc enem = Screen->LoadNPC(i); if ( enem->Misc[NPC_MISC_MAXHP] == 0 ) enem->Misc[NPC_MISC_MAXHP] = enem->HP; } } void checkEnemiesKilled(){ for ( int i = Screen->NumNPCs(); i > 0; i-- ){ npc enem = Screen->LoadNPC(i); if ( enem->HP <= 0 && enem->HP > HP_DEAD ){ enem->HP = HP_DEAD; int worth = enemyEXPWorth(enem); //Leadership: Chance to increase EXP worth if ( Link->Item[I_LEADERSHIP] && Rand(EXP_LEADERSHIPCHANCE) == 0 ) worth++; giveEXP(worth); } } } int enemyEXPWorth(npc enem){ return Max(1, enem->Misc[NPC_MISC_MAXHP] / EXP_HP_RATIO); } void giveEXP(int amount){ //Give EXP Game->Counter[CR_XP] += amount; } bool checkScreenFlag(int flag){ return Screen->Flags[SF_MISC] & (4<Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 0 ) { Game->Counter[CR_XP] = 1; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 1 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 2 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 3 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 4 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 5 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 6 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 7 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 8 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 9 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 10 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 11 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 12 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 13 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 14 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 15 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 16 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 17 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 18 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 19 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 20 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] == 21 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } if ( Game->Counter[CR_XP] > 9999 && Game->Counter[CR_XP_10K] > 21 && Game->Counter[CR_XP_10K] < 99 ) { Game->Counter[CR_XP] = 0; Game->Counter[CR_XP_10K]++; } } void levelSystem() { if ( Game->Counter[CR_LVL] == 0 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 100 ){ Game->Counter[CR_LVL] = 1; Level1(); } } if ( Game->Counter[CR_LVL] == 1 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 150 ) { Game->Counter[CR_LVL] = 2; Level2(); } } if ( Game->Counter[CR_LVL] == 1 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 2; Level2(); } } if ( Game->Counter[CR_LVL] == 2 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 225 ) { Game->Counter[CR_LVL] = 3; Level3(); } } if ( Game->Counter[CR_LVL] == 2 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 3; Level3(); } } if ( Game->Counter[CR_LVL] == 3 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 338 ) { Game->Counter[CR_LVL] = 4; Level4(); } } if ( Game->Counter[CR_LVL] == 3 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 4; Level4(); } } if ( Game->Counter[CR_LVL] == 4 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 507 ) { Game->Counter[CR_LVL] = 5; Level5(); } } if ( Game->Counter[CR_LVL] == 4 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 5; Level5(); } } if ( Game->Counter[CR_LVL] == 5 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 760 ){ Game->Counter[CR_LVL] = 6; Level6(); } } if ( Game->Counter[CR_LVL] == 5 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 6; Level6(); } } if ( Game->Counter[CR_LVL] == 6 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 1140 ){ Game->Counter[CR_LVL] = 7; Level7(); } } if ( Game->Counter[CR_LVL] == 6 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 7; Level7(); } } if ( Game->Counter[CR_LVL] == 7 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 1710 ){ Game->Counter[CR_LVL] = 8; Level8(); } } if ( Game->Counter[CR_LVL] == 7 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 8; Level8(); } } if ( Game->Counter[CR_LVL] == 8 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 2565 ){ Game->Counter[CR_LVL] = 9; Level9(); } } if ( Game->Counter[CR_LVL] == 8 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 9; Level9(); } } if ( Game->Counter[CR_LVL] == 9 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 3848 ){ Game->Counter[CR_LVL] = 10; Level10(); } } if ( Game->Counter[CR_LVL] == 9 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 10; Level10(); } } if ( Game->Counter[CR_LVL] == 10 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 11; Level11(); } } if ( Game->Counter[CR_LVL] == 10 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 5772 ){ Game->Counter[CR_LVL] = 11; Level11(); } } if ( Game->Counter[CR_LVL] == 10 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 11; Level11(); } } if ( Game->Counter[CR_LVL] == 11 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 8658 ){ Game->Counter[CR_LVL] = 12; Level12(); } } if ( Game->Counter[CR_LVL] == 11 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 12; Level12(); } } if ( Game->Counter[CR_LVL] == 12 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP] >= 2987 && Game->Counter[CR_XP_10K] > 0 ) { Game->Counter[CR_LVL] = 13; Level13(); } } if ( Game->Counter[CR_LVL] == 12 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 1 ) { Game->Counter[CR_LVL] = 13; Level13(); } } if ( Game->Counter[CR_LVL] == 13 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 9481 && Game->Counter[CR_XP_10K] > 0) { Game->Counter[CR_LVL] = 14; Level14(); } } if ( Game->Counter[CR_LVL] == 13 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 1 ) { Game->Counter[CR_LVL] = 14; Level14(); } } if ( Game->Counter[CR_LVL] == 14 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 9222 && Game->Counter[CR_XP_10K] > 1 ){ Game->Counter[CR_LVL] = 15; Level15(); } } if ( Game->Counter[CR_LVL] == 14 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 2 ) { Game->Counter[CR_LVL] = 15; Level15(); } } if ( Game->Counter[CR_LVL] == 15 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 3833 && Game->Counter[CR_XP_10K] > 3 ){ Game->Counter[CR_LVL] = 16; Level16(); } } if ( Game->Counter[CR_LVL] == 15 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 4 ) { Game->Counter[CR_LVL] = 16; Level16(); } } if ( Game->Counter[CR_LVL] == 16 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 5750 && Game->Counter[CR_XP_10K] > 5 ){ Game->Counter[CR_LVL] = 17; Level17(); } } if ( Game->Counter[CR_LVL] == 16 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 6 ) { Game->Counter[CR_LVL] = 17; Level17(); } } if ( Game->Counter[CR_LVL] == 17 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 8625 && Game->Counter[CR_XP_10K] > 8 ){ Game->Counter[CR_LVL] = 18; Level18(); } } if ( Game->Counter[CR_LVL] == 17 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 9 ) { Game->Counter[CR_LVL] = 18; Level18(); } } if ( Game->Counter[CR_LVL] == 18 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 7938 && Game->Counter[CR_XP_10K] > 13 ){ Game->Counter[CR_LVL] = 19; Level19(); } } if ( Game->Counter[CR_LVL] == 18 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 14 ) { Game->Counter[CR_LVL] = 19; Level19(); } } if ( Game->Counter[CR_LVL] == 19 && Screen->NumNPCs() == 0 ) { if ( Game->Counter[CR_XP] >= 500 && Game->Counter[CR_XP_10K] > 20 ){ Game->Counter[CR_LVL] = 20; Level20(); } } if ( Game->Counter[CR_LVL] == 19 && Screen->NumNPCs() == 0 ){ if ( Game->Counter[CR_XP_10K] > 21 ) { Game->Counter[CR_LVL] = 20; Level20(); } } } //////////////////////// /// XP TABLE /////////// //////////////////////// /// 0 = 0 //////// /// 100 = 1 //////// /// 150 = 2 //////// /// 225 = 3 //////// /// 338 = 4 //////// /// 507 = 5 //////// /// 760 = 6 //////// /// 1140 = 7 //////// /// 1710 = 8 //////// /// 2565 = 9 //////// /// 3848 = 10 //////// /// 5772 = 11 //////// /// 8658 = 12 //////// /// 12987 = 13 //////// /// 19481 = 14 //////// /// 29222 = 15 //////// /// 43833 = 16 //////// /// 65750 = 17 //////// /// 98625 = 18 //////// /// 147938 = 19 //////// /// 210500 = 20 //////// ////////////////////////////////////////// //// XP Algorithm //// //// C = Current Base //// //// H = Half Current Base //// //// N = Amount Needed for Next Level //// //// C + H = N //// //// Thus C (100) + H (50) = N (150) //// ////////////////////////////////////////// ///////////////////////// //// Level Functions //// ///////////////////////// void Level1() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[1]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); //Increases HP by 4d10 increaseMP(); //Increases MP by 3d10 increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level2() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[2]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level3() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[3]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level4() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[4]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. Game->Generic[GEN_CANSLASH] = 1; //This should occur when gaining this level, and be permanent. //NWS corrups the given-slash technique: placing it on Level5() doesn;t award it until L6 with NWS, so I'm placng it here to adjust for that. //Place sword techniques one level early, to adjust for NWS delays. } void Level5() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[5]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level6() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[6]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level7() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[7]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level8() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[8]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level9() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[9]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level10() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[10]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level11() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[11]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level12() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[12]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level13() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[13]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level14() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[14]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level15() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[15]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level16() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[16]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level17() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[17]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level18() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[18]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level19() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[19]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } void Level20() { Game->PlaySound(levelStrings[21]); Screen->Message(levelStrings[20]); //This should show on-screen one time, when gaining the level, and not remain forever. increaseHP(); increaseMP(); increaseStat(); //This should happen one time, when gaining this level, and be permanent. } ////////////////////////////////// /// SPECIAL MOVEMENT FUNCTIONS /// ////////////////////////////////// //Makes Link walk faster in addition to normal walking speed void fastWalk ( int speed ){ //Up if( Link->InputUp && !Screen->isSolid(Link->X,Link->Y+6) //NW && !Screen->isSolid(Link->X+7,Link->Y+6) //N && !Screen->isSolid(Link->X+15,Link->Y+6) //NE ) Link->Y -= speed; //Down else if( Link->InputDown && !Screen->isSolid(Link->X,Link->Y+17) //SW && !Screen->isSolid(Link->X+7,Link->Y+17) //S && !Screen->isSolid(Link->X+15,Link->Y+17) //SE ) Link->Y += speed; //Left else if( Link->InputLeft && !Screen->isSolid(Link->X-2,Link->Y+8) //NW && !Screen->isSolid(Link->X-2,Link->Y+15) //SW ) Link->X -= speed; //Right else if( Link->InputRight && !Screen->isSolid(Link->X+17,Link->Y+8) //NE && !Screen->isSolid(Link->X+17,Link->Y+15) //SE ) Link->X += speed; } void paddle(){ int combo=Screen->ComboT[ComboAt(Link->X+8, Link->Y+12)]; if(combo==CT_WATER || combo==CT_SWIMWARP || combo==CT_DIVEWARP || (combo>=CT_SWIMWARPB && combo<=CT_DIVEWARPD)) { isSwimming = true; } else{ isSwimming = false; } if( Link->Dir == DIR_UP //If Link is facing up... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X,Link->Y+6) //NW && !Screen->isSolid(Link->X+7,Link->Y+6) //N && !Screen->isSolid(Link->X+15,Link->Y+6) //NE ) { Link->Y -= 2; Game->PlaySound(SwimPaddle); } else if( Link->Dir == DIR_DOWN //If Link is facing down... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X,Link->Y+17) //SW && !Screen->isSolid(Link->X+7,Link->Y+17) //S && !Screen->isSolid(Link->X+15,Link->Y+17) //SE ) { Link->Y += 2; Game->PlaySound(SwimPaddle); } if( Link->Dir == DIR_RIGHT //If Link is facing right.... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X+17,Link->Y+8) //NE && !Screen->isSolid(Link->X+17,Link->Y+15) //SE ) { Link->X += 2; Game->PlaySound(SwimPaddle); } if( Link->Dir == DIR_LEFT //If Link is facing left... && Link->Action == LA_SWIMMING //and is swimming... && isSwimming == true //combo is a swim combo... && Link->InputB //and presses B... && !Screen->isSolid(Link->X-2,Link->Y+8) //NW && !Screen->isSolid(Link->X-2,Link->Y+15) //SW ) { Link->X -= 2; Game->PlaySound(SwimPaddle); } if ( Link->Action == LA_SWIMMING && isSwimming == false ) { Link->Action = LA_NONE; } } /////////////////// /// Lore Skills /// /////////////////// int skillCheckArray[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; const int LORE_itemNumber = 0; const int LORE_levelUnlocked = 1; const int LORE_lastChecked = 2; const int LORE_nextCheck = 3; const int LORE_messageFailure = 4; const int LORE_messageSuccess = 5; const int LORE_upgradeItem = 6; const int LORE_result = 7; //Setting array elements: //TABLE // item001, item001_levelUnlocked, item001_lastChecked, item001_nextCheck, item001_messageFailure, item001_messageSuccess, item001_upgrade, item 001_result, // item002, item002_levelUnlocked, item002_lastChecked, item002_nextCheck, item002_messageFailure, item002_messageSuccess, item002_upgrade, item_002_result, // item003, item003_levelUnlocked, item003_lastChecked, item003_nextCheck, item003_messageFailure, item003_messageSuccess, item003_upgrade, item_002_result, // item004, item004_levelUnlocked, item004_lastChecked, item004_nextCheck, item004_messageFailure, item004_messageSuccess, item004_upgrade, item_004_result // }; //Set a value: //int loreValue; //skillCheckArray[loreValue] = 0; // Establish rows. int itemLoreRow = 0; //Move array pointer to desired row, by advancing it by 8 positions. const int loreItem000 = 0; const int loreItem001 = 1; const int loreItem002 = 2; const int loreItem003 = 3; const int loreItem004 = 4; const int loreItem005 = 5; const int loreItem006 = 6; const int loreItem007 = 7; //int setLoreArrayRow = ( 8 * loreRow ); // +8 * 0 for row 0, +8 * 1 for row 1, + 8 * 2 for row 2, etc. //Establish Columns const int LoreColumn0 = 0; const int LoreColumn1 = 1; const int LoreColumn2 = 2; const int LoreColumn3 = 3; const int LoreColumn4 = 4; const int LoreColumn5 = 5; const int LoreColumn6 = 6; const int LoreColumn7 = 7; //Function to select a column. void setCurrentLoreColumn(int columnValue){ loreColumn = columnValue; } //Function to select a row: void setLoreRow(int rowValue) { loreRow = ( 8 * rowValue ); } //int loreSkill = 1; int skillLevels[11]={ 1, // Lore 1, // Mystic Lore 1, // Site & History Lore 1, // Swordsmanship 1, // Marksmanship 1, // Diplomacy 1, // Spellcraft 1, // Perception 1, // Language 1, // Thief 1}; //Assense const int LORE_BASIC = 0; const int LORE_MYSTIC = 1; const int LORE_HISTORY = 2; const int SWORDSMANSHIP = 3; const int MARKSMANSHIP = 4; const int DIPLOMACY = 5; const int SPELLCRAFT = 6; const int PERCEPTION = 7; const int LANGUAGE = 8; const int THIEF_SKILLS = 9; const int ASSENSE = 10; //Produce an effect, such as setting itms true, or false, by a series of if/else statements, working from the value passed into //this function by 'result'. //} void loreCheck(int itemRow){ int thisItem; //Need a way to point to the item being checked. int itemNumber = 0; int levelUnlocked = 1; int lastChecked = 2; int nextCheck = 3; int messageFailure = 4; int messageSuccess = 5; int upgradeItem = 6; int result = 7; int thisItemRow = itemRow; int currentLevel = Game->Counter[CR_LEVEL]; int currentSkillLevel = ( skillLevels[LORE_BASIC] * 10 ) + getMindStat(); bool success; int itemSlot = skillCheckArray[thisItemRow + LORE_itemNumber]; //Needs a way to determine the item in question, to select a row. if ( skillCheckArray[thisItemRow + LORE_nextCheck] <= currentLevel && skillCheckArray[thisItemRow + LORE_lastChecked] < currentLevel ) { int checkDie; checkDie = rollDie(100); if ( checkDie < currentSkillLevel ) { success = true; } else { success = false; } if ( success == true ) { skillCheckArray[thisItemRow + LORE_levelUnlocked] += 1; UnlockItem(thisItem, skillCheckArray[thisItemRow + LORE_levelUnlocked]); skillResult(skillCheckArray[thisItemRow + LORE_result]); Screen->Message(skillCheckArray[thisItemRow + LORE_messageSuccess]); } else if ( success == false ) { skillCheckArray[thisItemRow + LORE_lastChecked] = currentLevel; skillCheckArray[thisItemRow + LORE_nextCheck] = ( currentLevel + 1 ); Screen->Message(skillCheckArray[thisItemRow + LORE_messageFailure]); } } } void UnlockItem(int itemNumber, int element){ } void skillResult(int element){ } ///////////////////// /// RESISTANCES /// /// TAINT AND /// /// SAVING THROWS /// ///////////////////// const int SAVE_VS_POISON = 0; const int SAVE_VS_STUN = 1; const int SAVE_VS_FATIGUE = 2; const int SAVE_VS_MAGIC = 3; const int SAVE_VS_PSYCHIC = 4; const int SAVE_VS_FIRE = 5; const int SAVE_VS_WATER = 6; const int SAVE_VS_AIR = 7; const int SAVE_VS_EARTH = 8; const int SAVE_VS_LIGHT = 9; const int SAVE_VS_DARKNESS = 10; const int SAVE_VS_SONIC = 11; const int SAVE_VS_PETRIFICATION = 12; const int SAVE_VS_FEAR = 13; const int SAVE_VS_DEATH = 14; //Instant-Death Spells const int SAVE_VS_HORROR = 15; const int SAVE_VS_INSANITY = 16; const int SAVE_VS_CORRUPTION = 17; const int SAVE_VS_DEPRAVITY = 18; const int SAVE_VS_RIGHTEOUSNESS = 19; const int SAVE_VS_PURITY = 20; const int SAVE_VS_FATE = 21; //Curses int savingThrows[22]={ 0, // Posion 0, // Stun 0, // Fatigue 0, // Magic 0, // Psychic 0, // Fire 0, // Water 0, // Air 0, // Earth 0, // Light 0, // Darkness 0, // Sonic 0, // Petrification 0, // Fear 0, // Death 0, // Horror 0, // Insanity 0, // Corruption 0, // Depravity 0, // Righteousness 0, // Purity 0}; // Fate const int RESIST_FIRE = 0; const int RESIST_WATER = 1; const int RESIST_AIR = 2; const int RESIST_EARTH = 3; const int RESIST_LIGHT = 4; const int RESIST_DARKNESS = 5; const int RESIST_SONIC = 6; int elementalResistance[7]={0, //Fire & Heat 0, //Water & Ice 0, //Air & Electricity 0, //Earth & Acid 0, //Light 0, //Darkness 0}; //Sonic const int TAINT_CORRUPTION = 0; const int TAINT_DEPRAVITY = 1; const int TAINT_RIGHTOUSNESS = 2; const int TAINT_PURITY = 4; int taintArray[4]={ 0, //Corruption 0, //Depravity 0, //Righteusness 0}; //Purity bool savingThrow(int type, bool useTaint){ int modifierValue; int modifierBase; int modifierSubtotal; int modifierTotalValue; int luckModifier = getLuckMod(); int taintModifier; int energyModifier; int includeTaint; int finalSaveValue; int rollSavingThrow; if ( type == SAVE_VS_FATIGUE || type == SAVE_VS_SONIC ) { modifierValue = getMuscMod(); } if ( type == SAVE_VS_POISON || type == SAVE_VS_STUN || type == SAVE_VS_DEATH || type == SAVE_VS_PETRIFICATION ) { modifierValue = getBodyMod(); } if ( type == SAVE_VS_PSYCHIC || type == SAVE_VS_FEAR || type == SAVE_VS_HORROR || type == SAVE_VS_INSANITY ) { modifierValue = getMindMod(); } if ( type == SAVE_VS_MAGIC || type == SAVE_VS_FIRE || type == SAVE_VS_WATER || type == SAVE_VS_AIR || type == SAVE_VS_EARTH || type == SAVE_VS_LIGHT || type == SAVE_VS_DARKNESS ) { modifierValue = getMystMod(); } if ( type == SAVE_VS_CORRUPTION || type == SAVE_VS_DEPRAVITY || type == SAVE_VS_RIGHTEOUSNESS || type == SAVE_VS_PURITY ) { modifierValue = getMystMod(); } if ( type == SAVE_VS_FATE ) { modifierValue = getLuckStat(); } if ( type == SAVE_VS_FIRE ) { energyModifier = ( elementalResistance[RESIST_FIRE] ); } if ( type == SAVE_VS_WATER ) { energyModifier = ( elementalResistance[RESIST_WATER] ); } if ( type == SAVE_VS_AIR ) { energyModifier = ( elementalResistance[RESIST_AIR] ); } if ( type == SAVE_VS_EARTH ) { energyModifier = ( elementalResistance[RESIST_EARTH] ); } if ( type == SAVE_VS_LIGHT ) { energyModifier = ( elementalResistance[RESIST_LIGHT] ); } if ( type == SAVE_VS_DARKNESS ) { energyModifier = ( elementalResistance[RESIST_DARKNESS] ); } if ( type == SAVE_VS_SONIC ) { energyModifier = ( elementalResistance[RESIST_SONIC] ); } if ( type == SAVE_VS_CORRUPTION ) { taintModifier = ( taintArray[TAINT_PURITY] - taintArray[TAINT_CORRUPTION] ); } if ( type == SAVE_VS_DEPRAVITY ) { taintModifier = ( taintArray[TAINT_RIGHTOUSNESS] - taintArray[TAINT_DEPRAVITY] ); } if ( type == SAVE_VS_RIGHTEOUSNESS ) { taintModifier = ( taintArray[TAINT_DEPRAVITY] - taintArray[TAINT_RIGHTOUSNESS] ); } if ( type == SAVE_VS_PURITY ) { taintModifier = ( taintArray[TAINT_CORRUPTION] - taintArray[TAINT_PURITY] ); } modifierBase = ( modifierValue + energyModifier + energyModifier ); if ( useTaint == true ) { modifierSubtotal = ( modifierBase + taintModifier ); } else if ( useTaint == false ) { modifierSubtotal = modifierBase; } if ( type == SAVE_VS_FATE ) { modifierTotalValue = modifierSubtotal; } else { modifierTotalValue = ( modifierSubtotal + luckModifier ); } finalSaveValue = ( modifierTotalValue * 10 ); rollSavingThrow = rollDie(100); if ( rollSavingThrow > finalSaveValue ) { return false; } else { return true; } } int makeSavingThrow(int type, int minDamage, int maxDamage, bool damageStat, int statToDamage, bool useTaint, bool damageHP, bool damageMaxHP, bool damageMP, bool damageMaxMP, bool specialEffect) { bool madeSavingThrow; int damageValue; damageValue = Rand(minDamage, maxDamage); if ( useTaint ) { if ( savingThrow(type, true) ){ madeSavingThrow = true; } else { madeSavingThrow = false; } } else if ( !useTaint ) { if ( savingThrow(type, false) ){ madeSavingThrow = true; } else { madeSavingThrow = false; } } if ( madeSavingThrow == false ) { if ( damageStat ) { if ( statsArray[statToDamage] > damageValue ) { statsArray[statToDamage] -= damageValue; } else { statsArray[statToDamage] = 0; } } else if ( !damageStat ) { if ( damageHP ) { Link->HP -= damageValue; } if ( damageMP ) { Link->MP -= damageValue; } if ( damageMaxHP ) { Link->MaxHP -= damageValue; } if ( damageMaxMP ) { Link->MaxMP -= damageValue; } } if ( specialEffect ) { if ( type == SAVE_VS_STUN ) if ( SAVE_VS_FATIGUE ) { //fatigue(damageValue); } if ( SAVE_VS_MAGIC ){ // } if ( SAVE_VS_PSYCHIC ) { // } if ( SAVE_VS_FIRE ) { //playerOnFire(duration) //duration is set by damageValue * 100 in frames } if ( SAVE_VS_WATER ) { // } if ( SAVE_VS_AIR ) { // } if ( SAVE_VS_EARTH ) { // } if ( SAVE_VS_LIGHT ) { // } if ( SAVE_VS_DARKNESS ) { // } if ( SAVE_VS_SONIC ) { // } if ( SAVE_VS_PETRIFICATION ){ //for damagevalue * 100 frames, WaitNoAction(). } if ( SAVE_VS_FEAR ) { // } if ( SAVE_VS_DEATH ) { Link->HP = 0; } if ( SAVE_VS_HORROR ) { // } if ( SAVE_VS_INSANITY ) { // } if ( SAVE_VS_CORRUPTION ) { taintArray[TAINT_CORRUPTION] += damageValue; } if ( SAVE_VS_DEPRAVITY ) { taintArray[TAINT_DEPRAVITY] += damageValue; } if ( SAVE_VS_RIGHTEOUSNESS ) { taintArray[TAINT_RIGHTOUSNESS] += damageValue; } if ( SAVE_VS_PURITY ) { taintArray[TAINT_PURITY] += damageValue; } if ( SAVE_VS_FATE ) { //Jinxes & Curses } } } else { } }