Jump to content


Photo

Item usability pointers


  • Please log in to reply
44 replies to this topic

#1 Sir Kalthorine

Sir Kalthorine

    Order of Radiant Ugliness

  • Modder
  • 2188 posts

Posted 20 March 2005 - 04:40 AM

I appreciate that this is probably more of a "WeiDU" specific question, so if anyone feels the need to move it to the WeiDU help forum then please feel free - I just posted it here initially coz more people read this one ;)

Basically, I am trying to find a way of using WeiDU to patch item files to add usability, specifically (for my own nefarious purposes!) to make druid-only items usable by a thief with the assassin kit.

Having done some reading of my own (I hate to ask for help before at least attempting to solve a problem myself), how close am I with this attempt:

COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~   //copies all item files
      READ_BYTE    "0x2B" "assassin"   // reads the byte containing thief assassin kit usability flag  
      READ_BYTE    "0x21" "druid"   // reads the byte containing druid usability flag
      WRITE_BYTE    "0x2B" ("%assassin%" BAND "0b11111011")   // makes usable by assassins
      IF_EVAL (("%druid%" BAND "0b01000000") = "0b00000000")   // if it is already usable by druids

And please feel free to laugh yourselves silly if I have made a total hash of it... I am still feeling my way back into things, so have pity! ;)

Edited by Sir Kalthorine, 20 March 2005 - 04:41 AM.

KACH_TS.jpg Chrysta... could helping her to uncover her past threaten your own future?

"Pity the land in need of Heroes."- Bertolt Brecht
"A little madness, now and then, is relished by the wisest men." - Willy Wonka


#2 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11149 posts

Posted 20 March 2005 - 05:30 AM

I appreciate that this is probably more of a "WeiDU" specific question, so if anyone feels the need to move it to the WeiDU help forum then please feel free - I just posted it here initially coz more people read this one  ;)

Basically, I am trying to find a way of using WeiDU to patch item files to add usability, specifically (for my own nefarious purposes!) to make druid-only items usable by a thief with the assassin kit.

Having done some reading of my own (I hate to ask for help before at least attempting to solve a problem myself), how close am I with this attempt:

COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~   //copies all item files
      READ_BYTE    "0x2B" "assassin"   // reads the byte containing thief assassin kit usability flag  
      READ_BYTE    "0x21" "druid"   // reads the byte containing druid usability flag
      WRITE_BYTE    "0x2B" ("%assassin%" BAND "0b11111011")   // makes usable by assassins
      IF_EVAL (("%druid%" BAND "0b01000000") = "0b00000000")   // if it is already usable by druids

And please feel free to laugh yourselves silly if I have made a total hash of it... I am still feeling my way back into things, so have pity!  ;)

Not bad at all, actually. But I wouldn't code it exactly like that. See, I've been diagnosed with the fatal CamDawg-disease, which means that I'd like to put this into a WHILE-loop.

Now, this is how I'd code this:

COPY_EXISTING_REGEXP GLOB ~.*\.itm~ ~override~
READ_BYTE 0x21 "uflags1"
READ_BYTE 0x2b "uflags3"
  SET "patched" = 0
  WHILE ((("%uflags1%" BAND "0b0100000") = "0b00000000") AND ("%patched%" = 0)) BEGIN
    WRITE_BYTE "0x21" ("%uflags3%" BAND "0b11111011")
    SET "patched" = 1
  END
BUT_ONLY_IF_IT_CHANGES
I haven't tested this, but it should work. ;)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#3 Sir Kalthorine

Sir Kalthorine

    Order of Radiant Ugliness

  • Modder
  • 2188 posts

Posted 20 March 2005 - 06:20 AM

Thanks matey

I'll give it a try and let you know how I get on :)

KACH_TS.jpg Chrysta... could helping her to uncover her past threaten your own future?

"Pity the land in need of Heroes."- Bertolt Brecht
"A little madness, now and then, is relished by the wisest men." - Willy Wonka


#4 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 20 March 2005 - 10:41 AM

Hmmm, as I know, you're coding Chrysta as an Assassin... this means you'd have to remove even the general "Thief" flag from the unusable value of such items, and this would create problems with all thieves in the party (instead of just with all assassins in the party...)

Either way, you risk to incur in heavy problems.
If I'm right and you still need help, please let me know if I can provide it :)
There's not much space for abuses with the engine and all the mods around, but you never know :)

Ever forward, my darling wind...


#5 Sir Kalthorine

Sir Kalthorine

    Order of Radiant Ugliness

  • Modder
  • 2188 posts

Posted 20 March 2005 - 11:32 AM

Hmmm, as I know, you're coding Chrysta as an Assassin... this means you'd have to remove even the general "Thief" flag from the unusable value of such items, and this would create problems with all thieves in the party (instead of just with all assassins in the party...)

