• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

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

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:
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?
 
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?
Its because i tought stack was something else, they can be 0.
 
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 ?
 
Will there ever be something which stacks positive anyway? I guess not..
 
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.
 
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.
 

Attachments

  • skillitems.7z
    46.6 KB · Views: 107
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.
 
Back
Top