Rename www to www.rus
This commit is contained in:
parent
8ea7a858d0
commit
7bf44fa645
1878 changed files with 395385 additions and 395385 deletions
33
www.rus/js/plugins/RegionRandomize.js
Normal file
33
www.rus/js/plugins/RegionRandomize.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
//=============================================================================
|
||||
// Region Randomize
|
||||
//=============================================================================
|
||||
/*:
|
||||
* @plugindesc
|
||||
* Places an event on specificied region randomly.
|
||||
*
|
||||
*
|
||||
* Script Call:
|
||||
* $gameMap.randomPos(eventId, regionId);
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
Game_Map.prototype.randomPos = function(eventId, regionId) {
|
||||
var coords = [];
|
||||
|
||||
for (var x = 0; x < $dataMap.width; x++) {
|
||||
for (var y = 0; y < $dataMap.height; y++) {
|
||||
var region = this.regionId(x, y);
|
||||
if (region == regionId) {
|
||||
coords.push([x, y]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (coords.length === 0) return;
|
||||
var idx = Math.randomInt(coords.length);
|
||||
var randomCoord = coords[idx];
|
||||
|
||||
var event = this._events[eventId];
|
||||
event.setPosition(randomCoord[0], randomCoord[1]);
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue