Bing?
BING? You're using Bing and you're surprised to get irrelevant results?
Well duh!! Why are you using Bing? You've been deceived by their mediocre marketeers! Go hang your head in shame!!
SHAAAAAAME!!
No, I'm not being paid by Google to rag on their would-be competitor, and Yes, there is a way to ensure the party gets the first strike when certain conditions are met.
The method you would use to do it is rate_preemptive in Game_Party.
#-------------------------------------------------------------------------- # * Calculate Probability of Preemptive Attack #-------------------------------------------------------------------------- def rate_preemptive(troop_agi) (agi >= troop_agi ? 0.05 : 0.03) * (raise_preemptive? ? 4 : 1) endLet's say you want the rate to be 100% when Switch 12 is ON. Here's how you would rewrite (or alias) that method:
#-------------------------------------------------------------------------- # * Calculate Probability of Preemptive Attack #-------------------------------------------------------------------------- def rate_preemptive(troop_agi) if $game_switches[12] == true chance = 1.00 else chance = ((agi >= troop_agi ? 0.05 : 0.03) * (raise_preemptive? ? 4 : 1)) end return chance endThere are more concise ways to write that, but what I rewrote it as above is what I feel is the cleanest, clearest way. This will give your party a 100% chance to First-Strike when Switch 12 is set to ON, and use the standard "compare party's AGI to troop's AGI and use the RNG to determine whether it's a First-Strike" logic if it's set to OFF.
EDIT: I forgot to include one more change that will be necessary to make this work for Event-based encounters, since the preemptive/surprise logic is
only visited for Random Encounters by default. It seems like rewriting the Battle Processing method in
Game_Interpreter will fix this issue and allow Preemptives/Surprises logic (including that which I gave you above) to activate in Event Encounters. Simply add the line
BattleManager.on_encounter, as I did here. Thanks for reporting this bug!
#-------------------------------------------------------------------------- # * Battle Processing #-------------------------------------------------------------------------- def command_301 return if $game_party.in_battle if @params[0] == 0 # Direct designation troop_id = @params[1] elsif @params[0] == 1 # Designation with variables troop_id = $game_variables[@params[1]] else # Map-designated troop troop_id = $game_player.make_encounter_troop_id end if $data_troops[troop_id] BattleManager.setup(troop_id, @params[2], @params[3]) BattleManager.on_encounter BattleManager.event_proc = Proc.new {|n| @branch[@indent] = n } $game_player.make_encounter_count SceneManager.call(Scene_Battle) end Fiber.yield endNow, from the rest of your description, I take it you want to set the switch ON (or OFF) based on whether you're able to sneak up behind the enemy to initiate combat? You can do that with just eventing. There are several different ways to do it, but here's how I would go about it: you can set variables to equal player's current Map X and Map Y, as well as the "wandering enemy" event's Map X and Map Y (use "this event" to make it easy to copy the same wandering enemy event all over the map). Then, create conditional branches based on which way the characters are facing. So, for example, if the player is facing LEFT and the enemy is NOT facing RIGHT, and the player's Map X is greater than the enemy's Map X, you know that the player approached the enemy from its right side and snuck up on it. You should set Switch 12 (or whatever switch you're using to track whether there should be a 100% First-Strike Rate) ON. Once you've gone through all the ways that a player could have possibly gotten initiative, run the Battle processing as normal, and then remember to set Switch 12 back OFF after the battle is over, before the event processing ends.
One more edit: Right below rate_preemptive in Game_Party is rate_surprise and you can use similar logic to give the enemy a 100% chance to First-Strike you, if you'd like. Note that preemptive takes precendence over surprise, so if you've somehow set it so that both parties would get a first strike, the player's party (preemptive) wins out and the surprise by the enemies is ignored.