User Tag List

Results 1 to 3 of 3

Thread: Custom Item Counters

  1. #1
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    167
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    878
    Level
    10
    vBActivity - Bars
    Lv. Percent
    32.45%
    Daily Activity
    0%
    Weekly Activity
    2.8%
    Monthly Activity
    5.45%

    Question Custom Item Counters

    So I'm currently looking to use the simple potion script provided in this thread... And I'm looking to implement counters to track the number of specific potions Link is currently carrying. The idea is that there will be 4 potions. Health Potions which restore 6 hearts, magic potions which restore 6 magic containers, restoration potions which restore 6 of each, and the elixir which will restore all and remove jinxes but is limited to 2 uses. I'm trying to create a counter for each of the first 3 potions since they are separate from the elixir (i.e. original in game potion item). This way I can also create a custom item that increases the max carried of these items as well.

    So far all my research into finding out how to make a counter script has failed. I've looked at scripts which seem to make new counters but I'm unable to figure out how it is done. The only script that appears to have this that I've located is "Bait Bag" on PZC. The only references was a rant referencing 2.6 and a much older question of a smiliar vein but this was back in the days of 2.1 ish.

    Bottom line, how do I write a counter script? This can't possibly be that hard.

    EDIT

    Maybe it really isn't. Someone please check my work (and my logic)

    The way I'm seeing it, I have to create an item family for the potion belt or belts. Also, I have to duplicate the potion script mentioned before 3 times to make the specialized potions. I believe I have to declare starting values in the code, or is there a way to do that where I can modify that value for balance purposes later like setting the initial values for starting bombs, etc...

    Code:
    //Initialize counters with intial start values and creates item family for potion belt item
    
    const int CR_HPOT = 2;
    const int CR_MPOT = 2;
    const int CR_RPOT = 2;
    const int IC_PBELT
    
    //Potion Item scripts follow
    
    item script HealthPot
    {
    Void run(int a,int b, int c)
    	{
    	If (a==0){Link->HP+=b;}
    	If (b==0){Link->MP+=c;}
    	If (c==0){Link->HP+=b;Link->MP+=c;}
    	}
    }
    
    
    item script ManaPot
    {
    Void run(int a,int b, int c)
    	{
    	If (a==0){Link->HP+=b;}
    	If (b==0){Link->MP+=c;}
    	If (c==0){Link->HP+=b;Link->MP+=c;}
    	}
    }
    
    item script RestoPot
    {
    Void run(int a,int b, int c)
    	{
    	If (a==0){Link->HP+=b;}
    	If (b==0){Link->MP+=c;}
    	If (c==0){Link->HP+=b;Link->MP+=c;}
    	}
    }
    Also confused on the last part... how do I get one item to affect all three counters?
    Last edited by Lelouche Vi Britannia; 03-06-2016 at 08:00 PM. Reason: Added initial attempt
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  2. #2
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    167
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    878
    Level
    10
    vBActivity - Bars
    Lv. Percent
    32.45%
    Daily Activity
    0%
    Weekly Activity
    2.8%
    Monthly Activity
    5.45%
    Decided that the use of Arcums Razor was in order since no one chimed in yet. If you know a way to get all three counters to obey the same item, let me know otherwise if someone can take a second to look over my rather simple coding and make sure I'm not forgetting something of monumental importance, I'd be very greatful. Here is what I have....

    Code:
    const int CR_POT1 = 2;
    const int CR_POT2 = 2;
    const int CR_POT3 = 2;
    const int IC_PBELT1	//pouch for health pots
    const int IC_PBELT2	//pouch for mana pots
    const int IC_PBELT3	//pouch for restoration pots
    
    item script Potion1
    {
    Void run(int a,int b, int c)
    	{
    	If (a==0){Link->HP+=b;}
    	If (b==0){Link->MP+=c;}
    	If (c==0){Link->HP+=b;Link->MP+=c;}
    	}
    }
    
    
    item script Potion2
    {
    Void run(int a,int b, int c)
    	{
    	If (a==0){Link->HP+=b;}
    	If (b==0){Link->MP+=c;}
    	If (c==0){Link->HP+=b;Link->MP+=c;}
    	}
    }
    
    item script Potion3
    {
    Void run(int a,int b, int c)
    	{
    	If (a==0){Link->HP+=b;}
    	If (b==0){Link->MP+=c;}
    	If (c==0){Link->HP+=b;Link->MP+=c;}
    	}
    }
    All that is here is declarations for the new counters and the item classes needed to use the default interface to make them increase the relevant counters. By my estimates, I should be able to use the tab where counters are affected to affect custom counters appropriately, or do I have to tell the game to reduce the count if an item is used? Also, left the id's on the items ambiguous (potion 1, 2, and 3 instead of setting specifics) so that in the future I could either expand as appropriate or just change the nature of the potions keeping things generic and reusable.

    Any help at this point would be appreciated, even if it's just a quick "do this instead" or "should work fine".
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

  3. #3
    Octorok Lelouche Vi Britannia's Avatar
    Join Date
    Oct 2015
    Location
    Britannia - Area 11
    Posts
    167
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    878
    Level
    10
    vBActivity - Bars
    Lv. Percent
    32.45%
    Daily Activity
    0%
    Weekly Activity
    2.8%
    Monthly Activity
    5.45%
    Ok never mind, I'm apparently an idiot... I can't actually set up custom counters that will actually work so I went with tier potion items similar to what was already in use by the game. And I realize now that I don't need to set up custom item families as they technically already exist. For balance reasons I decided on no more than 2 uses for each of the now 4 different potions; red, blue, purple, and elixir. Only needed the potion script once, as custom item classes 1, 2, and 3 were all that was needed. So I used 6 custom items to get what I wanted out of this. I have room for more later if I really want to up potion values.

    Sorry to waste everyone's time. Mods feel free to delete this thread....
    Lost my wings and grew 8 tentacles... I've seen enough Hentai to know where this is going....

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