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 ... 138 139 140 141 142 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted March 09, 2012 07:17 PM

Thanks, there was a typo !!FU&y=8<0:E; which I fixed, the script calculates well the cost for all, but does not upgrades them when click on. Also the option "train all" remains visible when there is nothing to train also. I think you are very close, thanks a lot.
____________
Era II mods and utilities

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


Responsible
Supreme Hero
posted March 09, 2012 09:57 PM
Edited by JimV at 04:33, 10 Mar 2012.

Thanks for the debugging.  If you don't mind, I'll let you continue to do that, since you must have a map you can test with, and I would have to create one.  My previous post has been edited with these changes:



!!VRz8:S^Train all the above for  %V307  gold.^;  JHV
was changed to:

!!VRz8:S^Train all the above for  %V307  gold.^;  JHV
!!VRz8&v307<1:S^^; JHV

so that the "train all" option won't appear if there are no troops which can be trained.

!!DO510/y-10/y-10/1&v1<>128:P300;   JHV
!!DO510/y-10/y-10/1&v1=128/y1>=v307:P300;  JHV

was changed to:

!!DO510/y-10/y-10/1&v1<>128:P300;   JHV
!!DO510/0/6/1&v1=128/y1>=v307:P300;  JHV

(I copied the command to edit it but forgot to change the DO parameters.)

This should get past the initial bugs (but perhaps on to new ones).


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


Admirable
Omnipresent Hero
Wog refugee
posted March 09, 2012 10:05 PM

Hard to get it working
I can't really test it because it gets on endless loop and can't close the dialog to check results.

What it does:

