Jump to content

Wanted: Script for playing music.


Darkside_500

Recommended Posts

Hi, I dont want to waste anyone's time so Ill cut right to the chase. I need someone who can write a script for me that will play music when the PC enters the cell "The Straight Arrow". If anyone can write this script for me it would be greatly appreciated.

 

It is needed for my upcoming mod "SoulHeight: Flying City"

 

If you are willing to write this script for me, please either respond here of email me at [email protected].

 

Thanks.

Link to comment
Share on other sites

Replace MP3 name and path where necessary. This should be a startscript.

 

Length Should be the length of the MP3. Set BlankTime to the amount of time there will be at the end of the MP3 where there is no music (should be greater than a second and a half).

 

BP1, BP2, and BP3 should be the starting point of the first, second, and third times where the music dies down a bit -- if they exist at all -- respectively. BP1E, BP2E, and BP3E should be the ending points of these moments. The time between BP* and BP*E should be where the music can safely change to another MP3.

 

For this to work, you must create a global (Short, starting value = 0) named BarFight (rename and replace within the script following this one to accomodate naming conventions).

 

Begin BarMusic

Short State
Short UseBreakPoints
Set UseBreakpoints to 1
;Whether or not breakpoints should be used.
Float Length
Set Length to 278.24
Float BP1
Set BP1 to 52.10
Float BP1E
Set BP1E to 52.80
Float BP2
Set BP2 to 120.32
Float BP2E
Set BP2E to 122.05
Float BP3
Set BP3 to ( 2 * Length )
;Copy this to BP2 if there is only one breakpoint and BP1 (in addition to BP2) if you don't want to use breakpoints, but rather transition at the end of the MP3.  If you want to transfer over in medias muzakus, set UseBreakPoints false.
Float BP3E
Set BP3E to 0
;Doesn't matter, if you aren't using the third breakpoint.
Float BlankTime
Set BlankTime to 2
Float Timer
Float BTResult
Set BTResult to ( Length - BlankTime )
Short Wait

If ( Wait )
 If ( BarFight > 0 )
   Return
 Else
   Set Wait to 0
 EndIf
EndIf

If ( BarFight > 0 )
 Set State to 3
ElseIf ( GetPCCell "The Straight Arrow" )
 If ( State == 0 )
   StreamMusic "SoulHeight\StraightArrow.mp3"
   Set State to 1
   Set Timer to 0
 ElseIf ( Timer >= BTResult )
   StreamMusic "SoulHeight\StraightArrow.mp3"
   Set Timer to 0
 Else
   Set Timer to ( Timer + GetSecondsPassed )
 EndIf
 Return
ElseIf ( State == 1 )
 If ( UseBreakPoints )
   If ( Timer <= BP1 )
     If ( Timer >= BP1E )
       Set State to 2
     EndIf
   ElseIf ( Timer <= BP2 )
     If ( Timer >= BP2E )
       Set State to 2
     EndIf
   ElseIf ( Timer <= BP3 )
     If ( Timer >= BP3E )
       Set State to 2
     EndIf
   ElseIf ( Timer >= Length )
     Set Timer to 0
     Set State to 0
   Else
     Set Timer to ( Timer + GetSecondsPassed )
   EndIf
 Else
   Set State to 2
 EndIf
 Return
EndIf

If ( State == 2 )
 If ( Random100 < 25 )
   StreamMusic "Explore\mx_explore_1.mp3"
 ElseIf ( Random100 < 50 )
   StreamMusic "Explore\mx_explore_2.mp3"
 ElseIf ( Random100 < 75 )
   StreamMusic "Explore\mx_explore_3.mp3"
 Else
   StreamMusic "Explore\mx_explore_4.mp3"
  EndIf
ElseIf ( State == 3 )
 If ( Random100 < 25 )
   StreamMusic "Battle\MW Battle 1.mp3"
 ElseIf ( Random100 < 50 )
   StreamMusic "Battle\MW Battle 2.mp3"
 ElseIf ( Random100 < 75 )
   StreamMusic "Battle\MW Battle 3.mp3"
 Else
   StreamMusic "Battle\MW Battle 4.mp3"
  EndIf
 Set Wait to 1
EndIf

Set Timer to 0
Set State to 0

End

 

For the music to stop when the player is attacking something, attatch the following script to all NPCs and creatures in the bar.

 

Begin BarFightScript

Short DoOnce

If ( GetTarget Player )
 If ( DoOnce < 1 )
   Set BarFight to ( BarFight + 1 )
   Set DoOnce to 1
 EndIf
ElseIf ( DoOnce )
 Set BarFight to ( BarFight - 1 )
 Set DoOnce to 0
EndIf

End

 

Note that this is still quite rough and has not been tested to any extent.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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