Author Topic: My Feature Request (area editing) Nearly Done!  (Read 2029 times)

Ryder

  • Guest
My Feature Request (area editing) Nearly Done!
« on: May 20, 2004, 11:17:38 PM »
CBisson
Posted: Apr 12 2004, 01:34 AM


Ok, I've got templates I've set up to successfully add stuff to .ARE files (so far Actors, Entrances, Spawns, Ambiants, Items [in existing containers],Animations, Automap Notes, and Variables) but I'm having a bit of trouble with Triggers, Doors, and Containers because of the Vertices.

Could someone take a look at this, try it out for yourself if you'd like: it's nearly working right, and perhaps see where I'm going wrong with the Vertices? It would be an enormous help to all. Thanks.

Quote
BACKUP ~trigger/backup~ //where should we put backup files?
AUTHOR "http://www.teambg.net/~checkbod"
AUTO_TRA ~trigger/%s~
ALLOW_MISSING ~bsarev25.dlg~
              ~fatesp.dlg~
              ~valenj.dlg~
              ~ar4500.bcs~
              ~baldur25.bcs~
    ~baldur.bcs~
              ~ar0326.bcs~
              ~ar0330.bcs~
              ~ar6200.bcs~      // ToB epilogues
              ~bkeldo25.dlg~    // keldorn
LANGUAGE  ~American English~
  ~american~
  ~trigger/american/wsetup.tra~


BEGIN ~Figure Out How To Add Stuff To ARE files With Weidu.~

//Which File are we going to edit:
COPY_EXISTING ~AR0020.ARE~ ~override/AR0020.ARE~

//Prepare Variables by having Weidu read and save:
  READ_SHORT ~0x058~ ~#ofActor~
  READ_SHORT ~0x054~ ~actorOff~
  READ_SHORT ~0x05a~ ~#ofTrigg~
  READ_SHORT ~0x05c~ ~triggOff~
  READ_SHORT ~0x064~ ~#ofSpawn~
  READ_SHORT ~0x060~ ~spawnOff~
  READ_SHORT ~0x06c~ ~#ofEntra~
  READ_SHORT ~0x068~ ~entraOff~
  READ_SHORT ~0x074~ ~#ofConta~
  READ_SHORT ~0x070~ ~contaOff~
  READ_SHORT ~0x076~ ~#ofItems~
  READ_SHORT ~0x078~ ~itemsOff~
  READ_SHORT ~0x080~ ~#ofVerti~
  READ_SHORT ~0x07c~ ~vertiOff~
  READ_SHORT ~0x082~ ~#ofAmbia~
  READ_SHORT ~0x084~ ~ambiaOff~
  READ_SHORT ~0x08c~ ~#ofVaria~
  READ_SHORT ~0x088~ ~variaOff~
  READ_SHORT ~0x09c~ ~#ofExplo~
  READ_SHORT ~0x0A0~ ~exploOff~
  READ_SHORT ~0x0A4~ ~#ofDoors~
  READ_SHORT ~0x0A8~ ~doorsOff~
  READ_SHORT ~0x0AC~ ~#ofAnima~
  READ_SHORT ~0x0B0~ ~animaOff~
  READ_SHORT ~0x0B4~ ~#ofTiled~
  READ_SHORT ~0x0B8~ ~tiledOff~
  READ_SHORT ~0x0BC~ ~songsOff~
  READ_SHORT ~0x0C0~ ~restcOff~
  READ_SHORT ~0x0C8~ ~#ofAutom~
  READ_SHORT ~0x0C4~ ~automOff~


//What type of header are we going to add?  For this one, a trigger.  Increase that Variable by 1.
  WRITE_SHORT 0x05a (~%#ofTrigg%~ + 1)

//Since we'll be increasing the number of triggers by inserting bytes, we need to adjust the other headers by a
//specific number of bytes.  Do that here.
//REM out what you don't want to change.
//  WRITE_SHORT 0x058 (~%actorOff%~) //note, this is prior to the triggers so we don't need to change it.
  WRITE_SHORT 0x060 (~%spawnOff%~ + 196)
  WRITE_SHORT 0x068 (~%entraOff%~ + 196)
  WRITE_SHORT 0x070 (~%contaOff%~ + 196)
  WRITE_SHORT 0x078 (~%itemsOff%~ + 196)
  WRITE_SHORT 0x07c (~%vertiOff%~ + 196)
  WRITE_SHORT 0x084 (~%ambiaOff%~ + 196)
  WRITE_SHORT 0x088 (~%variaOff%~ + 196)
  WRITE_SHORT 0x0A0 (~%exploOff%~ + 196)
  WRITE_SHORT 0x0A8 (~%doorsOff%~ + 196)
  WRITE_SHORT 0x0B0 (~%animaOff%~ + 196)
  WRITE_SHORT 0x0B8 (~%tiledOff%~ + 196)
  WRITE_SHORT 0x0BC (~%songsOff%~ + 196)
  WRITE_SHORT 0x0C0 (~%restcOff%~ + 196)
  WRITE_SHORT 0x0C4 (~%automOff%~ + 196)

//Now, insert the correct number of bytes by following the formula:  (the number of original headers times their length added to the start of their offset) so that the new trigger ends up at the "end" of the list to reduce the possiblty of messing up other vertices or resrefs.
  INSERT_BYTES (~%triggOff%~ + ~%#ofTrigg%~ * 196) 196


//Now, you can start adding in the actual code for whatever you are inserting.
//Name
  WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196) ~City Gates Statue~
//Trigger Type
  WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 32) 01
