YesNoOk
avatar

Poison Glitch Implementation Problems (Read 1698 times)

Started by CoffeeFlavoredMilk, May 02, 2021, 10:10:22 pm
Share this topic:
Poison Glitch Implementation Problems
#1  May 02, 2021, 10:10:22 pm
  • **
  • Snek Friend
    • USA
    • coffeeflavoredmilk.neocities.org/
So I found out about the Poison status effect from looking it up on Mugen Wiki and whatnot. Through research and whatnot I came up with this code:

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

; Toxic Helper

[Statedef 1051]

type = A

movetype= A

physics = N

velset = 0,0

anim = 1051

 

[State 1051, VelAdd]

type = VelAdd

trigger1 = time = 0

x = 8

y = 1

;ignorehitpause =

;persistent =

 

[State 1051, HitDef]

type = HitDef

trigger1 = Time = 0

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

air.animtype = light

damage = 0,0

pausetime = 0 ,0

guard.pausetime = 0,0

sparkno = -1

guard.sparkno = -1

sparkxy = 0,0

hitsound = 1,0

guardsound = 2,0

ground.type = High ;Low,Trip,None

air.type = High

ground.slidetime = 0

guard.slidetime = 0

ground.hittime = 0

guard.hittime = 0

air.hittime = 20

ground.velocity = 0,0

guard.velocity = 0

air.velocity = 0,0

air.juggle = 0

palfx.time = 14

palfx.add = 170,0,127

palfx.mul = 170,0,127

palfx.color = 0

 

[State 1051, Helper]

type = Helper

trigger1 = movehit = 1

helpertype = normal ;player

name = "Toxic Effect"

ID = 1052

stateno = 1052

pos = 0,0

postype = p2 ;p2,front,back,left,right

 

[State 1051, DestroySelf]

type = DestroySelf

trigger1 = Vel Y > 0

trigger1 = Pos Y >= 0

trigger2 = movecontact

 

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

; Toxic Effect

[Statedef 1052]

type = A

movetype= A

physics = N

anim = 1052

 

[state 0, ReversalDef]

type = ReversalDef

trigger1 = time = 0

reversal.attr = A,NA

sparkno = -1

sparkxy = 0,0

pausetime = 0,0

hitsound = -1

numhits = 0

 

[State 0, StateTypeSet]

type = StateTypeSet

trigger1 = time = 3

movetype = I

 

[State 0, HitAdd]

type = HitAdd

trigger1 = 1

value = -1

 

[State 0, TargetLifeAdd]

type = TargetLifeAdd

trigger1 = time%2=0

value = -4

kill = 0

absolute = 1

 

[State 0, PosSet]

type = PosSet

trigger1 = 1

x = enemynear, pos x

y = enemynear, Const(size.head.pos.y)+(enemynear,pos y)

ignorehitpause = 1

 

[State 7001, Assert]

type = AssertSpecial

trigger1 = 1

flag = noshadow

ignorehitpause = 1

 

[State 10002, DestroySelf]

type = DestroySelf

trigger1 = time = 350

trigger2 = enemynear, alive = 0

trigger3 = enemynear, life <= 20

 

These use code partially edited from KoopaKoot's Shiki. Somehow though, the ReversalDef and therefore the TargetLifeAdds aren't working, so even though the opponent is hit by the effect, they don't take any damage from it. Note that these are the only pieces of code in the CNS relating to the effect. So no -2 or -3 or whatever. Can someone please tell me what I'm missing here? This attack prior to the poison is meant to function like a helper projectile, and that part came out fine, just the poison effect I'm having trouble with.
Last Edit: May 03, 2021, 09:54:37 pm by CoffeeFlavoredMilk
Re: Poison Glitch Implementation Problems
#2  May 03, 2021, 02:02:27 pm
  • avatar
  • *
    • Canada
The point of the ReversalDef is to persist a target, normally targets are dropped when the targeted player leaves the hit state but running ReversalDef allows the target to continue to be held. In this code the player running state 1051 (I assume some helper) is getting the initial target with HitDef, but then you spawn a new helper into 1052 to run the ReversalDef... the 1052 helper doesn’t have any target to begin with so the ReversalDef can’t persist anything. You need to run the ReversalDef on whatever player already holds a target.

You could just merge these two together and use the same helper for both...

[State 1051, HitDef]
type = HitDef
trigger1 = !NumTarget ;; <— only until target obtained

[State 1051, ReversalDef]
type = ReversalDef
trigger1 = NumTarget ;; <— retain target after obtained

Then move all the posset, targetlifeadd, etc up to 1051 and trigger them on NumTarget as well... and adjust the DestroySelf triggers
Re: Poison Glitch Implementation Problems
#3  May 03, 2021, 09:54:21 pm
  • **
  • Snek Friend
    • USA
    • coffeeflavoredmilk.neocities.org/
Did exactly that and managed to get it working. Thank you sir!