[H5 EDITOR] Troubleshooting topic

Maps and the art of mapmaking.
myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Unread postby myythryyn » 03 Mar 2007, 01:39

grindcardoso wrote:Gurizada ("hey guys" in portuguese),

Another question for the experts in mapmaking:

On the map I have three bridges, and a stack of Pit Lords hidden somewhere, I want to fortify the bridges also with Pit Lords, but trick are two:

1) The bridge keepers must have the same amount of creatures of the hidden Pit Lord;
2) By the day 2 and 4 of each week I want to increase the number of the hidden Pit Lord (plus 1 each two days);

Can anyone help me?
Many thanks!
hmmm. well first, i dont think you can affect a stack of creatures on the map. the only way you can increase the numbers of creatures is be using the AddObjectCreatures command, which means the Pit Lords have to be in an object, such as a garrison.
so you would have to put garrisons between the bridges.
you will need to give each garrison an ID name in the properties, such as garrison1

then you would set up a variable.
var1 = 0;

then using the NewDayTrigger have var1 = var1 +1 so that var1 increases in value each day that passes.
then you would have a check,
if var1 = 2 then, if var1 == 4, if var1 == 9 then, ect.
AddObjectCreatures(garrison1, 26, 1);
end;
this would add one pitlord to garrison1 on day 2, 4, ect.

so it would look like

var1 = 0;

function newday();
var1 = var1 + 1;
if var1 == 2 then
AddObjectCreatures(garrison1, 26, 1);
end;
if var1 == 4 then
AddObjectCreatures(garrison1, 26, 1);
end;
if var1 == 9 then --- this is the second day of the second week
ect. you would add a line for each second and fourth day of however many weeks you want the event to happen.
Trigger (NEW_DAY_TRIGGER, "newday" );

this should work...maybe someone has a better idea....im not sure what you mean by secret pitlords, but im guessing the only reason you want them is to increase the number of pitlords gaurding the bridges, which the above script does.

grindcardoso
Leprechaun
Leprechaun
Posts: 7
Joined: 12 Feb 2007
Location: Brazil

Unread postby grindcardoso » 03 Mar 2007, 10:36

Thanks for the tip.
For "hidden Pitlord" I mean that I want the player to search for it and kill it. As long as the bridges will have as many guardians as the hidden Pitlord, the player could pass through them much easier if the Lord is dead.
I thought I could do this way:

function grow()
If GetDate (DAY_OF_WEEK) == 2 or GetDate (DAY_OF_WEEK) == 4 then
AddObjectCreatures(garrison1, 26, 1);
end;
end;

Then it wouldn´t be necessary to write a lot of lines in the same script. Since I´m at work right now I can´t test it properly, however, any ideas are welcome.
"Glória do desporto nacional ó Internacional que eu vivo a exaltar" - Sport Club Internacional Anthem

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 11 Apr 2007, 10:44

Someone emailed me a question about adding custom sound files and having them play when a heroe enters an area. Does anyone know where to save such a file, or how to import it into the map? I know how to save text files for messages, but not sound files.

The scripting (using the pathing of my map) would be something like:

function BadlandsMessage()
if GetCurrentPlayer() == whoishuman then
MessageBox("Maps/SingleMissions/Seize The Throne/Badlands.txt");
Play2DSound("what path?/sound.wav");
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "Badlands", nil );
end;

end;

Trigger( REGION_ENTER_AND_STOP_TRIGGER, "Badlands", "BadlandsMessage");
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."

Mamoru-kun
Leprechaun
Leprechaun
Posts: 13
Joined: 06 Jan 2006

Basic questions...

Unread postby Mamoru-kun » 30 Apr 2007, 23:33

Hello all!

even if a programmer myself, I have some difficulties understanding the scripting procedures here. So before going any further, is there any documentation corresponding to the "script functions" help manual provided with the game? In short, I would like to find answers to such questions:

