Sign in to follow this  
TimBob12

Populate Function

Recommended Posts

index.php?app=downloads&module=display&section=screenshot&id=45

File Name: Populate Function

File Submitter: TimBob12

File Submitted: 02 Apr 2011

File Updated: 13 Apr 2011

File Category: Mods

TSLRCM Compatible: Yes

 

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.

 

Click here to download this file

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this