查看: 6005|回复: 5

[交流讨论] RMMV的任务插件发布前研讨会~

[复制链接]
梦石
0
星屑
1033
在线时间
145 小时
注册时间
2013-10-16
回帖
254
发表于 2015-11-13 21:47:59 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

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

×
本帖最后由 rpg-sheep 于 2015-11-14 22:01 编辑

RT,RMMV任务系统即将发布了~想和大家讨论讨论效果需不需要改进之类的~{:2_282:}
感谢诸位提出的建议,部分问题已经被修复了,现在还有一个存档保存的问题,貌似RMMV的存档保存机制和VA不一样……有没有大神能够指导一下~
上图:
搜狗截图20151114213145.png
任务会以类似《天谕》任务界面那样,分主任务、介绍、任务要点(可以理解为子任务)、完成度四部分显示。
已经完成的要点会变成灰色。
这个窗口不影响点击地图。
任务要点可以监测某个变量,或是指定进度双重判定方法。
任务可以被染色~
地图上的窗口只显示未完成任务,菜单中的窗口还没做呢。
使用方法如下:
* @help 在脚本中输入以下内容来操作任务系统:
* ======================================================================
* 新增任务:
* $gameParty.addmission(id,name,description,childs,reward,autocomplete);
* id(string):可以任意填写,是你识别任务的唯一参数,注意最好不要重复。
* name(string):可以任意填写,是显示的任务名称。
* description(string):可以任意填写,是显示的任务介绍。
* childs(array):任务要点列表,以[child,child,...]的格式填写,在下一条目有介绍。
* reward(array):完成奖励,以[['EXP',数量],['MONEY',数量],[物品ID,数量],...]的格式填写。
* autocomplete(boolean):是否自动完成任务,自动完成的意思就是达成条件后无需NPC触发。
* ======================================================================
* 为某个任务新增要点:
* $gameParty.addmissionchild(id,child);
* id(string):任务ID。
* child(array):要点,以[id,name,maxnumber,readnumber,autocomplete,completed]的格式填写。
*     id(string):可以任意填写,是你识别要点的唯一参数,同一任务中注意最好不要重复。
*     name(string):可以任意填写,是显示的要点名称。
*     maxnumber(int):大于0!达到这个数本要点将会被判定为达成。
*     readnumber(int/变量指针):
*         如果填int:需要你手动改变,可以做类似“摘三朵花”之类的任务。
*         如果填变量指针:会自动监测那个变量,可以做类似“生命达到1000”之类的任务。
*     autocomplete(boolean):是否自动完成本条件,自动完成的意思就是达成要点后无需NPC触发。
*     completed(boolean):初始状态是否完成,一般填false。
* ======================================================================
* 为某个任务的某个要点中的readnumber+1:
* $gameParty.upratemissionchild(id,childid);
* id(string):任务ID。
* childid(string):要点ID。
* ======================================================================
* 指定某个任务的某个要点中的readnumber:
* $gameParty.setratemissionchild(id,childid,num);、
* id(string):任务ID。
* childid(string):要点ID。
* num(int):值。
* ======================================================================
* 强制完成任务要点:
* $gameParty.completemissionchild(id,childid);
* id(string):任务ID。
* childid(string):要点ID。
* ======================================================================
* 手动完成任务要点:
* $gameParty.donemissionchild(id,childid);
* id(string):任务ID。
* childid(string):要点ID。
* 这条与上面那个不一样之处在于:
*     1、这个方法会检测是否满足达成要点的条件,并返回一个布尔值。
*     2、如果不满足条件,还是不会完成。
* 所以这个方法我的建议是放在条件分歧的脚本一栏里。
* ======================================================================
* 强制完成任务:
* $gameParty.completemission(id);
* id(string):任务ID。
* ======================================================================
* 手动完成任务:
* $gameParty.donemission(id);
* id(string):任务ID。
* 与上一条的差别同前。
* ======================================================================
请注意!以下代码仅供学习与参考,还没有做完,只能使用一部分的功能……

  1. /*:
  2. * @plugindesc 为RPG Maker MV新增任务系统。
  3. * @author 小优【66RPG:rpg-sheep】【百度贴吧:优加星爱兔子】
  4. *
  5. * @param Default Volume
  6. * @desc This will be the volume of the BGM played.
  7. * @default 90
  8. *
  9. * @help 在脚本中输入以下内容来操作任务系统:
  10. * ======================================================================
  11. * 新增任务:
  12. * $gameParty.addmission(id,name,description,childs,reward,autocomplete);
  13. * id(string):可以任意填写,是你识别任务的唯一参数,注意最好不要重复。
  14. * name(string):可以任意填写,是显示的任务名称。
  15. * description(string):可以任意填写,是显示的任务介绍。
  16. * childs(array):任务要点列表,以[child,child,...]的格式填写,在下一条目有介绍。
  17. * reward(array):完成奖励,以[['EXP',数量],['MONEY',数量],[物品ID,数量],...]的格式填写。
  18. * autocomplete(boolean):是否自动完成任务,自动完成的意思就是达成条件后无需NPC触发。
  19. * ======================================================================
  20. * 为某个任务新增要点:
  21. * $gameParty.addmissionchild(id,child);
  22. * id(string):任务ID。
  23. * child(array):要点,以[id,name,maxnumber,readnumber,autocomplete,completed]的格式填写。
  24. *     id(string):可以任意填写,是你识别要点的唯一参数,同一任务中注意最好不要重复。
  25. *     name(string):可以任意填写,是显示的要点名称。
  26. *     maxnumber(int):大于0!达到这个数本要点将会被判定为达成。
  27. *     readnumber(int/变量指针):
  28. *         如果填int:需要你手动改变,可以做类似“摘三朵花”之类的任务。
  29. *         如果填变量指针:会自动监测那个变量,可以做类似“生命达到1000”之类的任务。
  30. *     autocomplete(boolean):是否自动完成本条件,自动完成的意思就是达成要点后无需NPC触发。
  31. *     completed(boolean):初始状态是否完成,一般填false。
  32. * ======================================================================
  33. * 为某个任务的某个要点中的readnumber+1:
  34. * $gameParty.upratemissionchild(id,childid);
  35. * id(string):任务ID。
  36. * childid(string):要点ID。
  37. * ======================================================================
  38. * 指定某个任务的某个要点中的readnumber:
  39. * $gameParty.setratemissionchild(id,childid,num);、
  40. * id(string):任务ID。
  41. * childid(string):要点ID。
  42. * num(int):值。
  43. * ======================================================================
  44. * 强制完成任务要点:
  45. * $gameParty.completemissionchild(id,childid);
  46. * id(string):任务ID。
  47. * childid(string):要点ID。
  48. * ======================================================================
  49. * 手动完成任务要点:
  50. * $gameParty.donemissionchild(id,childid);
  51. * id(string):任务ID。
  52. * childid(string):要点ID。
  53. * 这条与上面那个不一样之处在于:
  54. *     1、这个方法会检测是否满足达成要点的条件,并返回一个布尔值。
  55. *     2、如果不满足条件,还是不会完成。
  56. * 所以这个方法我的建议是放在条件分歧的脚本一栏里。
  57. * ======================================================================
  58. * 强制完成任务:
  59. * $gameParty.completemission(id);
  60. * id(string):任务ID。
  61. * ======================================================================
  62. * 手动完成任务:
  63. * $gameParty.donemission(id);
  64. * id(string):任务ID。
  65. * 与上一条的差别同前。
  66. * ======================================================================
  67. */

  68. function Window_XY_Mission() {this.initialize.apply(this, arguments);}

  69. Window_XY_Mission.prototype = Object.create(Window_Base.prototype);
  70. Window_XY_Mission.prototype.constructor = Window_XY_Mission;

  71. Window_XY_Mission.prototype.initialize = function() {
  72.     Window_Base.prototype.initialize.call(this, Graphics.boxWidth - this.windowWidth(), Graphics.boxHeight/2, this.windowWidth(), this.windowHeight());
  73.     this.opacity = 0;
  74.         this.line = 0;
  75.         this.padd = 1;
  76.     this.refresh();
  77. };
  78. Window_XY_Mission.prototype.standardFontSize = function() {return 18;};
  79. Window_XY_Mission.prototype.standardPadding = function() {return 0;};
  80. Window_XY_Mission.prototype.textPadding = function() {return 10;};
  81. Window_XY_Mission.prototype.windowWidth = function() {return 300;};
  82. Window_XY_Mission.prototype.windowHeight = function() {return 300};
  83. Window_XY_Mission.prototype.update = function() {
  84.         Window_Base.prototype.update.call(this);
  85.         $gameParty.testallmission();
  86.         this.refresh();
  87. };
  88. Window_XY_Mission.prototype.refresh = function() {
  89.     this.contents.clear();
  90.     var width = this.contentsWidth();
  91.         var height = this.standardFontSize()*$gameParty.getdrawline() + 2*this.textPadding();
  92.         this.line = 0;
  93.         this.padd = 0;
  94.     var missionlist = $gameParty.getallmission();
  95.         if(missionlist.length > 0){this.drawBackground(0, 0, width, height);}
  96.         for(var i = 0;i < missionlist.length;i++){
  97.                 var childinfos = [];
  98.                 for(var b = 0;b < missionlist[i].childs.length;b++){
  99.                     childinfos.push([missionlist[i].childs[b][1],missionlist[i].getchildratebyindex(b),missionlist[i].childs[b][6]]);       
  100.             }
  101.                 this.drawMission(width,missionlist[i].name,missionlist[i].description,childinfos);
  102.                 this.padd ++;
  103.         }
  104.    
  105. };
  106. Window_XY_Mission.prototype.drawBackground = function(x, y, width, height) {
  107.         this.contents.context.fillStyle = 'rgba(0, 0, 0, 0.4)';
  108.     this.contents.context.fillRect(0, 0, this.windowWidth(), this.windowHeight());
  109. };
  110. Window_XY_Mission.prototype.drawMission = function(width,name,description,childinfos) {
  111.     this.drawText(name, this.textPadding(), this.standardFontSize()*this.line + this.textPadding()*this.padd, width ,'left');
  112.         this.line ++;
  113.         if(description != ''){
  114.             this.drawText(description, this.textPadding()*3, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'left');
  115.         this.line ++;
  116.         }
  117.         for(var i = 0;i < childinfos.length;i++){
  118.                 this.changeTextColor(childinfos[i][2] ? 'rgba(160, 160, 160, 0.4)' : 'rgba(255, 255, 255, 1)');
  119.                 this.drawText('▪' + childinfos[i][0], this.textPadding()*5, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'left');
  120.         this.drawText(childinfos[i][1], 0, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'right');
  121.         this.line ++;
  122.         }
  123. };/*
  124. Window_XY_Mission.prototype.drawMissionChild = function(name,rate,completed) {
  125.         this.changeTextColor(this.systemColor());
  126.     var color1 = this.dimColor1();
  127.     var color2 = this.dimColor2();
  128.     this.contents.FillRect(0, 0, width, height, 'rgba(0, 0, 0, 0.3)');
  129.     this.contents.gradientFillRect(x + width / 2, y, width / 2, height, color1, color2);
  130. };
  131. Window_XY_Mission.prototype.changeColorbycompleted = function(completed) {
  132.         complete ? this.changeTextColor('rgba(0, 0, 0, 0.6)') : this.changeTextColor('rgba(0, 0, 0, 0.6)');
  133. };*/
  134. /*
  135. Window_XY_Mission.prototype.isOpenAndActive = function() {
  136.     return this.isOpen() && this.active;
  137. };

  138. Window_XY_Mission.prototype.processTouch = function() {
  139.     if (this.isOpenAndActive()) {
  140.         if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) {
  141.             this._touching = true;
  142.             this.onTouch(true);
  143.         } else if (TouchInput.isCancelled()) {
  144.             if (this.isCancelEnabled()) {
  145.                 this.processCancel();
  146.             }
  147.         }
  148.         if (this._touching) {
  149.             if (TouchInput.isPressed()) {
  150.                 this.onTouch(false);
  151.             } else {
  152.                 this._touching = false;
  153.             }
  154.         }
  155.     } else {
  156.         this._touching = false;
  157.     }
  158. };

  159. Window_XY_Mission.prototype.isTouchedInsideFrame = function() {
  160.     var x = this.canvasToLocalX(TouchInput.x);
  161.     var y = this.canvasToLocalY(TouchInput.y);
  162.     return ((x >= 0)&&(y >= 0)&&(x <= this.width)&&(y <= this.width));
  163. };
  164. Window_XY_Mission.prototype.onTouch = function(triggered) {
  165.     var x = this.canvasToLocalX(TouchInput.x);
  166.     var y = this.canvasToLocalY(TouchInput.y);
  167.     if (this.isTouchedInsideFrame() {
  168.         SoundManager.playCursor();
  169.     }
  170.         //SoundManager.playCursor();
  171. };
  172. */
  173. Scene_Map.prototype.old_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
  174. Scene_Map.prototype.createDisplayObjects = function() {
  175.         this.old_createDisplayObjects();
  176.         this.XY_createMissionWindow();
  177. };
  178. Scene_Map.prototype.XY_createMissionWindow = function() {
  179.     this._XY_MissionWindow = new Window_XY_Mission();
  180.     this.addWindow(this._XY_MissionWindow);
  181. };
  182. alert(1);
  183. /*XY_Mission*/
  184. function XY_Mission(id,name,description,childs,reward,autocomplete){
  185.         this.id = id;
  186.     this.name = name;
  187.     this.description = description;
  188.         //Child[id,name,maxnumber,readnumber,autocomplete,completed]
  189.     this.childs = childs;
  190.     this.reward = reward;
  191.     this.autocomplete = autocomplete;
  192.         this.completed = false;
  193.         //添加任务要点
  194.     this.addchild = function(child){
  195.         this.childs.push(child);
  196.     }
  197.         //根据id寻找任务要点
  198.         this.findchildindexbyid = function(id){
  199.         for(var i = 0;i < this.childs.length;i++){
  200.             if(this.childs[i][0] === id){
  201.                 return i;
  202.             }
  203.         }
  204.     }
  205.         //获取任务要点完成度(仅绘图用)
  206.         this.getchildratebyid = function(id){
  207.         return this.getchildratebyindex(this.findchildindexbyid(id));
  208.     }
  209.         this.getchildratebyindex = function(index){
  210.                 return this.childs[index][3] + "/" + this.childs[index][2];
  211.     }
  212.         //增加一点任务要点完成度
  213.         this.upchildratebyid = function(id){
  214.         this.upchildratebyindex(this.findchildindexbyid(id));
  215.     }
  216.         this.upchildratebyindex = function(index){
  217.                 this.childs[index][3]++;
  218.     }
  219.         //设置任务要点完成度
  220.         this.setchildratebyid = function(id,num){
  221.         this.setchildratebyindex(this.findchildindexbyid(id),num);
  222.     }
  223.         this.setchildratebyindex = function(index,num){
  224.                 this.childs[index][3] = num;
  225.     }
  226.         //设置任务要点完成度
  227.         this.removechildbyid = function(id){
  228.         this.removechildbyindex(this.findchildindexbyid(id));
  229.     }
  230.         this.removechildbyindex = function(index){
  231.                 this.childs.splice(index,1);
  232.     }
  233.         //强制完成任务要点
  234.         this.completechildbyid = function(id){
  235.         this.completechildbyindex(this.findchildindexbyid(id));
  236.     }
  237.         this.completechildbyindex = function(index){
  238.                 this.childs[index][5] = true;
  239.     }
  240.         //获取任务要点是否达成
  241.         this.ischildcompletebyid = function(id){
  242.         return this.ischildcompletebyindex(this.findchildindexbyid(id));
  243.     }
  244.         this.ischildcompletebyindex = function(index){
  245.                 return (this.childs[index][3] >= this.childs[index][2]);
  246.     }
  247.         //获取任务要点是否完成
  248.         this.ischildcompletedbyid = function(id){
  249.         return this.ischildcompletedbyindex(this.findchildindexbyid(id));
  250.     }
  251.         this.ischildcompletedbyindex = function(index){
  252.                 return this.childs[index][5];
  253.     }
  254.         //手动完成任务要点
  255.         this.donechildbyid = function(id){
  256.         return this.donechildbyindex(this.findchildindexbyid(id));
  257.     }
  258.         this.donechildbyindex = function(index){
  259.                 if(this.ischildcompletebyindex(index)){this.completechildbyindex(index);}
  260.                 return this.ischildcompletedbyindex(index);
  261.     }
  262.         //自动完成任务要点
  263.         this.testchildbyid = function(id){
  264.         this.testchildbyindex(this.findchildindexbyid(id));
  265.     }
  266.         this.testchildbyindex = function(index){
  267.                 if(this.ischildcompletebyindex(index)&&this.childs[index][4]){this.completechildbyindex(index);}
  268.     }
  269.         //自动完成全部任务要点
  270.         this.testallchild = function(){
  271.                 for(var i = 0;i < this.childs.length;i++){
  272.                         this.testchildbyindex(i);
  273.         }
  274.     }
  275.         //强制完成任务
  276.         this.complete = function(){
  277.                 this.completed = true;
  278.     }
  279.         //获取任务是否达成
  280.         this.iscomplete = function(){
  281.         var isco = true;
  282.         for(var i = 0;i < this.childs.length;i++){
  283.             if(!this.ischildcompletedbyindex(i)){
  284.                 isco = false;
  285.             }
  286.         }
  287.         return isco;
  288.     }
  289.         //获取任务是否完成
  290.         this.iscompleted = function(){
  291.                 return this.completed;
  292.     }
  293.         //手动完成任务
  294.         this.done = function(){
  295.                 if(this.iscomplete()){this.complete();}
  296.                 return this.iscompleted();
  297.     }
  298.         //自动完成任务
  299.         this.test = function(){
  300.                 if(this.iscomplete()&&this.autocomplete){this.complete();}
  301.     }
  302.         //自动完成任务并且自动完成任务要点
  303.         this.testall = function(){
  304.                 this.testallchild();
  305.                 this.test();
  306.     }
  307. }
  308. /*Game_Party*/
  309. Game_Party.prototype.XY_Mission_old_initialize = Game_Party.prototype.initialize;
  310. Game_Party.prototype.initialize = function() {
  311.     Game_Party.prototype.XY_Mission_old_initialize();
  312.     this._missionlist = [];
  313. };
  314. //添加任务
  315. Game_Party.prototype.addmission = function(id,name,description,childs,reward,autocomplete) {
  316.     this._missionlist.push(new XY_Mission(id,name,description,childs,reward,autocomplete));
  317. };
  318. //添加要点
  319. Game_Party.prototype.addmissionchild = function(id,child) {
  320.     this._missionlist[this.findmissionindexbyid(id)].addchild(child);
  321. };
  322. //根据id寻找任务
  323. Game_Party.prototype.findmissionindexbyid = function(id){
  324.     for(var i = 0;i < this._missionlist.length;i++){
  325.         if(this._missionlist[i].id === id){
  326.             return i;
  327.         }
  328.     }
  329. }
  330. //刷新所有
  331. Game_Party.prototype.testallmission = function(id){
  332.     for(var i = 0;i < this._missionlist.length;i++){
  333.         this._missionlist[i].testall();
  334.     }
  335. }
  336. //增加一点任务要点完成度
  337. Game_Party.prototype.upratemissionchild = function(id,childid){
  338.     this._missionlist[this.findmissionindexbyid(id)].upchildratebyid(childid);
  339. }
  340. //设置任务要点完成度
  341. Game_Party.prototype.setratemissionchild = function(id,childid,num){
  342.     this._missionlist[this.findmissionindexbyid(id)].setchildratebyid(childid,num);
  343. }
  344. //强制完成任务要点
  345. Game_Party.prototype.completemissionchild = function(id,childid){
  346.     this._missionlist[this.findmissionindexbyid(id)].completechildbyid(childid);
  347. }
  348. //手动完成任务要点
  349. Game_Party.prototype.donemissionchild = function(id,childid){
  350.     return this._missionlist[this.findmissionindexbyid(id)].donechildbyid(childid);
  351. }
  352. //强制完成任务
  353. Game_Party.prototype.completemission = function(id){
  354.     this._missionlist[this.findmissionindexbyid(id)].complete();
  355. }
  356. //手动完成任务
  357. Game_Party.prototype.donemission = function(id){
  358.     return this._missionlist[this.findmissionindexbyid(id)].done();
  359. }
  360. //获取所有未完成任务
  361. Game_Party.prototype.getallmission = function(){
  362.         var allmission = [];
  363.         for(var i = 0;i < this._missionlist.length;i++){
  364.                 if(!this._missionlist[i].iscompleted()){
  365.                         allmission.push(this._missionlist[i]);
  366.                 }
  367.         }
  368.     return allmission;
  369. }
  370. //获取绘图行数
  371. Game_Party.prototype.getdrawline = function(){
  372.         var templine = 0;
  373.         var tempmission = this.getallmission();
  374.         templine += tempmission.length;
  375.         for(var i = 0;i < tempmission.length;i++){
  376.                 if(tempmission[i].description != ''){
  377.                         templine++;
  378.                 }
  379.                 templine += tempmission[i].childs.length;
  380.         }
  381.         return templine;
  382. }
