Jump to content


Alternative distribution of XP amongst party members


  • Please log in to reply
12 replies to this topic

#1 -Mhek-

-Mhek-
  • Guest

Posted 02 December 2011 - 06:40 AM

This is my idea:

1) Whenever the group earns XP, only the PC earns XP. He/she earns: entire amount of XP divided by number of party members (e.g. when only Minsc and Jaheira are in the party, PC earns XP/3; Alternatively diveded by 6, if easier to code).
2) After the XP is granted to the PC, the overall XP of each party-member is set to the same amount as what PC is having. This XP-adjustment should also happen while a NPC is (re)joining.


This approach would have the following advantages:
- It would not matter at which time point a NPC joins, as his/her XP would always match exactly that of the player.
- You could regularly change party members without loosing any XP. So you could go to Spellhold without Minsc in the party. If after returning to Atkatla you would decide to let him join again, he would not have fallen behind as compared to the other NPCs. His XP would just be the same (maybe he had some adventures on his own while staying in the Copper Coronet ;) ).
- It would even be viable to bring specific NPCs to a specific encounter. You would not be penalized for regularly swapping NPCs and readjusting your party.


Is this idea codeable, or would one have to manually change every single quest reward?
Suggestions, thoughts?

#2 10th

10th
  • Member
  • 621 posts

Posted 02 December 2011 - 09:08 AM

Much easier solution, cause it already exists:
Install Level 1 NPCs with
~LEVEL1NPCS/LEVEL1NPCS.TP2~ #0 #4 // Joinable NPCs more closely match the player character's experience -> On initial joining and rejoining: v1.9

which should take care of your problem.

It is not as fine tuned as your idea, but it could be, if one wants it to edit a specific baf-file before or a specific bcs-file after installation.

10th
Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#3 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 02 December 2011 - 09:34 AM

You want an XP evener script, right? NWN2/DA style?

Not possible as you describe it, but... something similar is possible. Make up a BS (AI script as opposed to a creature script). Set it up so that when the player hits a hotkey, an evener script runs. You wouldn't want to play with it on all the time, but you could always change to that script every time you need it, level your peeps, and then change to something that might actually help you in combat. It would probably take me about an hour to code and another hour to figure out how to make it compile into a BS instead of a BCS.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#4 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 02 December 2011 - 09:42 AM

It would probably take me about an hour to code and another hour to figure out how to make it compile into a BS instead of a BCS.

I'll give ya the hour to code it but compiling it to a BS is easy

COPY ~somefile.baf~ ~scripts/somefile.bs~
 COMPILE_BAF_TO_BCS

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#5 -Mhek-

-Mhek-
  • Guest

Posted 02 December 2011 - 05:57 PM

Wow, what a great community! Didn't expect so many answers is such a short time :Bow:


Much easier solution, cause it already exists:
Install Level 1 NPCs with
~LEVEL1NPCS/LEVEL1NPCS.TP2~ #0 #4 // Joinable NPCs more closely match the player character's experience -> On initial joining and rejoining: v1.9

which should take care of your problem.

It is not as fine tuned as your idea, but it could be, if one wants it to edit a specific baf-file before or a specific bcs-file after installation.

10th


Ah, I didn't realize that Level 1 NPCs also had the feature to adjust NPC XP on rejoining. Thanks for pointing this out to me, this could be exactly what I am looking for.
It seems you are familiar with how this mod works in this regard. What does "more closely match the player character's experience" means exactly? So how does the mod achieve this and what could be altered in said baf- or bcs-style to change the mechanism?



You want an XP evener script, right? NWN2/DA style?

Not possible as you describe it, but... something similar is possible. Make up a BS (AI script as opposed to a creature script). Set it up so that when the player hits a hotkey, an evener script runs. You wouldn't want to play with it on all the time, but you could always change to that script every time you need it, level your peeps, and then change to something that might actually help you in combat. It would probably take me about an hour to code and another hour to figure out how to make it compile into a BS instead of a BCS.


Hm, I don't know if I am looking for an XP evener script, as I don't know NWN2/DA. A script i would be looking for should not even XP in a sense that PC could also loose XP (e.g. a low level NPC joins a high level party, than XP should not be evened amongst all NPCs, thus lowering XP of the high level NPCs and PC but instead should only add XP to the low level NPC).


