Neverwinter Vault

Expand AllContract All -Site -My Profile -Features

Neverwinter Nights 2

-NWN2 Files -NWN2 Game Info -NWN2 Resources -NWN2 Community

Neverwinter Nights

-NWN Files -NWN Game Info -NWN Resources -NWN Community

Vault Network
RPG Vault
VN Boards
IGN Vault
Vault Wiki
· Age of Conan
· Anarchy Online
· Asheron's Call
· Dark Age of Camelot
· City of Heroes
· D&D
· EVE Online
· EverQuest
· EverQuest 2
· Final Fantasy
· Guild Wars
· Lineage 2
· Lord of the Rings Online
· Middle Earth
· Neverwinter Nights
· Pirates of the Burning Sea
· Rise of the Argonauts
· Star Wars Galaxies
· Tabula Rasa
· The Matrix Online
· The Witcher
· Titan Quest
· Two Worlds
· Vanguard
· Warhammer
· World of Warcraft

Planet Network
Planet Hub

IGN
Games
Cheats
Entertainment

The Web   The Site  



NWN SCRIPTS

- Jump to comments -
Title  Syrsnein's Random Number Generator
Author  Syrsnein
Submitted / Updated  01-31-2006 / 11-22-2006
Category  Scripting routines
Expansions  Works on all versions
Format  Code Only
Type  Type - Other
Includes  None
Description
I've been told, probably too many times, to stop whining about the crummy Bioware random number function and post one on the vault.
Well, here it is. I get better results using this system than using the native function in NWN. Hope you do too.

Usage:

RandomF(float fMax=1., float fMin=0., int nSeed=0, object oObject=OBJECT_INVALID)
- Returns a float between fMin and fMax

RandomI(int nMax=1, int nMin=0, int nSeed=0, object oObject = OBJECT_INVALID)
- Retruns an integer between nMin and nMax

Parameters:
-Max/Min = the range you want a random number in (including those numbers)
-nSeed = an optional seed value. If not supplied the game clock milliseconds value will be used.
-oObject = an object to store the history buffer on. If an object is not provided, the module will be used.

1 Feb 2006, Fixed a bug in SY_GetRandomSeed that was generating -10 all the time. Thanks to Gale of the DLA for pointing it out.

2 Feb 2006, Optimized a couple of the functions.

Files

NameTypeSizeDownloads
sy_inc_random.erfsy_inc_random.erf
Submitted: 01-31-2006 / Last Updated: 05-24-2006
erf13.27Kb297
Fixed an issue with the max integer value not being generated. (thanks Thurgood).
Modified the math to give better results.
SCORE OUT OF 10
10
7 votes
View Stats
Cast Your Vote!

PORTFOLIO
Add this entry to your portfolio so you can track it
Manage your existing portfolios or create a new one.
SCREENS
No Images




You Must Be Logged In to Participate.
Comments (7):

Posted by Dark Defiance at 2010-09-01 18:01:17    Voted 10.00 on 09/01/10
Indispensable! Thanks for sharing your work.
_________________________
Just because one is Dark, does not make them evil.

Contributor - CCC September - Pirates! | The DM's Burlap Horse

Posted by calsailx at 2009-11-28 17:05:55    Voted 10.00 on 11/28/09
Been using this for a couple of years at least, much happier with what it generates then anything else I've used before or since.
_________________________
TNI01 Usable Beds || TNI02 Useable Beds || TWC03 Usable Beds

Posted by Blasco-Yang at 2008-10-15 19:48:52    Voted 10.00 on 10/15/08
Very nice.

Tested it with a simple recursive function in the OnEnter of an area to generate a new number between 1 and 100 every 2 seconds.

Very random, and deserving of a "10" if you ask me.

My thanks and gratitude to you for making this. The math of it is far beyond my skills, but luckily that's a non issue as long as generous folks like you continue to provide such excellent content.

Posted by Nihlar at 2008-03-21 06:12:19    Voted 10.00 on 03/21/08
Good stuff needs a good rating. This is how it should have been made from the beginning
_________________________
ZORK - Rediscovering the Great Underground Empire
a re-make of the classic ZORK I, for Neverwinter Nights 2
Amraphael's House of Curious Things
My NWN2-blog
_________________________
If you download it, vote for it!

Posted by DLA Gale at 2006-06-03 06:18:52    Voted 10.00 on 06/03/06
Great work, man! And he even said thanks to me for pointing a bug! wow :-)
_________________________
Gale
Lead Tech Designer
DLA Team

Posted by Lisa at 2006-02-01 19:45:58    Voted 10.00 on 02/01/06
Heck, I'm a math professor, how can I not give this a good grade :)

Posted by G@P at 2006-02-01 07:27:55    Voted 10.00 on 02/01/06
Now I can make my random on enter scripts. It's about time someone made a script like this public

You must be Logged In to post comments in this section.

 
Most recent posts on the MMO General Boards
Analyst: Star Wars: The Old Republic Could...Analyst: Star Wars: The Old Republic Could Sell 3M: more numbers
- last reply by Acao on Aug 15, 2011 06:15 PM
which class will your first character be
- last reply by Blisteringballs on Aug 15, 2011 05:50 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 05:00 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 04:00 PM
NWN Idea Database Update
- posted by Vault_News on Aug 15, 2011 03:46 PM
Missing Votes for NWN2 Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:40 PM
Missing Votes for NWN Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:39 PM
Random Questions and game altering suggest...Random Questions and game altering suggestions!!!
- last reply by ArkadyTepes on Aug 15, 2011 03:22 PM
State of the game?
- last reply by LyricOpera on Aug 15, 2011 01:37 PM
Yesterday streaming, now demanding downloa...Yesterday streaming, now demanding download :(
- last reply by Sinane-tk on Aug 15, 2011 10:23 AM
 

   


IGN Entertainment
By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the User Agreement.
Copyright 1996-2011, IGN Entertainment, Inc. | Support | Privacy Policy | User Agreement | RSS Feeds
IGN’s enterprise databases running Oracle, SQL and MySQL are professionally monitored and managed by Pythian Remote DBA.


NWN2 Hall of Fame

HOF NWN2 Prefab Areas


View all Hall of Fame entries


Neverwinter Nights 2

TOP NWN2 Modules

NEW Modules

NEW Reviews

NEW INTL. Modules

TOP Hakpaks

TOP Gameworlds

TOP Tutorials

TOP Prefab:Areas

TOP Blueprints

TOP Plugins

TOP UI

TOP Other

TOP Visual Effects

TOP Scripts

TOP Tools

TOP Movies

TOP Models

TOP Characters





Hall of Fame

HOF NWN Modules


View all Hall of Fame entries


TOP NWN Modules

NEW NWN Modules

NEW Reviews

TOP Intl. Modules

TOP NWN Hakpaks

TOP NWN Gameworlds

TOP NWN Models

TOP NWN Portraits

TOP NWN Scripts

TOP NWN Prefabs

TOP NWN Other

TOP NWN Movies

TOP Sounds

TOP NWN Textures

TOP NWN Creatures

TOP NWN Characters