YesNoOk
avatar

Stun bar/meter Explod(s) or Helper /Realllllly/ Confused (Read 1652 times)

Started by Plum, April 29, 2019, 11:26:40 pm
Share this topic:
Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#1  April 29, 2019, 11:26:40 pm
  • **
  • Variables > Boyfriends
I managed to finally understand (self) stun/dizzy after reading a tutorial on BLACKLISTED WEBSITE... several--several times, I wound up altering the code a little bit so it works exactly as intended. But now I have no idea how to make a functioning or even visible stun bar. I tried looking over RajaaBoy SF3 Urien's stun bar code but it's strictly tied to it's own vars and helpers to function and it turns out it's incompatible with the guide I was using so I've been pretty stuck.

I tried using -2 statedef explod(s) and had one /somewhat/ working but I wasn't able to have to it fill/function, so I tried to use a helper that would remain active, to no avail. So I'm here asking for help, again. ^^" I'll leave the var code at the bottom, if it's really complicated you could link me to a tutorial and I'd study that.

Thanks any advance


Code:
[State -3: VarAdd]
type = VarAdd
triggerall = (Time = 2)
trigger1 = ((StateNo = 5001) && (Anim = 5000)) || ((StateNo = 5001)&& (Anim = 5010)) || ((StateNo = 5011) && (Anim = 5020))
persistent = 0
ignorehitpause = 1
v = 0
value = 40

[State -3: VarAdd]
type = VarAdd
triggerall = (Time = 4)
trigger1 = ((StateNo = 5001) && (Anim = 5001)) || ((StateNo = 5001)&& (Anim = 5011)) || ((StateNo = 5011) && (Anim = 5021))
persistent = 0
ignorehitpause = 1
v = 0
value = 40

[State -3: VarAdd]
type = VarAdd
triggerall = (Time = 6)
trigger1 = ((StateNo = 5001) && (Anim = 5002)) || ((StateNo = 5001)&& (Anim = 5012)) || ((StateNo = 5011) && (Anim = 5022))
persistent = 0
ignorehitpause = 1
v = 0
value = 40

[State -3: ChangeState]
type = ChangeState
trigger1 = (Var(0) >= 400) && (StateNo != [9000,9003])
value = 9010
ignorehitpause = 1




[Statedef 9000]
type = S
physics = S
movetype = H
ctrl = 0

[State 9000, Change Animation]
type = ChangeAnim
trigger1 = Time = 0
value = 5300

[State 9000, Button Jam]
type = ChangeState
triggerall = Random <= 500
trigger1 = (command = "a") || (command = "b") || (command = "c")
trigger2 = (command = "x") || (command = "y") || (command = "z")
value = 9001

[State 9000, Next]
type = ChangeState
trigger1 = Time = 30
value = 9001

[Statedef 9001]
type = S
physics = S
movetype = H
ctrl = 0

[State 9001, Flash]
type = PalFX
trigger1 = Time = 0
time = 2
add = 50,50,50
mul = 300,300,300

[State 9001, Button Jam]
type = ChangeState
triggerall = Random <= 500
trigger1 = (command = "a") || (command = "b") || (command = "c")
trigger2 = (command = "x") || (command = "y") || (command = "z")
value = 9002

[State 9001, Next]
type = ChangeState
trigger1 = Time = 30
value = 9002

[Statedef 9002]
type = S
physics = S
movetype = H
ctrl = 0

[State 9002, Flash]
type = PalFX
trigger1 = Time = 0
time = 2
add = 50,50,50
mul = 300,300,300

[State 9002, Button Jam]
type = ChangeState
triggerall = Random <= 500
trigger1 = (command = "a") || (command = "b") || (command = "c")
trigger2 = (command = "x") || (command = "y") || (command = "z")
value = 9003

[State 9002, Next]
type = ChangeState
trigger1 = Time = 30
value = 9003



[Statedef 9003]
type = S
physics = S
movetype = H
ctrl = 0

[State 9003, Flash]
type = PalFX
trigger1 = (!Time)
time = 2
add = 50,50,50
mul = 300,300,300

