Jump to content


Photo

RNDTRE01.ITM and others, replacement


  • Please log in to reply
No replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 02 September 2017 - 08:19 AM

There are five of them for five measures of value of random treasure - RNDTRE01 to RNDTRE05, voucher items that the engine converts into rolled choices on its loot list as soon as creatures materialize. Although creatures have them in their inventory in CRE files, the vouchers get converted instantly, so their owners never react to triggers like HasItem("RNDTRE01",Myself) - by then, it is too late. For a component of the mod that I'm making I would like to sometimes gather creatures' treasure in one spot - take away their loot and stash it. There are two parts to this: the taking and the stashing. The second I have taken care of, it simply involves adding, in this case, RNDTRE01.ITM to the store of the stash container, where it gets converted into a selection of items as usual. But first a creature has to lose its RNDTRE01.ITM, otherwise instead of transporting treasure there will be duplication. And for this I require some way of detecting the level of treasure a creature has.

 

Since I can't possibly write a HasItem trigger for every gem, potion, scroll, gold piece or any other item that may be dropped according to the standard loot tables or tables changed by a mod and don't want to change game balance, I have the idea of using Weidu to replace RNDTRE01 and the rest of them, on creatures, with vouchers of my own. They too would be levels 1-5. For just a few seconds after appearing creatures would have these completely useless but detectable items in their backpacks - enough time for my mod component to do its job, run checks, increment appropriate globals and add enough treasure of the right value to the stash. The vouchers would then get destroyed. This would only happen on a portion of maps, because the stashing is to be an occasional monster device. In the majority of cases creatures would not just lose their vouchers but get appropriate standard vouchers, tit for tat - RNDTRE01 for my voucher level 1 and so on. All of this can be done by invisible minions. It should only take a few seconds after area entry.

 

I'd like to know whether there are any problems with this idea and, if I may, get the Weidu code for replacing an item in an inventory.