Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > King's Bounty > King's Bounty: Armored Princess > Mods

Mods Armored Princess mods

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2011, 01:05 AM
DarkScythe DarkScythe is offline
Registered Member
 
Join Date: Jan 2011
Posts: 13
Default Tweaking chests

Hello everyone,

I'm currently enjoying my first King's Bounty game (or any HoMM-type game, for that matter) with AP/Crossworlds, as I went for the $8.74 deal on Steam a couple weeks ago.

I have to say it's a lot better than I expected it to be, and I'm having quite a bit of fun. I started out as a mage on Normal difficulty, and quickly ran into the "everything is lethal/invincible" problem on Scarlet Wind, which was kind of fun having to really try to figure out how to beat those armies to advance. Ultimately though, after reading on these forums, it seems "easy" is better for a first-timer until I understand how the game itself works, so I've restarted on easy (I'll hopefully get back to my normal game at some point.)

In either case, I'm wondering if there is a way to mod the treasure chests in some way.
I don't want to modify all of them, but rather just the ones that appear in-battle when I use the dragon's treasure searcher ability. My problem is it seems there is far too much gold being pulled up. I have to wonder why gold is a valuable currency if it's that easy to dig up. If possible, I want to modify the chests so that it would drop straight gold less often (combined with all the gold-filled chests already on the world map, this makes me not want to waste time in-battle to go treasure hunting) but increase the chances of something like crystals (which sounds like a reasonably expensive item for pirates to hoarde.)

Unfortunately, I'm not entirely sure how to do this, or if it's even possible.

From some posts I've found here, it looks like boxes.lua inside ses.kfs contains the code that generates the items in the chests. (Specifically, this thread.)

If I'm reading the code correctly, it seems to roll for a random number up to 100, then subtract some value to find the condition when it becomes negative, then apply the condition that it's matched with.

For the purposes of testing a "proof of concept," I selected crystals for modification. I set all the numbers to 0 so that they would hopefully not trigger, then set crystals to the following:

Code:
 K = K - 101
  if K < 0 then
    local r = Boxgen.rnd(113)

    if r < 100 then
      Boxgen.parcount( "crystals", "10" )
    elseif r < 110 then
      Boxgen.parcount( "crystals", "20" )
    else
      Boxgen.parcount( "crystals", "30" )
    end

    return true
  end
I set it to subtract 101, thinking if the maximum value being rolled is 100, this would always force a negative, and thus always force this condition to activate. I also increased the crystals substantially so that I would know if the modification was being applied successfully or if the game simply ignored this file and gave me crystals based on the stock file instead.

Of course, this did not work. I don't even know if the game is executing this file or not. I've placed my modified boxes.lua file into ./sessions/orcs/mods since that's where I've placed the camera mod, and I'm playing the Orcs on the March campaign of Crossworlds/AP. I launched the game, went into a battle, and immediately told my dragon to dig up a chest. I then casted haste on a squad of griffins to fly over and open the chest. The chest yielded some gold, and then the game crashed to desktop.

I'm not sure what I'm doing wrong, but if possible I'd like some help with this. If, on the other hand, what I'm trying to accomplish is impossible, please let me know as well. Ultimately, if I can get a proof of concept working, I'll tweak the values much more thoroughly so as to try to not completely break the game.

I apologize for the long first post, and appreciate any responses and help.

Thanks.
Reply With Quote
  #2  
Old 01-15-2011, 04:03 AM
Sir Whiskers Sir Whiskers is offline
Approved Member
 
Join Date: Dec 2008
Posts: 149
Default

Quote:
Originally Posted by DarkScythe View Post
I don't want to modify all of them, but rather just the ones that appear in-battle when I use the dragon's treasure searcher ability. My problem is it seems there is far too much gold being pulled up.
Keep in mind that, by default, the easy setting triples the amount of gold you get. If too much gold is an issue, I would suggest modding the logic.txt file (in Session.kfs, IIRC).

