Alternate Method:
If your custom items are not normally found in a (regular/zeny) shop, you could edit the "Buy Price" or "Sell Price" in your item database. The value in that column would correspond to the item's ticket value. To read the value you can use getiteminfo (documentation below). This would make your script less complicated but may get confusing when viewing your item DB. If you are interested in this method and would like further explanation, let me know =)
Or.. A similar method described above is to make a custom column (or a use of a delimiter) in the item database itself for a ticket value price. (ie. Item ID#, ..., NPC Sell, NPC Buy, Ticket Price, Item Type, ..., ViewID, Item Script) However, this would need a source modification.
EDIT:
I realized that this thread is in the Script Request sub forum so I quickly created the code for my method (and quickly tested it in-game) :
//20000,Ticket_Item,Ticket Item,3,,,0,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
//20001,Custom_Item,Custom Item,3,[b]20[/b],,0,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
//The bold-faced number 20 is the number of tickets a player can get if they exchange the item whose id is 20001
prontera,100,100,1 script Exchange for Tickets 46,{
mes "Input Item ID# that you want to exchange for tickets.";
mes "Make sure it is in your inventory and have no slotted cards!";
next;
input .@iid;
// range of valid custom items that can be exchanged for tickets
if(.@iid >= 20001 && .@iid <= 25000) {
// make sure they have one of this item so that it doesnt delete the wrong one?
if(countitem(.@iid) == 1) {
getinventorylist;
// for loop to check if item to be deleted has cards in it
for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1) {
// item found in inventory
if(@inventorylist_id[.@i] == .@iid) {
// item has a card in it
if(@inventorylist_card1[.@i] || @inventorylist_card2[.@i] || @inventorylist_card3[.@i] || @inventorylist_card4[.@i])
mes "There is a card in that item!";
// item doesnt have a card - give tickets and delete item
else {
delitem .@iid,1;
getitem 20000, getiteminfo(.@iid,0);
mes "Done!";
}
close;
}
}
}
// error message if item is not a custom item that can be exchanged
else
mes "Invalid item. This item cannot be exchanged into tickets.";
}
// error message if item input not found in inventory
else
mes "You do not have that item or have more than one in your inventory!";
close;
}