YesNoOk
avatar

Versatile Projectile Reflector (Read 10106 times)

Started by Nep Heart, March 04, 2019, 11:05:07 pm
Share this topic:
Versatile Projectile Reflector
#1  March 04, 2019, 11:05:07 pm
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
 This is something I've done while revising projectile reflectors in all my characters ever since Haruhi's release since I wasn't satisfied with what they worked previously. I'm frankly proud of this even if it's not perfect and is definitely a step above the generic variety. So, I feel like sharing it with people... credit would be nice for recognition for those who wish to use it.

Quote
; Reflector Helper
[Statedef 1250]
type = S
movetype = A
physics = N
ctrl = 0
velset = 0,0
anim = 1250 <--- the animation can be visible (to represent the reflector FX) or invisible (if the FX is part of the character animation already), but it must have both a blue and red CLSN overlapping each other

[State 1250, No Shadow]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1250, Rootbinder]
type = bindtoroot
trigger1 = 1
pos = 0,0

[State 1250, Invuln]
type = nothitby
trigger1 = 1
value = SCA
time = -1

[State 1250, Vuln]
type = hitby
trigger1 = 1
value = SCA,NP,SP,HP
time = -1

[State 1250, Reversaldef]
type = reversaldef
trigger1 = 1
reversal.attr = SCA,NP,SP,HP
pausetime = 0,0
sparkno = -1
sparkxy = 0,0
p2stateno = 1251
numhits = 0
ignorehitpause = 1
<--- this takes care of helper based projectiles and sends them to custom state

[State 1250, Hitoverride]
type = hitoverride
trigger1 = 1
attr = SCA,NP,SP,HP
stateno = 1252
ignorehitpause = 1
<--- this takes care of projectile SCTRLs since reversaldefs do not work on them

[State 1250, End]
type = destroyself
trigger1 = root,movetype = H
  <--- have it go away if your character gets hit so the reflector doesn't continue lingering even after they've been hit out of the attack
trigger2 = time = 42 <--- how long you want the reflector to last

;---------------------------------------------------------------------------

; Reflected Helper
[Statedef 1251]
type = A
ctrl = 0
movetype = A
physics = N
sprpriority = 2

[State 1251, Hitoverride]
type = HitOverride
trigger1 = 1
attr = SCA,AA,AP,AT
time = 1
stateno = 1251
ignorehitpause = 1

[State 1251, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1251, Invuln]
type = nothitby
trigger1 = 1
value = SCA
time = -1

[State 1251, StopSnd]
type = StopSnd
trigger1 = time = 180
channel = -1
ignorehitpause = 1
persistent = 0
<--- this is a just in case measure if the helper projectile's sound plays infinitely

[State 1251, Changeanime]
type = ChangeAnim
trigger1 = !time
value = anim
<--- mimics the helper projectiles animation

[State 1251, Turn]
type = Turn
triggerall = numenemy > 0
trigger1 = facing =1 && enemy,facing !=1
trigger2 = facing != 1 && enemy,facing =1
<--- turns the reflected helper projectile around so that it looks like it was properly reflected

[State 1251, Velset]
type = VelSet
triggerall = vel x
trigger1 = !time
trigger2 = pos y>=0
x = (ifelse(vel x>0,vel x,vel x*-1))
y = (vel y-((vel y>0)*(vel y*2)))
<--- sends the reflected helper back with its original velocity values

[State 1251, Velset]
type = VelSet
triggerall = vel x = 0
trigger1 = !time
x = 10
<--- a just in case measure if the projectile happens to not use velsets/veladds for velocity

[State 1251, Projectile]
type = hitdef
trigger1 = time = 1
persistent = 0
attr = A,SP
animtype = Hard
damage = ceil(60),30
hitflag = MAFDP
guardflag = MA
pausetime = 0,10
getpower = 100,100
givepower = 20,20
sparkxy = -5,0
hitsound = F5,4
guardsound = F6,0
ground.type = Low
ground.slidetime = 16
ground.hittime = 16
ground.velocity = -8.2,0
air.velocity = -8.2,-7
affectteam = F <--- Important if you want the reflected projectile to hit the opponent
air.fall = 1
fall.recover = 0
hitonce = 1
yaccel = 0.4

[State 1251, Remove FX]
type = removeexplod
trigger1 = IsHelper
trigger1 = time = 1
ignorehitpause = 1
<--- removes any explods the projectile may have just in case they have infinite removetime

[State 1252, End]
type = SelfState
trigger1 = !IsHelper
value = 0
ctrl = 1
<--- a just in case measure in the event you accidentally send the opponent into the reflector custom state

[State 1251, End]
type = DestroySelf
trigger1 = time > 240
trigger2 = frontedgedist <-100
trigger3 = backedgedist <-100
trigger4 = movecontact
ignorehitpause=1

;---------------------------------------------------------------------------

;[everything below here handles projectile SCTRLs stated from the hitoverride earlier]

