• 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!

Need Help Potion features

Okay I'm only guessing here:

This is the "healing" function in LAi_character.c

void LAi_UseHealthBottle(aref chr, float healthInBottle)
{
if(healthInBottle <= 0) return;
if(CheckPerkForGroup(chr, "ImprovePotions")) healthInBottle = healthInBottle * 1.1;//partywide boost
if(!CheckAttribute(chr, "chr_ai.hp_bottle"))
{
chr.chr_ai.hp_bottle = "0";
}
chr.chr_ai.hp_bottle = stf(chr.chr_ai.hp_bottle) + healthInBottle;
}

Now if we add a LAi_QuestDelay("stop_healing", 4.0); after the last line
and in for ex quests_common.c place

case "stop_healing":
chr.chr_ai.hp_bottle = "0";
(with the correct syntax)
break;

the healing process should stop after 4 sec.

This LAi_QuestDelay("stop_healing", 4.0); should only be executed if it's that special healing item.
 
The original request is for a potion which reduces damage. @Rolee9309, does that mean you want a potion which reduces damage when you are hit, as opposed to one which heals damage already taken?
 
The original request is for a potion which reduces damage. @Rolee9309, does that mean you want a potion which reduces damage when you are hit, as opposed to one which heals damage already taken?
Exactly, damage reduction when hit. For example at ~40%, when a bad guy hits you with 20 damage, you only take 12. Like in the case of ship defense skill(s). But since they are always on, and perk-dependant, I don't know if it would be possible to get dmg. reduction for 4 (or so) seconds instead of plain healing.
 
Nah, since I couldn't figure out, how to do this, I threw that idea out (for now).
Instead, I want to create 3 skills, which increase the character's maximum health (15%, 25%, 40%), but if I insert these lines below uner the 'float LAi_GetCharacterMaxHP(aref chr)' section , the health bar goes up and up, because it multiplies itself with that 1.15 value. I tried many variations/combinations. What do I do wrong? :checklist

if(IsCharacterPerkOn(chr, "Healthy"))
max_hp = max_hp*1.15;
return max_hp;


Sorry, if there is an obvious mistake here, I'm still a newbie and sadly I don't have a lot of time to learn/practise. Aaand I did not find any information about this . Could someone help me out a little bit? :)
 
I am unfamiliar with the mechanism of HP, but the "Toughness" perk already does something similar to what you want your perks to do - it boosts maximum HP by 10%. "Toughness" takes its effect in function 'float ResetMaxHP(ref chr)', which you'll find in "PROGRAM\Characters\Leveling.c":
Code:
        if(IsCharacterPerkOn(chr, "Toughness"))
       {
           HP = HP * 1.1;           // 10% health bonus for the tough guys
           chr.chr_ai.hp_dlt = LAI_DEFAULT_DLTHP * TOUGHNESS_REGEN_MULT; // higher regeneration rate, default is 0.1 - LDH 14Apr09
       }
Try doing something similar in the same part of 'ResetMaxHP', but don't copy the 'chr.chr_ai.hp_dlt' line.
 
I am unfamiliar with the mechanism of HP, but the "Toughness" perk already does something similar to what you want your perks to do - it boosts maximum HP by 10%. "Toughness" takes its effect in function 'float ResetMaxHP(ref chr)', which you'll find in "PROGRAM\Characters\Leveling.c":
Code:
        if(IsCharacterPerkOn(chr, "Toughness"))
       {
           HP = HP * 1.1;           // 10% health bonus for the tough guys
           chr.chr_ai.hp_dlt = LAI_DEFAULT_DLTHP * TOUGHNESS_REGEN_MULT; // higher regeneration rate, default is 0.1 - LDH 14Apr09
       }
Try doing something similar in the same part of 'ResetMaxHP', but don't copy the 'chr.chr_ai.hp_dlt' line.

Yayy, thanks! now I can use it to finish the other 2 skills.
I never thought, that skill will be coded in that file.
BUT I wonder! Will it work in the stock game too (since it doesn't have that particular file if I'm not wrong)?
 
I'm fairly sure the "Toughness" perk exists in the stock game, even if it's somewhere else.

Try using Windows Indexing. Click the "Start" button, then in the text window, type "Windows Index". Among the list of things you can click, there should be "Indexing Options". Click that. From there you should be able to find out how to add files to be indexed. Add your PoTC installation folder. When your PoTC folder (or anything else you like) is indexed, you can type whatever you want into the "Start" text window, and Windows will search not only for files whose name contains what you're looking for, but also files which contain what you're looking for.

That's how I found where "Toughness" is used - I've already got my PoTC folder indexed, so I typed in "Toughness" and let Windows do the digging. There were quite a lot of hits because the perk is assigned to various characters in their definitions, but once I'd figured out which files were just using the "Toughness" ability as opposed to containing the code which makes it work, I soon tracked it down to "Leveling.c". So you can do something similar to find out where "Toughness" occurs in your stock installation.
 
All the HP code was thoroughly rewritten after the original game.

I think the 'ResetHP' function might be relevant too (for the New Horizons, at least).
 
'ResetHP' calls 'ResetMaxHP', it doesn't deal directly with skills or abilities:
Code:
float ResetHP(ref chr)
{
   if(CheckAttribute(chr,"old.chr_ai.hp"))
   {
       DeleteAttribute(chr,"old.chr_ai.hp");
       DeleteAttribute(chr,"old.chr_ai.hp_max");
   }
   ResetMaxHP(chr);
   float HP = stf(chr.chr_ai.hp_max);
   chr.chr_ai.hp = HP;
   return HP;
}
 
Yes, that's the one which has a condition 'if(IsCharacterPerkOn(chr, "Toughness"))' to alter your maximum HP if you have the "Toughness" perk. (And also to boost your regeneration rate, but that's not needed for these health abilities.)
 
Nah, I managed to do something in my free time. Not exactly an x% max HP boost, but a small amount of extra HP, when leveling up. Just added the following lines under the section 'nextExp = CalculateExperienceFromRank(sti(_refCharacter.rank)+1);' in the CharacterUtilite.c file:
if( CheckCharacterPerk(_refCharacter,"Healthy") )
{
nextExp = CalculateExperienceFromRank(sti(_refCharacter.rank)+1);
mhp = LAi_GetCharacterMaxHP(_refCharacter) + 3.0;
LAi_SetHP(_refCharacter,mhp,mhp);
retVal = true;
}
So basically it adds 8 HP (or anything else to your liking) instead of the regular 5 after leveling up, when the so called 'Healthy' perk is on. That should do it for now (for me at least :D)
 
Back
Top