Sign in to follow this  
Friya

[Released] Server mod; Loot Tables

Recommended Posts

On 7/13/2017 at 0:55 AM, Eject said:

Hey Friya

 

I love your new update of this awesome mod :)

Is it possible to give us the option to create the new items with the wand?

 

Eject

 

It would be fairly easy to make, but I consider it out of scope for the LootTables mod since that is really just about 'random loot'. I am also not sure if I feel any temptation to write that mod myself, but if someone is up for the job, I'd be happy to assist with pointers on how to make it happen (and even tweak the LootTables mod if that is necessary). :)

 

Share this post


Link to post
Share on other sites

Not sure if I've mentioned this, but you can have any Wurm item inserted into the LootItem table (items from mods too). But the important bit here: By default I only insert a *subset* of Wurm's items. Things that are not very plausible as drops like carts, boats, etc are not inserted. Items like GM wands, mission ruler, etc are also excluded.

 

That said, you can easily insert any missing items yourself by looking up the Wurm template ID in the com/wurmonline/server/items/ItemTemplateCreator* classes.
 

25Jul2017 Some updates to LootItems

  • Ability to set weight of items, you can also add a random factor to the weight. Use 'weight' and 'weightrandom' (this is in grams). As with other random parameters, if weight is set to 1000 (1kg) and you have a weightrandom set to 500, the weight will be a random value between 1000 and 1500 grams. You can of course modify the weight of any item, say, a light weight huge axe or so.
     
  • Added ability to force an item to rare. Do this by setting 'forcerare' to 0 for normal, 1 for rare, 2 for supreme and 3 for fantastic. This is different from how rarity works on LootItems otherwise, you could always set items to 'can-be-rare' and then it is done through randomness (bones were an exception, they would always be rare or better). This new option will *force* them to go rare, supreme or fantastic.
     
  • Ability to set colour. This can be useful for almost every item of course, but I set out to add it for the purpose of being able to drop properly configured scale and hide. Please note that some items are simply not affected by colour -- sadly nothing that I can do about that. As is often the case when defining colours, RGB is used, you can get more information about that here: https://en.wikipedia.org/wiki/RGB_color_model

    The fields added to LootItems table: colorR / colorRrandom (redness), colorG / colorGrandom (greenness) and colorB / colorBrandom (blueness).

    So, setting colorR to 50 and colorRrandom to 205 will create a random 'redness' between 50 and 255. The final value of each color-component (R, G or B) must be between 0 and 255 or you may get an unpredictable result.

    As a side-note, dragon scale and drake hide colours are:
    Red dragon/drake: 215, 40, 40
    Black dragon/drake: 10, 10, 10
    Green dragon/drake: 10, 210, 10
    White dragon/drake: 255, 255, 255
    Blue dragon/drake: 40, 40, 215

To test all three additions

INSERT INTO FriyaLootItems(id, itemids, name, dropchance, colorr, colorg, colorb, weight) VALUES(150001, 372, "red dragon scale", 100.0, 215, 40, 40, 100);
INSERT INTO FriyaLootItems(id, itemids, name, dropchance, weight, weightrandom) VALUES(150002, 347, "tasty meal", 100.0, 500, 500);
INSERT INTO FriyaLootItems(id, itemids, name, dropchance, colorr, colorg, colorb, forcerare) VALUES(150003, 2, "sweet satchel", 100.0, 0, 0, 255, 2);

INSERT INTO FriyaLootTables values(123457, 150001);
INSERT INTO FriyaLootTables values(123457, 150002);
INSERT INTO FriyaLootTables values(123457, 150003);

INSERT INTO FriyaLootRules(rulename, loottable, creature, age) VALUES("Test of color, weight and forced rarity", 123457, "troll", "venerable");

The above examples will make all venerable trolls drop:

  • a meal weighing between 0.5 and 1.0kg (named tasty meal)
  • 0.1kg red dragon scale
  • a blue satchel that is forced to become supreme (named sweet satchel)

0PwS30a.png

 

As always when we need to update the database: On your next restart of server, the new fields will be merged into the existing database automatically (no action required from your side). But yes, you do have to restart your server to see the new fields. :)

 

