Difference between revisions of "EffectPolymorph"

From NWN Lexicon
Jump to: navigation, search
m (Wikified article formatting and cleaned up grammar)
 
Line 1: Line 1:
=EffectPolymorph(int, int)=
 
 
 
Create a Polymorph effect that changes the target into a different type of creature.
 
Create a Polymorph effect that changes the target into a different type of creature.
  
Line 10: Line 8:
 
</nwscript>
 
</nwscript>
  
====Parameters====
+
===Parameters===
 
+
; nPolymorphSelection
''nPolymorphSelection''
+
: A [[polymorph_type|POLYMORPH_TYPE_*]] constant matching the form to polymorph into
 
 
[[ polymorph_type | POLYMORPH_TYPE_* ]]
 
 
 
''nLocked''
 
  
If TRUE, player can't cancel polymorph (Default: FALSE)
+
; nLocked
 +
: If TRUE, player can't cancel polymorph (Default: FALSE)
  
====Description====
+
===Description===
 +
Returns a new effect object that, when applied to a target, will transform them into one of the types defined in the POLYMORPH_TYPE_* constant group, from the "polymorph.2da" file. New forms can be added via a hakpack.
  
Returns a new effect object that when applied to a target will transform them into one of the types defined in the POLYMORPH_TYPE_* constant group, from the "polymorph.2da" file, where new ones can be added via. a hakpack.
+
A new polymorph will cancel out an existing one. If nLocked is TRUE, there is no "Cancel Polymorph" in the radial menu, so it cannot be removed manually by a PC; the effect can only be removed when the duration runs out or (if applied via a spell) it is dispelled.
 
 
A new polymorph will cancel out an existing one, and if nLocked is TRUE, there is no "Cancel Polymorph" in the radial menu, so it cannot be removed automatically by a PC, only by the duration running out, or (if applied via. a spell) it being dispelled.
 
  
 
The target this effect is applied to must be a creature for it to work.
 
The target this effect is applied to must be a creature for it to work.
  
====Remarks====
+
==Remarks==
 
 
 
There may be polymorph types that can be used but which don't have a constant associated with it. All the different POLYMORPH_TYPE constants are just integers referencing a row number in your polymorph.2da file. Look in this file to see if there are further polymorphs available for you.
 
There may be polymorph types that can be used but which don't have a constant associated with it. All the different POLYMORPH_TYPE constants are just integers referencing a row number in your polymorph.2da file. Look in this file to see if there are further polymorphs available for you.
  
Polymorph changes these aspects of a Creature:<br />
+
Polymorph changes these aspects of a creature:
- Removes all equipped items temporarily<br />
+
* Removes all equipped items temporarily
- Their appearance changes (as with it, creature speed, creature size and associated bonuses/penalties).<br />
+
* Their appearance (and with it, creature speed, creature size, and associated bonuses/penalties).
- Their racial type (GetRacialType() return value also changes)<br />
+
* Their racial type ([[GetRacialType]]() return value also changes)
- Their portrait<br />
+
* Their portrait
- Their soundset<br />
+
* Their soundset
- Their equipped primary hand weapon (if valid weapon)<br />
+
* Their equipped primary hand weapon (if valid weapon)
- Their creature weapons (if valid, else they are considered unarmed)<br />
+
* Their creature weapons (if valid, else they are considered unarmed)
- Their hide item (which provides most permanent special bonuses)<br />
+
* Their hide item (which provides most permanent special bonuses)
- They may gain addional Natural AC (Which should stack with amulets of natural AC)<br />
+
* They may gain additional Natural AC (which should stack with amulets of natural AC)
- They Gain a bonus to their hit points (acts like tempoary hit points and cannot be healed.)<br />
+
* They gain a bonus to their hit points (acts like temporary hit points and cannot be healed.)
- Their Strength, Dexterity, Constitution (if valid values, else will use the original creatures original statistics. It may even lower statistics if their natural statisitic is higher then what the new one is.)<br />
+
* Their Strength, Dexterity, Constitution (if valid values, else will use the original creatures original statistics. It may even lower statistics if their natural statistic is higher then what the new one is.)
- They may gain up to 3 spells/natural abilities to cast infinitely (unless restricted in the script that runs)<br />
+
* They may gain up to 3 spells/natural abilities to cast infinitely (unless restricted in the script that runs)
 
+
* They cannot cast spells or use items apart from potions
And:<br />
 
- They cannot cast spells or use items apart from potions
 
  
 
All the ones without a comment after should always be present when a polymorph is done. Some are not present (IE: **** in the 2da file) and thus it is just ignored (so no weapon, means no weapon is equipped, and no bonus to dexterity means they use their natural dexterity).
 
