YesNoOk
avatar

Is there a way to have a helper change the P1 state? (Read 12389 times)

Started by Boxuu, June 04, 2021, 06:19:45 AM
Share this topic:
Is there a way to have a helper change the P1 state?
#1  June 04, 2021, 06:19:45 AM
  • *
  • The Magic Esper
  • I like boxes
    • New Zealand
... Without red collision boxes/hitboxes?

I made this custom bar/meter and when it is empty, I want it to change the P1 state.
Boop
Re: Is there a way to have a helper change the P1 state?
#2  June 04, 2021, 06:30:50 AM
  • ***
  • | The Awakened |
  • 하나뿐인 한국인 대표
    • South Korea
    • sites.google.com/view/kolossoni-mugen
It's not going to be easy...

You'll need to use varset as your value detector for your bar. Then in your -2/-3 state, whenever your custom gauge meter's value goes empty, follow it with changestate accordingly.
Re: Is there a way to have a helper change the P1 state?
#3  June 04, 2021, 10:22:40 AM
  • *
  • The Magic Esper
  • I like boxes
    • New Zealand
Ah the variables. I sort of have knowledge about them but I haven't really tested them out.

So I have the custom bar helper in -2 state. The ID of my helper is 30000. After the round has begun, the helper changes into 30001 (custom bar full) and will eventually change into 30002 (custom bar empty) this change is timed.

Code:
[State 30001]
type = ChangeState
trigger1 = time = 2385
value = 30002

Once this happens, I want P1 to change its state.

> " whenever your custom gauge meter's value goes empty, follow it with changestate accordingly."

So If reading this right, If I were to put a varset in 30002 (custom bar empty) and a changestate in -2 state, the trigger of the changestate being the variable, this would change the state of P1? Like say...


 Example:
Code:
[State -2, ChangeState]
type = ChangeState
trigger1 = var(1) = 50
value = 3060
ctrl = 0

Boop
Last Edit: June 04, 2021, 03:55:13 PM by Boxuu
Re: Is there a way to have a helper change the P1 state?
#4  June 04, 2021, 12:58:49 PM
  • ***
  • | The Awakened |
  • 하나뿐인 한국인 대표
    • South Korea
    • sites.google.com/view/kolossoni-mugen
Well, it'll be simpler than that in your case.

use VarSet for 30001 (which would always start full).

Code:
[State 30001]
type = varset
trigger1 = Time = 0
var(1) = 0

Then, go to 30002 and add another VarSet like this:

Code:
[State 30002]
type = varset
trigger1 = Time = 0
var(1) = 1

And for your -2 state, add this:

Code:
[State -2, ChangeState]
type = ChangeState
trigger1 = Var(1) > 0
value = (whatever state you want it to change to)
ctrl = 0
persistent = 1

What this does is state 30002's Var(1) overwrites 30001's values once the assigned time expires.
Once that happens, your -2 state will detect that Var(1)'s value is no longer 0 and thus will change your character's state to whatever you please.

So the order would be:
30001 (Start of the round) -> 30002 -> Detection from -2 -> Changestate

Try this out and get back to me.
Hopefully it works.
Re: Is there a way to have a helper change the P1 state?
#5  June 04, 2021, 03:28:47 PM
  • *
  • The Magic Esper
  • I like boxes
    • New Zealand
Alright. I added them and this has sort of helped. Thank you. At least the P1 state has changed so this is progress.

However, P1 changed immediately after the round started.

P1 intro ----> Round 1, FIGHT! ----> P1 changed state when the gauge meter starts to drain and not when the assigned time expires.

Should I show the entire code?
Boop
Last Edit: June 04, 2021, 05:46:07 PM by Boxuu
Re: Is there a way to have a helper change the P1 state?
#6  June 04, 2021, 06:22:08 PM
  • ***
  • | The Awakened |
  • 하나뿐인 한국인 대표
    • South Korea
    • sites.google.com/view/kolossoni-mugen
Hmmm, then it looks like var(1) is being set to a non-zero value right as the round begins...

Post the entire code so I can take a better look at what I'm dealing with :)
Re: Is there a way to have a helper change the P1 state?
#7  June 04, 2021, 07:07:03 PM
  • *
  • The Magic Esper
  • I like boxes
    • New Zealand
Code:
;---------------------------------------------------------------------------
; Player 1 state when custom gauge meter helper goes into 30002
[Statedef 3060]
type    = S
movetype= I
physics = s
anim = 3060
ctrl = 0
velset = 0,0

[State 3060] ; Haven't worked on this yet. Too busy figuring out how to make P1 change into this state when 30002 starts
type = ChangeState
trigger1 = Var(1)>0
value = 0
Ctrl = 1

;---------------------------------------------------------------------------
; Custom gauge meter (Before round starts)
[Statedef 30000]
type    = U
movetype= I
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 9999 ; Blank
sprpriority = -1

[State 30000]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 30000] ; Custom gauge meter 'Border'
type = Explod
triggerall = numExplod(30000) = 0
trigger1 = 1
anim = 30000
ID = 30000
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 1
ontop = 1
ownpal = 1

[State 30000] ; Custom gauge meter 'Blank'
type = Explod
triggerall = numExplod(30001) =0
trigger1 = 1
anim = 30001
ID = 30001
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 1
ontop = 0
ownpal = 1

[State 30000] ; Custom gauge meter 'Gauge'
type = Explod
triggerall = numExplod(30002) = 0
trigger1 = 1
anim = 30002
ID = 30002
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 2
ontop = 0
ownpal = 1

[State 30000] ; Removes the gauge meter 'Gauge' explod after round starts
type = RemoveExplod
trigger1 = RoundState = 2
ID = 30002

