Turning Scripts on/off

● ARCHIVED · READ-ONLY
Started by Chaos Avian 13 posts View original ↗
  1. I was wondering if it was possible to turn off and on different scripts at several points during mid-game. Whether it being via eventing or script.

    Thanks in advance~
  2. You can turn an event off by adding an additional event page with a condition on the self switch. Then when you want it turned off simply switch it's self switch.

    Here is a stripped down version of what I use to switch events on/off permanently using their self-switches.

    #=========================================================================== # self_switch can be: 'A', 'B', 'C' or 'D' # example call: self_switch(1,true,'A') # example call: self_switch(5,1,true,'A') # sets the self switch 'A' for event with id 1 on map with id 5 to true #=========================================================================== def self.self_switch(map_id=$game_map.map_id, ev_id, value, self_switch) $game_self_switches[[map_id, ev_id, self_switch]] = value $game_map.need_refresh = true end or to erase it:

    Code:
      $game_map.events[ev_id].erase
  3. @Napoleon: I believe the OP was asking about scripts, not events.

    As for the question from the OP-

    I'm not a scripter, so it's not guaranteed. It's probably better if someone confirms it.. But here's my understanding on the matter-

    If it's built into the script then yes, it's usually set so a switch or something like that.

    Otherwise it would require a lot of rewriting of the script because ruby scripts are generally modular.
  4. It works if he calls those scripts via events. Victors lights for example are parallel processes and can be disabled by turning the event off or by erasing it.

    If not then obviously it's not possible without modifying/replacing/layering the scripts.
  5. Why would you want to do that, if I may ask?
  6. What I had for an idea is to switch from side view by turning off Victor's Actor and Animated Battle script off for a dungeon and then switch it back.
  7. You would need to have both scripts in your game, and use a switch or variable to condition which one is in use. Then during the game just change the switch or variable.


    This might be a little difficult with systems that are designed to replace default systems (like battles), since they're written to replace, not work side by side with, the original. It means you would have to do a little rewriting of the script itself to tell it to call one or the other.
  8. I see, does Yanfly's Battle System replace the original BS because I have that working alongside Victor's Battle system.
  9. Yeah, I'm thinking about a remotely convenient way to do that, but that'd be pretty hard. Victor's script is huge; it not only deals with battler animations but also meddles seriously with mechanics via the action sequences so you'd need to only disable the visual parts and that's some precise editing there. There's also the fact it runs on a Core script and just ugh, headaches.

    Edit: oops ninja'd. Yanfly battle engine is lighter than Victor's and adds on the default system more than it replaces it.
  10. (I dunno if this is consider hi jacking or not so sorry before hand)

    @ Kread-Ex: So if we wanted to disable a more simpler script. Lets say Mog's battle cry (the script where the actors say stuff when their turn starts) Can this be easily be done? 
  11. It's probably hijacking. But if they solve this problem in a fast and generic manner then that programmer has my respect. What the OP asks for is something I tried to do too when I bought ace earlier this year. I found no fast & generic solution to the matter.

    You can disable that one really easy by adding a conditional on this method:

    Code:
      #--------------------------------------------------------------------------  # ● Play Battle Cry  #--------------------------------------------------------------------------        def play_battle_cry(voice_list)      return unless $game_switches[<your switch here>] # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<      return if voice_list == nil      voice_id = voice_list[rand(voice_list.size)]      Audio.se_play("Audio/SE/" + voice_id.to_s,VOLUME,100) rescue nil        end
  12. When I was implementing multiple battle system support awhile ago, I overwrote every reference to Scene_Battle and BattleManager to an interface that decided which battle system to use, and consequently which battle-related classes to create (scenes, windows, etc). Fortunately, there weren't THAT many, so it was a pretty simple change.

    Of course, this wasn't a complete solution because there are still things like battlers and units where different attributes mean different things under different systems, but I think in general HP serves the same purpose no matter what kind of battle system you're using.

    For the animated battle system, we could implement that as

    class Scene_NormalBattle < Scene_BattleBaseendclass Scene_AnimatedBattle < Scene_BattleBaseendAnd then have the appropriate logic for each battle system.

    Even if a battler stores information about what kind of images to use, the battle system doesn't have to use them, so it's fine.

    My implementation of multiple battle systems provided a custom BattleManagerBase class that all custom Battle Managers inherit from, where are then instantiated by the main BattleManager interface module to handle the rest of the battle.

    Large scripts where a simple condition check is just unfeasible to determine whether they should be run or not can be subclassed and managed using some factory pattern.
  13. I'm having the same problem. I'd love to create an options menu where you could turn some features off if you wanted. For instance, I have Jet's Mouse Script in my game, but maybe a player doesn't want to use it. Being able to turn off a script at will would be awesome.

    If anyone knows how to do this, it would be greatly appreciated.

    Sindaine