Author Topic: class Adding - Probably Noob Issue  (Read 624 times)

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #15 on: August 26, 2011, 01:25:20 pm »


               I wasn't picking up a fight... I was merely stating that there doesn't seem to be a difference between the two options in regards to consistency. In regards to functionality, considering he wants to make the class unavailable by default, the best option is to make the class require a "1" in the variable, so that he won't need to add an extra line to set the variable at module start.
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #16 on: August 29, 2011, 12:46:05 am »


               This is driving me nuts.

"TL_AllowMERCH 0" does the same as "TL_AllowMERCH 1". Where else must this variable be defined? Before I even posted this thread I tried to answer this by searching for "X1_AllowHarper" in the toolset files and found no file by that name (using Search In Files from the script editor).

My confusion comes from the fact that, even if I create a variable named TL_AllowMERCH on a character (somewhat bypassing the variable problem via OnLevelUp script), what function makes a non-standard class selectable or not?
               
               

               


                     Modifié par Hardcore UFO, 28 août 2011 - 11:48 .
                     
                  


            

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #17 on: August 29, 2011, 01:51:24 am »


               These variables aren't used anywhere within the default scripts. The prestige class requires that variable to be set to 0 - and a variable that hasn't been set also returns 0.
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #18 on: August 29, 2011, 02:37:53 am »


               I understand that much... I think.   '<img'>

But to build on what was just said: Say I use scripts to create this variable on characters, and set it to 0. Then, with an OnLevelUp script, I change the local integer to 1 if they meet requirements.

Wait... That's making sense now that I typed it out. It wasn't adding up in my head for some reason...

*Puts up "Gone Testing" sign.*
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #19 on: August 29, 2011, 03:18:39 am »


               Can someone tell me what is wrong with this script?

void main()
{
   object oPC = GetPCLevellingUp();

   if(GetLocalInt(oPC, "TL_AllowMERCH") == 0)
   {
       int nAppr = GetSkillRank(SKILL_APPRAISE, oPC, TRUE);
       int nPers = GetSkillRank(SKILL_PERSUADE, oPC, TRUE);
       int nLore = GetSkillRank(SKILL_LORE, oPC, TRUE);
       int nFocs = GetHasFeat(404, oPC);

       if(nFocs == TRUE && nLore == 4 && nAppr == 6 && nPers == 2)
       {
           SetLocalInt(oPC, "TL_AllowMERCH", 1);
       }
   }
}


If it isn't the script, then my last little epiphany was not all that enlightening. With this script as my OnPlayerLevelUp it still allows the class from level 2 onward with no requirements. Note that I set the TL_AllowMERCH variable to 1 in cls_pres_merch to only allow the class if the variable equals 1, which, as per this script, would only occur given some circumstances.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #20 on: August 29, 2011, 06:21:33 am »


               Not sure, but this:
if(nFocs == TRUE && nLore == 4 && nAppr == 6 && nPers == 2)

should use this instead:
if(nFocs == TRUE && nLore >= 4 && nAppr >= 6 && nPers >= 2)
               
               

               
            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #21 on: August 29, 2011, 07:08:08 am »


               That's certainly going to be added in, thanks. I wasn't paying that close attention to the math though, to be honest, and focusing on having a generic script that would set the variable TL_AllowMERCH on a character to 0 (and then to 1, depending on whether he meets the requirements). It seems not to be, however, since a character (even as I have it erroneously set up, a character with exactly 6 Appraise, 4 Lore, and 2 Persuade, or Skill Focus to speak of) without any requirements can take the class. This is the main issue, really - the specifics I can set up later.

Is the above script supposed to be creating the variable on the character if it does not exist? If not, then how can that variable be created (there are no functions that I saw to create variables, specifically)?
               
               

               


                     Modifié par Hardcore UFO, 29 août 2011 - 06:09 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #22 on: August 29, 2011, 07:44:40 am »


               Try setting the variable to 1 in the OnClientEnter event, and setting it to 0 in the level up event. It may be that the numbers checked are hardcoded, and that it's always 0 == TRUE, 1 == FALSE for it.

The on enter add on would look something like:


int nAppr = GetSkillRank(SKILL_APPRAISE, oPC, TRUE);
int nPers = GetSkillRank(SKILL_PERSUADE, oPC, TRUE);
int nLore = GetSkillRank(SKILL_LORE, oPC, TRUE);
int nFocs = GetHasFeat(404, oPC);

if(!nFocs || nLore < 4 || nAppr < 6 || nPers < 2)
{
SetLocalInt(oPC, "TL_AllowMERCH", 1);
}

The on level would be the same as before, but setting 0 now instead.
               
               

               


                     Modifié par Failed.Bard, 29 août 2011 - 06:45 .
                     
                  


            

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #23 on: August 29, 2011, 12:09:20 pm »


               

Failed.Bard wrote...

Try setting the variable to 1 in the OnClientEnter event, and setting it to 0 in the level up event. It may be that the numbers checked are hardcoded, and that it's always 0 == TRUE, 1 == FALSE for it.


I have tested this, using 1 for true, and it does prohibit the classes from being used in levelup (works even with the 11 base classes).
               
               

               


                     Modifié par Androrc, 29 août 2011 - 11:09 .
                     
                  


            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #24 on: August 29, 2011, 07:03:20 pm »


               I don't get it...

