Author Topic: Easy to script class restrictions?  (Read 2112 times)

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #45 on: October 02, 2011, 04:43:58 pm »


               

SuperFly_2000 wrote...
Also I know Bioware has some XP penalties for multiclassing...can theese be made larger? ..or how big are they to start with?


From the game manual......

EXPERIENCE FOR MULTIclass CHARACTERS

If your multiclass character’s classes are nearly the same level (all
within 1 level of each other), then he can balance the needs of his
classes. Your multiclass character suffers a -20% XP penalty for
each class that is not within 1 level of his most experienced class.
These penalties apply from the moment the character adds a class
or raises a class’s level too high. For instance, a 4th-level wizard/
3rd-level rogue gets no penalty, but if that character raises his
wizard level to 5th, then he’d receive the -20% penalty from that
point on until his levels were nearly even again.

I know of no way to effect the built in XP system to change the amount of the XP penalties.  Most of the systems that I have seen that mess with XP, simply set the module XP to 0%, then add scripts to give XP out in a way they want it done.

SuperFly_2000 wrote...

Another way that I just came to think of...would be to remove PC's that take prestige classes from the minimum level for lesser class needed (but not from the max 2 classes limit)....if possible to script again. That would solve everything I think.

(I was thinking to NOT have RDD, WM, SD, AA and shifter.)


Not allowing the PC to take the Prestiage class is simple.   It also does not need any 2da edits.  The default Bioware 2da's are already set up for this.   You would just need to add the following to your OnClientEnter script.
You will also need to set a Local on the PC so you can figure out what class they leveled up in OnLevelUp.

SetLocalInt(oPC,"X1_AllowDrDis",1);
   SetLocalInt(oPC,"X2_AllowWM",1);
   SetLocalInt(oPC,"X1_AllowShadow",1);
   SetLocalInt(oPC,"X1_AllowArcher",1);
   SetLocalInt(oPC,"X2_AllowShiftr",1);
 
SetLocalInt(oPC,"class1",GetLevelByPosition(1, oPC));


Your on level script wold need to be more like this.  

