Site hosted by Angelfire.com: Build your free website today!

Creating Helpers  

State by state Summary

 

Helpers,Strikers,Assist Characters, they're everywhere in today's fighting games. You can find them in popular games like Marvel vs Capcom 2 or King of Fighters 99, every new MUGEN character that comes out has one, but  how do you create them? What is a helper character anyway?

 

Helper characters are just that, they are characters that jump on the screen to help the main character in his fight. Helper behaviour varies from game to game , but basically the player inputs a command to "call" the helper, then the helper does  a preprogrammed attack and leaves the screen. Helpers are so cool, because you are able to control your main character while your helper attacks,so they are separate entities.

 

-Example :Cody calling Guy as a helper (Cody by Moxmaniac)

 

Cody attacking Magneto via his helper: Guy

 

First of all , you will need to add the animation frames for your helper, and the corresponding collision boxes,etc. This is done the standard way, using programs like MCM, Mugenerator, Airview or a combination of them. It's important to note, that it's strongly recommended to add your frames in action numbers as separate from the main character's frames as possible. Generally action 9000+ its separate enough , and avoids any undesirable confusion. 

 

After you got your pictures all sorted,you define a command for your helper in the CMD file,using the usual sintaxis:

 

CMD file

 

;-----------------

; Guy Summon (Hurricane)

[Command]

name = "guy_1"

command = ~F,DF,D,DB,B,a

 

 

....also you define the corresponding State -1 as shown below:

 

;----------------------------------------------

; Guy Striker - a

[State -1]

type = ChangeState

value = 9400

triggerall = NumHelper(9500) = 0  

triggerall = P2Name != "Guy"

triggerall = P4Name != "Guy"

trigger1 = command = "guy_1"

trigger1 = statetype != A

trigger1 = ctrl = 1

 

The highlighted line in the above code snippet is what interest us, you should have no problem deducing what the other ones do. In the mentioned line we ask if our character already has created or "spawned" a helper with ID number 9500. So we use the NumHelper trigger:

 

triggerall = NumHelper(9500) = 0

 

Every helper must have an ID number, so the engine can keep some control of them. So, it's important to check if the helper is not ALREADY in the screen,as he should only be called when he's NOT in the screen. The above line takes care of that.

 

Ok, we got our CMD file ready, but let's head to the important part: the CNS file. In the above code we changed the state of the character to state number 9400 with the ChangeState trigger, so let's see the code for state 9400.

 

CNS file

 

;-----------------------------------------------------------------------------

; Guy summon (Hurricane)

[Statedef 9400]

type = S

movetype = A

physics = S

anim = 9400        This is the animation that 

                                             the main char (Cody) is going to do 

                                             while calling the helper.

 

velset = 0,0,0

ctrl = 0

 

[State 9400, 1]

type = Helper

trigger1 = time = 0

ID = 9500

pos = -50,0

postype = back

stateno = 9500

helpertype = normal

name = "Guy"

keyctrl = 0

ownpal = 1

 

[State 9400, 2]

type = ChangeState

trigger1 = AnimTime = 0

value = 0

ctrl = 1

 

-Ok, let's look at [State 9400,1] a little bit more in detail:

 

[State 9400, 1]

type = Helper

    The Helper controller tells the engine that we are creating hmmm...a helper maybe? :)

 

trigger1 = time = 0

    The controller is going to activate when time is 0, that is, the beginning of this state

 

ID = 9500

    As we said before, every helper must have a unique ID number, Guy's ID is 9500, we saw that number in the  CMD,remember?

 

pos = -50,0

    Pos carries the form x,y and sets the "offset" of the helper from the main character position on the screen. In this example Guy will be created 50 points to the left of Cody , hence the -50 number.

 

postype = back

stateno = 9500

    Every striker or helper must have a state to start with. In this case, Guy will make action 9500 when called. We'll get to that shortly.

 

helpertype = normal

    You have 2 choices here: normal or player. This controls if the "camera" of the game is going to follow the main player, as it does normally (normal) or is going to follow the striker's movements (player). "Normal" is the option generally used.

 

name = "Guy"

    err....name of your striker?

 

keyctrl = 0

    If you set this option to 1, your striker will be able to change his behaviour according to command input. If you want to have a striker that goes different directions in the screen based on your commands, this could serve you well. In the case of Guy, he is doing an automated attack, with a preset motion, so we will leave this in 0.

 

