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

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Easy to script class restrictions?
« on: September 29, 2011, 12:03:50 pm »


               Just playing with the idea for now.

Lets say I don't want players to have more than two different classes...and then also the lowest level in any class shouldn't be less than 1/3 of the total level.

That means for example that a level 9 player can't be 1 fighter/8 rougue but has to have at least 3 levels in rogue before taking level 6 as a fighter.

Possible/easy to script?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #1 on: September 29, 2011, 12:16:35 pm »


               Very easy to script, but with the examples you posted, you'd essentially be banning prestige classes aside from pale master.
 You just put your checks into the OnPlayerLevelUp event, and delevel them then return their XP if they don't pass the checks you want to have in.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #2 on: September 29, 2011, 12:28:10 pm »


               If you want to apply this for base classes as well you will need my unofficial patch.

from documentation

Builder may also disable any standard base class via scripting. That may be usefull, if you want for example limit some class combinations or force max dual-class, etc. To do it, you must set a variable on player character via script (probably in OnEnter and OnLevelUp). All variables are of integer type, value 1 disables the class, value 0 will enables it again.

   * Variables names: 70_AllowBarbarian - will disable barbarian class
   * 70_AllowBard - will disable bard class
   * 70_AllowCleric - will disable cleric class
   * 70_AllowDruid - will disable druid class
   * 70_AllowFighter - will disable fighter class
   * 70_AllowMonk - will disable monk class
   * 70_AllowPaladin - will disable paladin class
   * 70_AllowRanger - will disable ranger class
   * 70_AllowRogue - will disable rogue class
   * 70_AllowSorcerer - will disable sorcerer class
   * 70_AllowWizard - will disable wizard class


               
               

               
            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #3 on: September 29, 2011, 12:40:25 pm »


               

Failed.Bard wrote...
 .....with the examples you posted, you'd essentially be banning prestige classes aside from pale master.

Naah...I don't think so. Most, if not all, prestige classes can be choosen with just one other class...a bard can become an RDD, a rogue can become a SD or Assasin and so on...

However...I do agree it becomes complicated. As a player ventures into a prestige class he would like to just level that class...but then he still has to keep count of his "old" class...which makes it complicated...but not impossible still...

However#2. My intention is actually to remove most of the prestige classes anyway. At least RDD, SD, WM, AA and probably some more.

Still I can see the problems with the remaining prestige classes...hmm...

A way is ofcourse to make it so that prestige classes don't count towards the 1/3 limit....as the player ANYWAY need to get quite many levels in another class BEFORE he goes into the prestigeclass....so there it is covered that he at least has some levels in the lesser class.

Still the maximum 2 class restriction will apply though.

...scripting this?

