Jump to content

Question

Posted

hello is there anyway to add option to this script example i want to add 10 rolls 20 rolls and 50 rolls 

 

Quote

turbo_room,88,139,5    script    PVP Gacha NPC    478,{
    mes "[ ^FF7700PVP Girl^000000 ]";
    mes "Hello Adventurer! Are you out";
    mes "shopping in the city?!";
    next;
    mes "[ ^FF7700PVP Girl^000000 ]";
    mes "I'm PVP Girl! I'll exchange cool";
    mes "Get a Change to Win Random ";
    mes "Prizes for every ^ff00005 PVP Ticket^000000.";
    mes "you can get ^26A7DFPVP Tickets^000000 in our Grand Arena  ";
    next;
    mes "[ ^FF7700PVP Girl^000000 ]";
    mes " Consumables:";
    mes "<ITEM>^0000ff2x Light White Potion ^000000<INFO>11501</INFO></ITEM>";    
    mes "<ITEM>^0000ff2x Light Blue Potion ^000000<INFO>11502</INFO></ITEM>";
    mes "<ITEM>^0000ff1x Ticket for Kafra Storage ^000000<INFO>7059</INFO></ITEM>";
    mes "<ITEM>^0000ff1x Agility Scroll ^000000<INFO>12216</INFO></ITEM>";    
    mes "<ITEM>^0000ff1x Blessing Scroll ^000000<INFO>12215</INFO></ITEM>";        
    next;
    mes "Grand Prize:[1%]";
    mes "<ITEM>^00bfffC. PVP Ticket ^000000<INFO>61966</INFO></ITEM>";
    next;
    if (countitem(7960) < 5) goto L_Sorry;
    next;
    if(select("Deal me in!:No way...")==2)
        close;
        mes "[ ^FF7700PVP Girl^000000 ]";
        mes "Here we go...";
        delitem 7960,5;
        set .@Total,9;
        setarray .@P1[0],1,61966,1;  // PVP Ticket
        setarray .@P2[0],50,11501,5; // Light Whites
        setarray .@P3[0],50,11502,5; // Light Blues        
        setarray .@P4[0],40,12216,5; // Agi scroll 5x
        setarray .@P5[0],40,12215,5; // Blessing Scroll 5x        
        setarray .@P6[0],30,7059,1;  // Kafra Storage            
        setarray .@P7[0],80,909,1;   // Royal Jelly
        setarray .@P8[0],100,909,1;  // Royal Jelly
        setarray .@P9[0],100,909,1;  // Royal Jelly    
    do{
        set .@i, rand(1,.@Total);
    }while( rand(1,100) > getd(".@P"+.@i+"[0]") );
    
    for(set .@j,1; .@j<getarraysize(getd(".@P"+.@i)); set .@j,.@j+2)
    {
        getitem getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
        if (!.@k[0])
        {
            set .@gz,.@i;
            setarray .@k[0], getd(".@P"+.@i+"["+.@j+"]"), getd(".@P"+.@i+"["+(.@j+1)+"]");
            break;
        }
    }
    if( .@gz && .@gz <= 1 )
    announce "Congratulations! "+strcharinfo(0)+" just received "+getitemname(.@k[0])+" x "+.@k[1]+" from  PVP Gacha  NPC",0;
    specialeffect2 248;
    close;
L_Sorry:
    mes "[ ^FF7700PVP Girl^000000 ]";
    mes "You don't have enough PVP Gacha Ticket, please get some";
    close;
OnTimer0050:
        showscript "PVP Gacha", getnpcid(0);
        initnpctimer;
        end;
OnInit:
        initnpctimer;
        end;
}

maintown,37,18,5    duplicate(PVP Gacha NPC)    PVP Gacha NPC#prt1    478
 

 

11 answers to this question

Recommended Posts

  • 0
Posted (edited)
On 2/9/2025 at 3:43 PM, Sallycantdance said:

hello is there anyway to add option to this script example i want to add 10 rolls 20 rolls and 50 rolls 

 

 

