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 150 200 250 300 ... 350 351 352 353 354 ... 400 407 · «PREV / NEXT»
Donach
Donach

Tavern Dweller
posted May 21, 2018 09:12 PM

RerryR said:
Donach said:
Hello guys,
I am new to ERM and could use your help, please.

I am trying to achieve quite simple thing.

On battle start, take all unit types hero has on him (say 3 different units, each unit only 1 units on it), and make that unit into 100 units for the battle.

Then, if the unit survives, set the number of that unit to 1 only again.

I am able to do it "statically", meaning using this:
!?BA0; // at start of battle
!!BA:M0/0/0/100; // set 100 pikemans on position 0 of attacking hero

How can I achieve similar thing, but dynamically for each different unit?

Thank you.

PS: Would you recommend any specific tutorials, guides? I am using the "http://www.wakeofgods.com/erm_help/", but to me, it seems like there is a lot of missing, or sometimes its just not descriptive enough.


Hi,
not the easiest ERM code to begin with. But I'll help you with the basic code that i would use. Remember there are often several ways of achieving what you want. Just stick to ERM Help. It has all the information you need. It's also very helpful to open already existing scripts (in WoG folder) and start playing with the numbers and see what happens. Once you changed something you can press F12 ingame to apply changes.


you can try this:

ZVSE

!?BF&1000; *at battle start
!!IF:M^Set all Creatures to 100 at beginning of battle^; *Show Message ingame
!!DO21693/0/41/1:P; *Run Fkt.Nr. 21693 42 times. The code now jumps to the function

*New Trigger*
!?BA1&1000; *At battle end
!!IF:M^Set all Creatures to 1 after battle^;
!!DO21694/0/6/1:P; *Run Fkt.Nr. 21694 7 times. (For all hero slots)


!?FU21693;
!!BMx16:N100;


!?FU21694;
!!HE-1:C0/x16/?y1/1;
*End Code*

From ERM help:
The x16 variable (used in functions called with the DO Receiver), stores the current cycle number of the function. For example, if the function is being repeated 12 times (from 1 to 12), the first time through, x16 will equal 1, the second time 2 and so on. If you change the x16 variable, you can actually "speed up" or "slow down" a function loop, or even exit from it completely by setting x16 equal to the end value (or higher) that was specified in the DO receiver.

This script will work in any battle and with any hero. So whatever you want to archive you have to set some constraints for the code. For example to only work with certain heroes or specific battles.


Hello,
Thanks for your help.
I tried the script, however, the second part does not seem to work. I see that you are using the "y1" variable for the monster type, however, how can I get it?

Right now, the number of creeps is correctly set to 100 at start, when battle ends, whetever creatures are left are staying at that number...

Thank you again for help.
____________

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


Admirable
Omnipresent Hero
Wog refugee
posted May 21, 2018 09:35 PM

Add to this:

!?BA1&1000; *At battle end
!!IF:M^Set all Creatures to 1 after battle^;
!!DO21694/0/6/1:P; *Run Fkt.Nr. 21694 7 times. (For all hero slots)

This:

!!UN:R1; redraw screen, heroes armies etc

Its just that you think it doesn't work because Rerry forgot to redraw screen.

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


Supreme Hero
Work at Magic Dimmension
posted June 20, 2018 02:56 PM

well it's more on plugins than scripting, but where in the code is part of casting adventure spells and where is part of casting damage spells. I wish to replace some boring adventure spells (i.e scuttle boat) with alternatives for existing damage spells but in another school of magic (now I use scripting with dialogs but it doesn't work as good  as I want).

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


Famous Hero
posted June 23, 2018 11:24 AM

1. Can anyone tell me what this function is doing? Please be specific.
FU$bit$y1;


2. What is flag 998?


Thank you.

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


Admirable
Omnipresent Hero
Wog refugee
posted June 23, 2018 12:59 PM

xericsin said:
1. Can anyone tell me what this function is doing? Please be specific.
FU$bit$:Py1;


It means nothing if the macro S@bit@ is not set before. Check MC in Erm help

xericsin said:

2. What is flag 998?


From erm help:

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
If Flag 997=1, then Flag 998=0 if an AI attacks a Human player at a remote PC.
Note that the battle here runs at only ONE PC, but this PC is a distant one for the current

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


Famous Hero
posted June 25, 2018 12:40 PM

Good. That is helpful. Thanks.

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


Adventuring Hero
posted June 26, 2018 09:55 PM
Edited by DarkAtom at 16:45, 27 Jun 2018.

Not sure if this was ever asked before. I have a creature def that I want to use to replace another one in the game. It also has a shooting animation. Sure I can use !!MA:X to give that creature the ability to shoot, but the game always crashes because it doesn't have a projectile. Is there a piece of ERM code that will give the shooter a specific projectile


EDIT: Ok I found the solution after searching the Internet for a lot of time (about 5 hours):

!?FU3;
!!VRx3&x1=1/x2<2:S16;
!!VRx3&x1=1/x2>197:S16;
!!FU|x2<2/x2>197:E;

