Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Modding, Customising, Editing » How to get a new items to randomly drop when exploring
How to get a new items to randomly drop when exploring[message #361045] Fri, 28 August 2020 12:52 Go to next message
Lucian667 is currently offline Lucian667
Messages:4
Registered:August 2020
Hi there, I'm playing 1.13 version 7609 and I've created two new items (a sports bag and a shopping bag, both LBE items).

I managed to get them to show up as buyable at Bobby Ray's. I also managed to get them to show up in Keith's inventory.
But what I really want is a chance for them to randomly appear when exploring, in other words when I'm randomly searching a house and open a cupboard, fridge or cabinet. When I do this, there's a chance of finding something. I want to include my new items on the list of items that might potentially be found.

Does anyone have any idea what needs to be modded to make new items drop while exploring containers? Or how to influence the odds of particular items dropping when opening a container?
Is it even possible?

Thanks in advance, any help is most appreciated.

Report message to a moderator

Civilian
Re: How to get a new items to randomly drop when exploring[message #361046 is a reply to message #361045] Fri, 28 August 2020 21:32 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Quote:
Does anyone have any idea what needs to be modded to make new items drop while exploring containers? Or how to influence the odds of particular items dropping when opening a container?
Is it even possible?

Unfortunately items in containers have to be placed there with the Map Editor. You can mod a Random Item item, fill it with items you want, and then place the Random Item in containers. I would love to have had the ability to use XMLs to place random items in the various containers. However, I don't think the code knows the difference between a refrigerator and a wooden crate, or any other container.

Report message to a moderator

Sergeant Major
Re: How to get a new items to randomly drop when exploring[message #361047 is a reply to message #361046] Fri, 28 August 2020 22:51 Go to previous messageGo to next message
Lucian667 is currently offline Lucian667
Messages:4
Registered:August 2020
edmortimer wrote on Fri, 28 August 2020 21:32
Unfortunately items in containers have to be placed there with the Map Editor. You can mod a Random Item item, fill it with items you want, and then place the Random Item in containers.

Aah, so it actually works nothing at all like I hoped, I thought it might be randomly selecting from some sort of list whenever I open a container and all I'd have to do is add my new item ID's to the list. Looks like I'll have to be content with the way its currently working.

Thanks for clearing it up for me anyway...

Report message to a moderator

Civilian
Re: How to get a new items to randomly drop when exploring[message #361049 is a reply to message #361046] Fri, 28 August 2020 23:43 Go to previous messageGo to next message
Kitty

 
Messages:505
Registered:October 2017
Location: Germany
You can try to take a look at the mod SDO (StockDataOverhaul). As far as I know, this is the only mod that ever used random items. From my understanding what I see there, is that you have to create random items. And what those random items contain and the chance they appear, can be defined in a xml. Something like random item number 1 contains 5 different items, random item number 2 contains 5 different items, etc. And then you can define that items in number 1 has a chance of 80% to appear and items in number 2 a chance of 40%, and so on. So basicly, it's all xml, which can be handled with notepad++ and quite some time. At least, that's how I understand this ... others arround may can explain it better.
But, like edmortimer said, you'll still have to place those random items with the map-editor, like you would place a normal item. I guess, a closer look into SDO might provide helpful for your purpose.



How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

First Sergeant
Re: How to get a new items to randomly drop when exploring[message #361054 is a reply to message #361049] Sat, 29 August 2020 11:45 Go to previous messageGo to next message
silversurfer

 
Messages:2787
Registered:May 2009
Even standard 1.13 data has some examples in Items.xml and RandomItem.xml. You can link one random item list to another random item list in case you want to combine them. A modder could place a random item for food in a refrigerator and another item for LBE in a locker and so on.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: How to get a new items to randomly drop when exploring[message #361055 is a reply to message #361049] Sat, 29 August 2020 12:44 Go to previous messageGo to next message
Lucian667 is currently offline Lucian667
Messages:4
Registered:August 2020
Kitty wrote on Fri, 28 August 2020 23:43
You can try to take a look at the mod SDO (StockDataOverhaul).
Thanks, I'll check it out.. happy

Quote:
Even standard 1.13 data has some examples in Items.xml and RandomItem.xml. You can link one random item list to another random item list in case you want to combine them. A modder could place a random item for food in a refrigerator and another item for LBE in a locker and so on.

This looks quite promising, I remember checking out RandomItem.xml but thinking it didn't apply to game containers because there were only guns to select from. But at the time I wasn't aware that each item had to be placed via the map editor. It Looks like it might do the job.

At the moment I'm thinking it works - for example - like this....

<randomitem1>Shopping Bag ID</randomitem1>
<randomitem2>Shopping Bag ID</randomitem2>
<randomitem3>Sports bag ID</randomitem3>
<randomitem4>0</randomitem4>
<randomitem5>0</randomitem5>
<randomitem6>0</randomitem6>
<randomitem7>0</randomitem7>
<randomitem8>0</randomitem8>
<randomitem9>0</randomitem9>
<randomitem10>0</randomitem10>

So if I placed the above random item into a container via the map editor, I'd have a 2/10 chance of finding a shopping bag, a 1/10 chance of finding a sports bag and a 7/10 chance of finding nothing. Is that correct?

However I'm not sure what this means...

<item1>0</item1>
<item2>0</item2>
<item3>0</item3>
<item4>0</item4>
<item5>0</item5>
<item6>0</item6>
<item7>0</item7>
<item8>0</item8>
<item9>0</item9>
<item10>0</item10>

Are they non-random items that are always present as long as they contain an ID?

Anyway, thanks for your advice, you've given me a lot to play with. I'll do some experiments to try and narrow down exactly how it works.

EDIT: I have it totally wrong above, looks like <randomitem1>...etc is (as you said) just a way of linking random lists to other random lists and <item1>...etc is the actual Item ID listings.

[Updated on: Sat, 29 August 2020 13:15]

Report message to a moderator

Civilian
Re: How to get a new items to randomly drop when exploring[message #361058 is a reply to message #361055] Sat, 29 August 2020 18:36 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Quote:
EDIT: I have it totally wrong above, looks like <randomitem1>...etc is (as you said) just a way of linking random lists to other random lists and <item1>...etc is the actual Item ID listings.
I think you understand it. But here's a recent thread where I asked about it.

[Updated on: Sat, 29 August 2020 18:39]

Report message to a moderator

Sergeant Major
Re: How to get a new items to randomly drop when exploring[message #361059 is a reply to message #361058] Sat, 29 August 2020 22:44 Go to previous message
Lucian667 is currently offline Lucian667
Messages:4
Registered:August 2020
edmortimer wrote on Sat, 29 August 2020 18:36
I think you understand it. But here's a recent thread[/url] where I asked about it.
Thanks, that was actually very useful and helped clear up some minor misunderstandings I had.

The major problem I'm having at the moment is with the map editor itself, I seem to be able to place any item except LBE items, not just newly added ones but ANY LBE item. They actually place ok, but they always fail to save for some reason, so when I re-load (or test in-game) they're no longer where I put them. Any other item I place (like a gun) always saves and shows up just fine. Very weird.

Also kind of annoying since the one type of Item I actually want to place is the only one the map editor doesn't let me place... suprised

EDIT: Never mind, I worked it out, I was saving the map in an old format (1.12) which doesn't recognize the LBE items. Its all good now, I have it working the way I want and my new items are now showing up in containers exactly as I want them to. Thanks for all the advice, you saved me a lot of time I would otherwise have spent banging my head against a digital wall. This is a very friendly and helpful community.

[Updated on: Sat, 29 August 2020 23:08]

Report message to a moderator

Civilian
Previous Topic: Reformatting
Next Topic: Making A New Gun (STI RELATED)
Goto Forum:
  


Current Time: Thu Jun 11 22:30:51 GMT+3 2026

Total time taken to generate the page: 0.00815 seconds