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

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #15 on: September 29, 2011, 09:07:38 pm »


               

ShaDoOoW wrote...
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.

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?

On a more personal note, pimping your patch for something simple like this is a little self-serving.


void main() {
    object oPC = GetPCLevellingUp();
    int nLevel = GetHitDice(oPC);
    int nclass = GetclassByLevel(oPC, nLevel);
    int nclassLevel = GetLevelByclass(nclass, oPC);
    int nFXLevel = VFX_FNF_WAIL_O_BANSHEES;

    /* Simtools setup */
    CheckLanguages(oPC);


    if (ModifySkillRank(oPC, SKILL_LORE, 0) > 4) {
        int nSub = GetLocalInt(oPC, "SubraceID");

        if (nSub == SUBRACE_NOBARIAN || nSub == SUBRACE_WEMIC) {
            FloatingTextStringOnCreature("You cannot take Lore skill before legendary levels with your subrace!", oPC, FALSE);

            DelevelPC(oPC);
            return;
        }
    }

Funky
               
               

               
            

Legacy_Shadooow

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


               You really want me to react to this Funky? I hope you are not serious.
               
               

               


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


            

Legacy_Rolo Kipp

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


               <looking over...>

ShaDoOoW wrote...
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.

I'm one of those people who lack "those" because I do not see how else to do some things.

Shadow, I've liked some of the things you've done, but I really can't see this one.

How would *you* handle a visitor of massive level who wants to visit your PW? Force him to create a new character? Allow him god-like levels because de-leveling is lame? How would *you* allow someone to keep a beloved character without unbalancing the world for everyone else?

I'm a pretty old and slow guy... I don't understand your cleaner and neater system. How would you handle this. Please show me so I understand.

<...his shoulder>
               
               

               
            

Legacy_Failed.Bard

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


               Some things can't be corrected without a delevel either, because Bioware botched the hardcoded parts of them.  Pale Masters are a perfect example, they're supposed to require the ability to cast level 3 arcane spells, which Bioware botched and set as needing level 3 in an arcane class.
 Since wizards, bards, and sorcerers don't all get level 3 spells at the same level, you can't adjust that to PnP standards with just a 2da tweak.
               
               

               
            

Legacy_Shadooow

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


               

Rolo Kipp wrote...

<looking over...>

ShaDoOoW wrote...
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.

I'm one of those people who lack "those" because I do not see how else to do some things.

Shadow, I've liked some of the things you've done, but I really can't see this one.

How would *you* handle a visitor of massive level who wants to visit your PW? Force him to create a new character? Allow him god-like levels because de-leveling is lame? How would *you* allow someone to keep a beloved character without unbalancing the world for everyone else?

I'm a pretty old and slow guy... I don't understand your cleaner and neater system. How would you handle this. Please show me so I understand.

<...his shoulder>

That would be exploit or lame server settings, why would you allowed localvault if you would want to players to start from level 1 character? You would only make your server vulnerable to various exploits and bugs.

But its not about this at all. Its the cheating discussion all over again and I myself use delevel solution for one thing too. Point is - is it ideal? Could it be done better? Definitely could. Its not about if its sufficient, it is. Just a bit lame. Im trying to see things more from player perspective and sorry kalbaern as I player I dont want to spend week reading rules I just want to play. Of course then I will make mistakes, but Im player and builder should be aware I will do them and try to prevent them to happen beforehand.

If we are talking about the OP issue, he got two choices:
- take easy script from Funky which do the job, but OP himself stated that delevel is indeed not best way to do it
- or reuse parts of my patch or duplicate those changes I made into 2das in order to be able to script a solution that doesnt even allow player to level up in another base class if the difference between his second base class is too high
               
               

               
            

Legacy_Shadooow

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


               

Failed.Bard wrote...

 Pale Masters are a perfect example, they're supposed to require the ability to cast level 3 arcane spells, which Bioware botched and set as needing level 3 in an arcane class.
 Since wizards, bards, and sorcerers don't all get level 3 spells at the same level, you can't adjust that to PnP standards with just a 2da tweak.

you can actually I have this done

you can count the known spell level from base ability, class level and if level match then you set local var to 0 (and you set it to 1 onenter before)
               
               

               


                     Modifié par ShaDoOoW, 29 septembre 2011 - 09:30 .
                     
                  


            

Legacy_Rolo Kipp

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


               <trying to see things...>

ShaDoOoW wrote...
That would be exploit or lame server settings, why would you allowed localvault if you would want to players to start from level 1 character? You would only make your server vulnerable to various exploits and bugs.

Hmmm, that's a valid question. But I honestly have very good reasons for *why*. I do not consider them either exploit or lame. In fact, I wrote an essay on that about, oh ten years ago :-) <sigh>

The question, from my point of view, is how can you allow visitors into an established world *without* de-leveling them and *without* destroying the balance for your native players? I am open to suggestions ;-)