void main()
{
    object oPC = GetPCLevellingUp();
    int nclass1 = GetLevelByPosition(1, oPC);
    int nclass2 = GetLevelByPosition(2, oPC);
    int nclass3 = GetLevelByPosition(3, oPC);
    string sclassName;
    int nCurrentXP;
    int bDelevel;

   // Check to see if they have taken a third class
   if (nclass3)
   {
        FloatingTextStringOnCreature("You are only allowed to have two classes!", oPC, FALSE);
        bDelevel = TRUE;//using the previously posted function
   }
   //else check to see if they have a class in the second level
   // If they do not no no other checks are needed.
   else if(nclass2)
   {
     // The code here is ran if they have two classes.
     // Due to the fact that prestige classes can break the level spread rules,
     // We need to know what class they leveled in. So the need for the Locals.
     if (GetLocalInt(oPC,"class1")!= nclass1)
     {
        // They leveled in class 1.
        if (nclass1/nclass2 > 3)
        {
           sclassName =  GetStringByStrRef(StringToInt(Get2DAString("classes","Name",GetclassByPosition(2,oPC))));
           FloatingTextStringOnCreature("classes have to be within one third of each other"
                     +" You have to take another Level in "+sclassName+" first.", oPC, FALSE);
           bDelevel = TRUE;
        }
     }
     else
     {
       // they leveled in class 2.
       // if it is a base class it will have to follow the rule.
       // and be taken within the first 4 levels. No restriction on when the
       // first level for a pres class can be taken.
       if (nclass2 == 1 && nclass1 >3 && GetclassByPosition(2,oPC) < 11)
       {
          FloatingTextStringOnCreature("You can no longer take a second base class", oPC, FALSE);
          bDelevel = TRUE;
       }
       else if (nclass2/nclass1 > 3)
       {
         sclassName =  GetStringByStrRef(StringToInt(Get2DAString("classes","Name",GetclassByPosition(1,oPC))));
         FloatingTextStringOnCreature("classes have to be within one third of each other"
                  +" You have to take another Level in "+sclassName+" first.", oPC, FALSE);
         bDelevel = TRUE;
       }
     }
   }

   // Delevel the PC if needed if not store the new first class local.
   if ( bDelevel)
   {
     nCurrentXP = GetXP(oPC);
     int nHD = GetHitDice(oPC);
     SetXP(oPC,nHD * (nHD - 1) * 500 - 1);
     // Give the XP back so they can relevel.
     DelayCommand(0.5, SetXP(oPC,nCurrentXP));
   }
   else SetLocalInt(oPC,"class1",nclass1);


Funkys posted script is just way to simplistic.   For one it would force the PC to take 3 classes without the checks that Faild Bard pointed out. It also does not handle the Pres classes the way you wanted them. 
               
               

               


                     Modifié par Lightfoot8, 04 octobre 2011 - 01:42 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #46 on: October 02, 2011, 05:19:22 pm »


               

FunkySwerve wrote...

Lightfoot8 wrote...

@Funky   the script you posted does not really compair to what is being talked about.  

You're right, it doens't 'compair' to what's being talked about, it IS what's being talked about.

Your posted code delevels due to them taking a Skill that they are not allowed to take.  That is an entirely diffearant matter then taking the wrong class. 

No, it isn't a entirely different matter. It's a nearly identical matter, which is precisely why deleveling works to address it.

Shad was the one disparaging one method without considering another, not me. If you're going to criticize someone's post, it would behoove you to READ it first.

Funky


You either missed entirely what I was criticizing Or you did not read your own post.   Let me recap.  

FunkySwerve wrote...

...Sorry, but that's nonsense. We use delevels. It's not a question of lacking knowledge or skill, but of weighing different alternatives. Below, by way of example, is some code from the beginning of our levelup. It was written by acaos, and uses a Delevel function he also wrote. So, would you like to remove that foot from your mouth now, or are you seriously going to suggest that the guy who's written the lion's share of linux nwnx plugins lacks knowledge and building skill?...

Funky

 
It sounds to me that you are posting the code to prove that shadow is wrong.   No I am not saying that shadow is right, Mainly just because I dissagree with his use of words like "Lame" ect.   If he would replace them with frases like "Is not allways the best method". I do not think any of us would dissagree with his posts.  

But since your posted code by acaos could not even be done by the method he was talking about, It proved nothing about how he would have handled the case of  restriction based on class.  There is also no time line as to when he wrote the code.   If it was written before the first patch,  and it matched exactly the case at hand, It still proves nothing because the method being discused was not avaliable at the time.   Third Even if the case matched, We have no Idea what constraints acros was writting under, was it for a mod without haks? , Did he know about the other options at the time he wrote it?  Did other factors like having to delevel due to lore restrictions,  sway him to just do everything with delevling?  Is it just a safty check incase one of the class restriction vars slipped by not being set correctly? 

In short,  posting code someone else wrote is hearsay and proves  nothing.
               
               

               


                     Modifié par Lightfoot8, 02 octobre 2011 - 04:19 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #47 on: October 02, 2011, 05:49:23 pm »


               

Lightfoot8 wrote...

SuperFly_2000 wrote...
Also I know Bioware has some XP penalties for multiclassing...can theese be made larger? ..or how big are they to start with?


From the game manual......

EXPERIENCE FOR MULTIclass CHARACTERS

If your multiclass character’s classes are nearly the same level (all
within 1 level of each other), then he can balance the needs of his
classes. Your multiclass character suffers a -20% XP penalty for
each class that is not within 1 level of his most experienced class.
These penalties apply from the moment the character adds a class
or raises a class’s level too high. For instance, a 4th-level wizard/
3rd-level rogue gets no penalty, but if that character raises his
wizard level to 5th, then he’d receive the -20% penalty from that
point on until his levels were nearly even again.

I know of no way to effect the built in XP system to change the amount of the XP penalties.  Most of the systems that I have seen that mess with XP, simply set the module XP to 0%, then add scripts to give XP out in a way they want it done.
 


But scripting these in is no problem either.  The system uses 10 * 2da values (row character level, column creature CR) * XP slider * penalties.  Party size is easy to get by script (add up all associates), and multiclass issues are also easy enough to calculate.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #48 on: October 02, 2011, 06:56:25 pm »


               

WhiZard wrote...
But scripting these in is no problem either.  The system uses 10 * 2da values (row character level, column creature CR) * XP slider * penalties.  Party size is easy to get by script (add up all associates), and multiclass issues are also easy enough to calculate.


Nice.  I never knew the formula.    The only thing I see missing is how party size factors into it.   I am pretty sure it is not an even spread.  i.e   (10* 2da *Slider * -Penatilty) /nPartySize 

Do you know how the party size effects the XP?  

.  
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #49 on: October 02, 2011, 10:32:51 pm »


               

Lightfoot8 wrote...

WhiZard wrote...
But scripting these in is no problem either.  The system uses 10 * 2da values (row character level, column creature CR) * XP slider * penalties.  Party size is easy to get by script (add up all associates), and multiclass issues are also easy enough to calculate.


Nice.  I never knew the formula.    The only thing I see missing is how party size factors into it.   I am pretty sure it is not an even spread.  i.e   (10* 2da *Slider * -Penatilty) /nPartySize 

Do you know how the party size effects the XP?  

.  


It's on the wiki under experience point.  The reported is 4/(3+ party size), though someone did post on the talk page that this never goes below 50% (party of 5 or higher).  The party size does include the party leader.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #50 on: October 02, 2011, 10:49:26 pm »


               So
Party size 1 = 100%
Party size 2 = 80%
Party size 3 = 66%
Party size 4 = 57%
Party size 5+ = 50%

making our full xp formula   10* 2da *Slider * -Penatilty * 4/(3+PartySize)

Cool, Thanks for the information.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #51 on: October 03, 2011, 04:09:48 am »


               

Lightfoot8 wrote...

You either missed entirely what I was criticizing Or you did not read your own post.   Let me recap.  

No, I read exactly what you were criticizing. You completely mischaracterized my remarks in this thread, claiming I was advocating only one way of doing this, instead of a weighing of alternatives. In so doing, you demonstrated that YOU had not read what I had written, as I already pointed out in my last post. I see you make no mention of that at all in this post. Instead of admitting your mistake, you've apparently decided to double down on it.

It sounds to me that you are posting the code to prove that shadow is wrong.   No I am not saying that shadow is right, Mainly just because I dissagree with his use of words like "Lame" ect.   If he would replace them with frases like "Is not allways the best method". I do not think any of us would dissagree with his posts.  

Very perceptive of you. More specifically, I was pointing out that delevling, despite lacking a certain polish, was certainly NOT a indication of laziness of lack or skill, as Shad claimed.  And the code I posted demonstrated that quite clearly. There were many other ways Acaos could have done that - he's written many plugins for less. The simple fact is he didn't because it was expedient, and because inconvenience to the player is minimal. I know this because we discussed it. The view that such methods are indicative of a lack of skill is patently absurd, and I don't think anyone of reasonable mind would agree with it, no matter how it was phrased.

But since your posted code by acaos could not even be done by the method he was talking about, It proved nothing about how he would have handled the case of  restriction based on class.

Actually, it proved exactly what I offered it to prove - that a builder of skill still uses delevels - it simply isn't a question of lack of skill.

  There is also no time line as to when he wrote the code.   If it was written before the first patch,  and it matched exactly the case at hand, It still proves nothing because the method being discused was not avaliable at the time.   Third Even if the case matched, We have no Idea what constraints acros was writting under, was it for a mod without haks? , Did he know about the other options at the time he wrote it?  Did other factors like having to delevel due to lore restrictions,  sway him to just do everything with delevling?  Is it just a safty check incase one of the class restriction vars slipped by not being set correctly? 

In short,  posting code someone else wrote is hearsay and proves  nothing.

Nothing here is hearsay - you don't understand the term. I wasn't posting in a court of law, you see, just making a simple point, which you're attempting to pretzel now, presumably out of ire for my having pointed out your flawed critique of my post. Given that code doesn't come signed, dated, and notarized, you'll just have to take my word for the rest, though I'd think simple logic would allow you to arrive at the same conclusion, given that you agreed with me about weighing alternatives until this latest trainwreck of a post. '<img'>

Since you seem to have trouble apprehending this very simple point, I'll spell it out in small words. You're correct that my example does not show that a skilled builder is willing to use delevels for the purpose of class restrictions. That isn't relevant to this discussion, however, since I was not offering it to show that - I was, rather, offering it to show that a skilled builder is willing to use delevels in general. I could have just as easily pointed to myself as acoas, though it seemed immodest to do so. I have the top 2 ranked scripts in the vault, and the top-ranked pw. I'm pretty sure I qualify as a 'skilled builder', and I'm willing to use them. So please cut the nonsensical wordsurgery.

Either way, I've no more time to waste on your nonsense. Please refrain from cluttering this thread further unless you intend to actually help the OP - crazy concept, I know.

Funky
               
               

               


                     Modifié par FunkySwerve, 03 octobre 2011 - 03:48 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #52 on: October 03, 2011, 04:13:18 am »


               

Lightfoot8 wrote...


Funkys posted script is just way to simplistic.   For one it would force the PC to take 3 classes without the checks that Faild Bard pointed out. It also does not handle the Pres classes the way you wanted them. 


This is ironic, coming from the guy who earlier himself said it depended on what the OP wants - which is precisely what I said. I was explicity offering the very simplest possibility, as you'll see if you trouble yourself to read my post. Yes, it would need more checks - and I specifically pointed out one fairly seroius problem with it, but until I know specifically what he wants, there's no point in adding them. It's likely some kind of persistence is called for, in order to store the last level configuration, for example, but that might also be overkill for what he's trying to do.

Funky
               
               

               


                     Modifié par FunkySwerve, 03 octobre 2011 - 03:15 .
                     
                  


            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #53 on: October 03, 2011, 12:15:49 pm »


               Woo, popular topic...

Thanks all who came up with ready to go solutions to theese fairly easy restrictions.

Again - my last version is: thoose taking prestige classes have only the two maximum classes restriction. All other have that restriction and ALSO a lesser class minumum level restriction of at least 1/3 of the total levels in that class.) 

