Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: ERM help and discussion
Thread: ERM help and discussion This Popular Thread is 407 pages long: 1 50 100 ... 123 124 125 126 127 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 07, 2011 08:55 PM

Thanks, but how is supposed to work with active hero?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 07, 2011 08:55 PM

Thanks, Bersy, I will add that excellent information to the 3.58f ERM Help in my next update.

Speaking of updates:  I have XFile video-playing working on an XP machine now.  I didn't have to change the XFiles DLL, but I had to change the machine's sound settings using Control Panel/.../Device Manager/Sound, video, and game controllers/... - it was the game audio controller that had some software interference, I think.  (I can't hear any difference in sound quality under the setting which works, but my ears are not the best.)

I will revise the DLL, to take out the annoying error beeps, and write something about what to do if trying to play a video hangs the game - once I determine exactly which of my changes were necessary.  XFiles will probably be updated tomorrow, as struggling through Windows menus has worn me out - like mud-wrestling with a pig.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 08, 2011 06:42 AM

Quote:
The algorithm is so simple that I believe even ERM can handle it .

In normal script languages you could just allocate a table and the problem is gone, but here you need to try harder.


You can also do a table look-up in ERM, using indexed variables, as described in the ERM Help.  ERM is Turing Complete - any computation which can be done in any computer language can be done in ERM (e.g., calculate pi to 1000 decimal places) - given enough time.  That is not what it was designed for, of course,  but it can do complex tasks such as fractal terrain generation, a poker game simulation, and a battlefield chess game.

To each his own.  No one will ever dislike ERM as much as I dislike C++, though.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted December 08, 2011 11:49 AM

Quote:
but how is supposed to work with active hero?


The function takes two arguments: level and ?exp for this level.
So you get level of active hero, add 2 and obtain exp for this [level+2].

Quote:
No one will ever dislike ERM as much as I dislike C++, though.
Absolutely agree.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 10, 2011 09:17 PM

I have updated XFiles, adding a new method of displaying videos on a Heroes screen.  It turns out the safest way to do this is to play the video and audio portions separately, after splitting a video+audio file into video-only and audio-only.  I used VirtualDub to edit videos this way (see instructions in the text file enclosed in XFiles.zip).  With this method I can do all the test map demonstrations on both a Windows 7 computer and an XP computer.

XFiles can be downloaded at http://www.box.com/s/1n069e3vc5vixc8l1zk5 .

Merry Christmas to everyone.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 11, 2011 04:05 AM
Edited by Salamandre at 04:13, 11 Dec 2011.

I got open media error v3=4, so media did not play and told file is not in right location. First I thought some error in file name but then I saw you added two videos. For the second I get error = 7 if I change name in script. I tried both normal and WIN 98 compatibility, same issue...

I have a question:

How to store all combat stats (A, D, M, E, N, P, S) of 8 creatures in a single loop? Is it possible? How to script that the variable storing next stat, then next creature, is changing to next variable at each loop?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 11, 2011 04:43 AM
Edited by JimV at 04:56, 11 Dec 2011.

Quote:
I got open media error v3=4, so media did not play and told file is not in right location. First I thought some error in file name but then I saw you added two videos. For the second I get error = 7 if I change name in script. I tried both normal and WIN 98 compatibility, same issue...

The first file which is opened is the video file, cutekitty.avi.  Error three means that the open command failed, for some reason.  It could be that a user typed the wrong file name, but that isn't the case here.  My guess is the reason is that you don't have a codec for that video.  You can check this with GSpot, or by trying that file in avitest, which displays the MCI error text.  Xvid will give you a codec for the video if you don't have it.  If you extracted the Data files into Data there is no reason that the file names should be wrong.  I extracted XFiles into my XP Heroes folder and everything wound up in the right place.  You should not have to change anything in the script to display the demonstration.  If you switched file names from what is in the script, that would explain the subsequent error 7.  Error 7 means the MCI command to position a child window failed.  There is no window for an audio-only file, which cute-kitty.wav is.

Quote:
How to store all combat stats (A, D, M, E, N, P, S) of 8 creatures in a single loop? Is it possible? How to script that the variable storing next stat, then next creature, is changing to next variable at each loop?


You will need to use indexed variables.  First you must allocate a range of consecutive v-variables which is 7x8 = 56 in number, such as v1000-v1055.  Then if the DO is for x16=0 to 7, the index to the first stat in each set of seven stats will be 7*x16 + 1000.  That is, the first series will start at v1000, the second at v1007, the third at v1014, and so on.

... within the DO function:

!!VRy1:Sx16*7+1000; index to first stat (A)
* get A value and store it in vy1 (v1000 for x16=0, v1007 for x16=1, etc.)
!!BMx1:A?vy1; assumes x1=stack number

Then add one to the index to get the index to the second stat (D):

!!VRy1:+1; index to D-value
!!BMx1:D?vy1; store D in v1001 for x16=1, v1008 for x16=2, etc.

Then add one again to get the index for the third stat (M?).  If you are storing both spell number and duration, then there are 8 stats not 7, and my numbers above will change:  56-->64, the second set will start at v1008 not v1007, the index starts at x16*8+1000, etc.  I will assume for now there is only one M-stat.

And so on, for the rest of the stats.

The reverse process would be used to restore the stats.  Get the index in y1 for A, and do !!BMx1:Avy1;, etc..

Update - I see I didn't give enough thought to the stack number.  That also has to vary in some regular way.  For example, if the stack numbers are 0 to 7, then the stack number = x16.  If they are 21-27, then the stack number = x16+21 (for DOxxx/0/7/1).

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 11, 2011 04:54 AM
Edited by Salamandre at 04:55, 11 Dec 2011.

Thanks, I was close but still too far away. Will try!

The video plays as it is. Is in game that does not play.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 11, 2011 05:11 AM
Edited by JimV at 05:14, 11 Dec 2011.

Quote:
The video plays as it is. Is in game that does not play.


(There were numerous typos which I edited in my last post plus an update added at the end.)

What did the error text from avitest.exe say, or does the video play okay in avitest?

Maybe there is some difference between Era 1.9+ and the Era 1.8 and WoG 3.58f+Era1.8(1) versions which I tested under, in regard to playing videos, although I don't understand why that would be.  I don't need to use any compatibility settings on either of my machines when playing the video and audio separately (simultaneously).  My XP machine has Service Pack 3 installed, as I recall.  I am using the HD executable, so I could test in both full-screen and reduced-window modes.  I think I tried the non-HD (full-screen only) executable in earlier tests, but haven't done so recently.

Update - the non-HD (h3wog.exe) plays the video okay on my Windows 7 machine.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 11, 2011 06:03 AM

L(i) = L(i - 1) + [1.2 * (L(i - 1) - L(i - 2))]

if not rounding, there would be a nice formula:

L(i) = 15500 * 1.2^(i - 11) + 2000, starting with level 13

For example, L(14) = 15500 * 1.2^(14 - 11) + 2000 = 15500 * 1,728 + 2000 = 28784.

Alas, for higher levels we will have small errors. For 30 level it's about 1000 XP.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 11, 2011 06:28 AM

Just checked. The error is around 230 XP for 30 lvl, but anyway I don't know if ERM can handle 1.2^x function ..

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 11, 2011 02:36 PM

AlexSpl has used an interesting mathematical trick which I think comes from the field of Numerical Analysis:  the fact that difference equations can be solved in ways similar to differential equations.

ERM does not have an exponentiation operator, so an exponentiation function would have to be written, similar to what is done in the C language.  The simplest method would be to use a DO loop for repeated multiplications.  Under ERA, an exponentiation function could be called from a system DLL.

I still think the easiest way to get a Hero from level A to level B is not to calculate the experience points for level B and then apply them, but to add some increment to the Hero's experience points in a DO loop, until the Hero reaches the required level.  As the Hero reaches the points for level A+1, A+2, etc., the Heroes program will give the Hero a level promotion, and display some screens for the player to click through - but the same thing will happen if the Hero is given the final value for B directly.  That is, Heroes will still make the player click through all the level promotions from A+1 to B.

@Salamandre:  another wild thought occurred to me, as to a possible difference between our systems.  Perhaps the codec which is required to play the video is already being used for something else you are doing on your system, and is locked for that use, during Heroes.  Such as, playing some special background music - not very likely, but a way to test for this would be to use VirtualDub or some other program to make an uncompressed version of the video, so that no codec is required for it.  (If the uncompressed version had a different file name, the ERM script would have to be edited to use that name, of course.)

I thought of adding VirtualDub to XFiles, since the VD zip file is 1.3 MB, whereas the two files made from the original video are 0.5 MB (video only) and 2.9 MB (audio only) - so it would be a smaller download to have the user do the processing.  But of course this would be more work for the user, and might violate re-distribution rights, so I didn't.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 11, 2011 06:41 PM
Edited by Salamandre at 22:49, 11 Dec 2011.

Of course it wasn't used by other programs, that was the first check I made. I will try to uncompress it and see.

I was able to get one level at time, but it may take a while if hero is high level, so some level adjustments should be done:

!?LE0/0/0;
!!IF:V17/0;
!!HE-1:Ed50000; <-[adjustments here]
!!SN&-17:G1; call again until level up

!?HL-1;
!!IF:V17/1;
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted December 12, 2011 01:50 PM

Why not:

!?FU99999;
; x1 - level
; ?x2 - exp (don't use y-vars in get syntax)
!!UN:J1/?y1/d J1/12/?y2 J1/x1/?y3 J1/y1/?y4;
!!VRx2:Sy3;
!!VRx2&x1<=12:E;
!!VRx2:Sy2;
!!VRy4:S13;
!!UN:J1/y4/?y5; #5
!!VRx2:+y5;
!!VRy4:+1;
!!SN&y4<=x1:G5;
!!UN:J1/y1/?y5;

!?[Your trigger];
!!HE-1:E?y1/y2;
!!VRy2:+2; increase hero level by two
!!FU99999y2/?v2;
!!VRv2:-y1;
!!HE-1:Edv2; level up...

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 12, 2011 05:01 PM
Edited by Salamandre at 17:12, 12 Dec 2011.

Thanks, but there is a typo? !!VRx2[...]:E; (FU:E?)
And the hero levels are reseted back to 0 when trigger event. The additional levels are working fine, but from 0 only. It was supposed to work like this?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted December 12, 2011 06:13 PM

Yes, typo.
Please, show your full code.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 12, 2011 06:15 PM

!?FU9999;
; x1 - level
; ?x2 - exp (don't use y-vars in get syntax)
!!UN:J1/?y1/d J1/12/?y2 J1/x1/?y3 J1/y1/?y4;
!!VRx2:Sy3;
!!FU&x1<=12:E; **modified because typo?
!!VRx2:Sy2;
!!VRy4:S13;
!!UN:J1/y4/?y5; #5
!!VRx2:+y5;
!!VRy4:+1;
!!SN&y4<=x1:G5;
!!UN:J1/y1/?y5;

!?LE10/10/0;
!!HE-1:E?y1/y2;
!!VRy2:+2; increase hero level by two
!!FU9999:Py2/?v2;
!!VRv2:-y1;
!!HE-1:Edv2;

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted December 12, 2011 07:14 PM

typo, !!HE-1:E?y1/?y2;

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 12, 2011 07:56 PM



Got it to work.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 17, 2011 04:40 AM
Edited by Salamandre at 04:41, 17 Dec 2011.

Some strange thing happens to me:

!?OB0/0/0; [is a monster]
!!HE-1:A2[...] (check for artefact)

!?BA0&v998=0/v999=0/v1000=0;
!!BM21:H50 S25; **will not work
!!BM21:U1/3000 U2/3000; **will not work
!!EA-22:B13/1/119/58/1/1/1/1/1/1/1/1/1/1/1;immunity **will work

Now, if I remove the object visit:

!?BA0&v998=0/v999=0/v1000=0;
!!HE-1:A2 (check for artefact)
!!BM21:H50 S25;
!!BM21:U1/3000 U2/3000;
!!EA-22:B13/1/119/58/1/1/1/1/1/1/1/1/1/1/1;immunity

all work. So why BM commands get lost if the !?OB on? Same if I use them in !?BF


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This Popular Thread is 407 pages long: 1 50 100 ... 123 124 125 126 127 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.4529 seconds