try this

	mes "Grand Prize:[1%]";
    mes "<ITEM>^00bfffC. PVP Ticket ^000000<INFO>61966</INFO></ITEM>";
    next;
	if(select("Deal me in!:No way...")==2)
        close;
	
	switch(select("1x Roll:10x Roll:20x Roll:50x Roll")){
		case 1:
			if (countitem(7960) < 5) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5;
			set .@roll_count, 1;
			break;
		case 2:
			if (countitem(7960) < 5*10) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5*10;
			set .@roll_count, 10;
			break;
		case 3:
			if (countitem(7960) < 5*20) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5*20;
			set .@roll_count, 20;
			break;
		case 4:
			if (countitem(7960) < 5*50) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5*50;
			set .@roll_count, 50;
			break;
	}
	
	set .@Total,9;
			setarray .@P1[0],1,61966,1;  // PVP Ticket
			setarray .@P2[0],50,11501,5; // Light Whites
			setarray .@P3[0],50,11502,5; // Light Blues        
			setarray .@P4[0],40,12216,5; // Agi scroll 5x
			setarray .@P5[0],40,12215,5; // Blessing Scroll 5x        
			setarray .@P6[0],30,7059,1;  // Kafra Storage            
			setarray .@P7[0],80,909,1;   // Royal Jelly
			setarray .@P8[0],100,909,1;  // Royal Jelly
			setarray .@P9[0],100,909,1;  // Royal Jelly
	
	for ( .@i = 1; .@i <= .@roll_count; .@i++) {
		set .@roll, rand(1, .@Total);
		
		while (rand(1, 100) > getd(".@P" + .@roll + "[0]")) {
			set .@roll, rand(1, .@Total);
    }
	
    for (set .@j, 1; .@j < getarraysize(getd(".@P" + .@roll)); set .@j, .@j + 2) {
        getitem getd(".@P" + .@roll + "[" + .@j + "]"), getd(".@P" + .@roll + "[" + (.@j + 1) + "]");
        if (!.@k[0]) {
            set .@gz, .@roll;
            setarray .@k[0], getd(".@P" + .@roll + "[" + .@j + "]"), getd(".@P" + .@roll + "[" + (.@j + 1) + "]");
            break;
        }
    }
	
    if (.@gz && .@gz <= 1) {
        announce "Congratulations! " + strcharinfo(0) + " just received " + getitemname(.@k[0]) + " x " + .@k[1] + " from PVP Gacha NPC", 0;
    }
    specialeffect2 248;
}

close;

 

Edited by GiovanT
  • 0
Posted
On 2/11/2025 at 3:39 PM, GiovanT said:

try this

	mes "Grand Prize:[1%]";
    mes "<ITEM>^00bfffC. PVP Ticket ^000000<INFO>61966</INFO></ITEM>";
    next;
	if(select("Deal me in!:No way...")==2)
        close;
	
	switch(select("1x Roll:10x Roll:20x Roll:50x Roll")){
		case 1:
			if (countitem(7960) < 5) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5;
			set .@roll_count, 1;
			break;
		case 2:
			if (countitem(7960) < 5*10) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5*10;
			set .@roll_count, 10;
			break;
		case 3:
			if (countitem(7960) < 5*20) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5*20;
			set .@roll_count, 20;
			break;
		case 4:
			if (countitem(7960) < 5*50) goto L_Sorry;
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "Here we go...";
			delitem 7960,5*50;
			set .@roll_count, 50;
			break;
	}
	
	set .@Total,9;
			setarray .@P1[0],1,61966,1;  // PVP Ticket
			setarray .@P2[0],50,11501,5; // Light Whites
			setarray .@P3[0],50,11502,5; // Light Blues        
			setarray .@P4[0],40,12216,5; // Agi scroll 5x
			setarray .@P5[0],40,12215,5; // Blessing Scroll 5x        
			setarray .@P6[0],30,7059,1;  // Kafra Storage            
			setarray .@P7[0],80,909,1;   // Royal Jelly
			setarray .@P8[0],100,909,1;  // Royal Jelly
			setarray .@P9[0],100,909,1;  // Royal Jelly
	
	for ( .@i = 1; .@i <= .@roll_count; .@i++) {
		set .@roll, rand(1, .@Total);
		
		while (rand(1, 100) > getd(".@P" + .@roll + "[0]")) {
			set .@roll, rand(1, .@Total);
    }
	
    for (set .@j, 1; .@j < getarraysize(getd(".@P" + .@roll)); set .@j, .@j + 2) {
        getitem getd(".@P" + .@roll + "[" + .@j + "]"), getd(".@P" + .@roll + "[" + (.@j + 1) + "]");
        if (!.@k[0]) {
            set .@gz, .@roll;
            setarray .@k[0], getd(".@P" + .@roll + "[" + .@j + "]"), getd(".@P" + .@roll + "[" + (.@j + 1) + "]");
            break;
        }
    }
	
    if (.@gz && .@gz <= 1) {
        announce "Congratulations! " + strcharinfo(0) + " just received " + getitemname(.@k[0]) + " x " + .@k[1] + " from PVP Gacha NPC", 0;
    }
    specialeffect2 248;
}

