Page 1 of 1

Change music in game after a set frag count

Posted: Thu Nov 07, 2013 1:09 am
by Glitchologteam
Hello there, I am looking for a actionscript code to do the following in my Video Game Wad Deatmatch Wad

as soon as semeone get 37 frags , I want the music of the current level to change for another one.

The reason I want to do that comes from the street fighters game, where when semeone is near ko, a more dramatic version of the stage music plays and I want to do the same when 3 frag remain for each map


Thanks in advance!

RE: Change music in game after a set frag count

Posted: Thu Nov 07, 2013 1:27 am
by Ænima
EDIT:
Actually, Qent's is better. I forgot that SetMusic applies to everyone and not just the activator, so no need for two seperate scripts. :v:

RE: Change music in game after a set frag count

Posted: Thu Nov 07, 2013 1:39 am
by Qent

Code: Select all

script 890 DEATH {
  // Go to the thing that killed me.
  SetActivatorToTarget(0);
  
  // If I wasn't killed by a player then do nothing.
  // If there is no fraglimit then do nothing.
  if(PlayerNumber() < 0 || GetCVar("fraglimit") <= 0)
    Terminate;
  
  if(PlayerFrags() >= GetCVar("fraglimit") - 3)
    SetMusic("d_ultima");
}
Assuming you actually use a fraglimit, instead of a hardcoded 40. (I don't know what kind of mod you're doing, but you should probably not hardcode a fraglimit of 40.)