• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • 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] How do I check if it's a scripted event?

  • 107
    Posts
    4
    Years
    • Seen Apr 27, 2023
    I'm using the multiple saves script with autosave enabled, and so, I've added a system that autosave happens at the end of each battle.

    But in Open World Event Pokemons, the Pokemon disappears after pbSetEventTime, so it will disappear for a certain time.

    However, if the player faints a wild Pokemon and receives its experience, closes the game and reopens it, it will remain there and this will cause an infinite loop, thus allowing the user to abuse the experience received by a certain Pokemon.

    So, I imagined adding the pbSetEventTime script when starting the battle, right in the pbWildBattle def section or if not at the end of the transition from the beginning of the battle, so the Pokemon wouldn't disappear on our screen at the same time it starts.

    However, just adding doesn't solve it, as if it's a wild encounter other than an event, it causes an error.

    So, conclude that, the solution would be to check if it is an event for the pbSetEventTime to happen.

    can anybody help me?
     
    I don't know where exaclty your autosave is called, but if it was called onEndBattle you can put something like

    EDIT: Broken script removed

    This way, when variables 98 and 99 have values, the code call pbSetEventTime after player win/capture wild pokémon. Put it before onEndBattle.
     
    Last edited:
    I don't know where exaclty your autosave is called, but if it was called onEndBattle you can put something like

    Code:
    Events.onEndBattle += proc { |_sender,e|
    	decision = e[0]
    	case decision
    	when 1, 4   # Win, capture
    		if $game_variables[98] != 0 && $game_variables[99] !=0
    			pbSetEventTime($game_variables[98],$game_variables[99])
    		end
    	end
    	$game_variables[98] = 0
    	$game_variables[99] = 0
    }

    This way, when variables 98 and 99 have values, the code call pbSetEventTime after player win/capture wild pokémon. Put it before onEndBattle.

    Well, it didn't work for me, maybe I did something wrong.
     
    What autosave system are you using?

    One that Bop made compatible with his multiple save script in v18.1.

    Spoiler:


    For the autosave to happen I call pbAutoSave.
    Thinking about it, I put the autosave in the battle script, to save at the end of it. I have a complex system that requires an autosave to prevent players from cheating.

    Well, everything worked out for me!
    Until, I found out from my players that:
    If the player faints the wild Pokémon, receives the experience and closes the game at the same time, when returning the same Pokémon it will be on the map where there is the event of battle against wild Pokémon (since I have A LOT of wild Pokémon in the open world). Thus, the player can abuse the experience of a Pokémon that provides a lot of experience.

    The idea of pbSetEventTime is that it happens to the wild event before receiving the experience, so if the player closes the game with the wrong intention, the wild Pokémon disappears from the map and only returns after the specified time.
     
    I put the autosave in places in the battle system, when using Pokeballs and at the end of each one.
    The problem is that the save is saving the received XP... but the pbSetEventTime doesn't come in time.
     
    Try to make autosave only works when a switch is ON, and disable it in this battle. Call manually the autosave on event after the battle ends.

    good yes! this is an alternative that will work!
    okay! I will do this in at least 200 POkemon events I have, the important thing is to solve
     
    good yes! this is an alternative that will work!
    okay! I will do this in at least 200 POkemon events I have, the important thing is to solve
    So, I have a better idea. Instead of calling an autosave on battle end, do:

    Code:
    $should_autosave = true

    And after

    Code:
    Events.onMapUpdate += proc { |_sender,_e|
      next if $game_temp.in_menu || $game_temp.in_battle || $game_temp.message_window_showing
      next if $game_player.move_route_forcing || pbMapInterpreterRunning?
      next if !$should_autosave
      pbAutoSave
      $should_autosave = false
    }
    So, autosave will work after battle when there is no event running or menu.
     
    So, I have a better idea. Instead of calling an autosave on battle end, do:

    Code:
    $should_autosave = true

    And after

    Code:
    Events.onMapUpdate += proc { |_sender,_e|
      next if $game_temp.in_menu || $game_temp.in_battle || $game_temp.message_window_showing
      next if $game_player.move_route_forcing || pbMapInterpreterRunning?
      next if !$should_autosave
      pbAutoSave
      $should_autosave = false
    }
    So, autosave will work after battle when there is no event running or menu.

    Wow I will test this today!!!
     
    Back
    Top