View Single Post
  #6  
Old 11-20-2012, 05:20 PM
jukeey jukeey is offline
Approved Member
 
Join Date: Aug 2011
Posts: 16
Default

Thank you very much for detailed advices.

Info_chesspiece.ui opening only on main window as infobox, when right click on unit in hero army.
All other cases the dlg_chesspiece.ui opening when click on unit, as dialog form.

Ui files easy editable, i wrote a program which can read this files, and show me visually with names and coordinates, no problem (i adjusted some ui files and png interface-textures for better appearance).

But resistances:
I think, the first "gen_unit_res" function maybe a trash, only the second works.
Your advices was my first idea, Tried and failed. Maybe i did something wrong; but i think, its simply dont work.

My second idea: creating 6 global variables, and including to loop in "gen_unit_res" this:
if i==0 then fiz=res end
if i==1 then mer=res end
if i==2 then mag=res end
if i==3 then tuz=res end
if i==4 then fag=res end
if i==5 then ast=res end

function gen_unit_res(data)
local text=""
local res_count=AU.rescount()
for i=0,res_count-1 do
local res = AU.resistance( data, i )
if res>95 then res = 95 end
local t=""
if res> 0 then t="<label=cpi_defense_res_D>" end
if res< 0 then t="<label=cpi_defense_res_U>" end
if i==0 then fiz=res end
if i==1 then mer=res end
if i==2 then mag=res end
if i==3 then tuz=res end
if i==4 then fag=res end
if i==5 then ast=res end

text=text.."<br> -<label=cpi_defense_res_"..(i+1)..">: "..res.."% "..t
end

if Game.LocIsArena() then
if Attack.act_feature(data, "humanoid") then
local count = Attack.val_restore(data,"contrstrike")
if count~=nil and count~="" then
text = text.."<br><br>Îňâĺňíűő ŕňŕę îńňŕëîńü: "..count
end
end
end

return text
end

This is work, new variables got the correct resistance values, when function execute, but problems:
This function execute when hint appear (onmouseover event on gui_object_name "defense" on chesspiece dialog).
So not enough to open the dialog, must move the cursor over "defense" text.
I can adjust this invisible object over cursor, or fullscreen
Variables got the values, but new texts not refreshed actually, only when opening next time the dialog...
Events and other essential things seems absolutely unavailable. Its serious?

Other:
I understand what do you want, great idea. But im afraid, impossible with this way. Too limited, this few modifiable thing is chaotic. With a decent editor or api, we can make castles, buildings for races, write pathfinding algorithm for ai, etcetera. Better than homm. But with this pile of diffuse code, i say, waste of time. Great, beautiful, funny and tactical game with terrible mechanism. Maybe converting models and write a new program, easiest and time-saving modding.
Reply With Quote