Random event Variables??

● ARCHIVED · READ-ONLY
Started by Sick-_-boys 3 posts View original ↗
  1. Alright so I don't know much about variables, but I want to add a random event so if I interact with an event/object a number of times, let's say one out of 50 times I can get a secret item. I would say the best example of this is in Yume Nikki, if you turn the lights off and on a number of times you would summon Uboa. something like that... if that makes sense.
  2. if u want a 2% chance you'd make the event like:
    control variable: x "Percent" random 0 ~ 99
    if variable is < 2
    do special thing
    else
    do normal thing

    if you want a set 50th interaction you make the event:
    if variable = 49
    do special thing
    variable control: add 1 (or reset to 0 if you want this to be repeatable)
    else
    variable control: add 1
    do normal thing

    you can make as many "if" statements as you want, just make sure to turn on the "Else" branch for all of them
    example could be:
    control variable: x random 0~99
    if variable < 40
    give tin ore
    else
    if variable <70
    give copper ore
    else
    if variable < 90
    give iron ore
    else
    "nothing but dirt"
    (and finish if off with) control switch: x = On

    now that same percentile variable is also used for a different event to give 40% chance at tin, 30% being copper, 20% iron, and 10% chance at nothing
    and can have all mining switches be turned Off from a different event like the event to leave the dungeon or a common event that runs when you sleep at an inn so it respawns
  3. Tiamat-86 said:
    if u want a 2% chance you'd make the event like:
    control variable: x "Percent" random 0 ~ 99
    if variable is < 2
    do special thing
    else
    do normal thing

    if you want a set 50th interaction you make the event:
    if variable = 49
    do special thing
    variable control: add 1 (or reset to 0 if you want this to be repeatable)
    else
    variable control: add 1
    do normal thing

    you can make as many "if" statements as you want, just make sure to turn on the "Else" branch for all of them
    example could be:
    control variable: x random 0~99
    if variable < 40
    give tin ore
    else
    if variable <70
    give copper ore
    else
    if variable < 90
    give iron ore
    else
    "nothing but dirt"
    (and finish if off with) control switch: x = On

    now that same percentile variable is also used for a different event to give 40% chance at tin, 30% being copper, 20% iron, and 10% chance at nothing
    and can have all mining switches be turned Off from a different event like the event to leave the dungeon or a common event that runs when you sleep at an inn so it respawns
    thanks my dude!!!