[State 9003, Button Jam]
type = ChangeState
triggerall = (Random <= 500)
trigger1 = (Command = "a") || (Command = "b") || (Command = "c")
trigger2 = (Command = "x") || (Command = "y") || (Command = "z")
value = 0

[State 9003, Undizzy]
type = SelfState
trigger1 = (Time = 30)
value = 0
ctrl = 1

[Statedef 9010]
type = S
movetype = H
physics = N
ctrl = 0

[State 9010: NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 9010: VarSet]
type = VarSet
trigger1 = (!Time)
v = 10
value = 0

[State 9010: ChangeState]
type = ChangeState
trigger1 = (HitShakeOver)
value = 9011



;=========================================================================
; Stunned
;=========================================================================
[Statedef 9011]
type = S
movetype = I
physics = S
ctrl = 0
facep2 = 1
velset = 0, 0
sprpriority = 0


[state 5300, State Type Set]
type = statetypeset
trigger1 = !time
trigger1 = var(54) = [1, 2]
movetype = H

[state 5300, Set Hit Fall]
type = hitfallset
trigger1 = !time
value = 0

[state 5300, Set Position]
type = posset
trigger1 = !time
y = 0

[state 5300, End State]
type = changestate
trigger1 = !alive
value = 5050

[state 5300, Stun Time]
type = varset
trigger1 = !time
sysvar(0) = 0

[state 5300, Stun Time]
type = null
triggerall = !time
trigger1 = var(17) = [0, 1] ; Normal Hit
trigger1 = var(0) := 90 + 20 * (random % 4)
trigger2 = var(17) = 2 ; Special Hit
trigger2 = var(0) := 150 + 20 * (random % 4)
trigger3 = var(17) = 3 ; Super Art Hit
trigger3 = var(0) := 120 + 40 * (random % 4)
trigger4 = var(17) = 4 ; Normal Throw
trigger4 = var(0) := 120 + 20 * (random % 4)
trigger5 = var(17) = 5 ; Special Throw
trigger5 = var(0) := 120 + 40 * (random % 4)
trigger6 = var(17) = 6 ; Super Art Throw
trigger6 = var(0) := 150 + 40 * (random % 4)

[state 5300, Change Animation]
type = changeanim
trigger1 = !time
value = 5300

[state 5300, Button Tap Buffer Time]
type = varadd
trigger1 = sysvar(0) > 0
trigger1 = time % 3 = 0
sysvar(0) = -1

[state 5300, Tap button to Speed up]
type = varadd
trigger1 = command = "a" || command = "b" || command = "c"
trigger2 = command = "x" || command = "y" || command = "z"
trigger3 = command = "fwd" || command = "back" || command = "up" || command = "down"
sysvar(0) = 1

[state 5300, Button Tap Buffer Time]
type = varset
trigger1 = sysvar(0) > 12
sysvar(0) = 12

[state 5300, Decrease Stun Time]
type = varadd
triggerall = var(0) > 0 && sysvar(0) >= 6
trigger1 = command = "a" || command = "b" || command = "c"
trigger2 = command = "x" || command = "y" || command = "z"
trigger3 = command = "fwd" || command = "back" || command = "up" || command = "down"
var(0) = -1

[state 5300, Change Animation]
type = changeanim
triggerall = anim = 5300
triggerall = var(0) > 0 && sysvar(0) >= 6
triggerall = animelemtime(animelemno(0)) >= 4
trigger1 = command = "a" || command = "b" || command = "c"
trigger2 = command = "x" || command = "y" || command = "z"
trigger3 = command = "fwd" || command = "back" || command = "up" || command = "down"
value = anim
elem = cond(!animelemtime(animelemno(0) + 1), 1, animelemno(0) + 1)

[state 5300, Stars]
type = helper
trigger1 = anim = 5300
trigger1 = !numhelper(6565)
name = "Stars, Ducks, Reapers, and Angles"
ID = 6565
stateno = 6565
postype = p1
ownpal = 1
keyctrl = 0
size.xscale = 1.0
size.yscale = 1.0

