Jump to content

Need help with a container formlist


jp2x

Recommended Posts

I added the properties and I'm getting music now!

 

The problem is I don't know if the scene actually ends (or if it should). My last phase of the radio scene loops to the first phase. I don't see a debugtrace for the OnSceneEnd, either. The radio plays the same song on repeat, like it selected it with the OnInit but doesn't get any further. That makes sense if the scene doesn't end. I was wondering if I can copy the OnInit code into a function and call that to select a song. Then I don't need to worry about the scene ending or restarting.

 

Regardless, with your great code, I'm confident I can figure this out. I've even bookmarked the "changes to papyrus since Skyrim" wiki page. :) So, don't worry about it if you're busy.

 

Thanks a bunch! You really helped me out of a jam here.

Link to comment
Share on other sites

That's one thing I was asking about. I removed the loop and it selects one song and then goes silent. It doesn't seem to be looping.

 

The script:

 

Scriptname MusiciansModRadio002a extends Quest Conditional

Formlist Property akAllHolotapeList Auto ; A formlist holding all your base Tapes
Int Property CurrentSong Auto Conditional ; use this as the numeric conditional in your Radio Scene
Objectreference Property MusiciansModHolotapeAutoloader Auto ; Your container that the player adds tapes into
Scene Property MusiciansMod01aRadioQuest001SceneA Auto ; the scene that plays the songs


Event OnInit()
Debug.Trace("Event OnInit Started")
Self.RegisterForRemoteEvent(MusiciansMod01aRadioQuest001SceneA, "OnEnd")
; registers this Quest to receive the OnEnd event from the Radio Scene

int tries = 0
CurrentSong = -1
while (tries <= 100 && CurrentSong == -1)
int randomnum = Utility.RandomInt(0, (akAllHolotapeList.GetSize() - 1))
if ( MusiciansModHolotapeAutoloader.GetItemCount(akAllHolotapeList.GetAt(randomnum) ) >= 1)
CurrentSong = randomnum
; CurrentSong now points to a number that corresponds to your tapes in the Formlist
endif
tries += 1
endWhile

Debug.Trace(CurrentSong) ; Output CurrentSong to the log

if (MusiciansMod01aRadioQuest001SceneA.IsPlaying() == false)
MusiciansMod01aRadioQuest001SceneA.Start() ; forces the scene to start if it hasn't already
Debug.Trace("Scene Started")
endif
endEvent


Event Scene.OnEnd(Scene akSender) ; radio has finished playing the song scene here.
Debug.Trace("Event SceneOnEnd Started")
CurrentSong = -1
int tries = 0

while (tries <= 100 && CurrentSong == -1)
int randomnum = Utility.RandomInt(0, (akAllHolotapeList.GetSize() - 1))
if ( MusiciansModHolotapeAutoloader.GetItemCount(akAllHolotapeList.GetAt(randomnum) ) >= 1)
CurrentSong = randomnum
; CurrentSong now points to a number that corresponds to your tapes in the Formlist
endif
tries += 1
endWhile

Debug.Trace(CurrentSong) ; Output CurrentSong to the log

if (MusiciansMod01aRadioQuest001SceneA.IsPlaying() == false)
MusiciansMod01aRadioQuest001SceneA.Start()
Debug.Trace("Scene Started")
endif
endEvent

 

 

This log is from the scene without the loop:

 

 

 

