• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Random event on entering map

153
Posts
4
Years
    • Seen Feb 4, 2020
    Hello Everyone,

    Still on my project to create a game for teaching I had the idea of implementing a limited number of pokemon of the same species in the computer, this relatively to the respect of biodiversity.
    I don't want to make it so it's impossible to capture if you already have one. I think it would be more realistic and fun if an environmental guy shows up randomly and checks the computer of the player then gives him a fine if he/she has two or more pokemon of the same species.

    So my questions are:
    1)How to create a global event that will autocheck its conditions every second (I think that's how the time of day works) or everytime the player enters a new map
    2)How to check if the computer + the party contains more than one vulpix for example.

    For the random I guess I can figure it out using variables.

    Thank you in advance guys/girls!
     
    153
    Posts
    4
    Years
    • Seen Feb 4, 2020
    Hello,

    So i tryed this code :

    Events.onMapChange+=proc {|sender,e|
    Envi=rand(4)
    if Envi==1
    pbWait(20)
    Kernel.pbMessage(_INTL("Hey there"))
    end
    }
    Which kinda works but the message is visible only if it triggers when I start the game and not when I change map. (I added the pbWait because i thought this way the character would walk on the map then see the message but each time he's waiting on the previous map and I have the sound of a message displaying but nothing is written and when I press action I then arrive on the next map.

    How could I change this? I tried pbDisplay, but for some reason I had a nil class error

    Edit: It works but I had to use a trick because I didn't understand the first problem, here is what I found:
    Events.onMapChange+=proc {|sender,e|
    $game_variables[1]=rand(4)
    }
    Events.onStepTaken+=proc {
    if $game_variables[1]==1
    Kernel.pbMessage(_INTL("Hey there"))
    $game_variables[1]=0
    end
    }
    If someone knows how to make it more simple I would love to hear how :)
    Now How do I Display a scene (pictures) and make a check weither the character has twice the same species?

    Thank you very much for your time
     
    Last edited:
    Back
    Top