; Reflected Projectile
[Statedef 1252]
physics = N
movetype = I
anim = 1
ctrl = 0

[State 1252, PSND]
type = PlaySnd
trigger1 = time = 0
value = 1,14
ignorehitpause = 1
persistent = 0

[State 1252, Hitoverride]
type = HitOverride
trigger1 = 1
attr = SCA,AA,AP,AT
time = 1
stateno = 1252
ignorehitpause = 1

[State 1252, AssertSpecial]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 1252, Projectile]
type = projectile
trigger1 = time = 1
persistent = 0
projID = 1252
projanim = 1020
projhitanim = 1025
offset = 75,0
projpriority = 7
projremovetime = -1
attr = A,SP
animtype = Hard
damage = ifelse(numhelper(3100) <= 0,ceil(ifelse(var(56)=0,60,120)),ceil(ifelse(var(56)=0,75,150))),75
hitflag = MAF
guardflag = MAF
pausetime = 0,10
getpower = ifelse(numhelper(3100) <= 0,ceil(100),ceil(50)),ifelse(numhelper(3100) <= 0,ceil(100),ceil(50))
givepower = 50,50
velocity = 9,0
sparkno = -1
guard.sparkno = -1
sparkxy = 0,-70
hitsound = s1,14
guardsound = s2,1
ground.type = Low
ground.slidetime = 16
ground.hittime = 16
ground.velocity = -8.2
air.velocity = -3.4,-1.0
air.fall = 1
fall.recover = 0
yaccel = 0.35

[State 1252, Remove FX]
type = removeexplod
trigger1 = IsHelper
trigger1 = time = 1
ignorehitpause = 1

[State 1252, End]
type = DestroySelf
trigger1 = IsHelper
trigger1 = time = 1
ignorehitpause = 1

 All this is for the entire projectile reflector helper itself.

Quote
[State -2, Guard Dist]
type = projectile
trigger1 = numhelper(1250) = 1
trigger1 = !numprojID(1250)
projID = 1250
projanim = 1
velocity = 0,0
guard.dist = 300
postype = p2
offset = 0,5000
projremovetime = 240
ignorehitpause = 1

 In statedef -2, you will be required to have an invisible projectile with no CLSNs summoned whenever the reflector is out so that the reflected helper projectile doesn't become unblockable as a result of the reflected projectile still technically being owned by the opponent, which would make it unblockable without this measure.

 Note: The main flaw for this reflector is that the reflected projectile will become invisible if the helper projectile in question uses an explod as an FX instead of its own animation, but that's not too common otherwise.
Last Edit: March 04, 2019, 11:18:18 pm by Nep Heart
Re: Versatile Projectile Reflector
#2  March 04, 2019, 11:55:19 pm
  • ****
    • USA
    • twitter.com/inktrebuchet
I haven't got a chance to go through this code completely yet. Is there a benefit to using this one over Vans' reflector?

http://gcnmario.free.fr/mugen/guile.html uses a similar reversaldef reflector and had some problems with certain projectiles. I see that you have fixed one of them, for projectiles that don't use velsets/veladds.

The biggest problem with this type of reflector is if a enemy projectile uses a blank anim and a explod for the projectile effect. In that case normally the explod would face the wrong direction. If your code successfully removes the explod there will be an invisible projectile on screen. Here is an example character where that will happen: http://mugenguild.com/forum/topics/cvtw2-ryu-24-december-2017-update-178688.0.html

Another problem is no hitspark when the enemy projectile hits the reflector but that's not a huge deal.

And [Statedef 1252] is just a generic reflected projectile, correct?

I would love to checkout the character you have this working in, if you have released it.



Last Edit: March 04, 2019, 11:59:08 pm by ink
Re: Versatile Projectile Reflector
#3  March 05, 2019, 12:02:32 am
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
I haven't got a chance to go through this code completely yet. Is there a benefit to using this one over Vans' reflector?

 My issue with Vans' is that it requires comparability, which feels impractical when not many people will be conforming to that standard in the first place... and from what I've seen, not many people have.

Quote
The biggest problem with this type of reflector is if a enemy projectile uses a blank anim and a explod for the projectile effect. In that case normally the explod would face the wrong direction. If your code successfully removes the explod there will be an invisible projectile on screen. Here is an example character where that will happen: http://mugenguild.com/forum/topics/cvtw2-ryu-24-december-2017-update-178688.0.html

 Yeah, I actually made that note on the bottom that was the main limitation of the method I devised. There isn't really much I can do, but I'm not too worried since those aren't overly common to begin with. I think I've only came across one character that uses the explod projectile and actually removing the it helped in this case since the explod animation had infinite removetime (it was Z2 Goku, I believe). Even if I did find a way, the problem is matching velocities of the helper still remaining.

Quote
And [Statedef 1252] is just a generic reflected projectile, correct?

 Yeah, it's there in the emergency case of projectile SCTRLs since reversaldefs fail against them.