Populate Function 2.81

   (3 reviews)

4 Screenshots

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



User Feedback

Recommended Comments

Just to say that the screenshots are of Shadows of the Empire which is still currently being worked on and is not availbale.

Share this comment


Link to comment
Share on other sites
Guest newbiemodder

Posted

Definitely give this a try TB...should be a really useful tool.

  • Like 1

Share this comment


Link to comment
Share on other sites

beautifull job...more interesting aport

 

 

Do you mean a port for K1. It should work in K1 with no changes. Haven't tested it though.

Share this comment


Link to comment
Share on other sites

Sorry to bring up an old post but I've just found this mod. Where it says: "Populate(20, -28, 21, 69, 121, Tag, TRUE); //This is the bit that does all the spawning" whereabouts does the tag go? Does it replace the word "Tag" in your example, or next to it? Before it? I'm still new to learning writing scripts. 

Say for example I was spawning an alien, I had this: Populate(20, -101.10, 118.09, 69, 95.16, "Alien_Bith_01", TRUE); - but this gives me a long list of errors when I try to compile it. This is for K1 BTW.

Share this comment


Link to comment
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
Add a comment...

×   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.