Author Sticky: Post Working Scripts Here
Eboneye Posted: Monday, 08 July 02:39PM
This is a function to create a dramatic spawn-in (summoning) of a monster at a specific location marked by a waypoint. It also demonstrates how to target visual FX on a specific location.

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

//:: Summon Creature Trap Script

//::

//:: This is a fancy / dramatic effect to gate in a monster as a result

//:: of some PC action.  The most typical usage would be used in the 

//:: OnTriggered event of a trap. It could also be used in the OnEnter 

//:: event of a generic trigger if it is your desire to always summon 

//:: a creature when the PC passes through a location. 

//:: 

//:: To function the script requires a way point be placed to determine

//:: the summoning location.  If you wish to summon custom creatures they

//:: will also need to be placed on the pallet and their blueprint IDs

//:: noted.

//:: 

//::  $author$: Will Greenway

//:: $version$: 1.0

//:: $updated$: 07/06/2002

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

void summoncreature(string TEMPNAME, string LOC_TAG);

void summoncreature(string TEMPNAME, string LOC_TAG) {

    location summonlocation = GetLocation(GetWaypointByTag(LOC_TAG));

    //::///

    //:: This FX simulates flame striking down onto the spawn location

    //::///

    effect StrikeEffect = EffectVisualEffect(VFX_IMP_DIVINE_STRIKE_FIRE,FALSE);

    //::///

    //:: This FX simulates the summoning ring appearing around the summoning location

    //::///

    effect SummonEffect = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3,FALSE);

    //::///

    //:: Wait after the trap is triggered.

    //::///

    ActionWait(2.0);

    //::///

    //:: Play summoning sound

    //::///

    PlaySound("sff_summund");

    //::///

    //:: Fire strike at location

    //::///

    ApplyEffectAtLocation(DURATION_TYPE_INSTANT,StrikeEffect,summonlocation,1.5);

    //::///

    //:: Summon effect at spawn location

    //::///

    ApplyEffectAtLocation(DURATION_TYPE_INSTANT,SummonEffect,summonlocation,4.0);

    //::///

    //:: Spawn in the creature here

    //::///

    CreateObject(OBJECT_TYPE_CREATURE,TEMPNAME,summonlocation,TRUE);

}

void main()

{

    //:://

    //:: Set the name of the creature blueprint ID you wish to create

    //:: The blueprint ID name can be found under the advanced properties of each creature

    //:: If you wish to assign inventory you will have to create a custom creature which

    //:: will have a unique ID ending in a 3 digit number 00x, put that entire identifier in the

    //:: quotes.  For example sake I have a the base template name of a doom knight.

    //:://

    string CR_TEMPNAME = "nw_doomkghtboss";

    //::///

    //:: Set the location where creature will spawn 

    //:: You must create a way point in your map where the critter will

    //:: appear.  Make the waypoint tags match up in the waypoint and in this script.

    //:: As an example I put "SPAWN_LOC" in the waypoint tag.

    //::///

    string WAYTAG = "SPAWN_LOC";

    //::///

    //:: Call the summon function

    //::///

    summoncreature(CR_TEMPNAME, WAYTAG);

    //::///

    //:: NOTE: It would be just as easy to call this function like this:

    //::       summoncreature("nw_doomkghtboss","SPAWN_LOC");

    //::

    //:://// 

    

}