Stratics - The Massively Multiplayer Network
Stratics Network   Stratics Community   Stratics Central     
 
 
NWN Spawn System v.2.4.4c

Created by Palor
Formerly known as the "UO Style Spawn System"
See the NWN Spawn Script v.2.4.4c text file for more details on this versions changes and additions.

Introduction

PC tested, DM approved.

This is a single script that is placed as an OnHeartbeat on a single object in an area. Once placed you can setup individual Spawn Sites by placing WayPoints. Each Spawn Site can:

  • Spawn up to 99 creatures
  • Spawn a random amount of creatures between 1 and 99
  • Spawn a group of different creatures
  • Spawn random creatures from a group
  • Use a delay of up to 99 hours between each spawn
  • Use random delay of up to 99 hours between spawns
  • Spawn just at night or during the day
  • Spawn only at a specific hour or between certain hours
  • Spawn only on a specific day or between certain days
  • Spawn only if a PC is within up to 99 meters
  • Spawn creatures in random locations within a specified radius
  • Spawn creatures in random locations around the players
  • Optionaly not spawn if a player enters the radius and is already in combat
  • Spawn treasure chests or any other valid Placeable
  • Use Effects when it spawns or kills the creatures due to an invalid time
  • Setup radius based damage (traps) and have effects applied to simulate poisonous fogs or other effects
  • Have spawned creatures walk around randomly without editing their OnSpawn script
  • Make the creatures play animations while they are not walking without editing their default scripts
  • Generate treasure on a spawned creature without editing their OnSpawn script
  • Have the spawner wait until all creatures are killed before spawning again
  • Optionaly not spawn until all the creatures it spawns are killed

Other things you can do with the script if you like some added flavor:

  • Customize Groups or use existing ones
  • Customize the Traps by changing damage and visual effects
  • Easily create "magic" amulets that can protect players from the "traps"
  • Customize Spawn effects and effects used when the spawner destroys creatures
  • Setup camp items to be used as props for Monster Camp
  • .
  • Check for items and spawn based on whether the player has it or not
  • Create quest items on the creatures when they are spawned
  • Spawn at remote locations away from the spawn point
  • Control the spawn through triggers

Back to Top

Downloads

Download the NWN Spawn Script v.2.4.4c erf file. A 279KB file.

Download the NWN Spawn Script v.2.4.4c in a text file with version notes. A 92KB file.

Back to Top

Installation

  • Create an invisible object and attach this script to it's Heartbeat. You only need the one object for all your spawn points in the area.
  • Decide what creature you want to spawn and make a note of it's Tag or create a custom creature.
  • Place a Waypoint and edit the properties to look like:
    	Name: SP_SX02
    	Tag: NW_DOG
    
  • Load your module and login and watch the 2 dogs standing there. :)
  • Place more Waypoints and populate your module!

For a complete list of valid switches that you can use on your Spawn Point to control the spawn, see the Switch Quick Reference and section Switches section sections of this document.

Back to Top

Switch Quick Reference

Spawn Switches | Item Related Switches | Random Switches | Time Switches
Action Switches | Effect Switches | 3rd-Party Switches

~ Click on the Switch tag to see more details about its use. ~

Spawn Switches

  • SP_ - Tells the Spawn Control Object that this Waypoint is a Spawn Point.
  • ID01 - Sets the ID of the spawn point to 1.
  • CH01 - Tells the spawner to spawn Champion 01 at the spawn point.
  • CH01R1d2 - Give the spawner a 50% chance to spawn Champion 01 at the spawn point.
  • CR - Spawn the Champion at a remote location.
  • SS - Stops Spawn when all creatures are killed at spawn point.
  • RD10 - Only spawn creatures if a Player is within 10 meters.
  • RD10X - Only spawn if a player is within 10 meters. Kill the creatures when a player leaves the radius even if they are in combat.
  • RD10N - Do NOT spawn if a player is within 10 meters.
  • RD101d4 - If a player is within 10 meters, roll and give the spawn point a 1 in 4 chance of spawning.
  • IC - Do not spawn when a player enters the radius and is already in combat. Used with RD.
  • SX02 - Keep 2 creatures spawned.
  • SX01R10 - Spawn a random amount between 1 and 10.
  • CP01 - Spawn creature camp site 01.
  • GP - Spawn a group of creatures using the default group templates. Specify the group in the waypoint tag.
  • TR - Spawn Placeable. Specify the ResRef in the waypoint tag.
  • EX02 - Spawn at remote location 02.
  • PA - Only spawn if a player is in the area.
  • DX0 - When the creatures are suppose to despawn, they will walk to Remote Site 01 and then despawn.
  • KT01H - Kill all creatures at 1am.
  • KT01D - Kill all creatures on the 1st day of the month.

