Help with scripting out Dev Crit (on a new EE server)

OOC General Discussion

Moderators: Forum Moderators, Active DMs

Post Reply
mask and riddle
Posts: 3
Joined: Fri May 04, 2018 4:06 pm

Help with scripting out Dev Crit (on a new EE server)

Post by mask and riddle » Fri May 04, 2018 4:10 pm

Hi all,

I came here to ask a question, as you guys are the bristling hub of all NWN activity.

I am wondering if there is a way to disable dev crit without forcing players to download a hak file?
My scripting knowhow is very little, and so is everyone involved in the server.

I apologize that this has nothing to do with Arelith, but I didn't know where to turn.

Thank you!

-Mask

yellowcateyes
Project Lead
Project Lead
Posts: 1445
Joined: Fri Sep 12, 2014 2:02 am

Re: Help with scripting out Dev Crit (on a new EE server)

Post by yellowcateyes » Fri May 04, 2018 4:26 pm

Arelith's approach to disabling Devastating Critical was to have a script that checked for forbidden feats upon level-up or login. If a character had a forbidden feat (in this case, one of the Devastating Critical feats), the player would be sent a message that picking the feat was disallowed and the character would automatically be reduced to one XP less than what was needed for their current level.

This script was written well before the NWNX plugin, which has functions for directly removing feats from characters.

Hope this helps.
Dinosaur Space Program is my working partner on Arelith-related projects. If my inbox is full or I take a while to get back to you, feel free to PM them questions or concerns.

mask and riddle
Posts: 3
Joined: Fri May 04, 2018 4:06 pm

Re: Help with scripting out Dev Crit (on a new EE server)

Post by mask and riddle » Fri May 04, 2018 4:30 pm

Thanks for the reply!

Is there a way of getting ahold of this script and a simple instruction of how to implement it?
We are total scripting newbs.

Thanks!

yellowcateyes
Project Lead
Project Lead
Posts: 1445
Joined: Fri Sep 12, 2014 2:02 am

Re: Help with scripting out Dev Crit (on a new EE server)

Post by yellowcateyes » Fri May 04, 2018 4:45 pm

When you edit your module's properties, you will see an Events tab. One of these tabs has a field called OnPlayerLevelUp. Entering a script here will have that script trigger when a player finishes the level-up process by hitting the "OK" button.

In that script, you will likely want to first define some variables.

Code: Select all

object oPC = GetPCLevellingUp();  // The player-character object that just leveled-up
int nLevel = GetHitDice(oPC); // The PC's hit dice.  In other words, their current level.
int nXPLevel = nLevel * (nLevel - 1) / 2 * 1000;  // How much XP is needed for their current level.
Once you have these, you can check to see if a player has any of the Devastating Critical feats. If so, you can send them a message and drop their XP to the XP needed for their current level, minus one.

Code: Select all

    if (GetHasFeat(FEAT_EPIC_DEVASTATING_CRITICAL_BASTARDSWORD,   oPC) ||
        GetHasFeat(FEAT_EPIC_DEVASTATING_CRITICAL_BATTLEAXE,      oPC) ||
        // etc, etc.  Go through all the devastating critical feats.
	// Not listing them all here, just a few for purpose of example.
        GetHasFeat(FEAT_EPIC_DEVASTATING_CRITICAL_WARHAMMER,      oPC) ||
        GetHasFeat(FEAT_EPIC_DEVASTATING_CRITICAL_WHIP,           oPC))
    {
        SetXP(oPC, nXPLevel - 1);
        FloatingTextStringOnCreature("Devastating Critical is disabled, please do not choose it as a feat when leveling up!", oPC, FALSE);
        return;
    }
All of the above should be placed in the void main(){} function of your OnPlayerLevelUp script.

There are likely more efficient ways of doing this, especially with NWNX. But this is how Arelith disabled Devastating Critical.

Good luck!
Dinosaur Space Program is my working partner on Arelith-related projects. If my inbox is full or I take a while to get back to you, feel free to PM them questions or concerns.

mask and riddle
Posts: 3
Joined: Fri May 04, 2018 4:06 pm

Re: Help with scripting out Dev Crit (on a new EE server)

Post by mask and riddle » Fri May 04, 2018 4:51 pm

Thank you So much for this, I really appreciate it!

User avatar
Rags
Posts: 56
Joined: Wed Jul 12, 2017 1:23 am

Re: Help with scripting out Dev Crit (on a new EE server)

Post by Rags » Sat May 05, 2018 6:43 pm

Could always disable it with a server side override. Looks like you have a working solution, though!

Post Reply