close;

 

 

12345.png

  • 0
Posted

Try this.

 

// PVP Gacha NPC with Multi-Roll Options and Custom Notifications
prontera,194,140,4	script	PVP Gacha	100,{
	// NPC Introduction
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Hello Adventurer! Want to try your luck?";
	next;
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Exchange ^ff00005 PVP Tickets^000000 to roll for prizes!";
	mes "You can get ^26A7DFPVP Tickets^000000 in our Grand Arena!";
	next;
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Consumables:";
	mes "<ITEM>^0000ff2x Light White Potion ^000000<INFO>11501</INFO></ITEM>";    
	mes "<ITEM>^0000ff2x Light Blue Potion ^000000<INFO>11502</INFO></ITEM>";
	mes "<ITEM>^0000ff1x Ticket for Kafra Storage ^000000<INFO>7059</INFO></ITEM>";
	mes "<ITEM>^0000ff1x Agility Scroll ^000000<INFO>12216</INFO></ITEM>";    
	mes "<ITEM>^0000ff1x Blessing Scroll ^000000<INFO>12215</INFO></ITEM>";        
	next;
	mes "Grand Prize:[1%]";
	mes "<ITEM>^00bfffC. PVP Ticket ^000000<INFO>61966</INFO></ITEM>";
	next;

	// Check if player has at least 5 PVP Tickets
	if (countitem(7960) < 5) goto L_Sorry;

	// Roll Options
	switch (select("1 Roll (5 PVP Tickets):10 Rolls (50 PVP Tickets):20 Rolls (100 PVP Tickets):50 Rolls (250 PVP Tickets):No way...")) {
		case 1: set .Rolls, 1; set .Cost, 5; break;
		case 2: set .Rolls, 10; set .Cost, 50; break;
		case 3: set .Rolls, 20; set .Cost, 100; break;
		case 4: set .Rolls, 50; set .Cost, 250; break;
		case 5: close;
	}

	// Check if player has enough tickets
	if (countitem(7960) < .Cost) {
		mes "[ ^FF7700PVP Girl^000000 ]";
		mes "You don't have enough PVP Gacha Tickets!";
		close;
	}

	// Ask player how they want their rewards displayed
	switch(select("Show Every Roll:Just give me my rewards.")) {
		case 1: set .ShowEachRoll, 1; break;
		case 2: set .ShowEachRoll, 0; break;
	}

	// Remove PVP Tickets
	delitem 7960, .Cost;
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Here we go... Rolling " + .Rolls + " times!";
	next;

	// Prize Arrays
	set .@Total,9;
	setarray .@P1[0],1,61966,1;  // PVP Ticket (Grand Prize - 1%)
	setarray .@P2[0],50,11501,5; // Light Whites
	setarray .@P3[0],50,11502,5; // Light Blues        
	setarray .@P4[0],40,12216,5; // Agi scroll 5x
	setarray .@P5[0],40,12215,5; // Blessing Scroll 5x        
	setarray .@P6[0],30,7059,1;  // Kafra Storage            
	setarray .@P7[0],80,909,1;   // Royal Jelly
	setarray .@P8[0],100,909,1;  // Royal Jelly
	setarray .@P9[0],100,909,1;  // Royal Jelly    

	// Rolling Multiple Times
	set .@GrandPrizes, 0;
	for (set .@count, 0; .@count < .Rolls; set .@count, .@count + 1) {
		do {
			set .@i, rand(1, .@Total);
		} while (rand(1,100) > getd(".@P"+.@i+"[0]"));

		// Get the prize item
		set .@itemID, getd(".@P"+.@i+"[1]");
		set .@itemAmount, getd(".@P"+.@i+"[2]");

		// Give the item
		getitem .@itemID, .@itemAmount;

		// Show individual message per roll (if chosen)
		if (.ShowEachRoll) {
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "You won " + .@itemAmount + "x " + getitemname(.@itemID) + "!";
			next;
		} else {
			// Save rewards for summary later
			setarray .@SummaryID[getarraysize(.@SummaryID)], .@itemID;
			setarray .@SummaryAmount[getarraysize(.@SummaryAmount)], .@itemAmount;
		}

		// Announce ONLY if the player gets the grand prize
		if (.@itemID == 61966) {
			announce "Congratulations! " + strcharinfo(0) + " just received " + getitemname(.@itemID) + " x " + .@itemAmount + " from PVP Gacha NPC!", 0;
			specialeffect2 248;
			set .@GrandPrizes, .@GrandPrizes + 1;
		}
	}

	// If the player chose to receive everything at once, show a summary
	if (!.ShowEachRoll) {
		mes "[ ^FF7700PVP Girl^000000 ]";
		mes "Here are all your rewards:";
		for (set .@index, 0; .@index < getarraysize(.@SummaryID); set .@index, .@index + 1) {
			mes "- " + .@SummaryAmount[.@index] + "x " + getitemname(.@SummaryID[.@index]);
		}
		next;
	}

	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Thanks for playing! Come back again.";
	close;

L_Sorry:
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "You don't have enough PVP Gacha Tickets, please get some!";
	close;

OnTimer0050:
	showscript "PVP Gacha", getnpcid(0);
	initnpctimer;
	end;

OnInit:
	initnpctimer;
	end;
}

 

  • Upvote 1
  • 0
