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 .