Jump to content

Daily Roll Machine


Recommended Posts


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

A simple script which allow player to gain item using this npc in exchange of event ticket (you can change if you want)

Npc give a random item from the list.

Players can exchange it using Event ticket

this work one time per day you can change it in what you want. find OnHour24: and change it to what you want. OnHour24 is 12:00AM

you can check the script for more details.

i want to make it 3 random item every roll but i don't know how hahaha.

roll machine.txt

roll machine(24hours).txt

Edited by WordsUp
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  95
  • Reputation:   26
  • Joined:  11/15/11
  • Last Seen:  

I would recommend you to make the script shorter. If I would like to edit the whole list of items inside the machine, I need to replace all the names,item IDs and the quantities. Like make a function and pass the item ID and the quantity as the arguments to make it more easy to configure the item list inside the machine.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

well im new at this so i don't know much about it yet. but i will try to change it. still in progress on developing it

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

erm...my suggestion... you can make use of array in this script..

the script look very long because of the repeating lines....

try to minimize the repeated line...

and your script is 1 time per day ? not every player can roll 1 time per day ?

in your case it is 1 time per day...only 1 player from your server can roll it per day.

how ever, if you want...you can try make it like this

prontera,155,178,3 script Event Ticket Trader 910,{
set @npc$,"[ Roll Machine ]";
// Ticket ID used for this Roll Machine
set .TicketID,30540;
// Items Available to Gain through Roll Machine
setarray .Items[0],607,608,609,610,512;
// Amount of Ticket required to change into Items.
setarray .Cost[0],1,3,5,10,50;
mes @npc$;
mes "Roll machine restarts everyday 12:00AM";
next;
if ( $roll_claimed ){
mes "You already rolled for the day";
mes "see you tomorrow";
}else{
mes @npc$;
mes "Roll the machine?";
next;
if( select("Yes!:No! not yet") == 2 ) close;
mes @npc$;
mes "Are you sure?";
next;
mes @npc$;
mes "Puff* Puff* Tink***";
set $roll_claimed, 1;
next;
if( select("Yes, let's roll it!:I change my mind") == 2 ) close;
mes @npc$;
mes "Random Item Flashing....";
mes "Rolling........";
next;
mes @npc$;
set .@i,rand( getarraysize( .Items ) );
mes "A ^0000FF"+getitemname( .Items[.@i] )+"^000000 appear on the screen.";
mes "This item cost ^FF0000"+.Cost[.@i]+" x "+getitemname( .TicketID )+"^000000.";
next;
if( select("Spend my Ticket:Waste my roll") == 2 ) close;
 mes @npc$;
 if( countitem( .TicketID ) < .Cost[.@i] ){
  mes "You don't have enough "+.Cost[.@i]+" x "+getitemname( .TicketID )+"";
  mes "Better luck next time";
 }else{
  mes "Thanks for using Roll Machine";
  getitem .Items[.@i],1;
  delitem .TicketID,.Cost[.@i];
 }
 close;
}
}

setting here

// Ticket ID used for this Roll Machine
set .TicketID,30540;
// Items Available to Gain through Roll Machine
setarray .Items[0],607,608,609,610,512;
// Amount of Ticket required to change into Items.
setarray .Cost[0],1,3,5,10,50;

using the switch for too many cases...caused you keep repeatly type the same things...so you can just simplify it...

LOL....miland is faster than my posts when i was writing it...>.<

Edited by Emistry
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

thanks for helping emistry i will reupdate my files and include you in my script thanks again.

btw i want it to be every player can roll 1

Edited by WordsUp
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

here...try this