Posted
15 hours ago, Scanty said:

Try this.

 

// PVP Gacha NPC with Multi-Roll Options and Custom Notifications
prontera,194,140,4	script	PVP Gacha	100,{
	// NPC Introduction
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Hello Adventurer! Want to try your luck?";
	next;
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Exchange ^ff00005 PVP Tickets^000000 to roll for prizes!";
	mes "You can get ^26A7DFPVP Tickets^000000 in our Grand Arena!";
	next;
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Consumables:";
	mes "<ITEM>^0000ff2x Light White Potion ^000000<INFO>11501</INFO></ITEM>";    
	mes "<ITEM>^0000ff2x Light Blue Potion ^000000<INFO>11502</INFO></ITEM>";
	mes "<ITEM>^0000ff1x Ticket for Kafra Storage ^000000<INFO>7059</INFO></ITEM>";
	mes "<ITEM>^0000ff1x Agility Scroll ^000000<INFO>12216</INFO></ITEM>";    
	mes "<ITEM>^0000ff1x Blessing Scroll ^000000<INFO>12215</INFO></ITEM>";        
	next;
	mes "Grand Prize:[1%]";
	mes "<ITEM>^00bfffC. PVP Ticket ^000000<INFO>61966</INFO></ITEM>";
	next;

	// Check if player has at least 5 PVP Tickets
	if (countitem(7960) < 5) goto L_Sorry;

	// Roll Options
	switch (select("1 Roll (5 PVP Tickets):10 Rolls (50 PVP Tickets):20 Rolls (100 PVP Tickets):50 Rolls (250 PVP Tickets):No way...")) {
		case 1: set .Rolls, 1; set .Cost, 5; break;
		case 2: set .Rolls, 10; set .Cost, 50; break;
		case 3: set .Rolls, 20; set .Cost, 100; break;
		case 4: set .Rolls, 50; set .Cost, 250; break;
		case 5: close;
	}

	// Check if player has enough tickets
	if (countitem(7960) < .Cost) {
		mes "[ ^FF7700PVP Girl^000000 ]";
		mes "You don't have enough PVP Gacha Tickets!";
		close;
	}

	// Ask player how they want their rewards displayed
	switch(select("Show Every Roll:Just give me my rewards.")) {
		case 1: set .ShowEachRoll, 1; break;
		case 2: set .ShowEachRoll, 0; break;
	}

	// Remove PVP Tickets
	delitem 7960, .Cost;
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Here we go... Rolling " + .Rolls + " times!";
	next;

	// Prize Arrays
	set .@Total,9;
	setarray .@P1[0],1,61966,1;  // PVP Ticket (Grand Prize - 1%)
	setarray .@P2[0],50,11501,5; // Light Whites
	setarray .@P3[0],50,11502,5; // Light Blues        
	setarray .@P4[0],40,12216,5; // Agi scroll 5x
	setarray .@P5[0],40,12215,5; // Blessing Scroll 5x        
	setarray .@P6[0],30,7059,1;  // Kafra Storage            
	setarray .@P7[0],80,909,1;   // Royal Jelly
	setarray .@P8[0],100,909,1;  // Royal Jelly
	setarray .@P9[0],100,909,1;  // Royal Jelly    

	// Rolling Multiple Times
	set .@GrandPrizes, 0;
	for (set .@count, 0; .@count < .Rolls; set .@count, .@count + 1) {
		do {
			set .@i, rand(1, .@Total);
		} while (rand(1,100) > getd(".@P"+.@i+"[0]"));

		// Get the prize item
		set .@itemID, getd(".@P"+.@i+"[1]");
		set .@itemAmount, getd(".@P"+.@i+"[2]");

		// Give the item
		getitem .@itemID, .@itemAmount;

		// Show individual message per roll (if chosen)
		if (.ShowEachRoll) {
			mes "[ ^FF7700PVP Girl^000000 ]";
			mes "You won " + .@itemAmount + "x " + getitemname(.@itemID) + "!";
			next;
		} else {
			// Save rewards for summary later
			setarray .@SummaryID[getarraysize(.@SummaryID)], .@itemID;
			setarray .@SummaryAmount[getarraysize(.@SummaryAmount)], .@itemAmount;
		}

		// Announce ONLY if the player gets the grand prize
		if (.@itemID == 61966) {
			announce "Congratulations! " + strcharinfo(0) + " just received " + getitemname(.@itemID) + " x " + .@itemAmount + " from PVP Gacha NPC!", 0;
			specialeffect2 248;
			set .@GrandPrizes, .@GrandPrizes + 1;
		}
	}

	// If the player chose to receive everything at once, show a summary
	if (!.ShowEachRoll) {
		mes "[ ^FF7700PVP Girl^000000 ]";
		mes "Here are all your rewards:";
		for (set .@index, 0; .@index < getarraysize(.@SummaryID); set .@index, .@index + 1) {
			mes "- " + .@SummaryAmount[.@index] + "x " + getitemname(.@SummaryID[.@index]);
		}
		next;
	}

	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "Thanks for playing! Come back again.";
	close;

L_Sorry:
	mes "[ ^FF7700PVP Girl^000000 ]";
	mes "You don't have enough PVP Gacha Tickets, please get some!";
	close;

OnTimer0050:
	showscript "PVP Gacha", getnpcid(0);
	initnpctimer;
	end;

OnInit:
	initnpctimer;
	end;
}

 

