It's the same deal as levels, but slightly more complex. To compare the xp values i would need to duplicate the possible states into a state machine since there is no XPGT(S:Global).
guess i'm not seeing it...
personally i don't see why a player would want to use thief skills on more than one party member. they could always have a thief join the party if they want a backup. make the mod protagonist only...
to determine how many skill points total need to be offered on first use of the mod, set a global equal to the level. then when level goes up and global is one under offer normal level up amount of skills to be spread about.... Else just ask the player at install time how they want to spread the skills at each level up. Either one set for all or a different spread for each level up. then preset the effects to apply as they chose.
but i understand you want in game choices instead...
Yes, that it. Character development of a sort. I'm still thinking about the penalty. Subtract the exp needed to get to the equivalent thief level? Make having the script set give a penality to XP (if there's a effect for this).
Anyway your suggestion in code form (took a while to compile, weidu doesn't like recursions):
Spoiler
//create a static binary tree to find the real value of the stat so i can use it for feedback with a global and tokens
//don't set the depth parameter - it's for the recursion.
DEFINE_ACTION_FUNCTION binSearch INT_VAR depth = 0 min = 0 max = 0 leafLength = 30 STR_VAR statID = ~~ scriptName = ~~ returnScript = ~~ BEGIN
//pivots are unique on all ranges... max-min/2 is never the same because max and min are never the same
OUTER_SET pivot = %min% + ((%max% - %min%) / 2)
//the first recursion needs to keep the name, so the user can expect the right file to start out things.
ACTION_IF (depth == 0) BEGIN
OUTER_SPRINT currentScript ~%scriptName%.baf~
OUTER_SET depth = depth + 1
END ELSE BEGIN
OUTER_SPRINT currentScript ~%scriptName%%pivot%.baf~
END
ACTION_IF ((max - min) < leafLength) BEGIN
OUTER_SPRINT statTree ~~
OUTER_FOR(j = %min%; %j% <= %max%; j = %j%+1) BEGIN
OUTER_SPRINT statTree
~%statTree%
IF
CheckStat(LastTalkedToBy, %j%, %statID%)
THEN
RESPONSE #100
DialogueSetGlobal("%statID%", "GLOBAL", %j%)
SetTokenGlobal("%statID%", "GLOBAL", "%statID%")
ActionOverride(Myself,ChangeAIScript("%returnScript%",GENERAL))
END~
END
<<<<<<<< %currentScript%
%statTree%
>>>>>>>>
COMPILE EVALUATE_BUFFER ~%currentScript%~
END ELSE BEGIN
OUTER_SET minus_pivot = %pivot% - 1
//the pivots of the halves
OUTER_SET upperPivot = (%pivot% + ((%max% - %pivot%) / 2))
OUTER_SET lowerPivot = (%min% + ((%minus_pivot% - %min%) / 2))
<<<<<<<< %currentScript%
IF
CheckStatGT(LastTalkedToBy, %minus_pivot%, %statID%)
THEN
RESPONSE #100
ActionOverride(Myself,ChangeAIScript("%scriptName%%upperPivot%",GENERAL))
END
IF
True()
THEN
RESPONSE #100
ActionOverride(Myself,ChangeAIScript("%scriptName%%lowerPivot%",GENERAL))
END
>>>>>>>>
COMPILE EVALUATE_BUFFER ~%currentScript%~
LAUNCH_ACTION_FUNCTION binSearch INT_VAR depth min max=minus_pivot leafLength STR_VAR statID scriptName returnScript END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR depth min=pivot max leafLength STR_VAR statID scriptName returnScript END
END
END
I'm going to try to use it like this:
Spoiler
//return script are the next required stat so they all are recorded. Last one, restores the thief script.
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 1 max = 7 leafLength = 30 STR_VAR statID = ~BACKSTABDAMAGEMULTIPLIER~ scriptName = ~gt#bks~ returnScript = ~gt#trp~ END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 0 max = 255 leafLength = 30 STR_VAR statID = ~TRAPS~ scriptName = ~gt#trp~ returnScript = ~gt#dil~ END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 0 max = 255 leafLength = 30 STR_VAR statID = ~DETECTILLUSIONS~ scriptName = ~gt#dil~ returnScript = ~gt#stp~ END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 0 max = 255 leafLength = 30 STR_VAR statID = ~SETTRAPS~ scriptName = ~gt#stp~ returnScript = ~gt#lkp~ END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 0 max = 255 leafLength = 30 STR_VAR statID = ~LOCKPICKING~ scriptName = ~gt#lkp~ returnScript = ~gt#ppt~ END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 0 max = 255 leafLength = 30 STR_VAR statID = ~PICKPOCKET~ scriptName = ~gt#ppt~ returnScript = ~gt#hds~ END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 0 max = 255 leafLength = 30 STR_VAR statID = ~HIDEINSHADOWS~ scriptName = ~gt#hds~ returnScript = ~gt#mvs~ END
LAUNCH_ACTION_FUNCTION binSearch INT_VAR min = 0 max = 255 leafLength = 30 STR_VAR statID = ~STEALTH~ scriptName = ~gt#mvs~ returnScript = ~gt#thief~ END
One script tree leads to another, leads to another ... until the last leads back to the original script (trying to replace the player script in a cutscene - though i can try a creature later).
Edit: tested, it's far too slow (due to being bounded by the AI ticks clock - change AI script waits until the next AI update i think.
Anyway, my tokens weren't being set with DialogueSetGlobal. I'm using the last TobEx version. Broken?
Edit2: DialogueSG(S:Name*,I:Num*) works though. Huh, I'm using "GLOBAL" too.
to determine how many skill points total need to be offered on first use of the mod, set a global equal to the level. then when level goes up and global is one under offer normal level up amount of skills to be spread about.... Else just ask the player at install time how they want to spread the skills at each level up. Either one set for all or a different spread for each level up. then preset the effects to apply as they chose.
Its very easy for the thieves skill to overflow if you focus on one - to avoid this i need to know the current skill level exactly - and that is altered by dexterity, cheating even items (those +50% or minus 40% items come to mind) that might change.
You can also easily level up more than once if using a single class and a low level single classed char. For these reasons, the checks for the level and skills need occur any time you go to distribute skills - this doesn't solve all problems; but at least it makes my particular mod not add to them, so it's the fault of other things (items can be removed, dex increases not so much).
Or i can just cap things to 150, call it a "limitation" of the item - and ignore the racial and dex bonus; at least until and if Ascension64 adds a StatToGlobal function - though this doesn't solve the need to know the level for getting the right amount if points and when to allow "level up". That should be a lot faster thought (prob can even be done in a single dialog state with 50 replies).
Leave the automatic level up for when i can check the level rapidly in a AI script (cool idea that, would make things more seamless)