Until them, a temporary de-level while they audition the PW (and the PW auditions *them*!) is my best solution.

But its not about this at all. Its the cheating discussion all over again and I myself use delevel solution for one thing too. Point is - is it ideal? Could it be done better? Definitely could. Its not about if its sufficient, it is. Just a bit lame.

Ah! My apologies, then. I will wait for a better post to ask my questions ;-)

 Im trying to see things more from player perspective and sorry kalbaern as I player I dont want to spend week reading rules I just want to play. Of course then I will make mistakes, but Im player and builder should be aware I will do them and try to prevent them to happen beforehand.

I do agree there. It is the designer's responsibility to anticipate players. OTOH, depending on the world, learning the rules should be very advantageous for the player =)

If we are talking about the OP issue, he got two choices:
- take easy script from Funky which do the job, but OP himself stated that delevel is indeed not best way to do it
- or reuse parts of my patch or duplicate those changes I made into 2das in order to be able to script a solution that doesnt even allow player to level up in another base class if the difference between his second base class is too high

Tiny observation, SuperFly said "I agree deleveling the PC is not nice..."
He did not say delevel "is indeed not best way to do it".

After all, I do a *lot* of not-nice things... *some* of them *are* the best way to do it :-) <a few>

OTOH, your approach has its merits... I like the idea of preventing a mistake from occurring.
But I don't like the cost of complexity a builder may wish to invest into something else :-/

<...and succeeding too well>
               
               

               


                     Modifié par Rolo Kipp, 29 septembre 2011 - 10:19 .
                     
                  


            

Legacy_Shadooow

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


               

Hmmm, that's a valid question. But I honestly have very good reasons for
*why*. I do not consider them either exploit or lame. In fact, I wrote
an essay on that about, oh ten years ago :-) <sigh>

The
question, from my point of view, is how can you allow visitors into an
established world *without* de-leveling them and *without* destroying
the balance for your native players? I am open to suggestions ;-)

Until them, a temporary de-level while they audition the PW (and the PW auditions *them*!) is my best solution.

Then I would use delevel. As I said im using it already for one thing (Fist of Hextor Brutal Attack/Strike feats if you want to know). But Im not proud for this, wish I know how to make it better but I was unable to think better option in nwscript, though im sure builders like acaos would be able to make nwnx solution (if they would want to). Im not afraid to call something even I use to be lame thats it.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #23 on: September 29, 2011, 11:46:45 pm »


               <gives a thumbs up...>

Thank you for the feedback, Shadow. I'm always looking for better ideas. Until I find them, I'll use what's handy... monkey wrenches *do* make decent hammers, honest :-)

<...to doing what ever needs to be done>
               
               

               


                     Modifié par Rolo Kipp, 29 septembre 2011 - 10:47 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #24 on: September 30, 2011, 02:15:42 am »


               

ShaDoOoW wrote...

You really want me to react to this Funky? I hope you are not serious.

Funny, that was the first thing I thought when I read your post. I do indeed want you to react to it. Attributing use of deleveling to lack of skill is...silly, is the kindest word I can use to describe it.

Funky
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #25 on: September 30, 2011, 03:58:41 am »


               

FunkySwerve wrote...

ShaDoOoW wrote...

You really want me to react to this Funky? I hope you are not serious.

Funny, that was the first thing I thought when I read your post. I do indeed want you to react to it. Attributing use of deleveling to lack of skill is...silly, is the kindest word I can use to describe it.

Funky


Deleveling isn't purely straight forward either.  RDDs if deleveled incorrectly can become illegal characters from the strength bonus not disappearing.