You can simply mod the money setting from 3.0 to 1.0 or whatever number you want. Or you can dig into the individual settings for how much treasure is given based on the difficulty of the island you're on. You may have to play with the values a bit to see how they work, but it appears this file will give you considerable control over this element of the game.

I don't believe there is a separate setting for the search ability, but I could be wrong. You might find something with the Dragon skills, but I'm fairly sure those are not in a text file.

Last edited by Sir Whiskers; 01-15-2011 at 04:06 AM.
Reply With Quote
  #3  
Old 01-15-2011, 11:02 AM
bucazaurus's Avatar
bucazaurus bucazaurus is offline
Approved Member
 
Join Date: Sep 2009
Posts: 131
Default

Sir Whiskers is right. The loot from chests spawned in battles is controlled by
the addon_pet file. (Dragon skills) . I tested the game with a modded version of the file and from 6 chest not even one generated gold. Four of them spawned scrolls.One spawned crystals and one spawned rune. Unzip the file i used , from attachment , and try it . If you want to mod him even more go to Digger function ,inside the file , and play with the settings.
Attached Files
File Type: zip addon_pet.zip (6.3 KB, 138 views)
Reply With Quote
  #4  
Old 01-15-2011, 05:29 PM
DarkScythe DarkScythe is offline
Registered Member
 
Join Date: Jan 2011
Posts: 13
Default

Wow, thank you guys!

Sir Whiskers, I know easy mode does give more gold than normal, although I believe 3x is a bit much.. I may alter that setting (maybe 1.5-2x, or just leave it at 1x) regardless of anything else, since it seems excessive, unless I'm losing my entire army every battle. Still, I was mainly trying to change the contents of the chests themselves, because it's at a point where I don't even want to waste a few turns of battle and risk my troops suffering more damage and possibly lose someone trying to pull a chest that will pretty much always have some more useless gold (lol) in it.

Bucazaurus seems to have found it though; I didn't think that dragon chests were any different from chests generated anywhere else on the map, so I didn't think to check the pet files. Sure enough though, the same block of chest generation code is in there (minus the items, of course.) That said, I do recall at one point while I was trying to play with the boxes.lua file that I got some kind of sword from a chest my dragon dug up. I don't know how that was possible.

I notice that orcs.kfs also contains an addon_pet.lua file though, and it seems to have more lines of code in it, I assume for some new OotM stuff, so I'm porting your changes over to that file instead. I believe the changes should be the same regardless, but I would like to ask if you know how to decipher the numbers you are using. I have not yet tested it, but reading through the code, I see that you changed the values to K-15 instead.

If everything is set to K-15, wouldn't every item trigger at the same time with 15% chance? If it's picking a number, say 12, it would satisfy every single condition simultaneously.

Unless I'm misreading this code, and "K" gets modified while it simply goes down the list (for example, it rolls 36; 36-15=21 to fail first condition for runes; 21-15=6 fail second condition for crystals; 6-15<0 triggers third condition for scrolls.)

