Author Sticky: Post Working Scripts Here
Trulain Posted: Tuesday, 09 July 07:47PM
People have been asking about these DarkLamps that I made, so I'm posting how to make them here to save others the effort and to provide an example for other newbies of how to script SFX/VFX (this was my first attempt at scripting). It's not that fancy, but from the feedback I've gotten so far, the end result might even impress some of you veterans!
Feedback / suggesions / ripping all welcome:

Script Names:
darklamp_hb
darklamp_dmg
darklamp_death

What it does:
DarkLamps create darkness fields and some other related VFX/SFX around them. To remove the darkness, PCs simply have to destroy the candelabra. However, DarkLights come with optional OnDamaged script which will summon creatures to defend them when attacked. I created these for a scene where some undead needed to perform a daytime ritual outside and didn't want to get a sunburn - but I'm sure you can think of other applications too. =)

Notes:
DARKLAMP CREATION INSTRUCTIONS
(instructions also included in the script file headers)
1) Make a USEABLE Candelabra
2) Create sound object called DarkLampSound & place on/near the Candelabra
3) Set up DarkLampSound to play "al_mg_ballmagic1" set to seemless looping
4) Attach script darklamp_hb to OnHeartbeat script slot
5) Attach script darklamp_dmg to OnDamaged script slot
6) Attach script darklamp_death to OnDeath script slot
7) Enjoy!

The Scripts:

NWScript:
//::///////////////////////////////////////////////

//:: FileName: darklamp_hb

//:://////////////////////////////////////////////

/*

*/

//:://////////////////////////////////////////////

//:: Created By: Trulain

//:: Created On: July 7, 2002

//:://////////////////////////////////////////////

/*

*/

//:://////////////////////////////////////////////

//:: DarkLamps create darkness fields around them.  Undead set these up before

//:: performing rituals outside in the daytime - though they have many other

//:: uses.  To remove the darkness, PC's simply have to destroy the candelabra.

//:: However, DarkLights come with optional OnDamaged script which will summon

//:: creatures to defend them when attacked.

//::

//:: DARKLAMP CREATION INSTRUCTIONS

//:: 1) Make a USEABLE Candelabra

//:: 2) Create sound object called DarkLampSound & place on/near the Candelabra

//:: 3) Set up DarkLampSound to play "al_mg_ballmagic1" set to seemless looping

//:: 4) Attach script darklamp_hb to the Candelabra's OnHeartbeat script slot

//:: 5) Attach script darklamp_dmg to the Candelabra's OnDamaged script slot

//:: 6) Attach script darklamp_death to the Candelabra's OnDeath script slot

//:: 7) Enjoy!

void main()

{

      effect eDarkness = EffectVisualEffect(VFX_DUR_DARKNESS);

      ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDarkness, OBJECT_SELF);

      effect eGlow = EffectVisualEffect(VFX_DUR_GHOSTLY_VISAGE);

      ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGlow, OBJECT_SELF);

      effect eEnergyField = EffectVisualEffect(VFX_DUR_GLOBE_MINOR);

      ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEnergyField, OBJECT_SELF);

      effect eGroundReflect = EffectVisualEffect(VFX_DUR_SPELLTURNING);

      ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGroundReflect, OBJECT_SELF);

}



NWScript:
//::///////////////////////////////////////////////

//:: FileName: darklamp_dmg

//:://////////////////////////////////////////////

/*

*/

//:://////////////////////////////////////////////

//:: Created By: Trulain

//:: Created On: July 7, 2002

//:://////////////////////////////////////////////

/*

*/

//:://////////////////////////////////////////////

//:: DarkLamps create darkness fields around them.  Undead set these up before

//:: performing rituals outside in the daytime - though they have many other

//:: uses.  To remove the darkness, PC's simply have to destroy the candelabra.

//:: However, DarkLights come with optional OnDamaged script which will summon

//:: creatures to defend them when attacked.

//::

//:: DARKLAMP CREATION INSTRUCTIONS

//:: 1) Make a USEABLE Candelabra

//:: 2) Create sound object called DarkLampSound & place on/near the Candelabra

//:: 3) Set up DarkLampSound to play "al_mg_ballmagic1" set to seemless looping

//:: 4) Attach script darklamp_hb to the Candelabra's OnHeartbeat script slot

//:: 5) Attach script darklamp_dmg to the Candelabra's OnDamaged script slot

//:: 6) Attach script darklamp_death to the Candelabra's OnDeath script slot

//:: 7) Enjoy!

void main()

{

    location lSpawnPoint = GetLocation(OBJECT_SELF);

    effect eSummon = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);

    CreateObject(OBJECT_TYPE_CREATURE, "NW_SKELETON", lSpawnPoint, FALSE);

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSummon, OBJECT_SELF);

}



NWScript:
//::///////////////////////////////////////////////

//:: FileName: darklamp_death

//:://////////////////////////////////////////////

/*

*/

//:://////////////////////////////////////////////

//:: Created By: Trulain

//:: Created On: July 7, 2002

//:://////////////////////////////////////////////

/*

*/

//:://////////////////////////////////////////////

//:: DarkLamps create darkness fields around them.  Undead set these up before

//:: performing rituals outside in the daytime - though they have many other

//:: uses.  To remove the darkness, PC's simply have to destroy the candelabra.

//:: However, DarkLights come with optional OnDamaged script which will summon

//:: creatures to defend them when attacked.

//::

//:: DARKLAMP CREATION INSTRUCTIONS

//:: 1) Make a USEABLE Candelabra

//:: 2) Create sound object called DarkLampSound & place on/near the Candelabra

//:: 3) Set up DarkLampSound to play "al_mg_ballmagic1" set to seemless looping

//:: 4) Attach script darklamp_hb to the Candelabra's OnHeartbeat script slot

//:: 5) Attach script darklamp_dmg to the Candelabra's OnDamaged script slot

//:: 6) Attach script darklamp_death to the Candelabra's OnDeath script slot

//:: 7) Enjoy!

void main()

{

    object oDarkLightHum = GetNearestObjectByTag("DarkLampSound", OBJECT_SELF, 1);

    SoundObjectStop(oDarkLightHum);

    effect eLightBurst = EffectVisualEffect(VFX_FNF_BLINDDEAF);

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLightBurst, OBJECT_SELF);

    PlaySound("sca_dragodd");

}



Tru