Skip to content

Custom Class (turn undead)

BrandonKBrandonK Member Posts: 16
edited August 2022 in Builders - Scripting
I have been playing with custom classes and gave them turn undead...I feel like it might not be leveling? Do I have to do something other than just giving the class the feat? The character does the animation and yellow light but doesn't seem to have any effect?

Thank you in advance
Post edited by BrandonK on

Comments

  • ProlericProleric Member Posts: 1,281
    edited August 2022
    The wiki says that the outcome depends on the caster having sufficient levels in specific classes - not sure whether that's configurable anywhere.

    EDIT - you could try changing nw_s2_turndead for the custom class.
  • BrandonKBrandonK Member Posts: 16
    edited August 2022
    EDIT - I have seen this "nw_s2_turndead" referenced in a few places. I found it using nwnExplorer, but at this time don't seem to know how to edit it...I am glad to see "text" although a friend of mine who does this time of stuff has said that every space, caps/lower case is for a reason so not sure how to change the script. Can I just add a line replacing cleric with my class name?

    Just updating this as I go....thank you in advance for anyone who can help me with this....

    Also, there isn't a changing the game for dummies tutorial is there? Like an elementary guide? I found a really good one for making custom familiars. I feel like it worked last time I tried it....I haven't tried it since I started messing around this summer:)

    Post edited by BrandonK on
  • ProlericProleric Member Posts: 1,281
    edited August 2022
    nw_s2_turndead is a script, so you can use the script editor in the toolset to change it. To open it, filter on all scripts (the default is module scripts only). Changes will be saved as a local script with the same name.

    Sounds like you'll need to acquire some basic scripting knowledge.

    The NWN Lexicon has a primer and tutorials.

    Neverwinter Vault has scripting tutorials by Tarot Redhand, the Toolset Manual, plus (for advanced topics) the Custom Content Guide and Neverwinter University.

    The Vault scripting forum is a good place to ask specific questions.

    These are all general guides - thing is, if you find a cookbook for something as complex as a custom class, all well and good, but as soon as you want to customise stuff that's not in the cookbook, a better overall understanding of how things work is essential.
    Post edited by Proleric on
  • BrandonKBrandonK Member Posts: 16
    I will try to look up those things you mentioned. I don't know why I do this:) Last time I started playing this game (Stuck in the house due to Covid and I download the EE version) I played for a few days and found out I can customize things....spent the next few weeks trying to make a custom class....2 years or so later and I decided to play around with a new computer and hey I should play NWN. Few hours in....wouldn't a necromancy be cool! LOL, thank you for your help:)
  • BrandonKBrandonK Member Posts: 16
    I tried reading the stuff in Lexicon on scripting basics but I am not trying to create a script as much as add another class to those that the computer already recognizes as leveling up the turn undead ability. I simple copied the line for CLASS_TYPE_PALADIN and used that copy to create one for CLASS_TYPE_NEWCLASS.

    I got the script to compile without errors...Not sure if I did it right because I opened it through a module created by the creation wizard. Once it compiled I exported the script (I am pretty sure)
    The file exported as an ERF file....I was hoping to get a script file (nss?) I figured I could just put the scripted with my addition in to replace the original script.

    Will any of that work or am I approaching this wrong?

    It is bedtime:) Hope everyone has a great day....
  • ProlericProleric Member Posts: 1,281
    edited August 2022
    I guess you're trying to mod the OC?

    I wouldn't expect your script to compile, unless you include a line like this before void main()
    const int CLASS_TYPE_NEWCLASS = 42;
    
    Replace 42 with the number of the new class that you added to classes.2da (if different).

    You can open your .erf file with nwhak (ships with the game) then export the .nss and .ncs files to the override folder.

    Alternatively, when the module is open, you'll find those files in modules\temp0.

    Use of override is frowned on for published works (because it impacts every module including the OC) but it's fine if it's just for your own amusement.
  • BrandonKBrandonK Member Posts: 16
    Yup just trying to amuse myself in the OC EE version. Once I get it all working, I might try to learn how to create a HAK file, which is what I think people use to package up custom things to distribute? I had the original diamond edition I bought 20+ years ago but my daughter lost the play disk at some point. I found the EE version was only like 5.99 lol

    I should have taken a screen shot of what I added to the original script....I will pull it up when I mess with things later today. If I understood what I was reading yesterday the script includes something like CLASS_TYPE_SORCERER as a "Constant." The constant is just a tag for me the human to read...The computer doesn't really care what it says. Since my base class in the 2da was a sorcerer I still had that as my constant...I haven't tried changing the name to something more descriptive.

    Honestly, I hope it is just stress and not that my brain is already getting old:) I feel like I understood this stuff better 2 years ago when I started messing with it the first time I played. I got a lot of different projects I am trying to figure out before the summer ends, so this is my me time in the evenings:) As always, I will read and try to process any comments and appreciate everyone who responds:)
  • BrandonKBrandonK Member Posts: 16
    edited August 2022
    So here is the part of the script I changed and it allowed me to compile it afterwards

    void main()
    {
    int nClericLevel = GetLevelByClass(CLASS_TYPE_CLERIC);
    int nPaladinLevel = GetLevelByClass(CLASS_TYPE_PALADIN);
    int nSorcererLevel = GetLevelByClass(CLASS_TYPE_SORCERER);
    int nBlackguardlevel = GetLevelByClass(CLASS_TYPE_BLACKGUARD);
    int nTotalLevel = GetHitDice(OBJECT_SELF);

    The bolded part is what I added....My base class in Classes.2da was just a modified sorcerer and I guess I never changed the Constant "CLASS_TYPE_XXXXX" They didn't seem to reference the line number just the constant. After this it talks about modifying blackguards and paladin levels but I just left it this way assuming it would be the same as a cleric because it seemed to be the default and everything after this part was to modify classes based on cleric minus different amounts.

    After changing this I compiled it with 0 errors....and fumbled my way through "saving" or I think I exported the script. The result was my ERF file....I think I will try using that nwHAK and see if I can get those 2 things in the override to see if it works:)

    EDIT - I placed the .nss and .ncs file in override and leveled my character to 20 to ensure ultimate power:) Sadly 8 turn undead attempts failed to have any effect. I will look at the script to see if I can find an area that includes the row number as you suggested.



  • ProlericProleric Member Posts: 1,281
    In the OP, you mention "custom class".

    Are you trying to add a new class (extra line in classes.2da) or simply modify Sorceror (class 9)?

    If the former, you need to define a new constant, as previously mentioned.

    CLASS_TYPE_SORCERER is a pre-defined constant with the value 9, which the compiler will recognise, so the script will compile but do nothing for any new class.

    P.S. hak pack would indeed be the way to go for publication.
  • BrandonKBrandonK Member Posts: 16
    New Class (New line in Classes.2da) based on Sorcerer as a starting point...Long term plans include a custom familiar progressing from a zombie to wraith or whatever seem like a proper progression in power. Turn undead and maybe summon undead...Necromancer type idea.

    I copied the Sorcerer line for spell gain, attack and saving throws...It does currently have the same thing written in the column for constant. I assumed it was just a generic thing since what I read was that the words under constant is just for human use.

    Where do I define the constant (Class_Type_xxxx)..That was why you wrote the thing previously Class_type_newclass = 42. I am not at home so using phone...Sorry for short response:)
  • ProlericProleric Member Posts: 1,281
    
    const int CLASS_TYPE_NEWCLASS = 42;
    
    void main()
    {
    int nClericLevel = GetLevelByClass(CLASS_TYPE_CLERIC);
    int nPaladinLevel = GetLevelByClass(CLASS_TYPE_PALADIN);
    int nSorcererLevel = GetLevelByClass(CLASS_TYPE_NEWCLASS);
    int nBlackguardlevel = GetLevelByClass(CLASS_TYPE_BLACKGUARD);
    int nTotalLevel = GetHitDice(OBJECT_SELF);
    

    You can replace NEWCLASS with your own class name throughout. Replace 42 with your new classes.2da line number if different.

    I haven't checked the original code - if nSorcerorLevel is already in use for something, you'll need to define a new variable for your class.
  • KamirynKamiryn Member Posts: 74
    You don't need to define a new constant (because as you've said the constant is for human use only). Instead you can also write:
    int nMyNewClassLevel = GetLevelByClass(42); // 42 = row number of MyNewClass in classes.2da
    
    But if you want to have a constant you have to define it before you can use it. Where you do that in your scripts doesn't really matter. You just have to make sure that the compiler reads the definition before the constant is used for the first time:
    const int CLASS_TYPE_MYNEWCLASS = 42; // 42 = row number of MyNewClass in classes.2da
    ...
    int nMyNewClassLevel = GetLevelByClass(CLASS_TYPE_MYNEWCLASS);
    
    Of course adding these lines to the turn undead script is not enough. You also have to add nMyNewClassLevel to nTurnLevel / nClassLevel:
    int nTurnLevel = nClericLevel + nMyNewClassLevel;
    int nClassLevel = nClericLevel + nMyNewClassLevel;
    

    If you want to know if your script is actually called you can add a debug message like:
    SendMessageToPC(OBJECT_SELF, "Turn undead level = "+IntToString(nTurnLevel));
    
Sign In or Register to comment.