[State 30000] ; Helper changes into 30001 after round starts
type = ChangeState
trigger1 = RoundState = 2
value = 30001

;---------------------------------------------------------------------------
; Custom gauge meter (After round starts) / Draining itself
[Statedef 30001]
type    = U
movetype= I
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 9999 ; Blank
sprpriority = -1

[State 30001]
type = varset
trigger1 = Time = 0
var(1) = 0

[State 30001]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 30001] ; Custom gauge meter 'Border'
type = Explod
trigger1 = numExplod(30000) = 0
anim = 30000
ID = 30000
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 1
ontop = 1
ownpal = 1

[State 30001] ; Custom gauge meter 'Blank'
type = Explod
trigger1 = numExplod(30001) = 0
anim = 30001
ID = 30001
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 1
ontop = 0
ownpal = 1

[State 30001] ; Custom gauge meter 'Gauge' Drain
type = Explod
trigger1 = numExplod(30003) = 0
anim = 30003
ID = 30003
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 2
ontop = 0
ownpal = 1

[State 30001]
type = RemoveExplod
trigger1 = time = 2385
ID = 30003

[State 30001]
type = ChangeState
trigger1 = time = 2385
value = 30002

;---------------------------------------------------------------------------
; Custom gauge meter (Recharging/Empty)
[Statedef 30002]
type    = U
movetype= I
physics = S
juggle  = 0
velset = 0,0
ctrl = 0
anim = 9999 ; Blank
sprpriority = -1

[State 30002]
type = varset
trigger1 = Time = 0
var(1) = 1

[State 30002]
type = AssertSpecial
trigger1 = 1
flag = noshadow

[State 30002]
type = Pause
trigger1 = time = 0
time = 10
movetime = 10

[State 30002]
type = BGPalFX
trigger1 = time = 0
time = 10
mul = 100,100,100

[State 30002] ; Custom gauge meter 'Border'
type = Explod
trigger1 = numExplod(30000) = 0
anim = 30000
ID = 30000
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 1
ontop = 1
ownpal = 1

[State 30002] ; Custom gauge meter 'Blank'
type = Explod
trigger1 = numExplod(30001) = 0
anim = 30001
ID = 30001
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 1
ontop = 0
ownpal = 1

[State 30002] ; Custom gauge meter 'Recharge'
type = Explod
trigger1 = numExplod(30004) = 0
anim = 30004
ID = 30004
pos = 4,40
postype = left
bindtime = -1
removetime = -1
scale = 0.3,0.3
sprpriority = 2
ontop = 0
ownpal = 1

[State 30002]
type = RemoveExplod
trigger1 = time = 1272
ID = 30004

[State 30002] ; THIS LOOPS BACK TO STATE 30001 AFTER GUAGE METER FULLY RECHARGES
type = ChangeState
trigger1 = time = 1272
value = 30001

And here is the -2 Statedef. The codes down below is regarding the custom gauge only.

Code:
[State -2, Helper] ; Custom gauge meter
type = Helper
trigger1 = NumHelper(30000) = 0
helpertype = Normal
name = "Custom gauge meter"
ID = 30000
stateno = 30000
pos = 50,50
postype = P1
facing = 1
keyctrl = 0
ownpal = 0
ignorehitpause = 1

[State -2, ChangeState]
type = ChangeState
trigger1 = Var(1) > 0
value = 3060
ctrl = 0
persistent = 1

Oh, and i'll provide some of the explods to show you what they look like.

in 30000 statedef : Custom gauge meter (Before round starts)

in 30001 statedef : Custom gauge meter (After round starts) / Draining itself

in 30002 statedef : Custom gauge meter (Recharging/Empty) / Gif doesn't loop. Oops.
Boop
Last Edit: June 04, 2021, 07:39:03 PM by Boxuu
Re: Is there a way to have a helper change the P1 state?
#8  June 04, 2021, 10:49:10 PM
  • ****
    • deathscythemugen.neocities.org/
I have not read the entire thread (lazyness lol) but from the top of my head I think you can use parentvarset. It's like a normal varset but instead of changing a var in the helper, it changes a var in the character. And then in -2 you can detect when this var is on and change state from there, something like this:

(your changestate in -2, var number and state number are just examples) [...]
trigger1 = var(25) && stateno != 1250

Then of course reset the var to 0 after that. Again, this is just by reading the title and is how I'd try that.
Re: Is there a way to have a helper change the P1 state?
#9  June 05, 2021, 04:44:18 AM
  • avatar
  • **
    • Vietnam
... Without red collision boxes/hitboxes?

I made this custom bar/meter and when it is empty, I want it to change the P1 state.

the only way for the helper to change p1 state is using the p1stateno's Projectile sctrl and if only P1 own that helper.
------Tremble Mortal and Despair. Doom has come to this world------
Re: Is there a way to have a helper change the P1 state?
#10  June 25, 2021, 01:34:35 AM
  • *****
  • Shame on you!
    • USA
Not sure if this topic is solved or not.
One thing is, if you're starting with a value for a var, Set it in state 5900 to begin with.
the Second thing is, if you just use 1 check to change states you're going to have a bad time. It will usually just get stuck changing to that state. If you're changing to state 3060, put in a varset/add at the top of it to change it off the value that triggers the state change.
vVv Mauru Mauru Released vVv
Re: Is there a way to have a helper change the P1 state?
#11  June 30, 2021, 04:48:24 PM
  • ***
    • beterwork.hopto.org
... Without red collision boxes/hitboxes?

I made this custom bar/meter and when it is empty, I want it to change the P1 state.

why not p1 monitor the state of the bar meter and change state by itself?
Check my Odysee Channel videos for latest stuff from me.
https://odysee.com/@BeterWork:e
My Home Page
https://beterwork.hopto.org