Looking for Scripting Assistance

Hello, all. I’m not entirely new to the NWN2 community, but I AM new to scripting. I’ve got a few that I’m working on for a project, but while I’m starting to get the hang of things, I could still use some feedback on if they’ll work as I expect.

Feel free to ask if you have any questions. There are always people here who might help you, regardless of your knowledge level in scripting.

So what I’m doing is designing a PrC with a number of custom feats. The basic concept is twofold:

First, to inject a bit of WMA/HEMA into DnD.

Second, and partly related to the above, to provide an option for 2H DEXers, because as a practitioner of WMA it makes me twitch that every RPG I’ve ever played relegates 2H weapons to RAAAAAAAAAAAAAAAAAAWR SMASH when that’s not remotely the case IRL.

I’ve got a number of scripts started in-concept (I’m also already working on the 2DA files, as well). I’m slowly starting to figure a few things out, but I could use someone who can cross-check what I’m trying to do, and either confirm it will work, suggest a better/more efficient way of doing it, or simply point out where I’ve made a mistake or left something important out, or suggest work-arounds if my approach simply won’t work. There’s going to be a few places where I also simply don’t know how to approach it and may need some help getting started.

So I guess I’ll start from the beginning. This is the script for the first feat, and one of the class Pre-Reqs:

#include "cmi_ginc_motls"

void main ()
{
	int nModifier = 3
	int nAttack = ATTACK_BONUS_MISC
	int nDamage = DAMAGE_TYPE_ALL

	if (GetHasFeat(FEAT_MASTER_OF_ARMS))
	{
		effect EffectAttackIncrease((nModifier * 2), nAttack, oPC);
		effect EffectDamageDecrease(nModifier, nDamage, oPC);
	}
	else
	{
		effect EffectAttackIncrease(nModifier, nAttack, oPC);
		effect EffectDamageDecrease(nModifier, nDamage, oPC);
	}
}

This is going to be a Combat Mode called Measured Blows, which will increase the character’s Attack by 3, at the expense of 3 damage. It will be further modified by another feat called Master of Arms by doubling the attack bonus gain.

I have it added to the CombatModes.2da and set it as a mode in the Feats.2da. I’m aware there’s also an XML I need to edit (I’m not sure where and which one) in order to make it appear on the Modes bar, as well. However my main concern here is that I’m not sure if there’s anything further I need to specify in the script to make it work when the Mode is active, (note that oPC is defined in my cmi_ginc_motls script) or if this is all the information I need.

question? You say you’ve made a feat, given it a “ToggleMode”, and added it to CombatModes.2da … does it actually show up on the modebar? The xml you’re looking for is modebar.xml and since it uses PrototypeButtons I’d think it should show up right away if your current theory is sound,

 
edit: the stock version of modebar.xml resides in the <install>/UI folder

I haven’t gotten as far as trying anything in the game yet. I’m still working on figuring out the scripting.

Thanks for the info on the location of the XML, though. After a quick glance, I THINK I need to increase the number of columns on the page to 6, but I’ll play around with it once I actually get to in-game testing.

if i were you i’d be doing a feasibility test on ActionModes … aka combatmodes. That is, try to fire a script like this from a custom mode-button:

void main()
{
    SendMessageToPC(GetFirstPC(FALSE), "OMG it works");
}

'cause I think it’s gonna be more frustrating than we’d like it to be …

in other words you might be looking at plain old Feats (aka. spellabilities) instead of new ActionModes,

Regardless of which approach, (the important thing is that it CAN’T be allowed to run at the same time as CE, etc.) right now my main concern is that the script is set up properly.

I think you should check first what KevL said. It’s an important thing. Cause if you can’t add new combat modes via combatmodes.2da (it might be hardcoded), you have to rewrite entirely the script in that case: add manual checks w/ GetActionMode/SetActionMode functions and probably use additionaly the module heartbeat script to properly simulate a new combat “mode”.

Try the Book of Nine Swords pack on the vault, it sounds quite similar to what you are attempting, so it should be useful to look at.

1 Like