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

HP hit when blocking

Pieter Boelen

Navigation Officer
Administrator
Storm Modder
Hearts of Oak Donator
CouchcaptainCharles had the idea to add a 2 HP hit when effectively blocking. I have tried to enhance his code for a bit and I also added in the get "hurt with fists" stuff that I wanted to do. The code seems OK to me and it causes no error messages. It doesn't work either though. Somebody please help! <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />
PROGRAM\Loc_ai\LAi_fightparams.c:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->        if(rand(10000) > p*10000)
        {
            // ccc Jan07 -->
            if(CheckAttribute(attack, "level")) attack_level = sti(attack.level);
            else attack_level = 0;
            
            switch(BLOCKDAMAGE)
            {
                case 0:    blockdamage = 0;                        break;
                case 1:    blockdamage = rand(sqrt(attack_level));    break;
                        blockdamage = BLOCKDAMAGE;
            }
            if(sti(blockdamage) > 0 && !LAi_IsImmortal(enemy))
            { LAi_ApplyCharacterDamage(enemy,blockdamage); LAi_CheckKillCharacter(enemy); }
            // ccc Jan07 <--

            // PB: Fists -->
            if(CheckCharacterEquipByGroup(attack, BLADE_ITEM_TYPE) == "bladeX4" && !LAi_IsImmortal(attack))
            {
                if(CheckAttribute(enemy, "level")) enemy_level = sti(enemy.level);
                else enemy_level = 0;
                LAi_ApplyCharacterDamage(attack,rand(enemy_level)); LAi_CheckKillCharacter(attack);
            }
            // PB: Fists <--
            return;
        }<!--c2--></div><!--ec2-->
 
Try ".rank" instead of ".level" <img src="style_emoticons/<#EMO_DIR#>/icon_wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="icon_wink.gif" />
 
And I hope you don't mind if I propose a few changes.

A question first: you want to make the damage suffered while blocking depend on the root of the attacker's rank/level? So if a rank 1 player blocks the hit of a level 16 bandit he looses up to 4 HP? That would make sense, but if you want to make it so that weak beginner players suffer less you must check the level of the defendant: enemy.rank .

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->if(CheckAttribute(attack, "rank")) attack_level = sti(attack.rank);
else attack_level = 0;
<!--c2--></div><!--ec2-->I think you can skip that check, cause FAIK .rank is an essential attribute for every character.

I assume BLOCKDAMAGE is a Buildsetting? Good idea <img src="style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" /> But if it is 0 nothing needs to be done so you can skip the case for that as well, also the blockdamage variable (wouldn't use the name anyway, don't know if the program can tell BLOCKDAMAGE from blockdamage)

I'd put the whole calculation right into the "applydamage" command. The formula for the damage would be
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->
makeint( rand( sqrt( sti(attack.rank) ) ) )
<!--c2--></div><!--ec2-->
Makeint converts the endresult into an integer number cause LAi_ApplyCharacterDamage works only with integers. (No 0.253 HP )
True, the formula looks a bit confusing at first, but for a program that's leaner than declaring several variables for intermediate results.

So my version would look like this
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->
if(rand(10000) > p*10000)
{
    // PB Jan07 -->
    if( BLOCKDAMAGE && !LAi_IsImmortal(enemy) )
      {
         LAi_ApplyCharacterDamage(enemy, makeint( rand( sqrt( sti(attack.rank) ) ) )  );
         LAi_CheckKillCharacter(enemy);
      }
      // PB Jan07 <--
<!--c2--></div><!--ec2-->
Though I haven't tried it yet, quite possible that I have overlooked something <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
Thanks CCC. Good point about the level/rank mess-up. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
I'm going to test this.

I could indeed simply the code in the way you suggest, but I used the switch so that it is possible to keep the mod work exactly as your original mod with the set value hit.

I am not entirely sure on what formula to use for this. Of course the damage should increase if the enemy is stronger, but that is very annoying for the player when he encounters really strong enemies. So I reckon we'll need to figure out something better than this, because this version probably doesn't work well as far as gamebalancing is concerned. <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />

Ideas would be welcome. <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
you know, (i'm seriously going to regret saying this) the player can SEE if the enemy is of a high level. it would be very wise for the player to then run away or sneak around, which is possible. so it might not be frustrating at all, just a tactical feature. the player shouldn't always be able to just defeat anything he meets, but should also run for it once in a while. (although i think different about this) in real life, heroes had to run sometimes too, you know!
 
The code I now have does do something, but apparently not everything it should. I still haven't seen any HP hit on the player. <img src="style_emoticons/<#EMO_DIR#>/wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" />
 
excellent! <img src="style_emoticons/<#EMO_DIR#>/smile2.gif" style="vertical-align:middle" emoid=":))" border="0" alt="smile2.gif" /> anyway, i think that what i said in my previous post would actually IMPROVE game play instead of harm it.
 
To everybody playing Alpha 9.5 Patch 1 lately, how do you like the blockdamage vs. "infinite blocking syndrome" in this version?
Hook did some major work on the fighting system to make it more challenging and less cheat-like.
 
I finally got the mess installed properly, and have been trying to figure out how to make it so i don't take damage when blocking. there's nothing realistic or challenging about random hobo looking sailors in port being able to kill you in a few hits when blocking, the fact that you can be 1 hit killed when new would make it challenging to take on strong people and have to block everytime to survive and win. having no chance at all is just lame..do i have do dig into a game file and manually edit it?
 
<!--quoteo(post=330111:date=Jun 18 2009, 05:59 AM:name=kalamaru)--><div class='quotetop'>QUOTE (kalamaru @ Jun 18 2009, 05:59 AM) <a href="index.php?act=findpost&pid=330111"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I finally got the mess installed properly, and have been trying to figure out how to make it so i don't take damage when blocking. there's nothing realistic or challenging about random hobo looking sailors in port being able to kill you in a few hits when blocking, the fact that you can be 1 hit killed when new would make it challenging to take on strong people and have to block everytime to survive and win. having no chance at all is just lame..do i have do dig into a game file and manually edit it?<!--QuoteEnd--></div><!--QuoteEEnd-->
-Start the game.
-Options
-Advanced Options
-Block Damage
-Change it to "0"

Make sure you don't have a game running at the time. Do it straight after the main menu loads
 
Which game version are you using? The whole blockdamage mod was recently removed anyway.
It's now replaced with a system that's a bit more advanced, but the block value of your blade is important now.
Some attacks, you won't block, even when trying. <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />
 
Yup one of the first things i did when i got everything installed was go through every one of the advanced options and whatnot, changed block damage to 0 but doesn't help much hehe, thanks anyway.
 
Try to get yourself a good blade. And saving frequently is always a must. What difficulty are you playing?
 
Hardest difficulty? That might explain it. I never did play on that; actually, I virtually never play on anything but the lowest difficulty.
But anyway, the best you can do is get a blade with a good block and lots of health potions.
And if you've got a fair amount of money to spend and find four medical items, the Bridgetown apothecary can increase your maximum health.
 
Guess i'll restart my game then..i've played Sid Meiyers Pirates, Sea Dogs, and currently World of Pirates (online game). but this one seems to be alot tougher to get started on, all the ships sailing around are always in fleets hehe..maybe changing the difficulty will help with that too.
 
You can actually change your difficulty without starting a new game.
Though doing so through the Options menu does require you to reload a save (changing the options messes up the currently loaded game).
Best talk to a tavern-hired officer and use the dialog options for "About me" and then "I don't fit in quite right with this world".
 
Back
Top