Below is the script:
#include "nw_i0_spells"
// Duration of the placeable in rounds
const int DURATION_ROUNDS = 10; // Adjust duration as needed
// Check if target is humanoid or demihuman
int IsTargetDemihuman(object oTarget)
{
int nRace = GetRacialType(oTarget);
return (nRace == RACIAL_TYPE_HUMAN ||
nRace == RACIAL_TYPE_ELF ||
nRace == RACIAL_TYPE_DWARF ||
nRace == RACIAL_TYPE_HALFLING ||
nRace == RACIAL_TYPE_GNOME ||
nRace == RACIAL_TYPE_HALFELF ||
nRace == RACIAL_TYPE_HALFORC);
}
// Apply hypnotic effect to valid targets
void ApplyHypnoticEffect(object oTarget)
{
if (!IsTargetDemihuman(oTarget))
{
return; // Skip non-demihumans
}
int nDC = GetSpellSaveDC();
if (!WillSave(oTarget, nDC))
{
// Hypnotic effect on the target (Daze)
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oTarget, 10.0);
}
}
// Cast the Hypnosis spell
void CastSpell()
{
// Create the hypnotic placeable at the target location
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE, "phodfxfuryredblu", GetSpellTargetLocation(), TRUE);
// Get all creatures in a sphere around the placeable
object oCreature = GetFirstObjectInShape(SHAPE_SPHERE, 5.0, GetLocation(oPlaceable)); // Get first object in range
// Loop through all objects in the sphere
while (GetIsObjectValid(oCreature))
{
// Only apply effects to creatures that are not the caster
if (oCreature != GetCaster()) // This checks if the creature is not the caster
{
ApplyHypnoticEffect(oCreature);
}
// Get the next object in range for the next iteration
oCreature = GetNextObjectInShape(SHAPE_SPHERE, 5.0, GetLocation(oPlaceable));
}
// Optional: Apply a pulse visual effect at the placeable's location for flair
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_PULSE_COLD), GetLocation(oPlaceable));
// Set a delayed action to remove the placeable after the specified duration
DelayCommand(RoundsToSeconds(DURATION_ROUNDS), RemovePlaceable(oPlaceable));
}
// Remove the placeable object after spell duration expires
void RemovePlaceable(object oPlaceable)
{
if (GetIsObjectValid(oPlaceable)) // Ensure the object is still valid before destroying
{
DestroyObject(oPlaceable);
}
}
suppose to work like this:
Hypnosis
School: Enchantment (Compulsion)
Level: Bard 1, Sorcerer/Wizard 1
Components: Verbal, Somatic
Casting Time: 1 standard action
Range: Close (25 ft. + 5 ft./2 levels)
Target: One humanoid or demihuman creature
Duration: 1 round/level (Dazed effect)
Saving Throw: Will negates
Spell Resistance: Yes
Description:
With a soft, hypnotic chant, you lull your target into a trance, leaving them dazed and vulnerable. This spell works only on humanoid or demihuman creatures, such as humans, elves, dwarves, halflings, gnomes, half-elves, and half-orcs.
If the target fails a Will save, they become Dazed for the duration of the spell. While dazed, the target is unable to act, suffering from confusion and disorientation, making them an easy target for follow-up attacks or spells. The target remains unaware of the caster’s intentions but is incapacitated by the spell’s effects.
A creature that succeeds on the Will save is unaffected by the spell. The caster can target multiple creatures within range by casting the spell at a location or in the vicinity of the spell’s area of effect.
Special Components:
- A placeable object representing the hypnotic focus (a visual effect or object) will be created at the spell’s target location. The placeable remains for a duration of the spell and helps visualize the spell’s hypnotic influence.
Notes:
- The caster cannot target themselves or their allies with this spell.
- The Dazed effect lasts for 1 round per caster level, or until the target succeeds on a Will save to break free early.
BUT…the placeable is not being created and i am getting the following error in the script;
ERROR: NO RIGHT BRACKET ON EXPRESSION
// Only apply effects to creatures that are not the caster if (oCreature != GetCaster()) // This checks if the creature is not the caster