Randomize scene in script

Post » Fri Jul 05, 2013 7:21 pm

I have a script which is intended to do the following:

1) When the player gets within a certain distance of an NPC using a marker as part of a normal AI package, a scene will play.

2) I want this behaviour to loop for the duration of the NPC's AI package and as long as the player is in the same cell.

Spoiler
Scriptname MyNPCBlahBlahScript extends ObjectReference ConditionalScene Property MyNPCScene01  Auto ObjectReference Property MyNPCTalkMarker  Autoint Property MyNPCIsTalking  Auto  Conditional Event OnLoad()	RegisterForSingleUpdate(5)EndEventEvent OnUnload()	UnregisterForUpdate()endEventEvent OnUpdate()if MyNPCIsTalking == 0		if GetDistance(MyNPCTalkMarker) <= 300				if Game.GetPlayer().GetDistance(Self) <= 1000 						MyNPCScene01.Start() 						MyNPCIsTalking = 1								endifendifEndEvent

I've tested this in game and everything works. but now I want to do something in addition to this:

1) I want the scene that is selected to play to be completely random, from a selection of say...6 or more scenes

2) I do not want the same scene to repeat right after itself. Also, currently, the scene repeats only because the 'repeat while true' flag is selected. I guess to if I want randomize the scenes played and have that occur continuously, I would need to toggle the 'repeat while true' flag off so they don't loop indefinitely, but then I'd have to find another way to get the scenes to repeat....

Any ideas?

User avatar
Jay Baby
 
Posts: 3369
Joined: Sat Sep 15, 2007 12:43 pm

Post » Fri Jul 05, 2013 7:13 pm

Are the number of phases the same for each scene? If so, put your dialog in stacks in one scene and flag them as random.

User avatar
natalie mccormick
 
Posts: 3415
Joined: Fri Aug 18, 2006 8:36 am

Post » Sat Jul 06, 2013 12:07 am

I thought about that, and I have recycled as many shared info lines as I can, but most of these dialogue lines don't 'mesh' together and can't be randomized (otherwise they would not make sense). They don't all have the same number of phases, and some of them have up to 10 phases of dialogue, so they need to be kept as separate scenes.

User avatar
Abel Vazquez
 
Posts: 3334
Joined: Tue Aug 14, 2007 12:25 am


Return to V - Skyrim