The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Topic started by: DNZRX768 on August 12, 2010, 07:16:53 am

Title: Need Help interpreting code.
Post by: DNZRX768 on August 12, 2010, 07:16:53 am
OK, I was planing to use some code from POTS's Ryu for a private edit.

I was going to use the "spinning hurricane kick" but I was baffled about the amount of code that POTS put into the code.

Can you guys help me interpret the code and tell me which ones are not needed?
Code:
;======================<TATSUMAKI SENPUU KYAKU>=============================
[Statedef 1200]
type=A
physics=N
movetype=A
anim=1200
ctrl=0
velset=0,0
poweradd=72*!var(20)
juggle=8
sprpriority=1
facep2=1

[State 1200, strengthvar]
type=varset
trigger1= !time && var(59)<=0
var(10)=ifelse((command="qcbc"),3,ifelse(command="qcbb",2,1))
[State 1200, strengthvarAI]
type=varset
trigger1= !time && var(59)>=1
var(10)= ifelse((p2movetype=H || random<333), 1, ifelse(random<500, 2, 3))

[State 1200, Snd]
type=playsnd
trigger1= anim=1200 && animelem=1
value=4+(var(1)=2)*10,2
channel=0
[State 1200, Snd]
type=playsnd
trigger1= anim=1200 && animelem=1
value=0,40
[State 1200, Dust]
type=helper
trigger1= anim=1200 && animelem=1
helpertype=normal
stateno=7100
ID=7100
name="Dust"
postype=p1
ownpal=1

[State 1200, Anim]
type=changeanim
trigger1= anim=1200 && !animtime
value=1201

[State 1200, statetype]
type=statetypeset
trigger1= anim=1200 || anim=1205
statetype=A
physics=A
[State 1200, statetype]
type=statetypeset
trigger1= anim=1201
statetype=A
physics=N

[State 1200, Vel]
type=velset
trigger1= anim=1200 && animelem=1
x=3.5
y=-4

[State 1200, Vel]
type=velset
trigger1= anim=1201
x=3.5
y=0

[State 1200, spin]
type=playsnd
trigger1= anim=1201 && !(animelemtime(1)%9)
value=1,6
channel=1

[State 1200, Anim]
type=changeanim
trigger1= var(1)!=2
trigger1= anim=1201 && ifelse(var(10)=3,animelemtime(18)>=0,ifelse(var(10)=2,animelemtime(12)>=0,animelemtime(6)>=0))
value=1205
persistent=0
[State 1200, Anim]
type=changeanim
trigger1= var(1)!=1
trigger1= anim=1201 && ifelse(var(10)=3,!animtime,ifelse(var(10)=2,animelemtime(12)>=0,animelemtime(6)>=0))
value=1205
persistent=0

[State 1200, missed]
type=movehitreset
triggerall= var(1)=1
trigger1= movehit=1 && !numtarget
trigger2= movehit=1 && numtarget
trigger2= target,hitshakeover

[State 1200, Hit]
type=hitdef
trigger1= var(1)=1 && (!movehit || var(20))
trigger1= anim=1201 && (animelem=2 || animelem=8 || animelem=14)
attr=A,SA
damage= ifelse(movehit, 21, 98), 7
animtype=Hard
guardflag=MA
hitflag=MAF
priority=4,Hit
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14)
sparkno=s7020+(random%8)
guard.sparkno=s7001
sparkxy=-10,-70
hitsound=s2,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=-4,-7.5
air.type=Low
air.velocity=-4,-7.5
air.cornerpush.veloff = 0
ground.cornerpush.veloff = 0
guard.velocity= -10.52
guard.cornerpush.veloff = 0;-12.74
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20)
givepower=36,36
envshake.time=16
envshake.freq=120
envshake.ampl=4
fall=1
fall.recover=0;!var(20)
;fall.recovertime=37
yaccel=.5
airguard.ctrltime= 16
airguard.velocity= ifelse(var(20),-4,-8), -1.5
forcestand=1
airguard.cornerpush.veloff = 0

