Heroes of Might and Magic Community
please log in.! Register | Today's Posts | Search! | FAQ/Rules | AvatarList | MemberList | Profile

<a href="http://www.game-advertising-online.com/" target=_blank>Game Advertising Online</a><br> banner requires iframes

Heroes 1 (Heroes 2 (Heroes 3 (Heroes 4 (Heroes 5 (Heroes 6 ()

Login:     Username:     Password:    
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: ERM help and discussion
Thread: ERM help and discussion [ This thread is 227 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 (112) 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 ]
mister_kalu
mister_kalu


Known Hero
posted November 07, 2011 11:45 AM

Quote:
Did you check the current value for grass (UN:C(address)/4/?v1)?  Perhaps it is already 100 (or whatever value you set).

In fact, I just tested:

ZVSE

!#VRv1:S2; --grass
!#VRv2:S0; --no pathfinding
!#VRv3:Sv1 *4 +v2 *4 +6546704;
!#UN:Cv3/4/?v4; --100 movepoints per tile?
!#IF:M^Grass movement value = %V4.^;

Answer:  Grass movement value = 100.



yes you are right, and I know the value is 100, but if you change to 500 or a different number the hero walks the same number of steps that if you don't do the change.. and this happens only in grass tile, if you do the change !#VRv1:SX; --where X [0,9] without 2, the scripts works and hero walks few steps 2 or 3..

i want to reduce the number of steps on grass

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


Responsible
Supreme Hero
posted November 07, 2011 12:14 PM
Edited by JimV at 12:39, 07 Nov 2011.

@Magissia,

I don't know why the Garrison owner change didn't work for you under a BA1 or BA53 trigger.  I would have have to write my own script and test in a test map, and I have other work to do.  If you are running under Era, you can try the TL0 trick which I have posted about here previously:  under the BA1 trigger, instead of changing the Garrison directly, enable TL0 with Bersy's minumum delay setting (about 20 milliseconds) and set a flag to enable a TL0 trigger.  Under that TL0&flag trigger, change the Garrison ownership, then disable TL0 again and zero the flag.  (You don't want TL0 triggering continuously as it would slow down the program.)

P.S. v999 is not a good variable to use because it is set automatically by several triggers, e.g. !?OB and !?HM.  I don't think that is the source of your problem, but it could screw up other scripts which expect v999 to have the map y-value at the end of a battle.  If it were my script, I would try various things before giving up on the BA1 or BA53 triggers, such as adding a small delay, refreshing the screen, moving the view, using v1 instead of v999, and anything else I could think of.  Salamandre has a trick where he does a change, checks with ?v# to see if the change has occurred, and if not, repeats the process  two or more times.

@Mister_Kalu,

If you want to slow down or speed up Heroes on any given terrain, use the !?HM-1; trigger (which executes when any Hero takes a step), check the terrain (v998/v999/v1000) which it is stepping on with the TR:T? receiver, then add or subtract movement points with HE-1:Wd.  For example, if it takes 100 movement points to take one step on grass, HE-1:Wd-400 will convert that to 500 movement points.  I have used this successfully to give Heroes extra movement.  Probably you should first get the MP (!!HE-1:W?v1;) and insure that it won't go negative due to the subtraction, in the case of reducing movement, as I am not sure what will happen if the the Hero's MP become negative.

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


Honorable
Undefeatable Hero
posted November 07, 2011 02:49 PM

Magissia, the town color is updated later, after BA1 processed already. Use the way around to get your garrison:

!?BA1; * after castle was taken, flag the battle or whatever
!!HE-1:O?y1; check winner, if no winner, no active hero
!!FU&y1<0:E;
!!GRx/y/z:Oy1; [change with your GR coordinates]
!!UN:R1;

Other flags/checks may be needed, it depends of your wishes.

____________

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


Adventuring Hero
posted November 07, 2011 03:32 PM
Edited by Magissia at 15:49, 07 Nov 2011.

Hello again

I'm trying to add a mithril cost to script 45 grow upgrade

i found out that

"!!FU863&1/x3=0/x2=164:P0/0/7/0/0/0/1000/5; " define the cost, and the number of increased grow, but i can't set a mithril cost with it

Since it runs the function 863 i scrolled down to !?FU863, but seem to have found strings settings only

Edit : Ty Salamandre, will try it

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


Responsible
Supreme Hero
posted November 07, 2011 05:10 PM

Quote:

!!FU863&1/x3=0/x2=164:P0/0/7/0/0/0/1000/5; defines the cost, and the number of increased growth, but I can't set a mithril cost with it.

Since it runs the function 863 i scrolled down to !?FU863, but seem to have found strings settings only


The P-parameters to FU863 appear to be wood/mercury/ore/sulfur/crystal/gems/gold/amount of increased growth per week.  (The strings used in FU836 are of course given in script45.ert in Data/s.)  So the script is not set up to use mithril as a cost for troop growth upgrades.  You will have to add this capability to the script, perhaps as a 9th parameter.

I hope this answers your question.  I must admit my track record for understanding what questions people are asking is poor.

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


Adventuring Hero
posted November 07, 2011 06:20 PM

That's not exactly what i asked, but if there's a problem, it's probably my poor english.

I was asking how to add a 9th parameter to have it be mithril.

But i'm not even sure how mithril works, i first thought it would be the ressource 7 (since 6 is gold ?) but when i tried to add a mithril reward on a creature bank it failled and did nothing.

Thanks you very much for your time JimV

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


Responsible
Supreme Hero
posted November 07, 2011 07:52 PM

From ERM Help, the OW:R command:

R#1/#2/$3; Set/check/get a resource
  #1 - Owner (See Format E1) [-1 for current owner (color)]
  #2 - Resource type (See Format R)
  $3 - Resource value

Format R is:

List of Resources
(Type 79)
0 Wood  
1 Mercury  
2 Ore  
3 Sulfur  
4 Crystal  
5 Gems  
6 Gold  
7 Mithril

So to get the amount of mithril that Red has:

!!OW:R0/7/?v1;

To subtract 5 mithril from Blue (if Blue has it):

!!OW:R1/7/d-5;

(Probably still not what you wanted to know, but maybe I'm getting closer?)

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


Adventuring Hero
posted November 08, 2011 08:55 AM
Edited by Magissia at 08:55, 08 Nov 2011.

Thanks JimV

From script 45

line 151

!!VRv434: S0;                          ;if v434=7 then player can build upgrade
!!OW:Rv428/0/?v433;                    ;v433=amount of resource
!!VRv434&v433>=x1: Sd1;
!!OW:Rv428/1/?v433;
!!VRv434&v433>=x2: Sd1;
!!OW:Rv428/2/?v433;
!!VRv434&v433>=x3: Sd1;
!!OW:Rv428/3/?v433;
!!VRv434&v433>=x4: Sd1;
!!OW:Rv428/4/?v433;
!!VRv434&v433>=x5: Sd1;
!!OW:Rv428/5/?v433;
!!VRv434&v433>=x6: Sd1;
!!OW:Rv428/6/?v433;
!!VRv434&v433>=x7: Sd1;

means i have to add

!!OW:Rv428/7/?v433;
!!VRv434&v433>=x8: Sd1;



Now i need to add the mithril cost line 52

!!FU863&1/x3=0/x2=164:P0/0/7/0/0/0/1000/5; //pikeman

But whereever i place it, the mithril cost isn't added, i have to change the script somewhere else for it, so i need now to add, after the creature grow, a mithril cost.

I need to add the parameter mithril at the end of FU863, but i don't understand how the actual parameter are set to add the mithril one

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


Known Hero
posted November 08, 2011 09:05 AM

Quote:
@Magissia,

@Mister_Kalu,
If you want to slow down or speed up Heroes on any given terrain, use the !?HM-1; trigger (which executes when any Hero takes a step), check the terrain (v998/v999/v1000) which it is stepping on with the TR:T? receiver, then add or subtract movement points with HE-1:Wd.  For example, if it takes 100 movement points to take one step on grass, HE-1:Wd-400 will convert that to 500 movement points.  I have used this successfully to give Heroes extra movement.  Probably you should first get the MP (!!HE-1:W?v1;) and insure that it won't go negative due to the subtraction, in the case of reducing movement, as I am not sure what will happen if the the Hero's MP become negative.


yes you are right, and i did the same experiment, but this method have one mistake and is that if you change the move points !!HE-1:W, the hero walk and next, he loss the extra move points. so if you have a map with the virtual travel ( the green X icon that mark the possible way ) for 15 steps when the hero arrives to the 6-7 green X, with a lack of 7 or more steps) unexpectedly the hero stops his journey. and this may cause a serie of  troubles to a player, specially on grass ( maybe the most common terrain)

the UN receiver doesn't have this problem,

!?PI;
!!VRy1:S2; --Grass
!!VRy2:S0; --none pathfinding
!!VRy3:Sy1 *4 +y2 *4 +6546704;
!!UN:Cy3/4/400; --400 movepoints per tile

but i don't know why this doesn't work on grass and yes for all the rest of terrains

thanks

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


Responsible
Supreme Hero
posted November 08, 2011 09:37 AM

Quote:
... i have to add

!!OW:Rv428/7/?v433;
!!VRv434&v433>=x8: Sd1;

Now i need to add the mithril cost line 52

!!FU863&1/x3=0/x2=164:P0/0/7/0/0/0/1000/5; //pikeman

But whereever i place it, the mithril cost isn't added ...


As explained in the ERM Help, the values or variables given after the P in a FU:P command are transferred into the corresponding variables x1, x2, etc. when the !?FU trigger is executed.  So in your example, x8 is the amount of growth (5).  If you added the mithril cost to your function call before the growth, that is,

!!FU863&1/x3=0/x2=164:P0/0/7/0/0/0/1000/2/5; //pikeman

(where 2 is the mithril cost) then x8 becomes the mithril cost and x9 becomes the creature growth, so every where in !?FU863 there is an x8, it will have to be changed to x9.  Alternatively, you could add the mithril cost after the growth, e.g.,

!!FU863&1/x3=0/x2=164:P0/0/7/0/0/0/1000/5/2; //pikeman

and then you won't have to change x8 in !?FU863 but you will have to use x9 here:

!!VRv434&v433>=x9: Sd1;

There are always many different ways to write a script.

There may be other things which have to change in !?FU863 also - I have not studied the script.  Well, for sure there will be messages which have to change, to tell the player that the cost includes mithril.



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


Responsible
Supreme Hero
posted November 08, 2011 09:49 AM
Edited by JimV at 10:00, 08 Nov 2011.

Quote:
... i don't know why this doesn't work on grass and yes for all the rest of terrains


I don't either, and probably you would have to ask the programmers who designed the game that way.  My guess is they intended that there should never be a movement penalty for grass, so they didn't bother to program any use for the table value for grass, but they needed a table entry for grass so that they could index values from the table by terrain number.  That is, sand is 1 and snow is three, so if the table skipped grass, the index for snow would read the value for swamp.

It would not be difficult to eliminate all grass from a map at the start of the game, using the TR:T command in DO loop, if you insist on limiting movement.  You could even add eratz grass tiles to the sand def and convert the actual grass to sand-grass, so the map would look the same in the Adventure screen.

P.S. One can become accustomed to the path inconsistencies when using HM-1 to add or subtract movement, and a player can eliminate them by first clicking on a destination to see the overall path, then clicking on an intermediate destination a few steps away, but I agree this is not ideal.  Sometimes one has to make compromises in an imperfect world, however.

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


Adventuring Hero
posted November 08, 2011 10:43 AM
Edited by Magissia at 10:52, 08 Nov 2011.

Thanks JimV

So i decided to use x9 for mithril


!!VRv434: S0;                          ;if v434=7 then player can build upgrade
!!OW:Rv428/0/?v433;                    ;v433=amount of resource
!!VRv434&v433>=x1: Sd1;
!!OW:Rv428/1/?v433;
!!VRv434&v433>=x2: Sd1;
!!OW:Rv428/2/?v433;
!!VRv434&v433>=x3: Sd1;
!!OW:Rv428/3/?v433;
!!VRv434&v433>=x4: Sd1;
!!OW:Rv428/4/?v433;
!!VRv434&v433>=x5: Sd1;
!!OW:Rv428/5/?v433;
!!VRv434&v433>=x6: Sd1;
!!OW:Rv428/6/?v433;
!!VRv434&v433>=x7: Sd1;
!!OW:Rv428/7/?v433;
!!VRv434&v433>=x9: Sd1;


Doing that, when i have 2 mithril or more, i can't make the grow upgrade (nothing happen after selecting the level 1 dwelling)

i also modified

!!FU861&433:Px1/x2/x3/x4/x5/x6/x7/x9/v430/v431/v428/x8/;
to make the script correctly take 2 mithril bars (so i end with -2 mithril bars, or -1, since when i have the correct number of mithril bar it doesn't works)

Edit : Found out that i have to correct thoses lines

!!VRz405&v434=8/v435=0:Sz405 +z145009;

!!VRz405&v434<8/v435=0:Sz405 +z145010;

!!IF:V433/0;
!!IF&v434=8/v435=0:Q433/405;
!!IF&v434<8/v435=0:M1/405;
!!IF&v435>0:M1/405;

Now the script correctly takes 2 mithril bars and don't exit when you have enough bars

Thanks you very very much for your help JimV, i will now add mithril cost for every building in the script and share the script there

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


Responsible
Supreme Hero
posted November 08, 2011 11:14 AM
Edited by JimV at 11:19, 08 Nov 2011.

@Magissia,

Looking at the original script, I see:


!!VRv434: S0;                          ;if v434=7 then player can build upgrade
!!OW:Rv428/0/?v433;                    ;v433=amount of resource
!!VRv434&v433>=x1: Sd1;
!!OW:Rv428/1/?v433;
!!VRv434&v433>=x2: Sd1;
!!OW:Rv428/2/?v433;
!!VRv434&v433>=x3: Sd1;
!!OW:Rv428/3/?v433;
!!VRv434&v433>=x4: Sd1;
!!OW:Rv428/4/?v433;
!!VRv434&v433>=x5: Sd1;
!!OW:Rv428/5/?v433;
!!VRv434&v433>=x6: Sd1;
!!OW:Rv428/6/?v433;
!!VRv434&v433>=x7: Sd1;

!!VRz405&v434=7/v435=0:Sz405 +z145009; would you like to increase troop production?

!!VRz405&v434<7/v435=0:Sz405 +z145010; you can't afford another upgrade

So the code here is checking whether the player has enough of each resource, from wood to gold (0 to 6).  If the player has enough of each (and some may have a requirement of zero), then at the end v434 will contain the value 7.  By adding mithril, you will arrive at a value of 8 if each requirement is met.  So the tests following should be &v434=8 and &v434<8.

There are probably other changes necessary also.  Ideally, you should read the whole script and look up each command in the ERM Help until you understand everything which the script is doing.  Just as if you were adding an extension to a house you would need to read the blueprints and see where the support posts, plumbing lines, and electrical conduits are.

(Note to me:  I see that the command IF:Q#1/#2 is used by the WoG Team in this script, where #2 = the number of a z-variable.  This command is not in the WoG 3.48f ERM Help.  I will add it when I find time to make my next update.)

Edit - I see you already figured it out for yourself while I was typing that.  Good work.

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


Hired Hero
posted November 08, 2011 01:03 PM

HI!

I have another problem. I want to make mass resurrection but
I do not know how can check the spell is castable at a stack.
Can not cast resurrect on undead, magic immunity, golem, and some
others.
Is there a way to check a # spell is castable at # stack?

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


Known Hero
posted November 08, 2011 01:07 PM


hello, i have a question, the letters are white and yellow with black shadow, Salamandre says :

ERA allow :

Colorful dialogs with HTML-like syntax (yeah, white and yellow colors are in the past).

this mean that the letters will have another full colors?  for example the white color for the letters of the font is #FFF3DE, for the yellow is this : #EFD77B

if i wanna change the color to Green or something and maybe ERM will transform the colors into #00FF00 ( absolutly green).. but, this is a caprice, the letters can have different shades for borders, edges, for base.?.. in this case i want do a new medfont.fnt with not single, if not hybrid colors with 3 or 4 in their pixels for every letter ( grey, blue, white, yellow ) and that ERM with a receiver, load it. Like a external imagen ( this is much improbably because transform a picture in a font ,sounds weird and strange), but load a new font(external) for the game, I've never heard.

probably the comment before is too confused. sorry

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


Adventuring Hero
posted November 08, 2011 01:13 PM

Quote:
HI!

I have another problem. I want to make mass resurrection but
I do not know how can check the spell is castable at a stack.
Can not cast resurrect on undead, magic immunity, golem, and some
others.
Is there a way to check a # spell is castable at # stack?


Hi

You can check if unit died by getting how much units are on a stack at start, and compare it afterward.

I wish i could help you more
____________

My works

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


Hired Hero
posted November 08, 2011 01:25 PM

That is not enough. The archer can not be resurrected when has magic resistance or they are cloned or they are undead or ... There is too many checkable thing. Is there a receiver MR but I do not know how can I check the spell is able on the stack (the mouse changing to spellbook)

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


Adventuring Hero
posted November 08, 2011 02:32 PM

It's a bit out of topic, but i actually never got that the icon was a book...
____________

My works

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


Responsible
Supreme Hero
posted November 08, 2011 02:42 PM
Edited by JimV at 15:23, 08 Nov 2011.

[quote... Is there a way to check a #s spell is castable at #n stack?


There is a flag bit (16) which is set for creatures which are alive, i.e., not undead, not elementals, not golems, and not gargoyles.  It can be checked with BM#n:F.  That will eliminate most creatures, but not Gold, Black, Diamond, or Darkness Dragons.  Those could be checked for using creature type, BM:T.

In WoG, creatures can also have magic immunity which is experience-based (EA:B).  These could be checked for using the EA(-#n-1):F and EA(-#n-1):B? commands.  Actually, a Dragon might get Receptivity (no immunity to beneficial spells), so that could be checked for also.

Presence of the Orb of Vulnerability will eliminate natural immunities, but not experience-based immunities.

Edit - I forgot to mention that clones can be detected by a BM:F flag bit also.

Re-Edit - I also forgot about the Power of the Dragon Father, which should be checked for.  I don't think the Orb of Vulnerability overcomes it, but would have to do a test to be sure.

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


Hired Hero
posted November 08, 2011 03:40 PM

Thanx, but what about to cast magic immunity and something what I am not thinking? Is there a siple check for the spell not a many many tests? I think the program sets something to in/out to cast a spell or show able to cast a spell.
Is memory location about this set?


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
[ This thread is 227 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 (112) 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 ] < Prev Thread . . . Next Thread >
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1275 seconds