Either way, you risk to incur in heavy problems.
If I'm right and you still need help, please let me know if I can provide it :)
There's not much space for abuses with the engine and all the mods around, but you never know :)

View Post


Well the code seemed to run OK but it seems that you are right, Littiz... still can't equip any druidic items, not even a simple spear!

I do have some other thoughts on the matter, but I am also open to suggestions :) I still want to keep Chrysta coded as an assassin as I want to keep to just 15 thief ability points per level.

Edited by Sir Kalthorine, 20 March 2005 - 11:34 AM.

KACH_TS.jpg Chrysta... could helping her to uncover her past threaten your own future?

"Pity the land in need of Heroes."- Bertolt Brecht
"A little madness, now and then, is relished by the wisest men." - Willy Wonka


#6 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 20 March 2005 - 11:40 AM

Ok, here's a basic idea for your needs.
(You might refer to the Refinements mod to check the Use Scrolls ability and/or the Sword Angel and see the tricks I used there).

1.
You should find a redundant kit flag: there are a few in the game, but not all are! Some are used to define class abilities, as for Assassins' and Bounty Hunters' different rate of thieving points.
Also, some *are* used for a few very specific items.
So, first thing is a careful search of the few remaining redundancies of the game.
For the Sword Angel I used the Jester's flag, in the mod you can find why and how I could use it ;)
If I have time in the following days, I might attempt this search for you :)

2.
Add a tp2 action to change your selected "victim" kit: since you must have found a flag that is entirely redundant, you may change the selected kit's unusable value to one of his "brothers'", so to speak.

3.
Remove the "thief" unusable flag from the druid items you want to be useable by Christa.
Remove even the Assassin flag if present.
Add the kit-unusable flag of the "victim" kit.

4.
Add a tp2 action to *add* the unusable value of the victim kit to ALL thieves.

5.
Create an invisible kit for Chrysta (this might still be named "assassin", or be something different). She will use the ORIGINAL assassin unusable value, but NOT the one of the victim kit.
This way, all thieves will be still prevented from using druidic items, but Chrysta will be free to use them, even if she has "thief" as the base class, and the normal Assassin skills and settings :)

Edited by Littiz, 20 March 2005 - 11:50 AM.

Ever forward, my darling wind...


#7 Sir Kalthorine

Sir Kalthorine

    Order of Radiant Ugliness

  • Modder
  • 2188 posts

Posted 20 March 2005 - 11:54 AM

Cheers, once I can get my head around all that I'll give it a shot :)

And thank you very much for taking the time to offer your help and advice, it is much appreciated.

KACH_TS.jpg Chrysta... could helping her to uncover her past threaten your own future?

"Pity the land in need of Heroes."- Bertolt Brecht
"A little madness, now and then, is relished by the wisest men." - Willy Wonka


#8 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 20 March 2005 - 12:26 PM

Well, there *is* a problem, now that I remember.
See, the point of this trick (and all the tricks of this kind I used in the past), is that the unusable values may freely be added/removed, because of the way the usability checks work.

BUT, there is an exception, and it is right with Assassins and Bounty Hunters :( : the hard-coded check at level up, for thief points assignment, looks after the *exact* assassin and bounty hunters unusable values (instead of simply checking if one of them is present... and it makes sense, since in case both were present, you wouldn't know how to assign points...), so if you add something to them, the check fails entirely, and treats these kits as regular thieves.
This means we couldn't add to the original kits' values the value we'd need to keep Assassins and Bounty Hunters excluded from druid items :(
How could I forgot, this problem haunted me when I faced it with Refinements... :closedeyes:
Damn it, with every other class, it would have worked.
Well, I must think if there's a way around it...

As a last resort, there's always the "Disallow item" effect: you could add an applied spell to the clabfile of each thief kit, specifying dozens of disallowed items for thieves (the items you're going to remove the generic thief unusable flag from)
Tiring to do, also such items wouldn't glow red as they should when picked by thieves...

Another option that comes to mind is to reverse the concept, and implement Chrysta as a druid....

Edited by Littiz, 20 March 2005 - 12:43 PM.

Ever forward, my darling wind...


#9 Sir Kalthorine

Sir Kalthorine

    Order of Radiant Ugliness

  • Modder
  • 2188 posts

Posted 20 March 2005 - 12:45 PM

At a push, Chrysta doesn't have to be an assassin, as I can always give her penalties to thieving abilities rather than limited points on level-up (as you can tell I am desperate for her not to be overpowered).

I am flexible and open-minded when it comes to solutions. :)

KACH_TS.jpg Chrysta... could helping her to uncover her past threaten your own future?

"Pity the land in need of Heroes."- Bertolt Brecht
"A little madness, now and then, is relished by the wisest men." - Willy Wonka


