Author Topic: Broken script help?  (Read 1058 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Broken script help?
« Reply #15 on: December 07, 2010, 02:35:49 pm »


               okay this is REALLY getting on my nerves here....compiling goes wohoo! But when I try it out my toon can still take the freaking class.....which is not what the script is supposed to do....



anyone else has an idea here?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Broken script help?
« Reply #16 on: December 07, 2010, 03:10:47 pm »


               Does this system also have a script for the OnPlayerLevelUp event? It most likely should. Then when the player levels, It checks for the int and whether or not it is true or false allowing the player to take the class.
               
               

               


                     Modifié par GhostOfGod, 07 décembre 2010 - 03:11 .
                     
                  


            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Broken script help?
« Reply #17 on: December 07, 2010, 04:57:36 pm »


               well, no, well I cannot recall it had that script. Since we (used) tokens in order to unlock the prclasses.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Broken script help?
« Reply #18 on: December 07, 2010, 05:28:21 pm »


               All the script you've been editing does is to set a local variable with Allow in the name on the character when they log in, if they already have the class in question. This is presumably to grandfather in those that already have it, if they don't have other permission. You still need something in onlevelup to block them taking the levels unless the variable in question is set. Basically, you check to see if they have the token item or the specific Allow variable, and if not, and they have the disallowed class, delevel them with a message explaining why. I'll post an example script in a couple minutes.



Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Broken script help?
« Reply #19 on: December 07, 2010, 05:50:09 pm »


               That is the old system Funky.  The vars set on the Character are tied to hard code in the engine that should prevent the character from leveling.  I think the problem my be that thier server may be using modifyed 2da's that are either missing the value for the var name or they have edited the 2da to change the name of the var.  Perhaps in the way shadow has suggested in the past.

Checking the 2da's on for the server to make sure the var names are right would be the next step i would take. 

Here is the link to the last time i remember this topic being fought out. 

 http://nwn.bioware.c...724682&forum=47
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Broken script help?
« Reply #20 on: December 07, 2010, 06:03:13 pm »


               Bah, having connectivity issues. Here's the onlevelup code to block taking of prestige classes. It uses a different variable than your client enter script, so I'm providing a modified client enter script as well. It assumes the tokens that allow a prestige will have tags of the format:
Allowclass_X
Where x is the number of the class, taken from the const. The numbers are:
Shadowdancer 27
Harper 28
Arcane_Archer 29
Assassin 30
Blackguard 31
Champion of Torm 32
Weaponmaster 33
Pale Master 34
Shifter 35
Dwarven Defender 36
Dragon Disciple 37
Purple Dragon Knight 41
So a token allowing the player to take shadowdancer levels would have to have the tag Allowclass_27, for example.

Here's the onlevelup:

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

    SetXP(oPC, nNewXP);
}
void CheckRestrictedclass(object oPC, int nclass) {
    if (GetLevelByclass(nclass, oPC) > 0) {
        if (!GetLocalInt(oPC, "Allowclass_"+IntToString(nclass)) &&
            !GetIsObjectValid(GetItemPossessedBy(oPC, "Allowclass_"+IntToString(nclass)))) {
            DelevelPC(oPC);
            FloatingTextStringOnCreature("You cannot take prestige classes without the required token!", oPC, FALSE);
        }
    }
}

void main() {
    object oPC = GetPCLevellingUp();
    int nX;
    for (nX = 27; nX < 42; nX++)
        CheckRestrictedclass(oPC, nX);

}




And here is the onenter code, modified to use the new variable:




#include "_pw_journal_inc"

void GrandfatherPrestigeclasses(object oPC) {
    int nX;
    for (nX = 27; nX < 42; nX++) {
        if (GetLevelByclass(nX, oPC) > 0)
            SetLocalInt(oPC, "Allowclass_"+IntToString(nX), 1);
    }
}

void main()
{
    object oPC = GetEnteringObject();
    RestorePersistentJournal(oPC);
    GrandfatherPrestigeclasses(oPC);
    ExecuteScript ("cnr_module_oce", oPC);
}

In case you're wondering WHY I switched to using a new variable, it was so I could do those tidy little for loops instead of a big clunky list.

Funky
               
               

               


                     Modifié par FunkySwerve, 07 décembre 2010 - 08:41 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Broken script help?
« Reply #21 on: December 07, 2010, 06:13:23 pm »


               Sigh, finally got through again. Just a reminder to capitalize all instances of 'class' and 'classes'.



Funky
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Broken script help?
« Reply #22 on: December 07, 2010, 07:00:51 pm »


               

Lightfoot8 wrote...

That is the old system Funky.

Ah, only just saw this - internet is driving me crazy today. That's interesting, I wasn't aware of such a setup, though it's handy. Likely because we've never blocked a prestige on HG. '<img'>  Anyway, the code I gave him will work, though I'm glad of my instinct to change the vars.

Funky
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Broken script help?
« Reply #23 on: December 07, 2010, 08:31:10 pm »


               okay so if I put this in what you have send me Funky I will be able to lock those prestige classes again?
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Broken script help?
« Reply #24 on: December 07, 2010, 08:37:59 pm »


               hmm I wonder if the Subrace engine of Shayan could have changed the 2da files maybe? That is the only add-on "I" have added to the module
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Broken script help?
« Reply #25 on: December 07, 2010, 08:42:54 pm »


               

Who said that I wrote...

okay so if I put this in what you have send me Funky I will be able to lock those prestige classes again?

Yes, you will. Please note I just modified it to uncomment your journal function - I had to comment it out to compile the rest, since I don't have the include, and had forgotten to uncomment it afterwards.

Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Broken script help?
« Reply #26 on: December 07, 2010, 08:43:44 pm »


               Did it include hak's ?



If it does it sounds like your problem. Concidering you said that it was working fine then quite working, It would have to be either a 2da overriden or they are changing the values of the vars after you are setting them.
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Broken script help?
« Reply #27 on: December 07, 2010, 09:11:20 pm »


               no Shayans did not had haks, though they had spellhooks....Do not know if that also could have something to do with but I am just throwing it in the group to exclude all possibilities and such

               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Broken script help?
« Reply #28 on: December 07, 2010, 09:14:26 pm »


               

FunkySwerve wrote...

Who said that I wrote...

okay so if I put this in what you have send me Funky I will be able to lock those prestige classes again?

Yes, you will. Please note I just modified it to uncomment your journal function - I had to comment it out to compile the rest, since I don't have the include, and had forgotten to uncomment it afterwards.

Funky


Well thanks Funky, I will try it out as soon as my tired body can manage to move heh, will let you know if its an epic fail or an epic HOORAY ^^
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Broken script help?
« Reply #29 on: December 07, 2010, 09:42:00 pm »


               There is no Question that funkys system will work.  The only draw back is that there is nothing to tell the player that they can not take the prestige class untill after they have gone all the way through the leveling process.  At with point they will be deleveled and told they they are not allowed to take that class.  The use of the system you had in place is just a much cleaner system.  



Are you useing CEP 2.3 by chance.   You never know they may have changed your the 2da's with an update,