Help - Search - Members - Calendar
Full Version: kit creation question
The Black Wyrm's Lair - Forums > Mod development resources & discussion > Modder's Workshop
lroumen
Hello everyone.

I am attempting to create a kit, but I run into a problem and I would like to hear some opinions.

I was thinking that since you cannot change the layout of the functional buttons, you may be able to change their behaviour. So I figured, since the bard already has a thieving button for his pick pocket skill, would it be possible to give a bardkit the ability to pick locks and remove traps?

1. I have attempted to add an OPEN_LOCKS line into the bard 2da right under his pick pocket ability, but I'm guessing that that never gets read by the game.
2. Next I tried to give him thieving points with shadowkeeper to see it that worked in any way. But when I detected a trap with another thief I simply could not get the trap disable button with the bard.

So I guess my current conclusion is that the bardic thieving button only works for pick pocketing. Now that means that it must have some of its natural capabilities disabled by the game (the pick locks and remove traps ability). Therefore, I wonder if anyone has ever looked further into the game to see how these abilities are removed. Since it is possible to disable a functional button using an op-code, maybe part of the thieving has also been disabled with an op-code and can be undisabed (reenabled).

It is also possible that thieving for thieves is added by thieving points, whereas the thieving for other classes (monk, ranger, bard) is added through a 2da. It does not seem possible to have a non-thief class to get thieving points per level, so perhaps additional thieving skills are impossible for the other classes as well.



Lastly I think I will probably be able to fix the usability of a bardkit as a semi-thief by giving it a few knocks per day and a few find traps spells per day as kit ability. That makes him all-purpose in the end, but too powerful due to 100% successrate for the skills. Is it possible to have the spells efficiency scale per level (knock and find traps are only effective for trap difficulty of 50% or less for instance, to be increased upon level ups)? I'm guessing that the answer is no, but perhaps I'm wrong. Related to this, is it possible to re-memorise the casting of a spell after it has been used but without requiring sleep? That way I only need to give 1 knock and 1 find traps as kit ability, but that still does not give it proper scalability (such that it does not become overpowered compared to a normal thief who has scalability of the thieving skills).

Thanks for the responses.
Ardanis
Next to everything about classes-buttons is hardcoded. As for people who actively make such kinds of exe hacking nowadays, I only know of Taimon.

QUOTE
it possible to have the spells efficiency scale per level (knock and find traps are only effective for trap difficulty of 50% or less for instance, to be increased upon level ups)?
The spell can deal with a trap/lock that a regular thief can deal with having a skill value of 50%, but not one with the 75% requirement? No. To tell the truth, I can't even begin to imagine a possible workaround. Well, I think I can, but likely nobody in their sane mind would do that.

QUOTE
is it possible to re-memorise the casting of a spell after it has been used but without requiring sleep?
See how Polymorph Self and Shapechange spells work.
lroumen
Yes, exe hacking is a bit beyond the scope of my fiddling.

I think I'll look into the scalable knock. I have not really attempted this yet so it was a preliminary question.

Also thank you for the tip on polymorphing. Maybe I can find some clues there.
lroumen
I've had a thought-wave.

Perhaps it would be a nice idea just to give the bardkit the ability to polymorph into a thief that has x% in all thieving skills, and then have the thief cre (and thereby thieving skills) scale with the bardlevels/castinglevel.

It is probably impossible to give a kit abilities though GA_ or AP_ that exclude one another upon choice in a similar way that HLAs can require and exclude one another, right?
I mean, Fallen Deva excludes the choice of a Normal Deva and Critical Strike requiring Power Attack. It wouldn't be possible to give the bard the choice to shapeshift into a thief that upgrades towards trap detection first or a thief that upgrades towards lockpicking first, correct?
Ardanis
QUOTE
Perhaps it would be a nice idea just to give the bardkit the ability to polymorph into a thief that has x% in all thieving skills, and then have the thief cre (and thereby thieving skills) scale with the bardlevels/castinglevel.
It will probably work.

QUOTE
It wouldn't be possible to give the bard the choice to shapeshift into a thief that upgrades towards trap detection first or a thief that upgrades towards lockpicking first, correct?
I can think of such a trick - to give an invokable ability that will either trigger a dialog (via summoning a creature that's scripted to start a dialog) or will let to select the desired ability as per Spell Immunity, and then disappears from the character. I think a dialog would be better, as it also easily allows for storing and calling back variables. This way, you can get your select_the_type one-time ability from 2da at every odd level and each time to select from a pool of options - to get +15% to traps, or maybe to locks, or maybe to illusions. And since your previous choices can be stored in a form of local variables, then at the next selection those can be called back and you'll see somewhat like +15% to traps, another +15% to locks, etc. Though it may take quite a lot of work, to make all of those spl and cre. Of maybe not so much, now that I think of it, as the transform_into_thief can instead summon yet another invisible creature, which will scan the bard for his skill values (as he most certainly can have them, just no buttons to actually make a use of them), then transfrom into a thief, and finally boost it with skills that were on a bard.

If all that rambling makes sense to you...
lroumen
It does make sense. Perfect sense. I cannot believe I forgot the creature summoning to get this done. Now I'm just going to wonder whether I would make it an invisible creature or whether I would make it a Dao for the fun of it.

I will give the summon+boosting a try, but I think the quick fix would still be to make all the spl/cre files. I'm thinking it would be less of a problem to get that to work code-wise.
Ardanis
QUOTE
I will give the summon+boosting a try, but I think the quick fix would still be to make all the spl/cre files. I'm thinking it would be less of a problem to get that to work code-wise.
That largely depends on how many times a bard will get to 'distribute' thieving points, and how many skills into. If you have three skills and 7 distributions then it'll be

(3+7)! / (7! * 3!) = 120

different cre and spl. Imo way too many.

Here is a slight revamp of my own code. File names and directories are just for an example. Same goes to 'ag_' prefix, you likely want to use your own one.

In table.2da the first column contains stats' names (from stats.ids, you can un fact use numbers instead), the second - the template for boosting spell's name (ag_loc4.spl is supposed to increase the polymorphed bard's lockpicking by 15*4=60 points, ag_ill12.spl - detect illusions by 12*15=180), the third one - how precise the scanning should be, 15 means it will detect each 15% (if before morphing you had 37% then it will consider you having 30=15*2). The fourth - how many times that skill may get improved, which is determined within the dialog. Apparently, this way the boosting spells are better to follow the %spell%[1;%max%].spl - +'%value%*[1;%max%]' rule. Though one can expand this code to generate those spells alongside with the script.


CODE
MKDIR ~mymod/workspace~ // for testing purpose, the finished mod should already have premade folders

<<<<<<<<inlined/table.2da
DETECTILLUSIONS  ag_ill  15  6
LOCKPICKING      ag_loc  15  6
TRAPS            ag_tra  15  6
>>>>>>>>

<<<<<<<<inlined/script.baf
IF
/*GLOBAL*/
THEN
RESPONSE #100
/*SETGLOBAL*/
ReallyForceSpellRES("polymorp",LastSummonerOf(Myself)) // polymorp.spl transforms you into a thief
END
/*BIG_BLOCK*/
>>>>>>>>
COPY ~inlined/script.baf~ ~mymod/workspace/script.baf~
COPY ~inlined/table.2da~ ~mymod/workspace/table.2da~
  COUNT_2DA_ROWS 4 rows
  FOR (i=0;i<rows;i+=1) BEGIN
    READ_2DA_ENTRY i 0 4 ~skill~
    READ_2DA_ENTRY i 1 4 ~spell~
    READ_2DA_ENTRY i 2 4 ~value~
    READ_2DA_ENTRY i 3 4 ~max~

    INNER_ACTION BEGIN
      COPY ~mymod/workspace/script.baf~ ~mymod/workspace/script.baf~
        REPLACE_TEXTUALLY EXACT_MATCH ~/*GLOBAL*/~
~
Global("ag_%skill%_set","locals",1)
/*GLOBAL*/~
        REPLACE_TEXTUALLY EXACT_MATCH ~/*SETGLOBAL*/~
~
SetGlobal("ag_%skill%_set","locals",2)
/*SETGLOBAL*/~
        FOR (j=1;j<(max+1);j+=1) BEGIN
          SET value_min = (j*value - 1)
          PATCH_IF j=max BEGIN
            SET value_max = 300
          END ELSE
          SET value_max = ((j+1)*value)
          REPLACE_TEXTUALLY EXACT_MATCH ~/*BIG_BLOCK*/~
~
IF
Global("ag_%skill%_set","locals",0)
CheckStatGT(LastSummonerOf(Myself),%value_min%,%skill%)
CheckStatLT(LastSummonerOf(Myself),%value_max%,%skill%)
THEN
RESPONSE #100
SetGlobal("ag_%skill%_set","locals",1)
SetGlobal("ag_%skill%","locals",%j%)
END

IF
Global("ag_%skill%_set","locals",2)
Global("ag_%skill%","locals",%j%)
THEN
RESPONSE #100
SetGlobal("ag_%skill%_set","locals",3)
ReallyForceSpellRES("%spell%%j%",LastSummonerOf(Myself))
END
/*BIG_BLOCK*/~
        END // inner FOR loop
    END // INNER_ACTION
  END // FOR loop
lroumen
I see that this code greatly reduces the amount of files to create. I am impressed.

But thinking on it even further. I think it is possible to just create one spl for each of the thieving skills which bumps the thieving with +15% (or less if need be).

We can increase the Global("ag_%skill%_set","locals",0) with 1 every time we pick a certain skill upon level up as suggested.
Then upon shapeshifting/polymorphing we check the value of the global of each skill and apply the +15% several times per skill at once.

So just check what the x is in Global("ag_%skill%_set","locals",x) and apply the skill spl x times. It is possible to put a FOR loop in the RESPONSE #100 part to invoke the ReallyForceSpellRES("%spell%",LastSummonerOf(Myself)) x times, correct?

I'm not certain that that would help reduce the work because the code just gets longer where we reduce the amount of files.
Ardanis
QUOTE
We can increase the Global("ag_%skill%_set","locals",0) with 1 every time we pick a certain skill upon level up as suggested.
Then upon shapeshifting/polymorphing we check the value of the global of each skill and apply the +15% several times per skill at once.
I've thought of it, and it's how I had things to work in my case as well. But in game it may look a bit technical as IIRC there'll be a flood of '<CHARNAME> - SpellName' lines it the game log, whereas applying the boosts via single file would be 3-4 at most. Also, local variables can only be called by their owner, so if they're assigned to Charname then there's no direct way for a summon to read them. Though nobody prohibits to have Charname to temporarily switch his script.

While I was typing, I thought of something else - instead of polymorphing (and thus needing the scanning routine), the bard can simply change their class to a thief. I can see possible issues with the items currently being equipped, but it may work. Question is, what to do if such a character will decide to level up? Though it likely will remain a problem even with polymorphing.

PS Btw, said 120 files can be generated as well, without much effort involved. Then there won't a hassle with scripts at all, although the dlg will grow up and there'll many files in the override folder (which, while is undesired, isn't that much of an issue if their numbers are within a hundred or two). But the main drawback would be the large dialog file.
lroumen
Unfortunately, I really didn't have much time to work on it this summer but I have set up a bunch of items, spells and cres. So far I have done a lot of thining and I have come up with a method that allows me to handle it a bit differently. I am currently attempting the following:

cre:
- thiefform
- djinni
I took a look at the polymorphing spells and they seem to use only one cre. I'm thinking that the level of the char is inherited from the original cre and that the HP, thac0, saves etc are based on the level of the caster with adjustments for str, dex and con. Seems like I would thus only require one cre file.

itm:
- thief weapon.
This is not necessary, but I thought it would remove problems with weapons that cannot be used by the thief. Bard gear is not removed upon polymorph, but I could script it in or limit the item use. If I limit item use to the cumulative value of bard+thief, would that mean that bard-only items would become unusable? I'm guessing so.

d:
- bard
- djinn

spl:
- shapeshift to thief
- shapeshift to neutral
- 10% bonus to thieving set A
- 10% bonus to thieving set B
- 10% bonus to thieving set C
- backstab bonus.... though probably not necessary, will test later on
- summon djinni

I will do a forcespell upon level up to summon the djinni. Using the dialogue I intend to have the djinni cast a spell upon the bard to enhance the thieving skills through the eff (permanent after death). Since polymorphed chars would inherit the thieving effect of the eff, I think it would be fine to just polymorph without having to apply the bonuses at the time of morphing. If I apply the same effect twice, the bonuses should stack, correct?

The problem I'm running into now is to give the djinni a dialogue option to check how many times a thieving set has been increased already. I keep track of it using a global variable (which should be LOCALS if there are more of the same bards in the party, correct?) which is incremented every time one of the sets is chosen (so I actually have 3 globals keeping track of A, B and C. The problem is, I would like to have the djinni answer: "you have picked set A an X amount of times", where X is the value of the global variable.

So questions:
- ad itm: would item restriction of bard+thief mean I cannot use bard-only items anymore?
- ad spl: are permanent after death effs inherited by the polymorphed forms?
- ad spl: if the effs are applied multiple times, the bonuses should stack with one another, correct?
- ad d: is it possible to change a global variable value into a string in a dialogue file?
- Would I be going wrong somewhere? I can still edit in the spell upgrade suggestions by Ardanis.
lroumen
Short update

Coding the globals to work for 6 NPCs is too much work at the moment, so I fixed it such that at least it should work for 1 party member (protagonist or any other npc regardless).

I am currently at the point of actually doing an alpha test with the mod. I have not fired up BG2 yet so who knows how many mistakes I must have made, lol. This is not going to be fun to debug...
lroumen
Well, I tried the polymorph ability into a thief, and whereas the creature does polymorph, my weapon works and upon polymorphing back I regain my ability to polymorph.... the menu buttons do not change, thus the thieving part does not work. I do seem to have created a really good polymorph though, hahaha.

Soo.... scratch the simple polymorph approach.
I will have to do it by scripting a classchange rather than having a kit ability that allows polymorphing. I can probably use the following bit of code (though changed to some extend):

IF
Kit((??),"LRSWITCH") //internal name of the kit is LRSWITCH
Global("LR_SWITCH_CLASS","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("LR_SWITCH_CLASS","GLOBAL",1)
ChangeClass((),THIEF)
END

But I would really prefer it if I could do this using an F12 ability.

Question: Is it possible to create a spell that executes a script (in which I change the class from bard to thief or back)?

I would probably have to do an AddKit(0) to remove the bardkit when I change the class and somehow use the AddKit() again to regain the class when switching back to the bard form.

I have tried a spell with the effect:
Set IDS state (#72)
but that crashed my game. I cannot remember how I have done it before, but I have been able to get set ids state to work.

Any tips?
lroumen
woohoo. I got changeclass and addkit to work to some extent.

use the following block which seems to work okay.

IF
Class(Player1,BARD)
Kit(Player1,LRswitch)
Global("LRFORM","GLOBAL",0)
THEN
RESPONSE #100
ActionOverride(Player1, ChangeClass(Player1,Thief))
ActionOverride(Player1, AddKit(LRswitchthief))
SetGlobal("LRFORM","GLOBAL",1)
END


Problem: the class change is instantaneous, but the menu buttons (Functional keys) do not immediately change. That only happens if I enter a new area.
Is there a trick to destroy my character and recreate my character to overcome these problems? Since it's on the protagonist, it should probably done in such a way that it does not end the game.

Hoppy
Have you tried creating innate abilities for your kit that can allow you the effects you want? That may give you more creativity with the bonuses too. Those can be applied through your CLABxxxx.2da file.
lroumen
Thanks for the tip, but the kit bonuses are not really a big problem. I can make a few spells as innates and give the kit a few nice bonuses that way, however, I would like it if I were able to choose my bonuses as I level up. That is why I have been trying to code this through a dialogue-based bonus-acquirement.

It turned out to be quite easy to get the dialogue and the bonuses to work, but getting back the information on how I have picked my bonuses has been rather complex as it involved this token business. I have managed this at the moment though. The token settings now work properly too, so the summoning of the djinni works well and his dialogue is fixed. The only problem is going to be when you gain several levels at the same time... you also summon multiple djinnis. I think I will fix that later as it is not a big issue at the moment. I will probably set a few triggers that will check whether you start in BG1, SOA or TOB related to the level you start with upon charactercreation.... otherwise you get a lot of summonings at the same time and the count can get lost somehow in the chaos making the dialogue inconsistent.


The class changing has proven more difficult.
I tried to make an innate that allows me to change form, but that does not change your class menu buttons (F1 to F12). As such, the bardsong is still there and the thieving abilities do not transfer such that you cannot pick locks or remove traps (and you do not have the detect traps/illusions button nor the stealth button).

The only way to get this done is to script an actual class change. I am doing this by scripting a baf that is appended to baldur.bcs which always runs in the background. The script allows me to change a class when a certain global is tripped. The global is changed by an innate spell which is indeed added to the CLAB again. I can refresh that innate just fine so the innate is unlimited, though it will disappear when the innate is interrupted. Maybe I should make it uninterruptable.

Anyway, the class changing was working a while ago, but now it seems faulty again. The global is tripped but the class is not changed and the block does not execute. I will need to bugtest this very thoroughly as I have done for an hour every day over the past month. At least I got it to work a few times, now to figure out how to get it to stay working.


If I can get this to work well, I will be able to script a custom fighter kit which can be picked by any race and then script a class-change such that you become a half-orc-mage or a dwarven-bard or a halfling paladin or whatever, the 'legal' way, since you just gain the bonuses of the mage/bard/whatever class when you change to that class. Class limitations may be hard-coded but can be circumvented this way. I probably have to fix some bonuses at that point though, thac0, health, XP-level... Could be interesting at least for my own tampering within the game.
Hoppy
QUOTE(lroumen @ Oct 29 2009, 04:18 AM) *
Anyway, the class changing was working a while ago, but now it seems faulty again. The global is tripped but the class is not changed and the block does not execute. I will need to bugtest this very thoroughly as I have done for an hour every day over the past month. At least I got it to work a few times, now to figure out how to get it to stay working.


If I can get this to work well, I will be able to script a custom fighter kit which can be picked by any race and then script a class-change such that you become a half-orc-mage or a dwarven-bard or a halfling paladin or whatever, the 'legal' way, since you just gain the bonuses of the mage/bard/whatever class when you change to that class. Class limitations may be hard-coded but can be circumvented this way. I probably have to fix some bonuses at that point though, thac0, health, XP-level... Could be interesting at least for my own tampering within the game.


You may be able to do the class/kit change via cutscene and have your blocks run through that. It won't take much and that way you can make sure everything fires. Zyraen's Hidden Kits mod does similar things to changing kits when specific quests are over or enemies are defeated. From memory, I don't think it changes a class though.

However, you may try to run two blocks. One for the class change and then a secondary block for the kit change. It may be easier than that but it will keep major changes separate because sometimes they won't fire all at once especially since a class change needs to adjust.

Your original post gave me the idea for the innates:
QUOTE
I was thinking that since you cannot change the layout of the functional buttons, you may be able to change their behaviour. So I figured, since the bard already has a thieving button for his pick pocket skill, would it be possible to give a bard kit the ability to pick locks and remove traps?


I think the only way to give a bard like thieving abilities (traps/locks) would be to create your own innate spells to be applied to the kit. The bard will have his normal buttons but in F12 list, your spells that mimic the set traps, remove traps, hide in shadows and so on. It would just be a dual/class created through the creature file rather than all the preset .2da's. There may be something similar to this kind of ability arranging in a Cleric/Thief dual class in the vanilla game or Tiax biggrin.gif in BG1. Or you could change the class to thief all together and give an innate for Bard song.

Cheers and have fun!



lroumen
Thanks for the tips. I will look into the possibilities.
Spells don't have a 'failure' measure though, so trap detection like the cleric spell is always 100%. That is kind of irritating.


I got my class changing to work again. It is relatively simple:

IF
Global("LR","GLOBAL",1)
Kit(Player1,LRBARDKIT)
THEN
RESPONSE #100
ChangeClass(Player1,THIEF)
ActionOverride(Player1,AddKit(LRTHIEFKIT))
SetGlobal("LR","GLOBAL",2)
END

IF
Global("LR","GLOBAL",1)
Kit(Player1,LRTHIEFKIT)
THEN
RESPONSE #100
ChangeClass(Player1,BARD)
ActionOverride(Player1,AddKit(LRBARDKIT))
SetGlobal("LR","GLOBAL",2)
END

The bardkit gets an innate that when tripped sets the global to 1 and trips the first portion of the script to change into a thief.
The thiefkit is hidden and gets an innate too that when tripped sets the global to 1 and trips the second portion of the script to change back.


The problem why it did not work for a while is because this does not work for some stupid reason:
If the innate sets the global to 0 and I use the block:
IF
Global("LR","GLOBAL",0)
Kit(Player1,LRBARDKIT)
THEN
RESPONSE #100
ChangeClass(Player1,THIEF)
ActionOverride(Player1,AddKit(LRTHIEFKIT))
SetGlobal("LR","GLOBAL",1)
END

The block is not executed. Weird. If the global does not exist, the block does execute.
So the cure was to set the global to a different value that 0 (as above I just use 1 and 2 instead of 0 and 1) such that the block can activate.

The block fires instantaneous. The kit addition is also instantaneous. The F1-F12 buttons do not change if you still have the character selected but if you unselect and reselect the buttons also change, so it is a minor hamperment but it does work the way it should.


Btw: I cannot add bonus abilities to the CLAB anymore if I keep shifting ingame. That is because any bonuses of previous levels will be applied when you change to a class. That means a simple bonus like +1AC will be re-added when you shift from one class to the next and back again multiple times. Cheating-galore.
But anyway, I only needed my bardsongchange to be in the CLAB and my "gain shifting innate" in the 2da, which is fine since it does not give any innate-duplication problems. Similarly, the hidden thiefkit has a CLAB that only contains the innate to shift back.
I can always add into my scripts the removal of an innate skill like a thief trap setting of course. That should be no big problem.




I did a test and you can make a mage-kit that does not show up under the mage kit list since it's full and then you basically slap in a fighterkit pickable by all races who has no bonuses and such (I suggest also mage-like proficiencies) and then set a block that simply changes this fighterkit to change your class and kit into the desired mage-kit.
Who says protagonists cannot have a custom mage kit?

IF
OnCreation()
Global("LRSHIFT","GLOBAL",0)
Kit(Player1,LRFIGHTERKIT)
THEN
RESPONSE #100
ChangeClass(Player1,MAGE)
ActionOverride(Player1,AddKit(LRMAGEKIT))
SetGlobal("LRSHIFT","GLOBAL",1)
END

Note: now the global does work since "LRSHIFT" does not exist yet in a new game.
Extremely simple! Am I reinventing the wheel here because stuff like this I cannot find anywhere in a kitcreation readme or across the boards.


Edit reason. Fixed the ClassChange -> ChangeClass issue.
Additionally, as discussed below, this will also work in a more general fashion:

IF
OnCreation()
Global("LRSHIFT","LOCALS",0)
Kit(Myself,LRFIGHTERKIT)
THEN
RESPONSE #100
ChangeClass(Myself,MAGE)
ActionOverride(Myself,AddKit(LRMAGEKIT))
SetGlobal("LRSHIFT","LOCALS",1)
END
Jarno Mikkola
Hmm, intresting. thumb.gif
QUOTE(lroumen @ Oct 30 2009, 11:06 AM) *
IF
Global("LR",1)
Kit(Player1,LRBARDKIT)
THEN
RESPONSE #100
ClassChange(Player1,THIEF)
ActionOverride(Player1,AddKit(LRTHIEFKIT))
SetGlobal("LR",2)
END

IF
Global("LR",1)
Kit(Player1,LRTHIEFKIT)
THEN
RESPONSE #100
ClassChange(Player1,BARD)
ActionOverride(Player1,AddKit(LRBARDKIT))
SetGlobal("LR",2)
END
Just so you know, this will probably fail if you'll install the Refinements mod, and it would be better if you made the script like this:
CODE
IF
Global("LR","LOCALS",1)
THEN
RESPONSE #100
ChangeClass(Myself,THIEF)
ActionOverride(Myself,AddKit(LRTHIEFKIT))
SetGlobal("LR","LOCALS",0)
END

IF
Global("LR","LOCALS",2)
THEN
RESPONSE #100
ChangeClass(Myself,BARD)
ActionOverride(Myself1,AddKit(LRBARDKIT))
SetGlobal("LR","LOCALS",0)
END
As the LR = 0, would be the normal state, while the 1 and 2 would be the class and kit changing mode... so the initiate just needs to set the LR to 1 or 2. wink.gif
lroumen
QUOTE(Jarno Mikkola @ Oct 31 2009, 09:23 AM) *
Hmm, intresting. thumb.gif


Just so you know, this will probably fail if you'll install the Refinements mod, and it would be better if you made the script like this:


As the LR = 0, would be the normal state, while the 1 and 2 would be the class and kit changing mode... so the initiate just needs to set the LR to 1 or 2. wink.gif

Thanks for the suggestion. Indeed it does not really matter which number the LR global is and for nicety if might as well be 0. It's just that using 0 as a trigger did not work, so I kind of forgot that I could do it the other way around.

Question though, why would it not work with refinements? Is it because I swap classes a lot causing conceptual incompatibilities?
Jarno Mikkola
QUOTE(lroumen @ Nov 2 2009, 11:55 AM) *
Question though, why would it not work with refinements? Is it because I swap classes a lot causing conceptual incompatibilities?
Well, I might be wrong of course, but as the Refinements sets the classes up with a 'fake kits', it might bring problems.
Hmm, yes it sounds that I am wrong. blush.gif

PS: I made a small but significant improvement... adding the "LOCALS" to the global field, and changed the 'Player1' to 'Myself', so even the NPCs can use the class too. And according to this, it's 'ChangeClass()', not 'ClassChange()'. biggrin.gif
lroumen
I will check Refinements regardless, but I think that is only for the vanilla kits because refinements does work for custom kits added into the game (before you add refinements of course). So it should in theory still work for something I would be creating and that would probably include the kitwork. I guess it would be problematic if you gain a level as a bard and you change into a thief to level up and pick a thief HLA from the refinements list and then shift back or something likewise, but that is something I will likely not be able to fix.
There is no way to do a forced-level-up.

ChangeClass or ClassChange?!?
Argh! Typing mistakes since I'm writing the code from memory rather than pasting it from my scripts (which are at home and I post from work).

You are also right about the LOCALS and Myself. That works very well for only changing your class and adding the kit.


In my own modding attempt I have some additional design which requires me to check each party member separately and I'm doing some settokenglobal work which for the moment does not work on each party member yet. That is why I'm currently only bugtesting my kit on the protagonist hence all my findings and code blocks posted here are directed to that. Maybe I should write it in a more general fashion.
About that problem btw: I have tried to set a local in a dialogue of a summoned creature script but that ends up on the summoned creature rather than the party member, so I am currently setting a global to overcome that problems for the purpose of testing. I will fix that later by copying the dialogue parts and putting a check like:
IF ~LastTalkedToBy(Player1)~ THEN BEGIN PLAYER1TALK
SAY ~~
IF ~~
THEN DO
~Actions
SetGlobal("LR_Player1_Set","GLOBAL",1)~
END

IF ~LastTalkedToBy(Player2)~ THEN BEGIN PLAYER2TALK
SAY ~~
IF ~~
THEN DO
~Actions
SetGlobal("LR_Player2_Set","GLOBAL",1)~
END

etc.
Still sets globals but at least they will be player dependant. The problem is that when party members leave the group, things may go awry. So then I have to do something to overcome that by attaching the global to the party member as a locals such that it is saved properly on the npc.... bit difficult that, and I like to fix things in the correct order. First get the kit working, then make the dialogue and the globals npc dependant. smile.gif
Jarno Mikkola
QUOTE(lroumen @ Nov 3 2009, 10:48 AM) *
ChangeClass or ClassChange?!?
Argh! Typing mistakes since I'm writing the code from memory rather than pasting it from my scripts (which are at home and I post from work).
Well, you could always write the reply at home, when you should be working, and not at work when you sleep... this way you can always use the exported .baf as the source material, and then just put the reply to a .txt file, that you put to a USB stick or something alike, and modify it at work if it needs to.

QUOTE(lroumen @ Nov 3 2009, 10:48 AM) *
In my own modding attempt... Maybe I should write it in a more general fashion.
Nah, you can do your own thing, and then let people know that it doesn't work with other chars, if they ask... as there is far too many things to worry about other than some arbitrary rule of do it this or that way.

QUOTE(lroumen @ Nov 3 2009, 10:48 AM) *
About that problem btw: I have tried to set a local in a dialogue of a summoned creature script but that ends up on the summoned creature rather than the party member, so I am currently setting a global to overcome that problems for the purpose of testing. I will fix that later by copying the dialogue parts and putting a check like:
IF ~LastTalkedToBy(Player1)~ THEN BEGIN PLAYER1TALK
SAY ~~
IF ~~
THEN DO
~Actions
SetGlobal("LR_Player1_Set","GLOBAL",1)~
END
Well I think that could be easy to adjust, you just put ActionOverride(target,SetGlobal(etc.))

So it ends up to look like this:
CODE
THEN DO
      ~ActionOverride(Player1,SetGlobal("LR_Player1_Set","LOCALS",1))~
END
Of course that does needs the target... and the genie can't see what it just did without it's own local global, but still...
lroumen
Good idea about the usb. I had not thought about that. I generally have more time during a few breaks at work since all the time I can spare at home I'll be testing.

I had not thought about setting a local using action override. That is quite helpful. Thank you.
Back to testing and scripting smile.gif.
lroumen
Update:

- class changing fixed. it is working properly
- djinni dialogue fixed for 1 party member (I can do it with the locals, but the dialogue gets messed up when you kick party members out. bonuses should work okay, just the text will be botched)
- bardsong change in clab (at level 1)
- levelup bonuses not put into the clab (since when you switch classes you regain them all), but put into baf (and it works)
- gain some abilities at certain levels (through baf scripting)

I will be testing a few last things before finalising everything and then I will release a version for people that are interested in how I did this stuff. I generally don't mind if not many people are interested because this modding attempt is something for myself smile.gif


I will probably bring out 2 versions.
- personal version, where the kit has some abilities such as thieving upon level up, spells/skills/abilities per level up, a personal weapon spell, a personal overpowered bardsong and enhanced bardsong, a dialogue to recheck the progress of the thieving skills.

- vanilla version only contains class switching and thieving upon level up. nothing else. It will contain the thievingbonuses per level up but no dialogue to recheck the progress (it only has the dialogue to upgrade), no bardsong, no weapon spell, no bardsong change, etc... this is for people who do not like my changes and if they want they can tune the kit whichever they want. Notes will be added such as "do not put anything in the CLAB, but use a baf script".

- Next version: djinni dialogue fix for all party members (if I can figure out the code). class switching and thieving per level should probably work in the current version though.

ETA: mid to end December 2009.

I would like a tip for a reliable hosting site. Any ideas?
Jarno Mikkola
QUOTE(lroumen @ Nov 23 2009, 09:56 AM) *
I would like a tip for a reliable hosting site. Any ideas?
Well, if you ask, I am sure Baronius(his profile, our host/site admin) will give you some kind of response, but totally free mod hosting without any strings attached except a log in... I would give the SHS's Miscellaneous Released Mods a go.
Baronius
lroumen can always PM me with the details of what he needs if he finds BWL a "reliable hosting site". On a side note, I'm sure most members know here that BWL is "totally free" as well, and (as opposed to SHS, for example) it does not beg/flatter in private messages to lure new modders tongue.gif
lroumen
Oh, haha, I didn't mean it like that. If I were to put it up for a permanent download I would ask Baronius for a spot on the dragons hoard for sure. In that case the download would probably be put it in the small tweaks forum.

I meant something for a quick release rather than a complete version which I would append here since I'm guessing that I will get some comments on it first to make it 'pretty' for a final release.
Baronius
As a forum member, you should be able to attach files to your posts too, if that is suitable. If you want to put it somewhere else as a file (e.g. like some people do on sites such as RapidShare etc., I don't know those), then I understand that you're searching for tips, considering that the free sites obviously don't (and can't) offer high availability. (BWL certainly offers FTP space too, but perhaps you're looking for file storage with a web-based shiny graphical interface, I guess the free hosts provide such.)
Jarno Mikkola
QUOTE(Baronius @ Nov 24 2009, 12:22 PM) *
On a side note, I'm sure most members know here that BWL is "totally free" as well, and (as opposed to SHS, for example) it does not beg/flatter in private messages to lure new modders tongue.gif
The SHS holds the bar at 100 MB's not on 2 MB's, which is more reasonable for most of the mods.
I am not saying that one wouldn't get more on BWL, but one would obviously need to ask for it. wink.gif

And what comes to the PMs in SHS, it's just the joining part of the forum, besides the forum has enough spam already to fill ...
Now, what comes to the RapidShare etc(www.uploading.com, www.mediafire.com), you need to understand that they are not permanent solutions for mod spreading, nor very reliable either, as they will last a day, a week, a few months at most, and you'll hate yourself soon when somebody will come and ask for a new address, see a good example in this very site.
lroumen
Oh right, I forgot about being able to attach files to posts.

Thanks for the tips.
Baronius
Jarno Mikkola: I don't know what megabytes you're talking about, BWL can offer gigabytes of space to the modders whose work needs this (it's another question that we don't host many large mods, but the possibility is still there for new modders who want clean space). My comment merely pointed out that BWL wouldn't ask from SHS' "popularity" for that price biggrin.gif BWL is proud that it is a clean place, and can give place for practically any modder who contacts it, and it doesn't try to contact various modders privately to convince them to bring their mods there tongue.gif (terrrrible where this world goes). But enough of this, this is lroumen's topic about kit creation.
lroumen
Well.. this is it. All info is in the zip file, but below the readme in detail..






Switch
A mod for Baldur's Gate 2, by lroumen

=== Introduction ===
One thing that I have always disliked about the game is that certain things are hard-coded for no apparent reason. A bard has thieving abilities but is limited to only picking pockets and is not able to pick any locks. Seems okay for the class itself, but it would have been nice if the developers (who noticed that the fanbase was high and saw that the amount of mods rising), would have allowed some more freedom for the modders. Similarly, monks can find traps, but then they cannot do anything with those traps. Sounds rather silly, because then you still need a thief to do the trap disabling or you can trip it in which case the monk doesn't even need to find it does he?

For this reason I have created a small bardkit that allows him to shapeshift into a thief and perform the other thieving abilities in that form. This makes the bardkit into a stand-alone character that can either be a thief or a bard, effectively negating the necessity for a thief in the party, but you still have a rogue in the party (knock and find traps is rather impractical).


=== General Content ===
This mod contains basically two interconverting kits: the "Bardic Switch" and the "Thief Switch". Each starts with an innate ability that allows them to change their class "temporarily" into the other. I say here temporarily because if you want to switch back, you will have to activate the innate ability again of that particular class.
It is pretty straightforward really.

As a Switch you level up as a normal rogue. The thief and bard XP levels are the same such that you will not run into problems that one class is ahead of the other. I coded in an ability that you will be given upon reaching each new bard level. It will summon the "Master Switch" who will aid you in giving you either picking, trapping or stealth bonuses. Thus artificially, you will gain thief bonuses if you do not level up as a thief but as a bard.

If you install the mod Lux way, then you also get other goodies: custom bardsong, custom weaponspell, custom Master Switch dialogue.


In a similar fashion, one can create interconverting kits for the paladin-ranger combination (turn undead and have stealth) and the Cleric-Monk (fight with your hands, have magic resistance and use cleric spells... though this provides problems when you switch since you gain all bonuses in the CLAB files again). I will try to make these things work at a later point in time. Anyway... back to the bard-kit


=== Complications ===
Since this is a mod that bends the rules, there are several complications and fixes/workarounds, explained below.

P1. Race limitations
S1. No problems here because all races can pick thief as a class, such that with the click of a button, your thief can become a bard, thus races are no longer limited by classes. If one looks at my baf script for the switch, one can figure out how to get past hard-coded class limitations quite easily (create a fighterkit that changes class after character creation... all races can pick the fighter class).

P2. Thieving skills
S2. Bards only get pick pocket bonuses, thieves can pick anything. I have made the Switch gain 20% thieving skills if you level up as a thief, and twice 10% thieving skills if you level up as a bard. The latter is performed by granting the Bardic Switch the ability to summon a Master Switch who will increase either your picking skills (10% bonus to pick pockets and pick locks), trapping skills (10% bonus to find traps and detect illusions) and stealth skills (10% bonus to hide in shadows and move silently).
If you start as a thief, take this into account if you level up later as a bard. If you level as a thief, you do not get the bardic bonuses, thus leveling out.

P3. Spell slots
S3. Bards gain spells per level, but thieves do not. If you leveled as a thief and go into Bard form you do not get the extra spell levels. This will be fixed if you cast restoration on yourself. I could code this in, but thinking it could result in cheating (use the level up to get rid of nastiness), I decided that this would be up to the player. Restoration scrolls can be bought and spells can be memorised easily.

P4. Weapon Proficiencies
S4. Since you will be Bard and Thief, the thief has been given all proficiencies similar to the bard. Bard and thief rate is the same. Weapons will not be usable in thief form of course, thus unequip if appropriate (will be fixed when you get the Use Any Item HLA).

P5. Upon switching to the bard state you will be given the the message that you gained a bardsong ability.
S5. I can put this in as a level up ability through script, but decided not to. IF this floods your screen too much, please let me know and I can circumvent this by scripting it in the baf.
Note: all abilites are thus gained through script and not through the CLAB files. The reason is that when you switch class, you gain all bonuses from level 1 to the current level, even if you had already recieved those bonuses before. That means that if you switch a lot and have a +1AC in your CLAB, you can get as many bonuses to AC.

P6. Your trap setting skill is 100% from the start.
S6. Bards have a hidden trap setting modification that puts it to 100%, because otherwise they fail at setting the HLA traps. I decided that the Switch kit does not get trapping skills, but will be able to pick trapping HLAs. So basically, this has become a non-issue. If you want you can manage this by scripting the ability in and doing a one-time reduction of the trap setting bonus on the Bard, followed by a trap setting bonus upgradable per level by the Master Switch dialogue.


=== Switch Kit Abilities per Level Description ===
- The switch levels up as any rogue
- At level 1, if you start as human or half-elf, your avatar changes into a tiefling (fun to code).
- At level 1, you will gain a custom bardsong, description below.
- At level 1, you will gain the ability to shapeshift into a thief or bard. Shifting back reenables this, thus it should be unlimited.
- At level 1, the bard will have a custom weapon spell, the Switchblade. This upgrades four times with new bonuses, description below.
- Every time you level up as a bard, you will be given the ability to summon the Master Switch to increase a selection of thieving skills by 10%. This is iteratively, meaning that if you gain multiple levels, the bonuses come one at a time. After choosing which skill to increase, the summoning spell is removed again from your innate abilities.
- At level 1, your backstab modifier increases by 1. Thus, a Bardic Switch can backstab for a bonus of +1x the damage, whereas the Thief Switch can backstab at his own level+1.

= Thieving skill increase =
You will have three choices. Picking, trapping or stealth skills.

Picking skills: 10% bonus to Pick pockets Pick locks
Trapping skills: 10% bonus to Detect traps Detect illusions
Stealth skills: 10% bonus to Hide in shadows Move silently


= Djinni talk =
I have developed the Switch bardkit such that the tracking of the progression only works for ONE party member for now. I manage the progression talk by setting a global variable and tokens. I find that it becomes too much of a problem to code it in such a way that it will be allround for a multiple switch party... You don't need more than 1 switch in you party.
If somebody knows how to fix it, to make it party-friendly, I would be very interested (but do not just give me scraps of code unless you are certain that it works because I already have received lots of scraps that have failed, unfortunately).
The skill increases for a 6 Switch party will only work if your switches are the same level. You will probably all change class at the same time too... I advise you not to use more than one in your party or your play-through will be filled with bugs.


=== Installation ===
The bardkit can be installed in two ways.

BluePrint
This allows the protagonist to start as either a thief or bard and switch to and fro. It does not contain checks to keep track of your upgrades, nor does it contain any other bonuses. Thus it will be moddable in accordance with your own wishes, examples are given in the baf-script.

Lux way
This allows the protagonist to start as either a thief or bard and switch to and fro. Contains custom bardsong, weapon spell, level up abilities and a minor Master Switch progression tracking dialogue.


I made separate installers because I wanted to put the mod out into the world rather than tweak the installer-tp2 a million times.


=== bugs ===
If you find any bugs, they can be directed at: lucroumen@hotmail.com



=== acknowledgements ===
Ardanis, Jarno Mikkola, Hoppy and Wisp for some tips on the coding.



CODE
VERSION 1.0 Files
-----------
readme.txt           this file
setup-bardkit.tp2    installation datafile            Luxway
setup-bardkit.exe    installation executable          Luxway
setup-bardkit-reduced.tp2    installation datafile    Blueprint
setup-bardkit-reduced.exe    installation executable  Blueprint

--- tra ---
English        LRdjinn.tra: Master Switch Lines
English        setup.tra:   Installation Lines

--- 2da ---
CLABSWI.2da    CLAB for Bardic Switch: lvl1: GA_LRsw014, AP_LRsw008
CLABSWJ.2da    CLAB for Thief  Switch: lvl1: GA_LRsw015
luSWI.2da      HLA  for Bardic Switch: Nothing Special, enhanced bardsong (I hope it works)
luSWJ.2da      HLA  for Thief  Switch: Nothing Special, enhanced bardsong (I hope it works)
CLABSWK.2da    CLAB for Bardic Switch: lvl1: GA_LRsw014   Reduced Installation
CLABSWL.2da    CLAB for Thief  Switch: lvl1: GA_LRsw015   Reduced Installation
luSWK.2da      HLA  for Bardic Switch: Nothing Special    Reduced Installation
luSWL.2da      HLA  for Thief  Switch: Nothing Special    Reduced Installation

--- cre ---
LRdjinn.cre    Master Switch (The Unconscious Orog)

--- dlg ---
LRdjinn.d      Master Switch Dialogue (uses LRdjinn.tra)

--- itm ---
LRswbld1.itm   Switch Blade 1: Rng2, Wsp1, Longsw+1, thac0+1, 1d8+1, ProfLsw1, Blurred, ProtBckstb, 10%heal1 , Att/Rnd=1.5
LRswbld2.itm   Switch Blade 2: Rng2, Wsp1, Longsw+2, thac0+2, 1d8+2, ProfLsw2  Blurred, ProtBckstb, 15%heal2 , Att/Rnd=2
LRswbld3.itm   Switch Blade 3: Rng2, Wsp1, Longsw+3, thac0+3, 1d8+3, ProfLsw3, Blurred, ProtBckstb, 20%heal5 , Att/Rnd=3
LRswbld4.itm   Switch Blade 4: Rng2, Wsp1, Longsw+4, thac0+4, 1d8+4, ProfLsw4, Blurred, ProtBckstb, 25%heal10, Att/Rnd=4

--- spl ---
LRsw001.spl    Give Innate LRsw002 to the Bardic Switch.
LRsw002.spl    Innate: Spell that creates Magical Weapon (LRswbld1,2,3,4 : lvl cutoffs 1,7,13,19)
               Duration: 36,36,36,42,48,54,60,66,72,78,84,90,96,102,108,114,120,126,132,138
LRsw003.spl    +10% Open Locks
               +10% Pick Pockets
LRsw004.spl    +10% Find Traps
               +10% Detect Illusions
LRsw005.spl    +10% Hide in Shadows
               +10% Stealth (Move Silently)
LRsw006.spl    Backstab Bonus x1
LRsw008.spl    Change Bardsong to LRsw009.spl
LRsw009.spl    BardSong: Prot: Entangle, Web, Hold
                         Cure: Entangle, Web, Hold (works locally, does it work for other people?)
                         Dex+1
LRsw010.spl    BardSong: Prot: Entangle, Web, Hold
                         Cure: Entangle, Web, Hold (works locally, does it work for other people?)
                         Dex+3
                         Invisibility
                         Attacks Per Round +1
LRsw011.spl    Change Bardsong to LRsw010.spl (HLA)
LRsw013.spl    Give Innate LRSW016 to the Bardic Switch.
LRsw014.spl    Innate: Switch to Thief. (Remove LRsw014.spl from Innates, SetGlobal LRFORM to 2)
LRsw015.spl    Innate: Switch to Bard.  (Remove LRsw015.spl from Innates, SetGlobal LRFORM to 2)
LRSW016.spl    Innate: Spell to summon the Master Switch (LRdjinn.cre)
LRSW017.spl    Remove Spell LRSW007.spl from Innates. // not needed
               Remove Spell LRSW016.spl from Innates.


--- baf ---
LRdjinn.baf    Master Switch Script to get the dialogue running immediately
LRswitch.baf   Switch Script to do everything for this mod

Globals:
= LRFORM                   1 = do not switch class
                           2 = switch class (if bard->thief, if thief->bard)   SETBY LRSW014/LRSW015
= LRSWPICKINCREASE         0 = Default
                           1 = Increase picking  level by 1 (and token by 1)   SETBYDLGWITH(LRSW003.spl)  CALLS LRSW199
= LRSWPICK                 X = Level of picking  bonuses
= LRSWTRAPINCREASE         0 = Default
                           1 = Increase trapping level by 1 (and token by 1)   SETBYDLGWITH(LRSW004.spl)  CALLS LRSW199
= LRSWTRAP                 X = Level of trapping bonuses
= LRSWSTEALTHINCREASE      0 = Default
                           1 = Increase stealth  level by 1 (and token by 1)   SETBYDLGWITH(LRSW005.spl)  CALLS LRSW199
= LRSWSTEALTH              X = Level of stealth  bonuses
= LRCHOSEN                 0 = Has not been a bard yet, use to skip Bardic Master Switch Summon Levels
                           1 = Default
                           2 = Master Switch Dialogue bonus has been Chosen                               CALLS LRSW013
= LRDJINNGAIN              X = Every increase is a Master Switch Summon Gained, but only if you are a Bard!
= LRLVL                    X = Your own level. Used to check whether to skip Bardic Master Switch Summon Levels
= LRAVATAR                 0 = No avatar change
                           1 = Avatar changed (if human, half-elf, then become tiefling)
= LRBLADEGAIN              0 = No Switchblade gained yet
                           1 = Switchblade gained                                                         CALLS LRSW001
= LRBACKSTABGAIN           0 = No backstab gained yet
                           1 = Backstab gained                                                            CALLS LRSW006


Tokens:        Necessary for Master Switch Dialogue. Only works well if 1 Switch has ever been in the party.
= LRSWTRAP     The amount of times trapping has been increased by the Master Switch, (same as the global)
= LRSWPICK     The amount of times picking  has been increased by the Master Switch, (same as the global)
= LRSWSTEALTH  The amount of times stealth  has been increased by the Master Switch, (same as the global)
Jarno Mikkola
Ah, there's no primary mod folder(*modname* that is alike the setup-*modname*.tp2 and setup-*modname*.exe), so I guess we have to make it and call it as "bardkit"... and bump the .tp2's, the readme.txt file and the other folders into it. and copy it and the .exe's to the game folder and then install it.

And now that I have installed it, it works perfectly, nice. Really nic3.
lroumen
Ah yes.

The zip-file should be unpacked in the main BG2 folder.
The tp2 and the exe should then be moved from the bardkit folder to the main BG2 folder.

You can then install.


Things that need fixed, but which can be avoided for now:
- the abovementioned installation (I should pack it better)
- check for BG2, BGT or BGtutu (though it should work regardless).
Jarno Mikkola
QUOTE(lroumen @ Dec 23 2009, 08:35 AM) *
The zip-file should be unpacked in the main BG2 folder.
The tp2 and the exes should then be moved from the bardkit folder to the main BG2 folder.
Ah, but there is no need to move the setup-bardkit.tp2, it can be where ever it's put, even in <gamefolder>\U\C\F\R...\ and it will still work the same way as if it was in the game folder, and the setup-bardkit.exe will start it no matter where the .tp2 file is... the reason I wouldn't put it to the game folder is that it's not so nice to have aaa ten thousand setup-*mod*.* files in game folder.
So pack the mod so that when the unpacking happens, there is no extra folders or others, just the mod folder 'bardkit', the setup-bardkit.exe and setup-bardkit-reduced.exe (as everything else in within the bardkit folder). And remove the backup/0/ folder, it's empty...
lroumen
Great, I had to fix a bug with the bardsong already. Seems it does not work fullproof in the first version. The following works on my own PC.

Change: removed enhanced bardsong (because it's overwritten if you switch to a thief and back again) and I made the bardsong upgrade at level 20 instead (which is a bit early but okay). Bardsong now activates on the party rather than on an undefined target (which is probably why it did not work).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.