Music playing NPC

Status
Not open for further replies.
Skilled Illusionist
Joined
May 5, 2008
Messages
352
Reaction score
0
:::Song NPC:::​

First you'll to put this in net.sf.odinms.scripting.npc.NPCConversationManager
Code:
 public void playMusic(String music) {
                getPlayer().getMap().broadcastMessage(MaplePacketCreator.musicChange(music));
    }

Now just save the script below as a .js and name it to the NPC u want ^^


Code:
/*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]>
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation version 3 as published by
    the Free Software Foundation. You may not use, modify or distribute
    this program under any other version of the GNU Affero General Public
    License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/* JukeBox NPC
   Computer - 1052013
*/

var status = 0;

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0 && status == 0) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            cm.sendSimple("I can play some songs.#b\r\n#L0#FloralLife#l\r\n#L1#BadGuys#l\r\n#L2#Nightmare#l\r\n#L3#MissingYou#l\r\n#L4#PlayWithMe#l\r\n#L5#WhiteChristmas#l\r\n#L6#UponTheSky#l\r\n#L7#Shinin'Harbor#l\r\n#L8#Ariant#l\r\n#L9#ComeWithMe#l\r\n#L10#Fantasia#l\r\n#L11#Aquarium#l\r\n#L12#CokeTown#l\r\n#L13#Leafre#l\r\n#L14#Amoria#l\r\n#L15#Chapel#l\r\n#L16#FirstStepMaster#l\r\n ");
            } else if (status == 1) {
            if (selection == 0) {
                    cm.playMusic("Bgm00/FloralLife");
                    cm.dispose();
            } else if (selection == 1) {
                    cm.playMusic("Bgm01/BadGuys");
                    cm.dispose();
            } else if (selection == 2) {
                    cm.playMusic("Bgm00/Nightmare");
                    cm.dispose();
            } else if (selection == 3) {
                    cm.playMusic("Bgm02/MissingYou");
                    cm.dispose();
            } else if (selection == 4) {
                    cm.playMusic("Bgm04/PlayWithMe");
                    cm.dispose();
            } else if (selection == 5) {
                    cm.playMusic("Bgm04/WhiteChristmas");
                    cm.dispose();
            } else if (selection == 6) {
                    cm.playMusic("Bgm04/UponTheSky");
                    cm.dispose();
            } else if (selection == 7) {
                    cm.playMusic("Bgm04/Shinin'Harbor");
                    cm.dispose();
            } else if (selection == 8) {
                    cm.playMusic("Bgm14/Ariant");
                    cm.dispose();
            } else if (selection == 9) {
                    cm.playMusic("Bgm06/ComeWithMe");
                    cm.dispose();
            } else if (selection == 10) {
                    cm.playMusic("Bgm07/Fantasia");
                    cm.dispose();
            } else if (selection == 11) {
                    cm.playMusic("Bgm11/Aquarium");
                    cm.dispose();
            } else if (selection == 12) {
                    cm.playMusic("Bgm13/CokeTown");
                    cm.dispose();
            } else if (selection == 13) {
                    cm.playMusic("Bgm13/Leafre");
                    cm.dispose();
            } else if (selection == 14) {
                    cm.playMusic("BgmGL/amoria");
                    cm.dispose();
            } else if (selection == 15) {
                    cm.playMusic("BgmGL/chapel");
                    cm.dispose();
            } else if (selection == 16) {
                    cm.playMusic("BgmJp/FirstStepMaster");
                    cm.dispose();
              }
        }
    }
}



credits to jordanhenry
 
Re: [Release] Music playing NPC

