[H5 EDITOR] Troubleshooting topic
The problem is that I can't open the console. I changed the part in my input.cfg file (in the My Documents folder) into:
// general
bind jd_button_0 'ESC'
bind jd_button_0 'ENTER'
bind jd_button_0 'NUM_ENTER'
bind jd_button_0 'E'
bind esc_pressed 'ESC'
bind enter_pressed 'ENTER'
bind enter_pressed 'NUM_ENTER'
bind show_console '`'
But when I press ` nothing happens. (It's ALT+7 on my keyboard, but I tried all the other keyboard combinations as well.) What's wrong with it?
// general
bind jd_button_0 'ESC'
bind jd_button_0 'ENTER'
bind jd_button_0 'NUM_ENTER'
bind jd_button_0 'E'
bind esc_pressed 'ESC'
bind enter_pressed 'ENTER'
bind enter_pressed 'NUM_ENTER'
bind show_console '`'
But when I press ` nothing happens. (It's ALT+7 on my keyboard, but I tried all the other keyboard combinations as well.) What's wrong with it?
Need new eyes on this code.. i keep getting error ; expected
on this line
if IsPlayerHeroesInRegion(PLAYER_1,region[0], (;) expected here.. but that is wrong as it doesn't work either.[/code]
on this line
if IsPlayerHeroesInRegion(PLAYER_1,region[0], (;) expected here.. but that is wrong as it doesn't work either.
Code: Select all
name=GetPlayerHeroes(1);
check_assassins=0
check_ambush=0
region = { "ambush", "assassins2"} -- Indexes are assigned automatically
--function Ambush
function Ambush()
while 1 do
if IsPlayerHeroesInRegion(PLAYER_1,region[0], then
BlockGame();
StartCombat( name[0], nil, 2, 113, 13 , 113, 15, nil, nil);
check_assassins=0
--SetPlayerResource(PLAYER_1, 6, 200);
UnblockGame();
break;
else sleep(1)
end;
end;
end;
startThread(Ambush);
Code: Select all
if IsPlayerHeroesInRegion(PLAYER_1,region[0], then
if IsPlayerHeroesInRegion(PLAYER_1,region[0]) then
Avatar image credit: N Lüdimois
What is that command i never saw it in the editor... but it clearly need a boolean value like if isplayerheroesinregion(playerid,regionname) == true then
why don't you use a real command like IsObjectInRegion :
why don't you use a real command like IsObjectInRegion :
Code: Select all
name=GetPlayerHeroes(1);
check_assassins=0
check_ambush=0
region = { "ambush", "assassins2"} -- Indexes are assigned automatically
--function Ambush
function Ambush()
while 1 do
if IsObjectInRegion(name[0], region[0]) == true then
BlockGame();
StartCombat( name[0], nil, 2, 113, 13 , 113, 15, nil, nil);
check_assassins=0
--SetPlayerResource(PLAYER_1, 6, 200);
UnblockGame();
break;
else sleep(1)
end;
end;
end;
startThread(Ambush);
I am hoping someone can help me with some basics to get map scripting started. The message box discussion back on page 4 or so was very helpful, but I still have two questions.
1. When I try to set map objectives (or quest hut completion) to a value like accumulate creatures that requires parameters, I cannot set the parameters. In map properties, I get a single line for parameters that gives no value options, rather than the expandable list that is shown in the manual. What am I missing?
2. I am wanting a script that, for every combat, will count the the number of a particular creature in a particular hero's army before and after the fighting. I assume I would place that script as a combat script in the hero properties. In the manual I see two commands (one for scripts before creatures are placed on the battle field, one after creatures are placed but before fighting). Both scripts have nil as a parameter, and I cannot tell how to use them since I would expect a trigger to have a script it calls. And I cannot find anything to cause actions to occur after combat. Can anyone offer advice.
Finally, it is obvious to me that my stumbling block with scripting in HoMM V is nether with programming logic, nor with syntax; it's with where code is and where to put code (object oriented stuff somewhat alien to this old fortran programmer). Both the Lua website and the editor manuals are quite thorough with syntax, I'm fine with programming logic, and I think I've figured out the basic idea of triggers and handler functions, but does anyone know of a basic tutorial that can help with the other stuff involved in scripting?
1. When I try to set map objectives (or quest hut completion) to a value like accumulate creatures that requires parameters, I cannot set the parameters. In map properties, I get a single line for parameters that gives no value options, rather than the expandable list that is shown in the manual. What am I missing?
2. I am wanting a script that, for every combat, will count the the number of a particular creature in a particular hero's army before and after the fighting. I assume I would place that script as a combat script in the hero properties. In the manual I see two commands (one for scripts before creatures are placed on the battle field, one after creatures are placed but before fighting). Both scripts have nil as a parameter, and I cannot tell how to use them since I would expect a trigger to have a script it calls. And I cannot find anything to cause actions to occur after combat. Can anyone offer advice.
Finally, it is obvious to me that my stumbling block with scripting in HoMM V is nether with programming logic, nor with syntax; it's with where code is and where to put code (object oriented stuff somewhat alien to this old fortran programmer). Both the Lua website and the editor manuals are quite thorough with syntax, I'm fine with programming logic, and I think I've figured out the basic idea of triggers and handler functions, but does anyone know of a basic tutorial that can help with the other stuff involved in scripting?
about the first question : You have to manually add the parameters by right clicking on the parameter tab and pressing "add". I think the number of parameter for each objective is clearly explained in the editor theory guide so you shouldn't have any problem.
about the second one i didn't see any function to do your particular thing but i guess what you could do is :
-- I've never used the combat script yet so i dunno if it works like the map script but any way this is just my first idea how it could be done.
I dunno if it would work but here are some issues :
- Why would you want to do that, could you please tell me more info
- i don't think you'll be able to use the values in the map script after or if what i've wrote make sense because i think it would work for 1 combat but after that the values would be reset to 0 if the combat script starts again
- one solution would be to use the map script, if you know the creature id
that could be :
Only issues here are to know the heroname and the creatureID but i guess you already knows that
Maybe a little performance issue since the function never ends.
Oh, one thing is that it doesn't take in consideration if you give the creatures from your hero to another hero it will take it just like you've just lost them for whatever reason. Maybe with a loop that takes all the heroes and calculate the total amount of creatures of that type it would fix it but actually no since if you put the creatures in garrison or if you put the hero in garrison you'll get a bad result. (in the specific case of if you put the hero in garrison and you exit the town with the hero still in garrison the game wont find the hero and the script will crash and stop working) There again you could add a if with GetTownHero(townName); to solve a part of this problem.
hmmm anyway, lol i guess it is a very complex thing you ask there hehe so just give me more information
the best tutorial is to download every single map and look in their mapscript.lua file (or open the map with the editor and check the map script) and look and learn. Find their tricks and learn!
about the second one i didn't see any function to do your particular thing but i guess what you could do is :
-- I've never used the combat script yet so i dunno if it works like the map script but any way this is just my first idea how it could be done.
Code: Select all
variation = 0
initialnumber = GetCreatureNumber(unitName);
finalnumber = 0
function count()
if GetCreatureNumber(unitName) ~= initialnumber then -- if the number of creature changed
variation = initialnumber - GetCreatureNumber(unitName)
end;
if GetDefenderCreatures() == nil then -- I'm really really not sure about this so worth checking if it actually works
finalnumber = initialnumber - finalnumber;
break;
end;
end;
startThread(count); -- really dunno if you can actually put those in the combat script
- Why would you want to do that, could you please tell me more info
- i don't think you'll be able to use the values in the map script after or if what i've wrote make sense because i think it would work for 1 combat but after that the values would be reset to 0 if the combat script starts again
- one solution would be to use the map script, if you know the creature id
that could be :
Code: Select all
variation = 0
initialnumber = GetHeroCreatures(heroName, creatureID);
function count()
if GetHeroCreatures(heroName, creatureID) > initialnumber then -- if the number of creature increased
print('the hero got some reinforcement')
initialnumber = GetHeroCreatures(heroName, creatureID);
elseif GetHeroCreatures(heroName, creatureID) < initialnumber then
variation = variation + (initialnumber - GetCreatureNumber(unitName)); -- remove the "variation + " if you want to do a specific variation number for each combat or keep it if you want to do a total variation
--whatever action you'd like to make it do here
end;
end;
startThread(count);
Maybe a little performance issue since the function never ends.
Oh, one thing is that it doesn't take in consideration if you give the creatures from your hero to another hero it will take it just like you've just lost them for whatever reason. Maybe with a loop that takes all the heroes and calculate the total amount of creatures of that type it would fix it but actually no since if you put the creatures in garrison or if you put the hero in garrison you'll get a bad result. (in the specific case of if you put the hero in garrison and you exit the town with the hero still in garrison the game wont find the hero and the script will crash and stop working) There again you could add a if with GetTownHero(townName); to solve a part of this problem.
hmmm anyway, lol i guess it is a very complex thing you ask there hehe so just give me more information
the best tutorial is to download every single map and look in their mapscript.lua file (or open the map with the editor and check the map script) and look and learn. Find their tricks and learn!
Aaaaaargh!
Something happened to my map file, at I cannot open it anymore. The system sais there's an error in the file. If I take a look at it (with a viewer), the last part of the file is simply missing! I even cannot open it with WinZip... Could someone help me fixing the file, or at least bring back some part of it? I've been working on my map for weeks now, and it would be so horrifying if everything disappeared... Please, someone, help me!
My ruined map (as a zip file) could be downloaded from:
http://users.atw.hu/swdotf/trp.zip
EEEEEEEEEEEEEEEERGH!
Something happened to my map file, at I cannot open it anymore. The system sais there's an error in the file. If I take a look at it (with a viewer), the last part of the file is simply missing! I even cannot open it with WinZip... Could someone help me fixing the file, or at least bring back some part of it? I've been working on my map for weeks now, and it would be so horrifying if everything disappeared... Please, someone, help me!
My ruined map (as a zip file) could be downloaded from:
http://users.atw.hu/swdotf/trp.zip
EEEEEEEEEEEEEEEERGH!
No, the folder disappeared when I last tried to open the map with the editor. But thank God, on another forum someone fixed the file, so I've got it all back. : )
By the way, it's very-very-very kind of you to answer so quickly, so thank you! : )
(Back to work, I've got one more month for finishing my contest-map...)
By the way, it's very-very-very kind of you to answer so quickly, so thank you! : )
(Back to work, I've got one more month for finishing my contest-map...)
sixy i strongly recommend you keep a system of backups for your map files.
the editor is not stable. it does and will crash, say its saving when its not and you loose all your work, and create corrupted save files.
this happened to me many times now.
what i do is i keep four backups of my map file that i alternate from and i save every half hour of work i do so i wont loose much if that happens.
when im scripting i keep a working copy of the script in word, as i add script, i copy and paste the new script into the word document.
trust me, only just yesterday this saved me having to retype in a half hour of script when the editor crashed while saving. i would have lost all that new script if i didnt have a copy of it in word.
the editor is not stable. it does and will crash, say its saving when its not and you loose all your work, and create corrupted save files.
this happened to me many times now.
what i do is i keep four backups of my map file that i alternate from and i save every half hour of work i do so i wont loose much if that happens.
when im scripting i keep a working copy of the script in word, as i add script, i copy and paste the new script into the word document.
trust me, only just yesterday this saved me having to retype in a half hour of script when the editor crashed while saving. i would have lost all that new script if i didnt have a copy of it in word.
Question what size are these pictures supposed to be?alavris wrote:I thought it may be helpful for someone, so I will post here my reply to question PM'ed me by Fiur about making thumbnail images:.I've just tried to make these thumbnail images. So now I know it's easy I just copied these files from "Heritage" map to my alavris.h5m file:
mM4_pic.dds
mM4_2_pic.dds
mM4_3_pic.dds
mM4_4_pic.dds
mM4_pic.xdb
mM4_2_pic.xdb
mM4_3_pic.xdb
mM4_4_pic.xdb
I think that thumbnail images work only when there are 4 DDS files, but I haven't tried other situation... The next step is to replace this line in map-tag.xdb:with this text:Code: Select all
<thumbnailImages/>
That's allCode: Select all
<thumbnailImages> <Item href="/mM4_pic.xdb#xpointer(/Texture)"/> <Item href="/mM4_2_pic.xdb#xpointer(/Texture)"/> <Item href="/mM4_3_pic.xdb#xpointer(/Texture)"/> <Item href="/mM4_4_pic.xdb#xpointer(/Texture)"/> </thumbnailImages>
Thanks
Najibarr,
Thanks for a thorough answer to my earlier query.
Regarding finding parameters, I thought I had tried everything conceivable -- I overlooked right clicking, and that answers a number of questions, both present and future!
As for my second question, I have a map in which i know exactly which creatures will be available to each hero, but I don't want to allow a hero to dismiss or trade creatures. If a hero does such, I think I can forcibly reset them, but I need to be able to detect when creatures are lost in combat (I'll also have to deal with the issue of hiring creatures -- but one thing at a time! Also my map has very limited hiring opportunities so this issue might be easier than one would expect.) Your response here has also been very helpful -- I had not considered opening a thread active through the entire combat (maybe because my programming instincts are to avoid un-ending threads). I guess it just seems to me that this should not be so hard since in the heroes IV editor it would have been easy. I'll try some of these ideas over the next few days as I get a chance. Thanks again.
Thanks for a thorough answer to my earlier query.
Regarding finding parameters, I thought I had tried everything conceivable -- I overlooked right clicking, and that answers a number of questions, both present and future!
As for my second question, I have a map in which i know exactly which creatures will be available to each hero, but I don't want to allow a hero to dismiss or trade creatures. If a hero does such, I think I can forcibly reset them, but I need to be able to detect when creatures are lost in combat (I'll also have to deal with the issue of hiring creatures -- but one thing at a time! Also my map has very limited hiring opportunities so this issue might be easier than one would expect.) Your response here has also been very helpful -- I had not considered opening a thread active through the entire combat (maybe because my programming instincts are to avoid un-ending threads). I guess it just seems to me that this should not be so hard since in the heroes IV editor it would have been easy. I'll try some of these ideas over the next few days as I get a chance. Thanks again.
Working with secondary objectives. This code works.. However. only the First objective will display in the game. Is it my triggers? I am not sure how they work yet.
[/code]
Code: Select all
function Kill_Mummy1()
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "Kill_Mummys", nil );
MessageBox ("/Maps/SingleMissions/Ashers World one/mummyregion.txt");
SetObjectiveState("mummy1", OBJECTIVE_ACTIVE);
Trigger (OBJECTIVE_STATE_CHANGE_TRIGGER, "mummy1", "objectivecomplete1" );
end;
--------------------------------------------------------------------------
function objectivecomplete1 (heroname)
if GetObjectiveState ("mummy1") == OBJECTIVE_COMPLETED then
SetObjectPosition("mummy2live",21,43,0);
SetObjectiveState('mummy2',OBJECTIVE_ACTIVE);
Trigger (OBJECTIVE_STATE_CHANGE_TRIGGER, "mummy2", "objectivecomplete2" );
end;
end;
-----------------------------------------------------------------------------
function objectivecomplete2 (heroname)
if GetObjectiveState ("mummy2") == OBJECTIVE_COMPLETED then
SetObjectPosition("mummy3live",23,42,0);
SetObjectiveState('mummy3',OBJECTIVE_ACTIVE);
Trigger( OBJECTIVE_STATE_CHANGE_TRIGGER, "mummy2", nil);
Trigger (OBJECTIVE_STATE_CHANGE_TRIGGER, "mummy3", "objectivecomplete3" );
end;
end;
-----------------------------------------------------------------------------------------------------
function objectivecomplete3 (heroname)
if GetObjectiveState ("mummy3") == OBJECTIVE_COMPLETED then
MessageBox ("/Maps/SingleMissions/Ashers World one/mummys.txt");
-- end;
Trigger( OBJECTIVE_STATE_CHANGE_TRIGGER, "mummy3", nil);
end;
end;
I did try IsObjectInRegion and it didin't work either,, thats why I tried the off the wall code. the code works perfectly in game when just calling a single region.,. i was trying to combine 5 regions into one call to StartCombat but can't get it to work,,Najibarr wrote:What is that command i never saw it in the editor... but it clearly need a boolean value like if isplayerheroesinregion(playerid,regionname) == true then
why don't you use a real command like IsObjectInRegion :Code: Select all
name=GetPlayerHeroes(1); check_assassins=0 check_ambush=0 region = { "ambush", "assassins2"} -- Indexes are assigned automatically --function Ambush function Ambush() while 1 do if IsObjectInRegion(name[0], region[0]) == true then BlockGame(); StartCombat( name[0], nil, 2, 113, 13 , 113, 15, nil, nil); check_assassins=0 --SetPlayerResource(PLAYER_1, 6, 200); UnblockGame(); break; else sleep(1) end; end; end; startThread(Ambush);
Last edited by meows on 02 Dec 2006, 02:15, edited 1 time in total.
Aye thanks.. but the problem is still Objective 1 (mummy1)myythryyn wrote:meows
to make objectives visable in the game you also have to have this line after you activate it
SetObjectiveVisible ("obj1", true);
does work perfectly.. but the trigger in it to start objective 2
(mummy2) does not activate..
any one know how triggers work?
I need a sample i think.
Don't you just have to add more condition to the "if" i mean :meows wrote: I did try IsObjectInRegion and it didin't work either,, thats why I tried the off the wall code. the code works perfectly in game when just calling a single region.,. i was trying to combine 5 regions into one call to StartCombat but can't get it to work,,
Code: Select all
name=GetPlayerHeroes(1);
check_assassins=0
check_ambush=0
region = { "ambush", "assassins2"} -- Indexes are assigned automatically
--function Ambush
function Ambush()
while 1 do
if IsObjectInRegion(name[0], region[0]) == true and IsObjectInRegion(name[0], region[1]) == true and IsObjectInRegion(name[0], region[2]) == true and IsObjectInRegion(name[0], region[3]) == true and IsObjectInRegion(name[0], region[4]) == true then
BlockGame();
StartCombat( name[0], nil, 2, 113, 13 , 113, 15, nil, nil);
check_assassins=0
--SetPlayerResource(PLAYER_1, 6, 200);
UnblockGame();
break;
else sleep(1)
end;
end;
end;
startThread(Ambush);
Who is online
Users browsing this forum: No registered users and 0 guests