1) Why can we add scripts to "map properties" and "objects properties"? Any differences between both of them?
2) What difference between setting a trigger function name in a town properties (for example) and directly calling the Trigger function in the script page of that town?
3) What is the "Function x not define, in line 1" I receive after writing "function x()" at the very first line of a script page? I thought that describing a function in this script language implicitly defined it...
4) What is the "common" procedure for debugging your own code (I found the print() function...but not yet the "console" in the game ;))?

Of course, if someone has the hearth to answer me directly, I would be very glad, but really, a simple document link would make me happy as well! :)

Anyway, thank you very much in advance!

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Re: Basic questions...

Unread postby myythryyn » 01 May 2007, 05:44

hello, first off, Pitsu was kind enough to make us a scripting docuement
here is the link
viewtopic.php?t=5430
Mamoru-kun wrote: 1) Why can we add scripts to "map properties" and "objects properties"? Any differences between both of them?
2) What difference between setting a trigger function name in a town properties (for example) and directly calling the Trigger function in the script page of that town?
as far as i know, unless someone can correct me, scripts only work if placed in the map properties section. if you place scrips in any of the object boxes, creatures, towns, whatever, they will not work. confused? dont worry, nothing really makes sense with the HOMMV map editor. :)
Mamoru-kun wrote: 3) What is the "Function x not define, in line 1" I receive after writing "function x()" at the very first line of a script page? I thought that describing a function in this script language implicitly defined it...
how to define functions is in the document in the link above
Mamoru-kun wrote: 4) What is the "common" procedure for debugging your own code (I found the print() function...but not yet the "console" in the game ;))?
this as well is answered in the document above :)
the console is the one i use the most, and directions are given on how to use it as well there is a sticky about the console in the main HOMMV forum since the method to open it changes with the version you have.
basically the only way to debugg is to load your map in the game. the "check" button at the bottom of the editor scripting window/screen does nothing useful. suprise suprise :)
so you have spend time loading your map everytime you want to test even one line of script.
then in the game when you open the console, it will give you a line number if it has a problem and you can go from there.
usually i just make one block of script at a time, test it, then move on to the next block, ect, so if a problem happens, i know exactly which block is the problem.

ok good luck....youll need it :devil:

Mamoru-kun
Leprechaun
Leprechaun
Posts: 13
Joined: 06 Jan 2006

Unread postby Mamoru-kun » 01 May 2007, 08:47

Thank you so much for that quick answers! Even if the HOMM5 editor is not perfect, it is so much pleasant to work with a C oriented language than with the ASM style language proposed for the WOG scripting (HOMM3). I just hope the what I read in one of the first pages of this thread, saying that scripts don't work in multiplayer mode, is not thrue...:(

Thanks again, and see you soon for new maps! ;)

Mamoru-kun
Leprechaun
Leprechaun
Posts: 13
Joined: 06 Jan 2006

Unread postby Mamoru-kun » 01 May 2007, 09:30

OK OK...not a good try...

"setvar dev_console_password = schwinge-des-todes" in autoexec_a1.cfg
"bind show_console '<'" in config_a1.cfg

...what is missing to have the console displayed after hiting '<' in HoF (I also tries with the '²' key setting)? Or is the console something extern to HoF, you should access with an alt-tab (cannot test from this comp)? Or is the console hiden in multiplayers maps?

Another one, if you don't mind: why would I get the "start player doesn't exist on map" error message when launching a map, after simply adding a town 'X' in it and setting the "common objectives [0]" condition to OBJECTIVE_KIND_CAPTURE_OBJECT and 'X' as a new objective parameter? I don't understand the "link" between the two facts...:(

myythryyn
Assassin
Assassin
Posts: 293
Joined: 05 Sep 2006

Unread postby myythryyn » 01 May 2007, 14:22

ok first ill give you the bad news...then the good news :)

the bad news - no scripts in multiplayer maps. they have been disabled. which could explain why you couldnt open the console, as i have never tried to open the console in a multiplayer map. what is supposed to happen is that in the game, the top quarter of your screen opens into command prompt line when you open the console.