wow thanks for this can you put overweight warning if the player is 70% weight the npc will tell him to clear his inventory ty for this script !

  • 0
Posted

Checkweight

 

// PVP Gacha NPC with Multi-Roll Options and Custom Notifications
prontera,194,140,4    script    PVP Gacha    100,{

    
    .@weight = 100 * Weight / MaxWeight;
    if (70 <= .@weight) {
        mes "[ ^FF7700PVP Girl^000000 ]";
        mes "You are currently at " + .@weight + " percent of your maximum weight.";
        mes "Please lighten your load before rolling!";
        close;
    }

...


 

  • 0
Posted
13 hours ago, Scanty said:

Checkweight

 

// PVP Gacha NPC with Multi-Roll Options and Custom Notifications
prontera,194,140,4    script    PVP Gacha    100,{

    
    .@weight = 100 * Weight / MaxWeight;
    if (70 <= .@weight) {
        mes "[ ^FF7700PVP Girl^000000 ]";
        mes "You are currently at " + .@weight + " percent of your maximum weight.";
        mes "Please lighten your load before rolling!";
        close;
    }

...


 

savage thank you so much sir! how about if i want a multiple item in announce example

        if (.@itemID == "61966,502") {

  • 0
Posted
6 hours ago, Sallycantdance said:

savage thank you so much sir! how about if i want a multiple item in announce example

        if (.@itemID == "61966,502") {

 

// Rolling Multiple Times
	set .@GrandPrizes, 0;
	set .@AnnouncePercent, 1; // = 1, 50 = 50%

 

// Announce ONLY if the player gets the grand prize
		if (.@itemID == 61966) {
			announce "Congratulations! " + strcharinfo(0) + " just received " + getitemname(.@itemID) + " x " + .@itemAmount + " from PVP Gacha NPC!", 0;
			specialeffect2 248;
			set .@GrandPrizes, .@GrandPrizes + 1;
		}

 

Change to:

 

// Automatically announce if the item has a probability less than or equal to the configuration
		if (getd(".@P"+.@i+"[0]") <= .@AnnouncePercent) {
			announce "Congratulations! " + strcharinfo(0) + " just received " + getitemname(.@itemID) + " x " + .@itemAmount + " from PVP Gacha NPC!", 0;
			specialeffect2 248;
			set .@GrandPrizes, .@GrandPrizes + 1;
		}

 

If you have any request, let me know.

  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...