Thanks, it works perfect when we move the big stack when in hero screen. The bug remains when:

-we split the stack, the destination stack goes into negative if the split destination > a certain number, trying to find which
-when in town screen and move stack, stack vanish (should use the slider bar)
- the button "split creatures" is no more operational, but works through TAB+LMB ok (not a big issue for me)
-when another hero is adding to this stack another stack with ACE level (via exchanging screen), the experience of destination stack is lowered.

For the first situation, combining with JimV script should fix the problem. For the town screen, I don't know how.

@Edit: In my case, source stack is 52657 and the experience for split is lost when the destination stack is between 21900 and 22000. Below this, ok.
Probably the best fix would be directly in data code, the guys from TE never looked into?

Thanks for an excellent script with some useful UN:C information, Bersy.

I have been considering what to do in TDS, which is a WoG 3.58f map. I think I could convert Bersy's script for 3.58f use with a bit of address-searching, but the method I was thinking of was to use reduced numbers for the creature experience levels. ERM gives access to the level 10 value with EA:L, and to some experience factors with EA:M and EA:U, but it does not give access to the "level 11 bonus" = the amount of extra experience which a stack is allowed to accumulate, above level 10.

For example, a Storm Elemental (127) can accumulate up to 56,000 experience, but level 10 is at 35,000 experience, so the extra amount is 21,000. So far I have found the following addresses for the Storm Elemental's bonus:

WoG 3.58f: 85E2F0
Era 1.8: 85F548

(I need to do more testing on different PC's to be sure these are consistent.)

My thought is to set both the EA:L value and the bonus value to lower numbers for at least certain creatures which are commonly used in TDS, and perhaps all creatures. This should solve all stack experience problems (until people escalate the number of creatures from hundreds of thousands up into the tens of millions), and might also solve the disappearing stack problems (not tested).

I note in testing so far that when the level 10 value (EA:L) is reduced, the maximum amount of experience which a stack can gain from a battle is also reduced--which is good. Perhaps the balance of some maps would be affected even so, but I think that would not be true for TDS. After a few weeks of game-time, The Doctor only generates level 10 Storm Elementals after a battle anyway.

Val, the script covers only hero screen, not town screen or hero meeting screen. Fixed problem with split button. Also I suggest to implement custom dialog for splitting, consisting only of one input field for number (IF:[dont remember command ])

http://pastebin.com/vcfU2qHn

Jim, it's much simplier to find variables of currently selected slots for heroes meeting screen and town screen. If we have custom split operation for all these screens, the problem can be considered mostly solved.

I think these are the correct addresses for the amount of experience each creature can have above level 10:

WoG 3.58f: 20*(Creature number) + 8771844

Era 1.8: 20*(Creature number) + 8776540

These work for me in multiple program starts on both a Windows 7 and a Windows XP system, although both machines had plenty of RAM (nothing special these days, but more than older machines have) and possibly older machines with less RAM might use a different memory layout.

I used this script to rescale all creature experience level values in a test version of TDS:

This seems to solve all creature-experience-overflow problems in TDS, but not the Town Screen problem. That is a different problem, an overflow in the creature count, caused by using two-byte storage for creature count in the Town Screen. The maximum positive integer in two-byte arithmetic is (2^15)-1 = 32767. Creature counts up to that number work okay. If you add one more creature (in the Hero Screen), 32767+1 overflows to -32768 in two-byte integer arithmetic, and negative numbers of creatures are not displayed in the Town Screen. They can be seen in the Hero Screen, but attempts to use a negative number of creatures for anything will crash the program.

So Bersy is right (except that was easier for me to find data tables by searching memory than to find out how the program handles troop slot selection), the ERM solution will require a custom troop splitter/combiner for the Town and Hero Meeting screens - unless and until someone who knows the code makes a patch to replace the two-byte arithmetic with four-byte arithmetic (which would not apply to WoG 3.58f).

This converts a shift-click operation to a Split Creatures Button operation automatically, so the player always uses the Split Creatures Button. Since the SCB operation seems to use four-byte arithmetic, the manual data transfers are not necessary in this case.

I have a problem, please help.
I set quest "return with artifact" for a quest guard, but some WoG artifacts (such as Dragonheart, blank artifact,...) don't appear in the list to choose. I want to require WoG artifacts in quest guard. What erm script that I can do it?
Please help. Thanks.
____________ My HoMM3 Maps
Sorry for my bad English.

When clicking on spell book, a function occurs and it assign to each spell a variable, which is dynamic, may improve through research. Until here, it is simple, click and get new spells power. Now, if you are sorcerer, it must show this variable*2, but how to avoid multiplying*2 each time you open book? Is there any way to intercept when spell book is closed and restore values? In battle it is easy, multiply spells power in BA0 then apply in BF, so it does not occur twice (BA1 reset them). But in hero screen , it will increase every time we open the book.

I get I=19 either I click on spell book or close spell book. Tracking this click with a flag (set true/false on second click on) does not work.

Quote:Is there any way to intercept when spell book is closed and restore values?

If I understand what you are doing (probably not), when a Hero is a Sorcerer you want his spells shown at double spell power, and if the Hero is not a Sorcerer, at one times spell power.

Then upon a left-click of the Cast Spell button (Adventure Map), or Spell Book (Hero Screen), check to see whether the Hero is a Sorcerer or not, and set the spells accordingly, before the Spell Book is displayed. That is, for a non-Sorcerer, make sure the spells are at one times spell power. (Also at the start of a battle, in case a Sorcerer opened a Spell Book just prior to the battle, but the battle Hero is not a Sorcerer.) You must have a variable or flag which records the status of the spells, e.g., zero if the spells are currently set for a non-Sorcerer, and one if the spells are set for a Sorcerer. Or perhaps it would be simpler to save two sets of spell values, with and without Sorcery, if the spell settings are changing with time. Anyway, the key points are: 1) always know whether the spells are set for a Sorcerer or not; 2) whenever a Hero is about to have his spells displayed, change the spell settings if the current settings do not match the Hero type.

