RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[MV] Geomancy 1.0.0

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Most Mature Member2011 Favourite Staff Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Geomancy
Version: 1.0.0
Author: modern algebra
Date: 31 October 2015

Version History


  • <Version 1.0.0> 2015-10-31 - Original Release

Description


Set terrain and region restrictions on skill use. If you don't want your mage to be able to use lightning skills when he is underground for instance, then you can do that with this plugin.

Features

  • Can set geographical restrictions on the use of skills
  • Can use either terrain tags or regions
  • Can define the restrictions either exclusively (only on specified terrains) or prohibitively (not on specified terrains)

Instructions

Save the .js file in your plugins folder and import it through the Plugin Manager.

To set up a skill so that it can only be used in certain terrains, you need to put one of the following codes in its notebox:

       <onlyTerrains:x>
       <prohibitedTerrains:y>
 
If you use the onlyTerrains code, then the skill can be used only on terrains with ID x. If you use the prohibitedTerrains code, then the skill can only be used if the party is not on the terrain with ID y. In both cases, x and y must be set to integers. You can set as many terrain tags as you want; just separate them with a space or a comma.

The region codes work essentially the same way.

       <onlyRegions:x>
       <prohibitedRegions:x>
 
Examples:

       <onlyRegions:1 3 4 76>
          The skill can only be used when the party is in regions 1, 3, 4, or 76

       <prohibitedRegions:5 10>
          The skill can be used in every region except regions 5 and 10
 
      <onlyTerrains:7>
          The skill can only be used on tiles marked with terrain tag 7.

Plugin


You can download the .js file from Pastebin: http://pastebin.com/15vqEPUr

Code: [Select]
//=============================================================================
//  Geomancy.js
//=============================================================================
//  Version: 1.0.0
//  Date: 31 October 2015
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/*:
 * @plugindesc Set terrain and region restrictions on skill use
 * @author Modern Algebra (rmrk.net)
 * @help To set up a skill so that it can only be used in certain terrains, you
 * need to put one of the following codes in its notebox:
 *
 * <onlyTerrains:x>
 * <prohibitedTerrains:y>
 *
 * If you use the onlyTerrains code, then the skill can be used only on terrains
 * with ID x. If you use the prohibitedTerrains code, then the skill can only be
 * used if the party is not on the terrain with ID y. In both cases, x and y
 * must be set to integers. You can set as many terrain tags as you want; just
 * separate them with a space or a comma.
 *
 * The region codes work essentially the same way.
 *
 * <onlyRegions:x>
 * <prohibitedRegions:x>
 *
 * Examples:
 *
 * <onlyRegions:1 3 4 76>
 * The skill can only be used when the party is in regions 1, 3, 4, or 76
 *
 * <prohibitedRegions:5 10>
 * The skill can be used in every region except regions 5 and 10
 *
 * <onlyTerrains:7>
 * The skill can only be used on tiles marked with terrain tag 7.
 */
//=============================================================================

(function() {

// Game_BattlerBase - meetsSkillConditions
//   Test terrain and region too
var _mag_Game_BattlerBase_meetsSkillConditions =
Game_BattlerBase.prototype.meetsSkillConditions;
Game_BattlerBase.prototype.meetsSkillConditions = function(skill) {
var skillTest = _mag_Game_BattlerBase_meetsSkillConditions.apply(this, arguments);
if (!skillTest || DataManager.isBattleTest()) { return skillTest; }
return this.magMeetsSkillTerrainConditions(skill);
};

// Game_BattlerBase - Test terrain and region conditions for skills
Game_BattlerBase.prototype.magMeetsSkillTerrainConditions = function(skill) {
var terrainTag = $gamePlayer.terrainTag();
var regionId = $gamePlayer.regionId();
var rpatt = /\d+/g
// Can't use if on an expressly prohibited terrain
var prohibitedTerrains = skill.meta.prohibitedTerrains;
if (prohibitedTerrains) {
var match = prohibitedTerrains.match(rpatt);
if (match && match.map(Number).contains(terrainTag)) { return false; }
}
// Can't use if in an expressly prohibited region
var prohibitedRegions = skill.meta.prohibitedRegions;
if (prohibitedRegions) {
var match = prohibitedRegions.match(rpatt);
if (match && match.map(Number).contains(regionId)) { return false; }
}
// Can't use if exclusive terrains defined and not on one
var onlyTerrains = skill.meta.onlyTerrains;
if (onlyTerrains) {
var match = onlyTerrains.match(rpatt);
if (match && !match.map(Number).contains(terrainTag)) { return false; }
}
// Can't use if exclusive regions defined and not in one
var onlyRegions = skill.meta.onlyRegions;
if (onlyRegions) {
var match = onlyRegions.match(rpatt);
if (match && !match.map(Number).contains(regionId)) { return false; }
}
return true; // Can use the skill otherwise
};

})();

Credit


  • modern algebra

Support


Post in this thread if you have any comments or questions. It is perfectly fine to post here even if this topic has not been posted in for a very long time.

Please do not message me privately, as any concerns you have are likely shared by others and they will benefit from our correspondence being public. Additionally, I am often absent, and posting publicly will allow other members to assist you when I am unable to do so quickly.

Terms of Use


You are welcome to use this script in any project of yours, whether it is commercial or non-commercial. There is no need to credit me, and please feel free to modify the plugin in whatever ways suit your project.

Basically, my plugin is your plugin, but please do not re-post this plugin or any modified version of it on another forum or website.

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
I love you thank you.
&&&&&&&&&&&&&&&&

*
RMRK's dad-in-training
Rep:
Level 72
Busy Husband, Dad, and Youth Minister
GIAW 14: 2nd Place (Easy Mode)2014 Best WriterBronze - GIAW 11 (Normal)Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.2012 Best NewbieContestant - GIAW 9
I will add a character in my game just to use this.

*
The Hero of Rhyme
Rep:
Level 83
( ͡° ͜ʖ ͡°)
Project of the Year 20142014 Best RPG Maker User - Story2014 Queen of RMRK2011 Best Newbie2014 Kindest Member2014 Best RPG Maker User - Creativity2013 Queen of RMRKBronze SS AuthorBronze Writing ReviewerSecret Santa 2013 ParticipantFor taking arms in the name of your breakfast.GOOD!For frequently finding and reporting spam and spam bots2012 Best RPG Maker User (Creativity)2012 Best Yuyubabe Smiley;o
Breaking news:

Modern algebra continues to be amazing. 99% chance of love showers.

:ma:
Spoiler for My Games and Art:
ℒℴѵℯ❤


My Artwork Thread

The Lhuvia Tales [Current]

Ambassador [Complete]

The Postman [Complete]

The Wyvern [Complete]

Phoenix Wright: Haunted Turnabout [Complete]

Major Arcana [Cancelled]