Jump to content


Photo

Use Scrolls!!!


  • Please log in to reply
8 replies to this topic

#1 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 27 October 2003 - 05:52 AM

I think I'm now quite experienced in the mechanism of item restrictions.
To prove that I'm not babbling let me paste the restrictions I managed to code for the Sword Angel Kit that'll be included in the Refinements Mod: B)

- May not use armors, shields, helmets, excessively STR-enhancing equipment
- May not use missile, poisoned or other vile weapons


This required a VERY tricky solution, with a little, and only "theoric" (to my knowledge) cost.
Negligible, given the power of the trick, IMHO.
Now, every BG2 installation could handle this trick no more than twice or thrice at a time, but there's still room to use it.

So I started to think about a way to exploit this trick itself to create the "fabled" Use Scrolls ability. Now I think I've got it...
It'll be IMMENSELY tricky, but it's here, floating on my mind. I'm almost sure it would work.
:wacko:
All I need to know is a way to change the character's kit via spell. I know there's a script command for that, does it work? Maybe we could give it to an invisible summoned creature, to run the script once when the thief learns Use Scrolls...
Oh, I won't have the time to try anything for a couple of days, but if someone can tell me how to change Kit via spell in game, I bet we could make this ability at last.... -_-

Ever forward, my darling wind...


#2 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 27 October 2003 - 07:50 AM

Hmm, if I understand you correctly Littiz, you are actually making these restriction by editing ALL of the items which you don't want to be used by your kit via WeiDU right ? That seams to be feasible if you are only working with ONE kit, however, the Thief has one core class + three kits, I don't really see how you could set the item restrictions to those with this method from IN the game (once the Use Scrolls ability would be selected).

Also, consider that scrolls are not supposed to work perfectly for Thieves. They should have a 25% chance of failure which should cause random effects according to the table in the 2E DMG (somewhat similar to the wild magic table of BG2):

Use Scrolls: At 10th level, a thief gains a limited ability to use magical and priest scrolls. A thief's understanding of magical writings is far from complete, however. The thief has a 25% chance to read the scroll incorrectly and reverse the spell's effect. This sort of malfunction is almost always detrimental to the thief and his party. It could be as simple as accidentally casting the reverse of the given spell or as complex as a foul-up on a fireball scroll, causing the ball of flame to be centered on the thief instead of its intended target. The exact effect is up to the DM.


As for changing the character's kit via spell, I don't believe that there is a way to do this directly via spell effects, so I would also suggest using the good old 'invisible creature with an assigned script' trick. The thing is, the only two somewhat related actions which I found were:

From IESDP:

AddKit(I:Kit*KIT)

This will effectively add a kit onto any true class. To work, however, the referenced kit must be of the correct class and the performer of the action must be single-classed. When used, the CLAB files of the kit are reapplied.

AddSuperKit(I:Kit*KIT)
I'd say this does pretty much the same thing as AddKit(), but truthfully, I have no idea.



Anyway, if you can make this work I'd definitively be interested! B)

#3 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 27 October 2003 - 11:34 AM

Hmm, if I understand you correctly Littiz, you are actually making these restriction by editing ALL of the items which

you don't want to be used by your kit via WeiDU right ?

I do modify *some* items on the fly, but it's not the point, since the real problem is that you can't specify a NEW kit in the list of unallowed users. This forced me to think about an alternative solution ;)

That seams to be feasible if you are only working with ONE kit, however, the Thief has one core class + three kits, I don't really see how you could set the item restrictions to those with this method from IN the game

I know, it stopped me as well, until I realized I could apply the previous solution in reverse!
I told you it was tricky! :lol:
Trust me, that part is solved. In this case, I can elaborate even a "cleaner" version, maybe perfectly clean...
Ok, follow my reasoning:
A swashbuckler has 0x00100000 as UNUSABLE value.
Suppose that I set it at 0x00100020.
I've just *added* the UNUSABLE value of Undead Hunters. What happens?
Nothing!!!!
Undead Hunters, relatively to their base class, lose no equipment.
So that value applied to a thief Kit has no effect.
And in game you won't find items usable by Inquisitors, while NOT by Undead Hunters.
They're all flagged as usable by Paladins or not, but there's not an "intra-kit" discrimination, which is where the unusable value is really needed. Of course such items could exist, they could be created by some mods, but probably wouldn't be usable by thieves anyway, so again, no effect.
Yet some items may be *redundantly* flagged as unusable by paladins and by all paladins kits, but those very few items could be corrected *if* they create problems.
So, I set this value and I can assure that things work fine.

Next step. I correct all the MAGE scrolls in the game. I flag them as USABLE by thieves, but UNUSABLE by Undead Hunters!!!
What happens now?
Nothing to Undead Hunters, which wouldn't use Mage Scrolls anyway (they're flagged as UNUSABLE by Paladins...).
But now my SwashBuckler can't use them, even if I flagged them as USABLE by thieves, since he also has the UNUSABLE value of Undead Hunters!!!!!!!
So, what remains to do?
Just creating copies of the original swashbuckler Kit, which will have the ORIGINAL unusable value.
When I apply the "Twin Kit" via script, it'll be able to use all the mage scrolls!!!!!

