gh5591328 发表于 2022-3-2 11:41:08

萌新求问,怎么做一个可以在游戏里面刷道具的npc

怎么做一个可以在游戏里面刷道具的npc,只要输入物品代码就能等到这个道具的脚本

make950310 发表于 2022-3-4 14:42:52

本帖最后由 make950310 于 2022-3-4 14:53 编辑

自己在论坛找一些冒险岛基本的函数介绍看一下,多看看别人写的脚本然后照葫芦画瓢就行。
把我下面写的代码复制到你想放到的NPC里就行。
function start() {

    status = -1;

    action(1, 0, 0);
}
function action(mode, type, selection) {
    if (mode == -1) {
      cm.dispose();
    } else {
      if (status >= 0 && mode == 0) {

            cm.sendOk("欢迎下次光临。");
            cm.dispose();
            return;
      }
      if (mode == 1) {
            status++;
      }
      else {
            status--;
      }
      if (status == 0) {
                        cm.sendGetNumber("在下方输入框内输入道具代码获取相应道具:", 0, 1, 999999999);
                } else if (status == 1){
                        道具 = selection;
                        cm.sendGetNumber("你要获取的道具为: #i"+ 道具 +"#\r\n\r\n请确认道具后输入想获取的数量:", 0, 1, 999999999);
                } else if (status == 2 ){
                        数量 = selection;
                        cm.gainItem(道具,数量);
                        cm.sendOk("获取道具: #i"+ 道具 +"#\r\n获取数量: " + 数量 + "");
                        cm.dispose();
                }
    }
}
页: [1]
查看完整版本: 萌新求问,怎么做一个可以在游戏里面刷道具的npc