|
Thread: Simple Way to Add New Towns Under Era 2.3 (Dragon Peaks example) | This thread is pages long: 1 2 3 4 · NEXT» |
|
JimV
Responsible
Supreme Hero
|
posted July 03, 2012 07:19 PM |
bonus applied by angelito on 18 Jul 2012. |
Edited by JimV at 05:05, 28 Jul 2012.
|
Simple Way to Add New Towns Under Era 2.3 (Dragon Peaks example)
This post will describe a simple mod which adds a new Town without eliminating an existing Town. The main reason I am posting it is as a template (or just an idea) for others to consider when adding new Towns.
Download Link: https://www.box.com/s/a8a7accc0b5436638aa5
This mod adds a new town, "Dragon Peak", via wogification under Era 2.3. The town is slightly similar to a Heroes II Dragon City, in that you have to fight dragons to win it, and it produces dragons weekly and 1000 gold daily. It contains Fairie, Rust, Crystal, and Azure Dragons.
I thank Bersy, Salamandre, and master_learn for valuable comments.
INSTALL: For this map you have to install the Heroes 3 "Era 2.3" addon, which you can download from http://heroescommunity.com/viewthread.php3?TID=37208 - see the installation instructions there. Note: this mod will not work under Era versions prior to 2.3.
After installing Era 2, extract the zip file directly into your Heroes 3 - Era 2/Mods folder. The result should have this structure:
(Heroes 3 Era 2 Folder - where you installed Era 2 over Heroes 3 SoD or Heroes 3 Complete)
... (subfolders to Heroes 3)
Mods (a subfolder to Heroes 3)
DragonPeaks (subfolder to Mods)
Data (subfolder to DragonPeaks)
Maps (subfolder to DragonPeaks)
... (other Mods subfolders: Yona, WoG, etc.)
... (other Heroes 3 subfolders and files)
Note: four WoG scripts have been revised to account for Dragon Peak Towns: Bersy's numbers 33, 43, 46, and 53. These scripts are in WoG/Data/s in the package. The revisions have "JHV" in their comments.
The DragonPeak mod can be used to add a new feature (new Town) to random maps. It can also be used in custom maps, by either wogifying them with the DragonPeaks mod enabled, or with the DragonPeaks.erm script (DragonPeaks/Data/s) placed in a Timed Event using the Map Editor. Custom DragonPeak cities can be added in the Map Editor by adding Rampart Towns whose names begin with "Dragon Peak", e.g. "Dragon Peak NW". Randomly added DP Towns will be named "Dragon Peak 1", "Dragon Peak 2", etc., so do not name a custom DP town with a number which will match one of these. That is, if you intend to add 8 randomly-placed DP Towns (using the script menues at the start of a game), number your custom DP Towns as "Dragon Peak 9" or higher (or do not use numbers in the name).
At the start of a game, DragonPeak.erm will attempt to add DP Towns to the map. Due to the large footprint of a Town, most random maps will not have enough clear space in which to add DP Towns. The script will ask if you wish to remove 1/3 of the map's resource piles, in hopes of clearing spaces for random placment. If the script cannot find space for a random placement (after about 200 random tries), it will then ask if you want to convert a neutral Town to a DP.
Mod Method:
I used DefPreview, H3DeftOOL, and MMARCHIVE (thanks to Grayface) to manipulate DEF and PCX files. I used GIMP to modify graphics. Bersy's new "RedirectFile" option, as well as other Era options, were crucial to the development.
The plan was to make a new Town type out of Rampart Towns, without eliminating the original Rampart Towns, by changing Town properties and graphics each time a Rampart Town named "Dragon Peak xx" is entered.
Towns whose names begin with "Dragon Peak" are changed to the new type, and other Rampart Towns are left unchanged.
Mod Details:
A Town can be entered by these methods:
1) A Hero visits the Town (!?OB trigger).
2) The player clicks on a Town in the Town List on the right side of the Adventure Screen (!?CM5 trigger).
3) The player clicks on a Town in the Town List in the Town Screen (!?CM1 trigger).
4) Click twice on a Town on the Adventure map.
5) Open the Kingom Overview, select Towns, and click on a Town icon.
All of these events except the last can be detected with ERM triggers and used to implement Town changes. (The last had to be prohibited in this mod.)
However, there is a limitation, under event 3): it seems the Heroes 3 program does not reload Town graphics (DEF's and background PCX) when transferring from one Ramparts Town Screen to another. So transferring from a Dragon Peaks Town to an ordinary Rampart Town via the Town Screen Town List leaves the modified DP graphics in place, and vice-versa.
Therefore the script checks for this type of transfer and prevents it. (You can transfer from a Dragon Peak Town to a standard Rampart (e.g., "Rainhaven") by transferring from the DP to another Town type (e.g., Castle), and then transferring from the Castle to Rainhaven.)
A Dragon Peaks Town is a simple town, with only four Creature Dwellings and an unmodifiable Town Hall. The following scriplet shows how their new graphics are implemented:
!?FU6150&-413; set DP Town Cr's
!!UN:T1/2/0/134; [level 2 no upg - Faerie Dragon3]
!!UN:T1/3/0/135; [level 3 no upg - Rust Dragons]
!!UN:T1/4/0/133; [level 4 no upg - Crystal Dragons]
!!UN:T1/6/0/132; [level 6 no upg - Azure Dragons]
* change "TB" and "TO" to "JV"
!!SN:L^Era.dll^/?y1; y1=handle
!!SN:Ay1/^RedirectFile^/?y2; y2=FU address
!!SN:Ey2/1/^TBRMDW_2.def^/^JVRMDW_2.def^;
!!SN:Ey2/1/^TBRMDW_3.def^/^JVRMDW_3.def^;
!!SN:Ey2/1/^TBRMDW_4.def^/^JVRMDW_4.def^;
!!SN:Ey2/1/^TBRMDW_6.def^/^JVRMDW_6.def^;
!!SN:Ey2/1/^TBRMEXT2.def^/^JVRMEXT2.def^;
!!SN:Ey2/1/^TBRMEXT3.def^/^JVRMEXT3.def^;
!!SN:Ey2/1/^TBRMHAL2.def^/^JVRMHAL2.def^;
!!SN:Ey2/1/^TORDR1AA.PCX^/^JVRDR1AA.PCX^;
!!SN:Ey2/1/^TORELF1.PCX^/^JVRELF1.PCX^;
!!SN:Ey2/1/^TORHAL2.PCX^/^JVRHAL2.PCX^;
!!SN:Ey2/1/^TORPEG1A.PCX^/^JVRPEG1A.PCX^;
!!SN:Ey2/1/^TORTRE1.PCX^/^JVRTRE1.PCX^;
!!SN:Ey2/1/^tbrmback.pcx^/^JVrmback.pcx^;
!!IF:V413/1; prevent redirected redirects
!?FU6151&413; restore Rampart Town Cr's
!!UN:T1/2/0/18;
!!UN:T1/3/0/20;
!!UN:T1/4/0/22;
!!UN:T1/6/0/26;
* undo all redirects
!!SN:L^Era.dll^/?y1; y1=handle
!!SN:Ay1/^RedirectFile^/?y2; y2=FU address
!!SN:Ey2/1/^TBRMDW_2.def^/^^;
!!SN:Ey2/1/^TBRMDW_3.def^/^^;
!!SN:Ey2/1/^TBRMDW_4.def^/^^;
!!SN:Ey2/1/^TBRMDW_6.def^/^^;
!!SN:Ey2/1/^TBRMEXT2.def^/^^;
!!SN:Ey2/1/^TBRMEXT3.def^/^^;
!!SN:Ey2/1/^TBRMHAL2.def^/^^;
!!SN:Ey2/1/^TORDR1AA.PCX^/^^;
!!SN:Ey2/1/^TORELF1.PCX^/^^;
!!SN:Ey2/1/^TORHAL2.PCX^/^^;
!!SN:Ey2/1/^TORPEG1A.PCX^/^^;
!!SN:Ey2/1/^TORTRE1.PCX^/^^;
!!SN:Ey2/1/^tbrmback.pcx^/^^;
!!IF:V413/0; unflag redirects
The "JV" graphic items are stored in h3sprite.pac in DragonPeaks/Data.
When a Hero visits a Town, this scriplet makes the necessary changes:
!?OB98/1; Hero enters Rampart Town
!!CA998:N?z3; get Town Name
!!VRz2:M1/z3/0/11; get substring "Dragon Peak" if Town is a DP
!!FU6150&z2=z709/-413:P;
!!FU6151&z2<>z709/413:P;
(Similar scriplets are used for the other entry methods.)
That is the basic method. See other tutorials (here and elsewhere) to learn how to use the Grayface tools, GIMP, ERM, and Era.
Dragonpeaks.erm uses these (unclaimed, as far as I know) items: v2150-v2154, z709, FU6148-FU6163, flags 411 & 413-415 (v1-v10, z1-z10 temporarily)
Screenshots:
The new Town Screen:
The day-one menu:
The resource-pile option:
The option to convert neutral towns if random placement is limited by the lack of clear space:
A randomly-placed Dragon Peak:
A converted neutral Town (on a random map):
The download package contains two custom maps and a random map which can be used to test the mod. The custom maps ("Hint Test" and "Dragon Peak Test") are just test vehicles, with and without wogification, not playable maps.
Note: this post has been updated in response to changes made up to the edit date.
|
|
Warmonger
Promising
Legendary Hero
fallen artist
|
posted July 03, 2012 07:25 PM |
|
|
Finally!
Loos limited and quite troublesome, but opens a lot of new possibilities!
Especially Dragon town cna be a fun, it's been proposed many times already
____________
The future of Heroes 3 is here!
|
|
Bersy
Honorable
Supreme Hero
|
posted July 03, 2012 07:32 PM |
|
Edited by Bersy at 19:33, 03 Jul 2012.
|
Excellent work .
I will need more time to explore it carefully, but currently I have one notice. You clear all redirections using ^^/^^ syntax. Thus other scripts redirections will be cleared also.
P.S. Wasn't it better to use !?TH0-1 triggers?
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 03, 2012 07:35 PM |
|
|
Very nice, thanks. I got two issues, right clicking in middle area of new town triggers mage guild question (hero had mysticism), from inside clicking on upper town icon or itself icon crashes the game
SAVE
|
|
master_learn
Legendary Hero
walking to the library
|
posted July 03, 2012 08:02 PM |
|
|
Thank you,JimV,for this new Dragon Peaks town!
Another example of your skills!
|
|
JimV
Responsible
Supreme Hero
|
posted July 03, 2012 08:21 PM |
|
|
Thanks for the comments - some of which I am not smart enough to understand yet.
I am sure I should have used the Town Hall triggers, but I am not sure what for. I use CM1 to prevent use of the Dragon Peak Town Hall, because the Town is not modifiable and the graphics would not match. A more complex example might change the Town Hall menu also and use the TH trigger to implement the change - but I myself would replace it with a new DL rather than redirected graphics.
Good point about the redirects. I will un-redirect the redirections individually to make the script more general.
I could not start the saved game (dragons.gm1). It starts with an error message about secondary skills scrolling, and then crashes. I got numerous random crashes when I started developing the mod under Era 2.2, but they disappeared under Era 2.3 - so I am wondering which Era version you used. (And what other mods it might interfere with.) Clicking town icons everywhere I could think of on my system does not produce a crash. (Probably I am not finding the right place to click.)
Checking my notes, I started this mod on June 27, so I have not done as much testing as I should (of course, it is a very simple mod).
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 03, 2012 08:24 PM |
|
|
By default, ERA comes with the following mods:
WoG
Yona
Fast battle animation
Secondary skills Scrolling
This is my setup. I disabled secondary skills mod and crash was gone. Seems there is conflict somewhere.
|
|
OxFEA
Promising
Famous Hero
feanor on DF2.ru
|
posted July 03, 2012 08:40 PM |
|
|
Quote: !?FU6150&-412; set DP Town Cr's
!!UN:T1/2/0/134; [level 2 no upg - Faerie Dragon3]
!!UN:T1/3/0/135; [level 3 no upg - Rust Dragons]
!!UN:T1/4/0/133; [level 4 no upg - Crystal Dragons]
!!UN:T1/6/0/132; [level 6 no upg - Azure Dragons]
Units can be bought without visiting the town (kingdom overview, and, most important, AI procedures). Is it handling?
|
|
JimV
Responsible
Supreme Hero
|
posted July 03, 2012 08:42 PM |
|
Edited by JimV at 19:48, 06 Jul 2012.
|
I have the Secondary Skills mod (+ WoG and Yona) enabled, under Era 2.3. DragonPeaks is my top priority, followed by SS. So probably something else is different between our systems - I will investigate further. I installed Era 2.3 about two days ago, and did not change anything except to add DragonPeaks to it.
Meanwhile, I have found a mistake - the "Hint Test" map in the zip package was for a different development. I have replaced it with the version used to test DragonPeaks at Box.net. (Bersy's recommended un-direct change has not been made yet as it needs testing, and probably there will be other suggestions if I wait a while.)
Update: I didn't see OxFea's post until I submitted the above.
"Units can be bought without visiting the town (kingdom overview, and, most important, AI procedures). Is it handling?"
I didn't know creatures could be bought from the Kingdom Overview, which shows one can play Heroes for about 15 years and not know everything about it! This was not handled, and I will have to add it to the script. Thanks for mentioning it.
I have seen AI's attack a Dragon Peak and leave it with dragons which they purchased there. I wondered during the development whether the AI has internal ways of buying creatures, but since there wasn't any good way which I could think of to handle such in ERM, I decided that if the AI wants to buy Elves and Dendroids instead of Dragons, I could live with that. Assuming Heroes 3 has assigned the right creature costs, it should not be a significant disadvantage to the AI. Of course internally-coded mods such as VCMI and others would be able to handle such things, but I am just a lowly ERM coder.
List of things to change so far:
1) Individual un-directs.
2) Handle creature purchases from the Kingdom Overview menu.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 03, 2012 08:49 PM |
|
|
Weird, I re enabled secondary skills mod and now I have load game crash every time pointing to their script. Nothing about ERM in crash log, only one address. Save is now corrupted, no matter if sec skills On/Off.
### Location: 8 : 20
EIP = {0x7C812AFB}, Unhandled Exception.
|
|
Bersy
Honorable
Supreme Hero
|
posted July 03, 2012 09:07 PM |
|
|
Salamandre, did you use mods manager to install new mod?
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 03, 2012 09:11 PM |
|
|
No, unzipped in mods, as instructions said.
|
|
JimV
Responsible
Supreme Hero
|
posted July 03, 2012 09:20 PM |
|
|
Speaking for myself, I just added the folders and files to my Heroes 3 Era 2.3 folder using Windows Explorer.
When checking for transfers between standard Rampart Towns and Dragon Peaks within the Town Screen, I needed a way to get the name and Town type of a town in the scroll list - which ERM does not provide. Therefore I searched for the address of the hint text (which shows "View town-name, town-type" when the player clicks on a Town icon to transfer to it), and found the following:
[[[0x28085E0]+0x14]+0x234]+0x30114. This works (always, so far) on my Windows 7 laptop, and on an older XP laptop, so I hoped it was a general address which would always work. Now I think perhaps it does not work on Salamandre's system.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 03, 2012 09:26 PM |
|
|
I restarted the random map with sec skills off and no error when switching between towns. You may want to check with mysticism hero and see what's about mage guild, still there.
|
|
JimV
Responsible
Supreme Hero
|
posted July 03, 2012 09:41 PM |
|
|
Updated to-do list:
1) Individual un-directs.
2) Test with a Hero who has enhanced Mysticism.
3) Handle creature purchases from the Kingdom Overview menu.
4) Play a whole map to completion to find other unforeseen problems.
These may not happen soon as I will be undergoing surgery about 36 hours from now and there is a lot of Wimbledon tennis to watch in the meantime, but I appreciate the suggestions and will issue a revision based on them sooner or later.
|
|
master_learn
Legendary Hero
walking to the library
|
posted July 03, 2012 09:53 PM |
|
|
What kind of surgery are you talking about,JimV?
____________
"I heard the latest HD version disables playing Heroes. Please reconsider."-Salamandre
|
|
JimV
Responsible
Supreme Hero
|
posted July 03, 2012 10:02 PM |
|
Edited by JimV at 22:09, 03 Jul 2012.
|
I wish it was a brain and body transplant, but instead it is sinus surgery to clean out some blockage, probably a fungal infection.
It gave me a chance to use my standard joke:
Me: Will I be able to play the piano a week after the surgery, assuming all goes well?
Doctor: Certainly.
Me: That's great! I've always wanted to be able to play the piano, but never could!
It never gets old. (Pianists should use some other instrument.)
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted July 04, 2012 03:28 AM |
|
|
Wow seems like a lot of hard work nice job!
I wouldn't say this is really for adding a new town though, more like just another object to put in the map editor.
I haven't tried it yet, but is there a way to start as the DP team? If I chose Rampart from the beginning, will I be them sometimes/everytime/never?
Anyways great job. This seems like a more compact way of what I did with the covenant, just I used 'CV' instead of 'Dragon Peak' for renaming.
|
|
JimV
Responsible
Supreme Hero
|
posted July 04, 2012 03:54 AM |
|
Edited by JimV at 07:36, 04 Jul 2012.
|
First, in reply to Kegolo: thanks for the comment.
The new object is a Town (object type 98, subtype 1). What you see on the map is a replacement for AVCRAMP4.def, the maximally demolished version of a Rampart town. (The revised AVCRAMP4.def is in the h3sprite.pac under DragonPeaks, so if this mod is active it will replace the WoG version.) The object should have a dragon flying around it, and may some day, but the graphics work to do that seemed excessive to me for now.
It is intended as a sort of "Dragon City", containing neutral Dragons, so it can be used by any faction. At the start of a new game, the script attempts to add a number of them (player-specified) to the map. The added ones are neutral, with garrisons of dragons which have to be conquered to own the town, similar to the Dragon Cities in Heroes II.
A map-maker can also add owned Dragon Peaks to a custom map by placing owned Rampart Towns on a map and naming them "Dragon Peak xx". At the start of the game, the script will convert these to the new object, but without garrison troops (unless they are neutral instead of owned).
It is a very simple type of town which only took a week to do, mainly as an illustration of Bersy's RedirectFile Era command. A more complete town could be done with this method - requiring a lot more graphics work and time. The main point of this type of mod is to have a new town without losing any of the existing town types - with some limitations on the new town.
Second - the first update has been uploaded to the Box.net site. I found an error: flag 412 is not unclaimed, but used by WoG, so the script now uses 413 instead of 412 (and I will revise the first post to eliminate references to 412 as soon as I finish this post). This did not cause noticeable problems during my tests, perhaps because I do not use the WoG option which uses 412, but it might explain Salamandre's problem - but probably not, as I am still unable to reproduce his results. I have added another test map, "Dragon Peaks Test", in which Sorsha has Expert Mysticism, and with the WoG Mysticism options enabled ... I see nothing in Dragon Peak 1. I also played the random map long enough to get a Hero with Expert Mysticism and saw nothing in three Dragon Peaks in that map either. I may need some saved games to figure out what is happening.
To do:
1) Still haven't done individual un-directs - maybe tomorrow.
2) Fix Kingdom Overview to prevent creature purchases there. There seem to be no ERM triggers (except CM1 on the KO button) I can use, so I will have to replace the internal KO menu with a new one. (Probably stripped down to the Mine and Income information.)
3) Revise the WoG Summoning Stones scripts to treat Dragon Peaks as a separate case.
4) Think about how to compensate the AI for buying Elves and Dendroids in Dragon peaks (via internal routines without entering the Towns) instead of Dragons.
5) More play-testing.
Second update: added more code to the script, to fix the growth of owned Dragon Peak troops, and keep the available troops for neutral Dragon Peak troops at one of each dragon (no growth until they are owned, similar to H2 Dragon Cities).
I have added an AI-owned Dragon Peak (98) to the Hint Test map. So far when I have attacked it (at the start of week 2), the AI has only been able to buy one Green Dragon and one Pegasus to defend it (with two of all four creature types available to be recruited, at that point). (The AI is too far away to visit it with a Hero yet, and Dragon Peaks do not have Taverns.) So in these cases, if the AI were forced to buy Faerie, Crystal, Rust, or Azure Dragons instead of Rampart creatures, it would not have enough resources and would have to leave the Town undefended.
Later in the game, an AI-owned Dragon Peak might have a defending Hero, in which case it would be able to purchase Dragon Peak creatures rather than Rampart creatures.
So I am not sure whether the ability of the AI to bypass my script is a disadvantage or advantage to it. If it is a disadvantage I need to compensate for it, but if it is an advantage and makes the game a bit more challenging, I would not be inclined to try to reduce the advantage.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted July 04, 2012 09:05 AM |
|
|
SAVE
I also believe it is more about adding a new object which, under some limitations-using only neutral creatures-, will act as a neutral town. The redirects allow amazing things, but they will be useless if one wants to replace the DP with for example Grove town, which uses 14 creatures whose ID are used by the replaced town. I am not sure I fully understand the redirects potential, but what will happen if the new town using 14 creatures ID will get in battle with the former town? We can't have angels on one side and angels using another def on the other side, can we?
|
|
|
|