SenneD Posted March 2, 2012 Share Posted March 2, 2012 Hello, I was playing around with the idea of making some sort of jukebox. I've taken an activator and gave it dialogue trough a quest.This allows me to chose a song to play. In script i've just watched wich stage is set and then let the proper music track play, but it only workds correctly one time...So there must be a mistake in my script but i can't seem to find it. I 'm a noob and this is my fist mod ever so i wrote the script on instinct only ( it could probably be written much easier and better) Plz tell me what it is i do wrong. Here's the script: Scriptname JukeTestSenne extends Quest {Test script voor jukebox project}Quest Property myQuest AutoObjectReference Property Hendel AutoMusictype Property NETE autoMusicType Property NETM autoMusicType[] TestString[] NaamInt CountInt memInt tel Event OnInit() ; This event will run once, when the script is initialized RegisterForUpdate(2) GotoState ("polling")EndEvent State polling Event OnUpdate() Test = new MusicType[5] Naam = new String[5] Naam[0] = "Song 1" Naam[1] = "Song 2" Test[0] = NETE Test[1] = NETM if(myQuest.GetStage() == 20) Debug.Notification("Now playing : " + Naam[mem]) Test[mem].Add() myQuest.Reset() UnregisterForUpdate() GotoState ("active") ; Switch to a state that doesn't use OnUpdate() EndIf if (myQuest.GetStage() == 10) Hendel.Activate(Game.GetPlayer()) Count = 0 While(Count < 5 ) Test[Count].Remove() Count = Count + 1 EndWhile mem = 0 Debug.MessageBox("Now playing: " + Naam[0]) myQuest.SetStage(20) endif if (myQuest.GetStage() == 15) Hendel.Activate(Game.GetPlayer()) Count = 0 While(Count < 5 ) Test[Count].Remove() Count = Count + 1 EndWhile mem = 1 myQuest.SetStage(20) endif EndEventEndState State active ; Do nothing in here EndState Link to comment Share on other sites More sharing options...
Recommended Posts