Item Related Switches

  • CI01 - Creates Item 01 from the Item List and places it on all creatures.
  • CI01R1d2 - Each creature has a 50/50 chance of receiving the item.
  • IG - Give all items out of group 01.
  • IGR * - Choose a random item from the group.
  • PI01 - Player must have Item 01 in their inventory in order for this spawn site to spawn.
  • PI01X - Player must NOT have Item 01 in their inventory in order for this spawn site to spawn.
  • GT01 - Give all creatures treasure from 01.
  • GT01R1d2 - 50% chance to give all creatures treasure from 01.

Random Switches

  • SR10 - Spawn creatures in a random location within 10 meters.
  • NP - If SR is used it will spawn within 10 meters of the player.
  • GR - If GP and SX are specified, it will spawn a random creature from the group.

Time Switches

  • NT - Only spawn at night. Kill any creatures when it turns day, unless they are in combat.
  • NTX - Only spawn at night and kill any creatures when it turns day even if they are in combat.
  • DT - Only spawn during the day. Kill any creatures when it turns night, unless they are in combat.
  • DTX - Only spawn during the day and kill any creatures when it turns night even if they are in combat.
  • SH00 - Only spawn at midnight.
  • SH00T01 - Only spawn during midnight and 1am.
  • SD01 - Spawn only the first day of the month.
  • SD01T03 - Spawn only between the first and third days of the month.
  • TM02 - Delay spawn for 2 seconds.
  • TM02M - Delay spawn for 2 minutes.
  • TM02H - Delay spawn for 2 hours.
  • TM10R30 - Random between 10 and 30 seconds.
  • TM10R30M - Random between 10 and 30 minutes.
  • TM10R30H - Random between 10 and 30 hours.
  • NF - Tells the spawn system to NOT bypass the timers on the very first spawn.
  • DS - Wait until all creatures are killed before spawning any more.
  • RT - This switch is only used with PA and will reset the timer on the spawn point if a player is not in the area.

Action Switches

  • RH - Have creatures return to the waypoint when they are not busy.
  • RHF - Have creatures return to the waypoint when they are not busy and face a random direction.
  • RW - Walk randomly around. Location does not matter.
  • RW10 - Walk within a 10 meter radius of the spawn point.
  • AN01 - The creature will play animation 01.
  • AN15L10 - The creature will loop animation 15 for 10 seconds.
  • RF - This switch gives the creature a 50% chance of facing a random direction every heartbeat.
  • FA- Forces creatures to attack the player that triggered the spawn as soon as they spawn.

Effect Switches

  • AE01 - Will produce Area Effect 01 throughout a 5 meter radius of the spawn point.
  • AE01R10 - Will produce Area Effect 01 throughout a 10 meter radius.
  • VS01 - Tells the spawner to use effect 01 on the location before spawning.
  • VK01 - Same as above, except it happens when the spawner kills a creature due to it not being a valid spawn time.
  • TP01 - Use trap 01.
  • TP01A01 - Amulet 01 protects against the trap.

