|
本帖最后由 写给妖精的情诗 于 2025-11-2 17:36 编辑 this.wait(this.eventId()); /* 这个等待本事件编号的多少帧,是因为多个事件页同一帧执行读取图像的时候会读取同一个图像。 要是直接在原始代码那里修改或者是写插件的话,或许就不需要这个等待几帧了。 */ /* 在这里如果怎么样,就让本事件编号的那个变量值等于几,如果怎么样就加一减一。 $gameVariables.setValue(this.eventId(),$gameVariables.value(this.eventId()) + 1); $gameVariables.setValue(this.eventId(), 0); if(){ }else if(){ }else if(){ }else{ } switch(变量或表达式) { case 常量1: 语句块1; break; case 常量2: 语句块2; break; ... case 常量n: 语句块n; break; default: 语句块n+1; } */ 上面的放在上一个脚本框,也可以放在事件指令的分支条件那里。 下面的放在下一个脚本框那里。 /* i 图片名 j 图片区位0 - 7 k 行走图朝向下上左右2 4 6 8 l 图片定位的左中右0 1 2 */ i = this.eventId(); j = Math.floor(($gameVariables.value(this.eventId())/12)); k = Math.floor(($gameVariables.value(this.eventId())%12)/3+1)*2; l = Math.floor($gameVariables.value(this.eventId()%12)%3); ImageManager.loadCharacter = function(filename) { filename = i; return this.loadBitmap("img/characters/", filename); }; $gameMap.event(this.eventId()).setImage("i",j); //图片名和0到7的区块 $gameMap.event(this.eventId()).setDirection(k); //图片的下上左右2468 $gameMap.event(this.eventId()).setPattern(l); //图片的左中右012 if($gameVariables.value(this.eventId()) > 95){ $gameMap.event(this.eventId())._through = true } else { $gameMap.event(this.eventId())._through = false } //如果本事件编号变量的值大于95,那么本事件就可以穿透,否则不可以穿透。 |
|
◆如果:玩家 朝向 上 ◆脚本:$gameVariables.setValue(this.eventId(),$gameVariables.value(this.eventId()) + 1); ◆等待:10帧 ◆ :结束分支 ◆如果:玩家 朝向 下 ◆脚本://$gameVariables.setValue(this.eventId(),$gameVariables.value(this.eventId()) - 1); : :$gameVariables.setValue(this.eventId(),0); ◆等待:10帧 ◆ :结束分支 3楼的脚本配合上面的这个设置试了一下(并行执行),会出现需要两次切换图片才到正确图片的情况。2号事件页(玩家接触)配合下面这个也试了一下。 ◆数值输入处理:#0001, 2 位 原因是在rmmz_objects.js的Game_Event.prototype.setupPageSettings函数里有下面这两行代码,originalPattern这个原始图案在之前测试的时候是正常的,在这里把$gameMap.event(this.eventId())._originalPattern = l; 改成 $gameMap.event(this.eventId()).setPattern(l); 就可以了。 this._originalPattern = image.pattern; this.setPattern(image.pattern); ![]() 还有就是那三行里面的$gameVariables.value(1)这个,是因为一直都在用1号事件页来测试才这样写的, 改成$gameVariables.value(this.eventId())才能真正的本事件、本事件编号的变量、本事件编号ID的图案这个样子。 把改好的脚本放到5楼吧。 |
|
$gameVariables.setValue(this.eventId(), 95); 可以使用事件指令 ◆变量操作:#0001 = 95 指定,那就是可以跟下面这个脚本框放在一起,也可以不放在一起,这样就可以很灵活的操作了。 什么条件下本事件编号的那个变量等于几,什么条件下变量值增加或减少,变量值在0到95的时候就自动显示哪个位置的图像。 另外,这个变量值可以大于95,这样就可以让图片消失了。 还有就是 k = Math.floor(($gameVariables.value(1)%12)/3+1)*2; 这个可以改成 k = 把2、4、6、8的数字改成其他数字,比如3啊,比如5.5啊之类的,这样显示的图片就不是正对着那几行默认位置了,这个发现虽然好像没用,但是说不定什么时候会被用到呢。 ![]() /* i 图片名 j 图片区位0 - 7 k 行走图朝向下上左右2 4 6 8 l 图片定位的左中右0 1 2 */ $gameVariables.setValue(this.eventId(), 95); i = this.eventId(); j = Math.floor(($gameVariables.value(1)/12)); k = Math.floor(($gameVariables.value(1)%12)/3+1)*2; l = Math.floor($gameVariables.value(1)%12%3); ImageManager.loadCharacter = function(filename) { filename = i; return this.loadBitmap("img/characters/", filename); }; $gameMap.event(this.eventId()).setImage("i",j); //图片名和0到7的区块 $gameMap.event(this.eventId()).setDirection(k); //图片的下上左右2468 $gameMap.event(this.eventId())._originalPattern = l; //图片的左中右012 if($gameVariables.value(this.eventId()) > 95){ $gameMap.event(this.eventId())._through = true } else { $gameMap.event(this.eventId())._through = false } //如果本事件编号变量的值大于95,那么本事件就可以穿透,否则不可以穿透。 |
|
◆脚本:this.wait(this.eventId()); ◆注释:1楼说了那么多,如果没有耐心去看的话, : :直接在characters文件夹方法1.png和2.png : :然后1号事件页和2号事件页都这样设置, : :就可以看到它们各自读取他们编号的图片了。 : : : :至于为什么不直接指定文件名,因为复制粘贴就可以搞定,好像可以配合下面这些插件。 ◆注释:在 NRP 磁贴上自动生成事件 - NRP_TileToEvent.js : :https://plugin-mz.fungamemake.com/archives/2860 : :MNKR SAN 自动随机映射生成 - MNKR_SAN_MapGenerator.js : :https://plugin-mz.fungamemake.com/archives/1397 : :动态事件生成 - EventReSpawn.js : :https://plugin-mz.fungamemake.com/archives/212 ◆脚本:i = this.eventId(); : :ImageManager.loadCharacter = function(filename) { : : filename = i : : return this.loadBitmap("img/characters/", filename); : :}; : :$gameMap.event(this.eventId()).setImage("i",0) |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2025-11-4 07:23
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.