However 2das also have limitations.  If you require certain feats for taking a prestige class then a character with those feats on equipped items will be able to level up in the prestige class (even though they naturally do not qualify).  Even the race requirement for prestige class can be bypassed when leveling up polymorphed into that race.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #26 on: September 30, 2011, 06:14:18 am »


               @Funky   the script you posted does not really compair to what is 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.  Bioware already has things in place to prevent PC's from taking a  calss, If you do not mind using modified 2da's.   They  do not have anything that I know of to act the same way with preventing skills via scripting.  

The matter to me simply comes down to if using modified 2da is worth the benifit of a more streem line system  to the OP.  You have already answered that as No it is not worth it to you in past posts.  It may hoever be worth it to the OP.   


@SuperFly:   I see FB already pointed out the level problem with the 1/3   The solution I cam up with in the script below is that no classes are restricted untill they take a second class. ( Of cource you will need Shadows 2da's for thescript to work)   Once the second class is take the 1/3 rule is enforced.  So if a Character  was a 12th level fighter before he took a level of rouge.   FIghter/Thief 12/1  would be allowed.   He would just have to take his next 4 levels in thief  before he could level in fighter again.   Fighter/Thief 12/5.

Here is the script if you wanted to try it. .  I hope I understood correctly how shadow set up his 2da's.   So far it is untested.   Just let me know if you have problems with it.  

#include "x3_inc_string"
#include "x0_i0_stringlib"
string sclassVarArray =  "70_AllowBarbarian" // index 0   class ID# 0
                        +",70_AllowBard"     // index 1   class ID# 1
                        +",70_AllowCleric"   // index 2   class ID# 2
                        +",70_AllowDruid"    // index 3   class ID# 3
                        +",70_AllowFighter"  // index 4   class ID# 4
                        +",70_AllowMonk"     // index 5   class ID# 5
                        +",70_AllowPaladin"  // index 6   class ID# 6
                        +",70_AllowRanger"   // index 7   class ID# 7
                        +",70_AllowRogue"    // index 8   class ID# 8
                        +",70_AllowSorcerer" // index 9   class ID# 9
                        +",70_AllowWizard"   // index 10  class ID# 10
                        // All the prestige class are offset by 16.
                        +",X1_AllowShadow"   // index 11  class ID# 27
                        +",X1_AllowHarper"   // index 12  class ID# 28
                        +",X1_AllowArcher"   // index 13  class ID# 29
                        +",X1_AllowAsasin"   // index 14  class ID# 30
                        +",X1_AllowBlkGrd"   // index 15  class ID# 31
                        +",X2_AllowDivcha"   // index 16  class ID# 32
                        +",X2_AllowWM"       // index 17  class ID# 33
                        +",X2_AllowPalema"   // index 18  class ID# 34
                        +",X2_AllowShiftr"   // index 19  class ID# 35
                        +",X1_AllowDwDef"    // index 20  class ID# 36
                        +",X1_AllowDrDis";   // index 22  class ID# 37
void SetclassRestrictions(object oPC);
void RestrictAllclasses(object oPC);
void SetAllowedclasses(object oPC);
int  GetclassArrayIndice(int nclass);

void Setclassrestrictions(object oPC)
{
  if(GetclassByPosition(2,oPC) != class_TYPE_INVALID)
  {
    RestrictAllclasses(oPC);
    SetAllowedclasses(oPC);
  }
}

void RestrictAllclasses(object oPC)
{
  string sclasses = sclassVarArray;
  string sToken;
  while (sclasses !="")
  {
     sToken = StringParse(sclasses,",");
     SetLocalInt(oPC,sToken,TRUE);
     StringRemoveParsed(sclasses,sToken,",");
  }
}
void SetAllowedclasses(object oPC)
{
  int    nclass1 = GetclassByPosition(1,oPC);
         nclass1  = GetclassArrayIndice(nclass1);
  int    nLvl1   = GetLevelByPosition(1,oPC);
  string sclass1Var = GetTokenByPosition(sclassVarArray,",",nclass1);
  int nclass2  = GetclassByPosition(2,oPC);
      nclass2  = GetclassArrayIndice(nclass2);
  int nLvl2    = GetLevelByPosition(2,oPC);
  string sclass2Var = GetTokenByPosition(sclassVarArray,",",nclass2);
  SetLocalInt(oPC,sclass1Var,(nLvl1/nLvl2) > 2 );
  SetLocalInt(oPC,sclass2Var,(nLvl2/nLvl1) > 2 );
}
int  GetclassArrayIndice(int nclass)
{
    return nclass + 16 * (nclass > 10);
}


               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #27 on: September 30, 2011, 06:20:28 am »


               

Failed.Bard wrote...

Some things can't be corrected without a delevel either, because Bioware botched the hardcoded parts of them. Pale Masters are a perfect example, they're supposed to require the ability to cast level 3 arcane spells, which Bioware botched and set as needing level 3 in an arcane class.
Since wizards, bards, and sorcerers don't all get level 3 spells at the same level, you can't adjust that to PnP standards with just a 2da tweak.


You can prevent the PaleMaster class from being taken by setting the X2_AllowPalema local int on the PC to anything other then 0     So if you can script your checks you can stop them from taking the class.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #28 on: September 30, 2011, 06:55:18 am »


               

FunkySwerve wrote...

ShaDoOoW wrote...

You really want me to react to this Funky? I hope you are not serious.

Funny, that was the first thing I thought when I read your post. I do indeed want you to react to it. Attributing use of deleveling to lack of skill is...silly, is the kindest word I can use to describe it.

Funky

ok maybe its really bull**** and I wrote something I meant differently, is no doubt acaos has a neccesary skill and knowhow to make nwnx solution and I wont be guessing why he didnt. Anyway from player perspective, I have played many PWs and I already seen a lot things done. When it comes to delevels I can say I already seen servers which handled this the 2da way and tried to prevent player from doing the mistake in first place. Thats for me as a player is a better option then being learned "the hard way". When building Im trying to be as much user friendly as possible and I always trying to make things the way the player could say "wow this is nicely done!".

WhiZard wrote...

However 2das also have limitations.  If
you require certain feats for taking a prestige class then a character
with those feats on equipped items will be able to level up in the
prestige class (even though they naturally do not qualify).  Even the
race requirement for prestige class can be bypassed when leveling up
polymorphed into that race.

I thought it works only on skin (which is why it works in polymorph) - are you sure it works with a bonus feats on any other item?

Which is actually a good thing. You could create a "placeholder" feat that you can add on PC's skin just to be able to code something you wouldnt be without it like alignment.
Also when it comes to polymorph, its kind a must to not allow level up polymorphed character and again you either do it the delevel way or you can handle it via 2das -> though its not totally ideal too as its hard to code, but possible, just disable all classes after polymorph and enable them after finished rest or via heartbeat as soon as player unpolymorph again.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Easy to script class restrictions?
« Reply #29 on: September 30, 2011, 07:39:33 am »


               BTW just got and interesting idea that maybe some of the "hard way" camp will like.

One could remove all class prerequisities from 2das in order to allow player to take any class without them and script those prerequisities in OnLevelUp script and delevel anyone who doesnt fullfills them.

Best would be to add yur own custom prerequisities into every class like certain quest, gold ammount, guild membership etc. or really knowing the 3rd spell level for become PM etc. Of course these special prerequisities wont be written in class description via TLK, rather hidden somewhere in your forum which adress you have written in server description only.

The best would be to not tell player why is he deleveled or tell him always only one reason, so if he try to become Harper Scout first delevel will teach him he need:
- allertness, now redo levelling process
- "you need iron will feat", again
- "you need also improved parry, just our custom change", again
- "you need at least 4skill ranks in discipline", again
- "you need at least 6skill ranks in lore", again
- "yea 8 persuade dude!", again
- "forgot about search? 4ranks idiot", again
- "what the hell you think you can become harper without being in harper guild?", again

Wow that would be epic fun! I can imagine how im redoing whole levelling up process and distributing all saved skillpoints all over again. (Would be a good idea to delevel anyone who will try to save up skillpoints anyway)
':devil:'

In the OP idea, one could be actually deleveled when changing all his sorcerrer/bard spell selection too, very funny.
               
               

               


                     Modifié par ShaDoOoW, 30 septembre 2011 - 06:41 .