![]() |
|
King`s Bounty: Warriors of the North Next game in the award-winning King’s Bounty series |
![]() |
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
![]()
I am wondering if we can use this same file (unit_special_attacks.lua) to fix the Witch Hunter's "Magical Help" which right now always gives Dragon Slayer. It *might* be this section:
--------------- function special_magic_buff_attack() Attack.act_aseq(0, "buff") local dmgts = Attack.aseq_time(0, "x") local tab_spells = { {s = "dragon_slayer", prob = 0}, {s = "dark_knight", prob = 0}, {s = "light_knight", prob = 0}, {s = "divine_armor", prob = 0}, {s = "fire_breath", prob = 0}, {s = "haste", prob = 0}, {s = "stone_skin", prob = 0}, {s = "bless", prob = 0}, } ------------------ It actually goes on for a while, but if somebody who is better than I am at reading this code could look at it, maybe you can tell us what to tweak so "Magical Help" isn't always dragon slayer. Last edited by camelotcrusade; 10-30-2012 at 03:33 PM. |
#2
|
|||
|
|||
![]()
Regarding the witch hunter's issue:
I tried editing the file and replacing the prob = 0 with prob = 5. That made no difference in game. I then tried moving the {s = "bless", prob = 0}, line above the {s = "dragon_slayer", prob = 0}, line. After making that change, now my witch hunters always cast bless. It looks like the buff as it currently stands always casts the first buff in the list. |
#3
|
||||
|
||||
![]() Quote:
============= acnt = table.getn(tab_spells) for i = 1, acnt do local spell_name = tab_spells[i].s if Attack.act_is_spell(0, spell_name) then tab_spells[i].prob = 0 else tab_spells[i].prob = math.min(0, math.ceil(tab_spells[i].prob)) end end local spell = random_choice(tab_spells) if spell.s == "dragon_slayer" then spell_dragon_slayer_attack(2, dmgts, 0) elseif spell.s == "dark_knight" then spell_dark_knight_attack(2, dmgts, 0) elseif spell.s == "light_knight" then spell_light_knight_attack(2, dmgts, 0) elseif spell.s == "divine_armor" then spell_divine_armor_attack(2, dmgts, 0) elseif spell.s == "fire_breath" then spell_fire_breath_attack(2, dmgts, 0) elseif spell.s == "haste" then spell_haste_attack(2, dmgts, 0) elseif spell.s == "stone_skin" then spell_stone_skin_attack(2, dmgts, 0) elseif spell.s == "bless" then spell_bless_attack(2, dmgts, 0) end ========== Maybe the key is in there? |
#4
|
|||
|
|||
![]()
I think that somewhere along the line it overwrites the probabilities calculated with 0 so the script takes the first from the table which is dragon hunter, when I take hold of some witch hunters I'll try to find where exactly. My first guess is that it's the first if in:
for i = 1, acnt do local spell_name = tab_spells[i].s if Attack.act_is_spell(0, spell_name) then tab_spells[i].prob = 0 else tab_spells[i].prob = math.min(0, math.ceil(tab_spells[i].prob)) end if someone could comment the 3 lines starting with if and do some testing it'd be great. Cause I'd like to finish the game at least once before digging in code ![]() |
#5
|
|||
|
|||
![]()
Thank you sir for this workaround ! I finally managed to finish the second island without a single crash ! Thanks !
![]() |
#6
|
|||
|
|||
![]()
Rudi:
I tried that, but it made the game crashed (probably something I messed up while editing), so I tried something else that I think would accomplish the same thing: for i = 1, acnt do local spell_name = tab_spells[i].s if Attack.act_is_spell(0, spell_name) then tab_spells[i].prob = math.min(0, math.ceil(tab_spells[i].prob)) else tab_spells[i].prob = math.min(0, math.ceil(tab_spells[i].prob)) end end Unfortunately, it still selected the first spell in the list (bless in my case, since I shuffled bless on top of the spell group). I found an enemy group with two stacks of witch hunters, which should make for some good testing. Interestingly, when I changed that section to this: acnt = table.getn(tab_spells) for i = 1, acnt do local spell_name = tab_spells[i].s if Attack.act_is_spell(0, spell_name) then tab_spells[i].prob = math.min(2, math.ceil(tab_spells[i].prob)) else tab_spells[i].prob = math.min(2, math.ceil(tab_spells[i].prob)) end end The enemy witch hunters still always cast bless, but my witch hunter stack always casts Hell/Fire Breath (the sixth spell in the list). |
#7
|
||||
|
||||
![]()
Seems like you guys are close to figuring it out. I would love that and then I might acutally use Witch Hunters (buggy abilities turn me off).
Sorry I'm useless at programming. When I get in the game next I'm going to see if simply replacing "Last_Hero" with "Dragon_Slayer" in the Skald song area will give me that spell instead (and hopefully, no crash). That's probably the extent of my programming abilities, lol. |
#8
|
|||
|
|||
![]()
I seriously wonder why they even bothered to bring back Last hero at all, when AP eliminated this spell. It is the epytome of uselessness. So much, that for The Legend, I used this spell to mod myself an "Animated Dead" spell in it's place that I could use to resurrect my undead troops.
![]() |
#9
|
|||
|
|||
![]()
Try changing the probability to 1 which is 100% in maths. (There is no probability of 5)
|
#10
|
|||
|
|||
![]() Quote:
|
![]() |
Thread Tools | |
Display Modes | |
|
|