YesNoOk
avatar

var modifications to hitdef attributes? (Read 1167 times)

Started by Bannana, February 23, 2019, 07:15:58 am
Share this topic:
var modifications to hitdef attributes?
#1  February 23, 2019, 07:15:58 am
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
Not necessarily a question about how to do something but more whether it can be done according to the hardcoded parts of the engine (and maybe should be in the discussion section instead? It seems every time I have a good question it's about hardcoding!)

In my source I have a simple anti-air punishment in which the properties:

hit type
fall type
air velocity
hit sound
damage multiplier
hit effects

are all affected by the opponent's state type (defined by var(18)* in this situation).

Recreating this actually isn't an issue for me (and it's really just 10 seconds of editing)
Spoiler: But it requires TWO hitdefs for a light punch (click to see content)
I shouldn't complain (Kn generally uses two hitdefs for his Garou conversions, so why should I want to be any better?), but I favor brevity and readability in most situations so I prefer to clear up unnecessary clutter. So the question I have is whether I can feasibly define things such as hitflag or hitsound within a single hitdef according to var(18).

As far as I understand, I can't apply a cond(var(18)=1,A,MF) to a hitflag because it isn't defined by triggers, and I guess the same is so that I can't apply cond(var(18)=1,(s8001,4),(s8001,0)) to hitsound,
so are there any ways of influencing these flags or am I just shit out of luck?


*var(18) is defined in this manner
Code:
;======================================
; p2 air determination
;======================================
[State in air?]
type = VarSet
trigger1 = p2statetype = A && p2movetype != H
v = 18
value = 1
ignorehitpause = 1

[State hit]
type = VarSet
trigger1 = p2statetype = A && p2movetype = H
v = 18
value = 0
ignorehitpause = 1

[State stand]
type = VarSet
trigger1 = p2statetype != A
v = 18
value = 0
ignorehitpause = 1




Thanks for your time.
Last Edit: February 24, 2019, 03:58:58 am by Bannana
Re: var modifications to hitdef attributes?
#2  February 23, 2019, 02:13:19 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
I believe this will work for hitsound
Code:
s8001 , cond(var(18)=1,4,0)

Unfortunately I don’t think anything can be done about hitflag.

I thought maybe those hitdefs could be combined but you can't do much about animtype...
Code:
[State air]
type = HitDef
trigger1 = animelem = 3
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = back          ;Light, Medium, Hard, Back, Up, DiagUp
priority = 4,Hit
damage = ceil((cond(var(7)>1,(35.71428571428571*(fvar(13))*fvar(0)),35.71428571428571*fvar(0)))*cond(var(18)=1,1.5,1)),0
pausetime = 6,6
sparkno = S8000
guard.sparkno = S8100
sparkxy = -30,-70
hitsound = s8001 , cond(var(18)=1,4,0)
guardsound = S8002,0
ground.type = high      ;Low, Trip, None
ground.slidetime = 10
ground.hittime = 10
ground.velocity = cond(var(18)=1,fvar(20)/2,0)
air.type = high      ;Low, Trip, None
air.hittime = 20
air.velocity = fvar(20)/2,0
ground.cornerpush.veloff = 0
fall = cond(var(18)=1,1,0)
ID = 1
Last Edit: February 23, 2019, 10:35:25 pm by ink
Re: var modifications to hitdef attributes?
#3  February 24, 2019, 03:51:46 am
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
I was actually thinking the same myself driving back from work today.

Because I can define separate air and ground velocities and hit times in one hitdef, and the var works for hitsound it seems that the hitflags aren't actually the problem, but the animtype is. I might be able to use p2statetypeno and set it to a clone of the common hit states.

Code:
[State air]
type = HitDef
trigger1 = animelem = 3
attr = S,NA        ;SCA,NA,SA,HA,NP,SP,HP,NT,ST,HT
hitflag = MAF        ;HLAFD+-
guardflag = MA         ;HLA
animtype = light         ;Light, Medium, Hard, Back, Up, DiagUp
priority = 4,Hit
damage = ceil((cond(var(7)>1,(35.71428571428571*(fvar(13))*fvar(0)),35.71428571428571*fvar(0)))*cond(var(18)=1,1.5,1)),0
pausetime = 6,6
sparkno = S8000
guard.sparkno = S8100
sparkxy = -30,-70
hitsound = s8001 , cond(var(18)=1,4,0)
guardsound = S8002,0
ground.type = high      ;Low, Trip, None
ground.slidetime = 10
ground.hittime = 10
ground.velocity = cond(var(18)=1,fvar(20)/2,0)
air.type = high      ;Low, Trip, None
air.hittime = 20
air.velocity = fvar(20)/2,0
ground.cornerpush.veloff = 0
fall = cond(var(18)=1,1,0)
p2stateno = cond(var(18)=1,289,288)
ID = 1

Code:
;var(18)=0
[Statedef 288]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
value = 5000

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

;var(18)=1
[Statedef 289]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
value = 5030

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

Yeah, it works so far, which is good enough for me to tweak it later, thanks!


final tweaked result is changing
Code:
[State hit]
type = VarSet
trigger1 = p2statetype = A && p2movetype = H
v = 18
value = 2
ignorehitpause = 1
and then altering p2stateno accordingly
Code:
p2stateno = cond(var(18)=1,5022,cond(var(18)=2,5020,5000))
Last Edit: February 24, 2019, 04:16:45 am by Bannana
Re: var modifications to hitdef attributes?
#4  February 24, 2019, 04:46:33 am
  • ****
    • USA
    • twitter.com/inktrebuchet
That’s pretty clever! Why didn’t I think of that?