|Spell level :||Innate level: 1, Bard: 1, Druid: 1, Ranger: 2, Sorcerer/Wizard: 1, Other: Cleric with Dream domain 1|
|Components :||Verbal and Somatic|
|Duration :||(6 sec. * cLevel) + 18 sec.|
3 + 1 Round (cLevel).
|Save :||Will negates|
|Spell resistance :||Yes|
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.
This spell also affects friendlies on hardcore difficulty, making it a dangerous spell to cast around allies. However, if you want to exclude your party members from being affected by this spell, you have to understand how the game engine selects targets. If there are several targets in the area, those at the edge of the affected area are affected first. The closer a target is to the centre of the sleep area, the later this particular target will be checked. This is true for all spells that use the SHAPE_SPHERE: Sleep, Deep Slumber, Circle of Death, Wail of Banshee etc. This means if you cast the spell directly on yourself, you will be probably unaffected, because all HD will be used up by the time the check reaches the centre of the sleep area. However, this hard-coded function is somewhat bugged and will not calculate properly unless the ground is completely even (floor of a house vs. hillside/slope).
Bug Notes Edit
Many are the same as Deep Slumber.
Updated Bug section: Script shipped with game version 220.127.116.115.
Line 65: nMax should be set to 5 instead of 9 (because highest level affected is 4). This is needed for the search for the creature with the lowest HD (line 113: nCurrentHD < nLow -> here the script initially searches for any valid creature (nCurrentHD <5), then compares it to any other affected creatures' HD by setting the nLow variable to a new value during every loop. Also, on line 113, highest level affected is set as 5 (nCurrentHD < 6), should be "nCurrentHD < 5", because, according to the description, highest level affected is 4. However, nCurrentHD < nLow already takes care of the highest level affected (4), so this check is redundant anyway. So the final condition looks like this:
if(nCurrentHD < nLow //searching for the lowest HD creature, initial search <5 (since 4 is max), consequent loops compare the current target's HD against the HD of the creature checked during the previous loop). Also sets max level affected at 4
&& nCurrentHD <= nHD) // max hd affected all creatures together (8 maximised, 10 empowered - if you are lucky)
Line 78: Error in the way Empower works (only affecting the dice roll), it should be nRoll (defined as d4() before) here, and have an additional 4 added. Empowered HD highest total: 4+ 4 + (4/2)=10:
int nMetaMagic = GetMetaMagicFeat();
int nRoll=d4(); //for Empower
int nHD = 4 + nRoll;
if (nMetaMagic == METAMAGIC_EMPOWER)
nHD = 4+ nRoll + (nRoll/2);
Line 103: The script explicitly excludes construct and undead racial types. These races are immune to sleep anyway, but the actual problem here is that undead and constructs are excluded from the total HD AFFECTED by the spell, so if they are within the sleep range, they do not waste any HD (basically an unintentional reduction of game difficulty). This is probably an improper interpretation of the DnD rules, which state that "Sleep does not target unconscious creatures, constructs, or undead creatures" - "target" is used in the sense of "they are immune" and not "they are not affected." In order to fix, remove the construct/undead checks. The internal game mechanics will ensure that they will ignore the sleep effect anyway.
Line 125: The check "if(oLowest != OBJECT_INVALID)" should use GetIsObjectValid() since this test sometimes does not work, so should be "if(GetIsObjectValid(oLowest))"
Line 151-158: oLowest may be invalid (see line 125) these things should be moved into the statement section that checks if oLowest is valid.
Line 154: Setting the LocalInt to FALSE is redundant, the DeleteLocalInt on line 155 is sufficient.
DnD 3.5 Sleep Edit
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).