//D0 : Set to 1 if item is to restore hull HP, otherwise, set to 0. //D1 : Set to 1 if item is to restore hull MP, otherwise, set to 0. //D2 : Set to a number greater than 0 is D0 is set to 0, to set precise amount of HP to restore //D3 : Set to a number greater than 0 is D1 is set to 0, to set precise amount of MP to restore //D4 : Set to SFX to play when using item - from Quest>Audio->SFX Data //D5 : Set to SFX to play for error sound (if HP/MP is already full, to prevent wasting item - from Quest>Audio->SFX Data //D6 : Set to item number of this item. item script Potions { void run(int MaxRefillLife, int MaxRefillMagic, int hp, int mp, int POTION_SFX, int ERROR_SFX, int itemNumber) { int MP_Max = Game->MCounter[CR_MAGIC]; int HP_Max = Game->MCounter[CR_LIFE]; if ( MaxRefillLife == 1 && MaxRefillMagic == 1 && Link->MP < Link->MaxMP && Link->HP < Link->MaxHP ){ Link->HP += HP_Max; Link->MP += MP_Max; Game->PlaySound(POTION_SFX); Link->Item[itemNumber] = false; } else if ( MaxRefillLife == 1 && MaxRefillMagic == 0 && Link->HP < Link->MaxHP ){ Link->HP += HP_Max; Game->PlaySound(POTION_SFX); Link->Item[itemNumber] = false; } else if ( MaxRefillLife == 0 && MaxRefillMagic == 1 && Link->MP < Link->MaxMP ){ Link->MP += MP_Max; Game->PlaySound(POTION_SFX); Link->Item[itemNumber] = false; } else if ( MaxRefillLife == 0 && MaxRefillMagic == 0 && Link->MP < Link->MaxMP && Link->HP < Link->MaxHP ){ Link->HP += hp; Link->MP += hp; Game->PlaySound(POTION_SFX); Link->Item[itemNumber] = false; } else if ( MaxRefillLife == 0 && MaxRefillMagic == 0 && hp > 0 && Link->HP < Link->MaxHP ){ Link->HP += hp; Game->PlaySound(POTION_SFX); Link->Item[itemNumber] = false; } else if ( MaxRefillLife == 0 && MaxRefillMagic == 0 && mp > 0 && Link->MP < Link->MaxMP ){ Link->MP += mp; Game->PlaySound(POTION_SFX); Link->Item[itemNumber] = false; } else { Game->PlaySound(ERROR_SFX); } } }