I've tried with the OnClientEnter script as noted and the OnLevelUp setting the variable to 0. Then I tried the same thing with a 1 instead in the TL_AllowMERCH entry of the cls_peres_merch.2da. Then I tried reversing the 1 and 0 from both scripts, along with both variations of the 2da. The class is always available at level 2, regardless.

I didn't find documentation on this, but are you sure that SetLocalInt will create a variable on a character if it does not already exist there? I know I keep mentioning it, but I want to make sure. The rest of the occurences don't make sense, but they would make sense if the variable was somehow not put into existance for the value switches.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #25 on: August 29, 2011, 07:27:17 pm »


               <checks his pouches...>

Hardcore UFO wrote...

I don't get it...
...
I didn't find documentation on this, but are you sure that SetLocalInt will create a variable on a character if it does not already exist there? I know I keep mentioning it, but I want to make sure. The rest of the occurences don't make sense, but they would make sense if the variable was somehow not put into existance for the value switches.


Just a possibility; are you trying to set the variable *before* the PC is loaded?  I've seen several warnings in various tutorials to start doing things in the starting *area's* OnEnter (Rather than OnClientEnter) to avoid this behavior. 

Since I have stuck to that advice, so far (knock on my pointy wooden head) I haven't seen any of those symptoms.

<...to be sure he doesn't have it, either>
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #26 on: August 29, 2011, 07:31:01 pm »


               ...
Double post

(How does "You don't have permission to view this forum" translate into "I already posted it but I'm gonna fool you into re-typing the whole thing"?) :-P
               
               

               


                     Modifié par Rolo Kipp, 29 août 2011 - 06:33 .
                     
                  


            

Legacy_Androrc

  • Full Member
  • ***
  • Posts: 188
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #27 on: August 29, 2011, 08:02:35 pm »


               

Hardcore UFO wrote...

I don't get it...

I've tried with the OnClientEnter script as noted and the OnLevelUp setting the variable to 0. Then I tried the same thing with a 1 instead in the TL_AllowMERCH entry of the cls_peres_merch.2da. Then I tried reversing the 1 and 0 from both scripts, along with both variations of the 2da. The class is always available at level 2, regardless.

I didn't find documentation on this, but are you sure that SetLocalInt will create a variable on a character if it does not already exist there? I know I keep mentioning it, but I want to make sure. The rest of the occurences don't make sense, but they would make sense if the variable was somehow not put into existance for the value switches.


Try using "FALSE" and "TRUE" in the scripts, rather than 0 and 1 (while keeping 0 and 1 in the 2da).

If that doesn't solve the issue, then try simply not setting the variable at all, while making the cls_pres_merch.2da's setting be 1. See if that stops the class from being available at level up before trying to set other things.

How I do it in my would-be module (I've tested it): for the Cleric, for instance, I set the "AllowCleric" variable to 1 in the 2da. And then use this script during a conversation to make the class the available at level-up:


void main()
{
    object oPC = GetPCSpeaker();
    int nLevel = GetHitDice(oPC) + 1;
    int nCost = nLevel * 500;

    TakeGoldFromCreature(nCost, oPC, FALSE);

    SetLocalInt(oPC, "AllowCleric", TRUE);
}

               
               

               


                     Modifié par Androrc, 29 août 2011 - 07:11 .
                     
                  


            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #28 on: August 30, 2011, 05:00:47 am »


               I don't understand what's wrong, really, but even by starting at square one with just a conversation that sets the variable to TRUE, I find once I have the XP that I don't even need to activate the conversation node that fiddles with variables. It's already unlocked. Even with no script in the entire module that modifies the variable, aside from the conversation.

So I do the same thing, but in a blank module with no other haks that could possibly be confounding things (I only have CEP anyway) and the same occurs. Then I stick the line "TL_AllowMERCH       6" in the 2da much to the same effect; I then tried removing the variable requirement to no effect either. The other requirements are being ignored outright.

Now, my cls_pres_merch uses an existing file of the same format as a template (with changed values) and I decuple-checked that the classes.2da entry for it was formatted the same as every other row (i.e. is in the right column). That leaves few things that could be wrong. Is it possible that in erasing a few lines of the cls_pres_harper.2da an erased space before the line returns to the next could cause a misreading? How many spaces are needed after the very last column, and is there a need for spaces under the last row entered (some 2da files seem to have that)?
               
               

               


                     Modifié par Hardcore UFO, 30 août 2011 - 04:01 .
                     
                  


            

Legacy_Hardcore UFO

  • Full Member
  • ***
  • Posts: 157
  • Karma: +0/-0
class Adding - Probably Noob Issue
« Reply #29 on: August 30, 2011, 05:10:31 am »


               One thing I just noticed (and certainly hope is not the cause) is that the 2da files I have created in Notepad (by copying an existing 2da outright) come to be listed as simply "Text Document" in the file type, while the 2da files read "2da". With some poking around, I haven't found how to convert them into 2da, if that matters.

Hitherto I had assumed that 2da files in fact were Text Documents without a special type, but if there's a chance this is the problem I'll adress it. I just don't know how to make a 2da file if copying one, modifying its contents, then clicking Save As (different name) creates something other than a 2da.

Now I'm rambling. Sorry, this is just proving more finnicky and time consuming than I first thought it would be.
               
               

               


                     Modifié par Hardcore UFO, 30 août 2011 - 04:11 .