In a vanilla game you always get 100% XP that is split between party members. In a full party, it gets split amongst 6 members. So the best approach is to get your full party of choice and stick to it. If you decide to change two party members relatively late in the game, some XP is lost as the new members would have less XP than the members who always stayed in the party. The XP would be have been split amongst 8 people. The more you change NPCs, the weaker they are.
So my suggestion is to have a mod where you do not have to think of this issue and where all joinable NPCs would have as much XP as PC at any given time. This way you could try out new NPCs just for a short time, and expulse them if you don't like them. Or you could regularly readjust your party for certain quests thus evffectively playing with more than 5 NPCs.

As 10th pointed out Level 1 NPCs could be capable of that.



Thanks for all your feedback!

#6 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 02 December 2011 - 11:23 PM

What I was proposing was to have a script that would do pretty much the same thing as the L1NPC code, but with a closer match.

Basically, it would:
- Check Player1XP
- Check Player2 through Player6 XP (individually)
- Add enough XP to bring Player2 through Player 6 (individually)up to the same level as Player1.

Edited by berelinde, 03 December 2011 - 12:28 AM.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#7 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 03 December 2011 - 03:30 AM

Basically, it would:
- Check Player1XP
- Check Player2 through Player6 XP (individually)
- Add enough XP to bring Player2 through Player 6 (individually)up to the same level as Player1.

That's pretty much what the L1NPCs component does. It would trigger if you dismissed someone and then re-recruited them so I don't know if you'd need a separate script. I suppose it's possible. What it doesn't do is lower the level of high-level party members when low-level people join, if that's what suggested. I suppose that also is possible in theory, but it could be potentially messy, since you'd have to account for losing any abilities gained for levels that are lost, etc.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#8 10th

10th
  • Member
  • 621 posts

Posted 03 December 2011 - 05:25 AM

Ah, I didn't realize that Level 1 NPCs also had the feature to adjust NPC XP on rejoining. Thanks for pointing this out to me, this could be exactly what I am looking for.
It seems you are familiar with how this mod works in this regard. What does "more closely match the player character's experience" means exactly? So how does the mod achieve this and what could be altered in said baf- or bcs-style to change the mechanism?


The baf-file is the uncompiled script file - aka before installation of the mod component, the compiled baf-file is a bcs-file and present in your BG2 installation after installing that mod component.

Name and location of the file in question:
before:
Your BG2 directory\level1npcs\xpmod\fjxpmooc.baf
conveniently editable by any text editor worth his salt (ConTEXT, Notepad+, Crimson etc.).

after:
fjxpmooc.bcs
editable by using Near Infinity or DLTCEP, there are probably some more programs which I forgot, but those two are the most up-to-date, and most commonly used programs for general purpose editing/modding.

Content of this file and function:
A lot of if -> then clauses comparing xp values of your main character to the newly joined party member, and adding a certain amount of xp to said party member based on those if -> then clauses.

If your main character has more xp it's

AddXpObject(LastSummonerOf(Myself),100)

for example.

If it's the other way around, and your main character has less xp, it's

AddXpObject(LastSummonerOf(Myself),-100)

for example.

Scripts are parsed from top to bottom, therefore it begins with the highest possible xp achievable in a normal game:
IF
 CheckStatGT(Player1,7999999,44)
 CheckStatLT(LastSummonerOf(Myself),7000000,44)
THEN
 RESPONSE #100
	AddXpObject(LastSummonerOf(Myself),1000000)
END

IF
Check if main character has more than 7999999 xp AND
Check if newly joined party member has less than 7000000 xp
THEN
add 1000000 xp to the newly joined party member.
END

Slight detour:
That's by the way exactly the point where it breaks apart in heavily modded games, with mods which remove the xp-cap and extend the level cap to level 50, dole out many high xp rewards to the party to reach such a high level, and with a theoretical absolute xp-cap of 45,000,000 xp (a fighter/mage/thief or fighter/mage/cleric). To clarify, it's breaking apart because it doesn't add any more xp after that 8,000,000 mark in such games.
Level 50 rules without an xp-cap greatly benefit multi-classed characters (several classes are raised simultaneously) and to a lesser extent dual-classed characters (abandon one class to advance in another). That's due to the fact that even the slowest advancing class (Druid) reaches its cap at 17,500,000 xp.

Detour to Icewind Dale 1 + all addons:
Multi-class characters rule the Heart of Fury difficulty due to a removed xp-cap with a level 30 cap still in place.

As there are no Continue() after AddXpObject() the script starts over from the top.

Example:
Main character (mc) with 8,000,000 xp
New party member (npm) with initally 2,500,000 xp

