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 ... 43 44 45 46 47 ... 50 100 150 200 250 300 350 400 407 · «PREV / NEXT»
klwar
klwar

Tavern Dweller
posted October 04, 2009 08:14 AM
Edited by klwar at 09:07, 04 Oct 2009.

uhm, sorry, this problem was solved. I didn't test it properly, it works already.
Do you have any clue about how to make a unit attack 3 or more times ?
I don't find any receiver that allow a stack to attack the enemy unit. There is only a receiver that make the monster cast a spell on a specific place.

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


Admirable
Omnipresent Hero
Wog refugee
posted October 04, 2009 09:18 AM

I never saw it and don't think it is possible to attack more than twice. There are flags that you can play with:

!!BM#:F
= 67108864 - set if this stack is done acting for this round
= 33554432 - set if this stack is waiting

so theoretically it could be possible to reset the flag to "waiting" so the creature can attack again before the turn ends, but never tested or tried to do it.
____________
Era II mods and utilities

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

Tavern Dweller
posted October 04, 2009 10:51 AM

I tried to write a script that use the receiver !!BM#:F : if the hero ID is 155 (Xeron), horned demon unit (ID 49) has the ability to move infinite times (After moving, it is set back to wait). But it didn't work. I wonder where is wrong.
ZVSE

!?BA0;
!!BA:H0/?y38;
!!BA:H1/?y39;

!?BG1&y38=155;
!!BG:A?v101;    (check if this unit is moving)
!!BG:N?v102;
!!BMv102&v102<21:T?v103 F?i;
!!BMv102&v101=2/v102<21/v103=49/i=67108864:F33554432;

!?BG1&y39=155;
!!BG:A?v101;
!!BG:N?v102;
!!BMv102&v102>20:T?v103 F?i;
!!BMv102&v101=2/v102>20/v103=49/i=67108864:F33554432;

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


Admirable
Omnipresent Hero
Wog refugee
posted October 04, 2009 11:09 AM
Edited by Salamandre at 11:11, 04 Oct 2009.

I have no idea, when I check for flag I use MA:X?#, never tried with F. Try in russian forums, maybe you have luck with them.
____________
Era II mods and utilities

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


Famous Hero
posted October 04, 2009 01:23 PM
Edited by Siegfried at 13:26, 04 Oct 2009.

Individual town music

Hi,

just if anyone is interesed, here is the first part of a sample code on setting individual town music. I do not have the current usage file, so i moved any scripts to backup and started from scratch. So the fariables and functions used may obviously need renumbering

So first, a function which is called when a town music might be to be set. I chose FU98, because a town is object type 98


!?FU98&v996=98/v997>=0/v997<9;
!!CA998:N?z1;
!!IF:M^DEBUG: Town %Z1 entered^;
!!VRz2:S^MP3\%Z1.MP3^;
!!IF:M^DEBUG: Check for %Z2^;
!!UN:J8/0/2;            Flag 1 = 1 if file exists
!!VRz1&-1/v997=0:S^cstletown^;
!!VRz1&-1/v997=1:S^rampart^;
!!VRz1&-1/v997=2:S^towertown^;
!!VRz1&-1/v997=3:S^infernotown^;
!!VRz1&-1/v997=4:S^necrotown^;
!!VRz1&-1/v997=5:S^dungeon^;
!!VRz1&-1/v997=6:S^stronghold^;
!!VRz1&-1/v997=7:S^fortrtesstown^;
!!VRz1&-1/v997=8:S^elemtown^;
!!VRy1:Sv997+1;
!!MP:Sy1/1;
!!FU:E;

(The debug messages should be deleted somewhen)

Now the second part, the trigger. This is only one step of (i think) three necessary. This one triggers when a hero enters a town:

** Triggers _before_ opening town screen!
** v998/v999/v1000 = coordinates
** v996/v997 = type/subtype
!?OB98&1000;            Hero entered town
!!OB998:T?v996/U?v997;
!!IF:M^DEBUG: Town (%V996) type %V997^;
!!FU&v996<>98:E;        Exit if not town
!!CA998:O?y-1;          Owner of town
!!HE-1:O?y-2;           Owner of hero
!!FU&y-1<>y-2:E;        Exit if not same
!!FU98:P;
!!FU:E;

Next step now is place an appropriate file in the mp3 folder. I tried with the first RoE campaign scenario. The first town is named "Cariatyd". So i placed a file "Cariatyd.mp3" into the mp3 folder, and voilá, my own music.

Next two steps will be klicking on a town in the adventure screen or clicking on a town in the town list. The latter will be quite easy. Same setup, then call FU98. The clicking on a town in the adventure map will be tricky. Maybe something like Salamandre suggested, checking the cursor form when clicking somewhere. But how to get the correct town coordinates and thus type and subtype?

Have fun

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


