Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   King`s Bounty: Warriors of the North (http://forum.fulqrumpublishing.com/forumdisplay.php?f=206)
-   -   Bugfixes (http://forum.fulqrumpublishing.com/showthread.php?t=35494)

Bhruic 10-30-2012 06: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 06: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 08: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 08: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 08: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 08: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 08: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 08:33 PM

oh this is nice, thx a lot

Bhruic 10-30-2012 08: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 08: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

Bhruic 10-30-2012 09:22 PM

Quote:

Originally Posted by camelotcrusade (Post 475256)
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

In addon_arena.lua:
Code:

Attack.atom_spawn(act, tend, "magic_diversion", Attack.angleto(act))
That's the line where it's displaying the animation for the diversion skill. You'll need to experiment with the available animations to see which one you want to replace it with.

Hmm, I'm not sure if the code tag supports colours, but I guess I can try it and see.

edit: If I'd looked at your first post, I'd have realized that it does. ;)

camelotcrusade 10-30-2012 09:50 PM

That looks great, thanks for using those colors.

Okay so I hunted for the confused effect but then i realized since it only applies on the world map it might bug out if I used it in combat. So instead I found Stun, that would at least indicate "this unit isn't going to do anything this turn."

Here it is:

Code:

-- ***********************************************
-- * Stun
-- ***********************************************
function effect_stun_attack(target, pause, duration, log_message)
  --local target = Attack.get_target()
  if pause == nil then
    pause = 1
  end
  if target == nil then
    target = Attack.get_target()
  end
  if duration == nil then
    duration = tonumber(Logic.obj_par("effect_stun", "duration"))
  end
  if (Attack.act_ally(target) or Attack.act_enemy(target)) and not Attack.act_feature(target, "boss,pawn") then
    --local duration = tonumber(Attack.get_custom_param("duration"))
    duration = correct_spell_duration (duration, target, true)
    local inbonus = tonumber(Logic.obj_par("effect_stun", "inbonus"))
    local speedbonus = tonumber(Logic.obj_par("effect_stun", "speedbonus"))
--    local speed = Attack.act_get_par(target, "speed")

--    local change_speed = speed - speedbonus

    Attack.act_del_spell(target,"effect_stun")
    Attack.act_apply_spell_begin( target, "effect_stun", duration, false )
      Attack.act_apply_par_spell( "disreload", 10, 0, 0, duration, false)
      Attack.act_apply_par_spell( "disspec", 10, 0, 0, duration, false)
      Attack.act_apply_par_spell( "initiative", -inbonus, 0, 0, duration, false)
      Attack.act_apply_par_spell( "speed", -speedbonus , 0, 0, duration, false)
    Attack.act_apply_spell_end()
    Attack.atom_spawn(target, pause, "effect_stun", 0, true)

    -- log_message = -1 - íåò ëîãà, 0 - ïðèïèñûâàåì ê äàìàãó, 1 - âûâîäèì îòäåëüíîé ñòðîêîé
    if log_message == nil then
      log_message = 0
    end
    if log_message == 0 then
      Attack.act_damage_addlog(target, "add_blog_stun_")
    elseif log_message == 1 then
      if Attack.act_size(target) > 1 then
        Attack.log(pause, "add_blog_stun_2", "targets", blog_side_unit(target, 1))
      else
        Attack.log(pause, "add_blog_stun_1", "target",  blog_side_unit(target, 1))
      end
    end
  end

  return true
end

Any idea where the visual effect is in all that? I don't want the unit to actually be stunned, just look like while they are distracted.

Zechnophobe 10-30-2012 10:04 PM

Code:

    Attack.act_del_spell(target,"effect_stun")
    Attack.act_apply_spell_begin( target, "effect_stun", duration, false )
      Attack.act_apply_par_spell( "disreload", 10, 0, 0, duration, false)
      Attack.act_apply_par_spell( "disspec", 10, 0, 0, duration, false)
      Attack.act_apply_par_spell( "initiative", -inbonus, 0, 0, duration, false)
      Attack.act_apply_par_spell( "speed", -speedbonus , 0, 0, duration, false)
    Attack.act_apply_spell_end()
    Attack.atom_spawn(target, pause, "effect_stun", 0, true)

Not 100% sure without poking it, but the 'atom_spawn' could be an animation effect, though I'm not sure about the arguments. I'd be fairly certain though that the 'pause' variable is telling it to not let you continue to make orders while it's in effect. It just occurred to me that applying that argument to more effects would speed up combat a lot. Like, how Celestial guards (the things royal griffens spawn) remove debuffs on them without halting you from making actions.

I wouldn't mind a few longer than normal spell effects if they'd just queue up as I played. Hmm.

Bhruic 10-30-2012 10:08 PM

Quote:

Originally Posted by camelotcrusade (Post 475295)
Any idea where the visual effect is in all that? I don't want the unit to actually be stunned, just look like while they are distracted.

Code:

    Attack.atom_spawn(target, pause, "effect_stun", 0, true)
As Zechnophobe says, that's the line. I'm not sure if you can just copy and replace it with the other line, or if you'll need to modify it at all, but you can experiment and find out.

camelotcrusade 10-30-2012 10:37 PM

Omg you guys, it worked! I feel like a super modder now... :cool:

All I had to do was replace "magic_diversion" with "effect_stun." Worked great. No pause or anything, it just made the noise, showed the stun effect and the Skeleton lost his action points. Try it out if you want.

Manual Method

In addon_arena.lua, line 1010. Replace:

Code:

Attack.atom_spawn(act, tend, "magic_diversion", Attack.angleto(act))
with

Code:

Attack.atom_spawn(act, tend, "effect_stun", Attack.angleto(act))
Update: The attachment which replaces the "Fit of Energy/Rally" graphic with the "Stun" swirling stars effect has been consolidated into my other mods here.

Zechnophobe 10-30-2012 11:11 PM

High five team! (not like I did anything)

This is, by the way, why being a software developer can sometimes make you feel like a freaking wizard. You mere mortals and your inability to change graphical effects? Hah! You disgust me.

MattCaspermeyer 10-31-2012 01:26 AM

Great Job - Don't Forget the LUA Library
 
Hey, great job guys!

As a modder, it is neat to see people changing the game for the better.

Don't forget, though, about the LUA library mentioned here:

http://forum.1cpublishing.eu/showpos...97&postcount=4

You'll need to use a translater to convert the text to English unless you understand Russion (Google seems to work okay), but you should be able to discern the input arguments from there.

Also feel free to ask me if the LUA library doesn't answer your questions since I've dabbled (and am dabbling) in the LUA library quite a bit...

/C\/C\

Loopy 10-31-2012 03:18 AM

Warrior Maidens have two broken abilities.

Call of Valhalla seems to not work at all or only work 1 round in the past, and with multiple stacks of maidens it almost never works past the first time.

Gift of Odin seems to not work at all.

camelotcrusade 10-31-2012 03:34 AM

Quote:

Originally Posted by MattCaspermeyer (Post 475384)
Hey, great job guys!

As a modder, it is neat to see people changing the game for the better.

Don't forget, though, about the LUA library mentioned here:

http://forum.1cpublishing.eu/showpos...97&postcount=4

You'll need to use a translater to convert the text to English unless you understand Russion (Google seems to work okay), but you should be able to discern the input arguments from there.

Also feel free to ask me if the LUA library doesn't answer your questions since I've dabbled (and am dabbling) in the LUA library quite a bit...

/C\/C\

Cool, thanks for the link!
@Loopy, both of those are documented in the bug thread along with explanations. Check it out.

camelotcrusade 10-31-2012 04:30 AM

Up next - 1. Does anyone have ideas of where to even begin to fix the Crystal Collector bug? That one is really cramping my style. Yeah, I know I'm only missing out on a few points of intellect, but I know if I start spending my crystals it will be ages before I catch up.

2. I've never seen my alchemist or my engineer mix more than one bottle when using their remix ability. Here's what the code says (line 3026, unit_special_attacks.lua):

Code:

-- ***********************************************
-- Ñîçäàíèå Çåëèé/Ãðàíàò (Àëõèìèê, Èíæåíåð)
-- ***********************************************
function special_craft_attack()
  local charge = 1
  if Attack.act_human(0) then
    if Attack.act_name(0) == "alchemist" then
      if Logic.hero_lu_item_on_body("alchemist_toolkit") then
        if 10 >= Game.CurLocRand(1, 100) then
          charge = charge + 1
        end
      end
    end
  end

  local animation = Attack.get_custom_param("animation")
  Attack.act_aseq(0, animation)
  local dmgts = Attack.aseq_time(0, "x")
  local name = Attack.get_custom_param("craft")
  local craft_name = "craft_"..name
  Attack.act_enable_attack(0, craft_name, false)
  Attack.act_enable_attack(0, name, true)
  Attack.act_charge(0, charge, name)

  local size = Attack.act_size(0)
  if Attack.act_size(0)> 2 then
    size = 2
  end
  Attack.log(0.5 + dmgts, "add_blog_chemistry_crafting_success_"..tostring(charge)..tostring(size), "name", blog_side_unit(0, 0), "special", charge)

  return true
end

I can see it looks like there is a 10% chance to do better than 1 bottle. Have I just been unlucky 20+ times or might there be something wrong here?

namad 10-31-2012 05:45 AM

1) the powerful raise ability is intentionally limited to the recent past... as a balancing factor... its still prolly op!

2) what does the witchhunter fix actually do? (I didn't know what was wrong with them before)


also... is 20intiative rune mages a bug? what should it be? is that fixable via lua? what was it in crossworlds? 20 seems like its gotta be a typo? 20 is prolly the max possible value or something?

MattCaspermeyer 10-31-2012 07:40 AM

I think this post covers this problem: http://forum.1cpublishing.eu/showthread.php?t=35519

Quote:

Originally Posted by camelotcrusade (Post 475429)
Up next - 1. Does anyone have ideas of where to even begin to fix the Crystal Collector bug? That one is really cramping my style. Yeah, I know I'm only missing out on a few points of intellect, but I know if I start spending my crystals it will be ages before I catch up.

The code you quote looks correct - do you mean you've tried 20 times or that you should have been successful 20 times (i.e. you've tried 200 times)? If you've tried 20 times, you should have (on average) got 2 potions twice, but there is no guarantee and so you may have just been unlucky. If you've tried 200 times, then there is definitely something wrong, although the code looks fine to me...

/C\/C\

Quote:

Originally Posted by camelotcrusade (Post 475429)
2. I've never seen my alchemist or my engineer mix more than one bottle when using their remix ability. Here's what the code says (line 3026, unit_special_attacks.lua):

Code:

-- ***********************************************
-- Ñîçäàíèå Çåëèé/Ãðàíàò (Àëõèìèê, Èíæåíåð)
-- ***********************************************
function special_craft_attack()
  local charge = 1
  if Attack.act_human(0) then
    if Attack.act_name(0) == "alchemist" then
      if Logic.hero_lu_item_on_body("alchemist_toolkit") then
        if 10 >= Game.CurLocRand(1, 100) then
          charge = charge + 1
        end
      end
    end
  end

  local animation = Attack.get_custom_param("animation")
  Attack.act_aseq(0, animation)
  local dmgts = Attack.aseq_time(0, "x")
  local name = Attack.get_custom_param("craft")
  local craft_name = "craft_"..name
  Attack.act_enable_attack(0, craft_name, false)
  Attack.act_enable_attack(0, name, true)
  Attack.act_charge(0, charge, name)

  local size = Attack.act_size(0)
  if Attack.act_size(0)> 2 then
    size = 2
  end
  Attack.log(0.5 + dmgts, "add_blog_chemistry_crafting_success_"..tostring(charge)..tostring(size), "name", blog_side_unit(0, 0), "special", charge)

  return true
end

I can see it looks like there is a 10% chance to do better than 1 bottle. Have I just been unlucky 20+ times or might there be something wrong here?


Bhruic 10-31-2012 07:50 AM

Quote:

Originally Posted by namad (Post 475444)
2) what does the witchhunter fix actually do? (I didn't know what was wrong with them before)

Their self-buff ability was limited to only giving them the Dragonslayer buff. With the fix, they are back to potentially getting any of the buffs in their repertoire.

Quote:

also... is 20intiative rune mages a bug? what should it be? is that fixable via lua? what was it in crossworlds? 20 seems like its gotta be a typo? 20 is prolly the max possible value or something?
It's hard to say if it's a bug or not, but it seems unlikely to be a typo (I doubt they intended to give them 2 initiative, and even 10 would seem high).

Bhruic 10-31-2012 07:57 AM

Quote:

Originally Posted by camelotcrusade (Post 475429)
2. I've never seen my alchemist or my engineer mix more than one bottle when using their remix ability. Here's what the code says (line 3026, unit_special_attacks.lua):

I can see it looks like there is a 10% chance to do better than 1 bottle. Have I just been unlucky 20+ times or might there be something wrong here?

To save space I didn't quote the code, but you can go back and look... What it actually is doing is checking if you've got the item "alchemist_toolkit" equipped on your character, and if you do, then you have a 10% chance of getting a second bottle. That's the only way it lists for that to take place.

I've never used Alchemists/Engineers in WotN, so I'm not sure if they are supposed to have the option to mix more than one without an item.

Bhruic 10-31-2012 08:46 AM

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

addon_arena.lua

original:
Code:

local tab_spell_select = {
    -- õîðîøèå çàêëû
    {s = "spell_dispell",      nf = "magic_immunitet,pawn,boss"},
    {s = "spell_haste",        nf = "magic_immunitet,pawn,boss"},
    {s = "spell_bless",        nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_divine_armor",  nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_reaction",      nf = "magic_immunitet,pawn,boss"},
    {s = "spell_gifts",        nf = "magic_immunitet,pawn,boss"},
    -- ïëîõèå çàêëû
    {s = "spell_defenseless",  nf = "magic_immunitet,pawn,boss"},
    {s = "spell_slow",          nf = "magic_immunitet,pawn,boss"},
    {s = "spell_magic_bondage", nf = "mind_immunitet,magic_immunitet,pawn,boss"},
    {s = "spell_pygmy",        nf = "magic_immunitet,pawn,boss"},
    {s = "spell_scare",        nf = "magic_immunitet,mind_immunitet,undead,pawn,boss"},
    {s = "spell_weakness",      nf = "undead,golem,plant,magic_immunitet,pawn,boss"},
    {s = "spell_crue_fate",    nf = "magic_immunitet,pawn,boss"}--[[,
    {s = "spell_ram",          nf = "magic_immunitet,pawn,boss,mech"}]]
  }
  local cast = {}
  local spell_count = table.getn(tab_spell_select)
  local acnt = Attack.act_count()
  local total_prob = 0
  for i = 1, spell_count do
    local spell = (tab_spell_select[i]).s
    local nfeatures = (tab_spell_select[i]).nf
    local tab_spell_targets = {}
    for j = 0, acnt-1 do
      if not Attack.act_feature(j, nfeatures) and Attack.act_takesdmg(j) then
        table.insert(tab_spell_targets, j) -- âûáîð áàçîâûõ öåëåé
      end
    end
    if table.getn(tab_spell_targets) > 0 then -- åñòü áàçîâûå öåëè
      local spell_lvl = Game.Random (1, 3) -- óðîâåíü çàêëà, êîòîðûé áóäåì þçàòü
      local applicable = Attack.build_spell_attack(spell, spell_lvl).applicable
      for i, t in ipairs (tab_spell_targets) do
        if applicable(t) then -- çàêë ïðèìåíèì íà ýòó öåëü
          local prob = 10
          total_prob = total_prob + prob
          table.insert(cast, {spell = spell, level = spell_lvl, target = t, prob = prob})
        end
      end
    end
  end

modified:
Code:

local tab_spell_select_positive = {
    -- õîðîøèå çàêëû
    {s = "spell_dispell",      nf = "magic_immunitet,pawn,boss"},
    {s = "spell_haste",        nf = "magic_immunitet,pawn,boss"},
    {s = "spell_bless",        nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_divine_armor",  nf = "undead,magic_immunitet,pawn,boss"},
    {s = "spell_reaction",      nf = "magic_immunitet,pawn,boss"},
    {s = "spell_gifts",        nf = "magic_immunitet,pawn,boss"}
  }
  local tab_spell_select_negative = {

    -- ïëîõèå çàêëû
    {s = "spell_defenseless",  nf = "magic_immunitet,pawn,boss"},
    {s = "spell_slow",          nf = "magic_immunitet,pawn,boss"},
    {s = "spell_magic_bondage", nf = "mind_immunitet,magic_immunitet,pawn,boss"},
    {s = "spell_pygmy",        nf = "magic_immunitet,pawn,boss"},
    {s = "spell_scare",        nf = "magic_immunitet,mind_immunitet,undead,pawn,boss"},
    {s = "spell_weakness",      nf = "undead,golem,plant,magic_immunitet,pawn,boss"},
    {s = "spell_crue_fate",    nf = "magic_immunitet,pawn,boss"}--[[,
    {s = "spell_ram",          nf = "magic_immunitet,pawn,boss,mech"}]]
  }
  local cast = {}
  local acnt = Attack.act_count()
  local total_prob = 0
  local spell_count = table.getn(tab_spell_select_positive)
  for i = 1, spell_count do
    local spell = (tab_spell_select_positive[i]).s
    local nfeatures = (tab_spell_select_positive[i]).nf
    local tab_spell_targets = {}
    for j = 0, acnt-1 do
      if not Attack.act_feature(j, nfeatures) and Attack.act_takesdmg(j) and Attack.act_ally(j) then
        table.insert(tab_spell_targets, j) -- âûáîð áàçîâûõ öåëåé
      end
    end
    if table.getn(tab_spell_targets) > 0 then -- åñòü áàçîâûå öåëè
      local spell_lvl = Game.Random (1, 3) -- óðîâåíü çàêëà, êîòîðûé áóäåì þçàòü
      local applicable = Attack.build_spell_attack(spell, spell_lvl).applicable
      for i, t in ipairs (tab_spell_targets) do
        if applicable(t) then -- çàêë ïðèìåíèì íà ýòó öåëü
          local prob = 10
          total_prob = total_prob + prob
          table.insert(cast, {spell = spell, level = spell_lvl, target = t, prob = prob})
        end
      end
    end
  end
 
  spell_count = table.getn(tab_spell_select_negative)
  for i = 1, spell_count do
    local spell = (tab_spell_select_negative[i]).s
    local nfeatures = (tab_spell_select_negative[i]).nf
    local tab_spell_targets = {}
    for j = 0, acnt-1 do
      if not Attack.act_feature(j, nfeatures) and Attack.act_takesdmg(j) and Attack.act_enemy(j) then
        table.insert(tab_spell_targets, j) -- âûáîð áàçîâûõ öåëåé
      end
    end
    if table.getn(tab_spell_targets) > 0 then -- åñòü áàçîâûå öåëè
      local spell_lvl = Game.Random (1, 3) -- óðîâåíü çàêëà, êîòîðûé áóäåì þçàòü
      local applicable = Attack.build_spell_attack(spell, spell_lvl).applicable
      for i, t in ipairs (tab_spell_targets) do
        if applicable(t) then -- çàêë ïðèìåíèì íà ýòó öåëü
          local prob = 10
          total_prob = total_prob + prob
          table.insert(cast, {spell = spell, level = spell_lvl, target = t, prob = prob})
        end
      end
    end
  end


saroumana 10-31-2012 09:15 AM

Book of evil correction :

in spells_power.lua

Original

Quote:

function pwr_evilbook(level)
if tonumber(level) == 0 or level == nil then
level = Obj.spell_level()
if level == 0 then
level = 1
end
if Obj.where() == 6 and Obj.spell_level() ~= 0 then
level = level + 1
end
else
level = tonumber(level)
end

local level = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "level"), level))
local kill = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "kill"), level))
local creator_power = 1 + tonumber(skill_power2("creator", 1)/100)
creator_power = creator_power/2
local int_bonus = 1 + tonumber(Game.Config("spell_power_config/int_power"))*HInt()/100
local item_bonus = tonumber(Logic.hero_lu_item("sp_spell_demonologist ", "count")/100)
local bonus = math.floor(100*(creator_power + int_bonus)*int_bonus)

return bonus, level, kill
end
CHANGE

Quote:

function pwr_evilbook(level)
if tonumber(level) == 0 or level == nil then
level = Obj.spell_level()
if level == 0 then
level = 1
end
if Obj.where() == 6 and Obj.spell_level() ~= 0 then
level = level + 1
end
else
level = tonumber(level)
end

local level = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "level"), level))
local kill = tonumber("0" .. text_dec(Logic.obj_par("spell_evilbook", "kill"), level))
local creator_power = 1 + tonumber(skill_power2("creator", 1)/100)
creator_power = creator_power/2
local int_bonus = 1 + tonumber(Game.Config("spell_power_config/int_power"))*HInt()/100
local item_bonus = tonumber(Logic.hero_lu_item("sp_spell_demonologist ", "count")/100)
local bonus = math.floor(100*(creator_power + item_bonus)*int_bonus)

return bonus, level, kill
end

Bhruic 10-31-2012 09:30 AM

Nice find. Added that to the first post. Also added a fix for the Song of Svartalfheim.

pavar 10-31-2012 11:37 AM

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.

I'm working on correcting the effing grammar (and the off-mark descriptions) on spells and skills. If you are willing to list the tooltips that need updating (what it says / what it should say), I would gladly dive in on it. Thanks to you guys I am able to play the game without having it crashing to the desktop every 2 minutes and I wouldn't know where to start to correct the bugs, but this is at my level :cool:

ikbenrichard 10-31-2012 01:19 PM

Great work. Big thnx !

camelotcrusade 10-31-2012 03:57 PM

Quote:

Originally Posted by Bhruic (Post 475474)
To save space I didn't quote the code, but you can go back and look... What it actually is doing is checking if you've got the item "alchemist_toolkit" equipped on your character, and if you do, then you have a 10% chance of getting a second bottle. That's the only way it lists for that to take place.

I've never used Alchemists/Engineers in WotN, so I'm not sure if they are supposed to have the option to mix more than one without an item.

I bet that is the problem - good find. I don't have that item so it's never creating 2 bottles. However, the description on remix clearly says "Create 1-2 charges of X." I guess they put that in as a catchall? Seems misleading if you ask me, especially since your chances of finding one specific item could be low.

Imo, it should always have that 10% chance and having the item (after all, it's a belt slot!) should give you an extra 10% chance. Either that or the description should say 1 item... but then it won't be accurate when you DO have that item. Aargh.

Thoughts?

camelotcrusade 10-31-2012 04:08 PM

Quote:

Originally Posted by namad (Post 475444)
1) the powerful raise ability is intentionally limited to the recent past... as a balancing factor... its still prolly op!

I am starting to agree it's working as intended. What it should say is "Restores a maximum of X forces of the targeted troop if they receive the Call of Valhalla before they act again." That's what it really does, and I agree that's plenty good.

I'm going to move it to the description/tooltip section.

MattCaspermeyer 10-31-2012 04:19 PM

Try this...
 
Just do this:

Before:

Code:

  if Attack.act_human(0) then
    if Attack.act_name(0) == "alchemist" then
      if Logic.hero_lu_item_on_body("alchemist_toolkit") then
        if 10 >= Game.CurLocRand(1, 100) then
          charge = charge + 1
        end
      end
    end
  end

After:

Code:

  if Attack.act_human( 0 ) then
    if Attack.act_name( 0 ) == "alchemist" then
      local chance = 10

      if Logic.hero_lu_item_on_body( "alchemist_toolkit" ) then
        chance = chance + 10
      end

      if chance >= Game.CurLocRand( 1, 100 ) then
        charge = charge + 1
      end
    end
  end

The descriptions say 1 to 2 charges, but do not list a percent chance of that happening, the Toolkit description says +10% chance - the code above would cover both bases...

/C\/C\

Quote:

Originally Posted by camelotcrusade (Post 475655)
I bet that is the problem - good find. I don't have that item so it's never creating 2 bottles. However, the description on remix clearly says "Create 1-2 charges of X." I guess they put that in as a catchall? Seems misleading if you ask me, especially since your chances of finding one specific item could be low.

Imo, it should always have that 10% chance and having the item (after all, it's a belt slot!) should give you an extra 10% chance. Either that or the description should say 1 item... but then it won't be accurate when you DO have that item. Aargh.

Thoughts?


camelotcrusade 10-31-2012 04:23 PM

Thanks Matt! I'm going to mod my game and make a note of this on the bugs thread. Bhruic when you have time please add this to the summary. Also, thanks so much for tweaking Song of Alfheim. That one was complicated!

And I forget who linked me to the Crystal collector thread - I definitely know what's happening, I just think it's counter intuitive. Why on earth is there a reward for failing to learn your magic and hording up 100 crystals? Is it supposed to favor the Viking class or something? I find it a real killjoy and think it should be total collected. Mod for that would be great.

Xargon 10-31-2012 04:30 PM

Quote:

Originally Posted by camelotcrusade (Post 475669)
Thanks Matt! I'm going to mod my game and make a note of this on the bugs thread. Bhruic when you have time please add this to the summary. Also, thanks so much for tweaking Song of Alfheim. That one was complicated!

And I forget who linked me to the Crystal collector thread - I definitely know what's happening, I just think it's counter intuitive. Why on earth is there a reward for failing to learn your magic and hording up 100 crystals? Is it supposed to favor the Viking class or something? I find it a real killjoy and think it should be total collected. Mod for that would be great.

I agree about the crystal collector thing, it's rather annoying to hold off on all spell upgrades (though in line with the gold collector medal). But the required number of crystals should definitely higher if it is changed, a total of 100 collected crystals can be reached very early.

camelotcrusade 10-31-2012 04:36 PM

Quote:

Originally Posted by Xargon (Post 475673)
I agree about the crystal collector thing, it's rather annoying to hold off on all spell upgrades (though in line with the gold collector medal). But the required number of crystals should definitely higher if it is changed, a total of 100 collected crystals can be reached very early.

Hmm good point. We never noticed the problem with gold collector because gold is coming out our ears.

For me it's not even about holding out on upgrades, it's holding out on learning the magic in the first place. I just don't get rewarding us for not learning our spells in the first place. It would be like having an award for not spending your runes (I know the Rune Mage does that, but imo not the same thing) or an award for never using new troops. Is that supposed to be fun?

You know the more I think about it, the more messed up this is. It should be a reward for SPENDING your cyrstals and have a higher requirement. That would reward finding them and doing something useful. Maybe that is the Mod we should make, if it's possible.

deftest 10-31-2012 06:13 PM

adding fix files
 
so you just dump the lua files from zip into addon folder ?

camelotcrusade 10-31-2012 06:18 PM

Quote:

Originally Posted by deftest (Post 475717)
so you just dump the lua files from zip into addon folder ?

Yep. And if you want to tweak anything additional in or out of them, you can just edit them once they are included (like alchemist fix, dragonslayer for Last hero swap, image change on distraction, etc.)

Loopy 10-31-2012 06:22 PM

Pretty sure Crystal Collector isn't bugged. It's crystal collector, not crystal finder. If you are spending the crystals you aren't collecting them. The medal for getting lots of gold works the same way.

Bhruic 10-31-2012 06:52 PM

Ok, time for someone to fact check me here, because if I'm reading this correctly, I'm very confused:
Code:

      iskrit = ( kritProbRnd < kritProb )
      if iskrit then
        if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = false
            is_weakness_lore = true
          end
        end
      end

Basically, what this is doing it checking if someone made a critical hit. kritProb is the chance of performing a critical hit, kritProbRnd is a random number from 0-99.

Now, if I'm understanding this right, if a critical hit was made (kritProbRnd is less than kritProb), it then subtracts the value from "weakness_lore", which is the Sense Weakness skill. However, let's assume that you don't have the Sense Weakness skill. Shouldn't skill_power("weakness_lore", 2) return 0? And if that's the case, then kritProb = kritProb - skill_power("weakness_lore", 2) becomes kritProb = kritProb - 0, or kritProb = kritProb. In which case the second if kritProbRnd < kritProb then is guarunteed to also be true because kritProb hasn't changed. Which means that iskrit should automatically be set false, and the game should think Sense Weakness kicked in.

Even worse, I'm sitting here and I can't remember if I've actually had the enemy perform a critical hit on me. It could be my memory letting me down, or it could be that you can't actually get a critical hit on your troops until you take the Sense Weakness skill. Unfortunately I can't set up a test case for "enemy performs a critical hit". So have I mis-analyzed the code? Can anyone without the Sense Weakness skill verify that they've taken (not given) a critical hit?

Fatt_Shade 10-31-2012 07:34 PM

How does weakness lore work with ancient vampires ? They have 100% miss on crit, and this gives even more so basicly enemy hit your ancient vampire they evade and weakness lore override that and they get hit :-)

Razorflame 10-31-2012 07:50 PM

Quote:

Originally Posted by Bhruic (Post 475737)
Ok, time for someone to fact check me here, because if I'm reading this correctly, I'm very confused:
Code:

      iskrit = ( kritProbRnd < kritProb )
      if iskrit then
        if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = false
            is_weakness_lore = true
          end
        end
      end

Basically, what this is doing it checking if someone made a critical hit. kritProb is the chance of performing a critical hit, kritProbRnd is a random number from 0-99.

Now, if I'm understanding this right, if a critical hit was made (kritProbRnd is less than kritProb), it then subtracts the value from "weakness_lore", which is the Sense Weakness skill. However, let's assume that you don't have the Sense Weakness skill. Shouldn't skill_power("weakness_lore", 2) return 0? And if that's the case, then kritProb = kritProb - skill_power("weakness_lore", 2) becomes kritProb = kritProb - 0, or kritProb = kritProb. In which case the second if kritProbRnd < kritProb then is guarunteed to also be true because kritProb hasn't changed. Which means that iskrit should automatically be set false, and the game should think Sense Weakness kicked in.

Even worse, I'm sitting here and I can't remember if I've actually had the enemy perform a critical hit on me. It could be my memory letting me down, or it could be that you can't actually get a critical hit on your troops until you take the Sense Weakness skill. Unfortunately I can't set up a test case for "enemy performs a critical hit". So have I mis-analyzed the code? Can anyone without the Sense Weakness skill verify that they've taken (not given) a critical hit?


ah i also was wondering that since sometimes i got a msg about sense weakness
and i was like wtf i don't have that skill tagged


i thought it maybe was a viking ability or something

but seeing this
this is just a bad write up fix plz:D

Bhruic 10-31-2012 07:56 PM

Quote:

Originally Posted by Razorflame (Post 475764)
ah i also was wondering that since sometimes i got a msg about sense weakness
and i was like wtf i don't have that skill tagged


i thought it maybe was a viking ability or something

but seeing this
this is just a bad write up fix plz:D

It's an easy fix, but I just want to verify that I'm not misreading it first.

camelotcrusade 10-31-2012 08:17 PM

I don't think I've been critted now that you mention. And I actually think we see the sense weakness text come up when we should have been critted but we aren't.

Just last night the AI cast DOOM on my wolves (ermahgerd attack the summons?!!) and when they were hit by the enemy they were not criticaled. I did see the sense weakness appear in the text, though.

Does that help?

Bhruic 10-31-2012 08:22 PM

Quote:

Originally Posted by camelotcrusade (Post 475778)
I don't think I've been critted now that you mention. And I actually think we see the sense weakness text come up when we should have been critted but we aren't.

Just last night the AI cast DOOM on my wolves (ermahgerd attack the summons?!!) and when they were hit by the enemy they were not criticaled. I did see the sense weakness appear in the text, though.

Does that help?

Yup. Ha. And people were complaining about spells/rage not doing critical hits. The poor enemy wasn't getting crits for anything!

camelotcrusade 10-31-2012 08:52 PM

Oh dear. Double facepalm.

So how should we bug this one? Sense Weakness prevents critical hits from enemies? It's kind of a whopper if we are understanding this correctly.

Edit: Attempt at an entry.
  • Sense Weakness bug appears to prevent enemy critical hits: A look at the sense weakness code (link to thread) reveals an error where sense weakness is effectively preventing enemies from inflicting critical hits - but only if you don't have any ranks in the skill. When they would normally inflict a crit you instead see a "sense weakness" mention in the combat log and the crit is averted. Some players are also reporting they never been hit with a crit.

I'll just replace what I have in the thread now with this.

Zechnophobe 10-31-2012 09:30 PM

Code:

   
 iskrit = ( kritProbRnd < kritProb )
      if iskrit then
        if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = true
          else
            iskrit = false
            is_weakness_lore = true
          end
        end
      end

Logic was just all topsy turvy. They intend to check IF IT IS STILL A CRIT, but instead of letting it be a crit, they instead cancel it. I believe the above should fix it unless I'm misremembering lua 'else' syntax.

camelotcrusade 10-31-2012 09:39 PM

Nice, Zechnophobe. I'll link to it once it's confirmed and Bhruic adds it to the summary. Too bad getting crit isn't easy to test. You almost need to keep a save near a hero who casts doom.

Bhruic 10-31-2012 09:57 PM

Quote:

Originally Posted by Zechnophobe (Post 475817)
Code:

   
 iskrit = ( kritProbRnd < kritProb )
      if iskrit then
        if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = true
          else
            iskrit = false
            is_weakness_lore = true
          end
        end
      end

Logic was just all topsy turvy. They intend to check IF IT IS STILL A CRIT, but instead of letting it be a crit, they instead cancel it. I believe the above should fix it unless I'm misremembering lua 'else' syntax.

Well, what they were trying to do is check if Sense Weakness would prevent it from being a crit. Which they did correctly. Unfortunately what they didn't do is consider the case where you didn't have Sense Weakness.

Your code does mostly fix it, but I already posted a different fix in the main post. Both do roughly the same thing but different ways. The main point is that it should be working correctly now.

Zechnophobe 10-31-2012 10:04 PM

Quote:

Originally Posted by Bhruic (Post 475828)
Well, what they were trying to do is check if Sense Weakness would prevent it from being a crit. Which they did correctly. Unfortunately what they didn't do is consider the case where you didn't have Sense Weakness.

Your code does mostly fix it, but I already posted a different fix in the main post. Both do roughly the same thing but different ways. The main point is that it should be working correctly now.

Heh, the 'correct' way to fix it is actually just make the operand be >= in that second check, which I realized after I just saw my silly solution again.

Bhruic 10-31-2012 10:09 PM

Quote:

Originally Posted by Zechnophobe (Post 475832)
Heh, the 'correct' way to fix it is actually just make the operand be >= in that second check, which I realized after I just saw my silly solution again.

That'd involve less steps, certainly. I think mine's slightly more elegant in that it requires less steps if you don't have Sense Weakness. Of course, I might be biased. ;)

Csimbi 10-31-2012 10:10 PM

In addition, none of these LUA functions appear to work:
Game.MessageBox(...)
Game.InvokeMsgBox(...)
Game.Log(...)
Game.atom_getpar(...)
Plz fix.
Thank you!

Bhruic 10-31-2012 10:15 PM

Those are certainly all source code fixes, and as we don't have access, you'll have to wait for 1C to fix those (should they choose to). Better to report those in the Bugs thread.

camelotcrusade 11-01-2012 12:02 AM

Quote:

Originally Posted by Bhruic (Post 475169)
Critical Hits/Sense Weakness fix - If your hero didn't have the Sense Weakness skill, all critical hits on your units would trigger Sense Weakness (sounds backwards, I know)
In arena.lua, line 553:
Code:

if receiver_human and not receiver_glot then

if receiver_human and not receiver_glot and (skill_power("weakness_lore", 2) > 0) then


Hi - turns out I got a save right smack in front of the guy who casts Doom, so I just tested and the bug is still happening. Then I realized the zip file has addon_arena.lua, not arena.lua, so I didn't have the fix installed. So I went into the arena.lua file to mod it myself, but I don't quite understand how to do it. At 553 (and the next few after) it says:

Code:

      if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = false
            is_weakness_lore = true

Where do I make the changes? Am I adding that line you show right after it?

Zechnophobe 11-01-2012 12:02 AM

Quote:

Originally Posted by Bhruic (Post 475834)
That'd involve less steps, certainly. I think mine's slightly more elegant in that it requires less steps if you don't have Sense Weakness. Of course, I might be biased. ;)

Hmm, just for the sake of discussion...

I wasn't optimizing for speed, since that is no doubt a non-issue with something like this. More just for how clarity and ease of debugging. Calling in additional functions to do your logic like that makes the code slightly weightier. And then, any edit to an external source should generally be simple so as a diff is easy to understand. Seeing:

Code:

Blah blah < bleh bleh
Turn into

Code:

Blah blah >= bleh bleh
Is pretty clear what the problem was, and the solution for it.

Er, not that any of this really matters... I've just been doing code reviews at work recently and it has me thinking about Ivory Tower code production stuff.

Zechnophobe 11-01-2012 12:04 AM

Quote:

Originally Posted by camelotcrusade (Post 475861)
Hi - turns out I got a save right smack in front of the guy who casts Doom, so I just tested and the bug is still happening. Then I realized the zip file has addon_arena.lua, not arena.lua, so I didn't have the fix installed. So I went into the arena.lua file to mod it myself, but I don't quite understand how to do it. At 553 (and the next few after) it says:

Code:

      if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = false
            is_weakness_lore = true

Where do I make the changes? Am I adding that line you show right after it?

He is saying change:

Code:

if receiver_human and not receiver_glot then
to

Code:

if receiver_human and not receiver_glot and (skill_power("weakness_lore", 2) > 0) then

camelotcrusade 11-01-2012 12:12 AM

1 Attachment(s)
Lol, thanks. :) I'll try not to hurt myself making the change.

Edit: Aaand... it works! Wolves took the crit.

If anybody needs a crit tester save, you can use this one. Just talk to the berserker guy to fight him - he knows doom. What I have been doing is running the maiden out to grab the chest and then casting summon nature's ally in the hex in front of her. When it's the hero's turn he'll cast doom on the wolves and then his black knight will run up and smack them for a crit (or the sense weakness bug, if you don't put in the fix).

And you probably know this but the save goes in your my documents\my games\KBWoTN saves folder.

RCDOWN 11-01-2012 01:36 AM

Quote:

Originally Posted by Bhruic (Post 475219)
Well, rather than do that approach, I fixed the spell (mostly).

Tnx man, you saved the day! :)

Any hope to fix the famous battle crash using viking buffer troop?

QNk 11-01-2012 03:27 AM

Code:

      if receiver_human and not receiver_glot and (skill_power("weakness_lore", 2) > 0) then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = true
          else
            is_weakness_lore = true

Doesn't the iskrit check also need to be changed to true? What it's doing right now is if a crit is registered, it checks again against a kritProb modified by sense weakness. If iskrit = false, then the game would only register a crit if the random number was LOWER than the initial but HIGHER than the modified kritProb. Or did I misunderstand how the kritProbRnd < kritProb inequality work?

Bhruic 11-01-2012 09:12 AM

Quote:

Originally Posted by Zechnophobe (Post 475862)
Er, not that any of this really matters... I've just been doing code reviews at work recently and it has me thinking about Ivory Tower code production stuff.

lol, I know. I was being semi-facetious. Had I thought of doing it your way first, I would have stuck with that as being the simpler approach. Still, as both ways work equally well, I'm going to stick with the approach I took and call it "better"! ;) (even if it's not)

Bhruic 11-01-2012 09:14 AM

Quote:

Originally Posted by RCDOWN (Post 475894)
Tnx man, you saved the day! :)

Any hope to fix the famous battle crash using viking buffer troop?

That's the first I've heard of it. Do you have a save where I could witness it happening? Although there's a decent chance the crash is caused by the actual compiled code rather than a script, it's still worth a look.

Bhruic 11-01-2012 10:25 AM

Quote:

Originally Posted by QNk (Post 475913)
Doesn't the iskrit check also need to be changed to true? What it's doing right now is if a crit is registered, it checks again against a kritProb modified by sense weakness. If iskrit = false, then the game would only register a crit if the random number was LOWER than the initial but HIGHER than the modified kritProb. Or did I misunderstand how the kritProbRnd < kritProb inequality work?

iskrit is already set to true to begin with, that's the only way to enter that code block (with the "if iskrit then"). So there's no need to do anything to it unless Sense Weakness kicks in, in which case it needs to be set to false.

Bhruic 11-01-2012 12:41 PM

Ok, I changed the Sense Weakness fix to Zechnophobe's solution, as it's simpler (I give up! ;))

Added a second fix for Sense Weakness (effect was being applied twice).

Added a fix for spells/rage not getting critical hits.

Bunnle 11-01-2012 01:24 PM

edit: wrong topic, my bad.

Bhruic 11-01-2012 01:26 PM

Please refer bug reports to this thread. The purpose of this one is to highlight fixes that are available via scripting.

rekiem 11-01-2012 01:49 PM

1 Attachment(s)
Shield of Rekross seems to be bugged, when he should give you ice dragons, the description is all bugged and if you try to get it the game crashes. Any chances that it's just a lua error?

Bhruic 11-01-2012 02:01 PM

That's probably a text error, but again, please report the bugs in the thread I linked previously. We want to have all the bug reports in one central location.

rekiem 11-01-2012 02:15 PM

Quote:

Originally Posted by Bhruic (Post 476106)
That's probably a text error, but again, please report the bugs in the thread I linked previously. We want to have all the bug reports in one central location.

It's definetly crashing the game when used at the state on the screenshot, but it works for other dragons, i've already got 2 greens, 1 red and 1 black from the shield

Bhruic 11-01-2012 02:19 PM

Well, if you PM me a copy of the save right before you try and summon it, I can check and see if it's something fixable.

mahey 11-01-2012 02:37 PM

Rage Shield is also bugged.

addon_arena.lua line 1265:
if (rage_shield_i < Game.Random(1, 100)) then
has to be if (rage_shield_i >= Game.Random(1, 100)) then

rekiem 11-01-2012 02:38 PM

1 Attachment(s)
Quote:

Originally Posted by Bhruic (Post 476122)
Well, if you PM me a copy of the save right before you try and summon it, I can check and see if it's something fixable.

There you go. I fail completely at lua scripting it seems, couldn't even find what file I should be checking for errors lol.

Bhruic 11-01-2012 02:51 PM

Quote:

Originally Posted by mahey (Post 476131)
Rage Shield is also bugged.

Good find, added to the front page.

Bhruic 11-01-2012 02:56 PM

Quote:

Originally Posted by rekiem (Post 476132)
There you go. I fail completely at lua scripting it seems, couldn't even find what file I should be checking for errors lol.

Hmm, I opened up your game, but the dragon the shield is offering me is a red one (which works fine). Anything I should need to do to get an ice dragon?

rekiem 11-01-2012 03:04 PM

The dragon is randomly generated like 30 seconds after you level up, as long as there's no dragon inside (you got the dragon from the shield on the previous level), i guess it differs by something else too, since it was ice dragon for me :(

EDIT: Ok the save i gave you the shield is about to change his dragon. If you open the hero screen right before the "You feel a sharp blow...." message, it'll still be the bugged shield. (you have about 2 seconds after you load lol >< sorry), I can provide an earlier save if you want.

Bhruic 11-01-2012 03:30 PM

I managed to get to it as an ice dragon, but that's almost certainly a fix that 1C will have to do. The "use" option details in the items.txt file is just a string of hex numbers which, without knowing what they correspond to, are virtually impossible to decipher.

rekiem 11-01-2012 03:36 PM

O well, that's a pity, no early Ice Dragon for me then hah, thanks alot for trying, and for all the other bugfixes :)

Bhruic 11-01-2012 05:14 PM

Haha, I just spent a fruitless 30 minutes (and why I'm laughing about that I don't know! ;)). I went back to playing, and noticed that enemies were getting hit with something called "Fatal luck", which put some random curse on them. I thought, "uh oh, I must have messed something up in the code somewhere". So I went back and kept tinkering with things to figure out what I'd done wrong.

Well, long story short, it turns out I had the "Chain of Chance" on, which - apparently - hits an enemy with a curse any time they hit you with a critical hit. The description is horribly wrong, saying just that it "curses enemies, inflicting critical strikes". What it really does is curse enemies when you get hit with a critical strike. Of course I hadn't seen it yet, as the enemy never critical struck anyone thanks to the bug.

camelotcrusade 11-01-2012 06:20 PM

Good work as always. Been updating the bug thread with the fixes. A few quick questions.

1. Can you add the alchemist/engineer fix to the main page? The description really does say they should mix 1-2 bottles and doesn't mention the toolkit, so I think it's a legit fix and not just a mod.
2. Love that you fixed spell/rage crit. What skill or ability gives you rage crit that's not working? I want to list the fix near the bug (and I don't even know if I have that bugged yet).
3. I'll add the new bug you just mentioned. Is Chain of Chance an item?
4. Got any time to wade into the necromancer/shackles issue? It's a puzzler.

Bhruic 11-01-2012 06:30 PM

1) I'm still on the fence on that one. Yes, the tooltip says 1-2, but the tooltips are frequently wrong in the game, as you well know ;). Plus, there's no indication of what the chance of a second one should be, if in fact you are supposed to get 1-2. Should it be a 50-50 split?

2) Icy Rage is the skill that increases your critical hit chance for Rage, but it should be pointed out that you always should have a chance to crit with Spells/Rage attacks. The probability seems quite low (unless they have Doom cast on them, which guaruntees a crit with anything). If I'm reading this right, the base probability is:
3 x (current mana-or-rage / maximum mana-or-rage).

3) It's not really a bug, it's just a side-effect of fixing the critical hit bug. It required one of my units to take a critical hit to activate, which never happened (because of the bug). Now that it's fixed, it does happen, which took me by surprise.

4) I've read about it, but I haven't got that spell yet, so I haven't tried using in on various undead. Maybe I'll cheat and give it to myself to see what's up.

camelotcrusade 11-01-2012 06:44 PM

Thanks very much sir. Once they release the first patch we can go about noting what's fixed and separating the mods from the bugs if some of their intentions get clarified. I am fond of the alchemist fix and the song of alfheim fix, but like you said you never know what they are doing to do (if they even change them). Or if you have time we know this is coming so you could make an optional fixes/mods section.

I added Chain of Chance to description bugs since it lies. :)

Zechnophobe 11-01-2012 06:49 PM

Quote:

Originally Posted by Bhruic (Post 476240)
1) I'm still on the fence on that one. Yes, the tooltip says 1-2, but the tooltips are frequently wrong in the game, as you well know ;). Plus, there's no indication of what the chance of a second one should be, if in fact you are supposed to get 1-2. Should it be a 50-50 split?

In KBAP it was ~33% chance of two, by my eyeballing of it. (I used Alchemists with 4 movement for a run. They were like little no-retaliation poison dealing land dragons!)

Quote:


2) Icy Rage is the skill that increases your critical hit chance for Rage, but it should be pointed out that you always should have a chance to crit with Spells/Rage attacks. The probability seems quite low (unless they have Doom cast on them, which guaruntees a crit with anything). If I'm reading this right, the base probability is:
3 x (current mana-or-rage / maximum mana-or-rage).
Now that is interesting. That sounds like it's about one tenth the intended strength, even when working correctly. Having a 3% crit chance when at max rage or mana is very minor. But I really dig the intention at least. Makes mana regen to keep yourself topped off feel a bit more important.

Quote:


3) It's not really a bug, it's just a side-effect of fixing the critical hit bug. It required one of my units to take a critical hit to activate, which never happened (because of the bug). Now that it's fixed, it does happen, which took me by surprise.
Hmm, I'll have to fix the description on this one when I get to items. This was a CW item that had the same effect, and was similarly difficult to understand then!

Quote:

4) I've read about it, but I haven't got that spell yet, so I haven't tried using in on various undead. Maybe I'll cheat and give it to myself to see what's up.
If I remember, I'll at least try to reproduce the bug when I get home from work.

Bhruic 11-01-2012 06:59 PM

Well, I made a test game to check out the Magic Shackles bug, it seems like I can affect all other undead except the Necromancers, so it can't be the mind immunity. Definitely isn't a leadership problem either, as I found a stack with a single one.

Weirdly, there doesn't seem to be a txt file for units, so I can't check to see if it's going something extra set that would be blocking the spell.

camelotcrusade 11-01-2012 07:07 PM

Quote:

Originally Posted by Bhruic (Post 476251)
Well, I made a test game to check out the Magic Shackles bug, it seems like I can affect all other undead except the Necromancers, so it can't be the mind immunity. Definitely isn't a leadership problem either, as I found a stack with a single one.

Weirdly, there doesn't seem to be a txt file for units, so I can't check to see if it's going something extra set that would be blocking the spell.

Thanks. I'm going to bug it. In KBAP necromancers were a frequent target for my magic shackles. I see no reason why they aren't now, as well, especially given all the undead you slog through.

Bhruic 11-01-2012 07:12 PM

Yeah, it certainly is one.

You know, I think the Chain of Chance thing isn't so much a bad tooltip as it's a bad comma.

"curses enemies, inflicting critical strikes" makes a lot more sense as "curses enemies inflicting critical strikes".

camelotcrusade 11-01-2012 07:23 PM

Ooh, Zechnophobe just suggested Necros might have gotten Presence of Mind in the update. Can you check your save to see if they have it? If they do, that is what is killing our shackles. It's blocking archmages from being shackled, too.

Poor witch hunters. Can't shackle either of those. :(

Bhruic 11-01-2012 07:28 PM

Yeah, I read that, but he said they were "undocumented". Which might be true - the Necromancer definitely doesn't have that ability listed. But I can't find where the documentation for units is, so I can't check to see if that's the case.

They really hid units well. Or I'm blind. Maybe I need to wait 2 turns to see if it wears off? (yay KB jokes! ;))

rekiem 11-01-2012 08:12 PM

You might have to dig for it!

I tought the only 'documentation' they had was on the russian forums.

Bhruic 11-01-2012 08:14 PM

Well, by "documentation", I mean the various .txt files they have for things like spells, items, etc.

nublets 11-02-2012 12:31 AM

Thank you for these fixes!

I had put my game on hold until the sense weakness bug was fixed and its great to see the community able to do that and much more.

camelotcrusade 11-02-2012 01:24 AM

Quote:

Originally Posted by Bhruic (Post 476240)
1) If I'm reading this right, the base probability is:
3 x (current mana-or-rage / maximum mana-or-rage).

Any idea how crit bonus skills are applied now that crits are working? I think it was +3/5/7% (maybe, I'd have to check again) and I wonder if they multiplicative or additive. If they aren't additive then you really don't get much out of them... especially if you don't start with enough mana to begin with.

Bhruic 11-02-2012 01:30 AM

They are additive.

I should also point out that unlike regular crits, the crit increase isn't a static 1.5, but is 1.3 + 0.4 x (previous formula from above).

camelotcrusade 11-02-2012 01:32 AM

Quote:

Originally Posted by Bhruic (Post 476397)
They are additive.

I should also point out that unlike regular crits, the crit increase isn't a static 1.5, but is 1.3 + 0.4 x (previous formula from above).

Ohhh. So thats not your chance to crit, that's your critical damage? I think I'm confused. What's your chance to crit, then? :confused:

Csimbi 11-02-2012 04:43 AM

@Bhruic
There's no version number on the zip file in the first post.
Is that the latest (as of today)?
Maybe you could add the date to the filename in the future.
Thanks!

Just reported this bug (you might want to consider adding this, too):
"Guardian" award - While the hint appearing above this award says that this award gives resistance to all types of damage, it actually does not give any resistance to 'glacial' and 'astral' damage.
It was fixed in my extended awards mod. Those that want the fix without the modifications can apply the same fix by looking at the included medals.txt.

xtrm 11-02-2012 08:22 AM

Thanks, the fixes work nice and no more crashes in battles :)

Bhruic 11-02-2012 10:04 AM

Quote:

Originally Posted by camelotcrusade (Post 476398)
Ohhh. So thats not your chance to crit, that's your critical damage? I think I'm confused. What's your chance to crit, then? :confused:

It's used for both things, your chance to crit as well as how much extra damage you crit for.

ikbenrichard 11-02-2012 11:30 AM

Hi Bhruic,

can you remove the fix: LAST HERO, from your subpatch? Since its fixed with the steam patch.

Bhruic 11-02-2012 12:10 PM

There are lots of bugs officially fixed in the latest patch, I'm going to need to go through each fix individually to see if it still applies. That'll take a bit of time.

ikbenrichard 11-02-2012 02:08 PM

Quote:

Originally Posted by Bhruic (Post 476540)
There are lots of bugs officially fixed in the latest patch, I'm going to need to go through each fix individually to see if it still applies. That'll take a bit of time.

I understand, I (we) greatly appreciate your efforts !!

camelotcrusade 11-02-2012 03:20 PM

Let me know if you need help.

Question: What do we need to do if we all the fixes to date installed? Clear the addon folder and start fresh? Otherwise, won't it read our files before the patched files?

I know I am going to want to put some of our stuff back in, too, especially where I like some of our fixes better. :)

Netami 11-02-2012 03:23 PM

I'll probably regret asking this as it's gonna sound very noobish ... but where exactly are the .lua files o_O In my sessions/addon folder there are only like 2 files + another folder called locations .

Bhruic 11-02-2012 03:29 PM

Quote:

Originally Posted by camelotcrusade (Post 476608)
Let me know if you need help.

Question: What do we need to do if we all the fixes to date installed? Clear the addon folder and start fresh? Otherwise, won't it read our files before the patched files?

I know I am going to want to put some of our stuff back in, too, especially where I like some of our fixes better. :)

Well, the main slow down is that Steam is blocked here at work, so I can't check out the patch until I get home.

I'd recommend completely deleting all of the .lua files right now, so it's not reading them instead of the new ones. Once I get a chance to check out the new patch, I can see which things are still broken and re-implement them with the new files.


All times are GMT. The time now is 02:40 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.