YesNoOk
avatar

Have Helper change state from Player Attacks only?  (Read 4359 times)

Started by Sumisuman, October 23, 2013, 05:30:09 am
Share this topic:
Have Helper change state from Player Attacks only?
#1  October 23, 2013, 05:30:09 am
  • *
    • USA
Hi, I'm new to programming for MUGEN, and I just want to make a helper that changes state when attacked by player attacks only. I was thinking of making player attacks have "affectteam = B" and giving the helpers HitOverride State definitions, but I fear that this means that these HitOverrides will trigger when the opponent hits the helper as well. Could someone help me with this?

To clarify, it's a baseball player hitting a ball (the helper) with a bat (essentially all of his basic attacks).
Re: Have Helper change state from Player Attacks only?
#2  October 23, 2013, 08:14:50 pm
  • **
  • NvP!
Instead of affectteam = B, use affectteam = F, but this would also hit your teampartner when youre playing in team mode
Re: Have Helper change state from Player Attacks only?
#3  October 23, 2013, 08:45:58 pm
  • *
    • USA
But wouldn't this mean that regular attacks cannot hit the opponent anymore (which they still need to be able to do)?
Re: Have Helper change state from Player Attacks only?
#4  October 23, 2013, 09:43:44 pm
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
You could "fake" the hit. ;)

Example:
* Baseball falls into Y pos of Bat.
 -> Change Vel X & Vel Y of Baseball to hit by Bat velocities
  -> Change Bat to hit Baseball swinging
  -> Add hit spark & hit sound.

In other words, instead of using a regular hitdef, script the action of it getting hit via special effects. ;)

"You must defeat my flaming
dragon punch to stand a chance."
Re: Have Helper change state from Player Attacks only?
#5  October 24, 2013, 03:23:55 pm
  • **
  • NvP!
thats also what i had in mind doing this fake hit thingy, its also the better option!
Re: Have Helper change state from Player Attacks only?
#6  October 24, 2013, 10:45:34 pm
  • *
    • USA
Well, That may be fine for 1-2 different attacks, but I don't think it's very effective if a character has 10+ attacks that can affect the trajectory of the ball. Well, at least in this case, where the bat is part of the character model, not a separate object or anything.
Re: Have Helper change state from Player Attacks only?
#7  October 25, 2013, 12:30:54 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
Well instead of identifying the Y pos of the Bat, identify the Y pos of the player, subtract the "position" of where the bat is being held by the player.

How many different attacks are we talking about? Just use a FVar(0) for different X velocities, and a FVar(1) for different Y velocities for all the speeds. So you could make him use the same state, just change the Float Variables depending on which button has been pressed.

"You must defeat my flaming
dragon punch to stand a chance."
Re: Have Helper change state from Player Attacks only?
#8  October 30, 2013, 06:04:50 am
  • *
    • USA
I suppose that could work, but I was wondering if I could use something like the fabled "hitid" or chainID or something to guarantee which attack connected with the ball.
Re: Have Helper change state from Player Attacks only?
#9  October 30, 2013, 06:38:01 am
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
Instead of hitID or chainID, use Var(#) to identify the strength of the attack? Or is HitID, or ChainID absolutely required for your action you are scripting?

"You must defeat my flaming
dragon punch to stand a chance."
Re: Have Helper change state from Player Attacks only?
#10  October 30, 2013, 07:41:20 am
  • *
    • USA
Well, it makes the whole concept a lot easier to implement, because I from there, I can easily change effects depending on which hit makes contact with the ball. How does Var(#) work?
Re: Have Helper change state from Player Attacks only?
#11  October 30, 2013, 05:20:48 pm
  • ******
  • Video Game Veteran
  • Can you do it? SUREYOUCAN!
    • USA
    • gcnmario.free.fr
I meant something like this:
Code:
[state 123, varset]
type = VarSet
trigger1 = command = "x"
var(1) = 0

[state 123, varset]
type = VarSet
trigger1 = command = "y"
var(1) = 1

[state 123, varset]
type = VarSet
trigger1 = command = "z"
var(1) = 2

[state 123, varset]
type = VarSet
trigger1 = command = "a"
var(1) = 3

[state 123, varset]
type = VarSet
trigger1 = command = "b"
var(1) = 4

[state 123, varset]
type = VarSet
trigger1 = command = "c"
var(1) = 5

[state 123, varset]
type = VarSet
trigger1 = command = "start"
var(1) = 6

Pressing a certain button will change var(1) to whatever number you set it to in this case. So higher the number Var(1) is, the stronger the strength of the attack could be, or something like that.

"You must defeat my flaming
dragon punch to stand a chance."
Re: Have Helper change state from Player Attacks only?
#12  November 02, 2013, 06:47:47 pm
  • ****
  • Club -SyN- in my past life
    • USA
    • negative-edge.net
why couldnt he just use a hitby and  hitoverride?
Re: Have Helper change state from Player Attacks only?
#13  November 04, 2013, 07:48:17 pm
  • *
    • USA
Thanks for your help on this N-Mario, I decided to go that Variable route, and while it's not perfect, it's pretty good all the same.

--SyN -> I'm using hitoverride, but can HitBy give the specific ID of the Hit (i.e, the ball was hit by an attack with ID = 100, or a hit who's state is 123), because that would be perfect. Else, I have to rely on N-Mario's suggestion.
Re: Have Helper change state from Player Attacks only?
#14  November 04, 2013, 07:55:31 pm
  • *****
  • Thanks and God bless
    • USA
    • ricepigeon.neocities.org
So let me get this straight, you want P1 to create a helper that can get hit by P1's attacks?

Tried it long ago. Not possible. Only option, as N-Mario said, is to "fake" the hit.
Re: Have Helper change state from Player Attacks only?
#15  November 04, 2013, 08:29:08 pm
  • *
    • USA
Yeah, I'm using affectteam= B for hits that can hit the ball, as the bat can be used to hit the opponent as well. It's not perfect, but it's nice for a first attempt.