YesNoOk
avatar

How to limit fireballs? (Read 2629 times)

Started by QuickFist, June 26, 2017, 05:49:15 pm
Share this topic:
How to limit fireballs?
#1  June 26, 2017, 05:49:15 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
I'm coding a fireball move but I need it to stop after...idk, 10 fireballs? What I coded is a starting state which is the first fireball, then a changestate which sends the char to the 2nd+ fireball(s), and it has that same change state, so the player can keep throwing fireballs rapidly until certain limit, but I don't know how to code said limit, some help please

Re: How to limit fireballs?
#2  June 26, 2017, 06:18:05 pm
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
Similar to ryus mvc3 special?
Re: How to limit fireballs?
#3  June 26, 2017, 06:20:33 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
Haven't played MvC3, you mean the hadouken?
I'm actually coding a DBZ fireball

Re: How to limit fireballs?
#4  June 26, 2017, 06:23:39 pm
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
If you do a hado with the launcher button you can mash
it to get about 10 more hados in mvc3 or hold it and charge
It for a explosive hado
Re: How to limit fireballs?
#5  June 26, 2017, 06:25:39 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
Oh, yeah, like that

DW

Re: How to limit fireballs?
#6  June 26, 2017, 06:50:02 pm
  • *****
    • USA
    • www.trinitymugen.net
This is how I would do it:

Make a VarAdd at the beginning of the state add 1 every time you're in that state. Then add a restriction to the ChangeState based on that Var. You'll also need a reset function(set said Var to 0) in state -2 or possibly state -3? I'd go with -2 though. So, when you use the fireball, 1 will add to the Var. Every time it loops, it'll add 1 to the Var. Once the Var count reaches the desired amount, that's what you'd add as the restriction for the ChangeState loop.
Re: How to limit fireballs?
#7  June 26, 2017, 06:55:49 pm
  • *****
  • Shame on you!
    • USA
DW's var mode is usually how it's done. You can do it without using a variable, but it's much easier with them.
You wont need to use statedef -2 to reset the var. Just do a varset to 0 at
trigger1 = time = 0
in the very first state.
You probably dont want to loop back to the same state, just do a changeanim. If you code the rest of the sounds/helpers/whatever to work of animelem, or animelemno, or animelemtime you should be fine. Just keep setting the var, and use the button press for the changeanim.
I'd personally make it so you can't use the varadd/changeanim after a certain frame of the animation.
vVv Ryuko718 Updated 10/31/22 vVv
Re: How to limit fireballs?
#8  June 26, 2017, 07:00:40 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
Ok this is what I got but now it throws fireballs 2 at a time

;-------------------------------------------------------------------------------------
;KI BLAST, 1st
[Statedef 500]
type    = S
movetype= A
physics = N
juggle  = 7
velset = 0,0
anim = 500
ctrl = 0
sprpriority = 2
poweradd = 35

[state 1215, Smoke FX]
type = explod
trigger1 = animelemtime(2)=0
anim = 9110
id = 9110
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

[state 1215, Smoke FX]
type = explod
trigger1 = animelem =3
anim = 501
pos = 45,-83
postype = P1
sprpriority = 6
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1
scale = 0.5,0.5


[State 200, 1]
type = PlaySnd
trigger1 = AnimElemtime(3)=0
value = 950,2

[State 1000, lkb]
type = Helper
helpertype = normal
trigger1 = AnimElemtime(3)=0
name = "kiblastL1"
postype = P1
pos = 70,-83
ownpal = 1
stateno = 510
id = 510

[State 0, VarSet]
type = VarSet
trigger1 = time = 0
v = 5    ;fv = 10
value = 0
;ignorehitpause =
;persistent =


[State , repetition]
type = ChangeState
trigger1 = animelemtime(3)>=0
Trigger1 = Command = "a"
trigger1 = Var(5)<=10
value = 501
ctrl = 1

[State , Back to stand]
type = ChangeState
trigger1 = !animtime
value = 0
ctrl = 1
;-------------------------------------------------------------------------------------
;KI BLAST, repetition
[Statedef 501]
type    = S
movetype= A
physics = N
juggle  = 7
velset = 0,0
anim = 500
ctrl = 0
sprpriority = 2
poweradd = 35

[State 0, VarAdd]
type = VarAdd
trigger1 = 1
v = 5
value = 1

[state 1215, Smoke FX]
type = explod
trigger1 = animelemtime(1)=0
anim = 9110
id = 9110
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

[state 1215, Smoke FX]
type = explod
trigger1 = animelem =1
anim = 501
pos = 45,-83
postype = P1
sprpriority = 6
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1
scale = 0.5,0.5


[State 200, 1]
type = PlaySnd
trigger1 = AnimElemtime(1)=0
value = 950,2

[State 1000, lkb]
type = Helper
helpertype = normal
trigger1 = AnimElemtime(1)=0
name = "kiblastL1"
postype = P1
pos = 70,-83
ownpal = 1
stateno = 510
id = 510

[State , repetition]
type = ChangeState
trigger1 = animelemtime(2)>=0
Trigger1 = Command = "a"
trigger1 = Var(5)<=10
value = 501
ctrl = 1