1. As that if clause posted above is true, it awards npm with 1,000,000 xp.
2. Npm has a new xp value of initial value + 1,000,000 xp.
3. If if clause is still true, go to 1.

That repeats itself until npm reaches 7,500,000 xp.

If you're reading that script from top to bottom, you'll notice that the potential xp difference keeps getting larger the more xp the main character has. That's the place where you could fine tune it to your liking by using smaller xp comparison steps and adjusting the added xp accordingly.

In case you're wondering why it takes such a huge amount of code if it could have been solved by simply doing something like that:
NewXP=GetXP(Player1)
SetXP(PlayerX, NewXP)

That's due to the limitations of the game engine.

10th
Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#9 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 04 December 2011 - 01:27 AM

Slight detour:
That's by the way exactly the point where it breaks apart in heavily modded games, with mods which remove the xp-cap and extend the level cap to level 50, dole out many high xp rewards to the party to reach such a high level, and with a theoretical absolute xp-cap of 45,000,000 xp (a fighter/mage/thief or fighter/mage/cleric). To clarify, it's breaking apart because it doesn't add any more xp after that 8,000,000 mark in such games.
Level 50 rules without an xp-cap greatly benefit multi-classed characters (several classes are raised simultaneously) and to a lesser extent dual-classed characters (abandon one class to advance in another). That's due to the fact that even the slowest advancing class (Druid) reaches its cap at 17,500,000 xp.

So uh, are you suggesting an improvement? (Or better yet, do you have such an improved version?)

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#10 i30817

i30817
  • Member
  • 611 posts

Posted 04 December 2011 - 07:39 AM

In case you're wondering why it takes such a huge amount of code if it could have been solved by simply doing something like that:
NewXP=GetXP(Player1)
SetXP(PlayerX, NewXP)

That's due to the limitations of the game engine.


Oh god, i hope that Ascension64 is able to introduce variable substitution.

#11 10th

10th
  • Member
  • 621 posts

Posted 04 December 2011 - 09:02 AM

So uh, are you suggesting an improvement? (Or better yet, do you have such an improved version?)


See attachment. The enclosed fjxpmooc.baf is the final version with all changes applied, the other two are the extensions to the addition and substraction of AddXpObject() that I did. They are only there to see what those changes are. I went with the final 1 million xp, as I consider anything more than that too great a difference in xp. fjxpmooc.baf is ~600 lines longer, it could be reduced to half that if one went with a 2 million xp object and a two million xp difference between CHARNAME and joinable NPC.

TDD and BP, probably RoT too, don't know about Vecna, have level 50 rules with a 20 million xpcap.
Only by using BG2 Tweaks's
~BG2_TWEAKS/SETUP-BG2_TWEAKS.TP2~ #0 #2090 // Change Experience Point Cap -> Remove Experience Cap

or by setting all caps to -1 manually and a level 50 ruleset are 45 million xp theoretically possible. It's obviously impossible during regular play if defjam or another xp-reducing mod is used.

EDIT: changed bafs in order to remove a few typos.

10th

Attached Files


Edited by 10th, 24 December 2011 - 07:31 AM.

Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board

#12 Mhek

Mhek
  • Member
  • 1 posts

Posted 04 December 2011 - 01:50 PM

Thanks a lot for explaining the scripts in such detail. You did this very well, as even I as a non-programmer did understand how it works! So tuning this script to make it more fine-meshed makes it longer and longer (beside being boring to code i guess; So I am glad you shared your tuning work with us).  

It's a pity that there is no easier solution (such as that suggested by berelinde) because of engine limitations. I wonder if other workarounds would be possible as well. Does the game-engine keeps track of all XP-gains during a game? I think it does for monsters killed and quests solved (am I right?). Other sources would be opening locks, disarming traps and reading scrolls (where I think it doesn't keep track).

Assuming the game keeps track of all of those, would something like this be possible?:

If a NPC joins the party, then:
set XP of all party members to 0 (for BG1; or to whatever it is at the start of BG2)
give the party all of the XP rewarded for killing monsters
give the party all of the XP rewarded for solving quests
give the party all of the XP rewarded for opening locks
give the party all of the XP rewarded for disarming traps
give the party all of the XP rewarded for reading scrolls


I think it's very unlikely, that this would be possible. There would be also problems whenever the number of party members changes. Finally such a script would probably take a very long time to add XP from so many different sources in later game stages.
It was just an idea, maybe someone has a realistic one ;-)

#13 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 28 December 2011 - 07:31 PM

EDIT: changed bafs in order to remove a few typos.

Will look at it, cheers.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle