Jump to content

Photo

weidu patching request


8 replies to this topic

#1 igi

igi

    IESDP Guardian

  • Gibberlings
  • 1221 posts
  • Gender:Male

Posted 02 August 2004 - 10:11 AM

Lo folks,
Would it be possible for any weidu guru to draw up some weidu code to accomplish this task for me?

What I have
-----------
I have a series of items, named iiixxx (where xxx is a numbering system, starting at 000).
Each item has 3 extended headers (this is a guarenteed fact).
Each extended header has a varying number of feature blocks.
None of the items have any equipping effects.

What I want
-----------
I want to add a feature block to every extended header, on every item.
The feature block should contain a string in the 'resource' field, consisting of iiixxxY, where xxx is the numeric code from the filename (so 000 for the first item, 001 for the second item), and Y is the extended header index (so A for extended header 1, B for extended header 2, and C for extended header 3).

Basically, I want every extended header on every item, so set a unique global variable, based on the items filename and the extended header used.

Thanks!! :)

#2 igi

igi

    IESDP Guardian

  • Gibberlings
  • 1221 posts
  • Gender:Male

Posted 04 August 2004 - 09:23 AM

*bump*
I'd settle for just adding a feature block to each extended header in an item, if the rest is to hard.
Please.

#3 Idobek

Idobek

    Dust Bunny

  • Retired Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 04 August 2004 - 01:17 PM

It is actually fairly easy. I'll try and get it done on Sunday, no promises though.
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'

#4 Idobek

Idobek

    Dust Bunny

  • Retired Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 08 August 2004 - 03:36 PM

Okay, this should do the job:
BEGIN ~igi's Request~

COPY ~mymod/iii001.itm~ ~override~
     ~mymod/iii002.itm~ ~override~
     ~mymod/iii003.itm~ ~override~
     ~mymod/iiixxx.itm~ ~override~
  READ_LONG 0x64 "abilitiesoffset"
  READ_LONG 0x6a "effectsoffset"
  READ_SHORT 0x68 "#abilities1"
  READ_SHORT 0x68 "#abilities2"
  READ_SHORT 0x70 "#globaleffects"
  WHILE ("%#abilities1%" > 0) BEGIN
    SET "ability#" = ("%#abilities1%" - 1)
    SET "ability" = ("%abilitiesoffset%" + "%ability#%" * 0x38)
    READ_SHORT ("%ability%" + 0x1e) "#effects"
    READ_SHORT ("%ability%" + 0x20) "effectsindex"
    INSERT_BYTES ("%effectsoffset%" + "%effectsindex%" * 0x30) 0x30
      WRITE_EVALUATED_ASCII ("%effectsoffset%" + "%effectsindex%" * 0x30 + 0x14) ~%SOURCE_FILE%~
      /* This WRITE_LONG removes the .ITM of %SOURCE_FILE%. */
      WRITE_LONG ("%effectsoffset%" + "%effectsindex%" * 0x30 + 0x20) 0x00000000
    WRITE_SHORT ("%ability%" + 0x1e) ("%#effects%" + 1)
  SET "#abilities1" = ("%#abilities1%" - 1)
  END
  SET "ability#" = 0
  SET "total#effects" = "%#globaleffects%"
  WHILE ("%ability#%" < "%#abilities2%") BEGIN
    READ_SHORT ("%abilitiesoffset%" + "%ability#%" * 0x38 + 0x1e) "#effects"
    WRITE_SHORT ("%abilitiesoffset%" + "%ability#%" * 0x38 + 0x20) "%total#effects%"
    SET "total#effects" = ("%total#effects%" + "%#effects%")
  SET "ability#" = ("%ability#%" + 1)
  END
It is not fully tested but I think it is fine. I'm sure you can work out the rest of the WRITE_BYTE/SHORT/LONGs required to make the new effect work. If not, tell me what you need and I'll add them in.
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'

#5 igi

igi

    IESDP Guardian

  • Gibberlings
  • 1221 posts
  • Gender:Male

Posted 09 August 2004 - 11:03 AM

Thank you!
It will save a lot of time.

#6 igi

igi

    IESDP Guardian

  • Gibberlings
  • 1221 posts
  • Gender:Male

Posted 09 August 2004 - 01:33 PM

I've had a play with this code, and it works great. There was an issue with the end of the resouce key not being blanked properly, but it was easy enough to fix.

However, there is a small detail of my request which hasn't been implemented. I wanted the resource key for each extended header to be iixxxA, iixxxB or iixxxC, dependent on weather it's extended header 1, 2 or 3. Is this possible to do?

The feature block should contain a string in the 'resource' field, consisting of iiixxxY, where xxx is the numeric code from the filename (so 000 for the first item, 001 for the second item), and Y is the extended header index (so A for extended header 1, B for extended header 2, and C for extended header 3).



#7 Idobek

Idobek

    Dust Bunny

  • Retired Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 09 August 2004 - 01:51 PM

It would be easy if the suffix could be a number instead of a letter, is that alright?
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'

#8 igi

igi

    IESDP Guardian

  • Gibberlings
  • 1221 posts
  • Gender:Male

Posted 09 August 2004 - 01:57 PM

Yes, that would be ok, as long as it is a single digit number :(

#9 Idobek

Idobek

    Dust Bunny

  • Retired Gibberlings
  • 1001 posts
  • Gender:Male
  • Location:England

Posted 09 August 2004 - 02:00 PM

If so, the only thing you need to change is the WRITE_LONG section that removes the .ITM extension. Change the line like so:
WRITE_LONG ("%effectsoffset%" + "%effectsindex%" * 0x30 + 0x19) "%#abilities1%"
I fixed the offset too, it seems I added an extra i to the filenames when I worked it out.
Did you know G3 has secret forum rules?
Yep. They're generally of the nature 'don't annoy Idobek.'



Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users