No, all heroes are sorcerers, it is a faction choice. It is only about the right info of the spell damage, outside the battle (in battle ok).

I should probably have done the spells system different, as right now, the DL's are holding real values, you upgrade them normally, then in battle they do *2 damage if player choose sorcerer. I am thinking to remove the battle *2 modifications, put them in a daily timer, and reset them when end turn. So when open book, they show properly for this faction as well.

This is how is done:

Start game: store the spell power (not primary skill) in a var.
DL: this var increase by 10 if purchase upgrade, set new power
In battle (BA0) *2 if sorcerer faction, reset in BA1

Also the spells damage is correctly displayed in battle, as I assigned this function to CM4 as well, which occurs after BA0.

solitaire, will you update the ERM help? I'm making a package and need old ERM help replacement. Jim's variant is nice, but 3.58f only. Yours is lack of formatting (especially code) and some backgrounds.

I'm new to erm, i tried to put a visit object-then receive text command, but when I run the game it doesn't activate. I'm sure I made the specs (position of the object) right, it's put on day 675 and available for player1 only to trigger. I used !?OB and below it !!IF:M^texthere^; I haven't forgotten to put the ";" at the end of both of them and also ZVSE at the front. So what could be wrong?? Please, help!!

It might help to copy and paste your complete script here, and describe what object you used. It could be some typo which you haven't yet noticed, or it could be that you used !?OBx/y/L; but the x/y/L coordinates are not the coordinates of the object's yellow square, or it could be that the object does not have a yellow square (in the Map Editor when you click the button which shows red and yellow squares), or it could be that you used !?OBtype/subtype; but used the wrong type or subtype for the object which your Hero visited, or it could be you used an &-1000 condition instead of a &1000 condition, or ... many other things.

The !?OB trigger will only work for objects which have yellow squares as shown in the Map Editor. Adding a yellow square to an oak tree with the TR:E command during a game will not create a visitable object. There is a tutorial in ERM Help which goes through the process of creating a visitable object via ERM commands step by step.

Probably none of that has anything to do with your actual problem, but you asked what could be wrong, and those are some things which could be.

It might help to copy and paste your complete script here, and describe what object you used. It could be some typo which you haven't yet noticed, or it could be that you used !?OBx/y/L; but the x/y/L coordinates are not the coordinates of the object's yellow square, or it could be that the object does not have a yellow square (in the Map Editor when you click the button which shows red and yellow squares), or it could be that you used !?OBtype/subtype; but used the wrong type or subtype for the object which your Hero visited, or it could be you used an &-1000 condition instead of a &1000 condition, or ... many other things.

The !?OB trigger will only work for objects which have yellow squares as shown in the Map Editor. Adding a yellow square to an oak tree with the TR:E command during a game will not create a visitable object. There is a tutorial in ERM Help which goes through the process of creating a visitable object via ERM commands step by step.

Probably none of that has anything to do with your actual problem, but you asked what could be wrong, and those are some things which could be.

The object is visitable and the coordinates should be right - horizontal: 8 and vertical: 6 yeah, the yellow square. Here is the code i used:
ZVSE
!?OB8/6/0;
!!IF:M^{You gaze upon the small cottage for one last time.}^;

Quote:Adding a yellow square to an oak tree with the TR:E command during a game will not create a visitable object.

In Shining Force, lumber mill quest (Granseal scripts) I added oak trees, changed to yellow square and was able to chop (visit) them.

Quibble: oak trees are type 135, not type 199, but you're right. The ERM Help tutorial says to place a Sign object (which has a yellow square) which looks like a tree (or some other object) with the UN:I command, but maybe that was only to save the step of adding the yellow square manually with TR:E. I tried putting a yellow square on an empty tile to make an exit for the Labyrinth in "300" and that didn't work - I had to use an invisible Sign. Since then I have only used objects which had yellow squares (with disguises).

I guess the actual rule is to place a yellow square on an object, not a bare tile. I stand corrected.