Jump to content


Photo

2da hardcoded limits?


  • Please log in to reply
17 replies to this topic

#1 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 10 June 2008 - 11:58 PM

I'm trying to add a fourth column to tooltip.2da for some items that have multiple abilities.
COPY_EXISTING ~tooltip.2da~ ~override~

  COUNT_2DA_COLS cl

  COUNT_2DA_ROWS 1 rw

  PATCH_IF cl < 5 BEGIN

	SPRINT rx ~ ~

	SPRINT ry ~-1~

	SPRINT rz ~$ $ 4~

	FOR (i = 0; i < (rw - 3); i += 1) BEGIN

	  SPRINT rz ~%rz% ^ ~%rx%~ ^ ~%ry%~

	END

  END

BUT_ONLY



ACTION_IF cl < 5 THEN BEGIN

  APPEND_COL ~tooltip.2da~ ~%rz%~

END



APPEND ~tooltip.2da~ ~LDHAMM01   15527	  15529	  12124	  12060~ UNLESS ~LDHAMM01~
The code works just fine, adds the column and new row to tooltip.2da, but I don't see the fourth tooltip on the fourth header of ldhamm.itm. So is tooltip.2da hard-limited to 3 columns or what?

Edited by Miloch, 11 June 2008 - 12:03 AM.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#2 Demivrgvs

Demivrgvs
  • Member
  • 143 posts

Posted 11 June 2008 - 12:19 AM

Items cannot have more than three headers (melee, ranged, magical, ...). I think it may be related to that.

#3 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 11 June 2008 - 12:41 AM

Items cannot have more than three headers (melee, ranged, magical, ...). I think it may be related to that.

Eh... well apparently that's not true because I just used Call Lightning from the third header on the item and Lightning Bolt from the fourth. I don't think I got the tooltip for either though, hmm. Maybe I won't bother with it and just add text strings to the abilities instead.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#4 Demivrgvs

Demivrgvs
  • Member
  • 143 posts

Posted 11 June 2008 - 01:09 AM

Additional headers "works" but do strange things when resting (charges get messed up, some are restored others not). At least that's what come up with my tests long time ago. I'll check it again.

#5 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 11 June 2008 - 01:14 AM

Hmm. Maybe I'll just give it a 50/50 chance of casting either then...

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#6 -Guest-

-Guest-
  • Guest

Posted 11 June 2008 - 11:10 AM

http://iesdp.gibberl...tob/tooltip.htm

Extra columns can be added, and work correctly for abilities accessed via the 'use ability' button. Blame Galc if the information is incorrect.

#7 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 11 June 2008 - 11:31 AM

Didn't work... I was pretty sure of that. The fourth column and added row show up fine, but not the fourth tooltip on the item (it is a Use Item ability). I could test it again I guess...

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#8 -Guest-

-Guest-
  • Guest

Posted 11 June 2008 - 02:07 PM