The last "scrolls" function (I assume this is for wanderer scrolls, since it doesn't have an additional sub-function to roll for quantity) you also changed the success condition to K < 96. What is the reasoning behind this change, and what does this do? This would mean that pretty much every number under 99 would return true for this function.

Finally, on the gold drop itself (I assume it goes to this last function if all other functions have failed to return true, which I'm thinking it won't because you set the wanderer function to act as a catch-all last resort?) then it will drop gold based on several multipliers, but I don't understand why the *7 is being overridden immediately by a roll for *1, *2 and *4. I'd assume a larger multiplier (in this case, *4) would be more gold, and by changing the numbers to R < 97 and 98, you drastically reduce the chances of *2 and *4 from occurring?

I'm sorry for all these questions, but I'm interested in figuring out the logic behind how this works so that I may fine tune the numbers more.

Nonetheless, thank you guys for all the help as it is. I appreciate any more clarification.
Reply With Quote
  #5  
Old 01-16-2011, 12:37 AM
bucazaurus's Avatar
bucazaurus bucazaurus is offline
Approved Member
 
Join Date: Sep 2009
Posts: 131
Default

To be honest with you , i had no idea what i did. I saw your post and decided to experiment . My logic behind the numbers was that the game rolls a number ranging from 0 to 100 to decide what the reward will be...

if r < 97 then (...so only if the number rolled is higher then 97 the gold will be generated with that amount .)
Boxgen.parcount( "money", "*1" ) -- ãåíåðèì äåíåã Mini

Another example.
K = K - 15 (any number below this will generate gold)
if K < 0 then
local r = Boxgen.rnd(100)

if r < 20 then (if the number rolled is between 15 and 20 you get 3 crystals)
Boxgen.parcount( "crystals", "3" )
elseif r < 50 then (if number is between 20 and 50 you get 5 crystals)
Boxgen.parcount( "crystals", "5" )
elseif r < 65 then (and so on )
Boxgen.parcount( "crystals", "10" )

Again , this is how i thought the system works. It might be wrong , but it seems is working.
Reply With Quote
  #6  
Old 01-16-2011, 04:18 PM
DarkScythe DarkScythe is offline
Registered Member
 
Join Date: Jan 2011
Posts: 13
Default

Thanks for the information, bucazaurus.

I think there may be a mistake with your assumption though, but then I'm also making assumptions. It would help if someone more experienced with this code could step in to clarify a few things.

Quote:
Originally Posted by bucazaurus View Post
To be honest with you , i had no idea what i did. I saw your post and decided to experiment . My logic behind the numbers was that the game rolls a number ranging from 0 to 100 to decide what the reward will be...

if r < 97 then (...so only if the number rolled is higher then 97 the gold will be generated with that amount .) This says if "r" is less than "97" so it should give gold if it rolls 0-96, I think.
Boxgen.parcount( "money", "*1" ) -- ãåíåðèì äåíåã Mini

Another example.
K = K - 15 (any number below this will generate gold) I believe this should also be the opposite; The next line states if K is less than zero (negative) then it rolls to determine what "r" should be.
if K < 0 then
local r = Boxgen.rnd(100)

if r < 20 then (if the number rolled is between 15 and 20 you get 3 crystals) I think this would be from 0-19, since it's looking for "r" to be less than 20.
Boxgen.parcount( "crystals", "3" )
elseif r < 50 then (if number is between 20 and 50 you get 5 crystals)
Boxgen.parcount( "crystals", "5" )
elseif r < 65 then (and so on )
Boxgen.parcount( "crystals", "10" )

Again , this is how i thought the system works. It might be wrong , but it seems is working.
That said, your tip about looking in the pet files was definitely key.
I spent yesterday testing and trying different values, but I think I've found a balance.

addon_pet.lua definitely alters the chests dug up by the dragon's "treasure searcher" ability, but does not affect chests that already appear on the battlefield when you begin sometimes.

These "pre-existing" chests are modified by boxes.lua that I was working with before it seems. I tested this by, again, setting the "items" chance to 100%, then found a battle with a chest in it. Without my modification, it yielded some gold. After I added the modified file, it instead gave me a "silver rapier" sword. I restarted the battle a few times and it always gave me that one sword.

I have not found the file that modifies the chests that are scattered about the world/adventure map, but I think this is OK because I'm not looking to change those. The chests on the world map are almost always guarded by armies, and those actually make sense to have a lot of gold, since they're being protected.

With that, I went ahead and modified all the "battlefield" chests to give what I feel is a better representation of what these chests should have, while trying not to affect the balance too much. Still, this is a deviation from vanilla, so there WILL be a change in game balance regardless.

From a previous post on these forums,
Quote:
You can get artifacts only from pre-existing chests on the battlefield. Those have the following chances:
- Gold (76%)
- Random scroll (15%)
- Crystals (5%)
- 1 random rune (3%)
- 1 wanderers' scroll (1%)
- random item (1%) - level of the item is based on the difficulty of the battlefield

Chests dug up by the dragon give:
- Gold (72%)
- Random scroll (15%)
- Crystals (5%)
- 1 random rune (5%)
- 1 wanderers' scroll (3%)
I've modified the chances to the following so far:

Quote:
Dragon's chests:
25% for 3 Runes
30% chance of crystals [15% for 3, 40% for 5, 30% for 10, 15% for 15]
15% random scroll [50% for 1, 30% for 2, 20% for 3]
20% wanderer scroll
10% gold [10% "mini" amount, 50% "small", 40% "average"]

Battlefield chests:
25% random item
20% for 5 runes
15% chance of crystals [20% for 5, 50% for 8, 30% for 10]
10% random scroll [same sub-percentages as dragon's]
20% wanderer scroll
10% gold [same sub-percentages as dragon's]
These percentages are based on my assumption of how the code is working, of course. From my bit of playtesting, it seems to be working out well, I'm getting gold still, but much less often than before, and I'm always now interested in digging to see what I find.

The chances are increased quite a bit in some cases, but my reasoning is as follows:
Lower chance of gold means you no longer assume every chest will be gold anyway and stop trying to dig for them (when you have 1mil gold, getting more gold is kind of annoying) but when it does come up with gold, it should be a decent amount. This also means the gold-filled chests scattered around the map are much more valuable.

The next logical thing to hoarde in a chest besides gold, are jewels; in this case, magic crystals and runes. I'm still working out the best numbers for them, but as it's a buried treasure chest, I felt it should be a little more than what you can find lying around on the map in the open. The battlefield chests have more runes (and I may give it more crystals and lower the dragon's chest's crystals instead) because those are random and you cannot dig for them or force them to appear, so there should be a bigger incentive to rush for them. After that, the wanderer scrolls are more valuable than regular spell scrolls, so I increased their chances slightly.

I may eventually copy the code in to randomize the runes you get from 2-4 or 5 maybe, but I'm still testing everything right now.

Sorry for the lengthy rant, but thanks again for helping me out; I appreciate it.

I've attached what I have so far. If anyone tries it out, please let me know what you think. I'm too new to the game to tell what unforeseen consequences this could have.

Thanks!
Attached Files
File Type: zip Modified Treasure Chests-Beta1.zip (8.4 KB, 413 views)
Reply With Quote
  #7  
Old 01-20-2011, 08:42 PM
MaroonMaurader MaroonMaurader is offline
Approved Member
 
Join Date: Jan 2010
Posts: 91
Default

Yeah, that code will work as you described. I think I posted a while ago asking if anyone knew how to get the game logic to check (from in the post-battle screen; in arena.lua iirc) what level your dragon treasure ability was at. My thought at the time was to modify the post-battle logic to act as if you had used the dig ability to dig up all available chests, while modifying the dragon ability script to pretend that there were no treasure chests available to dig up.
1. Give you 3 randomly selected pet-dragon chest rewards. Relatively easy modification of the script.
2. Give the pet dragon the appropriate experience. Would have been tricky - I'm not sure if the dragon can be given exp out of battle, so I might have had to give up on this idea or find an alternate workaround (e.g., give the experience at the start of the battle, or the start of round 1).
3. Increment the "rage used" counter for medals and statistics appropriately based on your skill level.

A minor cheat, but a big time-saver. Problem was I never got off ground zero, because I never could figure out (and nobody else filled me in) how to check dragon skill levels. If you happen to figure that out in digging around (aha...ha...ha...), let me know.
Reply With Quote
  #8  
Old 01-22-2011, 06:39 AM
DarkScythe DarkScythe is offline
Registered Member
 
Join Date: Jan 2011
Posts: 13
Default

That sounds incredibly complicated for what appears to be very little gain aside from some laziness in battle. That said, I'll try to poke around a bit and see if I can dig up anything related to that.
Reply With Quote
  #9  
Old 09-10-2011, 11:25 AM
shinjiikuri shinjiikuri is offline
Approved Member
 
Join Date: May 2010
Posts: 10
Default

Any chance of this mod being adapted for crossworlds?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:34 AM.


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