the good news....well....there is no good news, except that there is a way to convert your multiplayer map into a single player if you have spent some time making it :)

as for player does not exist error, did you set up all the players in the map properties window? there is a players properties tab where you have to select the town for each player, if its human/computer playable, starting hero or not, that kind of thing. You have to set up each player.
you also have to pick which player the town belongs to in its properties.

as for setting objectives, thats a whole other thing unto itself.
start by reading "editor theory" PDF, page 24, which is located in your editor documentation game folder.

Mamoru-kun
Leprechaun
Leprechaun
Posts: 13
Joined: 06 Jan 2006

Unread postby Mamoru-kun » 01 May 2007, 15:42

Thanks for your answers again. Unfortunately, I have read each single PDF files provided before starting creating my map. About the problem with the "start player doesn't exist in map", I'm almost sure that the message is not related with the real problem, as without that single town 'X' I have added, the map works perfectly with the base two players. Anyway, using an artifact in place of a town works perfectly well, so I will keep it as a winning option ;)

What makes me feel sad about all theses stuffs is how Nival programmed the game core module. I have not seen the code itself of course, but I would bet my own house that it's not a real "multiplayer synchroneous" code. Just a "turn by turn" core, which would explain why: 1) the scripts have been disabled from multiplayers maps, and 2) why, when players’ visible zones “meet” in multiplayer mode, the game turns back to "turn by turn" mode (in both cases, the program would need to send information from one player to another, and update both players display “on the fly”…what it doesn’t, obviously). What they miss, I would bet, is a single "real time" communication between players. I wouldn’t suggest them to have a look at how Firaxis did on CIV4, but...

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 07 May 2007, 00:24

Well,l I have started a new HOF map and evidently my scripting skills have deteriorated somewhat. I can't see what is wrong with this simple script to display a message when the player enters a region.

I have verified that the text file is the same name as used in the script and that the region name is the same. I've been banging my head on the wall for some time now so I could use another pair of eyes.

The player does not stop when he enters the region nor does the message display.
function AcademyGraveyard()

MessageBox ("Maps/SingleMissions/Shadow Dreams/EnterAcademyGraveyard.txt");
Trigger (REGION_ENTER_AND_STOP_TRIGGER,"rgnAcademyGraveyard",nil);

end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"rgnAcademyGraveyard","AcademyGraveyard");
In the event that you don't see anything in the above, is there anything in the below script that could cause the problem? I've tried to make sure I had all my "ends" and such, but maybe I missed something.

Edit: Well, it turns out that I did miss an "end." I have corrected the code below. Also, the computer did not like my quest setups so I still have them commented out. I'll still have to figure that out, but I'm happy that the rest of the scripts are working as intended.
-- only do this the first day
path = "Maps/SingleMissions/Shadow Dreams/"; -- shorthand


--determine human player and set variables
whoishuman = GetCurrentPlayer(); --determine human player, always goes first
humanheroelist = GetPlayerHeroes(whoishuman); --get human's heroe choice
humanmainheroe = humanheroelist[0]; --human heroe choice assigned as main heroe


academygravemess = 0;

LevelUpHero (humanmainheroe); --For debuging. When enabled if hero does not level up, new script has syntax error.


--determine difficulty level: easy(1), normal(2), hard(3) or heroic(4)

if GetDifficulty() == DIFFICULTY_HEROIC then
difficultylevel = 4;
elseif GetDifficulty() == DIFFICULTY_HARD then
difficultylevel = 3;
elseif GetDifficulty() == DIFFICULTY_NORMAL then
difficultylevel = 2;
else difficultylevel = 1;
end;


MessageBox("Maps/SingleMissions/Shadow Dreams/Intro1.txt");

MessageBox(path.."Intro2.txt");


--Skeleton encounter in player's house
function skelefight()


StartCombat(humanmainheroe,nil,4,29,10,29,10,29,10,29,10,nil,"winlose_skelefight");

function winlose_skelefight()
MessageBox(path.."beatskeletons.txt");
MessageBox(path.."onelife.txt");
MessageBox (path.."duties.txt");
end;
end;