I would be surprised if it worked. Almost all 2DAs should be hardcoded in some fashion (the engine knows what to look for and doesn't pay attention to anything else for each 2DA), and I seriously doubt they'd extend TOOLTIP out to the nth column for no purpose.

You're free to check again (I don't know when/why that showed up in IESDP, but I've never actually tested >3 abilities), but I wouldn't expect much. Try leaving some of them at -1 (so only max three out of all columns have valid strrefs) or setting the melee and ranged ability columns (1 and 2) to **** and see what happens (likely nothing).

#9 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 13 June 2008 - 05:25 AM

On further investigation, adding a fourth tooltip does appear to work. It just wasn't showing up in DLTCEP, so maybe it's a defect in DLTCEP (though at least it gives an option to show item tooltips, unlike NI :P).

However, I noticed something else related to this:

Additional headers "works" but do strange things when resting (charges get messed up, some are restored others not). At least that's what come up with my tests long time ago. I'll check it again.

Even when I was testing an item with just one magic/use item ability (in addition to one melee and one ranged), I was getting weird behaviour with charges. Whenever I CLUAed the item it would generally be drained. If I patched it into a store, it would have 1 charge, even though it was set to 3 per day. And even after I rested it would only gain a single charge. This is in BG2 - I know it doesn't work in BG1. Am I not setting something right or is some of this expected behaviour?

Oh also, if I have an item with two different magic "use item" abilities, is it possible to give them separate projectiles or do they have to share the same one?

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#10 -Guest-

-Guest-
  • Guest

Posted 13 June 2008 - 05:47 AM

You suck. "It doesn't work" means that you tested it in the game, not that stupid DLTCEP doesn't recognize it. DECEIVER!

When you CLUA an item in (or script one in), you need to set the charges (3 abilities in order): CreateItem("blah",1,2,3). >3 abilities will be created with no charges for the subsequent abilities. Same for adding with a store (either setting manually or with WeiDU ADD_STORE_ITEM blah #1 #2 #3 ...). Make sure the item ability you're checking has the number of charges of correctly set and that the recharges flag is set and the recharge behavior set (I don't know how this is set up in DLTCEP, sorry).

Every ability is unique (different projectile, range, charges, icon, etc., will work fine).

#11 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 13 June 2008 - 06:17 AM

Whaaa... test something? Wait a minute, test it in game? That's crazy talk :D.

Actually, I did test it in game (where I thought I didn't get either use item tooltip) but either my tab key was buggered or I didn't patch the 2da headers correctly on that run, so I kinda wanted to test it again anyway...

So it works, but what you're saying about setting charges makes that fourth ability pretty useless I guess (it's a spellcasting ability). Unless maybe I shuffle the melee header to the fourth slot, since it shouldn't matter if that recharges? Then there's what Demivrgvs said about funny recharge behaviour, if that's true... I guess I could (gulp) test that too...

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#12 -Guest-

-Guest-
  • Guest

Posted 13 June 2008 - 09:24 AM

I'm not sure if the melee ability would work that far out (hopefully, it would, but BioWare never did anything other than ranged and melee, only one of each maximum, first). If it's not controlled by charges (either '0' for always usable or only 1 charge per day), you could probably get away with it (it will still be created with no charges and will transfer with no charges but might get a charge after resting).

The problem is that item reference structures everywhere only store charges for 3 abilities (on the CHR in the saved game, on the CRE, in the ARE container, in the STO, etc.). Since Galc or whoever tested it a long time ago and said it worked, the game must be able to track the extra headers in memory, but that data isn't going to get saved anywhere (you probably lose the charges when reloading or selling the item, and possibly when simply transferring it to another character or to a container or when dropping it).

Honestly, I think you're better off sticking with 3 (you might be able to use the select spell interface with an appropriate 2DA and custom spells to cast fake spells -- or the originals if that's all the abilities are currently doing -- but I've never seen this done from an item) than trying to go with something that just barely kinda-sorta works.

#13 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 13 June 2008 - 08:52 PM

Honestly, I think you're better off sticking with 3 (you might be able to use the select spell interface with an appropriate 2DA and custom spells to cast fake spells -- or the originals if that's all the abilities are currently doing -- but I've never seen this done from an item) than trying to go with something that just barely kinda-sorta works.

I would be fine with leaving it a 50/50 chance for each spell ability on the magic header, but the problem is the spells should have two different projectiles and I can't figure out a good way of doing that aside from having 2 headers. Even if I set the projectile animation to 0 or 1 and add a casting effect to the specific 50/50 ability, I still seem to get some cheesy casting projectile effect no matter what.

I did quite a bit of testing though, and having the two magic headers does seem to work. They'll even both recharge if the charge behaviour is set properly so I haven't seen what Demivrgvs is talking about. The only problem is as you suggest - I can't seem to get the melee ability to work, even if I move right up to someone and hack at point blank range, it'll still trigger the ranged ability. I tested this by adding strings to display what it's doing on each header. The charges should be zero anyway, so that's not the problem. Come to think of it though, I don't know if it works for other mixed-use weapons in general... guess I'll have to test that.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#14 -Guest-

-Guest-
  • Guest

Posted 13 June 2008 - 10:27 PM

1-3 magic headers work fine (the engine can handle each, and they're all handled separately). They should work exactly as you'd expect, but note that if any ability is limited by charges and doesn't recharge, the whole item will disappear when that ability's charges hit 0 (you can set the "recharges" bit without the recharge after rest behavior to create an item that doesn't disappear but doesn't recharge; see the wand of spellstriking in ToB IIRC). I doubt you can have multiple melee or ranged abilities but haven't ever tried (not that you would ever need them).

For mixed use items, you need to manually select the ability to use by right-clicking on the icon (all default mixed use weapons have "Ranged" and "Melee" tooltips). There should also be an Abilities button in the description when right-clicking on an equipped item (IIRC, the item has to be equipped or readied to be able to set the ability from the description window).

Leaving the projectile at 1, you should be able to use the cast spell effect set to cast instantly to cast the spell; if the casting "glow" fires (e.g., the red sparkles for an invocation spell), you can always just create custom spells and nix the casting animation (at 0x22 in the SPL header or whatever; just set it to 0).

#15 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 14 June 2008 - 12:09 AM

Hmm, ok. For some reason I thought my script would switch melee/ranged abilities automatically when within range, but no, I have to do it manually. So it appears it all works, tooltips and all - having four headers total, a ranged one, two spell headers and a melee ability on the fourth header.

So there's only one minor thing left that bugs me about this item that applies to a lot of similar items. This is a thrown weapon that supposedly returns to the thrower's hand (like the boomerang dagger). There are two issues with this:
1) The weapon remains visible in the thrower's hand even when it's shown flying across the screen.
2) There is no "return" animation - once the projectile hits the target, we just have to assume it returns.

I don't know if there's much we can do about the second point. Regarding the first, I would like it to disappear or become tranparent for the duration of the weapon's transit to the target (equivalent to its speed I guess). I couldn't find an opcode or gradient for this - the best I was able to do is turn it a dull grey for the duration. Destroying it and recreating it would be rather hackish and would mess with the spell charges even if it worked.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#16 Demivrgvs

Demivrgvs
  • Member
  • 143 posts

Posted 14 June 2008 - 12:32 AM

I did quite a bit of testing though, and having the two magic headers does seem to work. They'll even both recharge if the charge behaviour is set properly so I haven't seen what Demivrgvs is talking about.

The problem comes up when you have more than three headers with charges (you only have two). The engine can only memorize the charges of the first three headers and if there's a fourth header with charges you'll get the strange replenishment behaviour I was talking about.
Anyway setting the melee or ranged header as fourth may actually work...I haven't thought about doing it and it would be great if you could confirm that it does works! :cheers:

#17 -Guest-

-Guest-
  • Guest

Posted 14 June 2008 - 10:10 AM

Hmm, ok. For some reason I thought my script would switch melee/ranged abilities automatically when within range, but no, I have to do it manually. So it appears it all works, tooltips and all - having four headers total, a ranged one, two spell headers and a melee ability on the fourth header.

EquipRanged() and EquipMostDamagingMelee() should work (although, maybe not if you don't have the ranged and melee abilities both first in the item; don't know) to switch between the two abilities by script. SelectWeaponAbility() should also work. But with normal (player-initiated or scripted) attacks, the ability won't automatically change.

I don't know if there's much we can do about the second point. Regarding the first, I would like it to disappear or become tranparent for the duration of the weapon's transit to the target (equivalent to its speed I guess). I couldn't find an opcode or gradient for this - the best I was able to do is turn it a dull grey for the duration. Destroying it and recreating it would be rather hackish and would mess with the spell charges even if it worked.

I'd just let it alone. That's the way it works, and anything you come up with is going to have to be a truly ugly hack.

#18 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 14 June 2008 - 06:37 PM

it would be great if you could confirm that it does works!

It does as far as I can tell (see previous post <_<).

I'd just let it alone. That's the way it works, and anything you come up with is going to have to be a truly ugly hack.

Turning it grey for the couple seconds it's in transit seems to convey the idea without being too hideous. Though the item was blueish to begin with - for similar items that are already grey then, yeah, whatever... It'd be nice if there was a 'transparent' gradient or something, but I guess not.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle