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: Simple Way to Add New Towns Under Era 2.3 (Dragon Peaks example)
Thread: Simple Way to Add New Towns Under Era 2.3 (Dragon Peaks example) [ This thread is 3 pages long: 1 2 (3) ]
master_learn
master_learn


Legendary Hero
walking to the library
posted July 18, 2012 02:01 PM

Congratulations for your new stars,JimV!
Good to see your hard work appreciated!
____________
"Now VW? I kill spammers
When people can't say hi to demons in the VW - quite!"-Ghost

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


Famous Hero
Work at Magic Dimmension
posted July 20, 2012 06:43 PM

I  remember I've seen a command under !!CA receiver in ERA's ERM help which depends on baterry.dll
it was intended for alternate creatures in town's dwellings (like in later MOP products) but could be used in this mod template.
The dependency would help on bugs because towns would really have different creatures inside assuming batterry.dll would work well.

I had similair ideas but never realised them (I talked about here or on another forum?).
About placement issues I suggest adding new Object which would be added during RMG and replaced with dragon peaks during wogify (ERA 2.3 supports objects.txt editing alternative via separate text files).

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


Responsible
Supreme Hero
posted July 20, 2012 07:01 PM
Edited by JimV at 14:42, 22 Jul 2012.

Thanks for the suggestion about the new CA:D command, which might make the AI understand that Dragon Peaks have different creatures than Ramparts under all conditions, if the AI has been made aware of this feature.  I will try it.

Since Towns take up a lot of space, the only RMG object I could think of to replace a Dragon Peak with is ... a Neutral Town, which is one of the options now.

Update: I read the discussion of battery.dll (CA:D) in the ERM Help thread and it appears it will not work the way I would need it to:

a) There can not be any missing slots.  I was hoping to use slots 1 and 2 for Ramparts and slot 3 for Dragon Peaks, but then DP's would have to have the first two slots also.

b) It does not work for the AI, which was my major reason to try it.

Anyway, I feel better for knowing that someone else also did a mod without worrying that it did not completely support AI players.  Great minds think alike - and even my mind and a great mind (MoP) think slightly alike sometimes.

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


Famous Hero
Work at Magic Dimmension
posted July 21, 2012 04:09 AM

Yeah it was probably CA.

