Starttrackvar

From EDukeWiki
Jump to navigation Jump to search

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
}