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