#10 the bigg

the bigg

    2083 is a prime number.

  • Modder
  • 3331 posts

Posted 20 March 2005 - 12:49 PM

Well, there *is* a problem, now that I remember.
See, the point of this trick (and all the tricks of this kind I used in the past), is that the unusable values may freely be added/removed, because of the way the usability checks work.

BUT, there is an exception, and it is right with Assassins and Bounty Hunters :( : the hard-coded check at level up, for thief points assignment, looks after the *exact* assassin and bounty hunters unusable values (instead of simply checking if one of them is present... and it makes sense, since in case both were present, you wouldn't know how to assign points...), so if you add something to them, the check fails entirely, and treats these kits as regular thieves.
This means we couldn't add to the original kits' values the value we'd need to keep Assassins and Bounty Hunters excluded from druid items :(
How could I forgot, this problem haunted me when I faced it with Refinements... :closedeyes:
Damn it, with any other class, it would have worked.
Well, I must think if there's a way around it...

As a last resort, there's always the "Disallow item" effect: you could add an applied spell to the clabfile of each thief kit, specifying dozens of disallowed items for thieves (the items you're going to remove the generic thief unusable flag from)
Tiring to do, also such items wouldn't glow red as they should when picked by thieves...

Another option that comes to mind is to reverse the concept, and implement Chrysta as a druid....

View Post

Oops, posted the same buggy thing to PPG... time to hit "delete" <_< (luckily, at PPG you can delete your posts even if you aren't a moderator).

@ Disallow item: I guarantee you that "Disallow item" isn't as much tiring as you think to do, I could do it with 100 lines of code and an hour or less of writing / testing :shifty:
The only problem is living with the shame of having created a spell which is 10 Kb large and has only 1 Extended Header :)

@ SC: IF_EVAL checks a single byte, BUT_ONLY_IF_IT_CHANGES checks all bytes and is much slower. Besides, you could at least use the PATCH_IF command, to save 2 lines :)

Edited by the bigg, 20 March 2005 - 12:52 PM.

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.


#11 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 20 March 2005 - 12:52 PM

I see, but in this issue, the problem is with the thief class.
If you have Chrysta implemented as a thief -ANY thief-, you have to remove the thief UNUSABLE flag from druid-only items, and so you need an alternative way to keep such items away from regular and kitted thieves.

Unfortunately, the thief class includes assassins and bounty hunters, and so the thief class is the only one for which this trick cannot work.
On the other hand, it is appliable if she gets implemented as a druid (unless I'm forgetting something else, ouch. There is a reason if I decided to stay away from usability issues, after all I went through! :D)

Edited by Littiz, 20 March 2005 - 12:56 PM.

Ever forward, my darling wind...


#12 Sir Kalthorine

Sir Kalthorine

    Order of Radiant Ugliness

  • Modder
  • 2188 posts

Posted 20 March 2005 - 01:00 PM

I see, but in this issue, the problem is with the thief class.
If I have Chrysta implemented as a thief -ANY thief-, I have to remove the thief UNUSABLE flag from druid-only items, and so I'd need an alternative way to keep such items away from regular and kitted thieves.

Unfortunately, the thief class includes assassins and bounty hunters, and so the thief class is the only one for which this trick cannot work.
On the other hand, it would be appliable if she is implemented as a druid (unless I'm forgetting something else, ouch. There is a reason if I decided to stay away from usability issues, after all I went through! :D)

View Post

The only problem with implementing her as a druid would be that I can't see how I could have access to thieving abilities then... either via the interface or at level-up. And that is a big problem, as she has to have thieving abilities :ermm:

KACH_TS.jpg Chrysta... could helping her to uncover her past threaten your own future?

"Pity the land in need of Heroes."- Bertolt Brecht
"A little madness, now and then, is relished by the wisest men." - Willy Wonka


#13 the bigg

the bigg

    2083 is a prime number.

  • Modder
  • 3331 posts

Posted 20 March 2005 - 01:01 PM

I see, but in this issue, the problem is with the thief class.
If I have Chrysta implemented as a thief -ANY thief-, I have to remove the thief UNUSABLE flag from druid-only items, and so I'd need an alternative way to keep such items away from regular and kitted thieves.

Unfortunately, the thief class includes assassins and bounty hunters, and so the thief class is the only one for which this trick cannot work.
On the other hand, it would be appliable if she is implemented as a druid (unless I'm forgetting something else, ouch. There is a reason if I decided to stay away from usability issues, after all I went through! :D)

View Post

May I try to list the possible problems with coding Ch. as a druid?
1) hellish workaround to do Hide in Shadows and Find Traps / Detect Illusions.
2) Simply unable to Pick Pockets, Disarm Traps and Pick Locks, not sure about Set Traps.
3) Only a thief and a ranger (or a stalker?) can backstab. In Freedom's reign, there is a dagger, usable by everyone except Clerics and Beastmasters, which gives +2 to backstab. If you equip it on a fighter, or a bard, he won't backstab anyway.