About replacing I thought about new object via objects catalog which would be placeholder for new town and would have exactly same size and shape.
This way decision about where place new town would be done before wogification ie. By RMG algorithm or mapmaker placing the placeholder (of course the guards settings won't be availible if the second).
About diffrentating dragon peaks from rampart: I think it should be some SN:W variable with town coordintes in name rather than directly town name. (SN:W is really greater feature than it seems).


About the feature: I'm happy someone did it before me, so my theories become proved true. (About new town type with ERA 2.3 new tricks but no plugin via some emulation).
Would you JimV like to implement town hall later? I wonder if UI would be happy only by graphics redirecting.
Does the text tables loaded on game start or on demand? (On latter it would be possible to fix town strings just with redirection - no UN:C etc.).


Greetings about the (partial) success. I too hate the demolition feature and abusing the WoG engine to have another DEF for not-rampart was very clever. I suppose this way we can have at least one simulated new town per one real old town.
The faction could be shared between pairs (ie. Grove units being Rampart faction and Forge units beeing Necropolis faction).
About heroes we can live with lower number of them per town (ie. Some Rampart might Heroes changed to Grove might heroes) or just cheer about new OxFea plugin in preparing (described as new Hero clases but I suppose the count of heroes ingame would be able to increase too).

Well I'm beeing hospitalised too but it have nothing with fungi or spores. I thought of using redirection instead of feature I supposed to be handled by plugin (new buildings in old towns). Since I asserted new buildings beeing upgrades of fully built buildings (else town hall support would be even more terrible to do) I hope redirection would be enough. Did you tested when def info is refreshed in town UI? (Eg. It updates rapidly after redirection in intown script, need refresh command or player need leave town because the things are calculated at enter?). I have so much great ideas but I worry so small amount of them being incarnated.

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


Responsible
Supreme Hero
posted July 21, 2012 09:09 AM
Edited by JimV at 09:22, 21 Jul 2012.

I'm not sure I followed all of that. As far as the genesis of this idea, I started out the project intending to do it with UN:C addresses, but in some cases, changing all the UN:C DEF names on the fly (similar to what Kegolo does, and others have done including myself in "The Swords of Night and Day") did not change the Town Screen, so I recalled Bersy's notice about the redirect command, and tried that.  It worked for me (instantaneously as far as my human senses could detect) in cases where UN:C changes did not.

Since I want all the Dragon Peaks to be labelled as such anyway, using a different way to flag them would be redundant.  (Besides which, reading the name from the hint text is the only way I have yet found to tell when a player is clicking on a Dragon Peak in the Town scroll list inside the Town Screen.)  Also, adding another map object when RMG already places Neutral Towns seems redundant to me.  As explained previously, a map-maker can add Dragon Peaks to a map manually as well as having them placed automatically by the script, but by my definition a Dragon Peak always has the same guards (just as a Heroes II Dragon City does).

You have clever ideas, but the only way to get them implemented in exactly the way that you would do them ... is to do them yourself.  Someone else will always have different preferences.  Also, in the course of implementation, the need for compromises often occurs, but only the one doing the implementation appreciates that.

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


Famous Hero
Work at Magic Dimmension
posted July 22, 2012 04:49 AM

Yeah another object seems redundant in your implementation since it affects random towns and can be placed in mapmaker easily.
But I thought it more the tutorial that actual one town-project. In general using SN:W variables would be more uniform way, and having a blank object which looks exactly like the town would be easier for mapmaker (and there is no problem to replace it during wogification).
Having separate RMG object would help because RMG templates could specify how much there should be dragon peaks, and it help more once it is mostly neutral and same guarded.
For a template project  SN:W  seems better because it allows changing town name without cheating the town type.

Thanks for the helpful info. Once you mean "after opening townscreen" with mentioned "faster than human can see" I'm totally happy, because I wanted to simulate new buildings beeing upgrade of old and worried that "upgrade with ctr-click dialog" may look glitchy after building is built but city is not left yet. Once such complex projects like yours, JimV, works I suppose there is no particular need to create a plugin allowing 20 more (64-44=20) buildings per town, separate from having them together in town hall (which can be workarounded with DL dialog).

PS: you supposedly can get townpos from WoG info of townlist UI and use it for check if it is rampart or dragon peaks. You can also completely resort on demolished graphics once normal demolition is disabled so only "demolished" tows would be alternate towns. Good luck! Yeah I would try a bit myself.

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


Promising
Famous Hero
of infamy
posted July 27, 2012 08:33 PM

JimV: I am trying to do something similar to your dragon peaks example, and so I am going through your script. I want to check what town a player clicks on when inside a town (so CM:I should be 155-157) but I don't follow your code, I think you are checking the hint text? Could you explain the code below, or suggest how to go about finding out which town the player has clicked on in that list??? Thanks

!!UN:C41977312/4/?y2; base
!!VRy2:+20; offset 1
!!UN:Cy2/4/?y3; base 2
!!VRy3:+564; offset 2
!!UN:Cy3/4/?y4; base 3
!!VRy4:+196884; offset 3
!!SN:Xy4; y4 value (hint text address) to address buffer
!!SN:X?z3; buffer address to z3 address
!!VRz2:M1/z3/5/11; get substring "Dragon Peak" if Town is a DP

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


Responsible
Supreme Hero
posted July 27, 2012 10:10 PM
Edited by JimV at 08:01, 28 Jul 2012.

Sure.  This was posted as a sort of template, but I didn't want to write a huge post explaining every detail, so I expected to answer questions.  As I mentioned to Majaczek above, the only easy way I found to check which town is being clicked in the scroll list of Town icons inside the Town Screen is to check the hint text.  There are probably other ways, but that worked for me so I stopped looking.

CM:I for the Town Screen allows you to identify when one of the Town icons is being clicked, but I couldn't find a corresponding OW or CA receiver which identified the Town based on the slot number (as there is for the Town scroll list on the Adventure Map).  But I noticed that when the mouse pointer is on a Town icon in the Town Screen (as it would have to be, to click it), the hint text gives the name, e.g., "View Rainhaven".  That hint text had to be in memory somewhere, so I searched for it.  It is easy to find the string itself, in any given run, but the location varies from run to run.  Finding a reliable pointer to it was difficult (since I don't know the H3/WoG internal code).  Finally I found a three-level pointer which worked on every program run over dozens of starts for both my Windows 7 laptop and my older Windows XP laptop.  Since then it has worked for others on other machines.

