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)

bacchus1974 11-07-2012 08:20 AM

to install this update i just do decompressed these files in my folder

\steam\SteamApps\common\King's Bounty - Warriors of the North\sessions\addon

please help me

Xargon 11-07-2012 08:38 AM

Quote:

Originally Posted by bacchus1974 (Post 478464)
to install this update i just do decompressed these files in my folder

\steam\SteamApps\common\King's Bounty - Warriors of the North\sessions\addon

You followed the instructions outlined in the first post, congratulations. Everything should be working

Quote:

Originally Posted by bacchus1974 (Post 478464)
please help me

That might be possible if you actually state what your problem is.

Bhruic 11-07-2012 05:00 PM

This is (hopefully) a fix for the Highterant egg-laying issue. As it's a rather large piece of code (I wrote a specific AI routine to handle it - go me! ;)), I'm placing the code here rather than in the first post. Also, I'm not including pre- and post-code changes, everything in red text was added by me. The aim of this routine is to try and find the square that is farthest away from any enemy (and within movement range) and lay the egg there - presumably with the best chance of survival.

In arena.lua, line 2718:
Code:

local maxc, maxtarget
if mover.name == "highterrant" then
        local maxdist = 0
        for i = 0, ecells.n do
                local c = ecells[i]
                if c == nil then  -- проверяем также клетку, где мы стоим - вдруг идти никуда и не нужно - и здесь хорошо
                        c = mover
                        c.distance = 0
                end
                if c.distance < mover.ap then
                        local near_enemy = false
                        for dir = 0, 5 do
                                local c2 = Attack.cell_adjacent(c, dir)
                                if Attack.act_enemy(c2) then
                                        near_enemy = true
                                        break
                                end
                        end
                        if not near_enemy then
                                local dist = 0
                                for k = 0, ecells.n do
                                        local c2 = ecells[k]
                                        if c2 == nil then  -- проверяем также клетку где стоим, т.к. с нее можем уйти
                                                c2 = mover
                                        end
                                        if Attack.cell_dist(c, c2) == 1 then
                                                local mindist = 1e8
                                                for j, act in ipairs(actors) do
                                                        if Attack.act_enemy(act) then
                                                                dist = Attack.cell_dist(c2, act)
                                                                if dist < mindist then
                                                                        mindist = dist
                                                                end
                                                        end
                                                end
                                                if mindist > maxdist then
                                                        maxdist = mindist
                                                        maxc = c
                                                        maxtarget = c2
                                                end
                                        end
                                end
                        end
                end
        end
else

        if offence and not mover.thrower and (mover.par('dismove') == 0) and (mover.ap > 1) then -- при наступательной тактике не-стрелки способные перемещаться бегут к вражеским лучникам
                -- здесь могут оказаться : demon, dryad, highterrant, thorn_warrior
                local mindist = 1e8
                local nneed_corpse = true
                if mover.name == "thorn" or mover.name == "thorn_warrior" then -- тернии призывают на гексы с трупами
                        nneed_corpse = false
                end
                for i = 0, ecells.n do
                        local c = ecells[i]
                        if c == nil then  -- проверяем также клетку, где мы стоим - вдруг идти никуда и не нужно - и здесь хорошо
                                c = mover
                                c.distance = 0
                        end
                        if c.distance < mover.ap then
                                local dist = 0
                                for j, act in ipairs(actors) do
                                        if Attack.act_enemy(act) then
                                                if act.thrower then
                                                        dist = dist + Attack.cell_dist(c, act)*0.5
                                                else
                                                        dist = dist + Attack.cell_dist(c, act)
                                                end
                                        end
                                end
                                if dist < mindist then
                                        for j = 0, ecells.n do
                                                local c2 = ecells[j]
                                                if c2 == nil then  -- проверяем также клетку где стоим, т.к. с нее можем уйти
                                                        c2 = mover
                                                end
                                                if Attack.cell_dist(c, c2) == 1 then
                                                        if nneed_corpse or Attack.cell_has_ally_corpse(c2) or Attack.cell_has_enemy_corpse(c2) then
                                                                mindist = dist
                                                                maxc = c
                                                                break
                                                        end
                                                end
                                        end
                                end
                        end
                end
                if maxc ~= nil then
                        local mindist2 = 1e8
                        for i = 0, ecells.n do
                                local c2 = ecells[i]
                                if c2 == nil then  -- проверяем также клетку где стоим, т.к. с нее можем уйти
                                        c2 = mover
                                end
                                if Attack.cell_dist(maxc, c2) == 1 then
                                        if nneed_corpse or Attack.cell_has_ally_corpse(c2) or Attack.cell_has_enemy_corpse(c2) then
                                                local dist2 = 0
                                                for j, act in ipairs(enemies) do -- как далеко до врагов
                                                        if act.thrower then
                                                                dist2 = dist2 + Attack.cell_dist(c2, act)*0.5
                                                        else
                                                                dist2 = dist2 + Attack.cell_dist(c2, act)
                                                        end
                                                end
                                                if dist2 < mindist2 then
                                                        mindist2 = dist2
                                                        maxtarget = c2
                                                end
                                        end
                                end
                        end
                end
        end
        if maxc == nil then
                -- здесь гарантированно окажутся : chosha, demonologist, druid, ingeneer, kingthorn, thorn
                local mindist2 = 1e8
                for i = 1, atk.cells.n do
                        local c2 = atk.cells[i]
                        local dist2 = 0
                        for j, act in ipairs(enemies) do -- как далеко до врагов
                                if act.thrower then
                                        dist2 = dist2 + Attack.cell_dist(c2, act)*0.5
                                else
                                        dist2 = dist2 + Attack.cell_dist(c2, act)
                                end
                        end
                        if dist2 < mindist2 then
                                mindist2 = dist2
                                maxtarget = c2
                        end
                end
        end
end


Bhruic 11-07-2012 07:19 PM

Added fixes for warning popups occurring under AI control (yours or the enemies).

camelotcrusade 11-07-2012 07:34 PM

Quote:

Originally Posted by Bhruic (Post 478642)
Added fixes for warning popups occurring under AI control (yours or the enemies).

That's neat. Would it for example fix the popup on the skald trying to use an ability with no target?

Bhruic 11-07-2012 07:35 PM

Yup, and same with the Royal Griffins summoning (or more precisely not being able to summon) the Heavenly Guard.

camelotcrusade 11-07-2012 07:39 PM

Okay, nice, I will update that part of the bug thread once I'm done editing my own file.

n00b question - sometimes that line is commented out. That means it's not actually doing the popup so I don't need to put in the code to block it, right?

Bhruic 11-07-2012 07:40 PM

If it's commented out, no, you don't have to bother with it (it's not being used anyway).

Bhruic 11-07-2012 07:59 PM

Added fix for the Blizzard spell.

camelotcrusade 11-07-2012 09:30 PM

Cool, I will add the bug - and the fix - to the thread. I am not sure if fireball and/or fire rain are supposed to inflict burning, but if they do they might be worth a look. I don't have them yet so I can't read the descriptions.


All times are GMT. The time now is 09:50 PM.

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