wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
659
Reaction score
187
First Language
English
Primarily Uses
RMMZ
Right now, when you have a Skill set to 1 Random Enemy with a Repeat of more than 1, the Skill selects the Random Enemy, then executes all Repeats on that one enemy.

I want a notetag on skills that allow it to select a new Random Enemy for each Repeat the skill has.

Ex:

There are 5 enemies.

You use the skill 5-Hit (Has scope of 1 Random Enemy, 5 Repeat). It Hits 1 random enemy once, selects a new random enemy and hits it, ect. Until 5 hits have hit any 5 random enemies.
 

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
659
Reaction score
187
First Language
English
Primarily Uses
RMMZ

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
167
Reaction score
120
First Language
RGSS3
Primarily Uses
Hey ♫

This took less than an hour, so its free for use in all non-commercial projects. Just save it in the plugins folder under the name NonRepeatRandom.js.

Code:
/*=======================================NonRepeatRandom.js======================================= /*: * @plugindesc Non Repeating Random * @author Kaimonkey * @param True for all skills? * @desc Setting to true will mean that this plugin affects skills without the <norepeat> tag * @default false * * @help  * ============================================================================ * Terms and Conditions * ============================================================================  * The plug in may only be used for NONCOMMERCIAL projects. If you wish to * use this plug in in a commercial product, please contact Kaimonkey for a  * licience * * While reasonable effort will be made to fix any faults in the product, the  * product comes "as is", and Kaimonkey is under no legal obligation to do so.    * ============================================================================ * Intro * ============================================================================ * This script means that any skill with the repeat property, the scope of "one * random enemy", and the <norepeat> tag will never target the same enemy twice.  * If not enough targets are avaiable the skill will target each enemy once.  *  */(function() { //Start Plugin    var parameters = PluginManager.parameters('NonRepeatRandom');    var all_skills = String(parameters["True for all skills?"]) !== "false";    var _km_action_numTargets = Game_Action.prototype.numTargets;	Game_Action.prototype.numTargets = function() {		if(this.is_non_repeat()){			return this.item().repeats;		}	    return _km_action_numTargets.call(this);	};		Game_Action.prototype.is_non_repeat = function(){		return this.item().scope == 3 && (all_skills || this.item().note.includes("<norepeat>"));	};	var _km_action_numRepeats = Game_Action.prototype.numRepeats;	Game_Action.prototype.numRepeats = function() {	    if(this.is_non_repeat()){	    	return 1;	    }	    return _km_action_numRepeats.call(this);	};	var _km_action_targetsForOpponents = Game_Action.prototype.targetsForOpponents;	Game_Action.prototype.targetsForOpponents = function() {		if(this.is_non_repeat()){	   		var members = shuffle(this.opponentsUnit().aliveMembers().clone());	   		var targets = [];	        for (var i = 0; i < this.numTargets(); i++) {	            if(members.length!=0)	           		targets.push(members.pop());	           	else	           		return targets;	        }	        return targets;		}	    return _km_action_targetsForOpponents.call(this);	};	function shuffle(o){	    for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);	    return o;	}})(); //Close Plugin
 
Last edited by a moderator:

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
659
Reaction score
187
First Language
English
Primarily Uses
RMMZ
Thanks for replying!

I can't get it to work with other plugins I have, so I am trying to see what plugin(s) are causing issues.

However, you have one major issue that make me not able to use your script. You have the script to "will never target the same enemy twice". I do not want this. I want each repeat to just select 1 enemy at random to attack, not attack each enemy only a max of once each...

EDIT:

It seems as if your plugin is not compatible with the Yanfly Battle Core... 
 
Last edited by a moderator:

Kai Monkey

Veteran
Veteran
Joined
Apr 3, 2012
Messages
167
Reaction score
120
First Language
RGSS3
Primarily Uses
Hey ♫
 
Oh, well, haha! I completely assumed that was what you wanted- my bad!
 
Well, here is the modified version of the script (Which would have taken much less time to produce! Damn my presumptuousness!)
 
This one is called RepeatRandom.js

/*=======================================RepeatRandom.js=======================================  /*: * @plugindesc Repeating Random * @author Kaimonkey  * @param True for all skills? * @desc Setting to true will mean that this plugin affects skills without the * <repeatrandom> tag * @default false * * @help  * ============================================================================ * Terms and Conditions * ============================================================================  * The plug in may only be used for NONCOMMERCIAL projects. If you wish to * use this plug in in a commercial product, please contact Kaimonkey for a  * licience * * While reasonable effort will be made to fix any faults in the product, the  * product comes "as is", and Kaimonkey is under no legal obligation to do so.    * ============================================================================ * Intro * ============================================================================ * This script means that any skill with the repeat property, the scope of "one * random enemy", and the <repeatrandom> tag will repeat against different  * targets  *  */ (function() { //Start Plugin    var parameters = PluginManager.parameters('RepeatRandom');     var all_skills = String(parameters["True for all skills?"]) !== "false";     var _km_action_numTargets = Game_Action.prototype.numTargets;Game_Action.prototype.numTargets = function() {if(this.is_non_repeat()){return this.item().repeats;}   return _km_action_numTargets.call(this);}; Game_Action.prototype.is_non_repeat = function(){return this.item().scope == 3 && (all_skills || this.item().note.includes("<repeatrandom>"));}; var _km_action_numRepeats = Game_Action.prototype.numRepeats;Game_Action.prototype.numRepeats = function() {   if(this.is_non_repeat()){    return 1;   }   return _km_action_numRepeats.call(this);};  })(); //Close Plugin
 
As for the compatibility issue it is vital when making script/plug in requests to list links to other scripts which you are using, especially those which interact with the same components. (So in this case, combat and skills)
The code was designed for comparability (No methods are overridden, only added to) so you must have some kind of combat system script which simply never make references to the parts of the core code which I changed.

Post a link to the scripts you are using and I will see what I can do

/Kai
 
Last edited by a moderator:

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
659
Reaction score
187
First Language
English
Primarily Uses
RMMZ
Have you happened to look into making it compatible with these two plugins yet?
 

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
659
Reaction score
187
First Language
English
Primarily Uses
RMMZ

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
659
Reaction score
187
First Language
English
Primarily Uses
RMMZ

wrigty12

Just a QAer playing with Javascript
Veteran
Joined
Jan 11, 2014
Messages
659
Reaction score
187
First Language
English
Primarily Uses
RMMZ

Latest Threads

Latest Posts

Latest Profile Posts

I'm back from an 11 year hiatus. Lol
I sometime envy the people that haven't played Skyrim yet. I feel like I could trade the whole world to be able to make my first pilgrimage to High Hrothgar all over again
Come join us while we play Pocket Mirror by Astral Shift! :LZSjoy: Starting at 2PM ET today!
Tried changing profile icon but...It just felt weird, you know? Who would even want to talk to me if I didn't have this fat yellow rodent thing....Or whatever it is as a mascot....No one, that's who! I am nothing without it. NOTHING!!..
I am having such a good hair day but because it's thunderstorms all day I don't go out and as such nobody will see my hair >.< It's not often my hair cooperates!

Forum statistics

Threads
112,344
Messages
1,067,574
Members
145,981
Latest member
GanMvV
Top