Add this in NPCConversationManager.javaCode:public int getRandom(int start, int end) { return (int)Math.floor(Math.random()*end+start); }
how to use:
that would pick a random number between the 1 and the 100Code:int lol = cm.getRandom(1, 100);
this is a small release, but some of you might really need this
Quick example:
PHP Code:function start() {
switch(cm.getRandom(1, 100)) {
case 1:
cm.gainMeso(100000);
cm.sendOk("Whoa, you've just beaten a chance of 1:100\r\nHere, take 100k mesos!");
cm.dispose();
break;
case 2:
case 3:
case 4:
case 5:
case 6:
cm.gainMeso(50000);
cm.sendOk("Whoa, you've just beaten a chance of 1:20\r\nHere, take 50k mesos!");
cm.dispose();
break;
default:
cm.sendOk("You haven't won anything, sorry");
cm.dispose();
break;
}
}



Reply With Quote![[Small Release] Random number for npcs](http://ragezone.com/hyper728.png)


