﻿ Lelouche's Potion Script

1. ## Lelouche's Potion Script

The idea behind this was an expansion on the potion script provided by Zim. One use potions that restore some HP or MP or both in the case of Rejuvenation potions. The way I have them designed in the quest, they restore about 6 hearts and/or 4 Mana Blocks (max in the quest is set at 24 Hearts and 16 Mana Blocks), equaling about a quarter of full restoration if both meters are maxed out. Max load is provided by invisible items which determine how big the counters can be (8 total per potion, might change later due to balance).

The code is designed to track the amount gained, and work the counter properly by subtracting the items as they are used and removing the item completely once the counter reaches zero. While I could have simplified the code some more, I figured I'd keep it the way it is so if I decided to change how the potions work in a future project, I have the freedom to do that in the editor.

While this code is probably not going to dazzle anyone, I'm quite proud of it. It's personal proof that I'm finally getting the basics down.

Code:
```//Coding for all three potion types
//Health Potion here is Item 126, Mana Potion is 124, and Rejuv is 125
//D0=Type of potion where 0 is health only, 1 is mana only, and 2 is both
//D1=HP Restored
//D2=MP restored
//Script uses Counters 7,8, and 9, which is Script 1, Script 2, and Script 3 respectively, adjust as needed

const int CR_POTA = 7; //script 1 slot
const int CR_POTB = 8; //script 2 slot
const int CR_POTC = 9; //script 3 slot

item script potions
{
void run(int a,int b, int c)
{
if (a == 0)
{
if (Game->Counter[CR_POTA]==0)
{Quit();} //probably not necessary as there is no instance where the item counter will read 0 and the item is still in inventory
else
{
Game->Counter[CR_POTA]--;
Game->PlaySound(53);
}
}
if (a == 1)
{
if (Game->Counter[CR_POTB]==0)
{Quit();}
else
{
Game->Counter[CR_POTB]--;
Game->PlaySound(53);
}
}
if (a == 2)
{
if (Game->Counter[CR_POTC]==0)
{Quit();}
else
{
Game->Counter[CR_POTC]--;
Game->PlaySound(53);
}
}
}
}```

2. Cool. Has this been used in any quests yet? Any videos?

There are currently 1 users browsing this thread. (0 members and 1 guests)