Random int in Package Condition

Post » Fri Jul 05, 2013 5:27 pm

Hi Everyone,

I have about 9 packages, all on like 50 NPC's (I'm using templates). I want these NPC's to choose one of these packages randomly and ignore the package stack.

Basically, I want 50 NPC's to generate 50 random numbers. Each package will have a number assigned to it. Whatever number the NPC picks is the package it runs. After the NPC completes the package, he generates a new number and runs that package, and so on.

I know there is a class called Utility that has a RandomInt function and theres a "GetScriptVariable" but I have no clue how to use that and the creation kit wiki doesn't have any info on it.

Actually, is this even the best way to go about this? I'm not even sure anymore...

User avatar
Laura Richards
 
Posts: 3468
Joined: Mon Aug 28, 2006 4:42 am

Post » Fri Jul 05, 2013 4:11 pm

GetVMQuestVariable or GetVMScriptVariable are the ones people normally use. I didn't even know GetScriptVariable exists. I was all ready to write a script for you involving an array, but then I noticed that AddScriptPackage did not get carried over from Oblivion. Bummer.

So you'll have to use Conditional scripts. GetVMScriptVariable gets conditional variables from scripts attached to ObjectReferences, GetVMQuestVariable gets them from quests. I advise using the former and attaching this script to each of your actor references:

Scriptname RandomPackageScript extends Actor ConditionalInt Property PackageID Auto ConditionalEvent OnInit()	PackageID = Utility.RandomInt(0,8)EndEventEvent OnEvaluatePackage()	OnInit()EndEvent

So the condition would look something like:

GetVMScriptVariable, (the actor's reference), PackageID == 5

...but then you'd also have to create forty-nine copies of your nine packages so you can direct each one to the appropriate actor.

Take away from this what you will.

edit: http://www.creationkit.com/AddScriptPackage is apparently a console command. Maybe you can persuade the SKSE team to expose it?

User avatar
john palmer
 
Posts: 3410
Joined: Fri Jun 22, 2007 8:07 pm


Return to V - Skyrim