YesNoOk
avatar

Counter-Type Attack with Projectile (Read 1115 times)

Started by Afterthought, February 18, 2018, 03:41:56 pm
Share this topic:
Counter-Type Attack with Projectile
#1  February 18, 2018, 03:41:56 pm
  • avatar
  • **
While I wait for some more assistance on my previous topic, I have yet another attempt that needs troubleshooting.

Through my research I've found that it is possible to create a counter-type attack triggered only by projectiles or projectile-type attacks; while most people want to be able to deflect projectiles themselves, I find that the former works for my purposes.

For the most part what I put together does work, but of course there are some issues:

1. Upon activating the actual counter state, any projectiles will trigger that state even if my character currently is NOT in that state (so if he's in State 0 for example, being hit with a projectile will still trigger the counter state).
2. As I'm using a projectile in the counter state, I'd expect projpriority to work, but it doesn't seem to: I'm sure this is because some characters use helpers to create projectiles, as opposed to the actual projectile state controller. This means the counter projectile is usually destroyed in one hit, making the attack useless against two or three projectiles in a row. Is there a way to make my projectile more resilient? Maybe even near-invincible?

I currently have the projectile IN a helper, as I figured that way it could be a bit more customizable, but if that's wrong feel free to point it out.

(Be aware that I post code as it currently is at the time of a post, meaning some things maybe be blatantly incorrect: this is the result of me writing and rewriting code frequently. Optimally I'd like to be able to find solutions on my own after all!)

Counter "stance" code:
Code:
[Statedef 520]
type    = S
movetype= A
physics = S
ctrl = 0
anim = 520

[State 0]
type = Explod
trigger1 = animelem = 4
anim = 1324
id = 520
bindtime = -1
removetime = -1
pos = 70, -50
sprpriority = 9

[State 0]
type = HitOverride
trigger1 = time <= 0
attr = SCA, AP
stateno = 521
time = -1
slot = 0
ignorehitpause = 1


[State 0]
type = ChangeState
trigger1 = command != "holdx" || command ="holdy" || command ="holdz"
value = 0
ctrl = 1



Counter "shoot" code:
Code:
[Statedef 521]
type    = S
movetype= A
physics = S
ctrl = 0
anim = 521

[State 0, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA,NA,SA,HA
time = 1

[State 0]
type = Helper
trigger1 = animelem = 3
helpertype = normal
name = "Counter"
ID =  523
stateno = 523
pos = 20,-50
postype = p1   
facing = 1
keyctrl = 0
ownpal = 0
supermove
pausemove

[State 0]
type = ChangeState
trigger1 = animtime = 0
value = 0
ctrl = 1



Counter projectile code:

Code:
[Statedef 523]
type = A
movetype = A
physics = N
ctrl = 0
anim = 523
sprpriority = 5
velset = 5, 0

[State 1210, NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1


[State 1000, Projectile]
type = Hitdef
trigger1 = time = 0
attr = A, SP
damage = 70,5
animtype = Hard
guardflag = MA
hitflag = MAF
getpower = 30,0
givepower = 20,0
pausetime = 0,6
sparkno = S9999
guard.sparkno = S8050
sparkxy = -10,-25
hitsound = S5+var(49),3
guardsound = S6+var(49),0
ground.type = High
ground.slidetime = 18
ground.hittime = 20
air.hittime = 3
yaccel = .88
ground.velocity = -12.5,0
guard.velocity = -15
air.velocity = -10,-2
airguard.velocity = -10.5,3
fall.xvelocity = 0
fall.yvelocity = -1
air.fall = 1
fall.recover = 0


[State 0]
type = DestroySelf
trigger1 = (movecontact)
trigger1 = (movehit)

Re: Counter-Type Attack with Projectile
#2  February 20, 2018, 06:14:17 pm
  • avatar
  • **
Bumping so this can be seen, any ideas are accepted.
Re: Counter-Type Attack with Projectile
#3  February 24, 2018, 01:47:08 pm
  • **
    • Brazil
maybe it's because your hitoverride has a time of -1?
you could try:
Code:
time = ifelse((stateno=520),-1,0)
or something like that.
Re: Counter-Type Attack with Projectile
#4  February 27, 2018, 12:40:05 am
  • avatar
  • **
I tried a different approach with the HitOverride altogether (that line of code you supplied didn't work for me).

But I thank you for the assistance regardless.