I have two stacks, pitlords and demons, pits at adept level, demons at elite. I click "train all", it shows pits being upgraded picture, and then it shows power lich picture (which I don't have), and can't get out from there.


____________
Era II mods and utilities

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


Responsible
Supreme Hero
posted March 09, 2012 10:10 PM

Second edit -  moved these two lines from the end of FU510 to the end of FU509:

!!UN:R3/-1;
!!FU509:P;



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


Admirable
Omnipresent Hero
Wog refugee
posted March 09, 2012 10:18 PM

Wonderful, thank you. I will test it more deeply now with several stacks, but seems it is fully operational.
____________
Era II mods and utilities

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


Responsible
Supreme Hero
posted March 09, 2012 10:19 PM

Thanks, I have to go out again to have an early supper with the tennis gang, so I'll be offline for another couple of hours but will check again when I get back.

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


Promising
Famous Hero
of infamy
posted March 10, 2012 03:52 AM
Edited by Kegolo at 04:04, 10 Mar 2012.

So I want my creature (207 in the script) to gain an ability only when attacking flying troops. I've tried adding flags as well as abilities with EA:B but nothing is working. I'm triggering when I click on an enemy unit when using creature 207, can this work?

!?CM4;
!!CM:S?y1 D?y2; [Get type of click and position of click]

!!BG:N?y3; [current creature stack]
!!BMy3:T?y4; [creature type]
!!FU|y4<>207/y1<>12:E; [exit if not an AA wraith]
!!BMy3:I?y5; [get side of creature]
!!EA207&i>0:B0/0/////////////;  [has death blow never]
!!DO1341/0/20/1&y5=1y2;  [Run through all creature stacks on p1 side]
!!DO1341/21/41/1&y5=0y2; [Run through all creature stacks on p2 side]

!?FU1341;  [function to check enemy unit for flying, give AA wraith ability]

!!BMx16?y2; [position of stack]
!!VRy3:Sy2-1; [take care of double hex units]
!!FU&x1<>y2/x1<>y3:E; [break if stack position not clicked position]
!!BMx16:F?i;  [creature flags to i]
!!VRi:&1;     [check if double hex]
!!FU&x1=y3/i<>1:E; [break if clicked hex in front of unit but not a double hex]
!!BMx16:F?i;  [creature flags to i]
!!VRi:&2;     [0 if not flying, 1 if is flying]
!!EA207&i>0:B0/1/101/61/1/1/1/1/1/1/1/1/1/1/1;  [has death blow always]

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


Admirable
Omnipresent Hero
Wog refugee
posted March 10, 2012 04:20 AM

Yes, creature was converted to battle stack, you need EA-1->EA-42
____________
Era II mods and utilities

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


Responsible
Supreme Hero
posted March 10, 2012 04:24 AM

Minor points:  the variable "i" seems to be used before it is set, and the BU:E command can be used with the hex number from CM:D to get the stack number of a living stack, without having to test all 21 stacks.

When scripting the "Brutal Warrior" Hero specialty for the JS Project, I tested the EA:B deathblow and abandoned it in favor of a direct doubling (and at higher levels, tripling) of damage under the MF1 trigger, because setting the probability of a Death Blow to 100% only produced DB's about 50% of the time.  (The standard EA:B Death Blow as used for example by Horned Demons uses a percent probability at each creature experience level.)  So I concluded the Death Blow routine has a built-in limit which does not go above 50% occurrence, or thereabouts.  (Under MF1 the DB sound and BM:V animation can be produced, so the player can not tell the difference.)

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


Promising
Famous Hero
of infamy
posted March 10, 2012 06:31 PM

Quote:
Minor points:  the variable "i" seems to be used before it is set, and the BU:E command can be used with the hex number from CM:D to get the stack number of a living stack, without having to test all 21 stacks.

When scripting the "Brutal Warrior" Hero specialty for the JS Project, I tested the EA:B deathblow and abandoned it in favor of a direct doubling (and at higher levels, tripling) of damage under the MF1 trigger, because setting the probability of a Death Blow to 100% only produced DB's about 50% of the time.  (The standard EA:B Death Blow as used for example by Horned Demons uses a percent probability at each creature experience level.)  So I concluded the Death Blow routine has a built-in limit which does not go above 50% occurrence, or thereabouts.  (Under MF1 the DB sound and BM:V animation can be produced, so the player can not tell the difference.)


Decided to do it your way, works now thanks. Is there a way to change the damage using MF1 and the message log gets it right? I'm doing  double damage and it seems like a lot of work to change the whole message log thing using MM...

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


Responsible
Supreme Hero
posted March 10, 2012 07:28 PM

I tried several variations of using MF:D and MF:F but always got the same damage message, so I wound up disabling the message entirely.  This satisfied me at the time, but there are other possibilities which I might pursue in the future.  The message is of the form "The %s do %d damage." so it should be possible to intercept the %d value somewhere.

In this script, all the troops of a Brutal Warrior have a chance of doing a Death Blow, except for Arrow Towers and Moats.  The chance varies with the BW's level.

!#UN:C6970820/4/?v2; read address at 6A5DC4
!#VRv2:+44; 2Ch offset 0
!#UN:Cv2/4/?v354;
!#VRv354:+16530; offset 1 to first string of GENRLTXT, plus offset to damage string
!#VRv355:Sv354+26; 2nd damage string
!#UN:Cv354/2/?v4; first two bytes "Th" = 54 68 = 6854h = 26708
!#IF&v4<>26708:M^Error - GENRLTXT message not found - results unpredictable.^;

!?GM0;
!!UN:C6970820/4/?v2; read address at 6A5DC4
!!VRv2:+44; 2Ch offset 0
!!UN:Cv2/4/?v354;
!!VRv354:+16530; offset 1 to first string of GENRLTXT, plus offset to damage string
!!VRv355:Sv354+26; 2nd damage string
!!UN:Cv354/2/?v4; first two bytes "Th" = 54 68 = 6854h = 26708
!!IF&v4<>26708:M^Error - GENRLTXT message not found - results unpredictable.^;

!?MF1&29; stack about to take physical damage
!!UN:Cv354/2/26708;
!!UN:Cv355/2/26708;
!!MF:F?v4 N?v5 W?v6; corrected damage, stack number, type of shooter
!!FU|v5<>v376/v6<>0:E; Exit if wrong stack or shooter is Arrow Twr or Moat
!!VRv1:C3/5/10;
!!VRv5:Svv374; % chance of Death Blow
!!VRv6:S0 T99;
!!FU&v6>=v5:E; no go for Blow
!!VRv1:C20/25/30;
!!VRv5:Svv374; Damage factor numerator
!!VRv6:Sv4*v5+5:10;
!!MF:Dv6 Fv6; [battle damage message does not chg w/F, try D][no effect]
!!VRz-5:S^Burning with battle lust, your troop launches a {Death Strike}!^;
!!BU:Mz-5;
!!VRz-6:S^DEATHBLO.WAV^;
!!SN:Pz-6;
!!BMv376:V73;
!!UN:Cv354/2/32; blank 0 = 20h 00
!!UN:Cv355/2/32;

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


Adventuring Hero
Outcast Fire Witch
posted March 11, 2012 05:42 AM

When enemies have a level-up, I didn't want them to have some secondary skills. For example, when gain new level, Aine never learn Resistance (only Resistance, she can learn other skills). I banned Resistance from "SSkill" in Map Spec box, but I used Hidden Skill script so this skill still can be learnt. !?HL script banned all skills when level up. What is the way to ban only one skill?
____________
My HoMM3 Maps
Sorry for my bad English.

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


Responsible
Supreme Hero
posted March 11, 2012 06:41 AM

You can make a custom version of the Hidden Skills script which will never choose Resistance.  For an example, see the Hidden Skills script in "The Dragon Slaughter", which does not offer Scholar (Scholar is only given as a special event within the game).  The TDS Hidden Skills script disables Scholar for all Heroes, but you could test the current Hero number and ban Resistance for only one or some Heroes, if this is what you want.

If you do this you will probably have to disable wogification, to avoid interference with the WoG Hidden Skills functions, which means all WoG scripts which you want to use would have to be added to the map as Timed Events.  An alternate method would be to disable the WoG Hidden Skills (!#UN:P124/0;) and change the function numbers to Unclaimed numbers in your custom version.  Then you could allow wogification without interference.

Display of Hidden Skills is also handled by the TDS custom version (a copy of the WoG version).  The WoG version of this can be disabled by !#UN:P182/0; - or else you could leave this part out of your custom script and use wogification to let the WoG version handle the display (and switching) of skills.

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


Promising
Famous Hero
of infamy
posted March 11, 2012 07:29 AM
Edited by Kegolo at 07:35, 11 Mar 2012.

So a while ago I was trying to edit text files in this thread
http://heroescommunity.com/viewthread.php3?TID=36017

but now I've come to two strings, Elementalist and Planeswalker, that are not in UX_S.txt but I would like to change these types of heroes on the fly using ERM. I'm surprised hero types aren't in the file, is there a way to add them, or a different way to change the type of a hero somehow with HE:B2 and some memory editing?

This is as far as I've gotten, but the memory address doesn't work out with UN:C


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

Tavern Dweller
posted March 12, 2012 05:59 AM

Quote:
Quote:
Can you tell me how to import my own script into the WOG options instead in a Timed Event in the map please?


Quote:

I saved my script like you said but it had no effect.
I saved a script97.erm and ... nothing happens.


There have been one or two other instances of this reported, and I vaguely recall that it happened to me when I first started to do ERM scripts.

First, if you want to add a script to the WoG Options menu, you must read the text file "How to Edit Zsetup Files" which is located in Data/Text Resources Copy.  (It also mentions the use of .ers files as an alternative to editing Zsetup files.)

That file states that script numbers up to 99 can be used (in WoG 3.58f), but maybe in some early versions of WoG that limit was lower - just a guess.  Anyway, try this:  open the file Data/s/script40.erm in the Script Editor and paste your test script at the end of it (your ZVSE line will not be needed as part of the paste), and resave it.  Then wogify a map and see if your script is now active.  (It should be.)

thak u so much
i have done it
one more question
can i create a trigger which has condition : owning player is ...
how about condition string?
i don't know how to use it :-S
pls help me

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


Responsible
Supreme Hero
posted March 12, 2012 04:03 PM
Edited by JimV at 04:01, 13 Mar 2012.

RE:  use of "conditionals" (&):

The short answer is to read ERM Help.  The tutorials give examples of using conditional statements, and the "Flags and Variables" section gives a definition of them which I will copy and paste below.  Unfortunately, it is in English which is probably not your native language, but since it is my native language, I don't think my words would be any clearer, and I would only be repeating what I learned from ERM Help myself.

As to your specific question of using conditionals to check something about an owner, I am sure what you want to do can be done, but I do not understand all the details of what you want to do, so would only be guessing if I tried to offer an example for it.

Quote (from ERM Help):

Using Conditional Flags

The most common use of a flag is to control whether or not a piece of ERM code (such as a trigger or receiver) executes under certain conditions in the game. For example, if you want a map object to display a message the first time any hero visits it but never after, you could use a flag for this purpose; it would display the message if the flag was false (not set) and a following command would then set the flag to true (1) so that next time the object was visited, no message would be displayed.

The symbol for indicating a flag (or variable) test is the ampersand (&) which is placed immediately prior to the colon of a receiver statement, or prior to the semicolon of a trigger statement. The ampersand is immediately followed by the flag number used for the test. If a test for a true flag (a flag that has been set to 1) is made, the number alone is used. If the test is for a false flag (not set, or set to 0), a negative sign is placed in front of the number. So to test if flag number 5 is true, you would use &5, and to test if flag number 5 is false, you would use &-5.

Example of code:

ZVSE
!?OB10/14/0;  [object at x=10,y=15,level=surface is visited by a hero]
!!IF&-5:M^Come in. I have been expecting you.^;  [display if flag 5 is false]
!!IF:V5/1;  [set flag 5 to 1 (true)]

Checking Multiple Flags

At times, you may want to check for more than one conditional flag (or variable). To do this, separate each subsequent number with a slash (/). When there are multiple flags or variables to test for, ALL conditions must be met before the statement executes. For example, if you were testing for flag number 7 being true, flag 8 being false and flag 10 being true, then if even one of those flags had a different value, the statement would not be carried out.

Example of code:

ZVSE
!?OB10/14/0;  [object at x=10,y=15,level=surface is visited by a hero]
!!IF&7/-8/10:M^Come in. I have been expecting you.^;
[The above message is displayed only if flags 7 and 10 are true and 8 is false]

Initializing Flags

While all flags initially begin as "not set" (i.e., value of 0 or false), flags 501 to 1000 will retain their last value when you begin a new map (or the same map over) without first quitting and restarting the Heroes game. This is so they can be used for making campaigns in which you want certain flag values to carry over to the next map in the campaign. If you wish to avoid potentially having flags that aren't set to 0 at the start of a game, either stick to using flags 500 and below or initialize to 0 at the start of your map or script (with IF:V statements) all flags that you wish to use.

Special Flags
There are several flags that have special significance in the game.

Flag 1 is used by certain commands to return a result and will also return the result of a conditional check of values (see below). Therefore, it's a good idea to never use flag 1 for any long term storage. Or to be safe, don't use it at all and stick to higher numbered flags.

Flag 996 is automatically cleared (set to False) when any !!LE command executes and is set to 1 (True) if there is no Placed Event at the location specified by the LE command (you know that a Placed Event is removed after usage sometimes).

Flag 997 and 998 are set as follows:

Flag 997 returns the MP state of a battle.
=0 (False) if we have a local battle
=1 (True) if we have a network battle

Then if Flag 997=1, then Flag 998=0 if an AI attacks a Human player at a distant PC. Note that the battle here runs at only ONE PC, but this PC is a distant one for the current active PC.
Flag 998=1 if we have a Human vs Human battle. Here we have a real MP battle.

Conditional Statements with Variables

Like flags, you can use the value of one or more variables to determine if a statement (trigger or receiver) executes. And in fact, the syntax is similar. However, instead of putting the flag number (with or without a minus sign in front of it), you would put the name of the variable followed by a comparison symbol (=, >, <, <>, >=, or <=) and the number (or variable) you wish to compare it with.
Example of conditional statement, comparing v1 to see if it's greater than or equal to the number 7, and if it is, a message is displayed:
!!IF&v1>=7:M^You were wise to make that choice, hero!^;

Example of conditional statement, comparing the text stored in the z1 string variable to the text stored in the z2 string variable, and if it's the same displaying a message:
!!IF&z1=z2:M^So, you're the one!^;

Checking Multiple Variables

This is accomplished in much the same way as checking multiple flags, by separating subsequent variable tests with the slash symbol (/). In fact, you can freely mix and match checks for flags and variables in the same statement, as in the following example that gives the current hero the Armour of Wonder artifact, but only if certain conditions are fulfilled (flags set and variables with specific values): !!HE-1&7/v2>6/-1/y4=v8:A31;

In the above example, the following conditions must be true before the statement executes and gives the hero an artifact:
1. Flag 7 must be true (set to 1);
2. The v2 variable must currently store a value  of 7 or higher;
3. Flag 1 must be false (set to 0 or not set);
4. The y4 variable must currently store the same value as the v8 variable.

Only if ALL four of these conditions are true will the hero be given the artifact.

Checking syntax - OR conditions.: |
!(!|?|#)XX&c1/c2/c3|c4/c5/c6:...;
Full condition is: (c1 AND c2 AND c3) OR c4 OR c5 OR c6
Comments.
- OR section may be alone or only after AND section
- if there is only OR section, full condition will be true if at least one OR condition is TRUE
- there may be up to 16 AND conditions and up to 16 OR conditions

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


Promising
Famous Hero
feanor on DF2.ru
posted March 13, 2012 09:09 PM

Quote:
So a while ago I was trying to edit text files in this thread
http://heroescommunity.com/viewthread.php3?TID=36017

but now I've come to two strings, Elementalist and Planeswalker, that are not in UX_S.txt but I would like to change these types of heroes on the fly using ERM. I'm surprised hero types aren't in the file, is there a way to add them, or a different way to change the type of a hero somehow with HE:B2 and some memory editing?

This is as far as I've gotten, but the memory address doesn't work out with UN:C


Pointer to array of hero class - 67DCEC (by default contains 67Â86Ñ). Size of hero class struct - 0x40, pointer to class name - 2nd dword.

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


Promising
Famous Hero
of infamy
posted March 13, 2012 09:15 PM

Quote:
Quote:
So a while ago I was trying to edit text files in this thread
http://heroescommunity.com/viewthread.php3?TID=36017

but now I've come to two strings, Elementalist and Planeswalker, that are not in UX_S.txt but I would like to change these types of heroes on the fly using ERM. I'm surprised hero types aren't in the file, is there a way to add them, or a different way to change the type of a hero somehow with HE:B2 and some memory editing?

This is as far as I've gotten, but the memory address doesn't work out with UN:C


Pointer to array of hero class - 67DCEC (by default contains 67Â86Ñ). Size of hero class struct - 0x40, pointer to class name - 2nd dword.


Ah. OxFEA I figured you would come to the rescue. My hex editing skills have softened since I last did this, could you give me an example how to change a hero class to a z variable or something along these lines? Or how to add 2 more rows to edit with HE:B2?

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


Promising
Famous Hero
posted March 14, 2012 05:18 PM

Here's the function. It takes two parameters: first one is class number, second: number of z var (z letter not needed). Keep in mind, that opening a map which doesn't use your new class names after playing your map will not restore original names.

!?FU99999;
!!UN:C6806764/4/?v1; 67DCEC -> table of heroes
!!VRy1:Sx1 *64 + v1 +4; calculate pointer to class name
!!VRy2:Sx2 -1 *512 +9597928; calculate address of Z var
!!UN:Cy1/4/y2; write new pointer
____________

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


Promising
Famous Hero
of infamy
posted March 14, 2012 10:19 PM

Quote:
Here's the function. It takes two parameters: first one is class number, second: number of z var (z letter not needed). Keep in mind, that opening a map which doesn't use your new class names after playing your map will not restore original names.

!?FU99999;
!!UN:C6806764/4/?v1; 67DCEC -> table of heroes
!!VRy1:Sx1 *64 + v1 +4; calculate pointer to class name
!!VRy2:Sx2 -1 *512 +9597928; calculate address of Z var
!!UN:Cy1/4/y2; write new pointer


Thank you! And yes the way I am replacing the Conflux if you want to play them again after playing the Covenant you would have to restart the  exe

 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 ... 138 139 140 141 142 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.6724 seconds