All the ones without a comment after should always be present when a polymorph is done. Some are not present (IE: **** in the 2da file) and thus it is just ignored (so no weapon, means no weapon is equipped, and no bonus to dexterity means they use their natural dexterity).
  
Effect functions are Constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be got separately via. looping valid effects on the target (GetFirst/NextEffect()). See the [[Effect tutorial|Effect Tutorial]] for more details.
+
Effect functions are constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an [[ApplyEffectToObject]]() Command. Once applied, each effect can be gotten separately via looping valid effects on the target ([[GetFirstEffect|GetFirst]]/[[GetNextEffect|NextEffect]]()). See the [[Effect tutorial|Effect Tutorial]] for more details.
 
 
====Version====
 
  
 +
===Version===
 
1.62
 
1.62
  
====Example====
+
===Example===
 
 
 
<nwscript>
 
<nwscript>
 
// Sample code for applying a werewolf polymorph to a target
 
// Sample code for applying a werewolf polymorph to a target
 
 
void main()
 
void main()
 
{
 
{
Line 82: Line 70:
 
</nwscript>
 
</nwscript>
  
====See Also====
+
===See Also===
 
 
 
{| class="seealso"
 
{| class="seealso"
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
|
+
|[[SetCreatureAppearanceType]],
[[SetCreatureAppearanceType | SetCreatureAppearanceType ]]
 
|-
 
 
|-
 
|-
 
| width="1px" align="right" valign="top" | <font color="gray">constants: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">constants: </font>
|
+
| [[polymorph_type|POLYMORPH_TYPE_* Constants]]
[[ polymorph_type | POLYMORPH_TYPE_* Constants ]]
 
 
|}
 
|}
  
Line 99: Line 83:
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:Effects_Functions]]
 
[[Category:Effects_Functions]]
[[Category:Spells_Functions]]
+
[[Category:Spells_Functions]]{{DISPLAYTITLE:EffectPolymorph(int, int)}}

Latest revision as of 06:38, 8 March 2018

Create a Polymorph effect that changes the target into a different type of creature.

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

Parameters

nPolymorphSelection
A POLYMORPH_TYPE_* constant matching the form to polymorph into
nLocked
If TRUE, player can't cancel polymorph (Default: FALSE)

Description

Returns a new effect object that, when applied to a target, will transform them into one of the types defined in the POLYMORPH_TYPE_* constant group, from the "polymorph.2da" file. New forms can be added via a hakpack.

A new polymorph will cancel out an existing one. If nLocked is TRUE, there is no "Cancel Polymorph" in the radial menu, so it cannot be removed manually by a PC; the effect can only be removed when the duration runs out or (if applied via a spell) it is dispelled.

The target this effect is applied to must be a creature for it to work.

Remarks

There may be polymorph types that can be used but which don't have a constant associated with it. All the different POLYMORPH_TYPE constants are just integers referencing a row number in your polymorph.2da file. Look in this file to see if there are further polymorphs available for you.

Polymorph changes these aspects of a creature:

  • Removes all equipped items temporarily
  • Their appearance (and with it, creature speed, creature size, and associated bonuses/penalties).
  • Their racial type (GetRacialType() return value also changes)
  • Their portrait
  • Their soundset
  • Their equipped primary hand weapon (if valid weapon)
  • Their creature weapons (if valid, else they are considered unarmed)
  • Their hide item (which provides most permanent special bonuses)
  • They may gain additional Natural AC (which should stack with amulets of natural AC)
  • They gain a bonus to their hit points (acts like temporary hit points and cannot be healed.)
  • Their Strength, Dexterity, Constitution (if valid values, else will use the original creatures original statistics. It may even lower statistics if their natural statistic is higher then what the new one is.)
  • They may gain up to 3 spells/natural abilities to cast infinitely (unless restricted in the script that runs)
  • They cannot cast spells or use items apart from potions

All the ones without a comment after should always be present when a polymorph is done. Some are not present (IE: **** in the 2da file) and thus it is just ignored (so no weapon, means no weapon is equipped, and no bonus to dexterity means they use their natural dexterity).

Effect functions are constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be gotten separately via looping valid effects on the target (GetFirst/NextEffect()). See the Effect Tutorial for more details.

Version

1.62

Example

// Sample code for applying a werewolf polymorph to a target
void main()
{
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;
 
    // Create the effect to apply
    effect ePoly = EffectPolymorph(POLYMORPH_TYPE_WEREWOLF);
 
    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_POLYMORPH);
 
    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, ePoly, oTarget);
}

See Also

functions:  SetCreatureAppearanceType,
constants:  POLYMORPH_TYPE_* Constants

 author: John Shuell, editors: Jasperre, Mistress, additional contributor: Jasperre