[07/14/2016 - 07:33:14AM] Papyrus log opened (PC-64)
[07/14/2016 - 07:33:14AM] Update budget: 1.200000ms (Extra tasklet budget: 1.200000ms, Load screen budget: 500.000000ms)
[07/14/2016 - 07:33:14AM] Memory page: 128 (min) 512 (max) 153600 (max total)
[07/14/2016 - 07:33:14AM] Maximum stack depth: 100
[07/14/2016 - 07:33:14AM] This is a script log only and does not contain information on any other part of the game, including crashes.
[07/14/2016 - 07:33:31AM] VM is freezing...
[07/14/2016 - 07:33:31AM] VM is frozen
[07/14/2016 - 07:33:31AM] Reverting game...
[07/14/2016 - 07:33:41AM] Loading game...
[07/14/2016 - 07:33:41AM] VM is thawing...
[07/14/2016 - 07:33:41AM] Event OnInit Started
[07/14/2016 - 07:34:24AM] 0
[07/14/2016 - 07:34:24AM] Event OnInit Started
[07/14/2016 - 07:34:24AM] 37
[07/14/2016 - 07:34:27AM] Event SceneOnEnd Started
[07/14/2016 - 07:34:32AM] 37
[07/14/2016 - 07:34:32AM] Scene Started
[07/14/2016 - 07:34:35AM] Event SceneOnEnd Started
[07/14/2016 - 07:34:42AM] 128
[07/14/2016 - 07:34:42AM] Scene Started
[07/14/2016 - 07:34:55AM] Event SceneOnEnd Started
[07/14/2016 - 07:34:55AM] 128
[07/14/2016 - 07:35:14AM] VM is freezing...
[07/14/2016 - 07:35:14AM] VM is frozen
[07/14/2016 - 07:35:14AM] Saving game...
[07/14/2016 - 07:35:14AM] VM is thawing...
[07/14/2016 - 07:35:14AM] VM is freezing...
[07/14/2016 - 07:35:14AM] VM is frozen
[07/14/2016 - 07:35:14AM] Log closed

 

 

 

The numbers are CurrentSong values.

Link to comment
Share on other sites

Ok, I've made a few adjustments to the script, but how many forms / tapes have you put into the Formlist? And can you post a screenshot of how you have the Scene conditions set up?

 

Scriptname MusiciansModRadio002a extends Quest Conditional

Formlist Property akAllHolotapeList Auto  ; A formlist holding all your base Tapes
Int Property CurrentSong Auto Conditional   ; use this as the numeric conditional in your Radio Scene
Objectreference Property MusiciansModHolotapeAutoloader Auto  ; Your container that the player adds tapes into
Scene Property MusiciansMod01aRadioQuest001SceneA Auto   ; the scene that plays the songs


Event OnInit()
    Debug.Trace("Event OnInit Started")       
    Self.RegisterForRemoteEvent(MusiciansMod01aRadioQuest001SceneA, "OnEnd")
    ; registers this Quest to receive the OnEnd event from the Radio Scene
   
    int tries = 0
    CurrentSong = -1
    while (tries <= 100 && CurrentSong == -1)
        int randomnum = Utility.RandomInt(0, (akAllHolotapeList.GetSize() - 1))
        if ( MusiciansModHolotapeAutoloader.GetItemCount(akAllHolotapeList.GetAt(randomnum) ) >= 1)
            CurrentSong = randomnum
            ; CurrentSong now points to a number that corresponds to your tapes in the Formlist
        endif
        tries += 1
    endWhile

	Debug.Trace("OnInit CurrentSong: " + CurrentSong)        ; Output CurrentSong to the log
    
    if (MusiciansMod01aRadioQuest001SceneA.IsPlaying() == false)
        MusiciansMod01aRadioQuest001SceneA.Start()        ; forces the scene to start if it hasn't already
		Debug.Trace("OnInit Scene Started")    
    endif
endEvent


Event Scene.OnEnd(Scene akSender)        ; radio has finished playing the song scene here.
    Debug.Trace("Event SceneOnEnd Started")    
    CurrentSong = -1
    int tries = 0

    while (tries <= 100 && CurrentSong == -1)
        int randomnum = Utility.RandomInt(0, (akAllHolotapeList.GetSize() - 1))
        if ( MusiciansModHolotapeAutoloader.GetItemCount(akAllHolotapeList.GetAt(randomnum) ) >= 1)
            CurrentSong = randomnum
            ; CurrentSong now points to a number that corresponds to your tapes in the Formlist
        endif
        tries += 1
    endWhile
 
    Debug.Trace("OnEnd CurrentSong: " + CurrentSong)        ; Output CurrentSong to the log
   
    if (MusiciansMod01aRadioQuest001SceneA.IsPlaying() == false)
        MusiciansMod01aRadioQuest001SceneA.Start()
		Debug.Trace("OnEnd, Scene Started")    
    endif    
endEvent
Edited by Reneer
Link to comment
Share on other sites

I'm really curious about what's going on here. But, I got it to work by adding the OnEnd contents as a function and calling it on the phase before looping back to phase 1. I'm testing it on XB1 today.

 

If you like, I can still try the new code and remove the loop and see what happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...