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: Editing text files through ERM (started by Kegolo in July 2011)
Editing text files through ERM
Kegolo
Kegolo


Promising
Famous Hero
of infamy
posted July 31, 2011 06:35 AM

Editing text files through ERM

So my project right now is to replace a town without the hassle of replacing some 60 DEFs and other such things that I would much rather leave be. At the moment my script, when enabled, replaces all buildings, outlines and such, towns on map, small pictures, CRPSMALL and those, for a new town that is controlled through ERM.

The problem? I want to rename the town/buildings without replacing text files in the LODs such as towntype.txt and dwelling.txt. Does anyone know how to do this easily? I've used UN:C for the defs/pxc files, but text files seem to be handled differently. I thought UN:J3 might help but that is only for wog settings, not other text files. Sad face.

Thanks in advance for anyone who has any ideas.

 View Profile
revolut1oN
revolut1oN


Famous Hero
posted July 31, 2011 08:45 AM

I'm not sure cause I didnt use these scripts, but maybe in Neutral Conflux or Vlaad's rampart the names of buildings are changed via ERM, did u check it?

 View Profile
Aleee
Aleee


Known Hero
posted July 31, 2011 11:14 AM

I can only say that there is no way to do it using standard ERM commands. Also there hasn't been much progress in the area of UN:C operations with text strings (however, there is a number of functions which work with defs and some other resources that require manipulations with a text, but these are really special scripts).

 View Profile
GrayFace
GrayFace


Promising
Known Hero
posted July 31, 2011 02:01 PM

This should work I guess:
Find the string you want to replace in this file: https://sites.google.com/site/sergroj/wog/UX_S.rar?attredirects=0&d=1
Then use UN:C for the address 6968120 + 4*(index in the first column of the file). Set the 4-byte value there to the address of z-var holding the building's new name. There is a version-independent way to get the address of a Z-var, but I wrote it on DF2 which is now unavailable.

 View Profile
Aleee
Aleee


Known Hero
posted July 31, 2011 02:42 PM

Quote:
... I wrote it on DF2 which is now unavailable.

If you're talking about the forum itself, it works. I believe it's there.

 View Profile
GrayFace
GrayFace


Promising
Known Hero
posted July 31, 2011 02:45 PM

Ha, it's alive
[code]ZVSE

* This code puts address of z1 to v4138

!#UN:A0/9/?y10; [backup Z var number]
!#UN&y10<0:A0/9/?z-1; [backup string (3.59)]

!#UN:A0/9/1; [art0.Name = z1]
!#UN:C6687592/4/?y1; [get artifacts array address]
!#UN:Cy1/4/?v4138; [get art0.Name which is z1 address. Name goes first in art info, so y1 points to art0.Name]
[v4138 holds address of z1 now]

!#UN&y10>=0:A0/9/y10; [resture Z var number]
!#UN&y10<0:A0/9/z-1; [restore string (3.59)][/code]

 View Profile
Kegolo
Kegolo


Promising
Famous Hero
of infamy
posted August 01, 2011 03:08 AM

Quote:
Ha, it's alive
[code]ZVSE

* This code puts address of z1 to v4138

!#UN:A0/9/?y10; [backup Z var number]
!#UN&y10<0:A0/9/?z-1; [backup string (3.59)]

!#UN:A0/9/1; [art0.Name = z1]
!#UN:C6687592/4/?y1; [get artifacts array address]
!#UN:Cy1/4/?v4138; [get art0.Name which is z1 address. Name goes first in art info, so y1 points to art0.Name]
[v4138 holds address of z1 now]

!#UN&y10>=0:A0/9/y10; [resture Z var number]
!#UN&y10<0:A0/9/z-1; [restore string (3.59)][/code]


Hey thanks for all the work. So does the above code work how exactly? How would I make it specific to buildings I want to replace? I also tried your above suggestion, adding 4*index from file to that UN:C value but I got an error when I opened the town hall. Thoughts?

 View Profile
GrayFace
GrayFace


Promising
Known Hero
posted August 01, 2011 12:44 PM

Quote:
So does the above code work how exactly?

It uses ERM to change certain address to that of z1 variable, then it looks up the address with UN:C using knowledge of Heroes 3 internal structure.

Quote:
I also tried your above suggestion, adding 4*index from file to that UN:C value but I got an error when I opened the town hall. Thoughts?

Code?
Here's what you should do:
1) First, include this code.
2) Say, z100 would be the name of some building. Its address would be (v4138 + 99*512), where 99 is the number of z-var minus 1.
3) Then you'll need to change the value at (6968120 + 4*index) to z-var address.

 View Profile
Kegolo
Kegolo


Promising
Famous Hero
of infamy
posted August 06, 2011 01:52 AM

Quote:
Quote:
So does the above code work how exactly?

It uses ERM to change certain address to that of z1 variable, then it looks up the address with UN:C using knowledge of Heroes 3 internal structure.

Quote:
I also tried your above suggestion, adding 4*index from file to that UN:C value but I got an error when I opened the town hall. Thoughts?

Code?
Here's what you should do:
1) First, include this code.
2) Say, z100 would be the name of some building. Its address would be (v4138 + 99*512), where 99 is the number of z-var minus 1.
3) Then you'll need to change the value at (6968120 + 4*index) to z-var address.


Cool works well. Is it possible to do something like
!!UN:Cv123/4/v456; ???

It would make this process much easier but it doesn't seem to work, can you UN:C an address stored in a variable?

 View Profile
Jump To: « Prev Thread . . . Next Thread »
Post New Poll   Post New Topic   Post New Reply

Page compiled in 0.0379 seconds