Jump to content


Photo

rndtres.2da - unlimited random item spawns for BG2:EE and IWD:EE


3 replies to this topic

#1 K4thos

K4thos
  • Modders
  • 1057 posts
  • Gender:Male

Posted 21 March 2015 - 07:29 AM

Information about IWD:EE rndtres.2da implementation that has been recently (patch 1.3) ported to BG2:EE and will be also implemented in the next BG:EE patch.

 

Here is how the random tables work in vanilla BG2:

when a creature or container has item of filename RNDTREx#.ITM, where x=any character (even letters and symbols, and has no bearing on how RNDTREAS.2DA is read), and #=the row number of RNDTREAS.2DA to use (can be 1-9), RNDTREx#.ITM is replaced by the randomly generated item.
In other words 2da file accepts up to 9 rows. Same deal with other random tables: rndequip.2da, rndmagic.2da, rndscrol.2da, rndwep.2da.

 

 

And here is how new rndtres.2da work (notice that the file has different name than old rndtreas.2da):

rndtres.2da doesn't need items that follows the 2da name and points to row number like I explained above. Engine now checks the item name that will be replaced with random loot directly in the rndtres.2da (first column). You can choose any 8 character name, so it's possible for modders to use this 2da without any conflicts, as long as they add rows with unique names (for example using mod's prefixes). Thanks to this it is not limited to 9 columns like old 2da files, or even 99 columns (which would be true if it worked with RNDTRE## names, which isn't a case). Just tested it with row named TESTITM1, placed as a 130th row and dummy item named TESTITM1.ITM - random loot spawned correctly. Another test with row name "TEST_" also spawned correctly.

More information in this topic: http://forum.baldurs.../comment/622831


Edited by K4thos, 21 March 2015 - 08:05 AM.


#2 Avenger

Avenger
  • Modders
  • 3730 posts
  • Gender:Male
  • Location:Hungary

Posted 23 March 2015 - 08:20 AM

Note, this doesn't mean the old format was abandoned. Simply, the engines support both formats.



#3 K4thos

K4thos
  • Modders
  • 1057 posts
  • Gender:Male

Posted 11 August 2017 - 12:18 PM

There are two problems worth mentioning for those interested in using RNDTRES.2DA functionality:

- Different rows referencing (using dummy item resref to spawn items from another row) within RNDTRES.2DA doesn't work as expected.

- There is no way for defining random lists with a chance of generating no item at all.



#4 Avenger

Avenger
  • Modders
  • 3730 posts
  • Gender:Male
  • Location:Hungary

Posted 12 August 2017 - 12:39 AM

What happens if you add a no_drop entry to the bottom of the list, with just a * as the first created item?

[edit] ah, i see. yeah, recursion isn't done because it could create infinite loops. GemRB does have a loop limit, didn't see the need for this in EE.


Edited by Avenger, 12 August 2017 - 12:41 AM.




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users