Map Editor Bugs

The following is a list of the various bugs found in the Heroes of Might and Magic IV editor, compiled by Jeff_G. As you can see, there are not as many as one would expect. If you come across a bug that was missed, please post a description in the forums. Thanks to everyone who submitted bugs or solutions.

Combat Script Problem: When using the Combat Script both the defeated and the Victorious Branches execute regardless of the combat’s outcome. (Version WoW)

Workaround (Suggested by GhostWriter)

That script has always been bugged like that. There's a different ways you can get around it, all of which mean not using the combat branches at all.


COMBAT, in the victorious or defeated branches do nothing.

Separate Conditional Statements

IF Total number of creatures PLUS Total number of heroes in this army > 0 THEN (run the player victorious side) (that is the AI lost)

IF Total number of creatures PLUS Total number of heroes in this army = 0 THEN (run the player defeated side) (that is the AI won)

This script works for placed event combats, ambush combats, or on armies without heroes. I have tested this script and it works and it will treat fleeing as an AI victory, so no more cheap wins. If you script an army with a hero then Wimfrits has identified another problem this script does not correct.

Wimfrits: there is one slight problem with this script. Though I do feel it is the best solution, one should realize that a dead player hero counts as 1 hero.

So, if the player (with hero) loses and leaves a tombstone; the 'victorious' script will run.

His workaround:

I know of 1 alternative, but it would have to fit the map to some extent. It requires an additional script part to the 'victorious' script you mentioned. For the example I'll use ghosts:


