about 2.2.10's stagefailed global

SonicSpades

The Scarlet King of Spades.
So, I've been confused about the new stagefailed global and how to implement it correctly.
Here's some example code, that uses Katmint's Character-specific jingles template as a base, that would change the clear music after the special stage depending on if the player fails the stage or not:
Lua:
addHook("MusicChange", function(oldname, newname)
for i, player in ipairs({consoleplayer, secondarydisplayplayer})
if newname == "_clear"
and ((gamemap >= 50 and gamemap <= 57) 
or (gamemap >= 60 and gamemap <= 66))
if stagefailed == true
newname = "_clea4" //the fail music
end
end

if newname == "_clear"
and ((gamemap >= 50 and gamemap <= 57) 
or (gamemap >= 60 and gamemap <= 66))
if stagefailed == false
newname = "_clea3" //the clear music
end
end
I'm not sure what's wrong but it plays the fail music even though I cleared the stage.
 
I have a feeling the newname commands that have "_clear" after them should actually be oldname? Because I see "oldname" in the top of the code but I don't see it being used. I'm probably not correct because I don't do this kind of stuff, but eh.
 
the new Stage failed stuff is currently lacking in documentation all over the place.
 

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top