Famous Hero
posted October 04, 2009 02:34 PM

Problem. I've set up a trigger for mouse click on town list in adventure map. So far so good.


!?CM5&1000;
!!CM:F?y-1;             Get flags
!!FU&y-1<>0:E;          Only left click
!!CM:I?y-1;             Click location
!!FU&y-1<32:E;
!!FU&y-1>36:E;
** Clicked somewehre in the town list
!!VRy-1:-32;
!!OW:N-1/y-1/?y-2;      y-2 = town number
!!FU&y-2<0:E;           No town
!!UN:U98/-1/y-2/998;    Town coordinates
!!OB998:T?v996/U?v997;
!!IF:M^DEBUG: Town (%V996) type %V997^;
!!FU&v996<>98:E;        Exit if not town
**FU98:P;
!!FU:E;

Now the debug message gives correct object type(98) and subtype (0). But when i then call FU98, it says there that the object type is no castle. The line which triggers the error is:

!!CA998:N?z1;

Here the error message says that the object is no castle. What went wrong?

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


Famous Hero
posted October 04, 2009 02:45 PM

Hmmm, at least i found something:

When i enter the town with a hero, coordinaets are 66/56/0
When i click on the town list, coordinates are 58/8/0

So they are different. No idea why.

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


Admirable
Omnipresent Hero
Wog refugee
posted October 04, 2009 04:01 PM

I think the mouse cursor must be on the yellow square to trigger the right type. Castle walls will not trigger anything.
____________
Era II mods and utilities

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


Famous Hero
posted October 04, 2009 04:22 PM
Edited by Siegfried at 17:23, 04 Oct 2009.

@Salamandre: No. If i hover the mouse over any yellow square, the cursor becomes a horse. if i hover over any other square of a town, the cursor becomes a castle. Clicking then selects that town.

But that is not my current problem.

I click on the town in the town list and get a town index:
!!OW:N-1/?y-2;

That should give me the current active town of the current owner into y-2. The result i get is 1. I have 1 town. Seems reasonable.

Now if i use !!UN:U98/-1/y-2/998; to get the coordinates of that object i get the coordinates of another town (not owned by me). Wrong.

No then i assume this number is not the town number on the map but the town number in the players town list (that is not clear from documentation). So i try !!OW:W-1/y-2/?y-3; This should translate the town number from players list to town number on map. The result is -1 (e.g. no town). It is not clear if the second parameter starts with 0 or 1. So i try decrementing y-2 by 1 before translating. That gives 1 as the result. Now i get the same wrong castle as above.

Again i assume any off-by-1 error and add 1 to the result before checking coordinates. That gives the coordinates of another town again not owned by me.

I am not sure about the correct map number of that town, but it is not 1 and not 2. 0 = is excluded (error). So how do i get that map number of the current players active town?

Edit: I just checked. The correct map town number would be 4. So how do that?

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


Admirable
Omnipresent Hero
Wog refugee
posted October 04, 2009 05:36 PM

Would be interesting to find. Right now I have no idea, and research into this will take long as nobody even tried to do that. Please share with us if you get it working.
____________
Era II mods and utilities

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


Famous Hero
posted October 05, 2009 12:31 PM

Quote:
Please share with us if you get it working.

Sure. But for now i have no idea.

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


Famous Hero
posted October 06, 2009 12:31 PM

Bug?

Hi,

i'm currently experimenting. So i have two functions, one that stores some hero stats, another stat should restore them. Storing seems to work. Restoring gives a strange side-effect. I use this:

!!HEy1:Fvy2/vy3/vy4/vy5;

y2..y5 are holding the variable indexes. The values restores are correct (the 4 pimary skills) The side effect is that this alters the heroes speciality. Speciality type/subtype is changed to 7/8. Besides that the speciality pic is altered, but the speciality text is not altered.

In case you need the complete function:

** Restore hero stats
** Params:
**        x1: hero ID
**        x2: storage offset
!?FU34;
!!FU&x1>=0:E;
!!VRy1:Svx2;            Hero id
!!FU&y1<0:E;
!!FU&y1>155:E;
!!VRy2:Sx2+1;
!!VRy3:Sx2+2;
!!VRy4:Sx2+3;
!!VRy5:Sx2+4;
!!HEy1:Fvy2/vy3/vy4/vy5;
!!FU&y1<>6:E;           DEBUG
!!VRy6:Svy2;
!!VRy7:Svy3;
!!VRy8:Svy4;
!!VRy9:Svy5;
!!IF:M^DEBUG: Restore %Y1: %Y6/%Y7/%Y8/%Y9^;
!!HEy1:X?y2/?y3/d/d/d/d/d;
!!IF:M^Speciality type=%Y2, subtype=%Y3^;
!!FU:E;

