PDA

View Full Version : Make digging at the battlefield faster


lukasztkd
05-04-2012, 03:33 AM
I found out digging chests at the battlefield pretty annoying. Its always a few seconds wasted for animation, as well as losing your pet's turn.. So I found the solution, maybe some of you will consider it useful.

Copy to some folder and extract orcs.kfs by zip or rar. Find file "addon_pet.lua", open it (notepad). Find line "function pet_digger()". Now change this :

function pet_digger()

local target = Attack.get_target()

local what, ischest
if dig_cells[Attack.cell_id(target)] == DIGCELL_BOX then
what = "pet_chest"; ischest = true
else
local pawns = {"altar_bad_statue", "altar_bomb", "altar_hollow", "altar_volcano"}
what = pawns[Game.CurLocRand(1, table.getn(pawns))]
end

local startpos,startdir = Attack.get_spirit_cell()
------------------------ camera block --------------
local photo = Attack.photogenic(target)

if (Game.ArenaShape() ~= 5) or (Game.ArenaShape() ~= 2) then
if math.random(100) < 80 then
if photo == 1 then
Attack.cam_track(0, 37, 70, 0, target, "cam_pet_attack_digger_centre.track" )
end
if photo == 0 then
if Game.ArenaShape() ~= 1 then
if math.random(100) < 50 then
Attack.cam_track(0, 37, 70, 0, target, "cam_pet_attack_digger_centre.track" )
else
Attack.cam_track(0, 37, 70, 0, target, "cam_pet_attack_digger.track" )
end
end
end
end
end
------------------------ end of camera -------------

Attack.act_aseq( 0, "attack_digger" )
Attack.act_rotate( Attack.aseq_time(0,"rs1"), Attack.aseq_time(0,"re1"), 0, target )
Attack.act_move ( Attack.aseq_time(0,"ms1"), Attack.aseq_time(0,"me1"), 0, target )
local a=Attack.atom_spawn(target, Attack.aseq_time(0,"as1")-.1, what, 0)
if not ischest then init_pawn(Attack.get_caa(a)) end
-- Attack.act_rotate( Attack.aseq_time(0,"rs2"), Attack.aseq_time(0,"re2"), 0, Attack.angleto(0,target) )
Attack.act_move ( Attack.aseq_time(0,"ms2"), Attack.aseq_time(0,"me2"), 0, startpos )
Attack.act_rotate( Attack.aseq_time(0,"rs2"), Attack.aseq_time(0,"re2"), 0, startdir )

local tx,ty,tz = Attack.act_get_center(a) -- çŕďîěčíŕĺě íŕ÷ŕëüíîĺ ďîëîćĺíčĺ
Attack.act_move( Attack.aseq_time(0,"as1")-.1, Attack.aseq_time(0,"as1"), a, tx,ty,tz-2 )
Attack.act_move( Attack.aseq_time(0,"as1") , Attack.aseq_time(0,"ae1"), a, tx,ty,tz )

dig_cells[Attack.cell_id(target)] = -dig_cells[Attack.cell_id(target)]

Attack.log_label("use_pet_search_")
pet_after_hit()

return true

end

Into This :

function pet_digger()

local target = Attack.get_target()

local what, ischest
if dig_cells[Attack.cell_id(target)] == DIGCELL_BOX then
what = "pet_chest"; ischest = true
else
local pawns = {"altar_bad_statue", "altar_bomb", "altar_hollow", "altar_volcano"}
what = pawns[Game.CurLocRand(1, table.getn(pawns))]
end

local a=Attack.atom_spawn(target, Attack.aseq_time(0,"as1")-.1, what, 0)
if not ischest then init_pawn(Attack.get_caa(a)) end
dig_cells[Attack.cell_id(target)] = -dig_cells[Attack.cell_id(target)]

Attack.log_label("use_pet_search_")


return true

end



Save file. Paste it to "game folder/sessions/orcs/mods (if necessary, create it). If any problems will occur, simply delete the file from this folder.
I haven't found any problems with this soultion yet. Chests rapidly appear, and pet's turn is not wasted. Enjoy :D.

Fatt_Shade
05-04-2012, 10:35 AM
Nice idea, rarely i found some1 messing with rage skills
But could use a bit of polishing. I`ll try it later to see what to change for my game, but here`s couple thoughts :
1) make it spend rage as for digging 3 chests =15-20 rage on max lvl,
2) and use pet turn (spending 3 or more turns with dragon was tedious, but not spending even 1 turn for him digging all chest in arena is a bit much).
So how about removing evil chests ( i have never dig 1 of those and i finished this game 4 times with over 900 chests in every game), and treasure searcher using 1 turn to dig all chests and sending 5 rage for 1/10 for 2/15 for 3/20 for 4 chest ( I added 1 more chest in my red sands mod and pet dragon up to 65 lvl).His digging skill would look like this :
digger {
hinthead=pet_digger_name
class=scripted
script_calccells=calccells_digger
script_attack=pet_digger
attack_cursor=magicstick
place=2
level=2
default=level1
upgrade {
level1=level:0/green:1,rage:5,rest:1,exp:5,level:1
level2=level:1/green:2,rage:+5,exp:+5,level:2
level3=level:2/green:3,rage:+5,exp:+5,level:3
level4=level:3/green:4,rage:+5,exp:+5,level:4
rage1=rs:0,level:>0,rage:>5/rage:-2,rs:1,exp:+7
rage2=rs:1,LV:>10,rage:>10/rage:-2,rs:2,exp:+8
}
}
Thoughts ?