//Trigger Icon
  WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 52) 22
//Trigger Text
  WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 100) 5185 //dialog string reads "Statue"

//Now, we've got to set up the vertices.  I suggest you use IETME to make the graphical representation, then view the numbers with NI
//bounding box:
  WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 34) 568
  WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 36) 175
  WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 38) 676
  WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 40) 337
//#vertices
  WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 42) 8

//Now, we've got to set the vertice offset in the new trigger, insert the blank bytes, write over the blank bytes, and move everything down agian.

For my trigger test, I grabbed 8 variables which follow:
589 332
568 235
587 189
620 174
667 182
676 217
661 337
589 332

With those variables added to AR0020, a primative outline should appear around the big statue standing to the left of the main Gates which when clicked in game would make a display string that reads "Statue". Of course, you could theoritically add your own new string, but that's already pretty well documented.

I'm going to clean up my templates- they've worked well on every area I've tried so far- and put in more comments before I post them up here.

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #1 on: May 20, 2004, 11:18:51 PM »
Idobek
Posted: Apr 12 2004, 06:34 AM


Imagine reason you have been having trouble with adding vertices is that you have been updating too many offsets. The order the offsets are indexed in the file are not the order they appear in the file. I'm not really making sense so have a look at this:

Code: [Select]
//Which File are we going to edit:
COPY_EXISTING ~AR0020.ARE~ ~override/AR0020.ARE~

//Prepare Variables by having Weidu read and save:
 READ_SHORT ~0x058~ ~#ofActor~
 READ_SHORT ~0x054~ ~actorOff~
 READ_SHORT ~0x05a~ ~#ofTrigg~
 READ_SHORT ~0x05c~ ~triggOff~
 READ_SHORT ~0x064~ ~#ofSpawn~
 READ_SHORT ~0x060~ ~spawnOff~
 READ_SHORT ~0x06c~ ~#ofEntra~
 READ_SHORT ~0x068~ ~entraOff~
 READ_SHORT ~0x074~ ~#ofConta~
 READ_SHORT ~0x070~ ~contaOff~
 READ_SHORT ~0x076~ ~#ofItems~
 READ_SHORT ~0x078~ ~itemsOff~
 READ_SHORT ~0x080~ ~#ofVerti~
 READ_SHORT ~0x07c~ ~vertiOff~
 READ_SHORT ~0x082~ ~#ofAmbia~
 READ_SHORT ~0x084~ ~ambiaOff~
 READ_SHORT ~0x08c~ ~#ofVaria~
 READ_SHORT ~0x088~ ~variaOff~
 READ_SHORT ~0x09c~ ~#ofExplo~
 READ_SHORT ~0x0A0~ ~exploOff~
 READ_SHORT ~0x0A4~ ~#ofDoors~
 READ_SHORT ~0x0A8~ ~doorsOff~
 READ_SHORT ~0x0AC~ ~#ofAnima~
 READ_SHORT ~0x0B0~ ~animaOff~
 READ_SHORT ~0x0B4~ ~#ofTiled~
 READ_SHORT ~0x0B8~ ~tiledOff~
 READ_SHORT ~0x0BC~ ~songsOff~
 READ_SHORT ~0x0C0~ ~restcOff~
 READ_SHORT ~0x0C8~ ~#ofAutom~
 READ_SHORT ~0x0C4~ ~automOff~