I will dig deeper into the how-to's when I get that far. At least now I know its doable.


KMdS wrote...
Quick question as to why the need to limit or restrict the various levels/classes a player has. Is the actual need due to some undesired benefit players exploit.

This is not the thread for it rreally but I will comment a bit.

I can't really call it an exploit as the game is supposed to have some builds stronger than other but I think too much energy is being used on making the most uber build. I know that this is a drug for most NWN players but I want to restrict this...and actually make it EASIER to play the game. Now you don't have to concentrate what uber strange combination to use or in worst case use any of the ready made ones.

I don't want 1/3 of the players on the server to be bard/RDD, another third weaponmaster and then the shadowdancer. Kind of sick of it actually and also think that theese classes quickly get overpowered....which is why everyone is using them.

For once I'd like to see a pure bard for example.

I have seen some attempts at balancing by giving the less good options more power but in the end it all results all ending up in more in power in total...while what I am trying to do is to have a fairly low magic and low XP world. Still not going too far away from standard/vanilla NWN.

I have seen a similar system in use on a server (Genesis Nordock, a long time ago) and it worked pretty well....until it was removed. Tis funny cause the server was going more into roleplaying when that decision was made. Guess they couldn't roleplay without their uber builds...

On that server it worked so that whenever you walked out the starting area it checked so that you had the correct levels...and also you couldn't choose too much levels in only one class (don't remember about the prestige classes as I always play pure classes hehe....).