[State 1200, hitb]
type=hitdef
trigger1= var(1)=1 && (!movehit || var(20))
trigger1= anim=1201 && (animelem=5 || animelem=11 || animelem=17)
attr=A,SA
damage= ifelse(movehit, 21, 98), 7
animtype=Hard
guardflag=MA
hitflag=MAF
priority=4,Hit
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14)
sparkno=s7020+(random%8)
guard.sparkno=s7001
sparkxy=-10,-70
hitsound=s2,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=4,-7.5
air.type=Low
air.velocity=4,-7.5
air.cornerpush.veloff = 0
ground.cornerpush.veloff = 0
guard.velocity= -10.52
guard.cornerpush.veloff = 0;-12.74
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20)
givepower=36,36
envshake.time=16
envshake.freq=120
envshake.ampl=4
fall=1
fall.recover=0;!var(20)
;fall.recovertime=37
yaccel=.5
p2facing=-1
airguard.ctrltime= 16
airguard.velocity= ifelse(var(20),-4,-8), -1.5
forcestand=1
airguard.cornerpush.veloff = 0

[State 1200, Hit]
type=hitdef
trigger1= var(1)!=1 && hitcount<3
trigger1= anim=1201 && (animelem=2 || animelem=8 || animelem=14 || animelem=20)
attr=A,SA
damage=35,7
animtype=Hard
guardflag=MA
hitflag=MAF
priority=4,Hit
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14)
sparkno=s7020+(random%8)
guard.sparkno=s7001
sparkxy=-10,-70
hitsound=s2,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=-2.5,-8
air.type=Low
air.velocity=-2.5,-6.5
air.cornerpush.veloff = 0
ground.cornerpush.veloff = 0
guard.velocity= -10.52
guard.cornerpush.veloff = 0;-12.74
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20)
givepower=36,36
envshake.time=16
envshake.freq=120
envshake.ampl=4
fall=1
fall.recover=0;!var(20)
;fall.recovertime=ifelse(var(10)=1, 37, 41)
yaccel=.5
airguard.ctrltime= 16
airguard.velocity= ifelse(var(20),-4,-8), -1.5
forcestand=1
airguard.cornerpush.veloff = 0

[State 1200, hitb]
type=hitdef
trigger1= var(1)!=1 && hitcount<3
trigger1= anim=1201 && (animelem=5 || animelem=11 || animelem=17 || animelem=23)
attr=A,SA
damage=35,7
animtype=Hard
guardflag=MA
hitflag=MAF
priority=4,Hit
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14)
sparkno=s7020+(random%8)
guard.sparkno=s7001
sparkxy=-10,-70
hitsound=s2,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=2.5,-8
air.type=Low
air.velocity=2.5,-6.5
air.cornerpush.veloff = 0
ground.cornerpush.veloff = 0
guard.velocity= -10.52
guard.cornerpush.veloff = 0;-12.74
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20)
givepower=36,36
envshake.time=16
envshake.freq=120
envshake.ampl=4
fall=1
fall.recover=0;!var(20)
;fall.recovertime=ifelse(var(10)=1, 37, 41)
yaccel=.5
p2facing=-1
airguard.ctrltime= 16
airguard.velocity= ifelse(var(20),-4,-8), -1.5
forcestand=1
airguard.cornerpush.veloff = 0

[State Idle]
type=statetypeset
trigger1= anim=1205
movetype=I
Title: Re: Need Help interpreting code.
Post by: Cyanide on August 12, 2010, 07:45:21 am
You can take out any playsnd explod or varset. Probably.

This is why copy pasting is bad. Just make it yourself. You will learn more and won't have a messy piece of code that you don't understand.
Title: Re: Need Help interpreting code.
Post by: Cobra Caddie on August 12, 2010, 08:26:19 am
"What isn't needed" depends on what type of move you're making. Forgive me if I'm wrong about anything because I'm fairly rusty, but here we go:

----------------------------------------------------------------------

[Statedef 1200]; Start of a state, and defines the number it is.
type=A; Defines if the move is Standing, Crouching, or in the Air.
physics=N; Defines physics of the move based on characteristics. "N" is null, meaning it doesn't follow a specific type of physics. For an example of other types, "S" would be if the character is standing, and you would have friction when you try to move him. "A" behaves if the character is in the air, so he would start to fall towards the ground.
movetype=A; Defines what kind of move the state is. "A" stands for attack. This is needed for a move to be able to hit the opponent.
anim=1200; Defines the animation to use for the move.
ctrl=0; Defines if you have ctrl in this state. 0 means "no" and because of that, you cannot interrupt this move with other moves. In other words you do not have control of the character while they are in this state.
velset=0,0; Used to set the character's current velocity at the start of the state. In this instance, the character is completely stopped.
poweradd=72*!var(20); Adds power to the character's power meter. Here, the value being used is 72 times whether variable 20 is 0 or not. Variable 20 is presumptuously being used to prevent the character from adding power during times where the character should(like custom combos).
juggle=8; Specifies how many juggle points this move requires for the hitdefs to be active.
sprpriority=1; Determines the sprite priority of the character.
facep2=1; Forces the character to face player 2.