Repeat for all kits...

Ironically, the big problem remains for the True Class. I'd need to change that twice, and find a way to change it immediately as soon as a true-class thief is created or joins the party.
Maybe even from Baldur.bcs... True classes will definitely need more scripting, I'll need some help here.

The WeiDU code isn't really easy, as you need to use the NO BACKUP option in some cases, to prevent some files to be backuped twice thus losing the original versions. Then you have to fully understand the hex calculations of the unusable values, and where to ADD (or sometimes SUBTRACT) the values.
But I've already created a template to follow, since the Sword Angel Kit is ready and working. B)
(actually I had to be even more radical with that).

I tried AddKit, and it works fully, even with new kits, and even when a character has ALREADY a kit!
This means that Use Scrolls should really be possible. B)
I only have to find out now how to target the right character when I summon the creature, and how and when to change the True-Class...

Frankly I'd consider the chance of casting failure a secondary problem: if we make Use Scrolls, it'd be already a great success!!!
I'll try to work on this from, uh, Thursday I think.

I know, I know... I am a GENIUS!!! :D :P

Ever forward, my darling wind...


#4 aVENGER

aVENGER
  • Modder
  • 1680 posts

Posted 27 October 2003 - 02:41 PM

Congrats Littiz! These are great news indeed. B)

I'll be releasing v3.00 on Friday so that will have to go without 'Use Scrolls', however, if/when you manage to create this as a working ability I'd certainly like to check it out, if you don't mind of course :)

#5 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 28 October 2003 - 12:27 AM

Ok, I was suggesting to join forces, but no problem.
If I manage to do it, I'll send you the code :)

Ever forward, my darling wind...


#6 T.G.Maestro

T.G.Maestro

    Eclipse

  • Member
  • 4415 posts

Posted 28 October 2003 - 04:52 AM

Congrats Littiz! These are great news indeed

Indeed they are! If you manage to implement this, we can get rid of UAI once and for all!
Posted Image

Refinements v2 has been released!
Go and visit the website or the forum for more info!

Member of The Silver Star team.

#7 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 30 October 2003 - 03:13 AM

UAI would remain for bards, wouldn't it ;)
Ok, I've studied the issue a little more. Of course it's even HARDER than it seemed...
Dualclasses of the type any_kit/Thief heavily increase complexity.
Anyway trying to figure out if it was really possible (before wasting too much time) I've made a "plan" beforehand, some crossed tests and a pseudocode. The script would check class, race and kit of a character.
In most cases, it'd do nothing, in some cases, it'd apply a new "invisible" kit.
AddKit(), for once, it's a command that works always in the most intelligent way, and this matters a lot!

Now, the conclusion: I'm 99% sure it'll work, but unexpectedly, we're being betrayed by the finest modding tool, WeiDU itself!!!
Divine intervention from Weimer is needed!!! :)
Without a feature to update the KIT.IDS file accordingly to KITLIST.2DA (currently only this one is modified by ADD_KIT), I can only do a version that runs in a game without fan-made Kits. That is, you should install them later. For now I'll try it this way.

Ever forward, my darling wind...


#8 Seifer

Seifer

    The best Anti-Paladin weapon is a tin opener...!

  • Member
  • 4505 posts

Posted 30 October 2003 - 03:25 PM

Kit.IDS is a text file, you can append to the bottom of this as you can to SPELL.IDS

Does that help?

how come you always look so damn cool in every photo I see you in?!?


Speaking of modding, I listened to IER 3 yesterday, so you can have another quote for your signature: how come you sound so damn cool, as well as look it? It's unfair. Seriously.


Still a cyberjock, still hacking the matrix, still unsure of what that means.

TeamBG member - http://www.teambg.eu

#9 Littiz

Littiz
  • Modder
  • 1078 posts

Posted 01 November 2003 - 01:14 AM

I fear not Seif, I tried to exploit it :(
Indeed you can append values, but you can't know if they'll actually match the slot numbers created by WeiDU.
I also thought about adding Kits "manually" (without WeiDU's ADD_KIT command), starting, say, from slot 80, or 90. That way I thought I could leave existing kits unharmed, and use fixed numbers as addresses!!!
But the engine doesn't like holes in the numeration, and the kits become messed...
Nothing to do, I'll have to stick to this "less portable" version, for now.

Anyway, about the ability itself: it became trickier and trickier, as you have to consider single classes, multiclasses, dualclasses, dualclasses with kits, dualclasses *not yet reactivated*... :o :o
I was able to "merge" some cases, but the script is now 60 blocks (may grow a little more)!!
Yet... I have a prototype installed, and believe me or not, this damn trick *works*!!!!! B) :P :rolleyes:
(I know, I know, bugs wil show up...)


Now I say, where's my Nobel?!!? :lol: :D :lol:

Ever forward, my darling wind...