I don't know exactly why I want to do this. I think the main reasons are to decrease the "power diversity between different build choices" (making the choices less important - cause this is not what the game is about) and to decrease and better balance power altogether.
               
               

               


                     Modifié par SuperFly_2000, 03 octobre 2011 - 11:22 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #54 on: October 03, 2011, 05:17:58 pm »


                 You can get quite diverse in what you check for within the scripted system, and some restrictions you can only handle through scripting.

  As an example, I allow wizards and sorcerers to become shifters, which by PnP rules they can, but the default system can't check if they know the polymorph self spell before allowing the level up.  So, if they have only one level in shifter, and < 5 levels in druid, then it does the GetHasSpell check and delevels them if it fails.

  Most any sort of "scripted" condition can be set on it.  As long as they make sense within the setting being played in, most players will either accept them, or at least put up with them.  It's still best if you can create a few more options at the same time to balance out the restrictions though.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #55 on: October 03, 2011, 05:58:21 pm »


               Ehm SuperFly_2000 if I may tell my opinion, then you are going in wrong direction. Basically powergamers will just find out new best builds and starts to make them, the only one hurt will be regular player which will make 6wizard char and then realize "now it could be a good thing to become fighter as it would fit my RP" and thanks to your balance change he wont be able to do that.

There is no way to ged rid of powergames as someone can play "to be the most powerfull bad guy", "to be the richest" etc. So even if you make your game easy and you get rid of majority powergamers for which it wont be challenging, some could if the module you make will have a success play to achieve other goals.