PS. I know I use 'color' in code and 'colour' in text. I am consistent in my inconsistency.

 

Edited by Friya
  • Like 1

Share this post


Link to post
Share on other sites

Just an FYI the database did not insert the new table columns in the items table until I set "create default rules" back to true again. Since I already had rules after first use I had set this variable back to false. Had tried to reboot a few times and no love thought hmmm I wonder and eureka.

 

EDIT: After further inspecting the database after I did the toggle to creating the default rules I opened the database again and found your actual default rule had now been deleted from the loot rules table. The ones I added were still there but your generic all critters rare rule went poof.

Edited by LifesaverM
Adt'l Info

Share this post


Link to post
Share on other sites
On 24.7.2017 at 9:37 PM, Friya said:

It would be fairly easy to make, but I consider it out of scope for the LootTables mod since that is really just about 'random loot'. I am also not sure if I feel any temptation to write that mod myself, but if someone is up for the job, I'd be happy to assist with pointers on how to make it happen (and even tweak the LootTables mod if that is necessary). :)

Hello Friya :)

 

My reason for this feature is very simple ^^

 

Example: I let drop the animals "Eventtickets" for players to join different events, but i also like to sell this tickets with npc or by myself without spawning 100 creatures and kill them to get the tickets for selling lol.

 

Eject

Share this post


Link to post
Share on other sites

If you create a custom item for the game by creating a new ItemTemplate (not something LootTables is designed to do) then it will be available in your item list on the Ebony Wand.

  • Like 1

Share this post


Link to post
Share on other sites

ohhhh never saw that, with the given name?

 

Eject

Edited by Eject

Share this post


Link to post
Share on other sites

Having agreat time using this mod. Working really well. MANY thanks for making and releasing it!

Share this post


Link to post
Share on other sites
On 21.8.2017 at 9:29 AM, LifesaverM said:

If you create a custom item for the game by creating a new ItemTemplate (not something LootTables is designed to do) then it will be available in your item list on the Ebony Wand.

Its not working. The Items i added in the Loottables are not shown in the creation menu of the ebony wand

 

Eject

Share this post


Link to post
Share on other sites
On 10/7/2017 at 3:28 AM, Eject said:

Its not working. The Items i added in the Loottables are not shown in the creation menu of the ebony wand

 

Eject

 

Sorry Eject let me clarify LootTables is not capable of creating new items in the game, you have to create new ItemTemplates through some other means. The Ebony Wand gets its list from the game's "ItemTemplate" list/class file.

  • Like 1

Share this post


Link to post
Share on other sites

I am trying to setup custom loot for my server and, for the most part, this is working really well.  I am running into an issue with the color settings.  I want to drop items with no color settings at all.  I have tried setting the LootItems with -1 in all the color fields and I have tried to leave the color fields all blank.  Regardless of what I try, the RGB always gets set to 0,0,0 rather than the RGB vales left empty as they should be for a non-colored item.  What am I doing wrong here?  Is there even a way to specify that an item should NOT be assigned a color value?

Share this post


Link to post
Share on other sites
On 07/02/2018 at 2:58 PM, SallyIronside said:

I am trying to setup custom loot for my server and, for the most part, this is working really well.  I am running into an issue with the color settings.  I want to drop items with no color settings at all.  I have tried setting the LootItems with -1 in all the color fields and I have tried to leave the color fields all blank.  Regardless of what I try, the RGB always gets set to 0,0,0 rather than the RGB vales left empty as they should be for a non-colored item.  What am I doing wrong here?  Is there even a way to specify that an item should NOT be assigned a color value?

 

Hello,

 

I have been out of the Wurm Unlimited loop for quite a while and just happened to end up browsing this section; so I apologize for the somewhat late reply.

 

I think you may be right in your assessment that something is off here. Was the 'random' color set by any chance? I can imagine that would have thrown things off a bit. Regardless, I have thrown together a new release that checks if all three color components are -1, then do not set color under any circumstance.

 

There's a caveat here; I have been unable to test the release as my Wurm Unlimited is currently a bit borked and I have not been arsed to fix it :)

 

I hope this helps you. The download link is the same as was in the original post in this thread.

 

Edited by Friya
  • Like 1

Share this post


Link to post
Share on other sites

I started dabbling with WU again (we always come back to Wurm! <3) and wanted a bit of new functionality. Sooo.... here's an update to this ... thing.

 

Get some numbers on what is happening with your loot / server

You get statistics by typing /lootstats as a GM (power 1+). This will show the stats in the player's Event log as well as in the server log.

 

Any entries not shown when viewing the stats are still 0. That is, a stat will only appear if it's happened at least once.

 

Provided there is activity on the server, statistics will automatically be output to the server log (as INFO) every hour-ish (can be useful for auditing over time, or you know, generate charts).

 

Tracked data points

killed.players                  Total number of times players died on the server
killed.npcs                     Total number of times NPCs died on the server
killed.player.[NAME]            Number of times a specific player was killed
killed.npc.[NAME]               Number of times a specific NPC-type was killed
killed.ignored                  Number of suicides or no [valid] players involved in the death of a creature/player 
                                or some other reason disqualifying it from giving loot (an invalid player can be e.g. 
                                an invisible or invulnerable GM. Think: the target must be 'red' before dying)

table.triggered.[ID]            Number of times this loot-table was triggered
rule.cancelled.[ID].[NAME]      Number of times the rule was ignored due to maximum number of items it could drop 
                                was set to 0
rule.triggered.[ID].[NAME]      Number of times the rule was triggered

drop.total                      Total number of items handed out
drop.total.enchanted.[NAME]     Total number of this type of enchantment on items
drop.total.guaranteed           Total number of items handed out that had drop chance set to 100%
drop.total.rares                Total number of items handed out that were rare or better

drop.dropped.[ID].[NAME] [*]    The number of items that dropped. This can differ from item.drop.triggered because more 
                                than one clone may drop.
drop.missed.[ID].[NAME]	[*]     How many times the item was a valid drop, but RNG screwed the player out of the item :)
drop.triggered.[ID].[NAME] [*]  Number of times (an) item was dropped

mods.calls                      Number of times external mods utilizing LootTables were notified about drops
mods.cancelled                  Number of times an external mod utilizing LootTables prevented an NPC from yielding loot
mods.exceptions                 Number of times an external mod threw an exception (thus preventing any drop)

query.total.lootrules           Number of queries to LootRules table

misc.players.online             Number of players online at the time of printing these stats. Not related to LootTables 
                                per se, but can be useful if you want to generate charts (or whatever) based on the 
                                periodical output to server log.

[*] For some of the drop.* data points, the [NAME] will only be included if the LootItem had a forced name. So, if 
    empty, you'd use [ID] to find out which item it's about.

 

The screenshot gives an idea of what is added. This list will obviously become a lot longer on a live server, for this test I had a small number of rules and spent two minutes killing four creatures (without anything dropping).

 

bWWNQyy.png

 

The link in the original post is updated with latest version.

 

And well, that's it. Enjoy :)

 

Share this post


Link to post
Share on other sites

Hello Friya =)

 

Happy that you are back again ^^

I like to ask you how i can self created items (with mod or js) to the loot table, i tried it simple with insert the item id (that the item gets from agos modloader) but it doenst work it seems.

 

Eject

Share this post


Link to post
Share on other sites
2 hours ago, Eject said:

Hello Friya =)

 

Happy that you are back again ^^

I like to ask you how i can self created items (with mod or js) to the loot table, i tried it simple with insert the item id (that the item gets from agos modloader) but it doenst work it seems.

 

Eject

 

That should just .... work. I use that quite extensively myself. I can't even come up with any idea of what could possibly go wrong? hm :)

Share this post


Link to post
Share on other sites
On 3/7/2017 at 3:55 PM, Friya said:

-- The database you want to work with is in your World's sqlite folder: -- modsupport.db, after having installed this mod and started the server -- once, the tables will have been created in there.

 

I must be missing a step.  Here's what I did:

1) Extract the mod to my WU Dedicated server mods folder

2) patcher.bat

3) start the server

4) login a toon, just for good measure

5) logout

 

When I check the modsupport.db, it still shows only the IDS details that it had before I added this mod. No new tables. 

Can anyone tell me what I'm doing wrong?

 

---------------------------------------------

EDIT: Resolved.  I have more than one LAN, but I logged in to only one of them, then was checking modsupport.db on the other. The server I actually logged in on does have the new tables!

 

I'll leave my original question here in case someone else runs into this issue. 

Edited by Batta

Share this post


Link to post
Share on other sites

Fixed to work with 1.8.* (use link in original post).

 

I realize I may have some unanswered questions and such in this thread, unfortunately real life is rather difficult at the moment so I have just fixed critical issues.

 

In general, it's best to simply check http://filterbubbles.com for updates as I am more likely to just upload a new release there than post here at the moment.

 

(any other code of mine seem to work without updates)

Edited by Friya
  • Like 1

Share this post


Link to post
Share on other sites

Hello Friya

 

Have you done some changes at the properties file, or is it ok if i just upload the new jar?

 

Eject

Share this post


Link to post
Share on other sites

I attempted to clear my set of test rules by starting the server with the parameter deleteAllRules= true.  I did not get the results that I expected and I eventually hacked things up so badly that I stupidly deleted modsupport.db without thinking.  Bad mistake - it's a database not a simple file.

 

I have reset deleteAllRules=false and have been working with the properties file parameters but have been unable to get the mod to recreate/restore modsupport.db to include the three FriyaLoot table structures including the preloaded FriyaLootItems plus FriyaLootTable and FriyaLootRules.  I only get modsupport.db without the three FriyaLoot tables.

 

I would greatly appreciate any pointers / steps from anyone that will help me restore the original version of modsupport.db to include the FriyaLoot tables.

 

Thanks in advance for any assistance or ideas.

 

FYI:

In case anyone is interested, I was able to restore the FriyaLoot tables to their original state after I mistakenly deleted modsupport.db.  Yesterday, following my attempt to restore the modsupport database,  I could only get the general structure of modsupport.db without the three FriyaLoot tables.  Today, following a cold system restart, I somewhat magically have the original structure of modsupport.db including the populated FriyaLootItems portion of the table.  I am not sure why the cold restart helped but all is well.

Edited by skipw
Status Update:

Share this post


Link to post
Share on other sites

@Friya

I have the problem that at one server the mod is working but not at the neighbour server.

I looked over all tables and cant find an error, with /lootstats i see that the both rules are not triggered.

 

Could you help me out if i send you the db again?

The table is very simple, there are just 2 items that  i like to loot.

 

Eject

Edited by Eject

Share this post


Link to post
Share on other sites

Can you set this to drop random rare items when champion mobs are killed?

Share this post


Link to post
Share on other sites
On 12/9/2018 at 1:09 AM, solmark said:

Can you set this to drop random rare items when champion mobs are killed?

Yes you can set a lot of settings in the tables, also the rarity

If i remember correct, you can also define if the mob is a champ

Share this post


Link to post
Share on other sites

Thanks, I noted that, but from what I could see the rarity was just a chance with a binary option. In my testing zero out of about 50 drops have been rare, so I wonder if there was a way to set the rare chance

Share this post


Link to post
Share on other sites

in friyalootitems the very last bit is forcedrare, change that to the rarity, 0,1,2,3 0 being normal. I also change canberare to 1 but not sure if its needed tbh but yes doing that and it is that rarity, not some random chance.

Share this post


Link to post
Share on other sites

Got a question about one of the settings in the properties file. I didn't see it asked in the rest of the thread; sorry if I missed it.

 

Quote

#
# Set to true if dropping of loot can only happen if players were involved in 
# the kill. If this is set to false, old age, diseased, starvation will have 
# the same chance at dropping loot as everything else.
#
# If you want to decide whether it should happen on a case to case basis, just
# set this to true and hook up to the LootTable's BeforeDropListener in your 
# mod and look at the size of the LootResult.getKillers().
#
# Recommended: false
#
everythingDropsLoot=false

 

The wording is unclear: To make it so creatures will *only* drop loot if a player is involved in the kill, should this be set to true or false?
(The description states setting it to true will require a player to participate in the kill; however, I would expect a setting of "everythingDropsLoot=true" to do the opposite! Lol)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this