Project1

标题: 请问如何设置不同职业对不同武器的熟练度 [打印本页]

作者: ccArtermices    时间: 2019-7-30 22:31
标题: 请问如何设置不同职业对不同武器的熟练度
请问如何设置不同职业对不同武器的熟练度,如A和B职业都可以装备镰刀,但是A装备之后伤害比B高
作者: 多卡多卡    时间: 2019-7-30 22:37
本帖最后由 多卡多卡 于 2019-7-30 22:51 编辑

JAVASCRIPT 代码复制
  1. var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
  2. Game_Action.prototype.executeDamage = function (target, value) {
  3. if(value>0)/*大于0时为伤害量,小于0时为治疗量*/{
  4.     if(this.subject().isActor() &&  this.subject().actorId() == 1/*A的Id*/  && this.subject()._classId == 1/*职业Id*/){
  5.         this.subject().equips().forEach(function (equip){
  6.              if (equip != null  && equip.wtypeId != undefined && equip.wtypeId == 5/*假设镰刀的类型为5*/)
  7.               value *= 1.2;/*伤害倍率*/
  8.     });
  9. }}
  10. _Game_Action_executeDamage.call(this, target, value);
  11. }

如果要实现多个加成效果,就把第二个if里的复制一下改下参数就行了。

如果说是武器熟练度插件,这里有个日站的(需要科学上网)
http://dourakusoftweb.blog.fc2.com/blog-entry-4.html
作者: j296196585    时间: 2019-7-31 00:41
本帖最后由 j296196585 于 2019-7-31 00:46 编辑
多卡多卡 发表于 2019-7-30 22:37
var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
Game_Action.prototype.execute ...
  1. javascript:;
复制代码
  1.     if(this.subject().isActor() &&  this.subject().actorId() == 1/*A的Id*/  && this.subject()._classId == 20, 21/*职业Id*/){
复制代码



== 1/*A的Id*/这是什么意思
[classId == 20, 21/*职业Id*/ 如何添加多个职业 多卡大兄弟/ size]


[/  还发现一个问题  == 20, 21/*职业Id*/  超过30 就无效了 代码如下 color]


JAVASCRIPT 代码复制
  1. var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
  2. Game_Action.prototype.executeDamage = function (target, value) {
  3. if(value>0)/*大于0时为伤害量,小于0时为治疗量*/{
  4.     if(this.subject().isActor() &&  this.subject().actorId() == 1/*A的Id*/  && this.subject()._classId == 30/*职业Id*/){
  5.         this.subject().equips().forEach(function (equip){
  6.              if (equip != null  && equip.wtypeId != undefined && equip.wtypeId == 2 /*假设镰刀的类型为5*/)
  7.  
  8.               value *= 2.5;/*伤害倍率*/
  9.     });
  10. }}
  11. _Game_Action_executeDamage.call(this, target, value);
  12. }



作者: 多卡多卡    时间: 2019-7-31 07:35
j296196585 发表于 2019-7-31 00:41
== 1/*A的Id*/这是什么意思 、
[classId == 20, 21/*职业Id*/ 如何添加多个职业 多卡大兄弟/ size]


第一个是角色的Id
如果要添加多个职业,可以这样:
  1. var list = [1,2,3];//职业Id
  2. list.contains(this.subject()._classId);
复制代码

至于大于30之后,我测试时没发现有问题,是不是和你用的某些插件冲突了?
作者: j296196585    时间: 2019-7-31 16:03
本帖最后由 j296196585 于 2019-7-31 16:05 编辑
多卡多卡 发表于 2019-7-31 07:35
第一个是角色的Id
如果要添加多个职业,可以这样:


多卡大兄弟 你看是这样吗

怎样添加 角色   我自己鼓捣半天好像没效果

]OZZ$RJY4R0U]ONQF9X65}Y.png (126.88 KB, 下载次数: 1)

]OZZ$RJY4R0U]ONQF9X65}Y.png

作者: 多卡多卡    时间: 2019-7-31 17:20
本帖最后由 多卡多卡 于 2019-7-31 17:28 编辑
j296196585 发表于 2019-7-31 16:03
多卡大兄弟 你看是这样吗

怎样添加 角色   我自己鼓捣半天好像没效果  ...



如果要添加多个角色,就把蓝色的这部分复制一下,放在第一个if的里面就行了
如果不同的人职业不同,就多定义几个list取不同名称就行了
当做成结构体的形式时要多写很多代码,所以角色不是很多时这样会简单些
作者: j296196585    时间: 2019-7-31 18:00
放在第一个if的里面就行了 【我是猪 】看不明白
如果不同的人职业不同,就多定义几个list取不同名称就行    这个更加糊涂了