The SN:X command is explained in the Era Manual.  It provides a convenient way to get a string in memory into an ERM z-variable.  In WoG 3.58f I would probably have to check ASCII codes, character by character.

All my Dragon Peak cities have names beginning with "Dragon Peak", so if the 11 characters of the hint text string starting at the 6th character (character position 5) are equal to that, I know the Town that will be transerred to is a Dragon Peak, so I must do the redirects and UN:T's for that Town (if I allow the transfer).  As I mentioned in the first post, when you transfer from one Rampart to another, the redirects have no effect (H3 must be smart enough not to reload the DEF's), so I prohibited a direct transfer from a Rampart to a Dragon Peak or vice-versa.

What if the new Towns aren't distinguished by names?  In that case you could search all the Towns with UN:U until you found one which matched the name, and refer to it by its number (from the search) - as I do to check for normal Rampart Towns.  Note that a Town name can have up to 14 characters.

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


Famous Hero
Work at Magic Dimmension
posted July 28, 2012 11:30 AM

Yeah but it is bug prone if someone changes town name to one already existing.
I thought that only value needed and always enough is triplet of entrance coordinates. Since we have SN:W we can use it to name a vaiable which would hold info if alternate town type is here (0 for classical town another per alternate, and combining your experience with this theory we can have 3x9 simulated towns types - per each hardcoded town type a value 1-3 which would correspond to destroyed state which JimV use to have the graphics).
Then simple way to convert old town to new type is just change this variable (and we even can partially restore town rebuilding) and would work until there is someone crazy enough to implement travelling towns as a mod (which would virtually never happen).
All towns can be traversed by OB finding commands, so I believe JimV is smart enough to easily use it to implement easily more generic template. Sometimes even masters forgets novice tricks, so don't worry JimV (and me beeing almost lazy prefer you to clear the track first).

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


Responsible
Supreme Hero
posted July 28, 2012 11:47 AM

If I found out correctly:
[0x69CCFC]+0x3E:
(1) Number of towns player owns
(1) Current selected town or -1
(1)[Number of towns] CA:U for each town in he list

[0x6AAAB8]: index of selected town in town screen
[[[0x69954C]+0x118]+0x4C]: scrolled offset in the list in town screen

So, !?CM1 + get click index 0..2 + add scrolled offset + obtain CA:U.

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


Promising
Famous Hero
of infamy
posted July 28, 2012 12:17 PM
Edited by kegolo at 13:11, 28 Jul 2012.

You are a god among men.

Edit: but I am not. I don't get how to code the offset. Examply?

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


Responsible
Supreme Hero
posted July 28, 2012 01:02 PM

Nope. ArtMoney + OllyDebugger, 1 hour is enough.

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


Promising
Famous Hero
of infamy
posted July 28, 2012 01:14 PM

Also, @JimV: in trying to do my task, I have found two more ways to enter a town I don't think you considered:

Pressing enter on the adventure map (usually a T + enter is how I do it)

And I just, like 5 min ago, found out that pressing up and down arrows in a town scrolls to the next or previous town.

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


Responsible
Supreme Hero
posted July 28, 2012 03:30 PM
Edited by JimV at 18:16, 28 Jul 2012.

I can prevent pressing "T" or using the up and down arrows to scroll the Adventure Map Town List by:

