Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] Russian Roulette NPC

Status
Not open for further replies.
Joined
Apr 12, 2008
Messages
998
Reaction score
612
EDIT: Sorry for the errors in this one, i will be releasing this after im 100% done with it, it will have over 50 outcomes ranging from Balrogs spawning to winning a jackpot to having NX slimes spawn





First you need to add this crap into NPCConversationManager.java
PHP:
public void setMP(int MP) {
getPlayer().setMP(MP);
getPlayer().updateSingleStat(MapleStat.MP, Integer.valueOf(MP));
}
public void setHP(int hp) {
getPlayer().sethp(hp);
getPlayer().updateSingleStat(MapleStat.HP, Integer.valueOf(hp));
}
Then add this to MapleCharacter...
PHP:
public void setMP(int MP) {
        this.mp = mp-1;
    }

    public void sethp(int hp) {
        this.hp = hp-1;
    }
PHP:
/*
Base Script by Luke(Roamer in RaGEZONE)
poop done by RaptorJesus, go ahead and claim it as your own cause i made this in like 3 mins while chatting to Supi, Airflow, Steve and my other faggots on IRC.
*/

importPackage(net.sf.odinms.client);

var status = 0;
var fee;
var chance = Math.floor(Math.random()*6+1);

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

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0) {
            cm.sendOk("Later suckka....");
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            cm.sendNext("Hey man, lets play some #bRussian Roulette#k If you win, you can keep your mesos, but if you loose...Well...Thats it...Oh, also the fee to play is 5k mesos...");
        } else if (status == 1) {
            cm.sendGetText("How many mesos would you like to bet?");
        } else if (status == 2) {
            fee = cm.getText();
            cm.sendYesNo("Are you sure you want to bet #r" + fee + "#k Mesos?... ");
        } else if (status == 3) {
            if (cm.getMeso() < fee) {
                cm.sendOk("You Amount of mesos you Gamble cannot exceed the current amount of mesos in your inventory idiot!! ");
                cm.dispose();
            } else if (cm.getText() < 0) {
                cm.sendOk("You can't gamble less than 0 Mesos...");
                cm.dispose();
            } else {
                if (chance <= 1) {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }
                else if (chance == 2) {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }
                else if (chance == 3) {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }
else if (chance == 4) {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }
else if (chance == 5) {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }
                else if (chance >= 6) {
                    cm.gainMeso(fee * 2);
                    cm.gainMeso(-5000);
                    cm.sendNext("You pass the gun back to the man, he hands you your cash and you walk away...");
                    cm.dispose();
                }
            }
        }
    }
}
 
Last edited:
Newbie Spellweaver
Joined
Dec 11, 2008
Messages
87
Reaction score
1
Rather than add those to NPC conversation manager, you could simply use
cm.getChar().setMp(cm.getChar().getMp() - amount) and vice versa for HP.

I believe that's the right one, but bleh, I don't usually do NPC work with HP or MP.

lol o.o
 
Getting into Graphics
Joined
Jun 22, 2008
Messages
173
Reaction score
0
Umm..
1/5 chance, all you can win back is 5,000 mesos.
When you win, you gain doule your mesos then you loose 5k. ^_^
 
Experienced Elementalist
Joined
Dec 12, 2008
Messages
287
Reaction score
0
PHP:
if (chance >= 6) {
                    cm.gainMeso(fee * 2);
                    cm.gainMeso(-5000);
                    cm.sendNext("You pass the gun back to the man, he hands you your cash and you walk away...");
                    cm.dispose();
                } else {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }

Why not use this instead of copying over and over
 
Burn the land,
Loyal Member
Joined
Aug 7, 2008
Messages
1,903
Reaction score
17
PHP:
if (chance >= 6) {
                    cm.gainMeso(fee * 2);
                    cm.gainMeso(-5000);
                    cm.sendNext("You pass the gun back to the man, he hands you your cash and you walk away...");
                    cm.dispose();
                } else {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }

Why not use this instead of copying over and over
Because sometimes, people forget. :*:

Anyway, nice release :D
 
Newbie Spellweaver
Joined
Sep 15, 2008
Messages
63
Reaction score
1
Hmm this is very much the same as the gambling npc,is just that the content not the same.
Anyway nice release
 
Newbie Spellweaver
Joined
Dec 14, 2008
Messages
14
Reaction score
0
Lol nice release xD
@dragonsin53 nice siggy LOL.

Though you could make it much smaller. No need to redo all the chances ;)
PHP:
                 if (chance >= 1 && chance <=5) {
                    cm.gainMeso(-fee);
                    cm.gainMeso(-5000);
                    cm.setHP(0);
                    cm.setMP(0);
                    cm.sendNext("Well it looks like you shot yourself in the temple...Good luck with that...");
                    cm.dispose();
                }
                else if (chance >= 6) {
                    cm.gainMeso(fee * 2);
                    cm.gainMeso(-5000);
                    cm.sendNext("You pass the gun back to the man, he hands you your cash and you walk away...");
                    cm.dispose();
                }

EDIT: Oops it's up here :D I didn't read that post. Anyway this is a good way
 
Experienced Elementalist
Joined
May 29, 2008
Messages
241
Reaction score
0
this reminds me of roulette npcs in Ragnarok online p servers lolol.
 
Experienced Elementalist
Joined
Dec 12, 2008
Messages
287
Reaction score
0
PHP:
} else if (cm.getText() < 0) {

change that to

PHP:
} else if (fee < 0) {
 
Status
Not open for further replies.
Back
Top