(I've seen it before on a PW actually...somewhat similar...maybe without the prestige class being allowed more levels....)
               
               

               


                     Modifié par SuperFly_2000, 29 septembre 2011 - 11:41 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #4 on: September 29, 2011, 01:54:13 pm »


               I'd meant moreso due to the number of levels required before you could take it. CoT, for example, requires a BAB of +7 to be able to take. That means you can't take it until 8th level at minimumn, and SD is the same way since you need 7 levels to meet the skill requirements. Even something like RDD, that only needs 5 levels to ge tthe lore requirement, you couldn't take. Sorc or bard 5/RDD 1 wouldn't pass your 1/3 check.
Since PM can be taken starting at level 4, it would be the only one that you could take early enough.

Personally, I think a hard-coded level spread is enough to cover it. If all classes have to stay within, say, 10 levels of each other, you cut out most of the cheese builds just with that. Maximum level gaps that way are then 25/15, or 20/10/10.

Since my mod is a level 20 cap, I coded in a 7 level maximum gap. Maximum level differences with that are 13/7, or 10/7/3.
               
               

               


                     Modifié par Failed.Bard, 29 septembre 2011 - 12:55 .
                     
                  


            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #5 on: September 29, 2011, 02:23:37 pm »


               Ahaa...thats interesting...the maximum difference thingie. Somewhat less intuitive though.

About my thought of system I didn't say I was going to check all the time. One way is too check like at level 18 or something. Maybe even have 1/4...and check it at level 20. Thats a bit harsh though...if you didn't "know about the rule"...so its not watertight.

Another solution is I just use a 2 classes max rule....then let players go crazy with the composition (just not the most popular prestige classes still of course)...but then we'd have level 19 wiz/1 fighter and what not again...hmm...

This is hard...
               
               

               


                     Modifié par SuperFly_2000, 29 septembre 2011 - 01:24 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #6 on: September 29, 2011, 02:32:19 pm »


               This is very easy, and doesn't require any patch. Just use GetLevelByPosition, which will tell you the level of the character's 1st, 2nd, or 3rd class:
// A creature can have up to three classes.  This function determines the
// creature's class level based on nclass Position.
// - nclassPosition: 1, 2 or 3
// - oCreature
// * Returns 0 if oCreature does not have a class in nclassPosition
//   (i.e. a single-class creature will only have a value in nclassLocation=1)
//   or if oCreature is not a valid creature.
int GetLevelByPosition(int nclassPosition, object oCreature=OBJECT_SELF)


Check to see if your conditions are violated on levelup, and if they are, delevel the pc:

void DelevelPC (object oPC) {
    int nLevel = GetHitDice(oPC);
    int nNewXP = ((nLevel * (nLevel - 1)) / 2 * 1000) - 1;

    SetXP(oPC, nNewXP);
}



Funky
               
               

               


                     Modifié par FunkySwerve, 29 septembre 2011 - 01:32 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #7 on: September 29, 2011, 03:05:08 pm »


               ugh, delevel

of course, you can script anything via this lame technique '<img'>

Ok so change it to "you would want my patch" as it allows you to do this cleaner.
               
               

               


                     Modifié par ShaDoOoW, 29 septembre 2011 - 02:08 .
                     
                  


            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #8 on: September 29, 2011, 03:27:31 pm »


               Thanks Funky....thats good enough for me...

...I was thinking of something similar...

...players will have to keep track of how many levels they got in the lesser class yes...

...if I choose this road...

...and now I know its fairly easily achiavable...
               
               

               


                     Modifié par SuperFly_2000, 29 septembre 2011 - 02:28 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #9 on: September 29, 2011, 04:06:10 pm »


               

ShaDoOoW wrote...

ugh, delevel

of course, you can script anything via this lame technique '<img'>

Ok so change it to "you would want my patch" as it allows you to do this cleaner.

What's lame about it? It's completely effective, and saves the need for 2das. You can even relevel them back to the old xp, if you like.

Funky
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #10 on: September 29, 2011, 05:17:05 pm »


               

FunkySwerve wrote...

ShaDoOoW wrote...

ugh, delevel

of course, you can script anything via this lame technique '<img'>

Ok so change it to "you would want my patch" as it allows you to do this cleaner.

What's lame about it? It's completely effective, and saves the need for 2das. You can even relevel them back to the old xp, if you like.

Funky

Delevels are lame in my opinion. Player can do *that* wrong, and till then you tell him he mustn't do it he doesnt know he shouldn't. Its the same as you would leave willingly many bugs in your module like duping via persistent chest and tell players they mustn't do it otherwise you ban them. Or the same like "disable" the RDD class for example by that you will delevel anyone who take it.
               
               

               


                     Modifié par ShaDoOoW, 29 septembre 2011 - 04:19 .
                     
                  


            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #11 on: September 29, 2011, 07:36:16 pm »


               But if there is a script that automatically, irrevocably and directly delevels are PC that took the wrong class when leveling then there is no point in policing anything. Thats the whole idea of scripting theese kind of things.

Besides...choosing to lock certain classes can be done by setting some Bioware made variables on the module...so in thoose cases you even don't need to delevel....
               
               

               
            

Legacy_SuperFly_2000

  • Hero Member
  • *****
  • Posts: 1292
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #12 on: September 29, 2011, 07:41:08 pm »


               ...or do you have any other, simpler, suggestion Shado0ow....cause I didn't intend to use your "patch" unfortunately....

I agree deleveling the PC is not nice...but he had obviously missed a major thing pertaining to character creation/leveling...so its not that much of a biggie really...he just has to choose another class to level....that simple...and in this case learn the rules "the hard way"....
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #13 on: September 29, 2011, 08:09:44 pm »


               You dont have to, though I see no reason why someone wouldnt want to use it. Just download the "builders resources" from my patch where are 2das - classes and cls_pres_*.2da or make them yourself.

Its not easier, to make things clean and neat takes knowledge and building skill. So when I see a delevel somewhere I can see that the person who did it have lacked those. Dont be mad on me I consider these techniques *lame* since I know how to do it better and offer my advice with it.
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #14 on: September 29, 2011, 08:54:06 pm »


               

ShaDoOoW wrote...

You dont have to, though I see no reason why someone wouldnt want to use it. Just download the "builders resources" from my patch where are 2das - classes and cls_pres_*.2da or make them yourself.

Its not easier, to make things clean and neat takes knowledge and building skill. So when I see a delevel somewhere I can see that the person who did it have lacked those. Dont be mad on me I consider these techniques *lame* since I know how to do it better and offer my advice with it.


When I see a character deleveled, I see it as the PLAYER either being too lazy to read and follow the rules or they simply didn't care to comply. Generally such restrictions are in a Journal, Forum, IG Rules Boards or Players Guides. So when for whatever reason players don't follow such rules ... who cares if they are delevelled? I use such a script myself. As Funky pointed out, you can delevel them and restore their XP so they can just relevel properly and follow the rules like they should have.

Doing it your way is fine too. I actually prefer the delevelling when a PC takes a class or feat not allowed to them. Its a gentle "pimp slap" and only an inconvenience for their not following the rules.