3T_Q(OOY%P(0[{9)@}](8~8.png (144.13 KB, 下载次数: 3)

3T_Q(OOY%P(0[{9)@}](8~8.png

作者: 多卡多卡    时间: 2019-7-31 18:18
j296196585 发表于 2019-7-31 18:00
放在第一个if的里面就行了 【我是猪 】看不明白
如果不同的人职业不同,就多定义几个list取不同 ...

这个应该够详细了,自己对着看吧
对于一个角色能够使用哪些武器,这个不需要插件,直接角色那里调就可以了


作者: j296196585    时间: 2019-7-31 19:08
多卡多卡 发表于 2019-7-31 18:18
这个应该够详细了,自己对着看吧
对于一个角色能够使用哪些武器,这个不需要插件,直接角色那里 ...

真心谢谢了没有大佬相助 这个东东真难弄

3R9XN{~U15YW}B7M$1(DG]X.png (914.32 KB, 下载次数: 5)

3R9XN{~U15YW}B7M$1(DG]X.png

作者: ccArtermices    时间: 2019-7-31 19:44
多卡多卡 发表于 2019-7-30 22:37
var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
Game_Action.prototype.execute ...

多卡大神,我用了你的脚本,发现只要我一装备武器就报错:cannot read property 'params' of null
为此我改了代码,还是报这个错,请问为什么?
JAVASCRIPT 代码复制
  1. // Author:Doka
  2. // Modified by cc Artermices
  3. // 如果要实现多个加成效果,就把第二个if里的复制一下改下参数就行了
  4.  
  5. var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
  6. Game_Action.prototype.executeDamage = function (target, value) {
  7. if(value>0)/*大于0时为伤害量,小于0时为治疗量*/{
  8.    if(this.subject().isActor() && this.subject().actorId() > 0 ){
  9.        if(this.subject()._classId == 16/*枪手*/){
  10.                        this.subject().equips().forEach(function (equip){
  11.                        if (equip != null  && equip.wtypeId != undefined){
  12.                                switch(equip.wtypeId){
  13.                                        case 9 /*轻枪*/:
  14.                                                value *= 1.2;/*伤害倍率*/
  15.                                                break;
  16.                                        case 20 /*重枪*/
  17.                                                value *= 1.1;
  18.                                                break;
  19.                                        default:
  20.                                }
  21.                        }
  22.        });
  23.        }else if(this.subject()._classId == 17/*潜行者*/){
  24.                        this.subject().equips().forEach(function (equip){
  25.                        if (equip != null  && equip.wtypeId != undefined){
  26.                                switch(equip.wtypeId){
  27.                                        case 1 /*匕首*/:
  28.                                                value *= 1.2;
  29.                                                break;
  30.                                        case 17 /*忍刀*/
  31.                                                value *= 1.1;
  32.                                                break;
  33.                                        default:
  34.                                }
  35.                        }
  36.        });
  37.        }
  38.    }
  39. }
  40. _Game_Action_executeDamage.call(this, target, value);
  41. }

作者: 多卡多卡    时间: 2019-7-31 19:55
本帖最后由 多卡多卡 于 2019-7-31 19:59 编辑
ccArtermices 发表于 2019-7-31 19:44
多卡大神,我用了你的脚本,发现只要我一装备武器就报错:cannot read property 'params' of null
为此我 ...


16行和30行case的数字后面没有加冒号
defult的冒号后面也要加上分号代表空语句
作者: j296196585    时间: 2019-7-31 20:03
多卡多卡 发表于 2019-7-31 18:18
这个应该够详细了,自己对着看吧
对于一个角色能够使用哪些武器,这个不需要插件,直接角色那里 ...

JAVASCRIPT 代码复制
  1. //==================================================================================================================
  2. /*:
  3.  * @plugindesc 不同职业对不同武器的熟练度 。
  4.  *
  5.  * @author 多卡多卡
  6.  *
  7.  * @help
  8.  * ◆ 不同职业对不同武器的熟练度
  9.  *
  10.  
  11.  *如果要实现多个加成效果,就把第二个if里的复制一下改下参数就行了。
  12. */
  13. //==================================================================================================================
  14. var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
  15. Game_Action.prototype.executeDamage = function (target, value) {
  16.         var list1 = [21,22];//职业Id
  17.         var list2 = [1,2];               
  18.         if(value > 0) {  
  19.                if(this.subject().isActor() &&  this.subject().actorId() == 1 && list1.contains(this.subject()._classId)){//角色的Id
  20.              this.subject().equips().forEach(function (equip){
  21.                 if (equip != null  && equip.wtypeId != undefined && equip.wtypeId == 2/*假设镰刀的类型为5*/)
  22.                   value *= 2.2;/*伤害倍率*/                          
  23.          });               
  24.       }
  25.                if(this.subject().isActor() &&  this.subject().actorId() == 2 && list2.contains(this.subject()._classId)){//角色的Id
  26.              this.subject().equips().forEach(function (equip){
  27.                 if (equip != null  && equip.wtypeId != undefined && equip.wtypeId == 3/*假设镰刀的类型为5*/)
  28.                   value *= 2.2;/*伤害倍率*/                                                       
  29.                           {
  30.                     switch (equip.wtypeld){
  31.                         case 2: value =Math.ceil(value * 1.2 ); break;
  32.                         case 3: value =Math.ceil(value * 2 ); break;
  33.                      }       
  34.                    }                
  35.         });                                     
  36.       }          
  37.     }
  38. _Game_Action_executeDamage.call(this, target, value);
  39. }

作者: ccArtermices    时间: 2019-7-31 20:04
多卡多卡 发表于 2019-7-31 19:55
16行和30行case的数字后面没有加冒号
defult的冒号后面也要加上分号代表空语句 ...

改正了之后还是报错,大神这个报错代表什么意思啊?




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1