Infinity MUGEN Team
IMT Main => M.U.G.E.N Guides & Tutorials => Topic started by: ClubSyN-X-TReME on August 12, 2007, 09:49:21 AM
-
[youtube=425,350]qC5JmKaCh58[/youtube]
Ever wanted a code to make the music change when either player is about to die when their life is low after losing a round?
Thats the purpose of the video about and the codes I am about to share with you. This is based on games like killer instinct 2, street fighter 2 and a few more games i can think of.
First we need a helper and two free variables coded in statedef -2 or -3, your choice.
[State -2, VarSet]
type = VarSet
trigger1 = loseko
v = x
value = 1
[State -2, VarSet]
type = VarSet
trigger1 = winko
v = y
value = 1
[State -2, Helper]
type = Helper
trigger1 = 1 && !numhelper(xxxxx)
helpertype = normal
name = "near Death bgm"
stateno = xxxxx
id = xxxxx
pos = 0,9999999
postype = left ;p2,front,back,left,right
facing = 1
pausemovetime = 99999999999
supermovetime = 99999999999
The first two varset codes activates when you lose or win a round. This is needed for how things are coded in the helper states. The helper above is always active from the start of the match.
Now for the helper states.
;-----------------------------------------------------------------------
;About to Die after loss of a round bgm helper
;-----------------------------------------------------------------------
[Statedef xxxxx]
type = S
movetype = I
physics = n
[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = invisible
flag2 = noshadow
[State 0, AssertSpecial]
type = AssertSpecial
triggerall = (roundno >= 2 && (root,var(x) = 1 && root,life <= lifemax /3) || (root,var(y) = 1 && enemy,life <= lifemax /3))
trigger1 = 1
flag = nomusic
[State 0]
type = NotHitBy
trigger1 = 1
value = SCA
[State 0]
type = PlayerPush
trigger1 = 1
value = 1
[State 0, PlaySnd]; player 1 side
type = PlaySnd
triggerall = roundno >= 2 && root,var(x) = 1 && root,life != 0
trigger1 = root,life <= lifemax /3
value = Sx,x
volume = 100
channel = 6
loop = 1
persistent = 0
[State 0, PlaySnd]:player 2 side
type = PlaySnd
triggerall = roundno >= 2 && root,var(y) = 1 && enemy,life != 0
trigger1 = enemy,life <= lifemax /3
value = Sx,x
volume = 100
channel = 6
loop = 1
persistent = 0
[State 0, StopSnd]
type = StopSnd
triggerall = roundno >= 2
trigger1 = root,stateno = 5999
channel = 6
persistent = 0
This will activate when player one has lost a round and has a third of life left. It will also work when player two has lost a round and has a third of life left.
For extra effects like a danger logo or whatever, add an explod.
To prevent this for being used in simulation mode with can cause some weird effects. add this line to the helper.
For Team mode,
trigger1 = teammode = single || teammode = turns
trigger1 = enemy, teammode = single || enemy, teammode = turns
Add those triggers to the helper code.
-
here is my answer from the past thread. ::)
1- i want to use deferent music or each round..lets say round 1 has it's own track, round 2 has it's own...etc
2- i want to use the music for characters not stages..lets say i use ryo he comes with his track, i use robert in the same stage he also comes with his own track...and on
3-i want to use random tracks for a stage not just one. ;D
is any of this possible?
waiting ::)
-
i want to learn this but its really confusing ???
-
besides wat if there is only one round then will it work
-
besides wat if there is only one round?
XD
You could just alter it to say one round.
-
here is my answer from the past thread. ::)
1- i want to use deferent music or each round..lets say round 1 has it's own track, round 2 has it's own...etc
2- i want to use the music for characters not stages..lets say i use ryo he comes with his track, i use robert in the same stage he also comes with his own track...and on
3-i want to use random tracks for a stage not just one. ;D
is any of this possible?
waiting ::)
this has nothing to do with what this topic is about, But its possible, I will explain how in a different thread.
-edit-
http://www.infinitymugenteam.com/Forum_345/index.php?topic=1064.0
besides wat if there is only one round then will it work
replace roundno >= 2 with roundno = 1
-
this is wat loses me so the code do i actually have to write that in the character def file and also where do i write it
-
oh yea and plus i usually play team arcade so that wont work for team arcade will it
-
Re Read my first post towards the bottom, i already explained it.
-
Do you put the near death bgm in the character's folder or the sound folder?
And if it automaticly takes from the sound folder can you make it take it out of the character folder?
When i get to the point were im going to start figuring out coding to make Sniper Joe i want to enclude this feature.
-
Do you put the near death bgm in the character's folder or the sound folder?
And if it automaticly takes from the sound folder can you make it take it out of the character folder?
When i get to the point were im going to start figuring out coding to make Sniper Joe i want to enclude this feature.
its part of the characters sound file.
I was doing this guide for those that were making their own character btw.
-
edit: found your next thread
-
how you do this if you only DL your chars like I want it for spiderman BUT IT WON"T WORK how you do this
-
how you do this if you only DL your chars like I want it for spiderman BUT IT WON"T WORK how you do this
i know all this is confusin as hell and not specific enough they dont even tell u where to put that giant code thing out ~X(
-
[youtube=425,350]qC5JmKaCh58[/youtube]
That voice is creepy as hell.
-
Question...
If i remove
trigger1 = root,life <= lifemax /3
from the helper code, will it just start on round 2 with max life?
-
how you do this if you only DL your chars like I want it for spiderman BUT IT WON"T WORK how you do this
i know all this is confusin as hell and not specific enough they dont even tell u where to put that giant code thing out ~X(
I clearly said this earlier,
I was doing this guide for those that were making their own character btw.
And if you knew how to code characters, the State prefixes would tell you how to place the codes.i didn't say anything about editing existing characters. I make these guides for others to learn, not to copy and paste to already made characters despite how they were developed.
Question...
If i remove
trigger1 = root,life <= lifemax /3
from the helper code, will it just start on round 2 with max life?
Yes.
-
Uhh, huh...
And what happens when both players have the same exact near deth code?
-
the video from the begining should of told you that answer.
-
the video from the begining should of told you that answer.
Whats that?!
~SYN~ is tryin' to play me?! XD
Lets see...... Im still mystified.
-
Ok im trying to get this to work for the character im making, but im doing something wrong.
I put the statedef -2 stuff in the area with the rest of the -2 stuff... figured that was a no brainer.
Now i wasnt sure were to put the helper code so i just put it up with my regluar attacks and stuff and renamed the xxxxxx to 8001 (out of random just about but i dont have any other states with that number)
all the xxxxx in the -2 you posted i changed to 8001
Uploaded my song, put group 8001, 1
were i saw Sx,x i put 8001, 1
Now whenever i hit run in winmugen from fighter factory it crashes mugen, i cant make a screen shot of the error message because vista keeps closing it and sends an error report.
I did notice the first time was someting like
invalid value x
IM sorry if im being n00bish and not realizing it. I dont know allot about code and im learning as a i go along. If you could perhaps point out were im making my mistakes i would appreceate it.
-
Thanks a ton! By the way, nice lifebars, any chance you could send em my way?
-
Thanks a ton! By the way, nice lifebars, any chance you could send em my way?
Read the :rulez:
Thats not how you ask for stuf.
-
Ok im trying to get this to work for the character im making, but im doing something wrong.
I put the statedef -2 stuff in the area with the rest of the -2 stuff... figured that was a no brainer.
Now i wasnt sure were to put the helper code so i just put it up with my regluar attacks and stuff and renamed the xxxxxx to 8001 (out of random just about but i dont have any other states with that number)
all the xxxxx in the -2 you posted i changed to 8001
Uploaded my song, put group 8001, 1
were i saw Sx,x i put 8001, 1
Now whenever i hit run in winmugen from fighter factory it crashes mugen, i cant make a screen shot of the error message because vista keeps closing it and sends an error report.
I did notice the first time was someting like
invalid value x
IM sorry if im being n00bish and not realizing it. I dont know allot about code and im learning as a i go along. If you could perhaps point out were im making my mistakes i would appreceate it.
post your coding so I can see.
-
;-----------------------------------------------------------------------
;About to Die after loss of a round bgm helper
;-----------------------------------------------------------------------
[Statedef 8001]
type = S
movetype = I
physics = n
[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = invisible
flag2 = noshadow
[State 0, AssertSpecial]
type = AssertSpecial
triggerall = (roundno >= 2 && (root,var(x) = 1 && root,life <= lifemax /3) || (root,var(y) = 1 && enemy,life <= lifemax /3))
trigger1 = 1
flag = nomusic
[State 0]
type = NotHitBy
trigger1 = 1
value = SCA
[State 0]
type = PlayerPush
trigger1 = 1
value = 1
[State 0, PlaySnd]; player 1 side
type = PlaySnd
triggerall = roundno >= 2 && root,var(x) = 1 && root,life != 0
trigger1 = root,life <= lifemax /3
value = 8001, 1
volume = 100
channel = 6
loop = 1
persistent = 0
[State 0, PlaySnd]:player 2 side
type = PlaySnd
triggerall = roundno >= 2 && root,var(y) = 1 && enemy,life != 0
trigger1 = enemy,life <= lifemax /3
value = 8001, 1
volume = 100
channel = 6
loop = 1
persistent = 0
[State 0, StopSnd]
type = StopSnd
triggerall = roundno >= 2
trigger1 = root,stateno = 5999
channel = 6
persistent = 0
;-----------------------Round 2 Music------------------
[State -2, VarSet]
type = VarSet
trigger1 = loseko
v = x
value = 1
[State -2, VarSet]
type = VarSet
trigger1 = winko
v = y
value = 1
[State -2, Helper]
type = Helper
trigger1 = 1 && !numhelper(8001)
helpertype = normal
name = "near Death bgm"
stateno = 8001
id = 8001
pos = 0,9999999
postype = left ;p2,front,back,left,right
facing = 1
pausemovetime = 99999999999
supermovetime = 99999999999
-
x and y are not variable values. That was put the so you can chose a numeric value for x and one for y.
-
Are there aright and wrong values to pic for x and y?
Because now i keep picking differnt numbers and i still cant get it to work.
-
you said you were making a character right?
Did you use any variables yet?
if not do it like this;
if you dont have a statedef -2;
[statedef -2]
[State -2, VarSet]
type = VarSet
trigger1 = loseko
v = 1
value = 1
[State -2, VarSet]
type = VarSet
trigger1 = winko
v = 2
value = 1
[State -2, Helper]
type = Helper
trigger1 = 1 && !numhelper(8001)
helpertype = normal
name = "near Death bgm"
stateno = 8001
id = 8001
pos = 0,9999999
postype = left ;p2,front,back,left,right
facing = 1
pausemovetime = 99999999999
supermovetime = 99999999999
in your regular states add this
;-----------------------------------------------------------------------
;About to Die after loss of a round bgm helper
;-----------------------------------------------------------------------
[Statedef 8001]
type = S
movetype = I
physics = n
[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = invisible
flag2 = noshadow
[State 0, AssertSpecial]
type = AssertSpecial
triggerall = (roundno >= 2 && (root,var(1) = 1 && root,life <= lifemax /3) || (root,var(2) = 1 && enemy,life <= lifemax /3))
trigger1 = 1
flag = nomusic
[State 0]
type = NotHitBy
trigger1 = 1
value = SCA
[State 0]
type = PlayerPush
trigger1 = 1
value = 1
[State 0, PlaySnd]; player 1 side
type = PlaySnd
triggerall = roundno >= 2 && root,var(1) = 1 && root,life != 0
trigger1 = root,life <= lifemax /3
value = 8001, 1
volume = 100
channel = 6
loop = 1
persistent = 0
[State 0, PlaySnd]:player 2 side
type = PlaySnd
triggerall = roundno >= 2 && root,var(2) = 1 && enemy,life != 0
trigger1 = enemy,life <= lifemax /3
value = 8001, 1
volume = 100
channel = 6
loop = 1
persistent = 0
[State 0, StopSnd]
type = StopSnd
triggerall = roundno >= 2
trigger1 = root,stateno = 5999
channel = 6
persistent = 0
-
Well i havnt used any variables yet.
Pritty much editing off of the KFM template included with FF.
If i screwd arround with the common1 file would that affect this?
Its my first character, and i barely understand the coding, and learning as i go along.
But i dont understand what ive done wrong. (please dont think im trying to be lazy because im trying to avoid asking for help as much as I can)
Perhaps if you have the time to, i could send you the character and you can find out why it isnt working.
And then point it out or something.
Im sorry if thats a bit outlandish of a request.
-
send it to me over the weekend, ill check it then.
-
For the near death bgm to work properly, your character has to have its variables setup not to reset between rounds.
This is all you have to do,
in the cns section where you adjust life, speed, etc, look for these two lines.
IntPersistIndex = 60
FloatPersistIndex = 40
change IntPersistIndex = 60 to IntPersistIndex = 1 and you will be set.
Sorry about being so late with this but when I looked at spider mews character in progress, I noticed is variables reset after each round.
-
Thanks! It works perfectly now! i changed the lifemax /3 to /1 and it now works at the start of the round!
I tryed changing info that says round 2 to round 1 to just try to have the song play all the time but it didnt work.(but then i discoverd if there is a 3rd round the song restarts but i dont think there is a way arround that is there)
But thats ok, this is a great feature.
Thanks bunches with your help!
-
Is this suppose to be in the cns file or the cmd file?
-
Is this suppose to be in the cns file or the cmd file?
Learn to code before attempting anything in the code area. This is explained in the code itself in the 'code titles' of the coding. We cant keep answering this same question over and over and over again 10,000 times. It's clearly apparent where to put this.