!?FU77003;
!!SN:X?y99/0;
!!FU&y99<>84/y99<>40/y99<>38:E;
!!SN:X?y99/1; remove "T", Up-Arrow, Down-Arrow

However, that doesn't work in the Town Screen; the key-presses are detected, but not disabled, at least not in time to prevent the transfer.

The simplest thing to do is to tell users what my doctor told me when I had tennis elbow and it hurt to play tennis:  "Don't do that."  Meanwhile I will be thinking about other ways.  I have an idea, but it will take me a while to set it up and test it.

Last time I'll say:  I want all Dragon Peaks to be named as such, and it allows map-makers to add DP's to custom maps in the Map Editor by placing Ramparts and naming them "Dragon Peak xx".  Plus it gave me a way to find out when the mouse pointer is on a DP in the Town Screen Town List without having to learn PC assembly language.  There are other methods, but as one of my old bosses (managers) used to tell us, "If it ain't broke, don't fix it."  (But if it is broke, fix it.)

Update:  all it took was a little courtesy:

!?FU77003;
!!SN:X?y99/0;
!!FU&y99<>84/y99<>40/y99<>38:E;
!!SN&y99=84:X?y99/1; remove "T"
!!OW:N-1/?v1; get Active Town
!!FU&v1<0:E; no active Town (let Heroes move via arrow keys)
!!SN:X?y99/1; remove "T", Up-Arrow, Down-Arrow
!!IF:M^Please do not use the arrow keys to switch Towns.  The Dragons don't like to be snuck up on!^;

For reasons which I don't understand, but probably Bersy does, adding the IF:M dialog is enough to force the de-activation of the hot keys, even in the Town Screen, whereas the first version did not.  I was planning to try something a bit fancier, but it was not necessary.  The mod package at Box.com has been updated.

P.S. Belated thanks to Kegolo for pointing out the hot key mechanisms.

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


Famous Hero
Work at Magic Dimmension
posted July 29, 2012 04:45 AM
Edited by majaczek at 04:47, 29 Jul 2012.

Just to ask here. If used redraw command from ERM in town would the game reload the DEFs?
It may be neccessary in some building def redirection and if works it would be an easy trick. (Sorry for not trying find it first but internet here is too horrible to download something more than sngle image).
I ask here because JimV's Dragon Peaks is the only mod yet which heavily uses ERA redirect (so hope here is most ontopic).

Also with name beeing unchangable to detect when it is a DP... Fine for your mod, but I hoped more for a template that actual mod, it seems we need to find our way ourselves.
About "don't do it". I won't, but if someone is forcing fresh rampart to become dragon peaks due to bug, in multiplayer to cheat, I won't be happy. Still I'm aware its now more a funny concept than actual mod to play.


About IF:M - it looks simply that dialog catches the key instead of town, nice workaround.

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


Responsible
Supreme Hero
posted July 29, 2012 06:00 AM

This is the first place I see where OnKeyUp is used instead of OnKeyPressed.

OnKeyDown
OnKeyPressed <= Era catches only it currently
OnKeyUp

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


Responsible
Supreme Hero
posted July 29, 2012 11:53 AM

UN:R4 does not cause Heroes to reload DEF's.  If it did, I would have done that after every Town switch in the Town screen, and would not have had to prohibit transfers between Dragon Peak and Rampart Towns.

I have only played Multiplayer in Hot Seat mode, but it seems to me if someone wants to cheat, they could easily be detected as having a Dragon Peak which was not on the map at the game start, and was not added during the wogification phase (in which added DP's are listed).  Also a normal Rampart converted to a DP would have extra Town buildings which do not belong in a DP and could be detected that way.  A DP converted to a Rampart during a game would never be able to add buildings (such as a City Hall) since these are disabled at the start of the game.  So such cheating would be difficult to hide and not necessarily advantageous.  Giving up the ability to add DP's in the Map Editor easily in order to prevent this does not seem worthwhile to me.  Other implementers might make different compromises.

Thanks for the insight, Bersy.

 


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
[ This thread is 3 pages long: 1 2 (3) ] < Prev Thread . . . Next Thread >
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0729 seconds