Author Topic: Change field / menu functionality of items  (Read 5666 times)

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Change field / menu functionality of items
« on: 2012-10-03 11:28:11 »
I went through 4 pages of the search engine before I gave up on finding it. I believe someone once told me where in the .exe the items are but I can't find it anymore.
I know that the last item IDs handled in the .exe ( for field functions ) are the limit learn items, but that's fine. I only need to adjust some items like potions, elixirs and stuff
anyone know where in the .exe the items start and what format they have?

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Change field / menu functionality of items
« Reply #1 on: 2012-10-03 15:14:01 »
They're actually treated like field scripts, not like attacks stored in the KERNEL.BIN. You can alter bits and pieces of them, but changing effects entirely would require rewriting.

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Re: Change field / menu functionality of items
« Reply #2 on: 2012-10-03 15:33:26 »
it's mostly "how much HP / MP does this heal"
how much is "bits and pieces"?
would it be possible to make an item target the group ( mega lixir ) instead of single ( x-potion )?
because thats really all I'd need to change
amount healed and target mask

on that topic, I assume field spells are handled like this too? like "can be used" and "what does it do" ?

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Change field / menu functionality of items
« Reply #3 on: 2012-10-03 18:04:32 »
it's mostly "how much HP / MP does this heal"
how much is "bits and pieces"?
would it be possible to make an item target the group ( mega lixir ) instead of single ( x-potion )?
because thats really all I'd need to change
amount healed and target mask

on that topic, I assume field spells are handled like this too? like "can be used" and "what does it do" ?

amount healled, yes
targets, no

Here's a list of address of things you can reasonably change:
Code: [Select]
Sources (amount of bonus they grant):
   Power: 0x315F31; default 1
   Guard: 0x315F80; default 1
   Magic: 0x315FD0; default 1
   Mind:  0x31601F; default 1
   Speed: 0x31606E; default 1
   Luck:  0x3160BB; default 1
Potion       (amount of HP to restore): 0x316184 ; default 64h, limit FFh
Hi-Potion    (amount of HP to restore): 0x316212 ; default 1F4h, stored as word, limit 7FFFh (overflow could result otherwise)
Ether        (amount of MP to restore): 0x3162A3 ; default 64h, limit FFh
Turbo Ether  (amount of MP to restore): 0x316331 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)
Phoenix Down (amount of HP to restore): 0x3163C8 ; default 2, power of two to divide MHP by (eg. MHP / 2^[X] ), technically a bit-shift right, more below
Tent         (amount of HP to restore): 0x3164B6 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)
Tent         (amount of MP to restore): 0x3164C7 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)
X-Potion     (amount of HP to restore): 0x316570 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)
Elixir       (amount of HP to restore): 0x316613 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)
Elixir       (amount of MP to restore): 0x316627 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)
Megalixir    (amount of HP to restore): 0x316715 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)
Megalixir    (amount of MP to restore): 0x316726 ; default 2710h, stored as word, limit 7FFFh (overflow could result otherwise)

For phoenix downs it's probably better to not modify this too high. It becomes useless at low MHPs quickly. A value of 7 is as high as I'd say could safely be used. Some characters can start out with less than 256 MHP so it would revive them with 0 HP and they'd be dead at the start of the next battle anyway.

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Re: Change field / menu functionality of items
« Reply #4 on: 2012-10-03 18:45:02 »
works fine, thanks again

enabled potion, high potion, mega potion, ether, mega ether, lixir and phoenix down in the menu now

got any info on the heal spells?

edit: okay odd...
at the address for potion you gave me, if I change the value to C8, it actually starts to give minus HP. -56 HP after changing it from 64 to C8 ( makes no sense. even if it was a signed 8 bit value, the maximum would be 127 aka 7F. C8 - 7F is 73, not 56 )
« Last Edit: 2012-10-03 19:24:38 by The Rocket Kuugen »

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Change field / menu functionality of items
« Reply #5 on: 2012-10-03 20:13:32 »
Heal spells actually use the magic data from the KERNEL.BIN. There are just a lot of checks to ensure that ONLY Cure, Cure2, Cure3, Life, Life2, and FullCure are usable out-of-battle. Just enabling them apparently isn't enough.

Have you tried a lower number for potion, like 70h?

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Re: Change field / menu functionality of items
« Reply #6 on: 2012-10-03 21:33:46 »
Kernel says Heal always heals for 200 HP ( 4X, ignore mbarrier, always hit ) ( X6 Str * 20, strength is 10 )

However, used in the menu, it heals exactly the same as a vanilla heal spell
same is true for heal2 and heal3 etc

speaking of life2, is there a way to disable that being usable in the menu? because I turned that into a holy attack spell called Smite

havent tried different values on the potion yet.

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Change field / menu functionality of items
« Reply #7 on: 2012-10-03 21:44:10 »
Kernel says Heal always heals for 200 HP ( 4X, ignore mbarrier, always hit ) ( X6 Str * 20, strength is 10 )

However, used in the menu, it heals exactly the same as a vanilla heal spell
same is true for heal2 and heal3 etc

speaking of life2, is there a way to disable that being usable in the menu? because I turned that into a holy attack spell called Smite

havent tried different values on the potion yet.

Hmm. Odd. It should be pulling data from the KERNEL.BIN. I'll look into it again later.

At 0x313840 there should be a list of 52 bytes ranging from 0 - 3 that tell the menu whether to set the spell to be accessible from the out-of-battle menu. It's in the same order as spells from the KERNEL.BIN from Cure to FullCure. A value of 3 will not highlight it in the menu, but it might not be that easy. Try it with that first. If that's not enough I'll do more digging.

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Re: Change field / menu functionality of items
« Reply #8 on: 2012-10-03 22:09:22 »
lower values of potion work as intended
I tried 32h, giving me 50 HP

setting life2 to 03 does display it as grey but it's still usable so theres a check or flag somewhere else

on a spell data related note, it pulls MP cost from the kernel correctly but not the functionality
« Last Edit: 2012-10-03 22:11:09 by The Rocket Kuugen »

nfitc1

  • *
  • Posts: 3011
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Change field / menu functionality of items
« Reply #9 on: 2012-10-04 00:48:13 »
C8 is the twos compliment equivalent of -56. That's how it represents negative numbers. I guess the add function reads that as a negative number even though it should be a word add. Strange.

If I had looked a little further down from where I pointed you to, I'd have seen that the actual functions of the magic menu items start at 0x312C46. These are also chosen from a list in structure identical to the one at 0x313840, but this one is at 0x3138FC. It ranges from 0 - 6 and tells it which function to use. They're individually tailored to the spell you want to use.

The cure spells follow the healing formula: HP += (MAtk + Level) * 6 + X

Cure = 110 if HP > 0
Cure2 = 660 if HP > 0
Cure3 = 1760 if HP > 0

FullCure heals 10000HP if HP > 0
Life heals to MHP >> 2 (quarter HP)
Life2 heals 10000HP

Tenko Kuugen

  • Public Enemy
  • *
  • Posts: 1416
    • View Profile
    • Twitter
Re: Change field / menu functionality of items
« Reply #10 on: 2012-10-04 01:07:42 »
I assume 06 is a dummy formula and does nothing
this is a bit awkward though, as I can only change the function of which spell uses what
for now, I put life2 and fullcure on 06
( with those functions, heal1 will always be the most cost effective one.

I dont think its propable to change the functions so I'll give up on that. I'll be happy if I can dummy out life2 and full cure completely

setting highlight to 03 and function to 06 makes it grey and you cant actually use it but it still lets you call the "use on character" screen
do you think you can find where it enables that?