The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Topic started by: supercain on January 26, 2021, 05:33:59 PM

Title: time% wont work unless it equals 0?
Post by: supercain on January 26, 2021, 05:33:59 PM
Hi,

I have this explod:

Code:
[State 90]
type = explod
trigger1 = time%3 = 0
trigger1 = numexplod(4439) < 10
anim = F69
removetime = -1
postype = p1
pos = 0+random%70,0+random%10
ID = 4439

this works fine because it produces multiple instances of the same explod at different positions at once. Except that I need it to appear after 230 ticks so I changed the first line to this time%3 = 230 and now NOTHING happens. As a matter of fact it will only work with values from 0 to 2 but nothing bigger. Why is that?

Thank you.
Title: Re: time% wont work unless it equals 0?
Post by: XGargoyle on January 26, 2021, 07:40:30 PM
That's because you don't know mathematics.

%3 means modulus of 3, so the only possible results are 0,1 and 2

For example, %5 will give you possible results of 0,1,2,3 and 4

If you want something to trigger on time 230, you'll need to use time=230 instead
Title: Re: time% wont work unless it equals 0?
Post by: supercain on January 27, 2021, 02:03:08 AM
time=230 is exactly what Im using from the beginning, genius...
Title: Re: time% wont work unless it equals 0?
Post by: DarkWolf13 on January 27, 2021, 02:55:07 AM
time%230=0 also works
Title: Re: time% wont work unless it equals 0?
Post by: Cyanide on January 27, 2021, 05:40:55 AM
Insults are not necessary and a really good way to stop people helping you.

Trigger1 = time > 230
Trigger1 = time%3 = 0
Title: Re: time% wont work unless it equals 0?
Post by: supercain on January 27, 2021, 07:13:44 AM
He insulted me first. Sentences beginning with "You dont know" something are offensive. Besides his answer was not helpful at all. But thank you 2 for your replies. I think I got it now.
Title: Re: time% wont work unless it equals 0?
Post by: airforce111 on January 27, 2021, 08:38:27 AM
agree, saying "That's because you don't know mathematics" is unecessary, literally the rest of the comment besides that would've done fine.
Title: Re: time% wont work unless it equals 0?
Post by: XGargoyle on January 27, 2021, 10:08:39 AM
How is an insult when you didn't know what is a modulus function?
Title: Re: time% wont work unless it equals 0?
Post by: supercain on January 27, 2021, 05:01:01 PM
Do I have to spell it out for you? You dont say people things like "you dont know this". Its rude whether its true or not.

Besides guess what? You gave A WRONG ANSWER. So you dont know mathematics as much as you think you do...
Title: Re: time% wont work unless it equals 0?
Post by: XGargoyle on January 27, 2021, 06:43:23 PM
1) If you don't know the modulus function in mathematics, then it's not an insult to say "you don't know mathematics" because modulus is taught to 8 years old kids. Your question was as if you asked "why am I getting an error when I put 2+2=5?"

2) I didn't give you the answer to your problem, I gave you an explanation on how the modulus function worked

3) "If you want something to trigger on time 230, you'll need to use time=230 instead", this is a true fact and in no way a wrong answer. From there, you are supposed to extrapolate that you can also use time<230 or time>230 depending on your needs. Again, Mathematics 101

4) How were you supposed to learn something if I had given you the direct copy&paste code?
So, apologies if I wanted to get you into learning and understanding the root problem you had in your code.

5) So, you think I'm bad at mathematics? Fine if you do, I don't care. My works and creations tell otherwise, as well as my multiple COTM and COTY awards
Title: Re: time% wont work unless it equals 0?
Post by: 2OS on January 27, 2021, 07:00:20 PM
That's because you don't know mathematics.

i wouldn't particularly say that this is provocative but it's not exactly hard to see how someone would take it that way.





%3 means modulus of 3, so the only possible results are 0,1 and 2

For example, %5 will give you possible results of 0,1,2,3 and 4

this is the explanation to your thread title.

while it's most common for the value of an expression that uses modulus to equal 0 you can use any value that's lower than the number you define (the reason it's lower than and not equal to is because "0 is 1 and 1 is 2 etc").

(gametime%400)<200

this for example would play for the first half of every 400 game ticks.
Title: Re: time% wont work unless it equals 0?
Post by: Odb718 on January 28, 2021, 03:55:17 AM
trigger1 = time%3 = 0
time=230 is exactly what Im using from the beginning, genius...
These two things are not the same.
If XGargoyle had said
That's because you don't know THE mathematics.
the slight dig would have been even less.

With that said, you two are now friends. Right? We try to play nice in here, and beat each-other up in game.

The modulus function can be a little tricky to sort out. I try not to use it as often as I can. You should be able to get the same results using other triggers. Cyanide's response should be everything you need. If it's still not perfect, just ask.
Title: Re: time% wont work unless it equals 0?
Post by: supercain on January 28, 2021, 06:29:11 PM
XGargoyle you were rude and you made a MISTAKE and thats final. Just be a man and accept it. If you talk to people like that all the time you are going to get a lot of trouble.

Thats my advice so take it or leave it.