///RPG Script Set ///Currency & Wallets //This script allows you to have multiple wallets as counter items. Y //You can set the value of coins, and the size of coins, and differentiate between coins and currency. //Larger coins do not necessarily need to be of higher value than smaller coins. //The type of material can set coin value. //You can handle currency separately, taking a different amount fo space. 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. int walletSize = 50; //Sts default space within wallets. Can be changed later in game. int walletsOwned = 1; //Setsa initial number of wallets owned by player. int 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. int pocketCapacity = 20 // Sets pocket capacity for loose items. int pocketSpaceUsed = 0; //Sets initial pocket space used by player. const int CR_CUSTOM_WALLET_SIZE = 0; //const int CR_WALLETS = 0; //const int NO_FREE_SPACE = 0; //int totalWalletSpace = ( CR_WALLETSPACE * CR_WALLETS ) //int freeWalletSpace = Game->MCounter[CR_WALLETSPACE] - Game->Counter[CW_WALLETSPACE] const int CR_SIZE_COINS_CURRENCY = 0; const int CR_SDARI = 0; bool noFreeSpace = false; int totalWalletSpace = ( ( walletSize * walletsOwned ) + ( Game->Counter[CR_CUSTOM_WALLET_SIZE] ) ); int totalPocketSpace = ( pockets * pocketCapacity ); int totalPocketAndWalletSpace = ( totalWalletSpace + totalPocketSpace ); item script moneyPickup(int coinsize, int coinvalue){ int walletFreeSpace = ( totalWalletSize - CR_SIZE_COINS_CURRENCY ); int pocketFreeSpace = ( totalPocketSpace - CR_SIZE_COINS_CURRENCY ); if ( walletFreeSpace > coinsize ) { Game->Counter[CR_DSARI] += coinvalue; walletSpaceused += coinsize; //Fills wallet space. noFreeSpace = false; } else if ( walletFreeSpace < coinsize ){ if (pocketFreeSpace < coinsize ) { Game->Counter[CR_DSARI] += coinvalue; pocketSpaceUsed += coinsize; //Fills pocket space. noFreeSpace = false; } } else if ( walletFreeSpace < coinsize && pocketFreeSpace < coinsize) { noFreeSpace(); } } item script walletPickup(int capacity){ if ( capacity == 0 ) { walletsOwned += 1; } if ( capacity > 0 ){ Game->Counter[CR_CUSTOM_WALLET_SIZE] =+ capacity; //Can make different sized wallets } } void noFreeSpace() { if ( noFreeSpace == false ) { 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. noFreeSpace = true; } 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 = ( totalWalletSize - CR_SIZE_COINS_CURRENCY ); int pocketFreeSpace = ( totalPocketSpace - CR_SIZE_COINS_CURRENCY ); if ( walletFreeSpace > 5 ) { noFreeSpace = false; } if ( walletFreeSpace < 5 ){ if (pocketFreeSpace < coinsize ) { noFreeSpace = false; } } }