[state 5300, Control]
type = ctrlset
trigger1 = time >= var(0)
value = 1
persistent = 0

[state 5300, End State]
type = changeanim
trigger1 = time >= var(0)
value = 5301
persistent = 0

[state 5300, End State]
type = changestate
trigger1 = anim = 5301 && !animtime
trigger2 = ctrl && p2dist x < 0
value = 0
ctrl = 1

[State 413, Mode]
type = Explod
triggerall =  var(10) = 0
trigger1 = animelem = 1
anim = 8888
pos = 170, floor (screenpos y) - 30
postype = back
sprpriority = 10
scale = 1.6,1.6


[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 10    ;fv = 10
value = 1

[Statedef 9012]
type = S
movetype = H
physics = S
anim = 5110
ctrl = 0

[State 9012: VelSet]
type = VelSet
trigger1 = (!Time)
Y = 0

[State 9012: NotHitBy]
type = NotHitBy
trigger1 = 1
value = SCA

[State 9012: ChangeAnim]
type = ChangeAnim
trigger1 = (Time = 25)
value = 5120

[State 9012: ChangeState]
type = ChangeState
trigger1 = (AnimTime = 0) && (Anim = 5120)
value = 9000
Last Edit: May 02, 2019, 10:34:54 pm by Chartreuse
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#2  April 29, 2019, 11:34:22 pm
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
 Most system meters/bars are normally tied to the variable that dictates their current status, using an explod in place and then modify explod where said variable is used for the scale calculation (it takes a bit of playing with if you're not experienced with the method). I actually use a guard crush system that relies on this and all of it takes place in statedef -2, no helper required.

 Example of how I do it;

Spoiler, click to toggle visibilty
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#3  April 30, 2019, 09:26:12 am
  • **
  • Variables > Boyfriends
Ha, thanks! ^^" I wish I'd gotten to this earlier in honestly so I could have spent more than just an hour or so trying to comprehend it.

Unfortunately I can only understand it in pieces. I'm assuming the "trigger1 = var(11) >= 1000" is the max/standard value for the character being stunned? If so then the p2stateno! part is confusing since only my character is allowed to be stunned.

Honestly vars are still really new to me, like less than a week new, so I'm not sure if this is implemented for the gauge itself or just the meter,(line that fills the bar) so I'm a bit lost on what each piece is meant to do. I've made one or two basic var transformation states, but the concept isn't fully understood, at least not with using var to measure stun and display it properly.

I'm really interested in this method now, if there's a tutorial or anything floating around I'd definitely appreciate it.~
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#4  April 30, 2019, 09:48:17 am
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
 yeah, "var(11) >= 1000" is the limit in which guard crush occurs. You can apply the p2stateno logic to your own character as "stateno = all stun states".

 Basically, what you're doing is using the same var the calculates how much before P1 has before being stunned, you can apply the same numeric logic on the meter.

 So, if the value to reach stun is say... 1000, you can consider that the variable is not allowed to go over 1000 since that is the value in which stun occurs and subtract or divide from the scale of the explod itself. Var(#) is at 100, divide or subtract from the current scale of the explod by 100. Did it reach 500? Same math. Takes time to play around, but you can experiment and see it in action that it does change explod size.
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#5  April 30, 2019, 10:52:54 pm
  • **
  • Variables > Boyfriends
So "stun states" as in the 5300 AKA Stunned Statedef I posted above, or the 5000, 5001, 5021, etc. states? When I used your code at best it just stood frozen on screen for me, regardless of what I changed, the meter never increased or decreased. I'm not sure how to match the varadd from statedef-3 as I've made all the values 40 and the max stun 400, meaning it takes ten hits to stun the character.

Also, since this is for the "fvar," I have no idea how the scaling works. I get that,(code below) is meant for the bar decreasing and enlarging, but not exactly /why/ the scaling works. A lot of it is just confusing to me; as I expected it to be, and I didn't want to waste your time which is why I've been looking for a tutorial on this very thing but can't seem to find one. In short I understand /why/ it works but not the how, I've only been on var(s) for about a week now. I've been trying to understand this code for a few hours back and forth, last night, and now today. This is definitely another wall for me. ^^"



[State -2, Guard Meter Status]
type = ModifyExplod
trigger1 = var(11) >= 0
ID = 6551
scale = 0.3-(fvar(3)/3300),0.3
ignorehitpause = 1
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#6  May 01, 2019, 02:07:07 am
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
fvar(3) carries information of var(11) of the same guard crush code. I used an fvar for explod scaling simply because it scales more seamlessly. I divided fvar(3) by 3300 because var(11) maxes out at the value of 1000 and the explod's original scale is 30% of the original sprite length (so, 1 divided by 1000 divided by 3 basically).

 Looking at the stun code above, var(0) maxes out at 400, so...

[State -2, Stun Meter Status]
type = ModifyExplod
trigger1 = var(0) >= 0
ID = [insert the ID of the stun meter explod]
scale = 0.3-(var(0)/1333),0.3
ignorehitpause = 1

 If you need the explod to start out larger, like say double of what I suggested in the code above, you can do this instead.

[State -2, Stun Meter Status]
type = ModifyExplod
trigger1 = var(0) >= 0
ID = [insert the ID of the stun meter explod]
scale = 0.6-(var(0)/666),0.6
ignorehitpause = 1

 May have messed up the math since I usually need to actually visualize the code in action to judge scaling better (and even then, I do a lot of trial and error when it comes to explod scaling in general), but this should work as a starting example. Again, I recommend an fvar for explod scaling since vars tend to not scale as seamlessly.
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#7  May 01, 2019, 03:38:52 am
  • **
  • Variables > Boyfriends
I'm... just gonna leave this here: https://imgur.com/cMNg1Ba

This is the gauge I'm using, this is basically how it'll look when the bar is full. I wanted to ask if this /unusual/ meter has anything to do with why it's not showing or displaying /anything/ at all. I do have the bar itself functioning properly so that's progress. XD But I have absolutely no idea why the meter isn't displaying or increasing, I hope it doesn't matter that I've made it so the character's stun /doesn't/ decay over time?

Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#8  May 01, 2019, 03:59:03 am
  • ***
  • Non est hoc propter hoc sed propter est hoc
    • USA
    • doubletrend-zeta.neocities.org/
variable scaling is shrinking the sprite based on axis, so all it would do is scale down the sprite itself.

EDIT

sorry here's an example to illustrate it


It would scale either toward or away the axis point in the way I've placed it


Now you can make it an animation, but then it can't be an explod because explods have terrible animation controls, i.e. you can't have it start in the middle of the animation based on the variable number. You can do this with a helper, butg the drawback is that helpers won't move with the screen when it moves so you'd have to lock it in place and it will jitter around a bit.

I did this myself for my MONSTER system because I needed the bar animation to start at any certain frame during the start of the round, which requires animelem strings that aren't available for explods.

Here's just a dump of my code itself. The change anim controls are named [State anim correct]
Spoiler, click to toggle visibilty
Last Edit: May 01, 2019, 04:08:45 am by Bannana
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#9  May 01, 2019, 04:04:49 am
  • ****
  • CPU Purple Heart
    • USA
    • https://www.pixiv.net/en/users/8108265
Ah, yeah, that's completely different from what I worked on. You can't use explod scaling for that kind of thing, you'll need to have the sprite itself be scaled as Banana said, which is a lot more complicated than what my guard crush meter works with since the explod must constantly update to accommodate the var value.
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#10  May 01, 2019, 04:53:09 am
  • **
  • Variables > Boyfriends
Well I'll try your example,(Bannana) let you know if I manage to be successful, I'm grateful for all the help from you two.

My idea /was/ to use explod(s) for the gauge since it was so unique, and since it was going to be an explod I was planning on having it just destroy itself with destroyself and use the previous explod as the trigger to chain it until it resets back to default. Just an idea I had since the stun doesn't decay.

At least I can stay hopeful.
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#11  May 01, 2019, 01:59:28 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
variable scaling is shrinking the sprite based on axis, so all it would do is scale down the sprite itself.

EDIT

sorry here's an example to illustrate it


It would scale either toward or away the axis point in the way I've placed it


Now you can make it an animation, but then it can't be an explod because explods have terrible animation controls, i.e. you can't have it start in the middle of the animation based on the variable number. You can do this with a helper, butg the drawback is that helpers won't move with the screen when it moves so you'd have to lock it in place and it will jitter around a bit.

It's kind of a difficult concept to grasp, but it's certainly possible.  My Jailbot character is loaded with these animation controls.

If you download my char and go to State -3 look for the "Face Glitch-erizer."  It checks to see how much health Jailbot has left, and it will randomly make his face glitch as his health gets lower.  The face glitch animations are all split into 1-tick anims, and it uses VarAdd paired with "GameTime%__ = 0" to cycle through the frames at a fixed rate.

This system allows the animations to continue as Jailbot changes between his movement animations: Idle/Walk/RunFWD/RunBack/Turn

Here's one for example, which is Time based.

Spoiler, click to toggle visibilty


All Jailbot's movement anims are also drawn as 1-tick Explods.  The reason I did this is b/c you can spawn multiple Explods on the same sprite layer and they will flatten together.  So, his face and body are drawn separately yet are on the same sprite layer.

For example, I have a normal version of his Walk animation but I have a trigger for him to turn Invisible.  It then evaluates his hidden animation to pick which sprite to display in the Explod.  So this is not Time based, but instead just replicates whatever animation is occurring for the Player anims via Explods

Spoiler, click to toggle visibilty


SO!
The animation just needs to be split to 1-tick anims
You need a constantly active Explod controller that includes a "+ var(XX)" for anim number.
You need a VarAdd to constantly increase the value, driving the animation.
You need a VarSet to keep resetting that value when it gets to the end of the animation.

Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#12  May 02, 2019, 10:20:30 pm
  • **
  • Variables > Boyfriends
Good news and bad news.

Well, I did download Jailbot, and it was almost jarring with the tracing eyes and facial glitches, I also did find the code,[State -3 Glitch Reset] and the values of what I assumed were health values. All and all the character was so impressive that I spent the better part of three minutes feeling like shite because it just shows how little I actually know despite the amount of characters I've made. Jailbot was V1.1 from BLACKLISTED WEBSITE, I'm not sure if that's the latest build but it's the most inspiring mugen character I've seen in years, regardless.

Good news: I did manage to get the code working using a tutorial I found, and using Nep Hearts' code! Since... the actual code Bannana and altoiddealer left me went waaaay over my head, I spent the better part of yesterday trying to figure it all out and I didn't want to post anything until I had something concrete at least. So the weird gauge I made is working as intended so I'll just end up marking this off as solved.

Bad news: My bar/meter is working, but it keeps going over the limit whenever var reaches the limit,(400) and I have no idea why and it's driving me crazy,/ but/ that isn't what this topic was made for so it was solved thanks to you three.~ Still sad I couldn't comprehend the code altoiddealer and Bannana left me, I have a feeling I'll be coming back to it in the future.

Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#13  May 03, 2019, 02:40:41 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
you need to use a VarSet to avoid the variable going out of bounds

[State -2]
type = VarSet
trigger1 =var(4)>400
var(4) = 400

This will prevent the variable from going over 400
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: Stun bar/meter Explod(s) or Helper /Realllllly/ Confused
#14  May 03, 2019, 05:18:04 pm
  • **
  • Variables > Boyfriends
It was a pleasant surprise to wake up to this! ...Though I admit it didn't work for me. I'm honestly convinced it has something to do with Statedef 9011 because after the character's dizzy animation,(5300) is over the character has a random stun value after they recovery, it's always  40 or 80 stun value no matter the situation. I'll keep trying though, since I know what /needs/ to be done now. So thanks! X3