//What type of header are we going to add?  For this one, a trigger.  Increase that Variable by 1.
 WRITE_SHORT 0x05a (~%#ofTrigg%~ + 1)
 WRITE_SHORT 0x080 (~%#ofVerti%~ + 8)

//Since we'll be increasing the number of triggers by inserting bytes, we need to adjust the other headers by a
//specific number of bytes.  Do that here.
//REM out what you don't want to change.
//  WRITE_SHORT 0x058 (~%actorOff%~) //note, this is prior to the triggers so we don't need to change it.
 WRITE_SHORT 0x060 (~%spawnOff%~ + 196)
 WRITE_SHORT 0x068 (~%entraOff%~ + 196)
 WRITE_SHORT 0x070 (~%contaOff%~ + 196)
 WRITE_SHORT 0x078 (~%itemsOff%~ + 196)
 WRITE_SHORT 0x07c (~%vertiOff%~ + 196)
 WRITE_SHORT 0x084 (~%ambiaOff%~ + 196) // actually occur before vertices
 WRITE_SHORT 0x088 (~%variaOff%~ + 196) // actually occur before vertices
 WRITE_SHORT 0x0A0 (~%exploOff%~ + 228)
 WRITE_SHORT 0x0A8 (~%doorsOff%~ + 196) // actually occur before vertices
 WRITE_SHORT 0x0B0 (~%animaOff%~ + 228)
 WRITE_SHORT 0x0B8 (~%tiledOff%~ + 228)
 WRITE_SHORT 0x0BC (~%songsOff%~ + 228)
 WRITE_SHORT 0x0C0 (~%restcOff%~ + 228)
 WRITE_SHORT 0x0C4 (~%automOff%~ + 228)

//Now, insert the correct number of bytes by following the formula:  (the number of original headers times their length added to the start of their offset) so that the new trigger ends up at the "end" of the list to reduce the possiblty of messing up other vertices or resrefs.
 INSERT_BYTES (~%triggOff%~ + ~%#ofTrigg%~ * 196) 196
 INSERT_BYTES (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196) 32

//Now, you can start adding in the actual code for whatever you are inserting.
//Name
 WRITE_ASCII (~%triggOff%~ + ~%#ofTrigg%~ * 196) ~City Gates Statue~
//Trigger Type
 WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 32) 01
//Trigger Icon
 WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 52) 22
//Trigger Text
 WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 100) 5185 //dialog string reads "Statue"

//Now, we've got to set up the vertices.  I suggest you use IETME to make the graphical representation, then view the numbers with NI
//bounding box:
 WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 34) 568
 WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 36) 175
 WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 38) 676
 WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 40) 337
//#vertices
 WRITE_SHORT (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 42) 8
//vertex index
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 44) ~%#ofVerti%~

//Now, write the new vertices.
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196) 589
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 2) 332
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 4) 568
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 6) 235
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 8) 587
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 10) 189
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 12) 620
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 14) 174
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 16) 667
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 18) 182
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 20) 676
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 22) 217
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 24) 661
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 26) 337
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 28) 589
 WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 30) 332

I think this does what you want.

It appears adding a trigger point with WeiDU is now possible.   :)

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #2 on: May 20, 2004, 11:20:26 PM »
Idobek
Posted: Apr 12 2004, 06:48 AM


I'm not getting the outline. However the Crooked Crane sign doesn't have an outline either. Are you sure trigger points get outlines? Doors and containers do but I'm not sure about trigger points.

*****

CBisson
Posted: Apr 12 2004, 07:55 PM


Oh yeah!


Idobek, you got it my friend. I copied the last few lines from your updated code and threw them into mine. Perfect outline in Infinity explorer:

http://www.teambg.net/%7Echeckbod/htmlimage/trigger.jpg


Quote
The order the offsets are indexed in the file are not the order they appear in the file. 



I understand that, and it doesn't make a difference for this code. Regardless of what order the headers appear, they're updated correctly. I've tested all of the codes I've done on six areas: The city gates, the Promenade, Umar Hills, AR0044 (random area), the Windspear Dungeon, and a CtB area. With that sampling of areas with different objects, I'm sure it works well enough.

The only problem I'm having now is regarding adding automap notes to original BGII areas that don't have notes already: their automap offset is defaulted to 0h, which seriously screws up everything. (But adding notes to an area that has existing notes or was 'hand-made' works.)

With that fixed, I'm just going to go back through my codes for the other two, Containers and Doors, and then figure out why the Spawn point is added but doesn't actually spawn creatures. I'll post up the codes soon enough.

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #3 on: May 20, 2004, 11:22:07 PM »
CBisson
Posted: Apr 12 2004, 08:42 PM


No! On second look, it didn't quite come out right. In game, it crashed. Idobeck, you only wrote the variables over stuff, not inserted blank ones to write over those.