[State 1200, strengthvar]; This is the start of a state controller within states. Must have this for every state controller you use.
type=varset; Use this to set a variable to a defined number.
trigger1= !time && var(59)<=0; This is a trigger. !time means if the time of the state does NOT equal a number other than 0. && is how mugen says "and". var(59)<=0 means that the value of variable of 59 is less than or equal to 0. If all of these triggers are met, the state controller is activated.
var(10)=ifelse((command="qcbc"),3,ifelse(command="qcbb",2,1)); This is the variable that is going to be set by this state controller, and which value to set it to. The variable is var(10). The value is complex. There are two "ifelse" triggers, and they are used as followed: If the players input command is "qcbc", set the value to 3. If the players input command is "qcbb", set the value to 2. If it is neither of these, set the value to 1.

[State 1200, strengthvarAI]
type=varset
trigger1= !time && var(59)>=1; The same as the last trigger, but if var(59) is greater than or equal to 1.
var(10)= ifelse((p2movetype=H || random<333), 1, ifelse(random<500, 2, 3)); || is mugen's way of saying "or". The value for var(10) is as follows: if player 2's movetype is "being hit", or mugen's random number generator(which generates a random number between 0 and 999) is less than 333, set the value to 1. If the random number generator is greater than 500, set to 2. If none of those conditions are met, set to 3.

[State 1200, Snd]
type=playsnd; Tells mugen to play a sound effect.
trigger1= anim=1200 && animelem=1; If the characters animation is 1200 and the frame of animation is 1, this state controller will be triggered.
value=4+(var(1)=2)*10,2; The group number for the sound is 4+(if var(1)=2, this will be 1 and if not it will be 0) times 10, and it's 2 of that group.
channel=0; Defines the channel to play the sound on.

[State 1200, Snd]
type=playsnd
trigger1= anim=1200 && animelem=1
value=0,40

[State 1200, Dust]
type=helper; Creates a helper for the player. Helpers are similar to players and you can make them do almost everything that a character can do.
trigger1= anim=1200 && animelem=1
helpertype=normal
stateno=7100; Defines what state the helper will be in.
ID=7100; Gives the helper an number identifaction.
name="Dust"; Gives the helper a name.
postype=p1; Defines what the helper's starting position will be based on.
ownpal=1; Defines whether or not the helper shares palettes with the player.

[State 1200, Anim]
type=changeanim; Changes the characters animation.
trigger1= anim=1200 && !animtime
value=1201

[State 1200, statetype]
type=statetypeset; Changes the characters state type.
trigger1= anim=1200 || anim=1205
statetype=A; Changes the character's statetype to A, meaning that they will now be defined as being the air.
physics=A; Changes the character's physics.

[State 1200, statetype]
type=statetypeset
trigger1= anim=1201
statetype=A
physics=N

[State 1200, Vel]
type=velset; Changes the characters velocity, as in the number of pixels the character moves every frame.
trigger1= anim=1200 && animelem=1
x=3.5; Changes the character horizontal movement to 3.5 pixels per frame.
y=-4; Changes the character vertical movement to -4 pixels per frame.

[State 1200, Vel]
type=velset
trigger1= anim=1201
x=3.5
y=0