Anything after the DEBUG is just debugging code to check the result in detail. The remainder is simple: First get the storage offest. From there get the hero id (first variable). Then set up indexes for the next 4 variables and restore primary skills from there. That's all. The debug gode shows correct restored primary skills, but the speciality check shows 7/8. Is this a bug? Is it a known bug?

For now i think i have to store and restore the speciality, too.

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


Admirable
Omnipresent Hero
Wog refugee
posted October 06, 2009 12:49 PM

I don't know, when I want to store stats:
!!HE#:F$1/$2/$3/$4. Simple, no bug, no headache. What you're trying to do?
____________
Era II mods and utilities

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


Famous Hero
posted October 06, 2009 01:20 PM

Well, the problem is, it restores (sets) the stats, but also it alters the heros speciality.

Tested with Hero #6 (Sir Christian)

What i want to do? Simple: Restore (set) the stats without altering the heros speciality.

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


Admirable
Omnipresent Hero
Wog refugee
posted October 06, 2009 01:50 PM

That I know lol. But why use index and so many things for a 2 lines codes command? Store the stats then restore the stats. Or it is part of your big revamping functions project?
____________
Era II mods and utilities

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


Famous Hero
posted October 06, 2009 03:02 PM
Edited by Siegfried at 15:12, 06 Oct 2009.

Quote:
That I know lol. But why use index and so many things for a 2 lines codes command? Store the stats then restore the stats. Or it is part of your big revamping functions project?

Yes

I want to use the function twice. For left hero as well as for right hero. Left hero stats are stored in v100...something, right hero stats are stored in v200...something. So i give the start index as a parameter to the function.

As mentioned above, anything after the DEBUG string is just debug code. So the basic function is not that complicated as it seems


Edit:
The big picture is: I use the function various times. I first call it twice in f.ex. a pre-battle trigger !?BA0 to store the hero stats somewehre. This function checks for a valid hero id. If found, runs. Once the stats are stores, i then can alter them deliberately to whatever i want. Currently i'm adding some attack an defense. If an attacker moves far, he gets some AT+, if he has Tactics and Offense. The amount of bonus depends on the distance moved. Similar to the champion charge bonus. The defender gets DF+, if he has Tactics and Armorer. The amount here depends on the remaining movement points. Somwehat reverse to the champion charge bonus.

So after storing the stats i alter them. Now after Battle a !?BA1 trigger calls the function again for both heroes. The first parameter then is set to a negative value. So the function knows that the stats are not to store, but to restore. This is the function shown above. The other function with same number i've not shown here.

Now is it clear why?

Still i wonder why setting the primary skills also alter the heroes speciality. Meanwhile tested with others, too. But if i restore the speciality, too, it works. That just should not be necessary.

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


Famous Hero
posted October 06, 2009 05:17 PM
Edited by Siegfried at 09:44, 07 Oct 2009.

O.k., i found it. I forgot a parameter somewhere else. Now it works as intended.

P.S.: Grmbl! Tested it a while and found again one hero getting a change in his speciality once. No other. Those are the worst errors, which only rarely occure. I'll retry in a few days.

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


Famous Hero
posted October 07, 2009 12:34 PM

Hi,

what would be the safest way to read the hero speciality? I'm only interested in the first 2 values. Currently using:

!!HEy1:X?y7/?y8/d/d/d/d/d;

Is this correct? May this cause such such effects like those mentioned above (changing the heros speciality)?

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


Admirable
Omnipresent Hero
Wog refugee
posted October 07, 2009 01:07 PM

I never saw anyone using "d" in a check but in a set only. Even if you never use the variable, it is a safest way to check it manually.

Example:
!!HEy1:A2/?y2/?y3/?y4; **check for artefact

The mapmaker will never use all values for conditioning the follow scripts but still he put them. Let's say he needs only to check y2 and y3 only, but still he has to ask for y4, not use !!HEy1:A2/?y2/?y3/d;
____________
Era II mods and utilities

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


Famous Hero
posted October 07, 2009 03:22 PM

O.k., thanks. I'll try that. Although d should work too. But if this could cause any problems i'll use some dummy variables instead.

Another question: How could i tell if a hero has visited an object (f.ex. a marletto tower) with given coordinates? I'm thinking of this: If a hero has not yet visited this marletto tower, then do standard action (DF+1). If he has already visited this object, then do another action. I've currently solved it partially like Tobyn did in the witch hut script. But there still is the "we can't help you further" message which i want to avoid. But of course if the hero has not yet visited the object, the standard message or dialogue should appear.

Idea is to enable the hero getting even more from that object, but for a price. Current calculation is DF * DF * 1000 in gold (for DF enhancement, others similar). Limited to DF=20.

I can check if a hero has visited object number X. But how tell the object number from the coordinates?

 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 ... 43 44 45 46 47 ... 50 100 150 200 250 300 350 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.9121 seconds