• 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.

[Eventing Question] Random item event

3
Posts
2
Years
    • Seen Jun 26, 2021
    Hi guys,
    Im making a pokemon game based on an island, and i want to make an item ball event that gives you everyday 1 random item from all items available, ai tried and didnt succeed.
    Any help would be appreciated :D
     
    124
    Posts
    3
    Years
  • There are a few different ways you could do this. Here's how I would do it.
    Since this is an event that resets at midnight (presumably), you can look at how Kurt works in the example maps.
    The first event page for your item ball might look like this (I've used script commands, but some of this you could do using event commands):
    Code:
    arr = []
    GameData::Item.each { |s| arr.push(s.id) if !s.is_important? && !s.is_mega_stone? }
    if pbItemBall(arr.sample)
      pbSetEventTime # Start timer until next time player can receive an item
      pbSetSelfSwitch(@event_id,"A",true) # Activates self-switch A, usually corresponds to the event page that is used while the event is cooling down
    end
    This gives the player one of any defined item that is not a key item, TM, HM or mega stone.
    I hope that helps!
     
    3
    Posts
    2
    Years
    • Seen Jun 26, 2021
    There are a few different ways you could do this. Here's how I would do it.
    Since this is an event that resets at midnight (presumably), you can look at how Kurt works in the example maps.
    The first event page for your item ball might look like this (I've used script commands, but some of this you could do using event commands):
    Code:
    arr = []
    GameData::Item.each { |s| arr.push(s.id) if !s.is_important? && !s.is_mega_stone? }
    if pbItemBall(arr.sample)
      pbSetEventTime # Start timer until next time player can receive an item
      pbSetSelfSwitch(@event_id,"A",true) # Activates self-switch A, usually corresponds to the event page that is used while the event is cooling down
    end
    This gives the player one of any defined item that is not a key item, TM, HM or mega stone.
    I hope that helps!

    Thank you man! is there any way to add evolutions stones, tms and hms?
     
    124
    Posts
    3
    Years
  • Thank you man! is there any way to add evolutions stones, tms and hms?

    Evolution stones should be included. If you meant mega evolution stones, then use this (also no longer excludes TMs and HMs):
    Code:
    arr = []
    GameData::Item.each { |s| arr.push(s.id) if !s.is_key_item? }
    if pbItemBall(arr.sample)
      pbSetEventTime # Start timer until next time player can receive an item
      pbSetSelfSwitch(@event_id,"A",true) # Activates self-switch A, usually corresponds to the event page that is used while the event is cooling down
    end
     
    3
    Posts
    2
    Years
    • Seen Jun 26, 2021
    Evolution stones should be included. If you meant mega evolution stones, then use this (also no longer excludes TMs and HMs):
    Code:
    arr = []
    GameData::Item.each { |s| arr.push(s.id) if !s.is_key_item? }
    if pbItemBall(arr.sample)
      pbSetEventTime # Start timer until next time player can receive an item
      pbSetSelfSwitch(@event_id,"A",true) # Activates self-switch A, usually corresponds to the event page that is used while the event is cooling down
    end

    Thank you very much man! you the best! :D when I'll finnish my game I'll let you know if it worked.
     
    Back
    Top