查看: 3187|回复: 6

[有事请教] 我真的是...拿了别人的脚本看了介绍都不会用...

[复制链接]
梦石
0
星屑
651
在线时间
118 小时
注册时间
2019-3-15
回帖
60
发表于 2019-10-1 08:56:25 | 显示全部楼层 |阅读模式

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

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

×
一个任务系统插件
里面解释的倒是挺详细的,但看了有些地方还是很懵。
先是不知道怎么打开任务显示界面,好像也没提到打开任务界面的命令。
然后也不确定设置任务的脚本是写到原代码的脚本里,还是游戏编辑器的那个脚本里。
所以就试着设置了一下任务放到游戏编辑器的脚本里,结果出错了。
脑瓜子疼。


  1. /*:
  2. * @plugindesc 为RPG Maker MV新增任务系统。
  3. * @author 小优【66RPG:rpg-sheep】【百度贴吧:优加星爱兔子】
  4. *
  5. * @param windowmode
  6. * @desc 决定任务窗口位置(1=左置,2=右置)
  7. * @default 1
  8. *
  9. * @param windowcolor
  10. * @desc 决定任务窗口颜色(rgba)
  11. * @default rgba(0, 0, 0, 0.4)
  12. *
  13. * @param windowbackground
  14. * @desc 决定任务窗口图片,不填代表使用纯色背景(windowcolor)
  15. * @default
  16. *
  17. * @help
  18. * ======================================================================
  19. * 小优的任务系统采用全新逻辑方案,与传统任务系统相比,你可以做出任何效果!
  20. * ======================================================================
  21. * 在脚本中输入以下内容来操作任务系统:
  22. * ----------------------------------------------------------------------
  23. * 新增任务:
  24. * $gameParty.addmission(id,name,description,childs,reward,color,autocomplete);
  25. * id(string):可以任意填写,是你识别任务的唯一参数,注意最好不要重复。
  26. * name(string):可以任意填写,是显示的任务名称。
  27. * description(string):可以任意填写,是显示的任务介绍。
  28. * childs(array):任务要点列表,以[child,child,...]的格式填写,在下一条目有介绍。
  29. * reward(array):完成奖励,以[['EXP',数量],['MONEY',数量],[物品ID,数量],...]的格式填写。
  30. * color(string):任务颜色,填'#xxxxxx'的十六进制格式,填null默认为白色。
  31. * autocomplete(boolean):是否自动完成任务,自动完成的意思就是达成条件后无需NPC触发。
  32. * ----------------------------------------------------------------------
  33. * 为某个任务新增要点:
  34. * $gameParty.addmissionchild(id,child);
  35. * id(string):任务ID。
  36. * child(array):要点,以[id,name,maxnumber,readnumber,autocomplete,completed]的格式填写。
  37. *     id(string):可以任意填写,是你识别要点的唯一参数,同一任务中注意最好不要重复。
  38. *     name(string):可以任意填写,是显示的要点名称。
  39. *     maxnumber(int):大于0!达到这个数本要点将会被判定为达成。
  40. *     readnumber(int/string):
  41. *         如果填int:需要你手动改变,可以做类似“摘三朵花”之类的任务。
  42. *         如果填string:变量名称,会自动监测那个变量,可以做类似“生命达到1000”之类的任务。
  43. *     autocomplete(boolean):是否自动完成本条件,自动完成的意思就是达成要点后无需NPC触发。
  44. *     completed(boolean):初始状态是否完成,一般填false。
  45. * ----------------------------------------------------------------------
  46. * 为某个任务的某个要点中的readnumber+1:
  47. * $gameParty.upratemissionchild(id,childid);
  48. * id(string):任务ID。
  49. * childid(string):要点ID。
  50. * ----------------------------------------------------------------------
  51. * 指定某个任务的某个要点中的readnumber:
  52. * $gameParty.setratemissionchild(id,childid,num);
  53. * id(string):任务ID。
  54. * childid(string):要点ID。
  55. * num(int):值。
  56. * ----------------------------------------------------------------------
  57. * 检测任务要点是否完成:
  58. * $gameParty.ischildcompleted(id,childid);
  59. * id(string):任务ID。
  60. * childid(string):要点ID。
  61. * 这个方法会检测要点是否完成,并返回一个布尔值。所以这个方法我的建议是放
  62. * 在条件分歧的脚本一栏里。
  63. * ----------------------------------------------------------------------
  64. * 强制完成任务要点:
  65. * $gameParty.completemissionchild(id,childid);
  66. * id(string):任务ID。
  67. * childid(string):要点ID。
  68. * ----------------------------------------------------------------------
  69. * 手动完成任务要点:
  70. * $gameParty.donemissionchild(id,childid);
  71. * id(string):任务ID。
  72. * childid(string):要点ID。
  73. * 这条与上面那个不一样之处在于:
  74. *     1、这个方法会检测是否满足达成要点的条件,并返回是否完成的布尔值。
  75. *     2、如果不满足条件,还是不会完成。
  76. * 所以这个方法我的建议是放在条件分歧的脚本一栏里。
  77. * ----------------------------------------------------------------------
  78. * 检测任务是否完成:
  79. * $gameParty.iscompleted(id);
  80. * id(string):任务ID。
  81. * 这个方法会检测任务是否完成,并返回一个布尔值。所以这个方法我的建议是放
  82. * 在条件分歧的脚本一栏里。
  83. * ----------------------------------------------------------------------
  84. * 强制完成任务:
  85. * $gameParty.completemission(id);
  86. * id(string):任务ID。
  87. * ----------------------------------------------------------------------
  88. * 手动完成任务:
  89. * $gameParty.donemission(id);
  90. * id(string):任务ID。
  91. * 与上一条的差别同前。
  92. * ----------------------------------------------------------------------
  93. * 删除任务:
  94. * $gameParty.delmission(id);
  95. * id(string):任务ID。
  96. * ----------------------------------------------------------------------
  97. * NPC头上任务描绘的语法:在事件注释里输入:
  98. * <NPC:name,color,xadd,yadd,input>
  99. * name:可以任意填写,但不能包含英文逗号,是显示的NPC名称,不可缺省。
  100. * color:NPC名称颜色,填'#xxxxxx'的十六进制格式,不区分大小写,不可缺省。
  101. * xadd:可以填负号和0-9,X坐标偏移量,不可缺省。
  102. * yadd:可以填负号和0-9,X坐标偏移量,不可缺省。
  103. * input:格式为 图片位置|图片文件名|任务ID|子任务ID
  104. * ======================================================================
  105. * 实用小技巧Q&A:
  106. * ----------------------------------------------------------------------
  107. * Q:小优你的配置太麻烦了,你会不会出类似JSON的数据库?
  108. * A:抱歉不会。因为JSON数据库有他的局限性:不可动态改变。小优的很多功能
  109. * 都是动态改变的,虽然说如果你不使用动态改变的功能,可以这么干,但万一
  110. * 你用了就会混乱,所以……如果你一定需要数据库,请自行配置。
  111. * ----------------------------------------------------------------------
  112. * Q:能不能简单介绍一下你的任务系统?
  113. * A:小优的任务系统需要你记住以下四个关键词:主任务、要点、达成、完成。
  114. *    主任务:为addmission添加的任务,完成它能获得reward奖励。
  115. *    要点:可以理解为子任务,完成一个要点并不能获得reward中的奖励。
  116. *    达成:指达到了完成的条件,但并不等同于完成。举个例子:有一个任务“摘
  117. * 花”,其中一个要点是“摘三朵花并送给凯伦”。你摘了三朵花后,任务即为达成,
  118. * 但是你需要找凯伦,这个要点才能被完成。当然具体怎么设置归你管。
  119. *    完成:已经完成的任务或要点无法改变状态。此任务或要点被锁定。
  120. *    注意:必须先达成才能完成;任务的达成条件是全部要点被完成。当然有个
  121. * 强制完成的操作,可以跳过达成这一步。
  122. * ----------------------------------------------------------------------
  123. * Q:我想做一个任务“摘花”,摘三朵花后自动完成摘三朵花要点,怎么破?
  124. * A:将摘三朵花要点的autocomplete设置为true,即可在达成该要点时自动完成。
  125. * ----------------------------------------------------------------------
  126. * Q:我想做一个任务“修炼”,要求是玩家血量和MP都大于100,之后找一个NPC,
  127. * 但是我不希望血量曾经达到100就锁定这个要点,怎么破?
  128. * A:将玩家血量、MP要点的autocomplete设置为false,就不会自动锁定。
  129. * ----------------------------------------------------------------------
  130. * Q:怎么判断某个任务是否完成啊!NPC要根据是否完成做出回答啊!
  131. * A:你用事件的条件分歧第4页中的脚本栏:
  132. *        若:脚本:$gameParty.iscompleted(id)
  133. *           文字:哈哈,恭喜!
  134. *        其他
  135. *           文字:快点去完成!
  136. *        结束
  137. *    若你想做特殊效果,这个判断不仅返回是否完成,还会顺便自动完成,就把
  138. * $gameParty.iscompleted(id)换成$gameParty.donemission(id)。
  139. * ======================================================================
  140. */

  141. /*Window_XY_Mission*/
  142. function Window_XY_Mission() {this.initialize.apply(this, arguments);}

  143. Window_XY_Mission.prototype = Object.create(Window_Base.prototype);
  144. Window_XY_Mission.prototype.constructor = Window_XY_Mission;

  145. Window_XY_Mission.prototype.initialize = function() {
  146.     Window_Base.prototype.initialize.call(this, (Number(PluginManager.parameters('小优MV任务系统')['windowmode']) === 2 ? Graphics.boxWidth - this.windowWidth() : 0), Graphics.boxHeight/2, this.windowWidth(), this.windowHeight());
  147.     this.opacity = 0;
  148.         this.line = 0;
  149.         this.padd = 1;
  150.     this.refresh();
  151. };
  152. Window_XY_Mission.prototype.standardFontSize = function() {return 18;};
  153. Window_XY_Mission.prototype.standardPadding = function() {return 0;};
  154. Window_XY_Mission.prototype.textPadding = function() {return 10;};
  155. Window_XY_Mission.prototype.windowWidth = function() {return 300;};
  156. Window_XY_Mission.prototype.windowHeight = function() {return 300};
  157. Window_XY_Mission.prototype.update = function() {
  158.         Window_Base.prototype.update.call(this);
  159.         $gameParty.testallmission();
  160.         this.refresh();
  161. };
  162. Window_XY_Mission.prototype.refresh = function() {
  163.     this.contents.clear();
  164.     var width = this.contentsWidth();
  165.         var missionlist = $gameParty.getucmission();
  166.         var height = this.standardFontSize()*$gameParty.getdrawline() + (1 + missionlist.length)*this.textPadding();
  167.         this.line = 0;
  168.         this.padd = 0;
  169.         if(missionlist.length > 0){this.drawBackground(width, height);}
  170.         for(var i = 0;i < missionlist.length;i++){
  171.                 var childinfos = [];
  172.                 for(var b = 0;b < missionlist[i].childs.length;b++){
  173.                     childinfos.push([missionlist[i].childs[b][1],missionlist[i].getchildratebyindex(b),missionlist[i].childs[b][5]]);        
  174.             }
  175.                 this.drawMission(width,missionlist[i].name,missionlist[i].description,childinfos,missionlist[i].color);
  176.                 this.padd ++;
  177.         }

  178. };
  179. Window_XY_Mission.prototype.drawBackground = function(width, height) {
  180.         this.contents.context.fillStyle = (PluginManager.parameters('小优MV任务系统')['windowcolor']||'rgba(0, 0, 0, 0.4)');
  181.     this.contents.context.fillRect(0, 0, width, height);
  182. };
  183. Window_XY_Mission.prototype.drawMission = function(width,name,description,childinfos,color) {
  184.         this.contents.textColor = (color ? color : '#ffffff');
  185.     this.drawText(name, this.textPadding(), this.standardFontSize()*this.line + this.textPadding()*this.padd, width ,'left');
  186.         this.contents.textColor = '#ffffff';
  187.         this.line ++;
  188.         this.contents.fontSize -= 2;
  189.         if(description != ''){
  190.             this.drawText(description, this.textPadding()*3, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'left');
  191.         this.line ++;
  192.         }
  193.         for(var i = 0;i < childinfos.length;i++){
  194.                 this.contents.textColor = (childinfos[i][2] ? '#999999' : '#ffffff');
  195.                 this.drawText('▪' + childinfos[i][0], this.textPadding()*5, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'left');
  196.         this.drawText(childinfos[i][1], 0, this.standardFontSize()*this.line + this.textPadding()*this.padd, width - this.textPadding(), 'right');
  197.                 this.contents.textColor = '#ffffff';
  198.                 this.line ++;
  199.         }
  200.         this.contents.fontSize += 2;
  201. };
  202. /*
  203. Window_XY_Mission.prototype.isOpenAndActive = function() {
  204.     return this.isOpen() && this.active;
  205. };

  206. Window_XY_Mission.prototype.processTouch = function() {
  207.     if (this.isOpenAndActive()) {
  208.         if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) {
  209.             this._touching = true;
  210.             this.onTouch(true);
  211.         } else if (TouchInput.isCancelled()) {
  212.             if (this.isCancelEnabled()) {
  213.                 this.processCancel();
  214.             }
  215.         }
  216.         if (this._touching) {
  217.             if (TouchInput.isPressed()) {
  218.                 this.onTouch(false);
  219.             } else {
  220.                 this._touching = false;
  221.             }
  222.         }
  223.     } else {
  224.         this._touching = false;
  225.     }
  226. };

  227. Window_XY_Mission.prototype.isTouchedInsideFrame = function() {
  228.     var x = this.canvasToLocalX(TouchInput.x);
  229.     var y = this.canvasToLocalY(TouchInput.y);
  230.     return ((x >= 0)&&(y >= 0)&&(x <= this.width)&&(y <= this.width));
  231. };
  232. Window_XY_Mission.prototype.onTouch = function(triggered) {
  233.     var x = this.canvasToLocalX(TouchInput.x);
  234.     var y = this.canvasToLocalY(TouchInput.y);
  235.     if (this.isTouchedInsideFrame() {
  236.         SoundManager.playCursor();
  237.     }
  238.         //SoundManager.playCursor();
  239. };
  240. */

  241. /*Scene_Map*/
  242. Scene_Map.prototype.XY_Mission_old_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
  243. Scene_Map.prototype.createDisplayObjects = function() {
  244.         this.XY_Mission_old_createDisplayObjects();
  245.         this.XY_createMissionWindow();
  246. };
  247. Scene_Map.prototype.XY_createMissionWindow = function() {
  248.     this._XY_MissionWindow = new Window_XY_Mission();
  249.     this.addWindow(this._XY_MissionWindow);
  250. };
  251. Scene_Map.prototype.XY_Mission_old_update = Scene_Map.prototype.update;
  252. Scene_Map.prototype.update = function() {
  253.     this.XY_Mission_old_update();
  254.     if($gameMap._interpreter.isRunning()){
  255.         this._XY_MissionWindow.close();
  256.     }else{
  257.         this._XY_MissionWindow.open();  
  258.     }
  259. };

  260. /*XY_Mission*/
  261. function XY_Mission() {
  262.     this.initialize.apply(this, arguments);
  263. }
  264. XY_Mission.prototype.initialize = function(id,name,description,childs,reward,color,autocomplete) {
  265.     this.id = id;
  266.     this.name = name;
  267.     this.description = description;
  268.         //Child[id,name,maxnumber,readnumber,autocomplete,completed]
  269.     this.childs = childs;
  270.     this.reward = reward;
  271.         this.color = color;
  272.     this.autocomplete = autocomplete;
  273.         this.completed = false;
  274. };

  275. //添加任务要点
  276. XY_Mission.prototype.addchild = function(child){
  277.     this.childs.push(child);
  278. }
  279. //根据id寻找任务要点
  280. XY_Mission.prototype.findchildindexbyid = function(id){
  281.     for(var i = 0;i < this.childs.length;i++){
  282.         if(this.childs[i][0] === id){
  283.             return i;
  284.         }
  285.     }
  286.         return null;
  287. }
  288. //获取任务要点完成度(仅绘图用)
  289. XY_Mission.prototype.getchildratebyid = function(id){
  290.         if(this.findchildindexbyid(id)!=null){
  291.             return this.getchildratebyindex(this.findchildindexbyid(id));
  292.     }
  293.         return false;
  294. }
  295. XY_Mission.prototype.getchildratebyindex = function(index){
  296.     if(index >= 0 && index < this.childs.length){
  297.                 return ((this.childs[index][3]<=0||this.childs[index][3]>0) ? this.childs[index][3] : eval(this.childs[index][3])) + "/" + this.childs[index][2];
  298.     }
  299.         return false;
  300. }
  301. //增加一点任务要点完成度
  302. XY_Mission.prototype.upchildratebyid = function(id){
  303.          if(this.findchildindexbyid(id)!=null){
  304.                 this.upchildratebyindex(this.findchildindexbyid(id));
  305.     }
  306. }
  307. XY_Mission.prototype.upchildratebyindex = function(index){
  308.     if(index >= 0 && index < this.childs.length){
  309.                 if(this.childs[index][3]<=0||this.childs[index][3]>0){this.childs[index][3]++;}
  310.     }
  311. }
  312. //设置任务要点完成度
  313. XY_Mission.prototype.setchildratebyid = function(id,num){
  314.          if(this.findchildindexbyid(id)!=null){
  315.             this.setchildratebyindex(this.findchildindexbyid(id),num);
  316.     }
  317. }
  318. XY_Mission.prototype.setchildratebyindex = function(index,num){
  319.     if(index >= 0 && index < this.childs.length){
  320.                 if(this.childs[index][3]<=0||this.childs[index][3]>0){this.childs[index][3] = num;}
  321.     }
  322. }
  323. //设置任务要点完成度
  324. XY_Mission.prototype.removechildbyid = function(id){
  325.          if(this.findchildindexbyid(id)!=null){
  326.             this.removechildbyindex(this.findchildindexbyid(id));
  327.     }
  328. }
  329. XY_Mission.prototype.removechildbyindex = function(index){
  330.     if(index >= 0 && index < this.childs.length){
  331.             this.childs.splice(index,1);
  332.     }
  333. }
  334. //强制完成任务要点
  335. XY_Mission.prototype.completechildbyid = function(id){
  336.          if(this.findchildindexbyid(id)!=null){
  337.             this.completechildbyindex(this.findchildindexbyid(id));
  338.     }
  339. }
  340. XY_Mission.prototype.completechildbyindex = function(index){
  341.     if(index >= 0 && index < this.childs.length){
  342.                 this.childs[index][5] = true;
  343.     }
  344. }
  345. //获取任务要点是否达成
  346. XY_Mission.prototype.ischildcompletebyid = function(id){
  347.          if(this.findchildindexbyid(id)!=null){
  348.             return this.ischildcompletebyindex(this.findchildindexbyid(id));
  349.     }
  350.         return false;
  351. }
  352. XY_Mission.prototype.ischildcompletebyindex = function(index){
  353.     if(index >= 0 && index < this.childs.length){
  354.                 return (((this.childs[index][3]<=0||this.childs[index][3]>0) ? this.childs[index][3] : eval(this.childs[index][3])) >= this.childs[index][2]);
  355.     }
  356.         return false;
  357. }
  358. //获取任务要点是否完成
  359. XY_Mission.prototype.ischildcompletedbyid = function(id){
  360.          if(this.findchildindexbyid(id)!=null){
  361.             return this.ischildcompletedbyindex(this.findchildindexbyid(id));
  362.     }
  363.         return false;
  364. }
  365. XY_Mission.prototype.ischildcompletedbyindex = function(index){
  366.     if(index >= 0 && index < this.childs.length){
  367.                 return this.childs[index][5];
  368.     }
  369.         return false;
  370. }
  371. //手动完成任务要点
  372. XY_Mission.prototype.donechildbyid = function(id){
  373.          if(this.findchildindexbyid(id)!=null){
  374.             return this.donechildbyindex(this.findchildindexbyid(id));
  375.     }
  376.         return false;
  377. }
  378. XY_Mission.prototype.donechildbyindex = function(index){
  379.     if(index >= 0 && index < this.childs.length){
  380.             if(this.ischildcompletebyindex(index)){this.completechildbyindex(index);}
  381.             return this.ischildcompletedbyindex(index);
  382.     }
  383.         return false;
  384. }
  385. //自动完成任务要点
  386. XY_Mission.prototype.testchildbyid = function(id){
  387.          if(this.findchildindexbyid(id)!=null){
  388.             this.testchildbyindex(this.findchildindexbyid(id));
  389.     }
  390. }
  391. XY_Mission.prototype.testchildbyindex = function(index){
  392.     if(index >= 0 && index < this.childs.length){
  393.             if(this.ischildcompletebyindex(index)&&this.childs[index][4]){this.completechildbyindex(index);}
  394.     }
  395. }
  396. //自动完成全部任务要点
  397. XY_Mission.prototype.testallchild = function(){
  398.         for(var i = 0;i < this.childs.length;i++){
  399.                 this.testchildbyindex(i);
  400.     }
  401. }
  402. //强制完成任务
  403. XY_Mission.prototype.complete = function(){
  404.         this.completed = true;
  405. }
  406. //获取任务是否达成
  407. XY_Mission.prototype.iscomplete = function(){
  408.     var isco = true;
  409.     for(var i = 0;i < this.childs.length;i++){
  410.         if(!this.ischildcompletedbyindex(i)){
  411.             isco = false;
  412.         }
  413.     }
  414.     return isco;
  415. }
  416. //获取任务是否完成
  417. XY_Mission.prototype.iscompleted = function(){
  418.     return this.completed;
  419. }
  420. //手动完成任务
  421. XY_Mission.prototype.done = function(){
  422.     if(this.iscomplete()){this.complete();}
  423.         return this.iscompleted();
  424. }
  425. //自动完成任务
  426. XY_Mission.prototype.test = function(){
  427.         if(this.iscomplete()&&this.autocomplete){this.complete();}
  428. }
  429. //自动完成任务并且自动完成任务要点
  430. XY_Mission.prototype.testall = function(){
  431.     this.testallchild();
  432.         this.test();
  433. }

  434. /*Game_Party*/
  435. Game_Party.prototype.old_initialize = Game_Party.prototype.initialize;
  436. Game_Party.prototype.initialize = function() {
  437.     this.old_initialize();
  438.     this._missionlist = [];
  439. };/*
  440. var XY_Mission_old_initialize = Game_Party.prototype.initialize;
  441. Game_Party.prototype.initialize = function() {
  442.     XY_Mission_old_initialize.apply(this, arguments);
  443.         this._missionlist = [];
  444. };*/
  445. //添加任务
  446. Game_Party.prototype.addmission = function(id,name,description,childs,reward,color,autocomplete) {
  447.     this._missionlist.push(new XY_Mission(id,name,description,childs,reward,color,autocomplete));
  448. };
  449. //添加要点
  450. Game_Party.prototype.addmissionchild = function(id,child) {
  451.     this._missionlist[this.findmissionindexbyid(id)].addchild(child);
  452. };
  453. //根据id寻找任务
  454. Game_Party.prototype.findmissionindexbyid = function(id){
  455.     for(var i = 0;i < this._missionlist.length;i++){
  456.         if(this._missionlist[i].id === id){
  457.             return i;
  458.         }
  459.     }
  460.         return null;
  461. }
  462. //删除任务
  463. Game_Party.prototype.delmission = function(id) {
  464.         if(this.findmissionindexbyid(id)!=null){
  465.         this._missionlist.splice(this.findmissionindexbyid(id),1);
  466.         }
  467. };
  468. //刷新所有
  469. Game_Party.prototype.testallmission = function(id){
  470.     for(var i = 0;i < this._missionlist.length;i++){
  471.         this._missionlist[i].testall();
  472.     }
  473. }
  474. //任务要点是否完成
  475. Game_Party.prototype.ischildcompleted = function(id,childid){
  476.     if(this.findmissionindexbyid(id)!=null){
  477.         return this._missionlist[this.findmissionindexbyid(id)].ischildcompletedbyid(childid);
  478.         }
  479.         return false;
  480. }
  481. //任务是否完成
  482. Game_Party.prototype.iscompleted = function(id){
  483.     if(this.findmissionindexbyid(id)!=null){
  484.         return this._missionlist[this.findmissionindexbyid(id)].iscompleted();
  485.         }
  486.         return false;
  487. }
  488. //增加一点任务要点完成度
  489. Game_Party.prototype.upratemissionchild = function(id,childid){
  490.     if(this.findmissionindexbyid(id)!=null){
  491.         this._missionlist[this.findmissionindexbyid(id)].upchildratebyid(childid);
  492.         }
  493. }
  494. //设置任务要点完成度
  495. Game_Party.prototype.setratemissionchild = function(id,childid,num){
  496.     if(this.findmissionindexbyid(id)!=null){
  497.         this._missionlist[this.findmissionindexbyid(id)].setchildratebyid(childid,num);
  498.         }
  499. }
  500. //强制完成任务要点
  501. Game_Party.prototype.completemissionchild = function(id,childid){
  502.     if(this.findmissionindexbyid(id)!=null){
  503.         this._missionlist[this.findmissionindexbyid(id)].completechildbyid(childid);
  504.         }
  505. }
  506. //手动完成任务要点
  507. Game_Party.prototype.donemissionchild = function(id,childid){
  508.     if(this.findmissionindexbyid(id)!=null){
  509.         return this._missionlist[this.findmissionindexbyid(id)].donechildbyid(childid);
  510.         }
  511.         return false;
  512. }
  513. //强制完成任务
  514. Game_Party.prototype.completemission = function(id){
  515.     if(this.findmissionindexbyid(id)!=null){
  516.         this._missionlist[this.findmissionindexbyid(id)].complete();
  517.         }
  518. }
  519. //手动完成任务
  520. Game_Party.prototype.donemission = function(id){
  521.     if(this.findmissionindexbyid(id)!=null){
  522.         return this._missionlist[this.findmissionindexbyid(id)].done();
  523.         }
  524.         return false;
  525. }
  526. //获取所有任务
  527. Game_Party.prototype.getallmission = function(){
  528.     return this._missionlist;
  529. }
  530. //获取所有未完成任务
  531. Game_Party.prototype.getucmission = function(){
  532.         var allmission = [];
  533.         for(var i = 0;i < this._missionlist.length;i++){
  534.                 if(!this._missionlist[i].iscompleted()){
  535.                         allmission.push(this._missionlist[i]);
  536.                 }
  537.         }
  538.     return allmission;
  539. }
  540. //获取所有已完成任务
  541. Game_Party.prototype.getcmission = function(){
  542.         var allmission = [];
  543.         for(var i = 0;i < this._missionlist.length;i++){
  544.                 if(this._missionlist[i].iscompleted()){
  545.                         allmission.push(this._missionlist[i]);
  546.                 }
  547.         }
  548.     return allmission;
  549. }
  550. //获取绘图行数
  551. Game_Party.prototype.getdrawline = function(){
  552.         var templine = 0;
  553.         var tempmission = this.getallmission();
  554.         templine += tempmission.length;
  555.         for(var i = 0;i < tempmission.length;i++){
  556.                 if(tempmission[i].description != ''){
  557.                         templine++;
  558.                 }
  559.                 templine += tempmission[i].childs.length;
  560.         }
  561.         return templine;
  562. }

  563. /*地图显示NPC*/
  564. Sprite_Character.prototype.XY_Mission_old_initialize = Sprite_Character.prototype.initialize;
  565. Sprite_Character.prototype.initialize = function(character) {
  566.     this.XY_Mission_old_initialize(character);
  567.     if (character instanceof Game_Event) {
  568.         var datas = character.event().note.match(/\<NPC:.*,#[0-9a-f]{6},[-0-9]*,[-0-9]*,.*\>/i);
  569.         if (datas != null) {
  570.                         datas = datas[0].slice(5,datas[0].length-1).split(',');
  571.             this.drawNPC(decodeURI(datas[0]),datas[1].toString(),parseInt(datas[2]),parseInt(datas[3]),datas[4].toString());
  572.         };
  573.     };
  574. };

  575. Sprite_Character.prototype.drawNPC = function(name,color,xadd,yadd,type,pictureinput) {
  576.     this._NPCname = new Sprite();
  577.     this._NPCname.bitmap = new Bitmap(100, 20);
  578.     this._NPCname.bitmap.fontSize = 18;
  579.     this._NPCname.bitmap.textColor = color;
  580.     this._NPCname.bitmap.drawText(name, 0, 0, 100, 20, 'center');
  581.     this._NPCname.anchor.x = 0.5;
  582.     this._NPCname.anchor.y = 1;
  583.     this._NPCname.x = this.x + xadd;
  584.     this._NPCname.y = this.y + yadd;
  585.     this.addChild(this._NPCname);
  586.         /*
  587.         this._NPCpic = new Sprite();
  588.     this._NPCpic.bitmap = new Bitmap(48, 20);
  589.     this._NPCpic.bitmap.fontSize = 18;
  590.     this._NPCpic.bitmap.textColor = color;
  591.     this._NPCpic.bitmap.drawText(name, 0, 0, 100, 20, 'center');
  592.     this._NPCpic.anchor.x = 0.5;
  593.     this._NPCpic.anchor.y = 1;
  594.     this._NPCpic.x = this.x + xadd;
  595.     this._NPCpic.y = this.y + yadd;
  596.     this.addChild(this._NPCpic);*/
  597. };
复制代码

QQ截图20191001084831.png
QQ截图20191001085140.png
梦石
0
星屑
1075
在线时间
133 小时
注册时间
2019-5-1
回帖
57
发表于 2019-10-1 09:33:23 | 显示全部楼层
小优这个插件更新过很多版本了。

最新的在这里,https://github.com/Lagomoro/Lagomoro-Mission-MV 里面自带说明帮助文件和范例。

点评

大佬能不能帮忙下载一个,国内的网速让人绝望啊……  发表于 2019-10-2 20:49
回复

使用道具 举报

梦石
0
星屑
651
在线时间
118 小时
注册时间
2019-3-15
回帖
60
 楼主| 发表于 2019-10-1 11:14:47 | 显示全部楼层
chinx 发表于 2019-10-1 09:33
小优这个插件更新过很多版本了。

最新的在这里,https://github.com/Lagomoro/Lagomoro-Mission-MV 里面自 ...

谢谢啦~
回复

使用道具 举报

梦石
0
星屑
3930
在线时间
1198 小时
注册时间
2016-8-9
回帖
2355

开拓者

发表于 2019-10-1 20:43:26 | 显示全部楼层
小优这个很棒,但是我也是脑子笨看不懂,用的是yep的任务系统
酸酸甜甜就④哇噢
回复

使用道具 举报

梦石
0
星屑
1075
在线时间
133 小时
注册时间
2019-5-1
回帖
57
发表于 2019-10-2 21:20:51 | 显示全部楼层

其实是这样的,他在群里说希望大家能帮忙在GitHub上帮他点个star,所以我还是比较倾向推广原址。

既然你下不动就没办法了,我给你传一份吧。。

https://pan.baidu.com/s/1N50lm6hC84feQ242SuL_ow

7天有效,不需要提取码。请尽快下载。
回复

使用道具 举报

梦石
0
星屑
651
在线时间
118 小时
注册时间
2019-3-15
回帖
60
 楼主| 发表于 2019-10-4 11:30:52 | 显示全部楼层
chinx 发表于 2019-10-2 21:20
其实是这样的,他在群里说希望大家能帮忙在GitHub上帮他点个star,所以我还是比较倾向推广原址。

既然你 ...

嗯,好的
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部