复制代码
开心咸鱼每一天~
梦石
0
星屑
50
在线时间
1019 小时
注册时间
2012-4-25
回帖
693
发表于 2015-11-13 21:52:14 | 显示全部楼层
其实我一直在想打怪的任务,MV可以判断打败了什么怪物不?如果不行,能不能让怪物在某一开关打开之后,才掉落任务道具?这样判断道具即可。
回复

使用道具 举报

梦石
0
星屑
1033
在线时间
145 小时
注册时间
2013-10-16
回帖
254
 楼主| 发表于 2015-11-13 22:03:35 | 显示全部楼层
lirn 发表于 2015-11-13 21:52
其实我一直在想打怪的任务,MV可以判断打败了什么怪物不?如果不行,能不能让怪物在某一开关打开之后,才掉 ...

如果你用默认战斗就这样
搜狗截图20151113220457.png
如果你用其他方式战斗(ARPG等)得自己改脚本……
开心咸鱼每一天~
回复

使用道具 举报

梦石
0
星屑
48
在线时间
784 小时
注册时间
2013-1-4
回帖
1057
发表于 2015-11-14 01:39:24 | 显示全部楼层
我就说一句 既然数据库都是用的json 那么手写个编辑器不难吧

点评

不是己有一个了麼?  发表于 2015-11-14 13:16
额……也对  发表于 2015-11-14 10:41
RM-GUI延期。。。最近被黑心老板压迫T_T
二次元少女的shitake,长着长脸,身高165,蓝色卷双马尾,FCUP,瞳色黑色,病气和御宅属性,是天才少女。
回复

使用道具 举报

梦石
0
星屑
3589
在线时间
32 小时
注册时间
2015-9-24
回帖
2
发表于 2015-11-14 11:55:47 | 显示全部楼层
大神,这脚本如何使用啊?怎么保存城.js文件啊

点评

我也有同感  发表于 2015-11-15 12:09
论坛的保存功能好像有BUG用不了  发表于 2015-11-14 22:02
新建记事本,然后复制粘贴,保存,强硬修改扩展名为JS,OK  发表于 2015-11-14 21:42
还没有做好,所以暂时用不了  发表于 2015-11-14 20:53
回复

使用道具 举报

梦石
0
星屑
166
在线时间
454 小时
注册时间
2015-2-25
回帖
358
发表于 2015-11-14 12:16:45 | 显示全部楼层
我覺得,任務窗口右邊留點空位不要貼着邊框比較好(像下面一樣)

或者...如果是想要有從右邊冒出來的效果...那最少把0/3往左移一點,感覺比較好看

点评

嗯呢  发表于 2015-11-14 20:53
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部