累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 2026-7-12 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
29903
OK点
16
推广点
0
同能卷
50
积分 38745
I have made a working plugin for the Konami Code that you can activate at anytime during gameplay, this to activate a control switch (by default Switch 3, because that's what I needed it for). Use it for whatever, doesn't matter.
It is free for anyone to use, commercial or otherwise. No restrictions.
Up, up, down, down, left, right, left, right, B, A (X, Z on keyboard).
Download it here
JavaScript:
/*: * @plugindesc Triggers a control switch (Switch 3) when the Konami Code is entered at any time. * @thenbexperience * * @help * This plugin triggers Switch 3 when the Konami Code is entered: * Up, Up, Down, Down, Left, Right, Left, Right, B, A */ (function() { const switchId = 3; // Switch ID to be activated const konamiCode = [ 38, 38, // Up, Up 40, 40, // Down, Down 37, 39, // Left, Right 37, 39, // Left, Right 88, 90 // B, A (X, Z in RPG Maker MV) ]; let inputSequence = []; const checkKonamiCode = () => { if (inputSequence.length === konamiCode.length) { if (JSON.stringify(inputSequence) === JSON.stringify(konamiCode)) { $gameSwitches.setValue(switchId, true); console.log('Konami Code entered! Switch ' + switchId + ' is now ON.'); inputSequence = []; // Reset the input sequence } } }; const inputHandler = (event) => { inputSequence.push(event.keyCode); if (inputSequence.length > konamiCode.length) { inputSequence.shift(); // Keep only the last N inputs } checkKonamiCode(); }; // Add the event listener for keydown document.addEventListener('keydown', inputHandler); })(); 复制代码
本贴来自国际rpgmaker官方论坛作者:Deleted member 270061处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/konami-code-plugin.172202/