Ok so I use a Ice Tear event system and I made this npc. You can change the item they gamble to whatever you want, I really don't care. Here's the NPC.
PHP Code:
var status = -1;
var chance = Math.floor(Math.random()*4+1);
function start()
{
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1)
status++;
else
status--;
if (status == -1) {
cm.dispose();
} else if (status == 0) {
cm.sendYesNo("Would you like to gamble a #rIce Tear#k? #bDo not try to Gamble without an #rIce Tear#b or your character will become stuck. If this happens you need to type @dispose to unstick your character#k.");
} else if (status == 1) {
if(cm.haveItem(4000415)) {
if (chance <= 1) {
cm.gainItem(4000415, -1);
cm.sendNext("#bTough luck... Maybe next time you will win! ");
cm.dispose();
}
else if (chance == 2) {
cm.gainItem(4000415, -1);
cm.sendNext("#bTough luck... Maybe next time you will win! ");
cm.dispose();
}
else if (chance == 3) {
cm.gainItem(4000415, -1);
cm.sendNext("#bTough luck... Maybe next time you will win! ");
cm.dispose();
}
else if (chance >= 4) {
cm.gainItem(4000415, 1);
cm.sendNext("#rGood Job! You won!");
cm.dispose();
} else {
cm.sendNext("You don't have an #rIce Tear#k");
cm.dispose();
}
cm.dispose();
}
}
}
FLAMES SHIELD OFF