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
If you do a hado with the launcher button you can mashit to get about 10 more hados in mvc3 or hold it and chargeIt for a explosive hado
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.
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 = 0in 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.
Ok this is what I got but now it throws fireballs 2 at a time;-------------------------------------------------------------------------------------;KI BLAST, 1st [Statedef 500]type = Smovetype= Aphysics = Njuggle = 7velset = 0,0anim = 500ctrl = 0sprpriority = 2poweradd = 35[state 1215, Smoke FX]type = explodtrigger1 = animelemtime(2)=0anim = 9110id = 9110pos = 0,0postype = P1sprpriority = 3ownpal = 1removetime = -2persistent = 0ignorehitpause = 1[state 1215, Smoke FX]type = explodtrigger1 = animelem =3anim = 501pos = 45,-83postype = P1sprpriority = 6ownpal = 1removetime = -2persistent = 0ignorehitpause = 1scale = 0.5,0.5[State 200, 1]type = PlaySndtrigger1 = AnimElemtime(3)=0value = 950,2[State 1000, lkb]type = Helperhelpertype = normaltrigger1 = AnimElemtime(3)=0name = "kiblastL1"postype = P1pos = 70,-83ownpal = 1stateno = 510id = 510[State 0, VarSet]type = VarSettrigger1 = time = 0v = 5 ;fv = 10value = 0;ignorehitpause = ;persistent = [State , repetition]type = ChangeStatetrigger1 = animelemtime(3)>=0Trigger1 = Command = "a"trigger1 = Var(5)<=10value = 501ctrl = 1[State , Back to stand]type = ChangeStatetrigger1 = !animtimevalue = 0ctrl = 1;-------------------------------------------------------------------------------------;KI BLAST, repetition[Statedef 501]type = Smovetype= Aphysics = Njuggle = 7velset = 0,0anim = 500ctrl = 0sprpriority = 2poweradd = 35[State 0, VarAdd]type = VarAddtrigger1 = 1v = 5value = 1[state 1215, Smoke FX]type = explodtrigger1 = animelemtime(1)=0anim = 9110id = 9110pos = 0,0postype = P1sprpriority = 3ownpal = 1removetime = -2persistent = 0ignorehitpause = 1[state 1215, Smoke FX]type = explodtrigger1 = animelem =1anim = 501pos = 45,-83postype = P1sprpriority = 6ownpal = 1removetime = -2persistent = 0ignorehitpause = 1scale = 0.5,0.5[State 200, 1]type = PlaySndtrigger1 = AnimElemtime(1)=0value = 950,2[State 1000, lkb]type = Helperhelpertype = normaltrigger1 = AnimElemtime(1)=0name = "kiblastL1"postype = P1pos = 70,-83ownpal = 1stateno = 510id = 510[State , repetition]type = ChangeStatetrigger1 = animelemtime(2)>=0Trigger1 = Command = "a"trigger1 = Var(5)<=10value = 501ctrl = 1[State , Back to stand]type = ChangeStatetrigger1 = !animtimevalue = 0ctrl = 1What am I doing wrong?
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.
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?
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 liketrigger1 = animelemtime(4) < 0as for the countdown after 10, you can do two things. Make a new var, or make a little system to reset the varYou'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.
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?
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 510So, your trigger should simply be:NumHelper(510) < 10
The thing is the ten fireballs are not on screen at the same time, since they're destroyed on contact
Whoops So yeah like ODB said, reset a Var at the beginning lf the state then VarAdd every time a helper is created
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)<10In 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.
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
DW said, June 26, 2017, 07:02:59 pmIf 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 = VarAddtriggerall = var(5) <=9 ;add this to all the other stufftrigger1 = animelemtime(1) = 1 ;This will work every time anim elem 1 plays it's first tic. v = 5value = 1ignorehitpause = 1 ;add this because fireballs will be hitting P2.
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 = Smovetype= Aphysics = Njuggle = 7velset = 0,0anim = 500ctrl = 0sprpriority = 2poweradd = 35[state 1215, Smoke FX]type = explodtrigger1 = animelemtime(2)=0anim = 9110id = 9110pos = 0,0postype = P1sprpriority = 3ownpal = 1removetime = -2persistent = 0ignorehitpause = 1[state 1215, Smoke FX]type = explodtrigger1 = animelem =3anim = 501pos = 45,-83postype = P1sprpriority = 6ownpal = 1removetime = -2persistent = 0ignorehitpause = 1scale = 0.5,0.5[State 200, 1]type = PlaySndtrigger1 = AnimElemtime(3)=0value = 950,2[State 1000, lkb]type = Helperhelpertype = normaltrigger1 = AnimElemtime(3)=0name = "kiblastL1"postype = P1pos = 70,-83ownpal = 1stateno = 510id = 510[State , repetition]type = ChangeStatetrigger1 = animelemtime(3)>=0Trigger1 = Command = "a"trigger1 = var(5) <=10 value = 501ctrl = 0[State , Back to stand]type = ChangeStatetrigger1 = !animtimevalue = 0ctrl = 1;-------------------------------------------------------------------------------------;LIGHT KI BLAST, 2nd STRIKE[Statedef 501]type = Smovetype= Aphysics = Njuggle = 7velset = 0,0anim = 500ctrl = 0sprpriority = 2poweradd = 35[State 0, VarAdd]type = VarAddtriggerall = var(5) <=9 ;add this to all the other stufftrigger1 = animelemtime(1) = 1 ;This will work every time anim elem 1 plays it's first tic.v = 5value = 1ignorehitpause = 1 ;add this because fireballs will be hitting P2. [state 1215, Smoke FX]type = explodtrigger1 = animelemtime(1)=0anim = 9110id = 9110pos = 0,0postype = P1sprpriority = 3ownpal = 1removetime = -2persistent = 0ignorehitpause = 1[state 1215, Smoke FX]type = explodtrigger1 = animelem =1anim = 501pos = 45,-83postype = P1sprpriority = 6ownpal = 1removetime = -2persistent = 0ignorehitpause = 1scale = 0.5,0.5[State 200, 1]type = PlaySndtrigger1 = AnimElemtime(1)=0value = 950,2[State 1000, lkb]type = Helperhelpertype = normaltrigger1 = AnimElemtime(1)=0name = "kiblastL1"postype = P1pos = 70,-83ownpal = 1stateno = 510id = 510[State , repetition]type = ChangeStatetrigger1 = animelemtime(2)>=0Trigger1 = Command = "a"trigger1 = var(5) <10value = 501ctrl = 0[State , Back to stand]type = ChangeStatetrigger1 = !animtimevalue = 0ctrl = 1The countdown var: (on state -2)[State 0, VarSet]type = VarSettrigger1 = Var(19)>140v = 5 ;fv = 10value = 0;ignorehitpause = ;persistent = [State 0, VarAdd]type = VarAddtrigger1 = Var(5)>10 && Time%1v = 19 value = 1;ignorehitpause = ;persistent = The command state:[state -1, Ki Blast]type = ChangeStatetriggerall = !NumPartner || NumPartner && (sysvar(4) != [8,9]) && (sysvar(4) != 12) && (StateNo != [1251109,1251114]) value = 500triggerall = var(5) > 10triggerall = var(59) = 0triggerall = command = "a"triggerall = command != "holddown"trigger1 = statetype = strigger1 = ctrltrigger2 = stateno = 200trigger3 = stateno = 240trigger4 = stateno = 220trigger5 = stateno = 400trigger6 = stateno = 440trigger7 = stateno = 420trigger8 = stateno = 500 && AnimElem=3Now it's not throwing any fireballs
Well, honestly, at this point, I feel like posting is becoming pointless. Odb718 said, June 26, 2017, 07:59:25 pmOne 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 = VarAddtriggerall = var(5) <=9 ;add this to all the other stuff Then you have [state -1, Ki Blast]type = ChangeStatetriggerall = !NumPartner || NumPartner && (sysvar(4) != [8,9]) && (sysvar(4) != 12) && (StateNo != [1251109,1251114])value = 500triggerall = 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.