ownpal = 1

    The striker sprites are going to use their own copy of the character pallete. This means that when the character is affected with a pallete effect ( say he turns totally bright red to represent he is "on fire"), the striker will NOT be affected by the change.

 

At this point we have:

 

-defined the command to activate the helper

-checked if the helper is on the screen or not to activate it

-looked at the code that lets Cody create Guy.

 

Now that we have created Guy,we need to tell the engine what will be his behaviour. Brace yourselves as there is quite some code to read here. Hopefully the organization will make it easier for you to read.

 

GUY making a Hurricane Kick

 

To make it easier to understand I m gonna divide the code for Guy by his animations, so you will also have a visual reference to guide you through the code..

 

  Guy entering the screen running  - State 9500

 

 

Guy standing and ready to attack - State 9501

 

 

Guy making the hurricane kick - State 9502

 

 

Guy landing after the air hurricane kick - State 9503

 

 

 

Guy as he lands on the ground - State 9504

 

 

 

Guy leaving the screen after making his move - State 9505 

 

If Guy is hit by the opponent:

 

Guy after being hit by the opponent - State 9506

 

Guy standing up after the hit,and leaving the screen - State 9507

 

 

Guy entering the screen running  - State 9500

 

When creating Guy in the creation code we used statenumber 9500 as the startup action for Guy,so let's take a look at it:

 

;---------------------------------------------------------------------------

; Guy's code

[Statedef 9500]

type = S

movetype = I

physics = N

anim = 9503

velset = 5.5,0,0     notice the X velocity, cause Guy is 

                               moving forward as he runs towards the opponent

ctrl = 0

 

[State 9500, 1]

type = HitOverride

trigger1 = time = 0

time = -1

attr = SCA, AA, AT, AP

slot = 0

stateno = 9506

 

[State 9500, 2]

type = sprpriority

trigger1 = Time = 0

value = 10

 

[State 9500, 3]

type = PlaySnd

trigger1 = Time = 0

value = 6,0

 

[State 9500, 4]

type = ChangeState

trigger1 = RootDist X <= -30

value = 9501

 

[State 9500, 5]

type = VelSet

trigger1 = RootDist X <= -30

x = 0

y = 0

 

 

The above code makes Guy run towards the opponent, as soon as he is created. We said before that helpers must be independent entities, totally separate from the main player, and totally capable of hitting an opponent, and receiving hits from them. Because of this we cannot asume that the helper will attack his opponent while he 's just standing there! Probably your opponent will try to defend, attacking your helper . 

 

So, we can't use the GetHit States of the main character, doing that would result in Guy turning into Cody's frames  if he receives hits!. Clearly, the helper must have his own set of gethit states, we do that here:

 

[State 9500, 1]

type = HitOverride

    The HitOverride controller is used to ,as the name implies, "override" the gethit states of the main character,Cody in our case, with Guy states.

 

trigger1 = time = 0

    time=0, as you know,activates the controller (HitOverride) as soon as this state begins.

 

time = -1

    This is the duration of the override, we use -1  cause we want it to last as long as the character exists.

 

attr = SCA, AA, AT, AP

    This line is directly related to the HitDef controller, so you will probably recognize the parameters from there. If you don't ,the above parameters mean that we are going to let the opponent hit Guy with either: Standing, Crouching or Aerial attacks (SCA), with Normal Attacks (AA), Throws (AT) or Fireballs (AP).     

 

slot = 0

    You can have as many as 8 gethit overrides (0-7). We are only using one slot here (number 0), because hitting Guy with any of the above specified attacks will change him into the same getting hit state. If you wanna have say different  animations, based on which move the opponent used to hit your helper, you can use this 8 slots to store those overrides. You will need different HitOverrides  section for each of them, of course.

 

stateno = 9506

    Confused by the above explanations? Let me clear that up: If Guy is hit with either a Standing, Crouching or Aerial attack (SCA), with Normal Attacks (AA), Throws (AT) or Fireballs (AP) he will change into state 9506,his getting hit animation. As seen in the above "slot" explanation, it doesn't matter which of those moves the opponent uses to hit Guy, he will always turn into state 9506, that's why we use only 1 slot, we have 1 getting hit animation only.

 

 

[State 9500, 4]

type = ChangeState

