Starttrackvar: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
One (talk | contribs)
No edit summary
No edit summary
Line 1: Line 1:
'''starttrackvar''' <track#>
'''starttrackvar''' <track#>


starttrackvar is used to change the current background music that is playing. This command works like the [[starttrack]] command but the former can accept gamevars whereas the later accepts only constants.
starttrackvar sets the background music to <track#>, as defined for the current episode with the [[music]] command. It works like [[starttrack]], but the parameter can be a variable instead of a constant


<track#> is literally the track number of the current episode (which can be detected with the [[gamevar]] [[VOLUME]]) as defined by the [[music]] command.


Example: this will start the music track from episode 3, level 2.
Example: this code will cause the music to cycle through the first ten tracks defined for the current episode when the player presses the open key. (Replace the line "actor APLAYER..." with the code below)


  gamevar episode 2 0
  gamevar TRACK 9 0
  gamevar level 1 0
   
  getuserdef[THISACTOR].volume_number TEMP
  actor APLAYER MAXPLAYERHEALTH PSTAND 0 0
setuserdef[THISACTOR].volume_number episode
'''starttrackvar''' level
setuserdef[THISACTOR].volume_number TEMP


ifhitspace ifcount 26
{
  resetcount
  addvar TRACK 1
  ifvarg TRACK 9 setvar TRACK 0
  starttrackvar TRACK
}
[[Category:EDuke32 specific commands]]
[[Category:EDuke32 specific commands]]
[[Category:Sound manipulation]]
[[Category:Sound manipulation]]

Revision as of 16:15, 5 May 2009

starttrackvar <track#>

starttrackvar sets the background music to <track#>, as defined for the current episode with the music command. It works like starttrack, but the parameter can be a variable instead of a constant


Example: this code will cause the music to cycle through the first ten tracks defined for the current episode when the player presses the open key. (Replace the line "actor APLAYER..." with the code below)

gamevar TRACK 9 0

actor APLAYER MAXPLAYERHEALTH PSTAND 0 0
ifhitspace ifcount 26
{
  resetcount
  addvar TRACK 1
  ifvarg TRACK 9 setvar TRACK 0
  starttrackvar TRACK
}