The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Topic started by: Mr. Giang on May 18, 2018, 03:08:55 am

Title: Remove Helper-typed super armor?
Post by: Mr. Giang on May 18, 2018, 03:08:55 am
I'm currently making a super armor for my character but it seems that I can't find a trigger for this situation. When the character is in state 210, I want him to have super armor in frame 3 to 15 so in statedef -2, I create a helper whenever it's in frame 3 of state 210 (which works fine). The problem is that the helper stays after frame 15 instead of changing to a blank state. Here is my super armor code:
Spoiler, click to toggle visibilty

So anyone knows the trigger for this?
Also, how can I give my character only 1 layer of armor using this code?
Title: Re: Remove Helper-typed super armor?
Post by: Odb718 on May 18, 2018, 08:19:15 am
There could be more than one way to make it so the armor disappears after frame 15.
One way is to change the armor into a blank state and undo the nothitby.
The other way would be to kill the helper.
I'd think it'd be easier to kill the helper. So edit the ChangeState that brings the helper into state 902. Add in the trigger to check what P1, the root, is doing. You want it gone if it's not in 210? Add that as a trigger. And you want it gone if it's in State 210 but the animelem > 15, so add that as a trigger also.

What do you mean by 1 layer? Like only one hit has reduced damage?
Title: Re: Remove Helper-typed super armor?
Post by: Mr. Giang on May 18, 2018, 08:31:28 am
There could be more than one way to make it so the armor disappears after frame 15.
One way is to change the armor into a blank state and undo the nothitby.
The other way would be to kill the helper.
I'd think it'd be easier to kill the helper. So edit the ChangeState that brings the helper into state 902. Add in the trigger to check what P1, the root, is doing. You want it gone if it's not in 210? Add that as a trigger. And you want it gone if it's in State 210 but the animelem > 15, so add that as a trigger also.

What do you mean by 1 layer? Like only one hit has reduced damage?

That's what I did before:
Code:
[State 800, 5]
type = ChangeState ;This is so when you die or when more than one of these helpers exists, it'll destroy itself. You can add more triggers if you want. For example, a burst mode with super armor that is activated when var(50)=1. The burst mode and super armor deactivate when var(50)=0. You would want to put a "trigger3 = var(50)=0".
trigger1 = parent,life = 0
trigger2 = parent,numhelper(900) > 1
trigger3 = root,stateno = 210 && time > 15
But the armor will be there after the state ends and there will be no way to remove it. That's why I have to replace it with root,stateno = 0 (as placeholder).
And yes, I mean how to make the armor only take 1 instant of damage so multi hit attacks can still bypass the armor.
Title: Re: Remove Helper-typed super armor?
Post by: diletDis on May 18, 2018, 11:44:28 am
here i got a armor helper code that i  use. it Works everytime (but only resist one hit) guess you could rework it a bit
but the cool thing is that is one helper and you can call it on different states and it will work (it requires you to add the anims in the  helper code and thats it )

;please note that in order for this to work u need to duplicate your "armor attack" animation and delete the sprites from it leaving only the collision box data in the frames that u need armor (may take few minutes but does the job) (please read the code so u get the idea)

<put this on your attack state that need an armor>
[State Reversal]
type = helper
trigger1 = !time
stateno = 9100
name = "Detection"
pausemovetime = 65535
supermovetime = 65535

<this is the helper code>
;<Reversal Detection>
[StateDef 9100]
physics = N
sprpriority = 0
anim = 9741 ; empty anim with a -1 so its infinite

[State NotHitBy]
type = nothitby
trigger1 = 1
value = SCA

[State Bind]
type = BindToRoot
trigger1 = 1
time = -1

[State Anim]
type = varset
trigger1 = 1
var(0) = root, anim    ;gets the player current anim
ignorehitpause = 1
[State Elem]
type = varset
trigger1 = 1
var(1) = root, animelemno(0) ; gets the player current frame of the anim
ignorehitpause = 1

