YesNoOk
avatar

Meter Filler (Read 486 times)

Started by BC, November 05, 2014, 07:06:24 pm
Share this topic:

BC

Meter Filler
#1  November 05, 2014, 07:06:24 pm
  • avatar
  • ****
    • UK
I'm creating a gauge for a game feature called stagger stun and I'm having trouble figuring out the filler's scale equation. The feature works by causing p2 to go into a stagger/stun (not dizzy) state where you have the option to mash out of it to avoid further combos and there are certain moves that cause the stagger. Here's my code:

Code:
;====================STAGGER STUN SYSTEM====================================
;THIS SETS A VARIABLE TO THE MASH VALUE AND RECOGNIZES WHEN THE OPPONENT IS IN STAGGER STUN
[State 0, VarSet]
type = VarSet
trigger1 = stateno = 1406 && numtarget(500)=1
trigger1 = target,stateno = 1415
trigger2 = stateno = 210 && numtarget(500)=1
trigger2 = target,stateno = 1410
trigger3 = stateno = 1403 && numtarget(500)=1
trigger3 = target,stateno = 1410
v = 7
value = 30
persistent = 0

:THESE ARE THE COMMANDS TO USE FOR MASHING
[State 0, VarAdd]
type = VarAdd
triggerall = numtarget(500)=1
trigger1 = target,command = "x" || target,command = "y" || target,command = "z"
trigger2 = target,command = "a" || target,command = "b" || target,command = "c"
trigger3 = target,command = "up" || target,command = "down" || target,command = "left" || target,command = "right"
trigger4 = target,command = "uf" || target,command = "ub" || target,command = "df" || target,command = "db"
v = 7
value = -1

;RESETS THE VARIABLE
[State 0, VarSet]
type = VarSet
trigger1 = var(7) <= 0 || p2movetype != H
v = 7
value = 0




;HERE IS THE HELPER CODE:

[State -2, Helper]
type = Helper
triggerall = numhelper(1)=0
trigger1 = ((stateno = [1410,1415]) && stateno != 1411)
name = "Stagger Meter"
ID = 1
stateno = 4500
pos = 0,0
facing = 1
postype = p1
ownpal = 1
supermovetime = 999
pausemovetime = 999
ignorehitpause = 1



;HELPER STATE========
[statedef 4500]
physics = N
velset = 0,0
anim = 7999
ctrl = 0
sprpriority = 0

[State 0, BindToRoot]
type = BindToRoot
trigger1 = 1
pos = 5 * root,const(size.head.pos.x),root,const(size.head.pos.y)-30


;THIS IS THE EMPTY GUAGE====
[State 0, Explod] 
type = Explod
trigger1 = numexplod(1)=0
anim = 10000
ID = 1
facing = 1
bindtime = -1
pos = 0,0
postype = p1
pausemovetime = 999
supermovetime = 999
scale = 0.3,0.3
ownpal =  1

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,stateno != [1410,1415])
trigger2 =  stateno = 1411
id = 1
ignorehitpause =1


;THIS IS THE FILLER===
[State 0, Explod]
type = Explod
trigger1 = numexplod(2)=0
anim = 10001
ID = 2
facing = 1
bindtime = -1
pos = 0,0
postype = p1
pausemovetime = 999
supermovetime = 999
scale = 0.3,0.3
ownpal =  1

[State 0, ModifyExplod]
type = ModifyExplod
trigger1 = numexplod(2)=1
ID = 2
scale =  ;OK SO THIS IS THE SCALE I NEED TO ADJUST TO SCALE FROM FULL TO NOTHING DEPENDING ON VAR(7)'s VALUE?

[State 0, RemoveExplod]
type = RemoveExplod
trigger1 = (root,stateno != [1410,1415])
id = 2

[State 0, DestroySelf]
type = DestroySelf
trigger1 = (root,stateno != [1410,1415])


Any help would be appreicated.
Accepting commissions
Re: Meter Filler
#2  November 05, 2014, 07:50:08 pm
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
The easiest way to handle the scale is first by having your var(7) max be 100. Decrease it by something larger than 1 to achieve a quicker reduction. After that, the scale is really simple:

Code:
var(7)*[width_of_sprite].0 ; <-- You need to treat this as a float by adding the .0 or your result will be either 0 or 1, which is not what you want.

-[Все слова это только слова.]-

BC

Re: Meter Filler
#3  November 05, 2014, 07:53:11 pm
  • avatar
  • ****
    • UK
yea thanks, the 30 was my problem and my code now is:

scale = 0.3*((enemynear(0),var(7))/30.0),0.3


works great :) thanks
Accepting commissions
Re: Meter Filler
#4  November 06, 2014, 05:38:19 pm
  • ****
  • Target Acquired.
    • Ukraine
    • mugencoder.com
No problem! :)

-[Все слова это только слова.]-