查看: 5914|回复: 5

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

[复制链接]
梦石
0
星屑
1032
在线时间
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。
* 与上一条的差别同前。
* ======================================================================
请注意!以下代码仅供学习与参考,还没有做完,只能使用一部分的功能……
[pre lang="javascript"]
/*:
* @plugindesc 为RPG Maker MV新增任务系统。
* @author 小优【66RPG:rpg-sheep】【百度贴吧:优加星爱兔子】
*
* @param Default Volume
* @desc This will be the volume of the BGM played.
* @default 90
*
* @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。
* 与上一条的差别同前。
* ======================================================================
*/

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

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

Window_XY_Mission.prototype.initialize = function() {
    Window_Base.prototype.initialize.call(this, Graphics.boxWidth - this.windowWidth(), Graphics.boxHeight/2, this.windowWidth(), this.windowHeight());
    this.opacity = 0;
        this.line = 0;
        this.padd = 1;
    this.refresh();
};
Window_XY_Mission.prototype.standardFontSize = function() {return 18;};
Window_XY_Mission.prototype.standardPadding = function() {return 0;};
Window_XY_Mission.prototype.textPadding = function() {return 10;};
Window_XY_Mission.prototype.windowWidth = function() {return 300;};
Window_XY_Mission.prototype.windowHeight = function() {return 300};
Window_XY_Mission.prototype.update = function() {
        Window_Base.prototype.update.call(this);
        $gameParty.testallmission();
        this.refresh();
};
Window_XY_Mission.prototype.refresh = function() {
    this.contents.clear();
    var width = this.contentsWidth();
        var height = this.standardFontSize()*$gameParty.getdrawline() + 2*this.textPadding();
        this.line = 0;
        this.padd = 0;
    var missionlist = $gameParty.getallmission();
        if(missionlist.length > 0){this.drawBackground(0, 0, width, height);}
        for(var i = 0;i < missionlist.length;i++){
                var childinfos = [];
                for(var b = 0;b < missionlist.childs.length;b++){
                    childinfos.push([missionlist.childs[1],missionlist.getchildratebyindex(b),missionlist.childs[6]]);       
            }
                this.drawMission(width,missionlist.name,missionlist.description,childinfos);
                this.padd ++;
        }
   
};
Window_XY_Mission.prototype.drawBackground = function(x, y, width, height) {
        this.contents.context.fillStyle = 'rgba(0, 0, 0, 0.4)';
    this.contents.context.fillRect(0, 0, this.windowWidth(), this.windowHeight());
};
Window_XY_Mission.prototype.drawMission = function(width,name,description,childinfos) {
    this.drawText(name, this.textPadding(), this.standardFontSize()*this.line + this.textPadding()*this.padd, width ,'left');
        this.line ++;
        if(description != ''){
            this.drawText(description, this.textPadding()*3, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'left');
        this.line ++;
        }
        for(var i = 0;i < childinfos.length;i++){
                this.changeTextColor(childinfos[2] ? 'rgba(160, 160, 160, 0.4)' : 'rgba(255, 255, 255, 1)');
                this.drawText('▪' + childinfos[0], this.textPadding()*5, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'left');
        this.drawText(childinfos[1], 0, this.standardFontSize()*this.line + this.textPadding()*this.padd, width, 'right');
        this.line ++;
        }
};/*
Window_XY_Mission.prototype.drawMissionChild = function(name,rate,completed) {
        this.changeTextColor(this.systemColor());
    var color1 = this.dimColor1();
    var color2 = this.dimColor2();
    this.contents.FillRect(0, 0, width, height, 'rgba(0, 0, 0, 0.3)');
    this.contents.gradientFillRect(x + width / 2, y, width / 2, height, color1, color2);
};
Window_XY_Mission.prototype.changeColorbycompleted = function(completed) {
        complete ? this.changeTextColor('rgba(0, 0, 0, 0.6)') : this.changeTextColor('rgba(0, 0, 0, 0.6)');
};*/
/*
Window_XY_Mission.prototype.isOpenAndActive = function() {
    return this.isOpen() && this.active;
};

Window_XY_Mission.prototype.processTouch = function() {
    if (this.isOpenAndActive()) {
        if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) {
            this._touching = true;
            this.onTouch(true);
        } else if (TouchInput.isCancelled()) {
            if (this.isCancelEnabled()) {
                this.processCancel();
            }
        }
        if (this._touching) {
            if (TouchInput.isPressed()) {
                this.onTouch(false);
            } else {
                this._touching = false;
            }
        }
    } else {
        this._touching = false;
    }
};

Window_XY_Mission.prototype.isTouchedInsideFrame = function() {
    var x = this.canvasToLocalX(TouchInput.x);
    var y = this.canvasToLocalY(TouchInput.y);
    return ((x >= 0)&&(y >= 0)&&(x <= this.width)&&(y <= this.width));
};
Window_XY_Mission.prototype.onTouch = function(triggered) {
    var x = this.canvasToLocalX(TouchInput.x);
    var y = this.canvasToLocalY(TouchInput.y);
    if (this.isTouchedInsideFrame() {
        SoundManager.playCursor();
    }
        //SoundManager.playCursor();
};
*/
Scene_Map.prototype.old_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
Scene_Map.prototype.createDisplayObjects = function() {
        this.old_createDisplayObjects();
        this.XY_createMissionWindow();
};
Scene_Map.prototype.XY_createMissionWindow = function() {
    this._XY_MissionWindow = new Window_XY_Mission();
    this.addWindow(this._XY_MissionWindow);
};
alert(1);
/*XY_Mission*/
function XY_Mission(id,name,description,childs,reward,autocomplete){
        this.id = id;
    this.name = name;
    this.description = description;
        //Child[id,name,maxnumber,readnumber,autocomplete,completed]
    this.childs = childs;
    this.reward = reward;
    this.autocomplete = autocomplete;
        this.completed = false;
        //添加任务要点
    this.addchild = function(child){
        this.childs.push(child);
    }
        //根据id寻找任务要点
        this.findchildindexbyid = function(id){
        for(var i = 0;i < this.childs.length;i++){
            if(this.childs[0] === id){
                return i;
            }
        }
    }
        //获取任务要点完成度(仅绘图用)
        this.getchildratebyid = function(id){
        return this.getchildratebyindex(this.findchildindexbyid(id));
    }
        this.getchildratebyindex = function(index){
                return this.childs[index][3] + "/" + this.childs[index][2];
    }
        //增加一点任务要点完成度
        this.upchildratebyid = function(id){
        this.upchildratebyindex(this.findchildindexbyid(id));
    }
        this.upchildratebyindex = function(index){
                this.childs[index][3]++;
    }
        //设置任务要点完成度
        this.setchildratebyid = function(id,num){
        this.setchildratebyindex(this.findchildindexbyid(id),num);
    }
        this.setchildratebyindex = function(index,num){
                this.childs[index][3] = num;
    }
        //设置任务要点完成度
        this.removechildbyid = function(id){
        this.removechildbyindex(this.findchildindexbyid(id));
    }
        this.removechildbyindex = function(index){
                this.childs.splice(index,1);
    }
        //强制完成任务要点
        this.completechildbyid = function(id){
        this.completechildbyindex(this.findchildindexbyid(id));
    }
        this.completechildbyindex = function(index){
                this.childs[index][5] = true;
    }
        //获取任务要点是否达成
        this.ischildcompletebyid = function(id){
        return this.ischildcompletebyindex(this.findchildindexbyid(id));
    }
        this.ischildcompletebyindex = function(index){
                return (this.childs[index][3] >= this.childs[index][2]);
    }
        //获取任务要点是否完成
        this.ischildcompletedbyid = function(id){
        return this.ischildcompletedbyindex(this.findchildindexbyid(id));
    }
        this.ischildcompletedbyindex = function(index){
                return this.childs[index][5];
    }
        //手动完成任务要点
        this.donechildbyid = function(id){
        return this.donechildbyindex(this.findchildindexbyid(id));
    }
        this.donechildbyindex = function(index){
                if(this.ischildcompletebyindex(index)){this.completechildbyindex(index);}
                return this.ischildcompletedbyindex(index);
    }
        //自动完成任务要点
        this.testchildbyid = function(id){
        this.testchildbyindex(this.findchildindexbyid(id));
    }
        this.testchildbyindex = function(index){
                if(this.ischildcompletebyindex(index)&&this.childs[index][4]){this.completechildbyindex(index);}
    }
        //自动完成全部任务要点
        this.testallchild = function(){
                for(var i = 0;i < this.childs.length;i++){
                        this.testchildbyindex(i);
        }
    }
        //强制完成任务
        this.complete = function(){
                this.completed = true;
    }
        //获取任务是否达成
        this.iscomplete = function(){
        var isco = true;
        for(var i = 0;i < this.childs.length;i++){
            if(!this.ischildcompletedbyindex(i)){
                isco = false;
            }
        }
        return isco;
    }
        //获取任务是否完成
        this.iscompleted = function(){
                return this.completed;
    }
        //手动完成任务
        this.done = function(){
                if(this.iscomplete()){this.complete();}
                return this.iscompleted();
    }
        //自动完成任务
        this.test = function(){
                if(this.iscomplete()&&this.autocomplete){this.complete();}
    }
        //自动完成任务并且自动完成任务要点
        this.testall = function(){
                this.testallchild();
                this.test();
    }
}
/*Game_Party*/
Game_Party.prototype.XY_Mission_old_initialize = Game_Party.prototype.initialize;
Game_Party.prototype.initialize = function() {
    Game_Party.prototype.XY_Mission_old_initialize();
    this._missionlist = [];
};
//添加任务
Game_Party.prototype.addmission = function(id,name,description,childs,reward,autocomplete) {
    this._missionlist.push(new XY_Mission(id,name,description,childs,reward,autocomplete));
};
//添加要点
Game_Party.prototype.addmissionchild = function(id,child) {
    this._missionlist[this.findmissionindexbyid(id)].addchild(child);
};
//根据id寻找任务
Game_Party.prototype.findmissionindexbyid = function(id){
    for(var i = 0;i < this._missionlist.length;i++){
        if(this._missionlist.id === id){
            return i;
        }
    }
}
//刷新所有
Game_Party.prototype.testallmission = function(id){
    for(var i = 0;i < this._missionlist.length;i++){
        this._missionlist.testall();
    }
}
//增加一点任务要点完成度
Game_Party.prototype.upratemissionchild = function(id,childid){
    this._missionlist[this.findmissionindexbyid(id)].upchildratebyid(childid);
}
//设置任务要点完成度
Game_Party.prototype.setratemissionchild = function(id,childid,num){
    this._missionlist[this.findmissionindexbyid(id)].setchildratebyid(childid,num);
}
//强制完成任务要点
Game_Party.prototype.completemissionchild = function(id,childid){
    this._missionlist[this.findmissionindexbyid(id)].completechildbyid(childid);
}
//手动完成任务要点
Game_Party.prototype.donemissionchild = function(id,childid){
    return this._missionlist[this.findmissionindexbyid(id)].donechildbyid(childid);
}
//强制完成任务
Game_Party.prototype.completemission = function(id){
    this._missionlist[this.findmissionindexbyid(id)].complete();
}
//手动完成任务
Game_Party.prototype.donemission = function(id){
    return this._missionlist[this.findmissionindexbyid(id)].done();
}
//获取所有未完成任务
Game_Party.prototype.getallmission = function(){
        var allmission = [];
        for(var i = 0;i < this._missionlist.length;i++){
                if(!this._missionlist.iscompleted()){
                        allmission.push(this._missionlist);
                }
        }
    return allmission;
}
//获取绘图行数
Game_Party.prototype.getdrawline = function(){
        var templine = 0;
        var tempmission = this.getallmission();
        templine += tempmission.length;
        for(var i = 0;i < tempmission.length;i++){
                if(tempmission.description != ''){
                        templine++;
                }
                templine += tempmission.childs.length;
        }
        return templine;
}
[/pre]
开心咸鱼每一天~
梦石
0
星屑
50
在线时间
1019 小时
注册时间
2012-4-25
回帖
693
发表于 2015-11-13 21:52:14 | 显示全部楼层
其实我一直在想打怪的任务,MV可以判断打败了什么怪物不?如果不行,能不能让怪物在某一开关打开之后,才掉落任务道具?这样判断道具即可。
回复

使用道具 举报

梦石
0
星屑
1032
在线时间
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.

在本版发帖返回顶部