YesNoOk
avatar

Actual SFIV Damage Scaling (Read 76596 times)

Started by Yoshin222, October 09, 2017, 09:46:38 pm
Share this topic:
Actual SFIV Damage Scaling
#1  October 09, 2017, 09:46:38 pm
  • ***
  • Getting better, still a long way to go
    • UK
A while back, i made a method for SFIV damage scaling. This was unwise as it relied on AttackMulSet which isn't completely reliable. While studying HDBZ code (reasons) i decided to make a Sean character test out my current capabilities with making characters. While doing so i developed a method of calculating damage similar to SFIV. For those who don' know, in SFIV the first 2 hits are unscathed, with the next hit doing 80% damage, then 70% and so on. Unfortunately i haven't been able to figure out a good method for Life Scaling yet, so Fvar(9) is unused in this code for now. If anyone has a method, please let me know. With that out of the way, heres what ya need
4 Available Vars, in this example  i use Fvars 8,10, 11 and 13.
In this example, Far(8) is used to see if the move is a counterhit, adding an additional 20% to the damage if it is. Fvar(10) is the damage scaling percent, Fvar(13) keeps track of how many hits are in the combo, and Fvar(11) is the final calculation. Finally, contained at the bottom if what should be put in to your hitdefs damage parameter for the scaling to work. It just checks if theres more than 2 hits in the combo, then applies the scaling. Otherwise its unscaled.

OLD, PLEASE REFER TO NEW CODE
Spoiler, click to toggle visibilty

This code isn't perfect, and i'd rather have total control over when damage scaling takes effect and how instead of relying on Movehit, but for now this code should serve as a great starting point for anyone wanting to add a lil bit of sophistication to their characters but have difficulty grasping damage scaling (i know i did) so if theres anything wrong with this code please let me know. With that have a good day and hope this helps!

EDIT
My sleep patterns been fucked recently, i apologise for my idiocy XD There are a bunch of flaws in that code. When i tested it it worked at the time, but now i see there are multiple errors, suchl as the scaling applying too late. I have not only fixed that issue, but have simplified the damage template, and have even added Life Scaling! Now when the opponent is at 50% or less, they have damage reduced by 10%, 15 at 30% and lower. Everything still applies, except the whole Fvar(9) stuff thats being used now.

NEW
Spoiler, click to toggle visibilty

EVEN NEWER
Spoiler, click to toggle visibilty
Last Edit: March 15, 2023, 08:54:29 am by Yoshin222
Re: Actual SFIV Damage Scaling
#2  March 11, 2023, 07:02:17 am
    • USA
Hi! I got a quick question about the this piece coding for damage scaling. How come it keeps resetting after each round? Like, no damage is dealt after round one, and I can't seem to figure out the issue.
Re: Actual SFIV Damage Scaling
#3  March 11, 2023, 09:08:51 am
  • ***
  • Getting better, still a long way to go
    • UK
Nothing about the code references the roundstate at all, either ya implemented it wrong or your State 5900 scuffs it somehow
Make sure no vars are accidentally being mixed, not sure if ya know about SwissArmyKnife but that can also help find blemishes
Re: Actual SFIV Damage Scaling
#4  March 11, 2023, 09:03:50 pm
    • USA
Okay, I tried to look into the issue some more, and I found that changing the vars didn't do anything. I also looked into State 5900, I'm not sure what it could be that's preventing the damage scaling to just stop working after around one. I mean, nothing seems wrong here but I'm not 100% sure.

Here's the code for the character in State 5900:
Code:
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5900, 1] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0

[State 5900, 2] ;Clear all float variables
type = VarRangeSet
trigger1 = roundsexisted = 0
fvalue = 0

[State 5900, 3] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
value = 190
Re: Actual SFIV Damage Scaling
#5  March 15, 2023, 08:22:54 am
  • ***
  • Getting better, still a long way to go
    • UK
After doing some tinkering, found some weirdness i missed the first time. Refactored it a fair bit, and applied it to KFM and it works ifine. Very confident any bugs are just a matter of implementation now. Check the first post, hope this helped

      Posted: March 15, 2023, 08:26:00 am
Fuck this is typical, found a bug, gimme a bit

Ok that should do it for real this time
Last Edit: March 15, 2023, 08:55:11 am by Yoshin222
Re: Actual SFIV Damage Scaling
#6  March 15, 2023, 07:03:24 pm
  • ******
    • Portugal
    • network.mugenguild.com/pots/
At first glance there's a major issue with this code in that it's based on the current number of hits, when the main point of SF4 (and SF5's) damage scaling is that all moves are treated the same, no matter how many hits they do. It's not that the third hit should do 80% damage, but that the third attack should.

Also how do fireballs work with this code?

Other random observations that may help people who are learning how to code for Mugen:

Code:
[State -2, Hit Count] 
type = VarAdd
trigger1 = !IsHelper
This check only makes a difference for player type helpers, which generally shouldn't be used anyway.

Code:
trigger1 = !HitPauseTime 
trigger1 = !(HitDefAttr = SCA, AT)
var(3) = 1
ignoreHitPause = 1
If you removed the ignorehitpause line you wouldn't need to check if the hitpause was over.

Code:
triggerall = (EnemyNear, MoveType != H) && (EnemyNear, StateNo != 5300)
It's better to use the P2 triggers when possible (P2movetype and P2stateno), as Enemynear also checks dead enemies while P2 ignores them.

Also it's just easier to use an AttackMulSet than making expressions for all Hitdef damages. The only reason I did the latter at one point was to implement minimum damage in each Hitdef, which SF4 doesn't do.

Sorry if this all comes out the wrong way. I personally learned a lot when people first picked apart my codes (hello Winane).
You can help with Ikemen GO's development by trying out the latest development build and reporting any bugs on GitHub.
My Mugen and Ikemen content can also be found here.
Re: Actual SFIV Damage Scaling
#7  March 22, 2023, 07:41:46 pm
    • USA
After doing some tinkering, found some weirdness i missed the first time. Refactored it a fair bit, and applied it to KFM and it works ifine. Very confident any bugs are just a matter of implementation now. Check the first post, hope this helped

      Posted: March 15, 2023, 08:26:00 am
Fuck this is typical, found a bug, gimme a bit

Ok that should do it for real this time

Haha, awesome! I'm gonna test this out in a little bit. Thanks a ton for this!