[NPC] Mob Spawner, shortened

Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,131
Because I want to increase my e-penis I guess...

PHP:
menu = ["Papulatus Clock","Headless Horseman","Black Crow","Anego","Rooster","BigFoot","MushMom"];
mob = [8500001,9400549,9400014,9400121,9600001,9400575,9500124];
hp = [23000000,3500000,35000000,75000000,340,32000000,20000];
exp = [596000,300000,1780000,3900000,33,2660000,1200];
pServ = "WRITE SERVER NAME HERE";
status = 0;

function start() {
    if (cm.getPlayer().getMap().getMonsterCount() > 0)
        cm.sendOk("Sorry, there are some mobs already spawned. Kill them first.");
        cm.dispose();
    else{
        cm.sendNext("I summon Bosses for #b"+pServ+"#k. I summon 10 monsters at a time for free.");
    }
}

function action(m,t,s) {
    if (m > 0)
        status++;
    else{
        cm.dispose();
        return;
    }
    if (status == 1) {
        talk = "Please remember I will summon 10.\r\n\r\n";
        for (var i = 0; i < menu.length; i++)
            talk += "#L"+i+"#"+menu[i]+"#l\r\n";
        cm.sendSimple(talk + "#L7#Cleardrops#l\r\n#L8#Kill All Monsters#l");
    } else if (status == 2) {
        if (s == 7) {
            cm.cleardrops();
        } else if (s == 8) {
            cm.killAllMonsters(true);
        }else{
            cm.summonMob(mob[s],hp[s],exp[s],10);
        }
        cm.dispose();
    }
}

PHP:
public int getMonsterCount() {
                List<MapleMapObject> monsters = getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
                return monsters.size();
        }
PHP:
public void summonMob(int mobid, int customHP, int customEXP, int amount) {
        MapleMonsterStats newStats = new MapleMonsterStats();
        if (customHP > 0) {
            newStats.setHp(customHP);
        }
        if (customEXP >= 0) {
            newStats.setExp(customEXP);
        }
        if (amount <= 1) {
            MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
            npcmob.setOverrideStats(newStats);
            npcmob.setHp(npcmob.getMaxHp());
            getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, getPlayer().getPosition());
        } else {
            for (int i = 0; i < amount; i++) {
                MapleMonster npcmob = MapleLifeFactory.getMonster(mobid);
                npcmob.setOverrideStats(newStats);
                npcmob.setHp(npcmob.getMaxHp());
                getPlayer().getMap().spawnMonsterOnGroudBelow(npcmob, getPlayer().getPosition());
            }
        }
    }
PHP:
public void cleardrops() {
    MapleMonsterInformationProvider.getInstance().clearDrops();
    }
PHP:
public void killAllMonsters(int mapid) {
           MapleMap map = c.getChannelServer().getMapFactory().getMap(mapid);
           map.killAllMonsters(false); // No drop.
       }

If you are missing something, or would like to see the "original", go to this thread: http://forum.ragezone.com/f427/boss-spawner-monster-spawner-631062/

Off Topic: I am fully prepared for the countless posts saying "OMGZ WEZ ALRE4DEY HAVE DIZ."... Flame away, I'm bored :(


EDIT: To make it more "noob" friendly, let me explain how to edit it.

PHP:
menu = ["Papulatus Clock","Headless Horseman","Black Crow","Anego","Rooster","BigFoot","MushMom"];
mob = [8500001,9400549,9400014,9400121,9600001,9400575,9500124];
hp = [23000000,3500000,35000000,75000000,340,32000000,20000];
exp = [596000,300000,1780000,3900000,33,2660000,1200];

In a short explanation, the first selection in the menu that shows up would be Papulatus. 8500001 in the mob array is Papulatus' ID. 23000000 in the hp array is how much HP he'll have when spawned. 5960000 in the exp array is how much exp he will give. NOTE: You multiple the exp number by your exp rate to find the actual amount.

Another example. The 3rd selection is Black Crow. 9400014 in the mob array is Black Crows' ID. 35000000 in the hp array is the amount of HP he will have when spawned. 1780000 in the exp array is how much exp he will have.

So to sum it up, basically put them in the order they will appear. First choice goes first, second goes second, etc etc. It's very easy to understand...
 
Last edited:
Re: Mob Spawner, shortened

Not to be noob but, it's divided into 5 codes, where do all of them go?
Also, bookmarked for later :)
 
Re: Mob Spawner, shortened

well i never played with mobs before and i haven't been in development for awhile now i just started again, lawl

You can get it from the !killall command.
you know how it shows
"xxx mobs has been killed"
 
Re: Mob Spawner, shortened

Where would I add

PHP:
public int getMonsterCount() {
                List<MapleMapObject> monsters = getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
                return monsters.size();
        }

Thanks for you help!
 
Back