Welcome to PGMZ! My goal is to make it easy for everyone to find and share great plugins for creating amazing games. As a plugin developer myself, I'm excited to grow this community with all of you.
NUUN Preemptive Surprise Ex - NUUN_PreemptiveSurpriseEx.js
Plugin desc : Preemptive,Surprise EX
License : MIT License
Author : NUUN
Website : https://github.com/nuun888/MZ/blob/master/NUUN_PreemptiveSurpriseEx.js
Download Page : https://raw.githubusercontent.com/nuun888/MZ/master/NUUN_PreemptiveSurpriseEx.js
File name : NUUN_PreemptiveSurpriseEx.js
Help of plugin :
* @target MZ
* @plugindesc Preemptive,Surprise EX
* @author NUUN
* @version 1.3.0
* @base NUUN_Base
*
* @help
* You can define your own formula for preemptive surprise.
* You can also apply surprise attack in event encounters.
*
* Enter "Comment" on the first page of the enemy group's battle event.
* <Presur:[id]or[name]>
* [id]:Preemptive Surprise List ID
* [name]:Designated Names for the Preemptive Surprise List
*
* Acquisition variable of evaluation expression
* members:party member
* troop:enemy group
* this:BattleManager
*
* Get variable
* $gameParty.preemptiveCounter:Number of preemptive strikes.
* $gameParty.surpriseCounter:Number of times you've been caught off guard.
*
* In the case of random encounters, enemy groups without the above tags will be determined by default settings.
* Event determination is normal processing.
*
* PreemptiveSE,SurpriseSE
* During normal battle, preemptive attack, surprise attack, you can play the SE at the start of any battle.
* If the surprise attack start SE file is not set during the preemptive surprise attack setting, the surprise attack start SE SE will be played during the default preemptive attack.
* In addition, during the default preemptive attack, if the file name is not specified even in the surprise battle start SE, the normal battle start SE will be played.
*
* plugin command
* EventPresurMode
* Enable preemptive surprise attack if a battle is spawned from an event.
* Please specify the ID of "PreemptiveSurpriseSetting".
* The tag settings you fill in for each enemy group will take precedence.
* It will be initialized after the preemptive surprise attack process.
*
* Terms of Use
* This plugin is distributed under the MIT license.
*
* Log
* 7/4/2023 Ver.1.3.0
* Added a function that allows you to immediately execute a specified common event when encountering.
* 1/29/2023 Ver.1.2.0
* Added a function to enable preemptive surprise attack from an event with a plug-in command.
* 12/2/2022 Ver.1.1.1
* Fixed an issue where some of the default evaluators for normal encounters were not fetchable.
* Added a function that allows you to set the battle start SE for normal, preemptive attack, and surprise attacks.
* Processing fixes.
* 11/28/2022 Ver.1.1.0
* Added a function that allows arbitrary scripts to be executed during normal encounters, preemptive attacks, and surprise attacks.
* Added a switch that can always execute preemptive and surprise attacks.
* Added a switch to enable preemptive and surprise attacks for events.
* Added a function that allows you to obtain the number of preemptive strikes and the number of surprise attacks.
* 7/31/2022 Ver.1.0.0
* First edition.
*
* @command EventPresurMode
* @desc Enables first strike in combat from the event.
* @text Event preemptive surprise enabled
*
* @arg SurpriseId
* @text Preemptive surprise setting ID
* @desc Specifies the list ID of the preemptive surprise setting.
* @type number
* @default 0
*
*
* @param PreemptiveSurpriseSetting
* @text Preemptive Surprise Setting
* @desc Preemptive Surprise Setting.
* @type struct<PreemptiveSurpriseList>[]
* @default ["{¥"Name¥":¥"'default'¥",¥"RandomPreemptiveSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'Math.random() < this.ratePreemptive();//Default'¥¥¥"}¥",¥"EventPreemptiveSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"¥¥¥"}¥",¥"RandomSurpriseSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'Math.random() < this.rateSurprise() && !preemptive;//Default'¥¥¥"}¥",¥"EventSurpriseSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"¥¥¥"}¥"}","{¥"Name¥":¥"'eventpresur'¥",¥"RandomPreemptiveSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'Math.random() < this.ratePreemptive();//Default'¥¥¥"}¥",¥"EventPreemptiveSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'Math.random() < this.ratePreemptive();//Default'¥¥¥"}¥",¥"RandomSurpriseSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'Math.random() < this.rateSurprise() && !preemptive;//Default'¥¥¥"}¥",¥"EventSurpriseSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'Math.random() < this.rateSurprise() && !preemptive;//Default'¥¥¥"}¥"}","{¥"Name¥":¥"direction¥",¥"RandomPreemptiveSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"¥¥¥"}¥",¥"EventPreemptiveSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'this.getEventBackDirection();//Event direction contact judgment. Required NUUN_EventPlayerDirection'¥¥¥"}¥",¥"RandomSurpriseSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"¥¥¥"}¥",¥"EventSurpriseSetting¥":¥"{¥¥¥"EvalData¥¥¥":¥¥¥"'this.getPlayerBackDirection() && !preemptive;//Event direction contact judgment. Required NUUN_EventPlayerDirection'¥¥¥"}¥"}"]
*
* @param DefaultPreemptive
* @text Default preemptive condition
* @desc Enter the default preemptive condition for random encounters. A blank will not trigger a preemptive attack.
* @type combo
* @option 'Math.random() < this.ratePreemptive();//Default'
* @option '$gameSwitches.value(0);//switch'
* @default 'Math.random() < this.ratePreemptive();'
*
* @param DefaultSurprise
* @text Default surprise condition
* @desc Enter the default surprise condition for random encounters. A blank does not cause a surprise attack.
* @type combo
* @option 'Math.random() < this.rateSurprise() && !preemptive;//Default'
* @option 'Math.random() < this.rateSurprise();//No surprise attack disabled'
* @option '$gameSwitches.value(0);//switch'
* @default 'Math.random() < this.rateSurprise() && !preemptive;'
*
* @param PreemptiveSE
* @text Default preemptive attack battle start SE
* @desc Battle start SE at the time of default preemptive attack.
* @type struct<BattleStartSe>
* @default {"name":"","volume":"90","pitch":"100","pan":"0"}
*
* @param SurpriseSE
* @text Default surprise attack battle start SE
* @desc Battle start SE when receiving a default surprise attack.
* @type struct<BattleStartSe>
* @default {"name":"","volume":"90","pitch":"100","pan":"0"}
*
* @param EventPreSurSwitch
* @text Event Preemptive Surprise Apply Switch
* @desc Switch id to apply preemptive surprise from event command.
* @type switch
* @default 0
*
* @param PreemptiveSwitch
* @text Preemptive switch
* @desc A switch ID that always preemptively attacks.
* @type switch
* @default 0
*
* @param SurpriseSwitch
* @text Surprise switch
* @desc A switch ID that is always subject to surprise attacks.
* @type switch
* @default 0
*
* @param DefaultPresurSprict
* @text Normal encounter script
* @desc A script to run during normal encounters. (multiple can be specified)
* @type combo[]
* @option 'EncounterEffect.setType(1);//MPP_EncounterEffect Type change'
* @option 'EncounterEffect.setColor(255,255,255);//MPP_EncounterEffect Color change'
* @default []
*
* @param PreemptivePresurSprict
* @text Preemptive script
* @desc Script to run during preemptive strike. (multiple can be specified)
* @type combo[]
* @option 'EncounterEffect.setType(1);//MPP_EncounterEffect Type change'
* @option 'EncounterEffect.setColor(255,255,255);//MPP_EncounterEffect Color change'
* @option '$gameTemp.reserveCommonEvent(0);//Common event'
* @default []
*
* @param SurprisePresurSprict
* @text Surprise script
* @desc A script to run when a surprise attack occurs. (multiple can be specified)
* @type combo[]
* @option 'EncounterEffect.setType(1);//MPP_EncounterEffect Type change'
* @option 'EncounterEffect.setColor(255,255,255);//MPP_EncounterEffect Color change'
* @option '$gameTemp.reserveCommonEvent(0);//Common event'
* @default []
*
* @param DefaultPresurCommonEvent
* @desc A common event that runs on normal encounters.
* @text Normal encounter execution common event
* @type common_event
* @default 0
*
* @param PreemptiveCommonEvent
* @desc A common event that executes on a First Strike encounter.
* @text Execute Common Event on First Strike Encounter
* @type common_event
* @default 0
*
* @param SurpriseCommonEvent
* @desc A common event that executes when you encounter a surprise attack.
* @text Execute common event when surprise encounter
* @type common_event
* @default 0
*