|
#1
|
|||
|
|||
Need help modding battle rewards
I'm trying to mod my game so that instead of needing to dig for treasure you are instead automatically rewarded with whatever would have been dug up. I'm really noob at programming so I'm having some problems since lots of stuff can't be straight copied from the dig function to battle rewards function. The Original dug-chest spawning function looks like this:
Code:
function custom_genbox( racemask ) -- äëÿ ñóíäóêîâ äðàêîí÷èêà local K = Boxgen.rnd(100) K = K - 5 if K < 0 then local r = Boxgen.rnd(3) if r == 0 then Boxgen.parcount( "rune_might", "1" ) elseif r == 1 then Boxgen.parcount( "rune_magic", "1" ) else Boxgen.parcount( "rune_mind", "1" ) end return true end K = K - 5 if K < 0 then local r = Boxgen.rnd(100) if r < 50 then Boxgen.parcount( "crystals", "1" ) elseif r < 80 then Boxgen.parcount( "crystals", "2" ) elseif r < 95 then Boxgen.parcount( "crystals", "3" ) else Boxgen.parcount( "crystals", "5" ) end return true end K = K - 15 if K < 0 then -- ïðîñòîé ñâèòîê local r = Boxgen.rnd(100) local count = 3 if r < 80 then count = 1 elseif r < 95 then count = 2 end if not Boxgen.scroll( Game.MapLocDifficulty(), count ) then -- cant add scroll, add money Boxgen.parcount( "money", "*7" ) -- ãåíåðèì äåíåã Mini,Small,Average end return true end K = K - 3 if K < 0 then -- ìàãèÿ ñòðàíñòâèé if not Boxgen.scroll( ) then -- cant add scroll, add money Boxgen.parcount( "money", "*7" ) -- ãåíåðèì äåíåã Mini,Small,Average end return true end -- Boxgen.parcount( "money", "*7" ) -- ãåíåðèì äåíåã Mini,Small,Average local r = Boxgen.rnd(100) if r < 40 then Boxgen.parcount( "money", "*1" ) -- ãåíåðèì äåíåã Mini elseif r < 75 then Boxgen.parcount( "money", "*2" ) -- ãåíåðèì äåíåã Small else Boxgen.parcount( "money", "*4" ) -- ãåíåðèì äåíåã Average end return true end Code:
for i=1, 4 do local K = Game.Random(1,100) if K < 5 then local r = Game.Random(1,3) if r == 0 then Bonus.add("rune_might",1) elseif r == 1 then Bonus.add("rune_magic",1) else Bonus.add("rune_mind",1) end elseif K < 10 then local r = Game.Random(1,100) if r < 50 then Bonus.add( "crystals", "1" ) elseif r < 80 then Bonus.add( "crystals", "2" ) elseif r < 95 then Bonus.add( "crystals", "3" ) else Bonus.add( "crystals", "5" ) end elseif K < 25 then local r = Game.Random(1,100) local count = 3 if r < 80 then count = 1 elseif r < 95 then count = 2 end --if not Boxgen.scroll( Game.MapLocDifficulty(), count ) then -- cant add scroll, add money Bonus.add( "money", common_update_money( gold )*7 ) -- ãåíåðèì äåíåã Mini,Small,Average --end elseif K < 28 then -- ìàãèÿ ñòðàíñòâèé --if not Boxgen.scroll( ) then -- cant add scroll, add money Bonus.add( "money", common_update_money( gold )*7 ) -- ãåíåðèì äåíåã Mini,Small,Average else local r = Game.Random(1,100) if r < 40 then Bonus.add( "money", common_update_money( gold )*1 ) -- ãåíåðèì äåíåã Mini elseif r < 75 then Bonus.add( "money", common_update_money( gold )*2 ) -- ãåíåðèì äåíåã Small else Bonus.add( "money", common_update_money( gold )*4 ) -- ãåíåðèì äåíåã Average end end end Also, I need to know how to get the number of chests that are in the area (dependent on the pet digging level + the item that gives dig spots), I have it forced to 4 rewards at the moment but the original pet function uses Code:
local limits = {tonum(Attack.get_custom_param("green")), tonum(Attack.get_custom_param("red"))} if hero_item_count("sp_pet_digger")>0 then limits[1] = limits[1] + 1 limits[2] = limits[2] + 1 end Anyone here who can help me with this? |
#2
|
|||
|
|||
I have a weakness for cream-filled cakes. There's just something so indulgent about biting into a dessert oozing with creamy goodness. Retro Heart Cake
|
#4
|
|||
|
|||
greg
I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... Random generator tools
|
#5
|
|||
|
|||
I’m going to read this. I’ll be sure to come back. thanks for sharing. and also This article gives the light in which we can observe the reality. this is very nice one and gives indepth information. thanks for this nice article... crazy monkey free play
|
#6
|
|||
|
|||
This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: Font finder
|
#7
|
|||
|
|||
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. visit website
|
#8
|
|||
|
|||
I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. fina metal fabrication brooklyn
|
#9
|
|||
|
|||
You made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us to read this... staten island restaurants
|
|
|