-
[Help] Boss Spawner
i found this boss spawner and it is supposed to take 100m every time someone spawns a boss but it will still spawn a boss if they dont have money...
Code:
/* Marat
boss spawn npc
*/
var status = -1;
var x = 0
var mobs = Array();
var boss = Array(8800000, 8800100, 9400900, 8810026, 8810130, 8500002, 8820000, 8180001, 8180000, 8840000, 9420547, 9420542, 8850011, 9420067);
function action(mode, type, selection) {
if (mode == 1) {
status++;
} else {
if (status == 2) {
cm.sendNext("test");
}
status--;
}
if (status == 0) {
var talk = "Hello i am the BOSS SPWNER NPC! I can help you train by spawning varius different types of bosses.\r\n";
var ttalk = "Dont forget to kill the bosses!\r\n";
for(var t = 0; t < mobs.length; t++){
ttalk += "#L"+ t +"##o"+ mobs[t] +"# x15#l\r\n";
}
var btalk = "\r\n Please select a boss. It will cost 100m to spawn, so choose carefully.:\r\n";
for(var b = mobs.length; b < mobs.length + boss.length; b++){
btalk += "#L"+ b +"##o"+ boss[b - mobs.length] +"##l\r\n";
}
talk += ttalk;
talk += btalk;
cm.sendSimple(talk);
cm.gainMeso(-100000000);
} else if (status == 1) {
if(selection >= mobs.length){
cm.spawnMob(boss[selection - mobs.length], 1, 0);
cm.dispose();
}
else {
for(var a = 0; a <= 15; a++){
cm.spawnMob(mobs[selection], 1, 0);
}
cm.dispose();
}
}
}
-
Re: [Help] Boss Spawner
your code is really messy, you should arrange it because its hard to read.
anyways you should check if the player has the mesos before using gainMeso.
if not, dispose or something.
something like this
if(cm.getMeso() < 100000000) {
cm.sendOk("You don't have enough mesos");
cm.dispose();
}
else {
cm.gainMeso(-100000000);
spawn mob
}
-
Re: [Help] Boss Spawner
i tryed that .... itll say imnot coded
its fixed now, ty
-
Re: [Help] Boss Spawner
Here, took out all the useless crap. This should spawn 15 bosses for 100m and take 100m from their inventory. They won't be able to spawn mobs without that 100m. Like n Rep please.
PHP Code:
/* Marat
boss spawn npc
*/
var status = -1;
var boss = Array(8800000, 8800100, 9400900, 8810026, 8810130, 8500002, 8820000, 8180001, 8180000, 8840000, 9420547, 9420542, 8850011, 9420067);
function start()
{
action(1, 0, 0);
}
function action(mode, type, selection) {
status++;
if (mode != 1) {
cm.dispose();
return;
}
if (status == 0) {
if (cm.haveMeso(100000000)) {
var text = "Hello i am the BOSS SPWNER NPC! I can help you train by spawning varius different types of bosses.\r\n Please select a boss. It will cost 100m to spawn, so choose carefully.\r\n";
for (var i = 0; i < boss.Lenght; i++)
{
text += "\r\n#L" + i + "##o" + boss[i] + "##l";
}
text += "\r\n\r\nBe sure to kill any mobs still alive first.";
} else {
cm.sendOk("You don't have enough Mesos to use the Boss Spawner.");
cm.dispose();
}
} else if (status == 1) {
cm.spawnMob(boss[selection], 15);
cm.dispose();
}
}