prontera,155,178,3 script Event Ticket Trader 910,{
set @npc$,"[ Roll Machine ]";
// Hours Delay for each Roll
set .Hours,24;
// Ticket ID used for this Roll Machine
set .TicketID,30540;
// Items Available to Gain through Roll Machine
setarray .Items[0],607,608,609,610,512;
// Amount of Ticket required to change into Items.
setarray .Cost[0],1,3,5,10,50;
mes @npc$;
mes "Roll machine restarts everyday 12:00AM";
next;
if ( #Roll_Claimed > gettimetick(2) ){
mes "You already rolled for the day";
mes "see you tomorrow";
}else{
mes @npc$;
mes "Roll the machine?";
next;
if( select("Yes!:No! not yet") == 2 ) close;
mes @npc$;
mes "Are you sure?";
next;
if( select("Yes, let's roll it!:I change my mind") == 2 ) close;
mes @npc$;
mes "Random Item Flashing....";
mes "Rolling........";
next;
mes @npc$;
set .@i,rand( getarraysize( .Items ) );
mes "A ^0000FF"+getitemname( .Items[.@i] )+"^000000 appear on the screen.";
mes "This item cost ^FF0000"+.Cost[.@i]+" x "+getitemname( .TicketID )+"^000000.";
next;
if( select("Spend my Ticket:Waste my roll") == 2 ) close;
 mes @npc$;
 if( !countitem( .TicketID ) ){
  mes "You don't have enough "+getitemname( .TicketID )+"";
  mes "Better luck next time";
 }else{
  mes "Thanks for using Roll Machine";
  set #Roll_Claimed,gettimetick(2) + ( .Hours * 3600 );
  getitem .Items[.@i],1;
  delitem .TicketID,1;
 }
}
close;
}

Settings :

// Hours Delay for each Roll
set .Hours,24;
// Ticket ID used for this Roll Machine
set .TicketID,30540;
// Items Available to Gain through Roll Machine
setarray .Items[0],607,608,609,610,512;
// Amount of Ticket required to change into Items.
setarray .Cost[0],1,3,5,10,50;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

is it possible to have 3 random item to choose from?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

is it possible to have 3 random item to choose from?

here you go....but there is a chances of Repeating Items appear in the Lists since i randomed the items from the same lists.

try this

prontera,155,178,3 script Event Ticket Trader 910,{
set @npc$,"[ Roll Machine ]";
// How many Items can be Choose
set .List,3;
// Hours Delay for each Roll
set .Hours,24;
// Ticket ID used for this Roll Machine
set .TicketID,7539;
// Items Available to Gain through Roll Machine
setarray .Items[0],607,608,609,610,512;
// Amount of Ticket required to change into Items.
setarray .Cost[0],1,3,5,10,50;
if ( #Roll_Claimed > gettimetick(2) ){
mes "You already rolled for the day";
mes "see you tomorrow";
}else{
mes @npc$;
mes "Roll the machine?";
next;
if( select("Yes!:No! not yet") == 2 ) close;
mes @npc$;
mes "Are you sure?";
next;
if( select("Yes, let's roll it!:I change my mind") == 2 ) close;
mes @npc$;
mes "Random Item Flashing....";
mes "Rolling........";
next;
mes @npc$;
mes "Item Apear List :";
mes "[ ^FF0000Required Items^000000 ] [ ^0000FFItem Gain^000000 ]";
for( set .x,0; .x < .List; set .x,.x + 1 ){
 set .Random,rand( getarraysize( .Items ) );
 set .Rolled[.x],.Items[.Random];
 set .RolledCost[.x],.Cost[.Random];
 mes "^FF0000"+.RolledCost[.x]+" x "+getitemname( .TicketID )+" = ^0000FF"+getitemname( .Rolled[.x] )+"^000000";
 set .@Menu$,.@Menu$ + getitemname( .Rolled[.x] )+":";
}
set .@i,select( .@Menu$ ) - 1;
mes "This item cost ^FF0000"+.RolledCost[.@i]+" x "+getitemname( .TicketID )+"^000000.";
next;
if( select("Spend my Ticket:Waste my roll") == 2 ) close;
 mes @npc$;
 if( countitem( .TicketID ) < .RolledCost[.@i] ){
  mes "You need ^0000FF"+.RolledCost[.@i]+" ^0000FF"+getitemname( .TicketID )+"^000000";
  mes "Better luck next time";
 }else{
  mes "Thanks for using Roll Machine";
  set #Roll_Claimed,gettimetick(2) + ( .Hours * 3600 );
  getitem .Rolled[.@i],1;
  delitem .TicketID,.RolledCost[.@i];
 }
}
close;
}

Settings :

// How many Items can be Choose
set .List,3;
// Hours Delay for each Roll
set .Hours,24;
// Ticket ID used for this Roll Machine
set .TicketID,7539;
// Items Available to Gain through Roll Machine
setarray .Items[0],607,608,609,610,512;
// Amount of Ticket required to change into Items.
setarray .Cost[0],1,3,5,10,50;

LOL....how come i feel like this Script Release become Script Requests ..... ^_^

Edited by Emistry
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  24
  • Reputation:   0
  • Joined:  12/03/11
  • Last Seen:  

LOL emistry sort of like that hahaha. anyways thanks alot

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.

×
×
  • Create New...