## About This File

This script will allow you to easily populate an area using random number generation based on your specifications. It eliminates the need to find countless co-ordinates. You only need to find four co-ordinates to populate an area with as many NPCs as you like. (The engine really hates it if you go over 120). You can also choose whether to set them to walk randomly or not. You can use your own waypoints. I reccommend using this function in an on enter script.

-----------------------------

Installation and use

-----------------------------

You need to place the "populate.nss" script in your K2 Override. (This will probably work with K1 but I cannot confirm that). To use the function add the line

#include "populate"

at the beginning of your script.

Then you will need to lay an imaginary square over the area where you want to spawn in. Then find the co-ordinates of the four corners using D3's Whereami armband. Write down what you get and work out the smallest X value and the largest X Value and then do the same with the Y Co-ordinates. Then include this in the main function of your script.

Populate(0, 0, 0, 0, 0, Tag);

^ ^ ^ ^ ^ ^

Amount xMin xMax yMin yMax Tag

Amount = The number of NPCs of the specified tag to spawn.

xMin = The smallest X value

xMax = The largest X Value

yMin = The smallest Y Value

yMax = The largest Y Value

Tag = The tag of the NPC you want to spawn.

-----------------------------

Use and distribution

-----------------------------

Feel free to use this in any mod at all. If you wish to modify the script then feel free to but LEAVE THE RANDOM NUMBER GENERATION FUNCTION IN TACT. It was not created by me and is essential to the smooth running of the populate function. If you modify the script and want to distribute it then please contact me first through either Holowan Labs or Deadly Stream - TimBob12 or by email - timbothompson@gmail.com. If you do redistribute then you will be required to credit bead-v for the creation of the random number generation script.

-----------------------------

Extra's

-----------------------------

There is an additional random generation script that was created by bead-v and, unlike the in game function, it supports negative numbers making it perfect for location generation.

-----------------------------

Credits

-----------------------------

The populate function and example script were created by me, TimBob12 and the random number generation script was created by bead-v. I'd also like to thank everyone who helped in the creation of this function specifically:

Darth Insidious

Varsity Puppet

Bead-V

-----------------------------

A Final Note

-----------------------------

I hope this eases your Module Creation and you enjoy using this.

## What's New in Version 2.81

Released

- 2.81 Minor Bug Fix
- 2.8 Removed the ability to set whether NPCs walk or not as it was causing issues. NPCs now walk randomly as default. Will add this feature when fixed.
- 2.7 Added the ability to set whether NPC randomly walks or not.
- 2.5 Fixed Random Walking

## Recommended Comments

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.