YesNoOk
avatar

Making up for the broken DefenceMulSet SCTRL (Read 23641 times)

Started by Jesuszilla, August 15, 2014, 07:52:02 pm
Share this topic:
Making up for the broken DefenceMulSet SCTRL
#1  August 15, 2014, 07:52:02 pm
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
As you may or may not know, DefenceMulSet doesn't work for the first hit. That makes the SCTRL effectively broken because you don't get the results you expect.

Fortunately, there's a way to get the same results.

And now for an example code snippet that does the actual work. This adds 25% more damage to any taken.
Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8)-life)>0
value = ifElse((FVar(8)-life)<life,-floor((FVar(8)-life)/4),0)

As you can see, you will need one variable to keep track of life like so:

Code:
[State -2, Combo]
type = VarSet
trigger1 = 1
fvar(8) = life
ignorehitpause = 1

It doesn't have to be a float variable; int should work. And yes, IT MUST GO BELOW THE LIFEADD.

But you probably want to use it by plugging in the same value you'd use for DefenceMulSet, right? Then use this:

Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
value = floor(([insert value here] - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

So to increase damage by 25%, you'd do this:
Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
value = floor((1.25 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

And to reduce damage by half, you'd to this:
Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
value = floor((0.5 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))
Last Edit: August 16, 2014, 02:28:47 am by Jesuszilla
Re: Making up for the broken DefenceMulSet SCTRL
#2  August 15, 2014, 09:25:07 pm
  • ******
DefenceMulSet works from the second hit (the first hit does the normal damage, the second, third, fourth etc. hits will be conditioned from the DefenceMulSet), if you put a value that is less than 1. It doesn't work as intended (it should start instantly), that's for sure, but then it works. I've seen a lot of people used to describe DefenceMulSet as something that doesn't work saying it's broken, which is not really correct.

I tried to put a code that makes it work everytime (in state -2, trigger1 equal to 1, value less than 1, like 0.5), just to test it.
I put the code in KFM and tried doing the crouch strong punch against himself: without the DefenceMulSet it deals 73, with DefenceMulSet it deals 55.
Calling it DefenceMulSet was wrong since the code doesn't multiply but it divides for the value you put to it.
So if you put 0.5, your defence is twice the normal value, if you put, let's say, 20, it divides 100 (normal/default value in the data).
100/20 = 5
The defence value becomes 5 (for the second hit).
If you put 0,
100/0 = ∞ , let's say it is infinite, normally that operation can't be done, but you know what I mean (no damage from the second hit)

In any case, I just wanted to put this here.

I'm sure your code is much more flexible than how the DefenceMulSet is now.
Last Edit: August 16, 2014, 12:49:52 am by Alex Sinigaglia
Re: Making up for the broken DefenceMulSet SCTRL
#3  August 16, 2014, 02:20:18 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
I updated the first post. You have to put the lifeadd BEFORE the varset.

Also, you're incorrect. You must have replaced the wrong value, or used the wrong code snippet, because I get the expected behavior when when I plug in values for KFM vs. KFM.

For .5, I get 12 for LP, just as I should. If I plug in .2, I get 5, just as I should.


I don't get why you're bringing up division by 0 when that's not happening in this:
Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
value = floor(([insert value here] - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

... at all.

Read.
Re: Making up for the broken DefenceMulSet SCTRL
#4  August 16, 2014, 02:30:39 pm
  • ******
Spoiler, click to toggle visibilty
...
And when I finished making this post I read the first line of the first post. >_<
Oh well, at least I brought up some examples of the effectiveness of the original DMS. If you want to see them click the spoiler.

Everyone, use JZ's code!  :)
Re: Making up for the broken DefenceMulSet SCTRL
#5  October 23, 2015, 02:55:39 am
  • avatar
  • **
    • USA
    • hamalto1990@yahoo.com
I updated the first post. You have to put the lifeadd BEFORE the varset.

Also, you're incorrect. You must have replaced the wrong value, or used the wrong code snippet, because I get the expected behavior when when I plug in values for KFM vs. KFM.

For .5, I get 12 for LP, just as I should. If I plug in .2, I get 5, just as I should.


I don't get why you're bringing up division by 0 when that's not happening in this:
Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
value = floor(([insert value here] - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

... at all.

Read.

Nice coding but if an attack hits over 50 percent of the original hp, the attack bypasses ur code
Re: Making up for the broken DefenceMulSet SCTRL
#6  November 01, 2015, 11:12:41 pm
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Let the value be 0.5 and let the life be full at 1000.

Let the attack damage be 501 as represented by (FVar(8) - life).


Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
value = floor(([insert value here] - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = 501 > 0 ; true
value = floor((0.5 - 1.0) * ifElse(501 < 1000, -501,0))
= floor(-0.5 * ifElse(501 < 1000, -501, 0))
= floor(250.5)
= 250 ; adds back half the damage received


QED. Check your math.
Re: Making up for the broken DefenceMulSet SCTRL
#7  November 06, 2015, 02:45:35 am
  • avatar
  • **
    • USA
    • hamalto1990@yahoo.com
Let the value be 0.5 and let the life be full at 1000.

Let the attack damage be 501 as represented by (FVar(8) - life).


Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
value = floor(([insert value here] - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = 501 > 0 ; true
value = floor((0.5 - 1.0) * ifElse(501 < 1000, -501,0))
= floor(-0.5 * ifElse(501 < 1000, -501, 0))
= floor(250.5)
= 250 ; adds back half the damage received


QED. Check your math.

I tested it out by using a numhelper trigger

if an normal attack does 700 damage to the character(without helper) it still do the same damage with your code active

lets say an normal attack does 1000 to someone with 100 armor
they will still die using  ur code unlike someone with 200 armor or 2000 hp(without your code)

I doubt lifeadd would work if the hp is instantly at 0

here is the code i used

[State -2, lifeadd support]
type = LifeAdd
trigger1 = NumHelper(6000) = 1
value = floor(0.01*gethitvar(damage))

Spoiler, click to toggle visibilty


[State 0, Def up]
type = LifeAdd
triggerall = life > 1
triggerall = Var(5) = 1
trigger1 = 1
value= 0.80*fvar(8)

[State -2, Combo]
type = VarSet
trigger1 = 1
fvar(8) = (GetHitVar(damage))
ignorehitpause = 1


Last Edit: November 09, 2015, 06:41:04 am by coldskin1
Re: Making up for the broken DefenceMulSet SCTRL
#8  November 10, 2015, 03:23:42 am
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Ah. In order to fix the error you mentioned, you probably need to combine it with checking the math and adding AssertSpecial flag = noKO like so:

Code:
[State -2, AssertSpecial]
type = AssertSpecial
triggerall = Alive && MoveType = H
triggerall = (FVar(8) - life) > 0
; Remember to add any other triggers for the LifeAdd below here, or you may get undesirable behavior!
trigger1 = life + (floor(([insert value here] - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))) > 0
flag = noKO
ignorehitpause = 1

[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life) > 0
value = floor(([insert value here] - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))


This is only necessary if [insert value here] < 0.
Last Edit: November 10, 2015, 03:27:11 am by Jesuszilla

vyn

Re: Making up for the broken DefenceMulSet SCTRL
#9  May 29, 2016, 01:43:53 am
  • ****
    • Mexico
    • armandojc3@gmail.com
necroing here a bit.

im trying to imitate sfiv but what i have is unstable, doesnt work 100% of the time, can you please review?



Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
trigger1 = fvar(8) < (lifemax/2)
trigger1 = fvar(8) >= (lifemax*.3)
value = floor((.95 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
trigger1 = fvar(8) < (lifemax*.3)
trigger1 = fvar(8) >= (lifemax*.15)
value = floor((.9 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
trigger1 = fvar(8) < (lifemax*.15)
value = floor((.75 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, Combo]
type = VarSet
trigger1 = 1
fvar(8) = life
ignorehitpause = 1
Re: Making up for the broken DefenceMulSet SCTRL
#10  June 02, 2016, 07:55:53 am
  • avatar
  • **
    • USA
    • hamalto1990@yahoo.com
necroing here a bit.

im trying to imitate sfiv but what i have is unstable, doesnt work 100% of the time, can you please review?



Code:
[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
trigger1 = fvar(8) < (lifemax/2)
trigger1 = fvar(8) >= (lifemax*.3)
value = floor((.95 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
trigger1 = fvar(8) < (lifemax*.3)
trigger1 = fvar(8) >= (lifemax*.15)
value = floor((.9 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, DefenseMulSet]
type = LifeAdd
triggerall = Alive && MoveType = H
trigger1 = (FVar(8) - life)>0
trigger1 = fvar(8) < (lifemax*.15)
value = floor((.75 - 1.0) * ifElse((FVar(8)-life) < life, -(FVar(8) - life),0))

[State -2, Combo]
type = VarSet
trigger1 = 1
fvar(8) = life
ignorehitpause = 1

maybe  the code don't work sometimes because someone hit while your life was still above one of your lifemax triggers.

For instance lets say you're at 75 percent hp out of 1000 and someone hit u with 400 hit points the damage would still be at 100 percent damage


Last Edit: June 02, 2016, 07:59:53 am by coldskin1