News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

Multiple instances of the same explod?

Started by supercain, June 20, 2020, 08:19:16 AM

Previous topic - Next topic

supercain

Hi,

I have the same explod happening in the same state 3 times and the only difference is the position. Like this:


[State 0, Explod]   
type = Explod
trigger1 = time = 0
anim = f3022
pos = 0,0
postype = left
removetime = 50

[State 0, Explod]   
type = Explod
trigger1 = time = 0
anim = f3022
pos = 30,40
postype = left
removetime = 50

[State 0, Explod]   
type = Explod
trigger1 = time = 0
anim = f3022
pos = 70,90
postype = left
removetime = 50


is it possible to abbreviate this in only one expression? i tried like this:

[State 0, Explod]   
type = Explod
trigger1 = time%3 = 0
anim = f3022
pos = 0,0
postype = left
removetime = 50
random = 70-90


it almost got it but not quite because the explods wont appear at the same time but one after another.

any ideas please?

Dcat

#1
So is the explod is happening at the same time but you want it at different positions? I'd say to keep it as 3 seperate chunks to maintain your positioning, if its really large splash screen images but if you want it just like randomized hitsparks or debris

You're on the right track, just looks like you have a typo: try changing random = 70-90 to random =70,90


[State 0, Explod]
type = Explod 
trigger1 = time%3 = 0
anim = f3022
pos = 0,0
postype = left
removetime = 50
random = 70,90

Also You could maybe try it like this:

[State 0, Explod]
type = Explod 
ID=3022;  Assign an ID number to your explod so MUGEN can read it better
triggerall = numexplod(3022) <8 ; Will not make more than 7 instances of randomized 3022 Explods
trigger1 = time%3 = 0
anim = f3022
pos = 0+random%70 , 0+random%90
postype = left
removetime = 50


Quotetriggerall = numexplod(3022) <8
; Will not make more than 7 instances of randomized 3022 Explods. This is good to conserve CPU usage so you don't  make unlimited explods.Change this to as many or few explods you want

Plus (+) or minus (-) a random % value randomly generates a value equivalent to 1 less  than the number you pick, so "0 + random % 2"= Plus1 unit of variation, & results will be either 0 or 1.
If you wrote "0 + random % 3" it would give you Plus 2 units of variation, & Results will range from 0, 1,or 2. and it continues like that for whatever random% value to use. Took me a while to realize that


So "0 + random % 70" has a range from 0 to 69 just as " 0 - random % 70" has a range of -69 to 0.

supercain

Thats a great answer. Thank you. But lets say I dont want the positions to be random but to be exact at 0,0 for the first explod, 30,40 for the second and 70,90 for the 3rd one?

supercain

Oh I think I got it. In pos I only need to add + time like this

pos = time*30,time*40

Im not yet sure about the 3rd one because its a more complicated math expression but the important thing is that now I understand how to code it. Thank you!

supercain

Well I thought I got it but no... the explods still appear with different timing. Any way around?

Cyanide

Abuse some mugen logic. Only really works at time = 0. Otherwise youll need to have a helper do it.

Type explod
Trigger1 time 0
Id = 5
Pos whatver random values

Type changestate
Trigger1 numexplod5 < 5
Value = stateno

Don't have anything at time 0 that you don't want to multi trigger. Mugen will cycle the state 5 times then continue. Helper to do the same thing would be safer in terms of other effects but if you place the 2 bits of code in that order it should run tbose before doing the rest of the state.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.