Locked for polymorph

I’m trying to get a companion creature “locked” into a polymorph. As far as I understand, I need to set the “nLocked” parameter to True, but even though I do it, the script gives me an Undeclared Identifier error for it.

Here’s the script so far if it helps.

void main ()
{

object oTarget = OBJECT_SELF; 

// Create the effect to apply
effect ePoly = EffectPolymorph(POLYMORPH_TYPE_WINTER_WOLF, nLocked=TRUE);
ePoly = SupernaturalEffect(ePoly);

effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);

ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePoly, oTarget);

SetScale(oTarget, 1.5, 1.5, 1.5 );

}

Is the line that has the problem. It needs changing to

effect ePoly = EffectPolymorph(POLYMORPH_TYPE_WINTER_WOLF, TRUE);

When it says to set a parameter to anything you do not need to have an assignment to do it. Rather you place the variable or value that the parameter uses into that slot in the function call.

TR

2 Likes

Ah, understood! Thank you.

You’re welcome.

[shameless self promotion] While I realise that you are on NwN 2 and I wrote it primarily for NwN, I still honestly think this ebook that I wrote would be of use to you - TR’s Basics - Variables, Types and Functions (TBC).

TR

3 Likes

Or just:

since the nLocked parameter defaults to true.

No, actually, it’s not:

// Create a Polymorph effect.
// AFW-OEI 11/27/2006: Add a boolean to say whether this polymorph effect is a wildshape effect or not.

effect EffectPolymorph(int nPolymorphSelection, int nLocked=FALSE, int bWildshape=FALSE);

Ah, okay. I should have checked.