Jump to content
  • 0

How To Receive Triple Damage


Creamy_Goodness

Question

> I'm trying to produce a weak spot on my Creamy Goodness character, where he will take triple damage if hit during certain frames. I set aside Variable 3 in order determine when the weak spot is activated; 1 meaning Creamy takes normal damage, 2 meaning he takes double damage, and 3 meaning he takes triple damage. During the intro, Variable 3 is set to 1 in order to ensure Creamy takes normal damage at the start of the round...

[State 190, Variable Set]
type = VarSet
trigger1 = Time = 0 ;kicks in immediately
v = 3 ;Variable 3 - Extra damage taken (for weak spots)
value = 1 ;Sets Extra damage taken variable to 1 (Normal damage taken)

----------

> During the attack that bears the weak spot, I set Variable 3 to 3 in order to activate the triple damage on the desired frames...

[State 3500, Variable Set]
type = VarSet
trigger1 = AnimElemNo(0) = [5, 7]
;^Animation must be between its fifth and seventh frames^
v = 3 ;Variable 3 - Extra damage taken (for weak spots)
value = 3 ;Sets Extra damage taken variable to 3 (Triple damage taken)

----------

> In State -2, I tried to use a LifeAdd state controller to get Creamy to take the multiplied damage. However, after several attempts, I just couldn't the syntax of the coding right. Here's what my LifeAdd currently looks like...

[State -2, Triple Damage]
type = LifeAdd
trigger1 = var(3) = 3 ;Result of Variable 3 getting set to 3
;trigger1 = MoveType = H ;Must be in Get Hit move type
value = gethitvar(damage) * 3
;^Creamy takes triple damage when hit.^

----------

> In order to determine that Variable 3 is triggering correctly, I added a bit of temporary code that turns Creamy grey so I can know when the weak spot is active...

[State -2, PalFX] ;temporary
type = PalFX
trigger1 = Var(3) = 3
Time = 1
color = 0

----------

> I've already been through a thorough Google search that included MFG threads on this very topic, and official Elecbyte documentation, but it wasn't enough to provide me with a sufficient answer. Any help would be appreciated.

 

= = = = = = = = = =

Jason "Creamy Goodness" Tenn
http://creamyg.jdluke.com/
 
 
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

 

@PlasmoidThunder

 

> Thanks for your help, but I think I found the answer I was looking for. I went back to my original code, and all I had to do to fix the triple damage issue was make a minor change to one line. I simply changed "value = gethitvar(damage) * 3" to "value = gethitvar(damage) * -3", and that did the trick. As it turns out, my original code wasn't multiplying the damage taken from a hit by 3, but instead taking the original hit's damage, multiplying it by 3, and ADDING the product to the health. Changing 3 to -3 fixed that problem. I don't think that's the fix you had in mind, but it worked for me. I think I can now finally mark this thread as solved, and thanks again for your help.

Link to comment
Share on other sites

  • 0

So I'm guessing this isn't working then? You didn't exactly ask a question.

 

While not necessarily the answer to your question, using the intro to set a variable isn't reliable since it can be skipped, whereas the round initialisation state (5900) is always processed.

Link to comment
Share on other sites

  • 0

 

PlasmoidThunder - "So I'm guessing this isn't working then? You didn't exactly ask a question."

 

> I'm basically asking what the proper syntax is for making a character take triple damage. Right now, I'm using "value = gethitvar(damage) * 3" in the LifeAdd state, but that doesn't seem to be doing anything.

 

----------

 

PlasmoidThunder - "While not necessarily the answer to your question, using the intro to set a variable isn't reliable since it can be skipped, whereas the round initialisation state (5900) is always processed."

 

> OK thanks, I'll keep that in mind.

Link to comment
Share on other sites

  • 0

Gethitvar(damage) isn't very reliable as it doesn't take the first hit into consideration or something to that effect, though it's worth noting that your code would actually restore your character's Life because you're applying the damage as a positive value to your Life stat.

 

I recommending looking at this alternative for the broken DefenceMulSet sctrl and then modifying it for your own purposes:

http://mugenguild.com/forum/topics/making-broken-defencemulset-sctrl-161617.0.html

 

It circumvents the gethitvar(damage) issue by using something more reliable.

Link to comment
Share on other sites

  • 0

 

@PlasmoidThunder

 

> Actually, the thread you linked to was one of the MFG posts I came across while looking for help on this problem, but at the time I considered it to be too complicated for me to follow, so I dismissed it as useless. However, after your post, I took a another look at the post after you linked to it, but this time, I went through the coding line by line, and tried my best to understand what each line meant. From what I was able to understand, I came up with my own version of the coding and applied it to my character...

 

> During the attack that bears the weak spot, I set Variable 4 to match the character's hit points on the first frame of the animation, in order to record how much health he has before he could get hit...


[State 3500, Variable Set]
type = VarSet
trigger1 = AnimElem = 1 ;kicks in when animation reaches its first frame
var(4) = life ;Sets Variable 4 to current number of hit points

 

----------

 

> In State -2, under the section that handles weak spots, I changed the LifeAdd state controller to the following...


[State -2, Triple Damage]
type = LifeAdd
trigger1 = var(3) = 3 ;Result of Variable 3 getting set to 3
trigger1 = MoveType = H ;Creamy must be in Get Hit move type
value = (var(4) - life) * -3 ;HP before hit, minus HP after hit, times -3
;^Creamy takes triple damage when hit.^

 

----------

 

> The changes I made to my character's code are not working because he now takes zero damage when the weak spot gets hit. After some testing of the code, I've concluded that for whatever reason, the health is not reducing since Variable 4 was set to the number of HP, meaning "var(4)" is still equal to "life" when the triple damage is triggered. This means that var(4) minus life equals zero, and zero multiplied by anything equals zero, which is why the health didn't budge. My question now is how do I make sure that life is lower than var(4) when LifeAdd is activated?

 

 

 

 

Link to comment
Share on other sites

  • 0

Because the VarSet for the Life var (in your case, var(4)) needs to be in state -2 with the LifeAdd sctrl, and like the thread says, it needs to be placed below the LifeAdd. In addition, you're multiplying the result of (var(4) - life) by -3, so you're adding Life again; setting it to 3 works, but results in massive damage.

 

[State -2, Triple Damage]
type = LifeAdd

triggerall = var(3) = 3 ;Triple damage flag set
triggerall = alive && movetype = H
trigger1 = (var(4)-life) > 0
value = (3-1)*ifelse((var(4)-life) < life, -(var(4)-life),0) ;Multiply damage by 3

 

[State -2, VarSet]
type = VarSet
trigger1 = 1
var(4) = life
ignorehitpause = 1

 

All you need to do is set var(3) as you have been doing and this will work. Since you mentioned above that the value of var(3) equates to the damage multiplier, you could modify the LifeAdd sctrl like so:

 

[State -2, Damage Multiplier]
type = LifeAdd

triggerall = var(3) > 1 && var(3) <= 3 ;Damage multiplier flag set, failsafe in case the opponent messes with your variables and sets var(3) to something higher than intended
triggerall = alive && movetype = H
trigger1 = (var(4)-life) > 0
value = (var(3)-1)*ifelse((var(4)-life) < life, -(var(4)-life),0) ;Multiply damage by the value of var(3)

 

The bolded text is what I changed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...