Avenger Posted July 11, 2007 Posted July 11, 2007 In bg2 an equipped item's slot code is stored on 0xa0 in the effect struct. This is used at least by the color change by gradient (7) effect (and probably other avatar color effects with location code) to change the right palette entry when wielding offhand items (weapons for example). I have no idea which other effects and games use this field.
devSin Posted July 18, 2007 Posted July 18, 2007 Isn't that the field for local variable names (0xa0)? I'm not quite sure what you're talking about, but I'm not seeing any value stored here for the color effect (7), and I don't know why it'd be needed (a location is a location, regardless of which slot the item is in)?
Avenger Posted July 18, 2007 Author Posted July 18, 2007 No, as i mentioned, if an item is wielded offhand, it should change different colors. Also, if an item is unequipped, the engine will know from the slot number which effects to remove. Here is the relevant code from iwd2: call 00726800 ;;current shield slot mov ecx,dword ptr [esi+0A0h] ;;get the slot info from the effect and eax,0FFh cmp ecx,eax ;;is it the same as the current shield slot? jne 004A6C2D mov dl,byte ptr ds:[85AB49h];;dl = 0x10 xor eax,eax mov al,byte ptr [esi+1Ch];;location byte (eax=location) mov cl,al and cl,0F0h cmp cl,dl jne 004A6C2D xor edx,edx mov dl,byte ptr ds:[85AB4Ah];;dl = 0x20 and eax,0Fh or eax,edx mov dword ptr [esi+1Ch],eax ;;location = 0x20 | (location & 0xf) 004A6C2D: Basically, if the item is equipped in the shield slot, it will change the location from 0x1? to 0x2? on the fly. But you are right, i used the engine internal offset. It is up to you to determine the file offset from this info: unsigned long feature; c unsigned long target; 10 unsigned long power; 14 parameter par1; 18 parameter par2; 1c unsigned char timing; 20 unsigned char unknown; unsigned short unknown2; unsigned long duration; 24 unsigned short prob2; 28 unsigned short prob1; char resource[8]; 2c unsigned long count; 34 unsigned long sides; 38 unsigned long stype; 3c long sbonus; 40 long unknown2c; 44 long school; 48 long u3,u4,u5; 4c,50,54 long resist; 58 long par3; 5c long par4; 60 unsigned char unused2[8]; 64 char vvc[8]; 6c char resource3[8]; 74 long sx, sy; 7c // source point long dx, dy; 84 // target point long unused3; 8c char source[8]; 90 //the effect came from this item or spell long unused4; 98 long projectile; 9c //the effect uses this projectile (from spell) long slot; a0 //equipped slot if this is an item effect char variable[32]; a4 Btw, bg2 simply uses 9 (shield slot code) instead of that call. Iwd2 determines the shield slot by 0x2c+2*[weaponslot index] Where weapon slot index is 0-3.
devSin Posted July 18, 2007 Posted July 18, 2007 I only checked with barkskin in BG2, but even with an offhand weapon equipped, the value for all the color effects is always -1 (or 0; I can't remember which comes right before the varname string). I could understand if that code was effect code for the actual item (the on-equip effect), but I have no idea how it would pertain to anything whose target wasn't itself (i.e., it only exists in memory when called from a wielded weapon).
Nythrun Posted July 19, 2007 Posted July 19, 2007 Isn't that the field for local variable names (0xa0)? Only for effect 187 and its equivalents, but yes. 309 and whatever the other one is break up the variable name.
Avenger Posted July 19, 2007 Author Posted July 19, 2007 Color effects with location are usually used as while equipped item effects. Barkskin changes the whole body color.
devSin Posted July 19, 2007 Posted July 19, 2007 Barkskin uses 7 with a bunch of locations (give me a little credit here! . I don't think it touches any weapon locations, though. To be clear, are you suggesting that this field will be saved with an attached EFF struct or that it has any meaning when the resource is loaded?
Avenger Posted July 19, 2007 Author Posted July 19, 2007 Yes, i'm sure you'll be able to see this field set in a saved eff, but it will be rare. Mostly because equipping item effects are usually 'while equipped'. I don't think any modder ever will use those fields (projectile/inventory slot). I just given them a name so no one will call them 'unknown' anymore. I researched these for GemRB, and i report them because they are not unknown anymore, not because I think anyone will ever make use of them. Anyway, just because i have little imaginative powers, someone someday might even use those fields
devSin Posted July 19, 2007 Posted July 19, 2007 long projectile; 9c //the effect uses this projectile (from spell)These are stored -1 (starting from 0 per PROJECTL, unlike SPL, ITM, and PRO projectile references). For area projectiles, this will be the explosion (the actual impact) projectile.
Avenger Posted July 19, 2007 Author Posted July 19, 2007 The only usage i know for the projectile type is the zone of sweet air effect, which removes effects based on projectile. A pity they didn't implement it more generally. (GemRB will do so, of course).
devSin Posted July 19, 2007 Posted July 19, 2007 Yeah, my first reaction was pretty much "then where is the remove effects by projectile effect?" -- I guess they had better things to do.
Nythrun Posted July 21, 2007 Posted July 21, 2007 Is that a harbinger of a "Remove effects by resref" opcode for GemRB ?
Avenger Posted July 21, 2007 Author Posted July 21, 2007 Is that a harbinger of a "Remove effects by resref" opcode for GemRB ? Remove effects by resref IS already in GemRB, as it is part of iwd2. And an easy opcode. Also, you can make it part of a bg2 like setup, you simply need to edit a file called effects.ids
Nythrun Posted July 21, 2007 Posted July 21, 2007 Also, you can make it part of a bg2 like setup, you simply need to edit a file called effects.ids
Recommended Posts
Archived
This topic is now archived and is closed to further replies.