!!UN:C4446879/4/?y10;
!!UN:C4446867/1/?y11;
!!VRy10&y11=254:-2;
!!VRy10&y11=-2:-2;
!!VRx2:+y10;

!!UN&x1=0:Cx2/1/x3;
!!UN&x1=1:Cx2/1/?x3;

Still can't get beams though

EDIT 2: So it seems that the answer has always been right in this thread:
http://heroescommunity.com/viewthread.php3?TID=8288&PID=1459398#focus
Sorry because I didn't pay attention.

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


Admirable
Omnipresent Hero
Wog refugee
posted June 27, 2018 04:48 PM

Well, copying-paste a script from another mod will not do it, you still have to know where to change values, or your request doesn't say which creature ID. So lets assume it is the archangel (13)

!?PI;
!!FU6000:P13/5/24; mortar shoot

!?GM0;
!!FU6000:P13/5/24; mortar shoot

; FU6000:P[number_creature]/[missile type (0...15)]/[number_shoots];
!?FU6000;
!!MA:Nx1/x3;
!!MA:Xx1/?y1;
!!VRy1:|4;
!!MA:Xx1/y1;
!!VRx1:+7994814;
!!UN:Cx1/1/x2;  

Change 13 with your creature ID

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


Adventuring Hero
posted June 27, 2018 08:27 PM

Salamandre said:
Well, copying-paste a script from another mod will not do it, you still have to know where to change values, or your request doesn't say which creature ID. So lets assume it is the archangel (13)

!?PI;
!!FU6000:P13/5/24; mortar shoot

!?GM0;
!!FU6000:P13/5/24; mortar shoot

; FU6000:P[number_creature]/[missile type (0...15)]/[number_shoots];
!?FU6000;
!!MA:Nx1/x3;
!!MA:Xx1/?y1;
!!VRy1:|4;
!!MA:Xx1/y1;
!!VRx1:+7994814;
!!UN:Cx1/1/x2;  

Change 13 with your creature ID


Well, yeah, but luckily the mod also had the function call and all 3 parameters were explained well with comments.:)

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


Famous Hero
posted July 06, 2018 01:05 PM

How to get the exp rank of a stack in battle?

The closest I found in the erm help is this.
EA:E?x1/x2/x3/x4;

But the returned value is always the exp points, not rank.

How can I get or calculate the rank, please?

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


Admirable
Omnipresent Hero
Wog refugee
posted July 06, 2018 02:23 PM
Edited by Salamandre at 14:33, 06 Jul 2018.

In TEW4 you have a script which increases rank by 1 when you pay a fee, so I had to get rank each time (Jim Vogan courtesy). This is the part for get rank:

!!MA:Lv2/?y-6; [Monster level (0..6): y-6] (v2 monster ID)
!!VRy-6:+1; [Add 1 to monster level: y-6]
!!FU508:Py-6/v4/v2; [Get rank: y-20]

[Get rank of stack: y-20]
[x1=monster level (1..7), x2=current experience, x3=monster number]
!?FU508;
!!VRe1:S2 :5 +8; [e1=8.4]
!!VRy1:Sx2 :x1; [Base experience for level 1..7 creatures: y1]
!!VRy1&x3>=150/x3<=163:Sx2 :e1; [Base exp. for level 8 creatures: y1]
!!VRy-20&y1<1000:S0; [Rank 0]
!!VRy-20&y1>=1000/y1<2000:S1; [Rank 1]
!!VRy-20&y1>=2000/y1<3200:S2; [Rank 2]
!!VRy-20&y1>=3200/y1<4600:S3; [Rank 3]
!!VRy-20&y1>=4600/y1<6200:S4; [Rank 4]
!!VRy-20&y1>=6200/y1<8000:S5; [Rank 5]
!!VRy-20&y1>=8000/y1<10000:S6; [Rank 6]
!!VRy-20&y1>=10000/y1<12200:S7; [Rank 7]
!!VRy-20&y1>=12200/y1<14700:S8; [Rank 8]
!!VRy-20&y1>=14700/y1<17500:S9; [Rank 9]
!!VRy-20&y1>=17500:S10; [Rank 10]

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


Famous Hero
posted July 06, 2018 03:42 PM

Great! THanks

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


Admirable
Omnipresent Hero
Wog refugee
posted July 06, 2018 03:43 PM

Sorry, forgot to specify v4, here is the whole script again:

!!HE-1:C0/x16/?v2/?v3/?v4/2; [v2=type, v3=number, v4=exp]
!!MA:Lv2/?y-6; [Monster level (0..6): y-6] (v2 monster ID)
!!VRy-6:+1; [Add 1 to monster level: y-6]
!!FU508:Py-6/v4/v2; [Get rank: y-20]