skelefight();--fight the skeletons in the player's house


--computer starting bonuses based on difficulty level
for i = 1, 7, 1 do --do for each computer player
if i ~= whoishuman then --don't do for human
for j = 0, 5, 1 do --do for each resource

resource = GetPlayerResource(i, j) + 10*difficultylevel;--give resource bonus
if ((j == 2) or (j == 4)) then --give more ore/wood
resource = resource + 40;
end;
SetPlayerResource(i, j, resource);
end;
goldbonus = GetPlayerResource(i, 6) + 10000*difficultylevel;--give gold bonus
SetPlayerResource(i, 6, goldbonus);
end;
end;


--Transform Town in center to player town type (only the 4 surface types are playable);initial quests

if whoishuman == 1 then
TransformTown ("Feschnia", 5); --Academy
-- SetObjectiveState("Defeat the Red Slayer", OBJECTIVE_ACTIVE);
-- SetObjectiveState("Investigate Academy Graveyard", OBJECTIVE_ACTIVE);
-- SetObjectiveVisible ("Defeat the Red Slayer");

-- SetObjectiveVisible ("Investigate Academy Graveyard");
end;

if whoishuman == 2 then
TransformTown ("Feschnia", 4); --Sylvan
end;


if whoishuman == 3 then
TransformTown ("Feschnia", 9); --Fortress
end;


if whoishuman == 4 then
TransformTown ("Feschnia", 3); --Haven
end;


function AcademyGraveyard(heroename)

MessageBox ("Maps/SingleMissions/Shadow Dreams/EnterAcademyGraveyard.txt");
Trigger (REGION_ENTER_AND_STOP_TRIGGER,"rgnAcademyGraveyard",nil);

end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"rgnAcademyGraveyard","AcademyGraveyard");

--Grumpy Old Wizard
--function GrumpyOldWizardMessage(heroename)
-- if (GetCurrentPlayer() == whoishuman and GetCurrentPlayer() == PLAYER_1) then
-- MessageBox(path.."GrumpyOldWizardIntro.txt");
-- end;
-- Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnGrumpyOldWizard", nil );
--end
--Trigger( REGION_ENTER_AND_STOP_TRIGGER, "rgnGrumpyOldWizard", "GrumpyOldWizardMessage");


--check for stuff to do on various days
function NewDayTrigger()
end;
Trigger(NEW_DAY_TRIGGER, "NewDayTrigger");


function MainHeroAlive (heroname, herokiller)
if heroname == humanmainheroe then

MessageBox(path.."LoseGame.txt", Loose()); --player loses if he loses his first hero pick

end;
Trigger (PLAYER_REMOVE_HERO_TRIGGER, whoishuman);
end;

Trigger (PLAYER_REMOVE_HERO_TRIGGER, whoishuman, "MainHeroAlive");
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."

User avatar
Pitsu
Round Table Hero
Round Table Hero
Posts: 1848
Joined: 22 Nov 2005

Unread postby Pitsu » 07 May 2007, 07:12

Hero not stopping in the area sounds like the trigger is not set. Meaning that either the area is not there where you think it is (check area name spelling and location) or

Trigger(REGION_ENTER_AND_STOP_TRIGGER,"rgnAcademyGraveyard","AcademyGraveyard");

is somehow not read. You can shift the Trigger command to the first line in the script file and see if that changes anything.
Avatar image credit: N Lüdimois

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 07 May 2007, 08:33

The error turned out to be an "end" that I had forgotten to add. I for some reason caused the trigger not to execute even though the end that was missing was up above it in the code for transforming the town.

I discovered it by commenting out blocks of code and running the game until the stop in region worked because I was fairly certain that I hadn't done anything wrong in that code. That's what I get for writing large amounts of script without playtesting it. Usually I'll write a litte bit of code and then playtest it so errors are easier to find.

GOW
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."

User avatar
Pitsu
Round Table Hero
Round Table Hero
Posts: 1848
Joined: 22 Nov 2005

