YesNoOk
avatar

Need assistance with a trigger (Read 1937 times)

Started by cake-kun, February 12, 2018, 09:20:33 am
Share this topic:
Need assistance with a trigger
#1  February 12, 2018, 09:20:33 am
  • avatar
I'm trying to make a trigger activate by a random percent not health or  a command key but just have a slow percentage of randomly activating
is that possible and how would i code it? cant seem to figure it out help would be appreciated

ink

Re: Need assistance with a trigger
#2  February 12, 2018, 04:32:09 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
I think we need more info for this one.

would something like trigger1 = random < 4 work for this?
Re: Need assistance with a trigger
#3  February 12, 2018, 04:55:18 pm
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
I'm trying to make a trigger activate by a random percent not health or  a command key but just have a slow percentage of randomly activating
is that possible and how would i code it? cant seem to figure it out help would be appreciated
"Random" picks a random number from 0 to 999.  This happens in 1 tick.

Let me give two examples.

Example 1:
Code:
trigger1 = Time = 10
trigger1 = Random < 4

Since the first condition is only true for 1 tick, this will only pick a random number one time.  One out of 250 times, this will trigger.  Not likely to trigger.


Example 2:
Code:
trigger1 = Random < 4

Since there are no other trigger conditions, it will pick a random number every tick. So, since there are 60 ticks per second and in this case there is a 1 in 250 chance probability of triggering on any given tick -- on average, it will trigger in about 4 seconds, give or take depending on luck.

Last Edit: February 12, 2018, 04:58:21 pm by altoiddealer
Re: Need assistance with a trigger
#4  February 12, 2018, 10:51:19 pm
  • avatar
is there a way to make the state trigger with a certain amount of health and at the same time keeping it random
like you need that certain amount of health to activate but it wouldn't always happen like a 50% chance of the state triggering.
Code:
[State -1, modechange]
type=changestate
value=3400
triggerall =life <= 100&& Random < 1
trigger1= ctrl
i came up with this but not sure if this is the best way to go about it
Last Edit: February 12, 2018, 11:28:58 pm by cake-kun
Re: Need assistance with a trigger
#5  February 13, 2018, 01:11:22 am
  • ****
  • Robotics Engineer
    • USA
    • altoiddealer@gmail.com
That should work.  Increase the value if it doesn't trigger quickly enough.  As it is, it will trigger on average in about 17 seconds

Re: Need assistance with a trigger
#6  February 13, 2018, 01:21:37 am
  • avatar
  • **
try this

 [State -1, modechange]
 type=changestate
 value=3400
 triggerall =life <= 100&& Random < 250;<-----for 25% of the time
 trigger1= ctrl


 [State -1, modechange]
 type=changestate
 value=3400
 triggerall =life <= 100&& Random < 500;<-----for 50% of the time
 trigger1= ctrl

 [State -1, modechange]
 type=changestate
 value=3400
 triggerall =life <= 100&& Random < 750;<-----for 75% of the time
 trigger1= ctrl

i hope this helps

MGMURROW

ink

Re: Need assistance with a trigger
#7  February 13, 2018, 05:37:43 pm
  • ****
  • inktrebuchet
    • USA
    • s236.photobucket.com/albums/ff271/inktrebuchet/?
You could also try playing with this one that I put together a while back. The lower your life is, the more often it will trigger.

Code:
trigger1 = cond(Gametime% ((life/100)-1) = 0 ,random,1000) <= 999 
Re: Need assistance with a trigger
#8  February 15, 2018, 09:21:27 am
  • ******
  • Legendary XIII
  • I am the eye of the storm to come!
    • New Zealand
    • network.mugenguild.com/cyanide/
Random values above 100 trigger far more often. Random < 250 is liable to trigger within 4 ticks. 500 within 2 and 750 within 2 as well. Basically its a guarantee to trigger.


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.