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!

GMS-Style Gachapon NPC Bundle

Newbie Spellweaver
Joined
Oct 6, 2010
Messages
26
Reaction score
10
Alright Guys. Here's my release of a template for a Gachapon Ticket Seller as well as the actual Gachapon Script.

***UPDATED***


Gachapon Script:
PHP:
/* Created by DejaVu
    ConstantMS
    Gachapon NPC   */
prizes=[INSERT, ITEM, IDS, HERE, AS, AN, ARRAY]; // Insert your item ID's here
random=Math.floor(Math.random() * prizes.length++);
var chunkymonkey=0;  

function start() {
    cm.sendYesNo("Would you like to use your Gachapon Ticket?");
}

function action(m,t,s){
    cm.dispose();
    if(m<1){
        cm.dispose();
    }else{
        chunkymonkey++;  
    }
    if(chunkymonkey==1){  
        if(cm.haveItem(5220000,1)){   // edit this item ID to whatever you want (I used the reg gachapon ticket)
            cm.gainItem(prizes[random],1);
            cm.gainItem(5220000,-1);  // if you changed the above ID, make sure you change this one too
        }else{
            cm.sendOk("Come back when you have a Gachapon Ticket");
            cm.dispose();
        }
    }else{
        cm.sendOk("Come back when your ready to take a chance at fortune!");
        cm.dispose();
    }
}

Gachapon Ticket Seller:
PHP:
/* Created by DejaVu
    ConstantMS
    Gachapon Ticket Seller */
var bananabreath=0;  

function start(){  // Edit the <TICKET PRICE> and <DISCOUNT PRICE> texts with your price & discount price
    cm.sendGetText("#rHello #h #! I sell single Gachapon Tickets for <TICKET PRICE> each, but if you choose to buy either 5, 10, 15, or 20, you will recieve a discount. \r\n#b5 tickets: <DISCOUNT PRICE> \r\n10 tickets: <DISCOUNT PRICE> \r\n15 tickets: <DISCOUNT PRICE> \r\n20 tickets: <DISCOUNT PRICE> \r\n#r#eEnter the number of Gachapon Tickets you would like to buy:#n#k");
}

function action(m,t,s){
    if(m!=1){
        cm.dispose();
    }else{
        bananabreath++;  
    }
    if(bananabreath==1){ 
        var tickets=cm.getText(); // This is where the discount tickets come into effect:
        if(tickets==5||tickets==10||tickets==15||tickets==20){
            var price=tickets*<YOUR DISCOUNT MULTIPLIER>; // Edit <YOUR DISCOUNT MULTIPLIER> for the number of tickets to be multiplied by to get your total meso value. [[ IF I WANT 5 TICKETS TO COST 50,000,000 MESOS, I INPUT 10,000,000 IN THE <DISCOUNT PRICE MULTIPLIER> ] [BE CAREFUL!! THIS NUMBER APPLIES TO ALL DISCOUNTS]]
            if(cm.getMeso()>=price){
                cm.sendOk("#eHere ya go. It only cost you "+price+" mesos#n");
                cm.gainItem(5220000,tickets);
                cm.gainMeso(-price);
                cm.dispose();
            }else{
                cm.sendOk("#eYou don't have enough mesos!#n");
                cm.dispose();
            }
        }else{
            var price=tickets*<TICKET PRICE>;  // Edit <TICKET PRICE> to the cost of a single Gachapon Ticket
            if(cm.getMeso()>=price){
                cm.sendOk("#eHere ya go. It only cost you "+price+" mesos#n");
                cm.gainItem(5220000,tickets);
                cm.gainMeso(-price);
                cm.dispose();
            }else{
                cm.sendOk("#eYou don't have enough mesos!#n");
                cm.dispose();
            }
        }
    }
}

Have fun with it :)
 
Last edited:
Newbie Spellweaver
Joined
Oct 6, 2010
Messages
26
Reaction score
10
It doesn't look GMS-Like, but it functions like a GMS one would when presented with a gachapon ticket (selecting a random item and giving it to them)
 
Junior Spellweaver
Joined
Nov 18, 2008
Messages
106
Reaction score
1
Hey give him props for putting comments "//" to help out the beginners to the maple community. *thanks*
 
Newbie Spellweaver
Joined
Jan 16, 2011
Messages
55
Reaction score
2
I can't get the "Gachapon Ticket Seller" to work.
What am I doing wrong? (other script works fine.)
DejaVu - GMS-Style Gachapon NPC Bundle - RaGEZONE Forums
 
Skilled Illusionist
Joined
Dec 16, 2010
Messages
304
Reaction score
164
Read the comments in line 19, and line 30. I suggest opening it in notepad++ if you want to see which line is which. But just look for the lines with orange comments.
 
Newbie Spellweaver
Joined
Jan 16, 2011
Messages
55
Reaction score
2
var price=tickets*<YOUR DISCOUNT MULTIPLIER>; // Edit <YOUR DISCOUNT MULTIPLIER> for the number of tickets to be multiplied by to get your total meso value. [[ IF I WANT 5 TICKETS TO COST 50,000,000 MESOS, I INPUT 10,000,000 IN THE <DISCOUNT PRICE MULTIPLIER> ] [BE CAREFUL!! THIS NUMBER APPLIES TO ALL DISCOUNTS]]

would this be fine?
var price=tickets*10,000,000

var price=tickets*<TICKET PRICE>; // Edit <TICKET PRICE> to the cost of a single Gachapon Ticket

var price=tickets*10,000,000
 
Back
Top