Unread postby Pitsu » 07 May 2007, 08:57

Grumpy Old Wizard wrote: It for some reason caused the trigger not to execute even though the end that was missing was up above it in the code for transforming the town.
GOW
Yes, if an early end is missing, it has troubles to understand anything until a proper end is found. So, if a script does not work and you are damn sure that it has no errors in itself, you can cut'n'paste it upwards. Moving the problematic script above anything else tells whether it is the script itself (still not functioning) or a missing end in other parts (script starts functioning after moving it upwards).
Avatar image credit: N Lüdimois

Dominus
Leprechaun
Leprechaun
Posts: 4
Joined: 19 Jun 2006

"objects" in the toolbar are gone

Unread postby Dominus » 08 Jun 2007, 22:22

Hello,
I don't know what I have done, but objects from Tool Panel are gone. I have Tool Panel active, but no objects there. What I should do to retrieve these object back?

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 09 Jun 2007, 00:44

Click on View and try unchecking and rechecking "Tool Panel" (with a map open) and see if that helps. Also, close and restart your map editor.

GOW
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."

Dominus
Leprechaun
Leprechaun
Posts: 4
Joined: 19 Jun 2006

Unread postby Dominus » 09 Jun 2007, 06:50

Grumpy Old Wizard wrote:Click on View and try unchecking and rechecking "Tool Panel" (with a map open) and see if that helps. Also, close and restart your map editor.
Unfortunatelly both methods are useless:( I have even reinstalled whole game, but it didn't help neigther. What to do? Does anyone have any idea?

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 09 Jun 2007, 08:08

Dominus wrote:
Grumpy Old Wizard wrote:Click on View and try unchecking and rechecking "Tool Panel" (with a map open) and see if that helps. Also, close and restart your map editor.
Unfortunatelly both methods are useless:( I have even reinstalled whole game, but it didn't help neigther. What to do? Does anyone have any idea?
You are sure that you have a map open when you are trying to view the objects?

Did you uninstall the game or install over it? When you uninstall the game make sure that no old files are left. If there are delete them.

Did you uninstall and reinstall the editor, making sure no old editor files remained?

What happened right before you lost the objects? Did you recently download a map or a mod? Did you try to edit one of the editor files or to make your own mod?

GOW
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."

Dominus
Leprechaun
Leprechaun
Posts: 4
Joined: 19 Jun 2006

Unread postby Dominus » 09 Jun 2007, 08:31

>You are sure that you have a map open when you are trying to view the objects?

Yes, I am.

>Did you uninstall the game or install over it?

I unistalled it, but I didn't check if something was left. I will do that.

>Did you uninstall and reinstall the editor, making sure no old editor files remained?

I didn't install, unistall, reinstal editor alone. I have only installed patch(HoF 2.1).

Update I deleted all contents and installe all one more time. It helps. Thank you GOW for ideas.

>What happened right before you lost the objects?

I use "map", that is a skillwheel in game.

User avatar
Grumpy Old Wizard
Round Table Knight
Round Table Knight
Posts: 2205
Joined: 06 Jan 2006
Location: Tower Grump

Unread postby Grumpy Old Wizard » 09 Jun 2007, 10:14

I'm glad it worked for you. :)

Maybe the skill wheel map you downloaded was corrupted since I also use that mod (for the ingame skillwheel) with no problems. Or else the mod doesn't work with your language version of the game. I am using HOF 2.1 US English version.

GOW
Frodo: "I wish the ring had never come to me. I wish none of this had happened."
Gandalf: "So do all who live to see such times but that is not for them to decide. All we have to decide is what to do with the time that is given to us."

MoxManiac
Leprechaun
Leprechaun
Posts: 9
Joined: 13 Jun 2007

Unread postby MoxManiac » 16 Jun 2007, 00:46

Are there are any ice/snow tiles? I saw some custom maps with them but i can't find them in the editor. Or is this an expansion only feature? (I only have H5 standard)


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 2 guests