PDA

View Full Version : Random rune after a battle


The Rider
01-03-2009, 01:09 PM
Hi all,
I was trying to change the existing mod that gives mana or rage potion after a battle. My idea was to give with a small chance depending on the hero skill trophies a random rune. I tried two variants of that without success.
that was the old code:
if (Game.Random(1,100) <= tonumber(Logic.hero_lu_skill("alchemist"))*10) then
Logic.hero_add_item("mana_potion")
end
I first changed it to that, since the runes are considered items in the game:
if (Game.Random(1,100) <= tonumber(Logic.hero_lu_skill("charm"))*5) then
Logic.hero_add_item("rune_might")
end

than I tried that, following the logic from the level up of the hero:
if (Game.Random(1,100) <= tonumber(Logic.hero_lu_skill("charm"))*5) then
Logic.hero_add_item(1,"rune_might",might)
end
but nothing happens...
any ideas?

Keneth
01-03-2009, 01:34 PM
Hrm, try this one:
Logic.hero_lu_item("rune_might","count",1)

Also, that's insanely overpowered, it's 25-75 extra runes, :grin:

The Rider
01-03-2009, 02:19 PM
I will do further balance, for the moment I just want to make it work :) thanks I will try what you suggest

The Rider
01-03-2009, 03:19 PM
actually your code was making the ammount of might runes always 1. it required a little tweaking to add 1 rune and it looks like that:
local rune_might_count = Logic.hero_lu_item("rune_might","count")
Logic.hero_lu_item("rune_might","count",rune_might_count+1)
but thanks a lot for the help, now it works :) :D

The Rider
01-03-2009, 03:59 PM
so the final code looks like that and most important it works :)
it gives 3.33% chance for a random rune per trophy level skill plus another 3.33% per iron fist/rune stone/high magic (max 20% chance for a rune after a battle)
if (Game.Random(1,90) <= tonumber(Logic.hero_lu_skill("charm"))*3+Logic.hero_lu_skill("iron_fist"))*3+Logic.hero_lu_skill("rune_stone"))*3+Logic.hero_lu_skill("hi_magic"))*3) then
local random_rune = Game.Random(1,9)
if random_rune >= 7 then
local rune_might_count = Logic.hero_lu_item("rune_might","count")
Logic.hero_lu_item("rune_might","count",rune_might_count+1)
elseif random_rune >= 4 then
local rune_mind_count = Logic.hero_lu_item("rune_mind","count")
Logic.hero_lu_item("rune_mind","count",rune_mind_count+1)
elseif random_rune >= 1 then
local rune_magic_count = Logic.hero_lu_item("rune_magic","count")
Logic.hero_lu_item("rune_magic","count",rune_magic_count+1)
end
end

Keneth
01-03-2009, 04:51 PM
Yeah, I figured it either sets to 1 or adds 1 but I haven't had time to check, glad you've made it work.

But it's still overpowered. :P

The Rider
01-03-2009, 05:11 PM
that means 3 or max 4 skill levels (from the cheaper ones) in addition. On impossible in my last replay I won 512 battles, that means 70 runes more (because you cannot take the iron fist/rune stone/high magic skills at early stage), 1/3 from each kind, enough so you can buy all the unnecessary but interesting skills, you couldnt afford earlier

Eddited:
I cleared all the Kordar area with that mod (loaded a previous save game), in 61 battles I got 7might, 5mind and 5magic runes, I got 3 levels in that time, started with 1 level of trophies and 2 levels of rune stone (10% chance for a rune), around the 32th battle I upgraded trophies to the 3d level and rune stone to the 3d level (so my chances were 20% for a rune). With 7,5,5 runes I upgraded only 1 skill and added 1 mind rune for another (I got the other runes from level ups and what I found on the map). So it is not overpowered. In fact I think that the game provides very limited choise of the skills you can take. The runes you find are not even enough to fully upgrade one skill tree, I remember that at the end of my first campaign I didnt have enough runes for the 3d level of high magic).

Keneth
01-03-2009, 08:32 PM
Between everything you get over the course of the game and the runes you can buy for large sums of money (which are always available) you should have more than enough for any skill you want. At the end of the game I've always had a huge leftover ammount of at least 2 types of runes, having upgraded everything I wanted to have already. I don't see what the problem in your case was. :)

The Rider
01-03-2009, 09:07 PM
nevermind, we understand things differently :)
do you know how to put the pictures of the runes you get in the victory table? the one that shows after a battle with the unit losses and the gold?

kromberg
01-07-2009, 05:13 PM
Does this mod require you to restart your game?

Keneth
01-07-2009, 05:52 PM
Probably not but you won't benefit from it retroactively, you'll only get runes for the battles you haven't fought yet.

The Rider
01-07-2009, 08:17 PM
true, you will get runes only from future battles, and no restart is required:-P

sanjak
01-09-2009, 04:08 AM
um.... Could you please tell me how to open these file as text files?

Keneth
01-09-2009, 01:14 PM
Open With -> Choose Program... -> Notepad/Wordpad/Other

OR

Double click on the file -> Select the program from a list -> Notepad/Wordpad/Other

LUA is a text file, KFS is an archive file.