PDA

View Full Version : Onslaught adrenaline bug


jelly man
01-10-2019, 05:12 AM
I've been looking all over trying to find a fix for this bug. From what I've read Onslaught used to correctly divide up the adrenaline among whatever orcs you had, but now it usually gives nothing at all, and sometimes gives a small random amount.

Has anyone found a fix, or know where it might be located in the game files?

I'm trying a workaround for a single orc right now. In the .lua file under the subturn section for each orc I have:

local trophy = Attack.val_restore(unit,"trophy")
if trophy == nil then trophy = 0 end
if trophy == 0 then Attack.val_store(unit,"trophy",20) end
local trophy = Attack.val_restore(unit,"trophy")

Trophy seems to stand for adrenaline here, so it seems like it will give the 20 adrenaline from level 2 Onslaught on the first turn but then won't do anything for the rest of the battle. Unless perhaps adrenaline went down to 0, but most orcs will never go down to 0 if they started at 30 or 40.

jelly man
01-11-2019, 04:57 AM
OK, I think I found a real fix now. The only thing that needs to be changed is the orcs_common.lua file in sessions -> orcs -> orcs.kfs

You have to go to the part of the file that says:

local rep=25
while bonus_onstart>0 and table.getn(rageable_orcs)>0 do
rep=rep-1
if rep>0 then
for i=1,table.getn(rageable_orcs) do
local rnd = Game.Random(1,3)
if rnd>bonus_onstart then rnd=bonus_onstart end
local trophy = Attack.val_restore(i,"trophy")
if trophy==nil then trophy=0 end
local trophy_max = tonumber(orc_trophy_gen_max(i))
if trophy<trophy_max then
trophy = trophy + rnd
bonus_onstart = bonus_onstart - rnd
end
if trophy>trophy_max then
bonus_onstart=bonus_onstart+(trophy-trophy_max)
trophy=trophy_max
table.remove(rageable_orcs,i)
end
Attack.val_store(i,"trophy",trophy)
end
else
bonus_onstart=0
end

end


This is the code that is supposed to give the onslaught bonus but it doesn't work. I replaced it with this instead:

while bonus_onstart>0 and table.getn(rageable_orcs)>0 do
local n = Game.Random(1,table.getn(rageable_orcs))
local rnd_target = rageable_orcs[n]
local trophy = Attack.val_restore(rnd_target,"trophy")
if trophy==nil then trophy=0 end
local trophy_max = tonumber(orc_trophy_gen_max(rnd_target))
if (trophy+1) <= trophy_max then
trophy = trophy + 1
bonus_onstart = bonus_onstart - 1
Attack.val_store(rnd_target,"trophy",trophy)
else
if (trophy+1)>=trophy_max then
table.remove(rageable_orcs,n)
end
end
end


And it seems to work now. The new code accurately gives a random amount to each orc because it hands out each point one by one. With 20 points from onslaught it will pick somebody at random for the 1st point, then somebody at random for the 2nd, and so on, until all of them are used.

Also, I'm pretty sure this was the intended behavior, because the original code says:

if trophy>trophy_max then
bonus_onstart=bonus_onstart+(trophy-trophy_max)

In other words, if the code had worked, they didn't intend the adrenaline to be wasted. If it goes over the max, they meant to give it back to use on someone else.

dailybs
04-02-2019, 08:08 PM
Can you upload this file please ?

King's Hunty
11-19-2021, 03:58 PM
Here is the fix:
https://ufile.io/a1vkn0xp

place it in
Kings Bounty Crossworlds\sessions\orcs

dailybs
03-22-2022, 07:42 AM
Here is the fix:
https://ufile.io/a1vkn0xp

place it in
Kings Bounty Crossworlds\sessions\orcs

Thanks!