trigger1 = RootDist X <= -30

value = 9501

 

[State 9500, 5]

type = VelSet

trigger1 = RootDist X <= -30

x = 0

y = 0

 

The above 2 states make Guy stop his running after advancing a specified distance and make him go into the next state of his attack, state 9501. Note the RootDist trigger:

 

trigger1 = RootDist X <= -30

 

RootDist can take X or Y as a parameter, and returns the difference between the striker and his main character coordinates on the screen. In the above line, we check if the difference between Guy X position and Cody X position gives a value equal or less than -30. The smaller this value , the closest to Cody that Guy is. -30 is the approximate value where Guy's running sprite is in front of Cody. As I said, this value works for this particular sprite, your striker will probably use other values, so you will have to rely on trial and error until you are satisfied with the results.

 

You should have no problem with that Velset state, it only sets the x and y velocity of Guy to 0, so he stops running and stays in place. To the next animation then......

 

 

Guy standing and ready to attack - State 9501

 

 

[Statedef 9501]

type = A

movetype = A

physics = N

anim = 9500

velset = 0,0,0

ctrl = 0

 

[State 9500, 1]

type = HitOverride

trigger1 = time = 0

time = -1

attr = SCA, AA, AT, AP

slot = 0

stateno = 9506

 

[State 9501, 2]

type = sprpriority

trigger1 = Time = 0

value = 10

 

[State 9501, 3]

type = ChangeState

trigger1 = Time = 5

value = 9502

 

Nothing too special here. We follow the same structure as in the previous state.  We again use HitOverride to check if Guy has been hit by the opponent, and if so ,change him to state 9506,his getting hit animation. If he hasn't been hit we go to the next animation: State 9502.

 

 

 

Guy making the hurricane kick - State 9502

 

;-----------------------------------------------------------

[Statedef 9502]

type = A

movetype = A

physics = A

anim = 9504

velset = 2,-7,0

ctrl = 0

juggle = 2

 

[State 9500, 1]

type = HitOverride

trigger1 = time = 0

time = -1

attr = SCA, AA, AT, AP

slot = 0

stateno = 9506

 

[State 9502, 2]

type = sprpriority

trigger1 = Time = 0

value = 10

 

[State 9502, 3]

type = HitDef

trigger1 = AnimElem = 2

trigger2 = AnimElem = 4

trigger3 = AnimElem = 7

trigger4 = AnimElem = 9

trigger5 = AnimElem = 12

trigger6 = AnimElem = 14

attr = S, SP

damage = 34,8

animtype = Heavy

getpower = 10

givepower = 25

guardflag = MA

priority = 5

pausetime = 2,2

sparkxy = -10,-50

hitsound = S0,5

guardsound = S0,9

ground.type = High

ground.slidetime = 9

ground.hittime = 12

ground.velocity = -.5,-6

air.velocity = -.5,-6

fall = 1

 

[State 9502, 4]

type = PlaySnd

trigger1 = AnimElem = 1

trigger2 = AnimElem = 3

trigger3 = AnimElem = 6

trigger4 = AnimElem = 8

trigger5 = AnimElem = 11

trigger6 = AnimElem = 13

value = 0,7

 

[State 9502, 5]

type = PlaySnd

trigger1 = Time = 0

value = 6,2

 

[State 9502, 6]

type = ChangeState

trigger1 = AnimTime = 0

value = 9503

 

This is the main part of Guy's hurricane kick. In this state he rises up into the air,spinning and hitting the opponent if he is in range.

 

Check the velset definition at the beginning of the state:

 

velset = 2,-7,0

 

We use a negative value in Y velocity (-7) , because we want Guy to move up in the screen while he's doing his hurricane kick.

 

The rest of the state should be familiar to you. We use a HitDef controller for the hurricane kick, triggering it in the

animation frames of the move that actually hit the opponent (see triggern=Animelem=n lines above).  Note that we keep using the HitOverride controller, as in the rest of the states, to check if the opponent has hit Guy and react

accordingly.

 

The states that follow should be easy to understand by now, as they don't include nothing special about helpers, take a look at them if you so wish, or head to State 9505 to learn more about strikers.

 

 

 

Guy landing after the air hurricane kick - State 9503

 

;---------------------------------------------------------------------------

[Statedef 9503]

type = A

movetype = I

physics = N

