YesNoOk
avatar

Random sending P2 into custom gethit from a hitdef (Read 1395 times)

Started by Momotaro, November 14, 2021, 04:50:03 pm
Share this topic:
Random sending P2 into custom gethit from a hitdef
#1  November 14, 2021, 04:50:03 pm
  • *****
  • A.K.A. NED
  • I like to draw fighting game characters...
Basically the title.

I have a move whose the hitdef should send randomly P2 into custom gethitstate. (like 25% chances)

What is the best way to make it working well ?


For the moment I cloned the regular hitdef to have 2 exact hitdefs with these differences


1st have this triggerall
Code:
triggerall = Random <= 249
and this
Code:
p2stateno = 7015

The second have this
Code:
triggerall = Random > 249 


Is it the right way to code it?
seems like the random make sometime the hitbox inactive or something...

Thanks for any help

EDIT : seems like it's a "random" problem because with the method I use right now, the random vaue is not EITHER activating one or another hitdef.
It can also have none of them active.

My final solution would be to use a var. But I try to save them.
Any other option is welcome.
Last Edit: November 15, 2021, 07:31:53 pm by Momotaro
Re: Random sending P2 into custom gethit from a hitdef
#2  November 14, 2021, 08:06:10 pm
  • avatar
  • ***
    • Portugal
Probability doesn't work like that. Random <= 249 has a 25% chance of triggering, Random > 249 has a 75%. So if the first one doesn't trigger, it doesn't mean the second one will; its possible for both to not trigger.

Don't use p2stateno, use a targetstate controller and put the random there instead. That way you only need one hitdef.

Code:
[State 000]
type = targetstate
trigger1 = random <= 249 ;trigger 25% of the time
trigger1 = movehit
value = (custom state number goes here)
Re: Random sending P2 into custom gethit from a hitdef
#3  November 15, 2021, 01:23:27 am
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
Random%4=1 will give you a better 25% odds, which solves the problem that mugen's random generator is biased towards lower numbers
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: Random sending P2 into custom gethit from a hitdef
#4  November 15, 2021, 10:59:32 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
If you use the movehit trigger whichever random method you use wont have much effwct cos itll try on every tick of contact. He might not go custom on tick 1 but by tick 10 its a guarantee.

Use movehit = 2 or something instead.


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.
Re: Random sending P2 into custom gethit from a hitdef
#5  November 15, 2021, 12:31:13 pm
  • **
  • Blue is cool.
    • USA
There is a Hitdef parameter called "p2getp1state" that should be what you are looking for Momotaro. Adding this:

Code:
p2getp1state = random < 249

to the Hitdef should grant it a 25% chance of causing the custom state to actually happen.
Sometimes I listen to video game music more than I actually play the game.
Check out my Bonus Game & Characters!: http://mugenguild.com/forum/topics/streets-rage-2-bonus-game-11-chars-162092.0.html
IKEMEN Version: https://mugenguild.com/forum/topics/streets-rage-2-bonus-game-ikemen-version-update-728-196297.0.html
Re: Random sending P2 into custom gethit from a hitdef
#6  November 15, 2021, 07:31:35 pm
  • *****
  • A.K.A. NED
  • I like to draw fighting game characters...
Thanks to all of you guys!
I'll do trial and error with all your suggestions.

It will help a lot!