Sleep (spell)
From NWN2Wiki
| Sleep | |
| Spell Information | |
| Spell level : | Innate level: 1, Bard: 1, Druid: 1, Ranger: 2, Sorcerer/Wizard: 1, Other: Cleric with Dream domain 1 |
|---|---|
| School : | Enchantment |
| Descriptor(s) : | Mind-affecting |
| Components : | Verbal and Somatic |
| Range : | Medium |
| Target/Area : | Huge |
| Duration : | (6 sec. * cLevel) + 18 sec. 3 + 1 Round (cLevel). |
| Save : | Will negates |
| Spell resistance : | Yes |
[edit] Description
Sleep forces affected creatures to sleep for the duration of the spell. You can affect 4 + 1d4 HD of creatures, affecting the lower hit die creatures first. Creatures with 5 or more hit dice can not be affected by this spell.
Notes:
This spell also affects friendly units in hardcore difficulty, making it a dangerous spell to cast around allies.
[edit] Bug Notes
Many are the same as Deep Slumber.
Differences between script and description: It also doesn't affect construct or undead races (which is not mentioned explicitly).
Line 59: Error in the way Empower works (only affecting the dice roll), it should do d4() here, and have, after a proper use of ApplyMetamagicVariableMods(), an additional 4 added.
Line 63: A note that nMax should really be set to 6, which is 1 over the maximum HD to affect, but due to line 97 level 5 is the highest to affect anyway (where it says < 6).
Line 65, 66, 82: Duration works oddly. We seem to have (ignoring GetScaledDuration(), see below) nCaster Level + 3 + 2 rounds. This is Level + 18 + 12 seconds!
The basic thing should be to remove the added 2 rounds on line 82, and remove the use of GetScaledDuration() on line 66 (so it is simply "nDuration = 3 + nDuration;").
Line 70-81: This doesn't make use of the much better NWN2 ApplyMetamagicVariableMods() function for metamagic empower/maximise, nor ApplyMetamagicDurationMods() and ApplyMetamagicDurationTypeMods() for duration metamagic.
Line 58: GetScaledDuration() is meant to reduce the duration of sleep when less then core rules. In fact, in this and Sleep it doesn't work either.
To remedy this a few changes are needed. The duration should be calculated properly (noted above) to be nCasterLevel + 3 rounds. This will be fDuration, the "base" duration.
Firstly, GetScaledDuration() needs to have nDur changed to a float, or a new GetScaledDurationFloat() be added in nw_i0_spells.nss.
A new variable in the script, fNewDuration, can then be altered every time. It should be reset to fDuration's scaled duration just before 133, ie:
fNewDuration = GetScaledDuration(fDuration, oLowest);
This will return fDuration if the target isn't a PC, or the duration is <= 3 rounds, but the correct scaled ones for the PC.
Then, use fNewDuration 138 and 143 instead of fDuration.
Line 123: The check "if(oLowest != OBJECT_INVALID)" should use GetIsObjectValid() since this test sometimes does not work, so should be "if(GetIsObjectValid(oLowest))"
Line 126: The signal event should be fired at oLowest not oTarget (which will simply be invalid all the time due to how GetNextObjectInShape works).
Line 149-156: oLowest may be invalid (see line 123!) these things should be moved into the 123-148 if statement section, else the script can perform functions on invalid objects.
Line 152: This setting the variable to FALSE is redundant, the delete line on 153 is all that is needed (in fact, doing it this way would mean it gets deleted, then set to false, due to the nature of the delay command stack). HOLA!
[edit] DnD 3.5 Sleep
Description: A sleep spell causes a magical slumber to come upon 4 hit dice of creatures. Creatures with the fewest HD are affected first.
Among creatures with equal HD, those who are closest to the spell’s point of origin are affected first. Hit Dice that are not sufficient to affect a creature are wasted. Sleeping creatures are helpless. Slapping or wounding awakens an affected creature, but normal noise does not. Awakening a creature is a standard action (an application of the aid another action).
Sleep does not target unconscious creatures, constructs, or undead creatures.