anim = 9502

velset = 0,3,0

ctrl = 0

 

[State 9500, 1]

type = HitOverride

trigger1 = time = 0

time = -1

attr = SCA, AA, AT, AP

slot = 0

stateno = 9506

 

[State 9503, 2]

type = sprpriority

trigger1 = Time = 0

value = 10

 

[State 9503, 3]

type = Gravity

trigger1 = Time >= 0

 

[State 9503, 4]

type = ChangeState

trigger1 = Pos Y >= -2

trigger1 = Vel Y > 0

value = 9504

 

Nothing too special here, we just make Guy start landing from the hurricane kick, this is done by using a positive Y velocity at the beginning of the state, and then we check if he has actually touched the ground, by checking his

vertical position (See Pos Y) and vertical velocity (see Vel Y). 

 

Of course, as in the rest of the states , we use the HitOverride controller and check if Guy has been hit during this animation.

 

When we know that the sprite has touched the ground we change Guy to his next state, the state where he lands and does the taunt, prior to leave the screen, this is State 9504, our next state....

 

 

 

Guy as he lands on the ground - State 9504

 

;---------------------------------------------------------------------------

[Statedef 9504]

type = S

movetype = I

physics = S

anim = 9501

velset = 0,0,0

ctrl = 0

 

[State 9500, 1]

type = HitOverride

trigger1 = time = 0

time = -1

attr = SCA, AA, AT, AP

slot = 0

stateno = 9506

 

[State 9504, 2]

type = sprpriority

trigger1 = Time = 0

value = 10

 

[State 9504, 3]

type = PlaySnd

trigger1 = Time = 10

value = 6,1

 

[State 9504, 4]

type = ChangeAnim

trigger1 = AnimTime = 0

value = 9505   this is the taunt animation

 

[State 9504, 5]

type = ChangeState

trigger1 = Time = 50

value = 9505

 

Another not so difficult state to grasp, we show animation 9501, showing Guy landing, then (see highlighted code) when that animation ends, we change guy to Animation 9505, where he does his taunt to the opponent. Finally, in

State 9504,5 we change Guy's state to 9505, the state where he leaves the screen, and the one that shows why we must use the DestroySelf controller to avoid problems.

 

 

 

 

Guy leaving the screen after making his move - State 9505 

 

;---------------------------------------------------------------------------

[Statedef 9505]

type = A

movetype = I

physics = N

anim = 9502

velset = -7,-8,0

 

[State 9500, 1]

type = HitOverride

trigger1 = time = 0

time = -1

attr = SCA, AA, AT, AP

slot = 0

stateno = 9506

 

[State 9505, 2]

type = sprpriority

trigger1 = Time = 0

value = 10

 

[State 9505, 3]

type = Gravity

trigger1 = Time >= 0

 

[State 9505, 4]

type = DestroySelf

trigger1 = Pos X <= -170

trigger2 = Pos Y >= 20

 

We have finally reached the end of the Hurricane Animation: Guy has already entered the screen, made his hurricane kick, taunted the opponent ,and now that he has accomplished his mission, we are ready to take him out of the screen.

 

We mentioned before that strikers or helpers are like normal characters, they can make moves, receive hits,etc. As normal characters, the strikers take their share of the PC resources, so it's not enough to take them "off the screen", we must also erase them from memory.

 

We do so by calling the DestroySelf controller:

 

[State 9505, 4]

type = DestroySelf

trigger1 = Pos X <= -170

trigger2 = Pos Y >= 20

 

DestroySelf takes no parameters. We just use it in the "type=" line and that's it. This controller erases strikers only, you can't use it on normal characters. Also note that using DestroySelf doesn't mean that you can use your striker only one time, it means that the striker won't appear again until you call him by making the corresponding command.

 

The triggers that activate DestroySelf in State 9505,4 shouldn't be a problem to you. We just check the position of Guy, if he is the  position we like ,we make him disappear.

 

This concludes the states of the Hurricane Kick, but what happens if Guy is hit while making the move? We have been referring to it before, and here it is: State 9506.

 

 

 

Guy after being hit by the opponent - State 9506

 

;---------------------------------------------------------------------------

; Guy Falling (Getting hit)

 

[Statedef 9506]

type = A

movetype = I

physics = N

anim = 9506

velset = -2,-4,0

 

[State 9506, 1]