[State 1200, spin]
type=playsnd
trigger1= anim=1201 && !(animelemtime(1)%9); This is complicated. The second part, I believe, is a trigger for if the remander of the time in animelem 1 does NOT equal 9. Could be wrong about this, sorry. :(
value=1,6
channel=1

[State 1200, Anim]
type=changeanim
trigger1= var(1)!=2
trigger1= anim=1201 && ifelse(var(10)=3,animelemtime(18)>=0,ifelse(var(10)=2,animelemtime(12)>=0,animelemtime(6)>=0))
value=1205
persistent=0; This forces the move to activate only once during the state. It won't keep activating everytime the triggers are true.

[State 1200, Anim]
type=changeanim
trigger1= var(1)!=1
trigger1= anim=1201 && ifelse(var(10)=3,!animtime,ifelse(var(10)=2,animelemtime(12)>=0,animelemtime(6)>=0))
value=1205
persistent=0

[State 1200, missed]
type=movehitreset; Sets that the move is no longer hitting. This is used for the movehit, moveguard etc triggers.
triggerall= var(1)=1
trigger1= movehit=1 && !numtarget; The move has hit and there are no targets.
trigger2= movehit=1 && numtarget; The move has hit and there is a target.
trigger2= target,hitshakeover; The target is no longer in a "hitshake", the stun caused by being hit.

[State 1200, Hit]
type=hitdef; This defines an hit of an attack.
trigger1= var(1)=1 && (!movehit || var(20))
trigger1= anim=1201 && (animelem=2 || animelem=8 || animelem=14)
attr=A,SA; These are the attributes of the attacks. The first "A" stands for air. The "S" stands for Special. The second "A" stands for attack(as opposed to throw or projectile).
damage= ifelse(movehit, 21, 98), 7; Defines how much damage the attack should do. In this case, if the player is already hit by a move, the attack will do 21 damage points. If not, 98. If the opponent blocks the attack, it'll do 7 damage.
animtype=Hard; Defines how the opponent will react to being hit, stuff like "lightly" or "hard"
guardflag=MA; Defines how the move can be guarded. In this cause, it can be guarded "M" (stands for mid), which means both low and high, and "A", which means in the air.
hitflag=MAF; Defines how the move can hit the opponent. Mid, air, and "fall", which means if the opponent is falling down from being hit.
priority=4,Hit; Defines the priority of the attack versus other attacks. "Hit" means that if this attack is going up against an opponent's attack that is also defined at 4, it will hit them.
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14); Defines how much time to pause both the player and the opponent if the move connects. This particular time is "If variable 20 is not 0, 7 frames. If it is 0, 14 frames". For both characters in this case.
sparkno=s7020+(random%8); Defines which hit spark animation to display if the move hits.
guard.sparkno=s7001; Defines which hit spark to display if the move is guarded.
sparkxy=-10,-70; Defines where the spark will be displayed.
hitsound=s2,6; Defines which sound to play if the move hits.
guardsound=s2,0; Defines which sound to play if the move is guarded.
ground.type=High; Defines what kind of animation the opponent will have if they are hit by the move. In this cause, they will react as if they are getting hit in the head, or "high".
ground.slidetime=16; Defines how long the opponent will slide on the ground after getting hit by the attack. Basically how long they will be pushed backwards.
ground.hittime=16; Defines how long the opponent will stay "being hit".
ground.velocity=-4,-7.5; Defines the opponent's velocity after being hit by the attack.
air.type=Low; Same as ground.type, but if the opponent is hit the air.
air.velocity=-4,-7.5; Same as ground.velocity, but if the opponent is hit in the air.
air.cornerpush.veloff = 0; Defines the velocity to push the player back if the opponent is backed into a corner, and the palyer hit's the opponent while the opponent is in the air.
ground.cornerpush.veloff = 0; Same as air.cornerpush.veloff, but if the opponent is on the ground.
guard.velocity= -10.52; Defines the opponents velocity if they block the attack.
guard.cornerpush.veloff = 0;-12.74; Same as ground.cornerpush.veloff, but if the opponent blocks the attack.
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20); Defines how much power is added to the player's power meter if the move hits the opponent, and if the opponent blocks.
givepower=36,36; Defines how much power is added to the opponent's power meter if the move hits the opponent, and if the opponent blocks.
envshake.time=16; Makes the screen shake. This is the time the screen will shake.
envshake.freq=120
envshake.ampl=4; The last two values are how hard the screen shakes, I believe.
fall=1; Defines if the opponent will fall down if the move hits. 1 = yes.
fall.recover=0;!var(20); Defines if the opponent is able to recover in the air if the fall from the move. 0 = no.
;fall.recovertime=37
yaccel=.5; Defines, if the opponent is falling, how fast their fall will accelerate. In this case, .5 is added to the opponent's velocity after frame of animation.
airguard.ctrltime= 16; Defines how long it takes for the opponent to regain control after blocking in the air.
airguard.velocity= ifelse(var(20),-4,-8), -1.5; Defines what changes the opponent endures to their velocity if they block in the air.
forcestand=1; Forces the opponent to stand if they are ducking.
airguard.cornerpush.veloff = 0; Same as ground.cornerpush.veloff, but if the opponent blocks in the air.