Of course, if your thief doesn't use any thieving abilities, you can go with that :huh:
EDIT: Sir K. said this already.


You can try to simulate the 15% instead of 25% applying an opcode to set all thievish, using the 60% value. Looks dirty, though.

Edited by the bigg, 20 March 2005 - 01:03 PM.

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.


#14 Sir Kalthorine

Sir Kalthorine

    Order of Radiant Ugliness

  • Modder
  • 2188 posts

Posted 20 March 2005 - 01:14 PM

You can try to simulate the 15% instead of 25% applying an opcode to set all thievish, using the 60% value. Looks dirty, though.

View Post

What about this as a sneaky workaround, at least for this bit:

Chrysta, having very poor memory of her time as a thief/assassin (check out her forum if you want to know what I mean by that!), finds it hard to maintain technical skills such as Open Locks and Find/Remove Traps, and as such they automatically deteriorate by -5% each level (done via applying the relevant effect to her on level-up). In order to maintain them at a constant level she must invest 10 points (i.e. 5 per skill) every time she levels up... in other words, in effect she would only have 15 points per level to spend if she wants to keep increasing the "key" lockpicking and trap detection skills :)

Edited by Sir Kalthorine, 20 March 2005 - 01:14 PM.

KACH_TS.jpg Chrysta... could helping her to uncover her past threaten your own future?

"Pity the land in need of Heroes."- Bertolt Brecht
"A little madness, now and then, is relished by the wisest men." - Willy Wonka


#15 the bigg

the bigg

    2083 is a prime number.

  • Modder
  • 3331 posts

Posted 20 March 2005 - 01:23 PM

That way, you don't catch the people who use No Traps and Locks (for the shame, I do use it).

Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.


#16 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11149 posts

Posted 20 March 2005 - 02:18 PM

@ SC: IF_EVAL checks a single byte, BUT_ONLY_IF_IT_CHANGES checks all bytes and is much slower. Besides, you could at least use the PATCH_IF command, to save 2 lines  :)

Oh, come on. WHILE is so much more fun that PATCH_IF. I rarely use that, and if I do, it's always in conjunction with WHILE. And Sir K.'s IF_EVAL didn't check if it actually made any change, he only checked if it was usable by the druid, something which I do in the WHILE-action. ;)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#17 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 20 March 2005 - 02:44 PM

@ SC: IF_EVAL checks a single byte, BUT_ONLY_IF_IT_CHANGES checks all bytes and is much slower. Besides, you could at least use the PATCH_IF command, to save 2 lines  :)

View Post


IF_EVAL is deprecated, and was hacky even when supported.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#18 igi

igi

    IESDP Guardian

  • Administrator
  • 1065 posts

Posted 21 March 2005 - 04:43 AM

I'd avoid anything relating to usability values at all.
You may be able to hack something together, but it will likely hard large downsides, and break compatability with any other mod which makes similar changes.
OTOH, I would recommend the Disallow Item opcode.
I even believe someone once made a tool to aid in the creation of a .spl file to disallow items.

Visit the IESDP


#19 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 21 March 2005 - 04:55 AM

I'll end seconding bt_igi since actually, in this case, the disallow item opcode seems really the only available option.
On the other hand, you'll simplify the matter quite a bit: all thieves (including kits) will get this new spell in their CLAB file, while Chrysta's invisible kit won't.

All the difficulties will move to the creation of this spell: maybe it is even possible to create it at runtime, if you have the possibility of reading file names (of the items to disallow) and write them in the resource field of dinamically created "disallow item" effects.
If you end using a desperate copy-paste, I suggest to immediately create the effect specifying the string to be displayed ("cannot use item" or something like that), or you'll have to update that a hundred times!! (such string exists in the original dialog.tlk).

In the end, it's a viable solution, too bad for the loss of the red glow, and maybe you'll miss some mod-added items, but hey :closedeyes:

EDIT: actually, when you remove the "thief" unusable flag from a druid-only item, you can safely add (to the item itself) the bounty hunter's and the swashbuckler's unusable flag.
This way you can avoid the use of the spell for these two kits, and so you'll miss the red glow "only" with true classed thieves and assassins.

Edited by Littiz, 21 March 2005 - 05:05 AM.

Ever forward, my darling wind...


#20 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 21 March 2005 - 05:20 AM

igi made a tool to do just that for use in CR which we have not integrated yet--we would compile a list of items to be added to the spell at runtime and it would generate a spell with the proper list of disallow item opcodes.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.