type = Gravity

trigger1 = time >= 0

 

[State 9506, 2]

type = ChangeState

trigger1 = Pos Y >= -2

trigger1 = Vel Y > 0

value = 9507

 

We already said that strikers are like normal characters, didn't we? Of course we did : ) and that can  be corroborated by reading the above state. There's nothing special in it, we make Guy fall if he is in the air, then when we know that he's touched the ground (see State 9506,2) we take him to State 9507, our final (whew!) state.

 

 

 

 

Guy standing up after the hit,and leaving the screen - State 9507

 

;---------------------------------------------------------------------------

; Guy Recovering after hit

 

[Statedef 9507]

type = A

movetype = I

physics = N

anim = 9507

velset = 0,0,0

 

[State 9507, 1]

type = Gravity

trigger1 = Time >= 32

 

[State 9507, 2]

type = VelSet

trigger1 = AnimElem = 9

x = -7

y = -8

 

[State 9507, 3]

type = DestroySelf

trigger1 = Pos X <= -170

trigger2 = Pos Y >= 20

 

 

Guy has received the hit, we make him stand up by using animation 9507 (see Statedef ), then adjust his velocity values  ( see State 9507,2) to make him go upwards, and outward. Finally, when he's gone off the screen, we take

Guy out of Mugen's memory by using the DestroySelf controller in State 9507,3. 

 

 

Summary and Final Words about Helpers

 

After making you go through so much code, I would feel guilty if I don't give you some quick tips about striker programming : ) , so here they are.

 

- First of all : Helpers are like normal characters, if there's something that can be made by normal chars, it probably can be made when programming helpers

 

- Always remember to check if the striker is not ALREADY in the screen when you call him using a line like the highlighted one in the CMD file: 

 

;---------------------------------------------------------------------------

; Guy Striker - a

[State -1]

type = ChangeState

value = 9400

triggerall = NumHelper(9500) = 0

triggerall = P2Name != "Guy"

triggerall = P4Name != "Guy"

trigger1 = command = "guy_1"

trigger1 = statetype != A

trigger1 = ctrl = 1

 

go here for a more detailed explanation

 

- When defining the state of the summon move in the CNS, take into account that the animation number you specify there is the main char's summon animation, not the striker animation!

 

;-----------------------------------------------------------------------------

; Guy summon (Hurricane)

[Statedef 9400]

type = S

movetype = A

physics = S

anim = 9400        This is the animation that the main char (Cody) 

                            is going to do while calling the helper.

velset = 0,0,0

ctrl = 0

 

 

- Use the Helper controller to create your striker and define his initial properties :

 

[State 9400, 1]

type = Helper

trigger1 = time = 0

ID = 9500

pos = -50,0

postype = back

stateno = 9500

helpertype = normal

name = Guy

keyctrl = 0

ownpal = 1

 

go here for a more detailed explanation

 

- Use the HitOverride controller to check if your striker has been hit, let him use his own set of GetHit states and avoid seeing him turn into his "parent" frames when being hit!

 

[State 9500, 1]

type = HitOverride

trigger1 = time = 0

time = -1

attr = SCA, AA, AT, AP

slot = 0

stateno = 9506

 

go here for a more detailed explanation

 

- Don't forget to call DestroySelf to erase your striker from memory! If you don't , by the time you have called your helper 10 or so times, the game will become so slow it will probably become unplayable, as it has 10 Guy's in memory!

 

[State 9505, 4]

type = DestroySelf

trigger1 = Pos X <= -170

trigger2 = Pos Y >= 20

 

go here for a more detailed explanation

 

- Finally, if there are times when you want to know if the character that called the striker (the "parent" or "root", Cody in this example) is in a determined state, or you simply want to refer your triggers to the main player, instead of the helper, you can type "parent," or "root," before the trigger:

 

trigger1 = parent, stateno = 40
trigger2 = root, command = fireball

 

This activates when the main character is beginning his jump (trigger1),or doing the "Fireball" command/

 

-Also , there are triggers specific to striker programming,click on them for specific information:

 

   - Rootdist

 -ParentDist

   -NumHelper

    -IsHelper

 

That's it, you have hopefully learned how to make strikers, now what are you waiting for? Go work!

 

 

note: this tutorial is dedicated to Santiago and his great Punisher

 

  back to Tutorial Index