User Tag List

Results 1 to 1 of 1

Thread: Lelouche's Potion Script

  1. #1
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    173
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,107
    Level
    11
    vBActivity - Bars
    Lv. Percent
    44.09%

    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
    				{
    				Link->HP+=b;
    				Game->Counter[CR_POTA]--;
    				Game->PlaySound(53);
    				if (Game->Counter[CR_POTA]==0){Link->Item[126]=false;}
    				}
    		}
    	if (a == 1)
    		{
    			if (Game->Counter[CR_POTB]==0)
    				{Quit();}
    			else
    				{
    				Link->MP+=c;
    				Game->Counter[CR_POTB]--;
    				Game->PlaySound(53);
    				if (Game->Counter[CR_POTB]==0){Link->Item[124]=false;}
    				}
    		}
    	if (a == 2)
    		{
    			if (Game->Counter[CR_POTC]==0)
    				{Quit();}
    			else
    				{
    				Link->HP+=b;
    				Link->MP+=c;
    				Game->Counter[CR_POTC]--;
    				Game->PlaySound(53);
    				if (Game->Counter[CR_POTB]==0){Link->Item[125]=false;}
    				}
    		}
    	}
    }
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  2. #2
    Octorok jeffythedragonslayer's Avatar
    Join Date
    Jan 2024
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    29
    Level
    2
    vBActivity - Bars
    Lv. Percent
    15.33%
    Cool. Has this been used in any quests yet? Any videos?

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social