[State 1200, hitb]
type=hitdef; This is an addional hit in the move. This can be used as a second hit of the move, or an alternative to the first hit depending on if the first hit is triggered or not.
trigger1= var(1)=1 && (!movehit || var(20))
trigger1= anim=1201 && (animelem=5 || animelem=11 || animelem=17)
attr=A,SA
damage= ifelse(movehit, 21, 98), 7
animtype=Hard
guardflag=MA
hitflag=MAF
priority=4,Hit
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14)
sparkno=s7020+(random%8)
guard.sparkno=s7001
sparkxy=-10,-70
hitsound=s2,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=4,-7.5
air.type=Low
air.velocity=4,-7.5
air.cornerpush.veloff = 0
ground.cornerpush.veloff = 0
guard.velocity= -10.52
guard.cornerpush.veloff = 0;-12.74
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20)
givepower=36,36
envshake.time=16
envshake.freq=120
envshake.ampl=4
fall=1
fall.recover=0;!var(20)
;fall.recovertime=37
yaccel=.5
p2facing=-1
airguard.ctrltime= 16
airguard.velocity= ifelse(var(20),-4,-8), -1.5
forcestand=1
airguard.cornerpush.veloff = 0

[State 1200, Hit]
type=hitdef
trigger1= var(1)!=1 && hitcount<3; The hitcount trigger means this attack triggers if the current number of hits that have happened are less than 3.
trigger1= anim=1201 && (animelem=2 || animelem=8 || animelem=14 || animelem=20)
attr=A,SA
damage=35,7
animtype=Hard
guardflag=MA
hitflag=MAF
priority=4,Hit
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14)
sparkno=s7020+(random%8)
guard.sparkno=s7001
sparkxy=-10,-70
hitsound=s2,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=-2.5,-8
air.type=Low
air.velocity=-2.5,-6.5
air.cornerpush.veloff = 0
ground.cornerpush.veloff = 0
guard.velocity= -10.52
guard.cornerpush.veloff = 0;-12.74
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20)
givepower=36,36
envshake.time=16
envshake.freq=120
envshake.ampl=4
fall=1
fall.recover=0;!var(20)
;fall.recovertime=ifelse(var(10)=1, 37, 41)
yaccel=.5
airguard.ctrltime= 16
airguard.velocity= ifelse(var(20),-4,-8), -1.5
forcestand=1
airguard.cornerpush.veloff = 0

[State 1200, hitb]
type=hitdef
trigger1= var(1)!=1 && hitcount<3
trigger1= anim=1201 && (animelem=5 || animelem=11 || animelem=17 || animelem=23)
attr=A,SA
damage=35,7
animtype=Hard
guardflag=MA
hitflag=MAF
priority=4,Hit
pausetime= ifelse(var(20),7,14), ifelse(var(20),7,14)
sparkno=s7020+(random%8)
guard.sparkno=s7001
sparkxy=-10,-70
hitsound=s2,6
guardsound=s2,0
ground.type=High
ground.slidetime=16
ground.hittime=16
ground.velocity=2.5,-8
air.type=Low
air.velocity=2.5,-6.5
air.cornerpush.veloff = 0
ground.cornerpush.veloff = 0
guard.velocity= -10.52
guard.cornerpush.veloff = 0;-12.74
getpower= ifelse(p2movetype=H,72,144)*!var(20), 36*!var(20)
givepower=36,36
envshake.time=16
envshake.freq=120
envshake.ampl=4
fall=1
fall.recover=0;!var(20)
;fall.recovertime=ifelse(var(10)=1, 37, 41)
yaccel=.5
p2facing=-1
airguard.ctrltime= 16
airguard.velocity= ifelse(var(20),-4,-8), -1.5
forcestand=1
airguard.cornerpush.veloff = 0

[State Idle]
type=statetypeset
trigger1= anim=1205
movetype=I; Idle means that the move is neither an attack or a gethit state.

----------------------------------------------------------------------

This took me over an hour to type up. Hope it helps you understand coding, it was all off the top of my head. :D

Also this is all in the docs folder that comes with Mugen, probably better explained than how I did it.
Title: Re: Need Help interpreting code.
Post by: DNZRX768 on August 12, 2010, 02:53:15 pm
Thanks Caddie.

It really helped alot.