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 ]
New Server | HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 4 - Lands of Axeoth > Thread: Researching how to add new objects
Thread: Researching how to add new objects This thread is 10 pages long: 1 2 3 4 5 6 7 8 9 10 · «PREV
Karmakeld
Karmakeld


Famous Hero
posted March 21, 2018 10:01 PM

iliveinabox05 said:
Sorry I'm a little late to the party, but while looking back through old posts to figure out what I need to do in order to get a new / edited object into the editor to test passability editing, I stumbled across an image on the second page of this thread showing where the flag data is located.

I then went back and looked at Namerutan's documentation for objects, and I have discovered where / how the flag data should be inserted if it is absent

If you have an object that does not have a flag, check out the first 2 bytes of the file (which Namerutan has labeled as file format). If it is not 06 00, change it to that. (Warning, if the first two bytes were 03 00, you need to remove another field near the end of the file or things will likely crash, so let's ignore that file type for ease of testing).

After you have changed the first two bytes to 06 00, navigate down to the sub type code and sub type text. AFTER these fields, you skip the next byte (which is for the object depth), and this is where you should insert the flag data. The first byte of the flag data must be 01, which probably means true for a flag being present. Then there are 8 bytes of data, which I'm guessing are two 4 byte integers to specify an x and y offset for the flag's location.

I know you've been waiting for this Michael

This is something that should be quite simple to add to my resource editing app


I'm not the only one... better late than never, yet it's great to finally have the confirmed info. Next is to figure out how the image positions translates to hex code.
Hopefully I'll have time to play around with those info soon. Thanks mate
I really hope we'll be able to complete the puzzle that will allow us to create objects from scratch.

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


Adventuring Hero
posted March 21, 2018 10:04 PM
Edited by iliveinabox05 at 22:06, 21 Mar 2018.

It should just be the x and y offsets in pixels.

So just use a decimal to hex converter (google) and guess at the horizontal and vertical pixel distances and pad the rest with 00s.

For example, if you want to put the flag horizontal offset at 50 pixels, you would get 32 in hex.

Then you enter 32 00 00 00 for the x offset, and then do the same process for the y offset.

Let us know how it works out!


Edit: Were you talking about the flag position, or just image position I noted at the end of the object file?

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


Known Hero
posted March 22, 2018 12:56 PM

iliveinabox05 said:
Edit: Were you talking about the flag position, or just image position I noted at the end of the object file?


I think he was talking about the latter (image pos at the end of file) because that is one of our biggest problems currently. We (or at least I) can editing the flag data relatively easily but we (or at least I ) just can't figure out how to make some off-centered objects to be centered and why is editing this code causing crash in a lot of cases.

This is why we want to be able to creating new objects from scratch because that will solving all of such problems immediately. Currently we can only editing the existing objects and that sucks...

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


Adventuring Hero
posted March 22, 2018 04:28 PM

radmutant69 said:
I think he was talking about the latter (image pos at the end of file) because that is one of our biggest problems currently. We (or at least I) can editing the flag data relatively easily but we (or at least I ) just can't figure out how to make some off-centered objects to be centered and why is editing this code causing crash in a lot of cases.

This is why we want to be able to creating new objects from scratch because that will solving all of such problems immediately. Currently we can only editing the existing objects and that sucks...


Haha yeah that would make the most sense

Which code in particular is causing the crashes? I can possibly help with some of these since I can refer to Namerutan's documentation.

There are several cases where if you change something, such as the first two bytes of an adventure object file, then you have to add or remove another field.

The program could also be crashing if it attempts to draw something that is partially out of the frame's boundary.

Have you looked into the image sizes for different foot prints? Namerutan's tool seems to have sizes listed along with the foot print size. Might be something to research if you have the time.

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


Known Hero
posted March 22, 2018 05:40 PM
Edited by radmutant69 at 17:41, 22 Mar 2018.

Well, this
iliveinabox05 said:
The program could also be crashing if it attempts to draw something that is partially out of the frame's boundary.

is what I thought to be the source of my problem and you just comfirmed it. So I'll really have to wait for your tool to finally solve it I guess

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


Adventuring Hero
posted March 22, 2018 06:28 PM

radmutant69 said:
Well, this
iliveinabox05 said:
The program could also be crashing if it attempts to draw something that is partially out of the frame's boundary.

is what I thought to be the source of my problem and you just comfirmed it. So I'll really have to wait for your tool to finally solve it I guess


Well, I'll take another look at Namerutan's documentation, but I don't think there will be anything for the frame size inside the definition of the adventure object files. That's something that may be part of the exe and based on the foot print size, so I may need your help in determining that.

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


Famous Hero
posted March 22, 2018 11:58 PM

I was in fact refering to the flag position - as you can read in my last post from january (i think), where I tried to look into it. It's was due to the fact that we (as far as I know) havent yet determined how flag position is determined. Perhaps Rad has gotten more insight over time, but - in short - we have a 'position' code and codes that either moves the flag left or right, so the flag isn't just put in place by a code matching a decimal number.

But for now I agree the footprint is more important to look into.

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


Famous Hero
posted March 23, 2018 12:05 AM

iliveinabox05 said:
radmutant69 said:
I think he was talking about the latter (image pos at the end of file) because that is one of our biggest problems currently. We (or at least I) can editing the flag data relatively easily but we (or at least I ) just can't figure out how to make some off-centered objects to be centered and why is editing this code causing crash in a lot of cases.

This is why we want to be able to creating new objects from scratch because that will solving all of such problems immediately. Currently we can only editing the existing objects and that sucks...


Have you looked into the image sizes for different foot prints? Namerutan's tool seems to have sizes listed along with the foot print size. Might be something to research if you have the time.


I recall I documented a clear relation between objects TILE size and the lenght of the footprint. Not sure the actual image size has much matter on that, but would have to check to be sure.

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


Adventuring Hero
posted March 23, 2018 01:39 AM

Karmakeld said:
I was in fact refering to the flag position - as you can read in my last post from january (i think), where I tried to look into it. It's was due to the fact that we (as far as I know) havent yet determined how flag position is determined. Perhaps Rad has gotten more insight over time, but - in short - we have a 'position' code and codes that either moves the flag left or right, so the flag isn't just put in place by a code matching a decimal number.

But for now I agree the footprint is more important to look into.


Michael, the part of my post before the edit is addressing what you can do to play around with the flag location. Play around with the values the way I mentioned and let us know what you find! If you have further questions about what you should edit or copy and change in your object, let me know.

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


Known Hero
posted March 23, 2018 12:22 PM
Edited by radmutant69 at 12:45, 23 Mar 2018.

Karmakeld said:
I was in fact refering to the flag position - as you can read in my last post from january (i think), where I tried to look into it.


Oops then I still have a lot to learn about mind-reading

Karmakeld said:
It's was due to the fact that we (as far as I know) havent yet determined how flag position is determined. Perhaps Rad has gotten more insight over time, but - in short - we have a 'position' code and codes that either moves the flag left or right, so the flag isn't just put in place by a code matching a decimal number.


I'm not really sure we could just 'put the flag by a decimal number' or something because... Huh... I just checked the email what I sent you about this some time ago, and re-reading  that sh*t was a bit confusing even for me without some further explanation. So I'll try again.

At first let's change the flag code of an object to 8 FF like this:



The result will being this:



This is what I referred as 'default FF position' in my email, but also changing the flag code to 8 '00' will be the same. The game will moving the flag to the left/right or up/down from that position if the code isn't 8 FF or 00...

And here comes the problem with decimal numbers because the moving is working like this:



So if you move the flag to the left or up direction, an 'FE' value will be like '-1' or '1 to left/up' rather than '254' what it should be. You can't just simply convert it to a decimal number, I think.

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


Adventuring Hero
posted March 23, 2018 04:45 PM

Oh cool, so 0, 0 is basically the center of the object?

Then the positive x direction is right and the positive y direction is down, just like normal pixel drawing.

You can use a decimal to hex converter for those values. -1 will give you FF FF FF FF.

So you can test different offsets in this way to see where the flag ends up.

I believe I am correctly parsing the interactivity data, but some of the cases are different than the basic one in Namerutan's documentation, so I need to wrap my head around it.

Having said that, I may be able to start looking at flag placement and make that editable on my tool.

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


Famous Hero
posted March 23, 2018 11:24 PM
Edited by Karmakeld at 23:34, 23 Mar 2018.

Well your mail response didn't make much sense at the time, but neither have I played around with it, so...
Well placing the flag by decimal number might be a bit litteral, but you kinda answered my question anyway with your diagram. My point or search was that the flag is obviously positioned somehow, but your diagram suggest it's somewhat centered in the image..? If so, that would answer how flag position is determined, and how it's moved up/down or left/right.
And from I read from Derricks reply it does deem to match with decimal.
This will allows us to calculate/decide where the flag should be when looking at an image.

Derrick, I read your post. I'll see if I have time during the weekend to test it.

Edit. Derrick you go4 a good point about the pixel drawing. In Gimp 0,0 is the top left corner, that's why the flag's postion number puzzled me, as it's read as 0,0 in ResHelper. Going/counting left from the top left corner didn't make much sense, but I think (hope) you both just helped solve the puzzle (at least for me).

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


Adventuring Hero
posted March 24, 2018 06:09 AM

Have a look in the resource editor thread the x and y offsets are indeed in pixels and from the center of the object. And my resource editor can easily edit the location using decimal instead of hex

I haven't yet tried adding a flag to an object that doesn't have one and I haven't coded it yet either.

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


Adventuring Hero
posted March 24, 2018 07:56 PM

Well, I edited a mountain object to contain the flag code, and the editor will read it and it can be placed on the map, but without any editable properties, it can't be displayed!

Michael, which object are you attempting to make flaggable?

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


Famous Hero
posted March 24, 2018 08:45 PM

So I just played around with the flag position and indeed we can calculate it's position
The Flag's 0, 0 position (bottom of the flag that is) will always be at the top of the passability info, as Radmutant pointed out as being it's default position.
And indeed if we convert the hex value to decimal it matches the amount of pixels moved either right or left (00 or FF).
Oh and there's a reason why codes are always 3x ff or 3x 00. I tried changing it to 00 01 02 and the flag just flew out of the map haha. It moved so far away, it couldn't display on a small map, so don't edit those. I assume this will be easy to add to the ResourceEditor, so that changes can be viewed.
____________

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


Famous Hero
posted March 24, 2018 09:24 PM

iliveinabox05 said:
radmutant69 said:
Well, this
iliveinabox05 said:
The program could also be crashing if it attempts to draw something that is partially out of the frame's boundary.

is what I thought to be the source of my problem and you just comfirmed it. So I'll really have to wait for your tool to finally solve it I guess


Well, I'll take another look at Namerutan's documentation, but I don't think there will be anything for the frame size inside the definition of the adventure object files. That's something that may be part of the exe and based on the foot print size, so I may need your help in determining that.


If you open Namerutan's ResHelper and take a look at e.g. Ballista Works the image's overall size is read (object info, size), for this object it's 171x142.
I just checked it in gimp, and it matches the canvas size.
If you open Ballista Work in hex editor and search for 171 and 142, you can find these numbers for each frame, but I'm not sure which of the positions ResHelper reads.


iliveinabox05 said:
Michael, which object are you attempting to make flaggable?


I'm not trying to make unflagable objects flagable, but rather move flag positions for some of our mirrored objects. But I should have it covered now
____________

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


Adventuring Hero
posted March 24, 2018 11:31 PM

Ah well if just moving the flag is all you wanted to do, then that is done

And yeah, those image values have to be coming from somewhere. Possibly a field that is incorrectly named in the documentation, but I don't see anything that says how big the image actually is.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 10 pages long: 1 2 3 4 5 6 7 8 9 10 · «PREV
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0895 seconds