[State 7360, anim] ; <HERE you specify the animation that containts the "collision data" for the frames that u want armor (in my char the attack is 230 and the collisions
for the armor is 231 so..) (also the collision animation is a "clone" of the attack animation withouth sprites just collision boxes when u need them. also delete collision boxes from the frames that u dont want armor. lets say u want armor from frame 4 to 8, leave the collisions in those frames and erase from 0-3 and 9 and on)
type = changeanim
trigger1 = root, stateno = 230
value = var(0) +1 ;notice that the armor helper animation is next to the attack in the anim file .. hence the +1
elem = var(1)
ignorehitpause = 1
[State 7360, anim]; same here but if u want to add it to a different attack repeat the procedure
type = changeanim
trigger1 = root, stateno = 220
value = 223  ;but here i used a specific number in case u have the next slot taken and u want to use a different number for the armor anim
elem = var(1)
ignorehitpause = 1
[State 7360, anim]; same thing here
type = changeanim
trigger1 = root, stateno = 3100
value = 3101
elem = var(1)  ;<----- this is whats more important because it keep it on sync with the char anim 
ignorehitpause = 1

[State Disable]  ;add your anims and states here
type = varset
trigger1 = anim = 231
trigger1 = root, stateno != 230
trigger1 = anim = 223
trigger1 = root, stateno != 220
trigger1 = anim = 3101
trigger1 = root, stateno != 3100
var(2) = 1

[State Disable]
type = changeanim
trigger1 = var(2) = 1
value = 9741

[State Reversal]
type = reversaldef
trigger1 = !var(2)
reversal.attr = SCA,AA,AP
p1stateno = 9101   ;< pay attention to this . this does the changestate instead of a changestate ctrllr
pausetime = 0,0
sparkno = -1
numhits = 0

[State Disable]
type = ReversalDef
trigger1 = var(2) = 1
reversal.attr =
pausetime = 0,0
sparkno = -1
numhits = 0

[State 9100, End]
type = destroyself  ;prevent helper from existin if ur char gets  out of the armor time or if he gets hit  (add your states)
trigger1 = anim = 231
trigger1 = !animtime || (root ,animelemtime(10) >= 0) || root,stateno != 230
trigger2 = anim = 223
trigger2 = !animtime || (root ,animelemtime(11) >= 0) || root,stateno != 220
trigger3 = anim = 3101
trigger3 = !animtime || (root ,animelemtime(25) >= 0) || root,stateno != 3100
trigger4 = var(0) = 1

;<Success>
[StateDef 9101]
movetype = I
anim = 9741
ctrl = 0

[State Pause]
type = pause ;custom FX  when it worked  remove or tweak if u want
trigger1 = !time
time = 15
movetime = 15
pauseBg = 0

[State Sfx]
type = playsnd ;custom FX  when it worked  remove or tweak if u want
trigger1 = !time
channel= 2
value = F3, 3

[State Shake]
type = envshake
trigger1 = !time ;custom FX  when it worked  remove or tweak if u want
time = 1
freq = 0
ampl = 0

[State Flash]
type = explod
trigger1 = !time ;custom FX  when it worked  remove or tweak if u want
anim = 9100
ID = 1
space = screen
pos = 0 , 0
scale = 4,4
sprpriority = -5
supermovetime = 9999
pausemovetime = 9999

[State End]
type = destroyself  ; here the same as in the previous state add your triggers to terminate the armor helper
trigger1 = root, anim = 230 && root , animelemtime(11)>= 0
trigger2 = root, anim = 220 && root , animelemtime(11)>= 0 
trigger3 = root, anim = 3100 && root , animelemtime(25)>= 0

and thats it ... it does the job pretty well and also is easy to add or extend  just call the helper and add your anims and triggers :)

Title: Re: Remove Helper-typed super armor?
Post by: Mr. Giang on May 18, 2018, 01:59:13 pm
Hmm, it doesn't seem to work for me. I even tried to make the armor active the whole state to check but it just doesn't work.
Spoiler, click to toggle visibilty

p/s: Figured out a better way by tinkering RP_Yuuka (using HitOverdrive). Thanks you guys a lot.
Title: Re: Remove Helper-typed super armor?
Post by: Archimonde on July 06, 2018, 08:47:58 am
Nếu mà theo như ý ô. Đây chỉ là ý tưởng của tôi còn lập trình là chuyện của ô. Ô muốn block ở frames số 3 tới 15 thì ô tạo helper xong code nó bằng cách dùng hitby để nó hứng damage và lệnh seflstate để ghim helper đó trong state đó lun ko đi đâu cả. Quan trọng nữa là trigger
Title: Re: Remove Helper-typed super armor?
Post by: Odb718 on July 07, 2018, 12:20:18 am
Archimonde, please post in English here. You can post in Vietnamese if you feel something's lost in the translation but post under the English text.