IF [tot # creatures] + [tot # heroes] > 0

--SET variable X to [# ghosts]

--GIVE 1 ghost

--TAKE 1 ghost

--IF [# ghosts] > [variable X]

----execute loss script


----execute victorious script

Bonus Modifiers

Morale and Luck

Problem: Awarding an increase/decrease of morale or luck is unpredictable, and rarely are the increases/decreases what you award. (Version WoW)

Workaround: (By GhostWriter) I've had luck (pun intended) making it work by only increasing or decreasing in +/-5 levels at a time, no more than that. No guarantee it will work for you though. If you want to decrease by 10 try making two -5 scripts in a row. The only thing is you can't display the total amount using the icons in the dialogue, but you can just write it into your text to explain.


Problem: When using the increase current movement, it does not give the amount you script; it gives just 1% of the amount. (Version WoW)

Workaround: You must script 100 times the amount of the intended increase. So to increase the movement 5, you must place 10 scripts of increase current movement by 50. I suggest you do not use the sub-action block of the display message script. It would only confuse people as to the amount of increase they will actually receive.


Problem: In heroes patch versions earlier than v3.0 you can't rely on the script for AI heroes: INCREASE DEFENSE, as far as I remember then it increases attack instead.

Solution: Use WoW or patch 3.0 (Rakne Fne)

Experience Levels

Problem: INCREASE EXPERIENCE LEVEL of ... HERO by 10 does not give 10 experience levels, but much less, perhaps only 6-7.

Solution: Give INCREASE EXPERIENCE LEVEL of HERO by 1 and do it 10 times. (Rakne Fne)


Problem: (WoW) Perhaps it is not a bug, but an error in the help file documentation. The encountered script is stated as running before combat between enemies, or before the inventory screen when allies or friendly armies meet. Unfortunately this script only runs before combat and not when meeting friends or allies. Also an event that triggers an opponent to change to your color before combat will not prevent the combat. You end up with two armies of the same color fighting and the only real option then is to run with the loss of that hero's army.

Workaround: No easy ones, placed events in front of the army to trigger the color change has been suggested for the one example mentioned.


Problem: Removal of artifacts via scripts does not run when battle is between two AI players, including neutral.

Workaround: (Suggested by GhostWriter)

In the hero’s triggered scripts create two events a take items “hero’s name” and a give items “hero’s name” Now in the hero’s standard encountered script, a conditional if the opposing player is computer trigger take items “hero’s name”. In the victorious script a conditional if opposing player is computer then trigger give items “hero’s name”. Now if you do not want the human player to get the artifacts this hero is carrying then in the defeated script a conditional if opposing player is human then trigger take items “hero’s name.”



Problem: DIVIDED BY does not work properly.

Solution: There are plenty of other ways to get the right formula.

Solution (suggested by Qubar)

After some experimenting with events, I figured out how the divide function works:

On my first try I divided 100 by 2, the value I got was 2.

On my second try I divided 100 by 1, the result was 1.

At this point I figured out the answer, but I made one more trial just to make sure, so I divided 100 by 4, and the result I got was 4, as I expected.

This is how it works; instead of dividing by the value you want (lets call it X), the game divides by 100/X.

Now I'll tell you how to use the divide function correctly in 2 easy steps:

First; divide 100 by the number you want to divide by.

e.g. if you want to divide by 10, divide 100 by 10= 10 (this is a special case where both values are equal, note this 'cause it will be useful later).

Then use the resultant value instead of the value you want.

However, some times the resultant value will have decimal places, like for example if you want to divide by 8, 100/8=12.5, unfortunately you can't enter fractions in the divide by field, to get over this, first divide the variable you want to divide by 10, then divide it by 125 (i.e. 12.5*10, this in effect will divide the value by 0.8), so the net result will be dividing it by 8.

The more fractions you have, the more the number of times you need to divide by 10.

I hope this isn't too complicated.

Placed Event

Problem: PLACED EVENT right next to a town even with IF PLAYER IS COMPUTER will also work for human player if you retreat from a fight and retreat to the town with the PLACED EVENT (for instance if there are AI boost in that PLACED EVENT).

Solution: Move the PLACED EVENT a little away from the town. (Rakne Fne)


Problem: Game crashes if you bomb the same quest that you are currently activating at the same time.

Solution: Use other events to bomb quests. (Rakne Fne)

MOD (Remainder)

Problem: The MOD (REMAINDER) function does not work.

IF Owner = (color) script does not work on dwellings.

Workaround: (suggested by Robenhagen)

I've found a rather complex way to deal with this, but it only works for lvl 2+ dwellings (that isn't owned by another player - ultimately it requires combat to take place). A placed event 2 hexes from the dwelling sets a numeric varaible, measures the experience of the the most powerfull hero in the army. Once he passes the event again (you need some conditional actions to determine what the event should do) after having taken the dwelling, checks to see if the hero's current experience is greater that previously set variable. If it is, the army must have fought to get the dwelling and then the owner-is-certain-color variable.

An alternative (by Rakne Fne)

You could also put a PLACED EVENT right next to the dwelling that triggeres an event on the dwelling to change color to the player who steps on the placed event. But of course, this means, you won't have to fight for getting the dwelling (but you can place creatures in front instead).

Trigger Timed Events

Problem: When triggered timed-events run on a 'crowded' day, it's possible that one of the events will NOT run.


For instance, there are 2 set timed events on day 6 and 2 timed events repeating every day, starting on day 3, which will only run when a certain variable is met.

If this variable is met at the start of day 6, the 4 events should all run on that day. It's possible that one of these will not run.

I encountered this 2 times so far and both times it caused the scenario in question to become unfinishable. (Certain bombing of key sites for progression did not happen)

Workaround: make all events repeating, so that if one doesn't run on day x, it will run again on day x+1. Of course using the 'remove script' option is mandatory.

Scroll Identification

Grythandril posted this on Heroes Community and has come across a major bug.

Problem: Apparently the game cannot identify a scroll or parchment (they act the same) of a particular spell using a conditional action. If you do an "If this army has scroll of bless" for example, the condition will be met if the army has any scroll. There's some weird things going on with giving and taking scrolls as well, but that appears to be directly related to the lack of ability to identify a particular scroll.

Lampskjerm explained: Sometimes the game thinks of a parchment as all parchments, and sometimes not. In one of my maps I have an event that will trigger only if red player has a parchment of death call. If you have a parchment of bless instead, the script will not be triggered. However, the event will trigger if you have a parchement of a random DEATH magic spell.

Workaround: None

Complex Conditionals

Mace the Councillor: I have discovered something that seems to be a bug in the map editor of Heroes IV. It concerns complicated scripts, with multiple layers of Conditional Actions and/or Ask Questions. When I have made a too complicated script and click OK to close the last Event or Quest Hut (or whatever) window, the map editor just shuts down.

I just wanted to warn new mapmakers about making too complicated structures of CAs or AQs and ask if anyone else has encountered this problem.

P.S. I have GS and WoW as well as all available patches, so I know lack of updates is not the cause of this problem I've had.

GhostWriter: It does seem to happen in XP, but in the last year I have not had a single crash, while I used to get them quite often. I don't know what changed in my system. I've done some very heavy scripts, and the key is to break the script down into smaller parts, triggering pieces of it, and use sequences of conditions instead of embedded conditions. You can go on forever with sequences; at least I haven't found a limit.

Please login to view comments.