[State , Back to stand]
type = ChangeState
trigger1 = !animtime
value = 0
ctrl = 1

What am I doing wrong?

DW

Re: How to limit fireballs?
#9  June 26, 2017, 07:02:59 pm
  • *****
    • USA
    • www.trinitymugen.net
If the state loops though, and he puts the Var reset to 0 in that state, then it'll just keep going 0-1-0-1 right? I'm going based off what he's done currently. The Varset to 0 would need to go somewhere else, and would need different parameters for being set to 0. Like, not in said fireball state, or "movetype!=A" or w/e.



@Quickfist:

EDIT:
Change the trigger for the VarAdd.
Not "trigger1 = 1". Change it to "trigger1 = !Time".
Use the debug info as well for w/e var you're using, so you can see it functioning properly.

EDIT2:

Also, for the repetition ChangeStates, they should not have the "ctrl=1" parameter.
Last Edit: June 26, 2017, 07:09:56 pm by DW
Re: How to limit fireballs?
#10  June 26, 2017, 07:23:28 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
Ok it's kinda working now, what I need now its a time limit between each fireball barrage, the var should stay at 10 when it reaches 10 for a while and then reset back to 0, how do I code this?

Re: How to limit fireballs?
#11  June 26, 2017, 07:59:25 pm
  • *****
  • Shame on you!
    • USA
One thing, you want your code that has time = 0 at the top of the state.
If you make your statedef follow a time-line, it usually runs smoother. I, and a couple other users, have run into random problems where one thing is above another and it causes issues because things get set in the wrong order.

On resetting the "10", can P1 just stay in this state indefinitely? 

For the time limit, you want to use something like
trigger1 = animelemtime(4) < 0

as for the countdown after 10, you can do two things. Make a new var, or make a little system to reset the var
You'd basically put triggers that nothing works if the var > 10.
EXCEPT a varadd, that adds to it once it hits 10. Add 1 every tic, and if you want to wait 1 second, then it'll be 70 at the end.
Then you make a second VarSET, that once the var >=70 the var = 0.
vVv Ryuko718 Updated 10/31/22 vVv
Re: How to limit fireballs?
#12  June 26, 2017, 08:19:16 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
Ok, so, I make a new var that starts counting when the fireball var reaches 10, then when it reaches certain number I reset both vars, right?

Re: How to limit fireballs?
#13  June 26, 2017, 09:10:42 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
I didn't read the whole thread but I did not see anyone mention this...

I see all of the fireballs are helpers, assigned ID 510

So, your trigger should simply be:

NumHelper(510) < 10

Re: How to limit fireballs?
#14  June 26, 2017, 09:16:56 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
The thing is the ten fireballs are not on screen at the same time, since they're destroyed on contact

Re: How to limit fireballs?
#15  June 26, 2017, 09:43:48 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
Whoops :)   So yeah like ODB said, reset a Var at the beginning lf the state then VarAdd every time a helper is created

Re: How to limit fireballs?
#16  June 26, 2017, 10:56:15 pm
  • ****
  • Hey, I'm Grump!
    • USA
    • soldier.ucoz.net/
You only need 1 state if it fires 2 fireballs at once. Make it so you regain control after a certain amount of time has passed after the 2nd fireball. That way you just use the same state over and over repeatedly. Put a var trigger on the command itself. triggerall = var(5)<10
In statedef -2 have a varset to set var(5) back to 0 when you're no longer in that fireball state.

Y'all are making this too complicated.

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."
Re: How to limit fireballs?
#17  June 26, 2017, 10:59:19 pm
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
Ok, let me be very clear:
"a" button throws a fireball, pressing it repeatedly shoots more until you've shot 10. When you reach 10 you have to wait for a while, until you can shoot more

Re: How to limit fireballs?
#18  June 27, 2017, 02:08:48 am
  • *****
  • Shame on you!
    • USA
If the state loops though, and he puts the Var reset to 0 in that state, then it'll just keep going 0-1-0-1 right?
He has state 500 that switches to 501.

Just do my "70" method.
also you should set up the varset to ignorehitpause = 1

[State 0, VarAdd]
type = VarAdd
triggerall = var(5) <=9 ;add this to all the other stuff
trigger1 = animelemtime(1)  = 1 ;This will work every time anim elem 1 plays it's first tic.
v = 5
value = 1
ignorehitpause = 1 ;add this because fireballs will be hitting P2.
vVv Ryuko718 Updated 10/31/22 vVv
Re: How to limit fireballs?
#19  June 27, 2017, 02:48:14 am
  • *****
    • Venezuela
    • Blacksight22@Yahoo.Com.Ve
    • Skype - sebastian.osio
Ok, I'm losing my mind here. Let me show you what I did and please tell me what I have to fix

;-------------------------------------------------------------------------------------
;LIGHT KI BLAST, 1st STRIKE
[Statedef 500]
type    = S
movetype= A
physics = N
juggle  = 7
velset = 0,0
anim = 500
ctrl = 0
sprpriority = 2
poweradd = 35