Also, you havent even started modding and first what you are solving are builds limitations and balance changes. You dont know yet how challenging it will be, how many and what players gonna play it etc and this all matters...

Im not even sure I understand your new conditionals, but if you are going to disable triple class for prestige-multiclassed charactes I would predict that monk clerics will show up. Also some classes like wizards/sorcerrers/clerics wont even notice such restriction while others will have even harder times.
               
               

               
            

Legacy_KMdS

  • Newbie
  • *
  • Posts: 49
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #56 on: October 03, 2011, 11:44:53 pm »


               What ShaDoOoW said notwithstanding,  There ARE ways of doing what you want.  What you need to do is put in some time deciding how YOU want to handle things.  Think of specific goals across the board and then think of how each class would be affected.  From that point, specifics can be worked out.  Don't forget to plan a theme for the server that will keep your players interested, at least the type you want on your server.  Though there are players that strictly want to uberbuild a pc, there are those that are more interested in the theme.  This thread is yours, you asked for help, do what you want.  There are those that will think that you are only wasting your time, what the heck, it's your time, do with it what you want.  I can and have created many systems and can help with anything you would like to do...KMdS
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #57 on: October 04, 2011, 02:44:12 am »


               Corrected a bug in the last script I posted.  

I had:
SetXP(oPC,nHD * (nHD - 1) / 500 - 1);
It should have been:
SetXP(oPC,nHD * (nHD - 1) * 500 - 1);
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #58 on: October 04, 2011, 11:32:37 pm »


               

SuperFly_2000 wrote...

Woo, popular topic...

Thanks all who came up with ready to go solutions to theese fairly easy restrictions.

Again - my last version is: thoose taking prestige classes have only the two maximum classes restriction. All other have that restriction and ALSO a lesser class minumum level restriction of at least 1/3 of the total levels in that class.) 


Are you planning to code it yourself, then, or do you need further assistance?

As an aside, I agree with what Shad said about whether, not how, to do this - broad restrictions like this tend to curtail more than the behavior you're seeking to prevent. It's sort of akin to using a sledgehammer instead of a chisel. We've done a ton of class edits on HG, but in a more targeted way. Dislike the pally splash for cha saves boost? Move the feat granting it from 1st level pally to 3rd, or 5th, or whatever you deem appropriate. You can do that with nwnx funcs without a boot, or any player interaction - just remove it if they're less than xth level pally, and readd on the appropriate levelup if they are >= xth level pally. Ditto the SD ability, monk attributes, pally disease immunity, and so on. In short, instead of blocking such combinations, balance them. Of course, that entails a little more work, and doesn't really bear on your question.

Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #59 on: October 05, 2011, 12:52:16 am »


               

FunkySwerve wrote...

SuperFly_2000 wrote...

Woo, popular topic...

Thanks all who came up with ready to go solutions to theese fairly easy restrictions.

Again - my last version is: thoose taking prestige classes have only the two maximum classes restriction. All other have that restriction and ALSO a lesser class minumum level restriction of at least 1/3 of the total levels in that class.) 


Are you planning to code it yourself, then, or do you need further assistance?

Funky


??
The script was already posted.  Unless of cource you see a problem with my solution?   I have ran limited tests on it.  The only bug I seen was the XP correction i posted above.
               
               

               


                     Modifié par Lightfoot8, 04 octobre 2011 - 11:53 .