Ruby Problem: 25 Items Shop Limit, Where to find certain files

smoochy boys on tour

Wiccawest

Dedicated Member
Dedicated Member
Loyal Member
Feb 22, 2014
26
0
27
I'm New to having a server and there's probably a thread for this already but I'm hoping someone sees this and gives a link or an answer since I've seen many kind people on this forum.

Every NPC Shop seems to have a bug where if there are more than 25 items in the shop it stops listing them when you want to buy them. It can tell you there's more than 25 items by showing the 25th twice so I'd like to know if there's a fix or solution besides littering the world with double or even triple npc's per shops.

While I'm here let me list a few more things on my mind I'd like to adjust:

Where can I find the files to alter lottery win chance, win amounts, benediction luck and unluck chance, and ore mining chance

and has anyone setup a mobgen file with prajna temple 4,5,6 (not really important, I could easily make these)
 
Last edited:

Wiccawest

Dedicated Member
Dedicated Member
Loyal Member
Feb 22, 2014
26
0
27
I have no idea how to make something from scratch. Editing premade stuff is one thing but making a new closed system within the game is way too advanced for me atm.
 
Upvote 0

Ardbeg

Legend
Legendary
Aug 8, 2004
3,211
1
144
260
Southern England
Ok, I just created this code that you can use as an alternate to the inbuilt lottery system.

First off, a few things to know.
There's a text file called QFunction-0.txt that lives in M2Server/Envir/Market_Def. Changes to this file can be made on a live server and a GM Char can use @reloadqfunction to force M2Server to reload the file and bring in the changes.
There's an item in the item database called Lotteryticket and on my server its item 229.

For this code to work, we can utilise the current Lotteryticket item but you need to make STDMODE = 31, SHAPE = 0 and ANICOUNT = 102
These changes stop the server acting on the item and direct it to our Qfunction code.
The Anicount can be any unused number on your Qfunction-0.txt but the number used in the database must match the number used in the top line of the code.

Copy this code entirely and paste it to your Qfunction-0.txt. It's unlikely but if you already have code using @prize1 etc., you'll need to change the word.
I have the highest prize at the top and lowest at the bottom. This way, if all random tests fail, it will reach the last prize of 500 gold and always give it. There is no fail to win here.

To change the odds of winning, increase or decrease the number after random. The bigger the number, the harder the prize is to win.

If you don't want the whole server to see your win, remove the SENDALLMSG line.

You can replace gold prize with items if you wish. Simply remove GIVE Gold x and replace with GIVE itemname.

It should all work. I've tested it on my server but these things sometimes don't travel well !

Good luck.

Code:
[@StdModeFunc(102)]
#IF
random 6
#ACT
GIVE Gold 50000
SENDMSG "You won 1st prize and receive 50000 Gold !" 6
SENDALLMSG "Congratulations <$USERNAME> for winning 50000 Gold on the Lottery !" 3
BREAK
#ELSEACT
GOTO @prize2
[@prize2]
#IF
random 5
#ACT
GIVE Gold 25000
SENDMSG "You won 2nd prize and receive 25000 Gold !" 6
BREAK
#ELSEACT
GOTO @prize3
[@prize3]
#IF
random 4
#ACT
GIVE Gold 10000
SENDMSG "You won 3rd prize and receive 10000 Gold." 6
BREAK
#ELSEACT
GOTO @prize4
[@prize4]
#IF
random 3
#ACT
GIVE Gold 5000
SENDMSG "You won 4th prize and receive 5000 Gold." 6
BREAK
#ELSEACT
GOTO @prize5
[@prize5]
#IF
random 2
#ACT
GIVE Gold 1000
SENDMSG "You won 5th prize and receive 1000 Gold." 6
BREAK
#ELSEACT
GOTO @prize6
[@prize6]
#ACT
GIVE Gold 500
SENDMSG "You won 6th prize and receive 500 Gold." 6
BREAK

Edit
If you want a fail to win, add a 7th with a "you won nothing" type response or make the lottery ticket cost more to buy than your lowest win.
 
Last edited:
Upvote 0

Wiccawest

Dedicated Member
Dedicated Member
Loyal Member
Feb 22, 2014
26
0
27
Is there a quicker way to find things in the SQL, or to at least be able to sort the lists be the value of a column? It seems like I have almost no user friendly commands that other programs provide to make viewing documents easier.

Thanks a lot for the replies, they have been very helpful since I'm so this.

So is (Random 6) like saying 1/6 chance of winning?
what is the 6 for at the end of the sendmsg line? If i send messages in a script is the 6 required at the end?
 
Last edited:
Upvote 0

Ardbeg

Legend
Legendary
Aug 8, 2004
3,211
1
144
260
Southern England
Learning how to use SQL and the studio is a lengthy business even though the commands themselves aren't that difficult.

If you right click over an open table, you'll get a menu open and one option is Pane. Selecting this and then selecting SQL opens the SQL query used to display the table above the data.
You can add, change or replace all of it if you wish but it will last only as long as the table is open. It's also dangerous to play about as you might corrupt your data.

Let's assume your data is unimportant.
The most basic addition you could make would be to add ORDER BY and then a column name. Choose ID. So your addition looks like..

ORDER BY ID

The next thing to do is right click again and this time choose the option "Verify SQL Syntax". If all is well, it'll give you a positive response.
Then you can right click again and choose "Execute SQL".
This will arrange your table contents from lowest value to highest on the ID column, (Assuming there is one).
Change ID to Name and see what happens.
You should get an error if you typed name with any lowercase letters. make name read NAME and it will be ok.
It will change the case of commands etc. but won't change a column because it could be any combo of upper and lower.

Another useful snippet is to look for a particular value.
Let's say you wanted to find all the items belonging to Ardbeg.
You'll need to open the LOM2Game / Tables / TBL_ITEM table.
Notice the first column is FLD_CHARACTER. This relates to the char name in game.

So you could right click on this table as before and add under the FROM TBL_ITEM ...

WHERE FLD_CHARACTER=Ardbeg

Then use the verify option.
It will accept it but add ' ' around the name.
You can then run the query.
It won't find anything of course as my char probably isn't in your db. Replace Ardbeg with a valid name and see the result.

I can't list loads of different codes but simply replacing the column name and search name will allow you to search your tables.
Search the net for SQL help. There's loads of it and it can be used here.

Another option is to copy your data to a spreadsheet and edit there.
 
Upvote 0

Wiccawest

Dedicated Member
Dedicated Member
Loyal Member
Feb 22, 2014
26
0
27
Thank you so much for the help; any help with the sql is great since the lists are so big.

---------- Post Merged on 06-03-2014 at 03:18 PM ---------- Previous Post was on 05-03-2014 at 08:59 PM ----------

So there's no way to fix the 25 item limit in a store?
 
Upvote 0