Author Sticky: Post Working Scripts Here
Rockey Posted: Thursday, 27 June 05:33AM
1. How to use Sub Races in a Module

2. Ok, here is a script that I whipped up for Subclasses. You can use it to get an idea of how to add/subtract abilities, skills, and effects on a player due to subrace.

3. To try it out, edit the Module and place this script into the Module Properties->Events->OnClientEnter, then
make a character w/ the subrace of

BadAssElf

What this script will do is tell you your subclass (in the text window, only if your a BadAssElf), raise your strength and constitution by +2, add +1 hitpoint per level (or hitdie really), and add +30 to ALL skills. This is a crappy subrace, but its an example

I havent figured out how to modify the talents or the feats yet. If you save your character while in a game w/ this script running, it will show your abilities (strength, etc) restored to where it should be, but the bonuses it offers on other die rolls seems to be with the modified value. But, when you reload your character in the same world w/ the script, the do not add together and work as they should. And if you go to a non-script world, you are as you should be (non-modified, everything returns to normal).

4. Here is the script:

NWScript:
void main()

{

    //Get the new player entering the game

    object oNewPlayer = GetEnteringObject();

    //Just to be sure its a player...

    if (GetIsPC(oNewPlayer)) {

        //Grab the players SubRace (if any)

        string sSubRace = GetSubRace(oNewPlayer);

        //Grab their Deity. This could be used for a Deity

        // whose followers start w/ a +1 magic hammer or something.

        // If it matched, you could put a premade item in their

        // inventory, or maybe an increased saving throw or something...

        string sDeity = GetDeity(oNewPlayer);

        // This is just to verify to you testing that it did

        // see and match your sub race. This will appear in the

        // text window.

        SendMessageToPC(oNewPlayer, "You are a " + sSubRace);

        //Here's the list for a 'BadAssElf'

        if (sSubRace == "BadAssElf") {

            // Raise Strength by +2

            ApplyEffectToObject( DURATION_TYPE_PERMANENT,

                EffectAbilityIncrease( ABILITY_STRENGTH, 2),

                oNewPlayer, 0.0);

            // Raise Constitution by +2

            ApplyEffectToObject( DURATION_TYPE_PERMANENT,

                EffectAbilityIncrease( ABILITY_CONSTITUTION, 2),

                oNewPlayer, 0.0);

            // Add +30 to ALL skills...

            ApplyEffectToObject( DURATION_TYPE_PERMANENT,

                EffectSkillIncrease(SKILL_ALL_SKILLS, 30),

                oNewPlayer, 0.0);

            // Character subclass gets +1 hitpoint per level.

            int iPlayerHitDice = GetHitDice(oNewPlayer);

            ApplyEffectToObject( DURATION_TYPE_PERMANENT,

                 EffectTemporaryHitpoints(1 * iPlayerHitDice),

                 oNewPlayer, 0.0);

        }

    }

}