[state 1215, Smoke FX]
type = explod
trigger1 = animelemtime(2)=0
anim = 9110
id = 9110
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

[state 1215, Smoke FX]
type = explod
trigger1 = animelem =3
anim = 501
pos = 45,-83
postype = P1
sprpriority = 6
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1
scale = 0.5,0.5


[State 200, 1]
type = PlaySnd
trigger1 = AnimElemtime(3)=0
value = 950,2

[State 1000, lkb]
type = Helper
helpertype = normal
trigger1 = AnimElemtime(3)=0
name = "kiblastL1"
postype = P1
pos = 70,-83
ownpal = 1
stateno = 510
id = 510

[State , repetition]
type = ChangeState
trigger1 = animelemtime(3)>=0
Trigger1 = Command = "a"
trigger1 = var(5) <=10
value = 501
ctrl = 0

[State , Back to stand]
type = ChangeState
trigger1 = !animtime
value = 0
ctrl = 1
;-------------------------------------------------------------------------------------
;LIGHT KI BLAST, 2nd STRIKE
[Statedef 501]
type    = S
movetype= A
physics = N
juggle  = 7
velset = 0,0
anim = 500
ctrl = 0
sprpriority = 2
poweradd = 35

[State 0, VarAdd]
type = VarAdd
triggerall = var(5) <=9 ;add this to all the other stuff
trigger1 = animelemtime(1)  = 1 ;This will work every time anim elem 1 plays it's first tic.
v = 5
value = 1
ignorehitpause = 1 ;add this because fireballs will be hitting P2.

[state 1215, Smoke FX]
type = explod
trigger1 = animelemtime(1)=0
anim = 9110
id = 9110
pos = 0,0
postype = P1
sprpriority = 3
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1

[state 1215, Smoke FX]
type = explod
trigger1 = animelem =1
anim = 501
pos = 45,-83
postype = P1
sprpriority = 6
ownpal = 1
removetime = -2
persistent = 0
ignorehitpause = 1
scale = 0.5,0.5


[State 200, 1]
type = PlaySnd
trigger1 = AnimElemtime(1)=0
value = 950,2

[State 1000, lkb]
type = Helper
helpertype = normal
trigger1 = AnimElemtime(1)=0
name = "kiblastL1"
postype = P1
pos = 70,-83
ownpal = 1
stateno = 510
id = 510

[State , repetition]
type = ChangeState
trigger1 = animelemtime(2)>=0
Trigger1 = Command = "a"
trigger1 = var(5) <10
value = 501
ctrl = 0

[State , Back to stand]
type = ChangeState
trigger1 = !animtime
value = 0
ctrl = 1

The countdown var: (on state -2)
[State 0, VarSet]
type = VarSet
trigger1 = Var(19)>140
v = 5    ;fv = 10
value = 0
;ignorehitpause =
;persistent =

[State 0, VarAdd]
type = VarAdd
trigger1 = Var(5)>10 && Time%1
v = 19   
value = 1
;ignorehitpause =
;persistent =

The command state:
[state -1, Ki Blast]
type = ChangeState
triggerall = !NumPartner || NumPartner && (sysvar(4) != [8,9]) && (sysvar(4) != 12) && (StateNo != [1251109,1251114])
value = 500
triggerall = var(5) > 10
triggerall = var(59) = 0
triggerall = command = "a"
triggerall = command != "holddown"
trigger1 = statetype = s
trigger1 = ctrl
trigger2 = stateno = 200
trigger3 = stateno = 240
trigger4 = stateno = 220
trigger5 = stateno = 400
trigger6 = stateno = 440
trigger7 = stateno = 420
trigger8 = stateno = 500 && AnimElem=3

Now it's not throwing any fireballs

Re: How to limit fireballs?
#20  June 27, 2017, 04:35:09 am
  • *****
  • Shame on you!
    • USA
Well, honestly, at this point, I feel like posting is becoming pointless.
One thing, you want your code that has time = 0 at the top of the state.
I'm not sure why you removed the VarSet from state 500.
You have a ton of small mess ups all over.

The countdown var: (on state -2)  ;where's the comment out on this?
[State 0, VarSet] ;rename stuff like this so you know WHY you have it.
;ignorehitpause =    ;fireballs will be hitting left and right. You want stuff to work while that happens.


[State 0, VarAdd]
type = VarAdd
triggerall = var(5) <=9 ;add this to all the other stuff
Then you have
 
[state -1, Ki Blast]
type = ChangeState
triggerall = !NumPartner || NumPartner && (sysvar(4) != [8,9]) && (sysvar(4) != 12) && (StateNo != [1251109,1251114])
value = 500
triggerall = var(5) > 10 ;How do you go from 9 to 11?

trigger8 = stateno = 500 && AnimElem=3 ;this shouldn't be here because you use the changestate inside the state.

If you already use var 19 as a countdown timer, that's cool. Just make sure what ever statedef -2 stuff you're talking about isn't messing you up.
Add the varset var(5)=0 back to state 500.

Use displaytoclipboard to watch var(5) and (19) to see what values are pumping out.
vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: June 27, 2017, 04:38:36 am by Odb718