Jump to content

Script help


SenneD

Recommended Posts

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 Auto

ObjectReference Property Hendel Auto

Musictype Property NETE auto

MusicType Property NETM auto

MusicType[] Test

String[] Naam

Int Count

Int mem

Int 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

 

 

EndEvent

EndState

 

State active

; Do nothing in here

EndState

Link to comment
Share on other sites

  • Recently Browsing   0 members

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