Folks, check the code again: We've gotten as far as setting the number of vertices in the new trigger. Now we have to add those vertices, make the new trigger look to that first new vertice, and push the following headers down again. Something like this, but I'm not getting the # right.

Quote
WRITE_LONG (~%triggOff%~ + ~%#ofTrigg%~ * 196 + 44) (~%#ofVerti%~ + 1)

//update the offsets:
  WRITE_SHORT 0x080 (~%#ofVerti%~ + 8)
//that fixes the # of vertices in the area header with the correct number of vertices.  Just put the + # of how many you're adding.

  INSERT_BYTES (~%vertiOff%~ + ~%#ofVerti%~ * 228) 228

  WRITE_SHORT 0x0B0 (~%animaOff%~ + 228)
  WRITE_SHORT 0x0BC (~%songsOff%~ + 228)
  WRITE_SHORT 0x0C0 (~%restcOff%~ + 228)
  WRITE_SHORT 0x0C4 (~%automOff%~ + 228)

//Now, write the new vertices.
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196) 589
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 2) 332
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 4) 568
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 6) 235
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 8) 587
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 10) 189
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 12) 620
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 14) 174
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 16) 667
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 18) 182
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 20) 676
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 22) 217
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 24) 661
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 26) 337
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 28) 589
WRITE_SHORT (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196 + 30) 332

See that "+ 228"? That's where I'm running into problems. What's the number supposed to be for each added vertice? If I want to add a single vertice point, am I supposed to