Here's a direct repost of mine from that thread
Code:
/*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]>
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation version 3 as published by
    the Free Software Foundation. You may not use, modify or distribute
    this program under any other version of the GNU Affero General Public
    License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

var songs = Array("Bgm00/FloralLife","Bgm00/GoPicnic","Bgm00/Nightmare","Bgm00/RestNPeace","Bgm00/SleepyWood","Bgm01/AncientMove","Bgm01/BadGuys","Bgm01/CavaBien","Bgm01/HighlandStar","Bgm01/MoonlightShadow","Bgm01/WhereTheBarlogFrom","Bgm02/AboveTheTreetops","Bgm02/EvilEyes","Bgm02/JungleBook","Bgm02/MissingYou","Bgm02/WhenTheMorningComes","Bgm03/Beachway","Bgm03/BlueSky","Bgm03/Elfwood","Bgm03/SnowyVillage","Bgm03/Subway","Bgm04/ArabPirate","Bgm04/PlayWithMe","Bgm04/UponTheSky","Bgm04/WarmRegard","Bgm04/WhiteChristmas","Bgm05/AbandonedMine","Bgm05/DownToTheCave","Bgm05/HellGate","Bgm05/MineQuest","Bgm05/WolfWood","Bgm06/ComeWithMe","Bgm06/FantasticThinking","Bgm06/FinalFight","Bgm06/FlyingInABlueDream","Bgm06/WelcomeToTheHell","Bgm07/Fantasia","Bgm07/FunnyTimeMaker","Bgm07/HighEnough","Bgm07/WaltzForWork","Bgm07/WhereverYouAre","Bgm08/FindingForest","Bgm08/ForTheGlory","Bgm08/LetsHuntAliens","Bgm08/LetsMarch","Bgm08/PlotOfPixie","Bgm09/DarkShadow","Bgm09/FairyTale","Bgm09/FairyTalediffvers","Bgm09/TheyMenacingYou","Bgm09/TimeAttack","Bgm10/BizarreTales","Bgm10/Eregos","Bgm10/TheWayGrotesque","Bgm10/Timeless","Bgm10/TimelessB","Bgm11/Aquarium","Bgm11/BlueWorld","Bgm11/DarkMountain","Bgm11/DownTown","Bgm11/ShiningSea","Bgm12/AcientRemain","Bgm12/AquaCave","Bgm12/DeepSee","Bgm12/RuinCastle","Bgm12/WaterWay","Bgm13/CokeTown","Bgm13/Leafre","Bgm13/Minar'sDream","Bgm13/AcientForest","Bgm13/TowerOfGoddess","Bgm14/DragonLoad","Bgm14/HonTale","Bgm14/CaveOfHontale","Bgm14/DragonNest","Bgm14/Ariant","Bgm14/HotDesert", "Bgm15/MureungHill","Bgm15/MureungForest","Bgm15/WhiteHerb","Bgm15/Pirate","Bgm15/SunsetDesert","BgmEvent/FunnyRabbit","BgmEvent/FunnyRabbitFaster","BgmGL/amoria","BgmGL/Amorianchallenge","BgmGL/cathedral","BgmGL/chapel","BgmJp/Bathroom","BgmJp/BattleField","BgmJp/BizarreForest","BgmJp/Feeling","BgmJp/FirstStepMaster","BgmJp/Hana","BgmJp/Yume","BgmUI/ShopBgm","BgmUI/Title","BgmUI/WCSelect");
var songs_name = Array("Floral Life","Go Picnic","Nightmare","Rest In Peace","Sleepy Wood","Ancient Move","Bad Guys","Cava Bien","Highland Star","Moonlight Shadow","Where The Barlog From","Above The Treetops","Evil Eyes","Jungle Book","Missing You","When The Morning Comes","Beachway","Blue Sky","Elfwood","Snowy Village","Subway","Pirates!","Play With Me","Upon The Sky","Warm Regard","White Christmas","Abandoned Mine","Down To The Cave","Hell Gate","Mine Quest","Wolf Wood","Come With Me","Fantastic Thinking","Final Fight(Zakum)","Flying In A Blue Dream","Welcome To Hell","Fantasia","Funny Time Maker","High Enough","Waltz For Work","Wherever You Are","Finding Forest","For The Glory","Lets Hunt Aliens","Lets March","Plot Of Pixie","Dark Shadow","Fairy Tale","Fairy TaleB","They Menacing You","Time Attack","Bizarre Tales","Eregos","The Way Grotesque","Timeless","TimelessB","Aquarium","Blue World","Dark Mountain","Down Town","Shining Sea","Ancient Remain","Aqua Cave","Deep Sea","Ruined Castle","Water Way","Coke Town","Leafre","Minar's Dream","Ancient Forest","Tower Of Goddess","Dragon Load","Horn Tail(Battle)","Cave Of Horn Tail","Dragon Nest","Ariant","Hot Desert", "Mureung Hill","Mureung Forest","White Herb","Pirate","Sunset Desert","Funny Rabbit","Funny Rabbit Faster","Amoria","Amoria Challenge","Cathedral","Chapel","Bathroom","BattleField","Bizarre Forest","Feeling","First Step Master","Hana","Yume","Cash Shop","Title","WCSelect");

var cost = 5000000;
var Message = "Hey I'm a jukebox!\r\nPick a song, it only costs " + cost + "!";

function start() {
    for (var i = 0; i < songs_name.length; i++)
            Message += "\r\n#L" + i + "# " + songs_name[i] + "#l";
    cm.sendSimple(Message);
}

function action(mode, type, selection) {
    if(cm.getMeso() > (cost - 1))
    {
        cm.playMusic(songs[selection]);
        cm.gainMeso(-cost);
    }
    else
        cm.sendOk("You must have at least " + cost + " mesos to play a song!");
    cm.dispose();
}
 
Re: [Release] Music playing NPC

Looks nice even if it is taken, You edited around the script a bit, at least you gave credit.
Although this is completely a useless NPC to have in general very nice work :).

I might use it just for the hek of it.
 
Re: [Release] Music playing NPC

There are a few New Leaf City songs left out.

BgmGL/NLCtown
BgmGL/NLChunt
BgmGL/NLCupbeat
BgmGL/HauntedHouse
 
Re: [Release] Music playing NPC

Haha! This is awesome, nice release!
 
Re: [Release] Music playing NPC

Cewl im gonna try it ! :D


OFF Topic : to Luky Jay : Lol ur sig thing of speedtest.net * FAKE * 645.217 upload speed impossible, it would be 10 times better as a dedicated server o.o
 
Status
Not open for further replies.
Back