- 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:
Gachapon Ticket Seller:
Have fun with it
***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: