YesNoOk
avatar

How To Receive Triple Damage  (Read 659 times)

Started by Creamy_Goodness, April 09, 2019, 07:55:23 am
Share this topic:
How To Receive Triple Damage
#1  April 09, 2019, 07:55:23 am
  • ***
    • USA
    • creamyg.jdluke.com/

> 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/
Last Edit: May 24, 2019, 11:53:00 am by Creamy_Goodness
Re: How To Receive Triple Damage
#2  May 21, 2019, 02:27:55 am
  • ***
    • USA
    • creamyg.jdluke.com/

> Alright, I've been doing some further work on the code for Creamy's weak spot after getting some help from the Mugen Free For All forums. A user named PlasmoidThunder pointed me to this thread from this very message board that went into detail about altering the amount of damage a character takes when hit...

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

> When I did my initial search for help on how to get Creamy to receive triple damage when hit on certain frames of one of his attacks, I came across this thread but dismissed it as useless because it was too complicated for me to understand. However, since PlasmoidThunder linked to it in our thread at MFFA, I took a more thorough look at the coding, and going through the code 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 Creamy'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 Creamy'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?
 
= = = = = = = = = =
Jason "Creamy Goodness" Tenn
http://creamyg.jdluke.com/
Re: How To Receive Triple Damage
#3  May 21, 2019, 06:25:15 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
For starters, I don't think you need a Var(3).   In State -2 just use the trigger "trigger1 = Anim = XX && (AnimElemNo(0) = [5, 7])."
But put the MoveType trigger above it which should be more efficient.

Now for the lifeadd - I'm pretty sure you should be using the GetHitVar trigger to calculate how much extra damage to take, rather than looking at your life values at all.  So you'll take the normal damage, then execute a LifeAdd of the damage * 2

[State -2, Triple Damage]
type = LifeAdd
trigger1 = MoveType = H ;Creamy must be in Get Hit move type
trigger1 = Anim = XX && (AnimElemNo(0) = [5, 7])
value = -(GetHitVar(damage) * 2)

Well, your only problem now is getting this to only trigger 1 time since it is in State -2 and is active for multiple ticks.
You could use that freed up Var(3) by setting it on successful damage adder, and resetting the var somewhere after recovery like in State 0

[State -2, Triple Damage]
type = LifeAdd
triggerall = var(3) = 0
trigger1 = MoveType = H ;Creamy must be in Get Hit move type
trigger1 = Anim = XX && (AnimElemNo(0) = [5, 7])
trigger1 = var(3) := 1
value = -(GetHitVar(damage) * 2)

[State 0, Reset Var]
type = VarSet
trigger1 = !time
var(3) = 0

Re: How To Receive Triple Damage
#4  May 24, 2019, 11:52:47 am
  • ***
    • USA
    • creamyg.jdluke.com/

@altoiddealer

> First off, I DID need Var(3) in order to tell the CNS when to implement the double or triple damage, and when to disable it.

> Anyways, thanks for your reply, and I think it may have led me to the right answer; the line "value = -(GetHitVar(damage) * 2)" in particular. 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.
= = = = = = = = = =
Jason "Creamy Goodness" Tenn
http://creamyg.jdluke.com/
Re: How To Receive Triple Damage
#5  May 24, 2019, 04:13:11 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Glad to hear it, good luck with your project :)