Official 1C Company forum

Official 1C Company forum (http://forum.1cpublishing.eu/index.php)
-   King`s Bounty: Warriors of the North (http://forum.1cpublishing.eu/forumdisplay.php?f=206)
-   -   Bugfixes (http://forum.1cpublishing.eu/showthread.php?t=35494)

Bhruic 10-30-2012 07:43 PM

Bugfixes
 
Downloads offline while investigating latest patch

This thread is dedicated to those bugs that can be fixed by modifying Lua files. For those who know what they are doing, the bug fixes will be listed, but there'll also be a corresponding file to download to enjoy the fixes for the less technically inclined. To save space, changes are included in the same code box, the original first, the modified version second.

For those who are just downloading the file, I'm listing the time of file update at the end of this post, so you can check if it's changed since you last downloaded it.

Diplomacy fix - Diplomacy would only work if the enemy you were attacking had less units than your max leadership, and then could grant you more units than you should be able to take
In skills.lua, line 383:
Code:

local can_join = math.floor(hero_lead/Logic.cp_leadship(atom)) -count

local can_join = math.floor(hero_lead/Logic.cp_leadship(atom)) - hero[atom]

Archmage's Magic Shield fix - The Magic Shield reduced the target units outgoing damage rather than their incoming damage
In unit_special_attacks.lua, line 2199:
Code:

if Attack.act_is_spellattacker, "special_magic_shield") then

if Attack.act_is_spell(receiver, "special_magic_shield") then

Alfheim fix - the Alfheim edda is supposed to only cast beneficial spells on allies and harmful spells on enemies, but it was casting both types on any units
see post #25 for details


The above change is not currently included in the attached zip file

Book of Evil fix (thanks saroumana) - This spell was grossly overpowered
In spells_power.lua, line 1365:
Code:

local bonus = math.floor(100*(creator_power + int_bonus)*int_bonus)

local bonus = math.floor(100*(creator_power + item_bonus)*int_bonus)

Song of Svartalfaheim fix - Was giving too much initiative
In visa.lua, line 170:
Code:

local bonus, penalty = pwr_visa_svartalfheim()

local gold, bonus, penalty = pwr_visa_svartalfheim()

Sense Weakness fix - Sense Weakness gets 1% less chance to apply than it should
In arena.lua, line 553:
Code:

if kritProbRnd > kritProb then

if kritProbRnd >= kritProb then

Spell/Rage crits fix - Criticals were not being applied to either spells or rage attacks
in arena.lua, starting line 880:
insert the following code (in red):
Code:

      end
        else
          if iskrit then -- íà êðèòàõ
        sdmg = -sdmg * krit
        if receiver_human then
          item_bonus_on_krit(attacker)
        end
      end

    end
    -- Óìåíèÿ Ìàðîäåðà
    if attacker_human and killed>0 and 1000==10 then

Shield of Rage fix (thanks mahey) - Granted the reverse percentage chance of removing a spell (ie, at 10%, it actually had a 90% chance of removal)
in addon_arena.lua, line 1265:
Code:

if (rage_shield_i < Game.Random(1, 100)) then

if (rage_shield_i >= Game.Random(1, 100)) then

Calm Rage fix - The spell could attempt to calm more rage than you currently possessed, resulting in loss of total rage amount
in spells_power.lua, line 990:
Code:

local rage_can_give = math.ceil(mana_can_get/convert_mod)

local rage_can_give = math.floor(mana_can_get/convert_mod)

Soothsayer Ice Storm fix - The freeze effect of Ice Storm would only (and excessively) target the center unit
in unit_special_attacks.lua, line 1190:
Code:

effect_freeze_attack(target, dmgts+dmgts1+1, duration, 0)

effect_freeze_attack(cell, dmgts+dmgts1+1, duration, 0)

Edda fix (thanks Chro) - Edda power wasn't getting calculated properly
in visa_power_hint.lua:
Search and replace, find all instances of "skald_edda", replace with "edda_skald" (should be 9 changes made)

Fear (partial?) fix - Some units are able to use their special abilities when feared - this fix applies to Slingers and Catapults
in arena.lua, line 3700:
Code:

if h > max_hazard then
        max_hazard = h
        target = act
        prob = k * (1 + hit_count*0.5)
end

if h > max_hazard then
        if (mover.spells.spell_scare or mover.spells.effect_fear) then
                if (mover.level >= act.level) then
                        max_hazard = h
                        target = act
                        prob = k * (1 + hit_count*0.5)
                end
        else

                max_hazard = h
                target = act
                prob = k * (1 + hit_count*0.5)
        end
end

Trolls Pacify fix - Pacify was not taking effect
in unit_features_master.lua, line 1469:
Code:

if not not hitbacking then

if not hitbacking then

Ice Prison/Hilda's Arrows fix - Any unit with Ice Prison on it would be destroyed and replaced with an orb if hit with Hilda's Arrows (a nice exploit to be sure ;))
in addon_pet.lua, line 192:
Code:

everebody_dies = (Attack.act_damage( cell, ignore_posthitmaster ))
if everebody_dies then

everebody_dies = (Attack.act_damage( cell, ignore_posthitmaster ))
if Attack.act_is_spell(cell, "spell_ice_prison") then
        everebody_dies = false
end

if everebody_dies then

Mista's Lightning fix - If an enemy moved before you used this ability, your current unit would lose its turn, and the lightning wouldn't proc for that round
in addon_pet.lua, line 79:
Code:

Attack.done_timeshift(Attack.aseq_time(0))

--Attack.done_timeshift(Attack.aseq_time(0))

Ice Dragon death fix - Ice Dragons were causing crashes when they died
in unit_features_ondamage.lua, line 307:
Code:

if initsize == 1 then
  Attack.log(dmgts, "add_blog_ice_dragon_death_1", "name","  "..blog_side_unit(0), "special", mana_count)
else
  Attack.log(dmgts, "add_blog_ice_dragon_death_2", "name","  "..blog_side_unit(0), "special", mana_count)

if initsize == 1 then
  Attack.log(dmgts, "add_blog_ice_dragon_death_1", "name","  "..blog_side_unit(0), "special", manaval)
else
  Attack.log(dmgts, "add_blog_ice_dragon_death_2", "name","  "..blog_side_unit(0), "special", manaval)

Highterant fix - Highterants had a buggy egg-laying routine
see post #153 for details

Various warning fixes - Main unit special abilities (such as the Skald's curse song or the Royal Griffin's Heavenly Guard) would have their warnings pop up when under AI control
in unit_special_attacks.lua
there are multiple spots where the change needs to be made, I'm giving a single example here, but you can find all of them by doing a search for Game.InvokeMsgBox("warning" and cycling through them. Most work just like this example:
Code:

Game.InvokeMsgBox("warning", "<label=sw_default>")
Attack.log_label("null")

if not Attack.is_computer_move() then
        Game.InvokeMsgBox("warning", "<label=sw_default>")
        Attack.log_label("null")
end

Blizzard fix - The Blizzard spell wasn't freezing units properly
in spells.lua, line 6100:
Code:

effect_freeze_attack(cell_found, t_shift, 3, nil, 1)

effect_freeze_attack(cell, t_shift, 3, nil, 1)

___
If you download the zip file, you need to extra the files in the sessions\addon subfolder off your main WotN installation.

File updated Nov 7, 3:56 pm (local time)

camelotcrusade 10-30-2012 07:56 PM

1 Attachment(s)
Update: Mod updated for Patch 5.
Other notes - In Patch 2, Last Hero was replaced with Stoneskin for the Skald talent "paean." I'm happy with this decision and no longer providing a mod to change it to dragon_slayer. In Patch 3, Avenging Angel was also added to "paean." Nice.

If you want to replace Stonekin (or any other spell in the list for paean) yourself, you will need to do it once in lines 867-871 and twice in lines 945-955 for a total of 3 replacements (e.g., spell_stone_skin twice and spell_stone_skin_attack once). All of Bhuric's changes that I packaged into my last version were covered in Patch 2 (fixes for Archmage's shield and soothsayer ice storm).

Song of Alfheim and Diversion FX Mod
The attachment below includes includes the song of alfheim mod to make it only target you with beneficial buffs and enemies with curses, and the diversion animation mod which makes it look like stun instead. A readme is included, but in case you don't read it Bhuric deserves full credit for developing the code for the song of alfheim mod. :)

Your location may vary but mine is in here: C:\Program Files (x86)\Steam\steamapps\common\King's Bounty - Warriors of the North\sessions\addon.

The correct order to install these is: Start with Patched files first (e.g., clean out any LUA files in your addon folder), Install Bhruic fixes if they are available, then install my mods over top of them. Zech's language mod alters completely different files and can be installed at any time.

Finally, I will be updating my attachment whenever Bhruic issues new versions of unit_special_attacks or addon_arena, or whenever there is a new official patch.

Bhruic 10-30-2012 09:05 PM

Well, rather than do that approach, I fixed the spell (mostly). It's actually not a bad spell, if you know you are going to finish combat soon.

Probably Dragonslayer would be better, but I'm trying to just do fixes with this, rather than outright game changes.

camelotcrusade 10-30-2012 09:15 PM

I'm so impressed you figured that out.

Do you know how to change the visual representation for the Distraction skill? It reminds me of Fit of Energy/Rally which makes you act not stop moving. :)

If it were up to me, I'd change it to the Confusion effect (???) over their heads.

Zechnophobe 10-30-2012 09:26 PM

Quote:

Originally Posted by Bhruic (Post 475219)
Well, rather than do that approach, I fixed the spell (mostly). It's actually not a bad spell, if you know you are going to finish combat soon.

Probably Dragonslayer would be better, but I'm trying to just do fixes with this, rather than outright game changes.

Last Stand is a fine spell when manually cast. Having it randomly cast on a stack sucks horribly though.

I might break open the lua myself tonight and see if I can fix some of this stuff.

God, is it possible someone could do a fan-made update to all the freaking tool tips? I'd literally climax in excitement at that.

Bhruic 10-30-2012 09:28 PM

Added fix for Archmage's Magic Shield spell. Amusingly the default version of it actually caused the unit it was cast on to do 50% less damage. So basically you were nerfing your own units by casting it on them. ;)

Bhruic 10-30-2012 09:30 PM

Quote:

Originally Posted by camelotcrusade (Post 475226)
I'm so impressed you figured that out.

Do you know how to change the visual representation for the Distraction skill? It reminds me of Fit of Energy/Rally which makes you act not stop moving. :)

If it were up to me, I'd change it to the Confusion effect (???) over their heads.

It was mainly just trial and error - I took everything out, then slowly added stuff back until it broke.

Which skill is Distraction? Player skill or unit skill?

Hagbard 10-30-2012 09:33 PM

oh this is nice, thx a lot

Bhruic 10-30-2012 09:34 PM

Quote:

Originally Posted by Zechnophobe (Post 475233)
Last Stand is a fine spell when manually cast. Having it randomly cast on a stack sucks horribly though.

I might break open the lua myself tonight and see if I can fix some of this stuff.

God, is it possible someone could do a fan-made update to all the freaking tool tips? I'd literally climax in excitement at that.

True, Last Hero is a poor random spell. Ideally I'd like to see it swapped for something like Dragonslayer, but that's not really my call to make. ;)

I believe the tooltips are all just text based, so it should be possible to fix them, yes. Check the loc_ses.kfs file in sessions/addon (it's just a zip file). It contains all the .lng files, which seem to be plaintext

camelotcrusade 10-30-2012 09:54 PM

Diversions is a mind/spirit tree skill that says you have a 10/20/30% chance to make opponents lose their turn. I've been calling it the wrong thing this whole time, I better update my threads. :)

I will also make a note of the archmage fix in the bugs thread soon. And for the record I highly approve of you making only fixes not mods with these releases. I'm still gonna mod mine to use Dragonslayer, though. :D I feel it's not too strong (highly conditional as a random buff) but still useful.

PS - more work for you Bhruic but if you colorized what code changed it would be extra awesome


All times are GMT. The time now is 12:45 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 2007 1C Company. All rights reserved.