1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Fixed Bug with skill boost items that require multiple of the item to work

Discussion in 'Bug Archive' started by Tingyun, Aug 16, 2016.

  1. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    I think I'm on the right path now. There's just one thing. The MAX_SKILL_INCREASE
    limits the -1 luck/each cursedcoin to totally -4 luck by this line:

    Code:
    mod = iclamp(-MAX_SKILL_INCREASE, MAX_SKILL_INCREASE, mod);
    So I want to make an exception for the cursedcoin, something like:

    if(itmid == "cursedcoin")
    {
    mod = iclamp(-100, MAX_SKILL_INCREASE, mod); //JRH for cursed coin
    }
    else
    {
    mod = iclamp(-MAX_SKILL_INCREASE, MAX_SKILL_INCREASE, mod); // PB: Single line
    }

    but something's wrong with if(itmid == "cursedcoin"). Not read.
    Any ideas?
     
    Last edited: Aug 20, 2016
  2. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    Also: opium and vegetal have very high numbers on stack but no skillbonus.
    Guess those == 0 if stack is a bool. Or any other purpose here @Levis?
     
  3. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,707
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    Its because i tought stack was something else, they can be 0.
     
  4. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,707
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    As far as I know my code worked. I suggest we change all items to not stack and only let the cursed coin stack. Then remove the max option all together.
    What do you say @Jack Rackham ?
     
  5. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    Yes I've done that and changed stack to a bool. Your code works fine.

    Maybe just keep the positive max?
     
  6. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,707
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
    Will there ever be something which stacks positive anyway? I guess not..
     
  7. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    Maybe not but if you got 6 items which each gives +1 leadership the MAX_SKILL_INCREASE
    limits it to +4 leadership. I'll just skip the negative limit for now so > 4 cursedcoin takes effect.
     
  8. Jack Rackham

    Jack Rackham HoO Team Member Quest Writer Storm Modder

    Joined:
    Jul 5, 2004
    Messages:
    3,288
    Gender:
    Male
    Occupation:
    math teacher
    Location:
    Sund, Ramsjö, Sweden
    Okay, here's the version with stack as a bool. @Levis code is unchanged.
    Only cursedcoin stacks and has been given the -1 Luck.
    MAX_SKILL_INCREASE upper limit kept but lower limit removed for cursedcoin.
     

    Attached Files:

    Pieter Boelen, Levis and Tingyun like this.
  9. Levis

    Levis Find(Rum) = false; Staff Member Programmer Creative Support Storm Modder

    Joined:
    Oct 6, 2013
    Messages:
    6,707
    Gender:
    Male
    Occupation:
    ICT
    Location:
    University Twente (Netherlands)
  10. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Sounds like some good changes here! :onya
     
  11. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    @Jack Rackham, @pedrwyth and/or @Grey Roger: Do you guys reckon if items should "stack" by default?
    Or should only "cursed coins" stack? I think we agreed to use this for cursed coins only, right?
     
  12. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Also, I'm replacing this:
    Code:
           //Levis --> fix overflowing the stack not applying any bonus
           //Check if the player has enough items
           if(qty >= sti(itm.skill.num))
           {
             //Check if bonusses stack
             if(itm.skill.stack == true)       //JRH
             {
               //they stack, so we can add the mod
               mod += sti(itm.skill.(skillName)) * qty/sti(itm.skill.num);
             }
             else
             {
               //they don't stack so just add the mod once.
               mod += sti(itm.skill.(skillName));
             }
         }
           //Levis <--
    
    With this:
    Code:
           if(sti(itm.skill.stack) == false) qty = 1;
           mod += sti(itm.skill.(skillName)) * qty; // PB: Used to end with '/sti(itm.skill.num)'
    
    I think that still maintains the (now simplified) intention of the feature.
     

Share This Page