Hello, i see you know alot about reloaded source so i hope you can help me, im searching for which items can spawn in graves (golgotha/den/redding/cathedral) but i cant find it anywhere.
Here is what I did:
( you can do this with Total commander search in script folders, but I recommend installing an IDE to browse the scripts, I used Codeblocks, not the best, but at least you can find a tutorial how to install it and use it to browse the code,
here.I searched for "grave" and it gave a lot of results, but I selected something related to definition like this:
#define PID_GRAVESITE_V (344)
#define PID_GRAVESITE_H (345)
To follow this trail, with CodeBlocks, U just right click on the PID_GRAVESITE_V and select: "Find references of: ..". It will list all the references to this item. I searched around a bit and found some interesting code, which did not link to your request but to some GM events, so I skipped that, and found the following reference in "grave.fos":
void GraveRandomPic(Item@ grave)
{
if(grave.GetProtoId() == PID_GRAVESITE_V)
grave.PicMap = GetStrHash("art\\items\\grave" + Random(1, 4) + ".frm");
else
grave.PicMap = GetStrHash("art\\items\\grave" + Random(5, 7) + ".frm");
}
Now, this does not affect the items directly, bit it gives us a clue, that somewhere where this function is called, we might find more info as well, so finding the references for "GraveRandomPic(..)" leads to the file "grave.fos". It seems about right. Check the following funciton:
void _Init(Item& grave, bool firstTime)
{
grave.SetEvent(ITEM_EVENT_SKILL, "_UseSkill");
grave.SetEvent(ITEM_EVENT_USE_ON_ME, "_UseItem");
grave.SetEvent(ITEM_EVENT_FINISH, "_Finish");
if(firstTime)
{
GraveRandomPic(grave);
MultihexSpawned(grave);
}
array<uint> values = { grave.Id };
CreateTimeEvent(AFTER(0), "e_Init", values, true);
}
There are a lot of events created, checking the e_Init event code:
uint e_Init(array<uint>@ values)
{
Item@ grave = GetItem(values[0]);
if(valid(grave))
{
uint16 x, y;
Map@ map = grave.GetMapPosition(x, y);
if(valid(map))
{
uint16 p = map.GetProtoId();
if(p == MAP_DenBusiness || p == MAP_Redding || p == MAP_NewReno_Golgotha || p == MAP_Cathedral_Enter)
{
ConnectRecycler(grave, ENCOUNTER_RECYCLER);
}
}
}
return 0;
}
Since there are no other clues about filling those graves, since the tool in event_utils.fos is never called, we must sniff somewhere around that mysterious recycler. The first comment we find about it that some variables are built into engine, but probably the loot is not., but we do not find anything of usable so the other functions must give some clue, for example the function "void GraveOpen(Item@ grave, Critter@ cr, Item@ shovel)" in the same script file. And yes, it looks like this is the function that will generate the loot for us, for example there is a 1/10,000 chance to find a gold tooth or a decomposed body. Unfortunately the rest of the code contains only Karma related stuff, it looks like you have higher chances of not getting low karma if grave digging at night.
To find the rest of the loot, the clue lies in a comment: " // Move pickable items lying on the grave into the grave" and checking the code, it seems that this is right, since every item lying on the multihex grave, will be moved to the grave. To find what these items are, well, we have to search around for "grave" word again.
This time we find another definition:
#define EC_TYPE_NONE (0)
#define EC_TYPE_CONTAINER (1)
#define EC_TYPE_GRAVE (2)
This gives us the clue (EC = encounter?!) that graves are treated as encounter lockers. Ofc, you as a experienced player, might know a few about the loot, maybe they usually have the same loot, I don't know however..
Reading most of code through from "ecnounter_containers.fos" will show that graves are treated as lockers in random encounters, except their chance to contain item, is less (1/4). The code before used for the 4 maps you mentions, was used by the recycler, it looks like since the graves are on a static map instead on encounters, this recycler is used to refill them from time to time, or dispose of the unlooted stuff.
It looks like the perk treasure hunter works for graves as well
The code that populates it with items, is the "MakeSpawnerContainer(item, spawner);", jumping to definition, we find out of the scripts located in "spawner_container.fos". First, by exploring a bit, jumping to definitions, we find the "spawner_containers_h.fos" with a lot of definitions about spawner types. Looks likes these definitions are defined, but not used when adding spawn types, so to progress further we might "whole word" search in the "spawner_container.fos" script file for the exact values we want to find, in our case for 13 and 14:
#define SPAWNER_CONTAINER_GRAVE_LOW (13)
#define SPAWNER_CONTAINER_GRAVE_HIGH (14)
We do not find anything, that leaves us wondering about it, and then check the code more thoroughly, and it seems, that: "array<ItemSpawner@> spawners;" is responsible for spawning stuff and after looking at the "ADD_ITEMSPAWNER" macro that is used a lot in the init function, it seems that we did not find the index usage of 13 and 14, nor their defines, because it was added with .insertLast() to the array, which makes sense now. So, the spawners[13] (or spawners[SPAWNER_CONTAINER_GRAVE_LOW]) would be responsible for spawning our items into the grave, well, near the grave on entires and then putting it into the grave, but that's the same for us. So we have the find the 13th and 14th macro of "ADD_ITEMSPAWNER", which will result in:
Final result:
You have the chance to find the items with the PIDS listed below:
ADD_ITEMSPAWNER(encounter_grave_low_13,
SpawnTime(0, 0).SetSeparate(true).
AddItem(PID_BLUEPRINT_RANDOM_2, 10).
AddItem(PID_SAND_ROBE, 20).
AddItem(PID_DICE, 5).
AddItem(PID_LOADED_DICE, 2).
AddItem(PID_MAGIC_8_BALL, 1).
AddItem(PID_LOCKPICKS, 10).
AddItem(PID_LIGHTER, 20).
AddItem(PID_CIGARETTES, 30).
AddItem(PID_BEER, 30, 1, 3).
AddItem(PID_BOOZE, 20, 1, 2).
AddItem(PID_BOTTLE_CAPS, 80, 30, 70)
High roll:
ADD_ITEMSPAWNER(encounter_grave_high_14,
AddItem(PID_BLUEPRINT_RANDOM_3, 10).
AddItem(PID_SAND_ROBE, 20).
AddItem(PID_DICE, 5).
AddItem(PID_LOADED_DICE, 2).
AddItem(PID_MIRROR_SHADES, 1).
AddItem(PID_MAGIC_8_BALL, 1).
AddItem(PID_LOCKPICKS, 10).
AddItem(PID_TALISMAN, 1).
AddItem(PID_LIGHTER, 20).
AddItem(PID_CIGARETTES, 30).
AddItem(PID_BEER, 30, 1, 3).
AddItem(PID_BOOZE, 20, 1, 2).
AddItem(PID_ZIP_GUN, 1).
AddItem(PID_RED_RYDER_LE_BB_GUN, 1).
AddItem(PID_BOTTLE_CAPS, 80, 136, 300)
);
I never opened any grave, but if you did, you probably can tell if it sounds about right or not.
Edit:
Since we are here, we might be interested in finding out what the containers could contain on encounters, for which we would need to check the previous "few" lines for the low, mid and high encounter rolls.
It looks like I wasn't right, because he had different results playing the game, however the final test I left for him, as I wanted to move on to finishing the gambler.
i searched grave.fos and spawner_container.fos too earlier but didnt found anything thats why i asked you
sadly, results arent right i have never found any caps or blueprints in graves and i found alot of other stuff, leather jackets, laser rifles, plasma rifles, combat armors for example
Well in this case, what's left to do is to rewrite (remove most of) the data/functions, to minimize it only to one item, for example an eight ball or something rare.
If you do that, and when u dig graves, find only 8 balls, it will mean that the code is right to look at maybe the randomization is such that one would think differently.