Note: If a tag of effect is used for the waypoint, it will only do the effect.

  • TDR1d2 - Random chance of disarming a spawned object that is trapped.

    Note: If a tag of effect is used for the waypoint, it will only do the effect.<


    3rd-Party Switches

      Jaga's Area Transition Script

    • DZ - Tells the spawner not to zone any creatures spawned from this location.
    • jwvanderbeck's Item Manager

    • CC - This switch is to use creature corpses for loot rather than generic loot bags upon creature death.
    • CU - Used to determine whether to clean up items on the ground around the spawn point.
    • PU10 - Give the creatures a 10 percent chance to pick up any items within 5 meters.
    • AI - When specified, all creatures spawned at the spawnpoint will intelligently autoequip any items in their inventory when they first spawn.
    • PK - Only have the creatures drop loot if a player kills them.
    • SC10 - The creature will look within a 10 meter radius for a chair to sit in.

    Switches

    Switch Quick Reference |Spawn Switches | Item Related Switches | Random Switches | Time Switches
    Action Switches | Effect Switches | 3rd-Party Switches

    Switches tell the Spawn Point how to control the spawn. This ranges from telling it to spawn a random amount, to telling it to only spawn during the day or between 2:00pm and 3:00pm. For more information on using the switches, please read the section called Frequently Asked Questions, which can be found following below.


    Spawn Switches

    SP_
    Tells the Spawn Control Object that this Waypoint is a Spawn Point.

    IDnn
    Sets the ID of the spawn point to nn. This is used for controlling the spawn point through outside triggers.

    CHnn
    Tells the spawner to spawn Champion nn at the spawn point. If R is specified and a valid roll is used, it will give the Champion a random chance of appearing.

    Examples:

    • CH01 - Always spawn Champion 01 when all the creatures are dead.
    • CH01R1d4 - The Champion has a 1 in 4 chance of spawning when all the creatures are dead.
    • CH01R2d8 - The Champion has a 1 in 16 chance of spawning when all the creatures are dead.

    Valid rolls are:

    • nd2
    • nd3
    • nd4
    • nd6
    • nd8
    • nd10
    • nd12
    • nd20
    • nd100

    Champions are added by adding them to the list of Champions in the code. You can find the list around line 826 and it looks like:

    	SetLocalString(OBJECT_SELF, "champ01", "NW_ORCWIZB");
    

    So to add a Deer Champion you would make a new line:

    	SetLocalString(OBJECT_SELF, "champ02", "NW_DEER");
    

    Now you can make a Deer Champion appear by adding the switch CH02 to your spawn point. :) You can use any valid tag or you can create your own creature, but please follow the guide lines for creating custom creatures as mentioned throughout this thread.

    CR
    Used with CH and EX. If used it will only spawn the Champion at the remote location.

    SS
    Stops Spawn when all creatures are killed at spawn point.

    NOTE: ALL creatures must be killed. The spawn point will continue to spawn until it finds no creatures at the spawn point.

    RDnn
    Only spawn creatures if a Player is within "nn" meters.

    Examples:

    • RD10 - Only spawn if a player is within 10 meters. Kill the creatures when a player leaves the radius, unless the creatures are in combat.
    • RD10X - Only spawn if a player is within 10 meters. Kill the creatures when a player leaves the radius.
    • RD10N - Do NOT spawn if a player is within 10 meters.
    • RD101d4 - If a player is within 10 meters, roll and give the spawn point a 1 in 4 chance of spawning.

    IC
    Do not spawn when a player enters the radius and is already in combat. Used with RD.

    SXnnRyy
    Keep "nn" creatures spawned at this Spawn Point. If R is specified, it spawns a random number of creatures between nn and yy.

    Examples:

    • SX02 - Keep 2 creatures spawned.
    • SX01R10 - Spawn a random amount between 1 and 10.

    NOTE: nn is the MINIMUM you want. If you specify 01 as the minimum, it will not spawn anymore until they are ALL dead.

    CPnn
    Spawn a creature camp.

    Example:

    • CP01 - Will place the objects listed in camp01 in random locations around the site.

    Camp items can be added by including them in the Camp List. The list can be found around line 818 of the code and look like:

    	SetLocalString(OBJECT_SELF, "camp01_tag_1",    "FlyCladCorpseWagon");
    	SetLocalString(OBJECT_SELF, "camp01_resref_1", "plc_fcrpsewagon");
    

    To add a second object to Group 01 you would first place the object in your area and get the Tag and Blueprint off the object, then delete it. Now create a new entry like:

    	SetLocalString(OBJECT_SELF, "camp01_tag_2",    "MyObjectsTag");
    	SetLocalString(OBJECT_SELF, "camp01_resref_2", "myobjectsblueprint");
    

    Replace MyObjectsTag with the tag of your object. Replace the blueprint as well.

    GP
    Spawn a group of creatures using the default group templates. These can be customized if you so desire. :)

    NOTE: The SX tag is not used when spawning groups without the GR switch.

    Examples

    	Name: SP_GP
    	Tag: Group01
    

    The Group List can be found around line 800 and looks like:

    	SetLocalString(OBJECT_SELF, "group01_1", "NW_SKELETON");
    	SetLocalString(OBJECT_SELF, "group01_2", "NW_LICH003");
    

    To add new creatures to the groups, just use their Tag. You can add as many groups and creatures as you like :)

    TR
    Spawns any valid Placeable (used for treasure chests).

    Note: Please read "Spawning Treasure Chests" or the "UO Style Spawn System v2.1 - Spawning Treasure Chests" thread for more information on how to make a treasure chest if you are not familiar with creating treasure chests.

    EXnn
    Tells the spawner to spawn at remote location nn.

    Example:

    	Spawn Point Name: SP_EX01
    	Remote Waypoint Name: XX_01
    

    In the above example, the spawn point would spawn at a remotely placed waypoint. All remote location waypoint names must be in the format XX_nn.

    PA
    If specified, the spawn point will only spawn if a player is in the area.

    DXnn
    This switch tells the creatures to walk to a remote site before despawning. This is triggered by RD, NT, DT, etc.

    Examples:

    	Remote Site
    	Name: XX_01
    	Tag: DoesNotMatter
    
    	Spawn Point
    	Name: SP_NT_DX01
    	Tag: NW_SKELETON
    

    In the above, the skeleton will walk to Remote Site 1 when it turns day and then despawn.

    KTnn
    Kill all creatures on the specified Day or Hour.

    Examples:

    • KT01H - Kill at 1am.
    • KT01D - Kill on 1st day of the month.

    Back to Switches List


    Item Related Switches

    CI
    Creates an item on creatures spawned.

    Examples:

    • CI01 - Creates Item 01 from the Item List and places it on all creatures
    • CI01R1d2 - Each creature has a 50/50 chance of receiving the item

    The CI switch uses the same random call as the Champion Spawner. Please see list in the description of the Champion switch.

    IG *
    Informs the spawner to create an item out of a group. If used it will use the group number specified by CI. If an R is used, it will grab a random item from the group.

    Examples:

    • IG - Give all items out of group 01.
    • IGR - Choose a random item from the group.

    PI
    Tells the spawner to spawn or not to spawn based on whether the player has an item. PI must be used with RD.

    Examples:

    • PI01 - Player must have Item 01 in their inventory in order for this spawn site to spawn
    • PI01X - Player must NOT have Item 01 in their inventory in order for this spawn site to spawn

    GTnn
    Generate treasure. If specified it will generate treasure on the creatures that are spawned. If a roll is given using the same format as CI, there is only a chance of receiving loot. This uses the GenerateTreasure function found in the default NW_O2_CONINCLUDE file.

    Valid types are:

    • GT01 - Generate low treasure
    • GT02 - Generate medium treasure
    • GT03 - Generate high treasure
    • GT04 - Generate boss treasure
    • GT05 - Generate book treasure

    Back to Switches List


    Random Switches

    SRnn
    Spawn creatures in a random location within "nn" meters.

    NP
    When used with SR, it spawns in random locations near the closest player to the spawn point.

    GR
    Spawn a random creature from the specified group. When used with the SX switch it will spawn up to "nn" random creatures from the specified group.

    Example:

    	Name: SP_SX03_GP_GR
    	Tag: Group01
    

    Back to Switches List


    Time Switches

    NTX
    Only spawn during the night and kill any creatures left when it turns day, unless they are in combat. If an X is specified it will kill the creatures even if they are in combat.

    DTX
    Only spawn during the day and kill any creatures left when it turns night, unless they are in combat. If an X is specified it will kill the creatures even if they are in combat.

    SHnnTyy
    Spawn only at nn hour of the day. This is in 24 hour format. If T is specified it will spawn between the hours of nn and yy.

    Examples:

    • SH23 - Spawn only while it is 11pm
    • SH00 - Spawn only while it is midnight
    • SH01 - Spawn only while it is 1am
    • SH01T03 - Spawn only between 1am and 3am

    SDnnTyy
    Spawn only on nn day of the month. If T is specified it will only spawn between the days of nn and yy.

    Examples:

    • SD01 - Spawn only the first day of the month
    • SD01T03 - Spawn only between the first and third days of the month

    TMxxRyy
    Delay spawns by "xx" seconds. Specify Minutes by adding the M on the end or specify Hours by adding a H. Use R to generate a random number between xx and yy.

    Examples:

    • TM02 - Delay spawn for 2 seconds
    • TM02M - Delay spawn for 2 minutes
    • TM02H - Delay spawn for 2 hours
    • TM10R30 - Random between 10 and 30 seconds
    • TM10R30M - Random between 10 and 30 minutes
    • TM10R30H - Random between 10 and 30 hours

    NF
    When used with the timers it tells the spawn system to NOT bypass the timers on the very first spawn.

    DS
    Wait until all creatures are killed before spawning any more.

    RT
    This switch is only used with PA and will reset the timer on the spawn point if a player is not in the area.

    Back to Switches List


    Action Switches

    RHF
    RH tells all creatures to return home (to the waypoint) if they are not in the middle of something. If an F is used, the creature will face the direction of the waypoint when it returns.

    RWnn
    If specified, the creature will walk randomly around after spawning.

    Examples:

    • RW - Walk randomly around. Location does not matter
    • RW10 - Walk within a 10 meter radius of the spawn point

    ANnnLyy
    Used with RW, this switch gives the creature a 50% chance to play an animation when they are not walking. Using L will have it loop the animation for yy seconds.

    Examples:

    • AN01 - The creature will play animation 01
    • AN15L10 - The creature will loop animation 15 for 10 seconds

    A list of animations can be found around line 331 of the script.

    RF
    This switch gives the creature a 50% chance of facing a random direction every heartbeat.

    FA - This switch will force all spawned creatures to attack the first Player that triggers the spawn through RD. This will bypass the initial wait for Perception.

    Back to Switches List


    Effect Switches

    AEnnRyy
    This will produce the Area Effect nn throughout a 5 meter radius of the spawn point. If R is used it will make the effect throughout the radius yy. The location is random.

    Examples:

    • AE01 - Will produce Area Effect 01 throughout a 5 meter radius of the spawn point
    • AE01R10 - Will produce Area Effect 01 throughout a 10 meter radius

    Effects can be found around line 1215 of the script. This is work in progress and I have not had a chance to go through all of the effects in NWN. :)

    VSnn
    Tells the spawner to use effect nn on the location before spawning.

    Valid effects are:

    • 01 - VFX_FNF_SUMMON_MONSTER_1
    • 02 - VFX_FNF_SUMMON_MONSTER_2
    • 03 - VFX_FNF_SUMMON_MONSTER_3
    • 04 - VFX_FNF_SUMMON_UNDEAD
    • 05 - VFX_FNF_SUNBEAM
    • 06 - VFX_FNF_WAIL_O_BANSHEES
    • 07 - VFX_FNF_STORM
    • 08 - VFX_FNF_STRIKE_HOLY
    • 09 - VFX_FNF_IMPLOSION

    VKnn
    Same as above, except it happens when the spawner kills a creature due to it not being a valid spawn time. Example would be if it turned night and the creature is suppose to only spawn during the day. :)

    Effects for spawning can be found around line 677 of the script, effects for killing can be found around line 565.

    TPnnAyy
    Use trap nn at the spawn point. This works with creature spawns. If A is specified and an amulet is listed in the amulet section, whoever is wearing it will not be affected.

    Examples:

    • TP01 - Use trap 01
    • TP01A01 - Amulet 01 protects against the trap
    • TP01A02 - Amulet 02 protects against the trap
    • Traps are "Damage Effects" with a visual effect applied to the target

    Traps can be found around line 1173 and Amulets around line 1193.

    Note: If a tag of effect is used for the waypoint, it will only do the effect.

    Back to Switches List

    TD
    Random chance of disarming a spawned object that is trapped.

    ]Example

    • TDR1d2 - Random chance of disarming a trpped object.

    Note: If a tag of effect is used for the waypoint, it will only do the effect.


    3rd-Party Switches

    Jaga's Area Transition Script

    • DZ
      Tells the spawner not to zone any creatures spawned from this location.

    jwvanderbeck's Item Manager

    • CC
      This switch is to use creature corpses for loot rather than generic loot bags upon creature death.
    • CU
      Used to determine whether to clean up items on the ground around the spawn point.
    • PUnn
      When used the creature has a nn percent chance to pick up any items within 5 meters.
    • AI
      When specified, all creatures spawned at the spawnpoint will intelligently autoequip any items in their inventory when they first spawn.
    • PK
      Only have the creatures drop loot if a player kills them.
    • SCnn
      The creature will look within a nn radius for a chair to sit in.

    Back to Scripts List | Back to Top

    Advanced Usage

    Wars | Boss Monsters | Destroying an Army | Creating Custom Groups | Creating Custom Groups Include Files
    The Poisonous Fog | Camp Sites | Controlling the Spawn through Triggers

    This section will be used to describe a few things that are possible to do using this script. It is by no means a complete description, as the minds of humans tend to come up with neat and brilliant ideas all their own :)

    Wars

    By strategically placing waypoints and setting them to spawn at different times and with different amounts of creatures, you can easily simulate a war between rival groups. A few people have mentioned to me that they have setup waypoints using timers of minutes and hours and each one being placed in different parts of the map. What this allows is a few creatures to spawn and start randomly walking. If they happen to see an enemy, they run after them. They may even call for help, which would draw more creatures into the battle. Since there are timers set, when the creatures die they wait a while before spawning and thus the battle is won or lost for a while.... until another spawns in another place and happens into a section of the map patrolled by their enemy :)

    Back to Advanced List


    Boss Monsters

    You can setup creatures to only spawn at certain times of the day, which allows for setting a quest that may have a person go to a particular place at a certain time. By setting a radius option and a hour option on the waypoint, the creature would only spawn if the player got within a certain radius at a certain time. The following example would only spawn between the hours of 1pm and 2pm and only if the player was within 20 meters. By adding a RS05 and a NP, you could have the creature spawn within 5 meters of the player :)

    Example Waypoint:

    	Name: SP_RD20_SH13T14
    	Tag: CustBossMonster

    Back to Advanced List


    Destroying an Army...or not

    The SS switch is designed so that you can tell the spawn point not to spawn after all creatures are killed. By using this, no more creatures would spawn until the module is reset, or you set the local variable SpawnDestroyed on the waypoint through another script. One example would be having a group of players be able to destroy a group of monsters, but after talking with the Evil Mage they find out that the army is in fact still alive! Just have the Evil Mage set the LocalInt for the Waypoint back to 0 during the Conversation.

    Back to Advanced List


    Creating Custom Groups

    You can add any valid creatures tag into the Group section of the script and create your own groups. The group feature uses Tags just like the Waypoint does. If your spawning badgers that might be a good place to look :) Groups can be found around line 430 in the script and look like:

    	SetLocalString(OBJECT_SELF, "group01_1", "NW_SKELETON");
    	SetLocalString(OBJECT_SELF, "group01_2", "NW_LICH003");
    

    In order to add more creatures to a group or to create a new group, just add the appropriate Tag for the creature and give it a valid group. The groups or formatted like:

    	groupGroup Number_Creature Number
    

    So to add a ghoul to the group above as the third creature:

    	
    	SetLocalString(OBJECT_SELF, "group01_3", "NW_GHOUL");
    

    Back to Advanced List


    Creating Custom Groups Include Files

    By jwvanderbeck

    • Start the NWN Toolset
    • Load up your module
    • Open the scritp editor (Tools -> Script Editor)
    • Delete all the lines you see in the window
    • Type in the code shown below
    	[nwscript]
    	void RegisterGroups()
    	{
         	SetLocalString(OBJECT_SELF, "group03_1", "NW_ORCA");
         	SetLocalString(OBJECT_SELF, "group03_2", "NW_ORCB");
         	SetLocalString(OBJECT_SELF, "group03_3", "NW_OrcChiefA");
         	SetLocalString(OBJECT_SELF, "group03_4", "NW_ORCCHIEFB");
         	SetLocalString(OBJECT_SELF, "group03_5", "NW_ORCWIZA");
         	SetLocalString(OBJECT_SELF, "group03_6", "NW_ORCWIZB");
    	}
    	[/nwscript]
    
    • Save the script under whatever name you want
    • Open the NWN Spawner Script
    • Look for the line just after the comments (around line 779) that reads: #include "NW_O2_CONINCLUDE"
    • After that line, insert a line that reads: #include "YourScript"
    • Replacing "YourScript" with the name of your script you just created
    • Go to approximately line 879 in the NWN Spawner code and add the line of code as shown below
    	[nwscript]
    	void main()
    	{
      	// Setup Group, Champion, Item and Camp vars
      	//
      	if (!GetLocalInt(OBJECT_SELF, "ModInit")) {
        	sp_ModInit();
        	RegisterGroups(); // <--- Add this line *********************
      	}
    	[/nwscript]
    

    Now you're done.. Save and compile the NWN Spawner Script.

    To modify your groups, simply edit the section in the new script you created. When new versions of the script come out, simply re-add the 2 lines of code shows (The #INCLUDE line, and the RegisterGroups line).

    Back to Advanced List


    The Poisonous Fog

    This script comes predefined with a few different types of Traps. These are designed so that when a player enters the radius of the spawn point, it hits them for damage and adds a visual effect on them every heartbeat. You can design your own Amulets that they can put on to protect them... if they have it :) Adding a trap is as easy as finding the effect you want and changing the trap in the script to use that effect or just add multiple traps :) Amulets are made by creating a custom object and placing its tag in the trap section of the code. The Traps can be found around line 1279 of the script and look like:

    Case 01:

    	
    	eDamage = EffectDamage(d4(), DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
    	eEffect = EffectVisualEffect (VFX_FNF_GAS_EXPLOSION_NATURE);
    	sDamageCause = "You have stumbled into a poisonous fog.";
    break;
    

    eDamage is the type of damage and how hard it is going to hit. eEffect is the visual effect that will be applied to the target such as the above gas cloud. sDamageCause is what will be sent to the player to let them know why they are getting hurt :)

    Back to Advanced List


    Camp Sites

    What monster camp would be good without a campfire or an impaled human corpse being around? By adding objects into the Camp section you can have as many different types of settings for your spawns as you like. Be careful though, some objects are flaky and might end up on top of each other. I have tested many of them, but some just won't work with others. The Camp section can be found around line 450 of the script and looks like:

    	SetLocalString(OBJECT_SELF, "camp01_tag_1",    "FlyCladCorpseWagon");
    	SetLocalString(OBJECT_SELF, "camp01_resref_1", "plc_fcrpsewagon");
    

    Both of these lines belong to the same object. In order to add new objects you must first place the object in a test area, look at its properties and grab the Tag and ResRef from it. You cannot use the resref that is shown in the object list.

    Back to Advanced List


    Controlling the Spawn through Triggers

    All of the rules for a spawn site can be modified through setting certain variables. In order to do this you must first give the spawn site a unique label. This label is called the ID and is specified by:

    Spawn Point:

    	Name: SP_ID01
    	Tag: creatures tag/resref
    

    In order to get the object and change any of the rules, all you need to do is use the following in a script.

    	object oSpawner = GetLocalObject(GetModule(), "Spawner1");
    

    When using the ID switch you must specify it in 2 digits, such as 01, 02, 09, 10. When getting the object, just use single digits, such as Spawner1, Spawner2.

    Examples:

    Kill off all the spawn and stop a spawn point by adding the following to the OnDeath of another creature, OnUse of an object or whatever.

    	SetLocalInt(GetLocalObject(GetModule(), "Spawner1"), "KillSpawn", 1);
    

    Please note that I did not assign it to an object first :) It is easier to call it directly, unless you are making a bunch of changes.

    To activate the spawn point again just use the following:

    	DeleteLocalInt(GetLocalObject(GetModule(), "Spawner1"), "SpawnDestroyed");
    	DeleteLocalInt(GetLocalObject(GetModule(), "Spawner1"), "KillSpawn");
    

    To change what creature is spawned:

    	SetLocalString(GetLocalObject(GetModule(), "Spawner1"), "Blueprint", "NewCreature");
    

    Back to Top

    Back to Advanced List | Back to Top

    Troubleshooting

    This section will address common issues that you may have while trying to setup your area.


    Question:
    When I try to compile the script it gives me errors :(

    Answer:
    Before you paste the script into the OnHeartbeat of the invisible item you need to take out the existing lines shown below:

    	
    	void main()
    	{
    	}
    

    Remove those and then paste the script in.


    Question:
    When I create a custom creature and put it on a waypoint to spawn, it keeps spawning over and over and over and I get a TON of them!

    Answer:
    You need to make sure that the Tag of the creature you put on the waypoint does not have a typo in it and make sure it matches the creature you want to spawn. Having a mistyped tag will cause this every time.

    Example:

    	
    	Creature Tag: Skeleton001
    	Creature ResRef: skeleton001
    
    	Waypoint Name: SP_SX02
    	Waypoint Tag: skeleton001
    

    They look the same, but it is case sensitive and so it will spawn since it is a valid resref, but the spawn point can never find the creature since the tag does not match. If it cannot find the creature it will think it is missing it and so spawn again.

    When creating a custom creature give it a descriptive name inside the Creature Wizard and then go back in and edit it and change the name to what you want. The name given to it during the Wizard will be used by the toolset to assign a Tag and Blueprint.

    Example:
    Create a custom skeleton and give it the name weakskel001 during the Wizard. The finished info will look like:

    	Creature Name: weakskel001
    	Creature Tag: weakskel001
    	Creature ResRef: weakskel001

    Now go in the Custom section of the creature list where you placed it and edit it. Change the name to a weak skeleton and you will now have:

    	Creature Name: a weak skeleton
    	Creature Tag: weakskel001
    	Creature ResRef: weakskel001

    You can use weakskel001 without having to worry :)


    Question:
    I setup a waypoint exactly like you said but all I get is badgers :(

    Answer:
    The single cause for badgers is an invalid blueprint. Use the above solution to check the blueprint and make sure it matches the tag of your waypoint. This only applies to custom created creatures.


    Question:
    I am experiencing huge lag in my module after setting up only a few waypoints!

    Answer:
    This would be caused by not having a valid blueprint in the tag of one of your waypoints you setup for a custom creature, or by having a typo :) If NWN cannot find the blueprint you specify it will create a badger. If you have a waypoint setup to spawn 4 creatures, within a minute you will have a ton of badgers :)


    Question:
    I setup a camp with a radius and when the player leaves the radius the creatures go away but the camp items stay (or never appear).

    Answer:
    You need to first place the object somewhere and grab the Tag and ResRef off that item, then delete it. If you use the information from the Placeables List it will not work.

    Back to Top

    Frequently Asked Questions

    This section contains common usage questions.


    Question:
    How can I make my spawn point only spawn a couple of the same creatures and always have them there. If one of them dies I want it to come right back.

    Answer:
    If it is a Default NWN creature all you need to do is look in the creature list and look at the properties of the creature you want to spawn and grab the Tag. Create a Waypoint where you want the creatures to spawn. Let us pretend the creatures you want to spawn are the default dog. Setup a waypoint as follows:

    	Name: SP_SX02
    	Tag: NW_DOG
    

    The SX02 tells it to keep two of the creatures there. NW_DOG is the tag of the default NWN dog.


    Question:

    What if I want the dogs to walk around randomly after they spawn?

    Answer:
    Change the name of the waypoint to:

    	Name: SP_SX02_RW
    

    The RW switch tells it to make any creatures it controls walk around randomly when they are not talking or fighting.


    Question:
    How about having a couple of skeletons that only come out at night?

    Answer:
    Setup a waypoint with the following information:

    	Name: SP_SX02_NT
    	Tag: NW_SKELETON
    

    The NT switch tells it to only spawn at night.


    Question:
    Could I add another spawn point there with a tougher creature and have it only spawn when it is midnight?

    Answer:
    Sure. Use the following:

    	Name: SP_SX01_SH00
    

    The SH00 tells it to only spawn at 00:00 in 24 hour format, which is midnight.


    Question:
    What about a whole undead group?

    Answer:
    Yep! The script comes distributed with 2 predefined Groups. Group 01 is an undead group. Setup a waypoint with the following settings:

    	Name: SP_GP
    	Tag: Group01
    

    The switch GP tells it to spawn all of the creatures listed in Group 01.


    Question:
    What if I only want 3 random creatures from that group?

    Answer:
    Change the waypoint to:

    	Name: SP_SX03_GP_GR
    	Tag: Group01

    The GR switch tells it to choose random creatures from the group.


    Question:
    Can I check to see if the player has a certain item and spawn/not spawn based on that?

    Answer:
    Sure! You can use the PI switch to do just that. Use the following to check the item 01 in the Item List of the script and spawn if they have it:

    	Name: SP_PI01
    

    Or the following to not spawn if they have it:

    	Name: SP_PI01X
    

    Question:: My creatures look bored when they aren't walking around randomly. Can I do anything about that?

    Answer:: You can use the switch AN to make them play an animation when they aren't busy.

    	SP_AN01
    

    Or to loop animation 15 for 10 seconds:

    	SP_AN15L10
    

    For more information about each switch, please read the section entitled Switches, or feel free to post your question to the Forum Discussion Topic.

    Back to Top

    Companion Scripts & Tools

    NWNSS Helper App - A NWNSS Companion Application
    Created by Retina

    This is a small program to help make proper names for waypoints used with NWN Spawn System.

    Area Control System v2.1.1 - A NWNSS Companion Script
    Created by jwvanderbeck

    Item Manager is a script that works alongside the NWN Style Spawn system to provide many of the rudimentary item management needs of any persistent or semi-persistent world module. It can also be used stand-alone without NWNSS if desired.

    Spawner System Switch Helper Application
    Created by DrEvil

    Uses a java page to setup all the tags for you. All you do is fill out what you want a certain spawn site to do and it generates the command line that needs to be used.

    If you know of addition companion scripts please let us know.

    Back to Top

    References

    The latest Builders - NWN Scripting threads on the BioWare forums for the NWN Spawn System are:

    Discussion thread:
    "NWN Spawn System v2.3.7 through 2.4" or http://nwn.bioware.com/forums/viewtopic.html?topic=116832&forum=47

    Feature Requests:
    "NWN Spawn System - Feature Requests" or http://nwn.bioware.com/forums/myviewtopic.html?topic=107514&forum=47

    NWN Spawn System - Usage Scenarios

    Related Scripts/Programs/Topic Threads

    jwvanderbeck's Area Control System

    Retina's NWNSS Helper App

    Back to Top

    Feature Requests

    I would say around 75-80% of this script is all community suggested features. This script is made for the community and your feedback helps to shape it and defines what features are added, removed or adjusted.

    If you have an idea that you think would make a good feature, or even just be cool, please let me know. I am constantly working on the script and I am more than happy to add any feature that would make this script even better.

    We currently have a thread setup strictly for feature requests. This enables me to be able to keep track of what people want and who requested it (so they get credit). If you have a suggestion, please feel free to visit this thread and let us know :)

    If you have a problem with a feature that is not listed in the Troubleshooting section, please post about it. Bug tracking is the top priority and finding them naster critters and getting rid of them is very important :)

    I hope you enjoy using this script and look forward to releasing even better features in upcoming versions!

    The history of the script

    The following are topics that were used for different versions.

    -Palor

    Back to Top




  • This site best viewed in Internet Explorer.
     
    ©2002, Stratics. All rights reserved.
    Maintained by: Neverwinter Nights Stratics Staff
    Last modified: June 22 2002