[Get rank of stack: y-20]
[x1=monster level (1..7), x2=current experience, x3=monster number]
!?FU508;
!!VRe1:S2 :5 +8; [e1=8.4]
!!VRy1:Sx2 :x1; [Base experience for level 1..7 creatures: y1]
!!VRy1&x3>=150/x3<=163:Sx2 :e1; [Base exp. for level 8 creatures: y1]
!!VRy-20&y1<1000:S0; [Rank 0]
!!VRy-20&y1>=1000/y1<2000:S1; [Rank 1]
!!VRy-20&y1>=2000/y1<3200:S2; [Rank 2]
!!VRy-20&y1>=3200/y1<4600:S3; [Rank 3]
!!VRy-20&y1>=4600/y1<6200:S4; [Rank 4]
!!VRy-20&y1>=6200/y1<8000:S5; [Rank 5]
!!VRy-20&y1>=8000/y1<10000:S6; [Rank 6]
!!VRy-20&y1>=10000/y1<12200:S7; [Rank 7]
!!VRy-20&y1>=12200/y1<14700:S8; [Rank 8]
!!VRy-20&y1>=14700/y1<17500:S9; [Rank 9]
!!VRy-20&y1>=17500:S10; [Rank 10]

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


Famous Hero
posted July 08, 2018 12:47 PM
Edited by orc at 12:48, 08 Jul 2018.

Hello,

I want to modify script from adding % value to adding constant value. this is HBS script 39 (ERA II)

!!VRw30:Sv428*3+12;      //Additional percent to HP = 12+3*level of hero

so how do I make it: New HP = Old HP + 1 + (HeroLevel/2); (in other words how to get ridof %??)

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


Famous Hero
posted July 13, 2018 07:28 AM
Edited by xericsin at 07:38, 13 Jul 2018.

@orc,

There is no direct way of doing that.

You have to change the other part of the existing script, in order to change the way to apply bonus.
OR
You can calculate the equivalent percentage of the bonus you want.

----------------------------------------------------------

I need pros to tell me this, please:

Can we get the dwarf style magic resistance chance of a stack on the battlefield?

It is tedious if I manually check the creature type, magic aura, experience abilities, hero secondary skills.

Edit:
The closest ERM I found is this:

Dwarf-style Magic Resistance
!?MR2; will work out when the game calculates dwarf-style magic resistance.
You may use !!MR and other triggers.
!!MR:N, !!MR:M works as before (described in !?MR0 and !?MR1 trigger section). The !!MR:F here is used as a percentage (0..100) of a chance for the spell to work.

But how can I extract that calculation from this?

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


Admirable
Omnipresent Hero
Wog refugee
posted July 13, 2018 10:20 AM

I think MR2 calculates the creature magic resistance, not the sum of all resistance chances, hero, artifacts, skills etc. Ask Igrik in russian forums.

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


Famous Hero
posted July 14, 2018 05:00 AM
Edited by orc at 05:02, 14 Jul 2018.

xericsin said:
@orc,

There is no direct way of doing that.

You have to change the other part of the existing script, in order to change the way to apply bonus.
OR
You can calculate the equivalent percentage of the bonus you want.

----------------------------------------------------------



Hmmmm, what other parts I must change? O_O

anyway I think the second way is easier; I can do it by finding creature HP and dividing by it right? (and also by multiplying by 100 to eliminate the %)

so basically, I will change the following line:

!!VRw30:Sv428*3+12;      //Additional percent to HP = 12+3*level of hero

which means:
HP Increment = [Hero Level X 3 + 12] X [Creature HP/100]

and I will change it to:
HP increment = [100/Creature HP] X [Hero Level X 3 + 12] X [Creature HP/100]

(and I cant delete the last part because it is not explicitly written in the script)

am I correct?

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


Adventuring Hero
posted July 14, 2018 05:32 AM

xericsin said:

I need pros to tell me this, please:

Can we get the dwarf style magic resistance chance of a stack on the battlefield?

But how can I extract that calculation from this?


[by Bersy]
!!UN:C6919200/4/?y1; y1 - TCombatMan
!!VRy2:S[stack_num]*1352+21708+y1; y2 - combat monster
!!SN:E5931936/6/y1/[spell number]/0/y2/0/1/0;
then
E1 displays the resistance of stack to spell: 0.0 .. 1.0

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


Famous Hero
posted July 14, 2018 10:08 AM
Edited by xericsin at 10:10, 14 Jul 2018.

orc said:


HP Increment = [Hero Level X 3 + 12] X [Creature HP/100]




I made a mistake. The second way does not work.

W is a hero variable and there is no way to cancel off the Creature HP in the formula above, because you cannot know which creature exactly.

So you have to find the other part of the original script, that adds bonus to the stacks during the battle. Maybe you can search for !?BF.

Then you change the way of adding bonus.

---------------------------------
THanks to Hawaiing and Bersy.


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

Tavern Dweller
posted July 24, 2018 05:28 PM

Even on the new version of ERA I'm giving a bug in the game .... did anyone still have the same?

http://tinypic.com/view.php?pic=29l0cih&s=9

 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 150 200 250 300 ... 350 351 352 353 354 ... 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.5998 seconds