设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 162|回复: 0

[转载发布] Flare Collection - Laws For Map

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9072

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58885
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68851

    灌水之王

    发表于 2026-7-27 07:31:23 | 显示全部楼层 |阅读模式
    Flare Collections - Laws for Map vs2.0
    Created by DarknessFalls. All Credit must be given to me. Free for commercial use.

     

    Download: Get me

    The script must be named: Flare-LawsForMap.js



    ATTN!

    All code is written in ES6, including classes, static classes and so on. Do not edit the script it's self. You can view the source code here and learn how to build the script for your self here

     

    ScreenShots:

    Spoiler

     













     Welcome to Laws for Map.

    The script allows you to set up a set of laws for a map, these laws are then checked when a player does an action that targets either it's self, another actor or even an enemy. If you say no potions and I use a potion, you bet ill be punished in some way.

    Laws for Map comes with lots of things right out of the bag, lets get into it.

    Setting up laws

    you can have any number of laws on a map, we will only show you three of those laws at any one time. When the player starts up the map either from a new and saved game we will randomize those laws and show a new set of three. The same goes for when a player transfers to a different map and back again.

    Laws are comprised of a couple of things, a short name, a icon, a punishment and a cantUse which is allowed to hold three things in it (any more and I slice them off).

    So lets set up a law:

    <law  name:"Attacking Causes Death"  punishment:"hp"  amount: 1000  icon: 26  cantUse: "attack, potion, heal"  description: "I am mandatory and will blow up if I am missing.">

    • name: The name of the law.
    • punishment: The thing to punish on the actor object. (see below)
    • amount: How much do we do when we punish the user?
    • icon: What icon is representing the law?
    • cantUse: What can we not use? (see below)
    • description: Mandatory, used in the law description window.


    ATTN!

    The parser I use will read the tag as is, if you copy and paste it into the map detail window. Also note that codes like \c[9]...\c[0] must be written as \\c[9]..\\c[0] failure to do so could cause errors.

    Duplicate cantUse

    Consider the following example:

    <law  name:"Attacking Causes Death"  punishment:"hp"  amount: 1000  icon: 26  cantUse: "attack, potion, heal"  description: "I am mandatory and will blow up if I am missing."><law  name:"Minor Health Loss"  punishment:"hp"  amount: 10  icon: 26  cantUse: "attack, potion, heal"  description: "I am mandatory and will blow up if I am missing.">The issue here is that when we process which law you broke, we take the first one we find in the array of laws for the map is the first one we take. In this case Minor Health Loss would never get used because we found Attacking causes death first.

    ​Description must be included in laws

    Because it doesn't make sense to show you law details and have the whole description area empty, I have made this a crashing error. You must include a description with laws.

    Your "can't use" has to be unique like the name of the law.

    Punishment

    punishments are things we do to the player, we take away things like hp, mp, tp or xp. We can even take away gold.

    We cannot take a away items, weapons or armor (equipped or not).

    When we take away xp, we can level down the actor.

    ATTN!

    Laws can kill. if you reduce the hp below 0 or to 0 on a map or in battle it can kill the player.

    If you are on a map and you kill the whole party, the last law window will tell You that every one is dead and its game over before actually going to the game over.

    We tell you before we punish you, battles.

    In battles when you do an action and the law is broken, if that law would kill You we will tell you before we actually punish you.

    We Punish before we tell you, map.

    If you are on the map and you use a potion and we have stated no you cannot use potions, then we will show you the law window and THEN punish you.

    The following are acceptable punishments: hp, mp, tp, xp, gold.

    No you cannot have multiple punishments.

    cantUse

    Cant use stipulates what a actor can and cannot use. Because laws are not party wide and affect only the actor breaking it the cantUse only applies to that specific actor at the time that they use an action.


    • You can state, for battles: Attack, Item Name, Skill Name, Special Name
    • For maps you can do: Item Name, Skill Name, Special Name
    You can only have three cantUse per law.

    For example: attack, potion, spark

    When a player uses attack in battle or spark in battle they have broken a law. When a player uses potion either in or out of battle that player has broken a law.

    The same goes for out of battle. If a player uses a potion out of battle they will be punished.

    Regarding Breaking Laws in Battle.

    In a battle its the sole act of doing an action thats against the law that breaks the law. For example if the law states you cannot attack and you attack, but it misses, you still broke the law and will be punished according to that law.

    Regarding Yanfly Scripts.

    For Yanfly battle and Yanfly Menu Manager, you don't have to do anything at all.

    This script also works with Yanfly Aftermath, you just have to place laws in the list of reward windows:

    exp custom drops laws

    Reward for not breaking a law

    You can set this up with a tag in the map notes:

    <lawReward i: 5 w:5 a:8 gold:78 xp:90>

    This will reward the player it an item of id 5, weapon of id 5 and armor id of 8. The party will also gain 78 gold and the whole party will gain 90 xp.

    You can also do:

    <lawReward i: "5,6,7" w:"5~89" a:8 gold:"1~78" xp:90>

    This reads as, gain item id of 5,6 and 7. Gain a random weapon between if 5 and 89. Gain armor with id of 8. Gain random gold between 1 and 78 and finally the whole party gains 90 xp.

    Calculate Before or After Battle?

    If you set this plugin option as before then you will see:



    You can scroll through the laws that associated with this map and hit enter to scroll through the list of rewards.

    All of these rewards will be the same for every single battle.

    If you want to have the rewards calculated after every single battle and you are using concepts of: "1 ~ 6" which is how we calculate random rewards.

    Then you'll see:



    Which indicates that there is no reward information to be shown because that information is calculated after every battle.

    Bonus:

    You can do the following:

    i: 1 // item id 1i: "1 ~ 67" // random item between 1 and 67i: "1,2,4" // Give items 1,2 and 4// The above works on weapons and armor, you can use random generator on gold and xp.Public API

    For developers, you get some public api. Non developers might find this useful.

    You have access to the FlareLawsForMap static class which has the following functions on it:


    • getLawsForMap() Gets all the laws for the current map, returns an array of 3 objects.
    Example:

                    Code:       
    1. FlareLawsForMap.getLawsForMap() // Returns and array: [Object, Object, Object]
    复制代码




    本贴来自国际rpgmaker官方论坛作者:DarknessFalls处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/flare-collection-laws-for-map.50909/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-22 07:51 , Processed in 0.137365 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表