Quote
INSERT_BYTES (~%vertiOff%~ + ~%#ofVerti%~ * 2) 2


?

I'm just not getting how many bytes I'm supposed to add for each vertice. Any help?

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #4 on: May 20, 2004, 11:23:00 PM »
MagusWizardo
Posted: Apr 12 2004, 10:28 PM


Just to be pedantic, the singular of 'verticies' is 'vertex', not 'vertice'.
Also, what Idobek meant with them not being indexed in order is that you were updating the offset value for groups of things (eg, doors) when adding a vertex won't actually affect that group of things.
See, for example, AR404.ARE -
0x7C - Vertices Offset: 28d0
0xA8 - Doors Offset: 2808

Since the doors offset is lower than the vertices offset, adding a vertex will not affect the doors any. Meaning, you don't actually have to update the doors offset.

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #5 on: May 20, 2004, 11:24:23 PM »
Idobek
Posted: Apr 13 2004, 02:33 AM
 

Quote
I copied the last few lines from your updated code and threw them into mine.




Quote
Idobeck, you only wrote the variables over stuff, not inserted blank ones to write over those.


I updated altered more of your code than just the end. I did add new vertices, here:

Code: [Select]
INSERT_BYTES (~%triggOff%~ + ~%#ofTrigg%~ * 196) 196
INSERT_BYTES (~%vertiOff%~ + ~%#ofVerti%~ * 4 + 196) 32



Look over all the code I posted again everything should be in there


 
Quote
I'm just not getting how many bytes I'm supposed to add for each vertice. Any help?


Each vertex is 4 bytes, 2 each for the x and y values.


Quote
Code: [Select]
INSERT_BYTES (~%vertiOff%~ + ~%#ofVerti%~ * 228) 228

 

You shouldn't be multiplying anything be 228 and neither should you be adding 228 bytes in one shot. 228 is the total number of bytes, 196 for the trigger, 32 for 8 vertices.

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #6 on: May 20, 2004, 11:28:51 PM »
CBisson
Posted: Apr 13 2004, 03:47 PM


Guess what folks! We've got it.

Thank Idobek for the logical solutions to my math deficiency.

Check out the screenshot of the trigger in-game:

http://www.teambg.net/%7Echeckbod/htmlimage/statue.jpg


Ok, let me do up some tests with it: making different triggers with different number of vertices in different areas and such and then I'll start on the Containers. I don't think I'll be doing Doors as there's really no need: I don't think weidu can add to a tileset anyhow. Just think, probably sometime this coming weekend, weidu will be able to completely modify an existing area. Pretty cool, if you ask me.

*****

CBisson
Posted: Apr 13 2004, 05:11 PM


The template for Area Triggers is done. I've tried it on 6 areas with basically the same "trigger" (a proximity, a travel, and an info for each area), but I need your feedback to flesh out the codes.

Please, download the code and try it out for yourself. Give me some feedback please.


http://www.teambg.net/%7Echeckbod/ctbftpzi...AreaTrigger.tp2


THANKS ALL!

*****

Loriel
Posted: Apr 16 2004, 11:15 AM


I'm a Mac modder, and since we don't have an area editor, NI and Weidu are all we have for this task (the only problem is lack of graphical editor). I've been using this technique for a few months now in several of my mods. I don't read this forum much anymore, so I didn't know there was a demand for it, otherwise I would have posted it sooner. Probably better that I didn't, though, because your template is infinitely better documented than mine would have been.

*****

CBisson
Posted: Apr 17 2004, 11:36 AM


Idobek-

Can I get some more logical help? Something's wrong with my numbers for the containers. Check this one out if you would please:


http://www.teambg.net/%7Echeckbod/ctbftpzi...eaContainer.tp2

*****

Idobek
Posted: Apr 17 2004, 02:08 PM 


I think the first thing you need to fix is the amount of bytes you are adding for a container. I'm making a container to be 192 bytes not 184. I'll look at it more closely tomorrow.

*****

CBisson
Posted: Apr 17 2004, 02:22 PM


Yup, you're right again. IEDSP is slightly wrong with it's offsets for the .ARE container headers: instead of the last offset at 0x088h +56d, it's 0x80h +56d. Just a IEDSP typo that I didn't look closely at.   

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #7 on: May 20, 2004, 11:30:04 PM »
Idobek
Posted: Apr 17 2004, 03:19 PM


Whew. Well, there were a number of things wrong, I'll try to go over them all.

1. A container is 192 bytes (already established).
2. WRITE_SHORT/LONG was used wrongly in a lot of locations. I suggest you use NI and select 'edit as hex' for each field to make sure you're getting it right.
3. You should use ~%#ofItems%~ at the items index in the new container, much the same as for the vertices.
4. The biggy, but an easy mistake to make. When adding the bytes for your item you did this:

Code: [Select]
WRITE_SHORT 0x07c (~%vertiOff%~ + 20)
 WRITE_SHORT 0x084 (~%ambiaOff%~ + 20)
 WRITE_SHORT 0x088 (~%variaOff%~ + 20)
 WRITE_SHORT 0x0A0 (~%exploOff%~ + 20)
 WRITE_SHORT 0x0A8 (~%doorsOff%~ + 20)
 WRITE_SHORT 0x0B0 (~%animaOff%~ + 20)
 WRITE_SHORT 0x0B8 (~%tiledOff%~ + 20)
 WRITE_SHORT 0x0BC (~%songsOff%~ + 20)
 WRITE_SHORT 0x0C0 (~%restcOff%~ + 20)
 WRITE_SHORT 0x0C4 (~%automOff%~ + 20)


The problem is these offsets had already been changed and you had not taken this into account. The easiest way to avoid this is to add all your bytes and update all the offsets at the same time.

Below is a link to a (hopefully) working version.

http://www.leia.f2s.com/idobek/ie/weidu/containers.tp2

Ryder

  • Guest
Re: My Feature Request (area editing) Nearly Done!
« Reply #8 on: May 20, 2004, 11:31:51 PM »
CBisson
Posted: Apr 17 2004, 03:53 PM
 

You got it!

Quote
I'll try to go over them all.

1. A container is 192 bytes (already established).
2. WRITE_SHORT/LONG was used wrongly in a lot of locations. I suggest you use NI and select 'edit as hex' for each field to make sure you're getting it right.
3. You should use ~%#ofItems%~ at the items index in the new container, much the same as for the vertices.
4. The biggy, but an easy mistake to make. When adding the bytes for your item you did this:




1) I had fixed this when you pointed it out the first time. I also posted a correction to the .ARE format for IEDSP at TeamBG.
2) That is something that confuses a lot of folks, and I never know which one to use because I don't quite understand it myself.
3) I did alter that once I realized that in areas that already had containers and items my item wasn't in the new container and the original item number 1 was.
4) As above, #2.

I did have another problem with the added items when containers/items already existed, as I said, it was reading the first item and not mine, but also that something funky happened with the original items getting "pushed" down so that no items were in the right place, but yours seems to fix that.
I just tried it on a bunch of different areas (the same headers but different ARE files) and it goes off without any issues. I'm thinking it's good. If you don't mind, I'll go back through yours and "tutorialize" it for posting.
Then I'll fix the Spawn template and we'll be set.

Thanks for all your help!

*****

MagusWizardo
Posted: Apr 17 2004, 04:37 PM


WRITE_BYTE/SHORT/LONG :
In NI, look at the offset your writing to. Look at the next offset listed. Open Windows calculator, put it in Hex mode, and put in the next offset minus the offset you're writing to (WITHOUT the ending 'h'). Look at the result:
1 = WRITE_BYTE
2 = WRITE_SHORT
4 = WRITE_LONG .   

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: