Aller au contenu

Photo

Types of loot system


  • Veuillez vous connecter pour répondre
19 réponses à ce sujet

#1
andysks

andysks
  • Members
  • 1 652 messages
Hi all, with my Campaign nearly doen, hopefully after holiday, I was thinking of the different loot systems that one can use.
So far I have all the special items that the player needs to find, all custom made of course. But what happens to the random loot every creature might carry?
I tried the cdaulepp's random loot generator from the vault, but it has some flaus, that when happen the player can get extremely rich on the first couple levels.
I also read Tchos' guide to SoZ loot system, that seems good but never tried it myself. (Haven't played SoZ, after MotB the excitememnt was too high and then it just stayed on the shelf :?).
I guess one can go for any of them, but maybe check and change the probability tables to how it suits him?
In conclussion, please post any ideas on the loot system, or something you might have used in your campaigns that worked well.
Thank you in advance !

#2
ColorsFade

ColorsFade
  • Members
  • 1 271 messages
There are a couple default loot systems that come with the Toolset and I elected to use one of these in my campaign for random loot because they are really easy to use.  I, too, looked at the SoZ loot system but this seemed even easierto me. 
Much like your campaign, I create custom loot for all the "big stuff" - weapons, armor, etc. But when it comes to things like gems, disposable items, healing kits, potions, spells, etc, I wanted an easy to use random loot system, and the game provides ones. 
There is a script in the default game called gp_treasure_op_de that will handle random loot for you on a creature or container. All you have to do is set two variables on the object: TreasureClass and TreasureType. Then you need to set the script as either the DeathScript on the creature, or for a container set is as the OnOpen and OnDeath script. 
A for the variables: 

TreasureClass sets an integer value of -1,0,1 or 2. This roughly corresponds to the "level" of the loot that will be dropped. -1 = no loot. TreasureClass=0 is "Low", 1="Medim" and 2="High". 
TreasureType is also an integer and is used to determine the type of loot to be dropped. By adding numbers together you can combine loot drop types. 
The settings are such: 
1 = Disposable2 = Ammo4 = Gold (Gold and Gems)8 = Item (not used)16 = Magic (+ Weapons, Armor, Rings, Amulets, Boots) [DO NOT USE]32 = Mundane (Healer Kits, Lockpicks, 
So, for instance, TreasureType=37 means you will have a chance to get Mundane items + Gold + Disposable items. (32 + 4+ 1). I use TreasureType 37 and 39 a lot in my campaign (39 is the same as 37 but drops ammo as well). 

The percentage chances are, I believe, stored in a 2DA. My notes say the 2DA's that affect this system are named des_treas_.

I have not altered the 2DA file because the randomness seems fine to me. I'm not really interested in controlling the random loot drops. It's the "big stuff" that is expensive and can make a character rich, and so I control that through custom loot. 

On last caveat:
 

I use a lot of DeathScripts in my campaign for creatures and so I can't set the gp_treasure_op_de script as my deathscript in many cases. So, instead of setting the gp_treasure_op_de as the deathscript for the creature, I created a user defined script wrapper that calls gp_treasure_op_de. It works well. 

Nice thing about this system is you can just save the different TreasureClass and TreasureType variable sets and import them into new creatures really fast. It's easy to use and I like that part. 

#3
andysks

andysks
  • Members
  • 1 652 messages
Well, it seems exactly what I was searching. It is a little bit like cdaulepp's system that I found in the vault, but in that one the loot on the creature is determined from the CR and not the variables. Problem is that in one test run I made, goblin tend to drop spirit essences, which is not what exactly I had in mind. I guess I won't use it after all and will go for the one that you just described.
What happens if you don't put any variables and the creature has the default ondeath attached? In the end of the script it says the creature will generate random loot if I remember correctly... does it mean just some gold?

#4
ColorsFade

ColorsFade
  • Members
  • 1 271 messages

andysks wrote...

What happens if you don't put any variables and the creature has the default ondeath attached? In the end of the script it says the creature will generate random loot if I remember correctly... does it mean just some gold?


I don't think so. I've never had a creature generate random loot without using the scripts. 

I would recommend not using it as a deathscript either. The default OnDeathScript for most creatures is nw_c2_default7. It looks for a local variable called "DeathScript" and runs it. So all you have to do is wrap the loot script into a DeathScript, like so: 

void main(){ ExecuteScript("gp_treasure_op_de", OBJECT_SELF);}


Then, all you need is three variables on the creature: 

Posted Image

And since you can save variables as sets, then it just becomes a matter loading a variable set and bam: your creature will now drop random loot. 

#5
andysks

andysks
  • Members
  • 1 652 messages
Hmm, no matter how much I try, I guess I'm too old to learn scripting :D. So, what do we mean wrap the loot script?
Make a custom OnDeath with the line you posted and the put in on the OnDeath of the creatures?
Or ALL you need is the three variables and everything else takes care of itself?
I appreciate the help, and I'm sorry if my questions tire the more experienced :). But when it comes to scripting... boy am I bad.

#6
Tchos

Tchos
  • Members
  • 5 072 messages
You shouldn't need to write a wrapper. Just put "gp_treasure_op_de" as the string in the DeathScript variable.

The script was designed to be put on containers, which is why it has the _op (on open) and the _de (on death), where "death" here means you've destroyed the container by bashing it. It works on creatures anyway, though. What I don't like about it is that it can never drop creature crafting parts (since I use the OC crafting system).

#7
andysks

andysks
  • Members
  • 1 652 messages
So if I want crafting in my campaign I have to provide the components manually you mean. Will it drop gems and stuff but no claws and heads?

#8
Tchos

Tchos
  • Members
  • 5 072 messages
That's right. There are other ways of getting them to drop the claws, heads, etc., besides putting them manually on the creature. I have a script that I brought out of retirement (the original devs commented out this functionality for the expansions) that I can add onto the death scripts to do it, but for most monsters I just put the appropriate crafting items on them using the SoZ variables.  This is better than just putting it into their inventories, because it allows you to make it so that not every creature always drops the materials, and sometimes they can drop more than one, or an alternate material.  For instance, a wolf may drop some leather, a wolf claw, both, or neither, with a degree of randomness that you decide.

Modifié par Tchos, 12 juillet 2013 - 11:13 .


#9
andysks

andysks
  • Members
  • 1 652 messages
Heh, every time I ask for help I end up prolonging the release because I find out more stuff that I want to implement :D. I guess I'll go with the above way with the three variables, and just edit inventories manually. That means the creature ingredients will be quite rare, at least in the first part of my campaign that will be released. When i start working on the second chapter I'll see what to do.

#10
ColorsFade

ColorsFade
  • Members
  • 1 271 messages

andysks wrote...

Heh, every time I ask for help I end up prolonging the release because I find out more stuff that I want to implement :D. I guess I'll go with the above way with the three variables, and just edit inventories manually. That means the creature ingredients will be quite rare, at least in the first part of my campaign that will be released. When i start working on the second chapter I'll see what to do.


Tchos is, of course, right - you don't need a script wrapper. I am not quite sure why I did that :)

Crafting... Yeah, you have to put components in manually, which is why I made my own crafting system for my campaign (and because I wanted something different - not a big fan of the OC crafting system). 

If you notice in the walkthroughs for the OC, the authors always know where every single crafting component drop is. They are always on the same creatures in the same places, and that's because they are placed manually in the inventories of the creatures.  

Personally, if I were going to use the OC's crafting system, I would do it just like the devs did - I'd manually place components as well and not use a random system. It just gives you, the modder, more control over what players can do. You can limit how many awesome crafted items they can make simply by limiting the number and type of components. 

And don't worry about delaying your mod. Oh my goodness... get it the way you want! Besides, there's been several released in the last month - I haven't even had time to play all of them. Take your time and enjoy :)

#11
Tchos

Tchos
  • Members
  • 5 072 messages
The wrapper is indeed helpful if you want to fire off more than one deathscript, which is why you said you did it. I assume that since Andy's not comfortable with scripting that he'd rather just fire the one.

Although I do have to point out that the way I do it does give me total control, just as placing them manually would. The variables control the amount of randomness, from 0% to 100%.  In general, I don't place anything directly into a creature's inventory except for their non-droppable gear.  Everything, from random loot to guaranteed-drop quest items, are specified through the variables.

That's especially important for special items or quest items, since I sometimes need to make changes to those items' stats or functions.  Since they're created on the creature through the loot system instead of placed manually, they're always the latest version, while manually-placed items are copied instances of the old versions that I'd have to manually delete and replace.

Modifié par Tchos, 12 juillet 2013 - 04:16 .


#12
andysks

andysks
  • Members
  • 1 652 messages
Well I just tested it, and everything works out fine except for two things.
1 : They tend to drop broken items... a lot. But this is no major problem... maybe the goblins have different taste for item beauty and functionality.
2: I can't seem to make it work on placeables. Don't the chests take the same variables as the creatures? Since the script was originally for containers?

#13
andysks

andysks
  • Members
  • 1 652 messages
Hmm, on an unrelated matter, by trying to test the SoZ loot system I think I've done something. I just copied the files that the guide says to a test module directory I use for testing, and now I can't see any X2 models in any module. I see them in the palette, but not as models to place them. Are these related, or...

#14
Tchos

Tchos
  • Members
  • 5 072 messages
They drop broken items because that's what's supposed to happen when you break open a locked container, and it's a container script -- not just originally, but that's really all it's designed for. It works on creatures because creatures have inventories like containers do.

Check your placeables to make sure they're set to have an inventory, that they're usable, and not static. Chests should be set that way already, but just in case.

As to the other matter, I'm not sure I understand what you're describing, but first, start over and copy only these files: k_mod_load, kb_default_sp, and nx2_loot_*.2da. Not any other .2das, just the ones that start with "nx2_loot".

#15
andysks

andysks
  • Members
  • 1 652 messages
I'm sorry maybe is my english. I just said that I see names on the pallete that are from X2, but when I click them to add them to an area they are invisible for me. The scripts you mention, plus the kinc_treasure, are the scripts I copied from the SoZ folder to the test folder. I think the 2da are four. potions, gems, ammo and alchemy. I'm sure there's a reasonable explanation :). And I was thinking, if I copied these 2da, why would the models have a problem... they are no loot. Just placeables. Maybe is just the toolset being the toolset.

#16
ColorsFade

ColorsFade
  • Members
  • 1 271 messages

Tchos wrote...

That's especially important for special items or quest items, since I sometimes need to make changes to those items' stats or functions.  Since they're created on the creature through the loot system instead of placed manually, they're always the latest version, while manually-placed items are copied instances of the old versions that I'd have to manually delete and replace.


Yeah, I do the same thing with my custom loot drops. I have a script that reads a variable on the creature and creates the items on death. That way if you need to change an item's blueprint, you don't have to open an area in the game to make the changes stick. 

#17
ColorsFade

ColorsFade
  • Members
  • 1 271 messages

There may be a better way to do it, and if I can figure out how to modify the script to fix it so that only true containers that are bashed generate a broken item, I'll let you know.


It seems there is no way to differentiate between a creature and a container, so I simply wrote a second script just for use with creatures. This is a copy of the gp_treasure_de_op script, but it removes the broken item code. Use this on creatures. 

#include "x2_inc_treasure"#include "nw_o2_coninclude"#include "x2_inc_compon"#include "ginc_debug"

const string GOLD_ITEM_RES_REF = "nw_it_gold001"; // gold!
// local ints stored on the chestconst string VAR_TREASURE_CLASS = "TreasureClass";const string VAR_TREASURE_TYPE = "TreasureType";

void main(){    // craft_drop_placeable();
    if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0)    {       return;    }    object oOpener = GetLastOpener(); int iTreasureClass = GetLocalInt(OBJECT_SELF, VAR_TREASURE_CLASS); int iTreasureType = GetLocalInt(OBJECT_SELF, VAR_TREASURE_TYPE); if (iTreasureClass != X2_DTS_CLASS_NONE) { if (iTreasureType == 0) iTreasureType = X2_DTS_TYPE_DISP | X2_DTS_TYPE_GOLD; // if bashed, replace disposable w/ broken item
// remove Tresure Type "Item" - these don't scale and are to dangerous for balance reasons // to have in the standard treasure generation if (iTreasureType & X2_DTS_TYPE_ITEM) { iTreasureType = iTreasureType & (~X2_DTS_TYPE_ITEM); } int iNumGenerated = DTSGenerateTreasureOnContainer (OBJECT_SELF, oOpener, iTreasureClass, iTreasureType); // everything must have something... // if we didn't generate anything then add a smidgen of gold if (iNumGenerated == 0) { CreateItemOnObject(GOLD_ITEM_RES_REF, OBJECT_SELF, d20(1)); } }     SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);    ShoutDisturbed();}

Modifié par ColorsFade, 12 juillet 2013 - 07:54 .


#18
Tchos

Tchos
  • Members
  • 5 072 messages

andysks wrote...
I'm sorry maybe is my english. I just said that I see names on the pallete that are from X2, but when I click them to add them to an area they are invisible for me.

Ah, actually, your English is very good with only very minor errors.  The reason I brought up the 2da files, and said to make sure you only copied those, is because when you're experiencing blueprints with invisible models, then it's usually a problem with the placeables.2da file.  Is it possible you have a pre-SoZ copy of placeables.2da either in your override folder, the module folder, or in a hak that you've attached to your test module?

ColorsFade wrote...
There may be a better way
to do it, and if I can figure out how to modify the script to fix it so
that only true containers that are bashed generate a broken item, I'll
let you know. 

Well, you could just write a different script for creatures if it comes to that, rather than making a copy of the container script, and add in support for creature crafting items.  It would probably be useful for anyone who doesn't want to deal with the other systems.

Modifié par Tchos, 12 juillet 2013 - 07:47 .


#19
andysks

andysks
  • Members
  • 1 652 messages
Well that could be possible, since the test module directory is the dump/test folder :D... I imagine it could be something messing around there. I will figure it out.
ColorsFade :The script you posted is meant for creatures then, and containers still take the gp_treasure_de_op right?

#20
ColorsFade

ColorsFade
  • Members
  • 1 271 messages

andysks wrote...

ColorsFade :The script you posted is meant for creatures then, and containers still take the gp_treasure_de_op right?


Correct. 

And sorry about the formatting - I cannot get this message board to format at all. It hates me.