Random Stashes

Discussions on Modding of S.T.A.L.K.E.R. SoC & Clear Sky

Postby nandersen on 02 Oct 2008 08:57

Sounds exciting EggChen, when do I get to play it? :bounce:

EDIT: DOH! Why did I suggest the profit setup function? Now I see that I have a function for random gifts that is much closer to what you wanted in your first post...
Code: Select all
-- setup table of gift items based on what actor has in the various slots
-- for weapons this will randomly select one of applicable ammo types
-- for other item types one of the non_ammo_gift_items elemets will be used

local function setup_gift_items(actor, npc)
    for _, slot in ipairs(equipment_slots) do
        local item = actor:item_in_slot(slot)
        if item ~= nil then
            local ammo_list = utils.cfg_get_string(system_ini(), item:section(), "ammo_class", nil, false, "", nil)
            if ammo_list ~= nil then
                local ammo_table = {}
                for ammo in string.gfind(ammo_list, "([^,%s]+)") do
                    table.insert(ammo_table, ammo)
                end
                gift_item_by_slot[slot] = ammo_table[math.random(1, #ammo_table)]
            else
                gift_item_by_slot[slot] = non_ammo_gift_items[math.random(1, #non_ammo_gift_items)]
            end
        end
    end
end
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Postby EggChen on 02 Oct 2008 20:45

Well I started to package it into a mini-mod, but it did not work :scratch:

It works in my install built ontop of the ZRP, I have not yet figured out why it does not work in vanilla... told you I'm a scripting noob!!

I think it would work for those using ZRP, it would just take some minor tweaks to change my custom items into others.

Let me know if you want the files.
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Postby nandersen on 02 Oct 2008 21:24

Sure, send me the files and I'll take a look at it when I feel lucky.
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Postby EggChen on 02 Oct 2008 21:27

Done :salute:
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Postby nandersen on 03 Oct 2008 16:57

Hehe, forget what I posted about the config parsing and take a look at the function parse_spawns() in treasure_manager.script - it does everything for you... wish I had looked at it earlier #-o
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Postby EggChen on 03 Oct 2008 23:25

Hey nandersen, those files look much better than my version!!
Just tweaking the stashes to include my new items and I'm good to go, just feel a bit embarrased at how poor my script was in comparison, but I was pleased to get it working at all.

You should release that as a mini-mod :thumbright:
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Postby nandersen on 03 Oct 2008 23:48

EggChen, I'm happy that you got it to work.

I'm about to start a new game to test it. Could you send me an updated random_treasure.ltx once you're done with the stash contents? I like surprises :colors:
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Postby EggChen on 03 Oct 2008 23:53

Will do, I may have to tweak it a bit tomorrow, I have quite a few items in my game not in vanilla.

Thanks again :salute:
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Postby VINTAR on 06 Oct 2008 07:52

nandersen wrote:Hehe, forget what I posted about the config parsing and take a look at the function parse_spawns() in treasure_manager.script - it does everything for you... wish I had looked at it earlier #-o


Man, you beat me to it. I was going to say use the treasure_manager. I was tinkering with it the other day and didnt even think to suggest it untill I saw your post. Looks pretty simple the way they did it allthough I must say it doesnt look too unlike your original code Eggchen :rr:
Core2Quad Q8300 2.5 @ 3.6ghz
Cooler Master Hyper TX 2 CPU cooler
Gigabyte EP45 UD3R mobo
Nvidia GTS450
2 GIGS Transcend DDR2 800 pc6400 @ 960
Thermaltake Tough Power 650w PSU
Samsung Syncmaster P2350
-----------------------------------
Apartheid veteran
User avatar
VINTAR
Senior Resident
 
Posts: 441
Joined: 18 Sep 2008 15:07
Location: Durban, South Africa

Postby nandersen on 12 Oct 2008 09:50

I found a glitch: the code uses the name of current level and not the level that the stash is on.
This means e.g. that if you get stash info in Cordon about something in Agroprom, you'll end up with stash in Agroprom that has "Cordon items" in it.
The following code can be used to get correct level name:
Code: Select all
local glevel = game_graph():vertex(obj.m_game_vertex_id):level_id()
items_section = sim:level_name(glevel) .. "_items"
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Postby EggChen on 12 Oct 2008 13:42

Cheers nanderson, I actually preferred it that way though!

My theory was it would randomise stashes even more, and would still be balanced, as I thought that the level on which you were doing the killing was a good indication of your game progress. I also thought that someone in Garbage (rookie for example) would not have left an Abakan in Darkvalley, he would have taken it with him... though he may have left some ammo, etc.

I have not forgot doing the ltx for you, just been away a few days, should be on my own PC this evening though.

I tweaked a few of the conditions in the treasure_manager ltx to make some of the worst cross level stashes less of a problem. Example, Fang's stash in Pripryat can only be found in Yantar, so I removed that condition.

One of the worst examples though is the Bar, you will rarely find any of the items in the Bar list, as you don't normally get to kill many people in the Bar. I thought about changing that stashlist to mirror the Wild Territory list, but I think now I will use that code of yours just for Bar stashes.

Cheers buddy.
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Postby busetibi on 12 Oct 2008 14:11

speaking of Bar Stashes....
I can normally get four or five stashes in the Bar, but has anyone ever got the supposed armour in the Duty Compound?
User avatar
busetibi
Senior Resident
 
Posts: 464
Joined: 12 Sep 2008 23:17
Location: Gold Coast, Australia

Postby EggChen on 12 Oct 2008 17:44

Hmm, no, can't say I ever got that one... but the "condition" is not very open :

condlist = {=npc_rank(veteran)} 1
community = stalker

So, only a veteran Stalker can give you that stash, maybe if the community was opened up to stalker, bandit, killer, etc....

Don't know about you, but I play the game as a real good guy, defending every neutral Stalker I can and never taking a mission off anyone to kill a neutral guy.

Perhaps we need an evil streak to get that stash :angryfire:
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Postby nandersen on 12 Oct 2008 21:57

Cheers EggChen :)

Here you have "my version" of the stash minimod.
It works with 1.0005BFX and should work with ZRP also:

http://zhat.dk/stalker/random_stashes_v1.0.zip
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Postby EggChen on 12 Oct 2008 22:25

You should release that buddy.

I for one, always wanted random stashes, but my limited scripting knowledge prevented my own attempt until now. Even then, your script is far better than mine (even a novice like me can see that!!).

I appreciate all your help on this, you should release it on Stalkerfiles.
Would be nice to see a non-CS mod :rr:

Edit: If you do a public release, you may as well remove the reference to my mod. It was only intended for my own use, and yours is far better. I have a heavily modded game, but I could never do the credits for it now, its been work in progress for over a year!! It was more because I enjoy learning things like this. I could never release it.

I usually do little standalone mods.

Edit2: That looks great nandersen, the only thing I would do to it would be lower the probability of a vanilla stash to 10, and lower some of the items to keep the game about survival.

So, I will tweak it, you want my version still? Yours looks pretty good as it is!!
User avatar
EggChen
Moderator
 
Posts: 1016
Joined: 13 Sep 2008 00:44
Location: Birmingham, UK

Postby nandersen on 13 Oct 2008 17:57

Thanks for the encouraging words EggChen :)

OK, I'll put it on my S.T.A.L.K.E.R. minimods page http://zhat.dk/stalker/ when I have tested it a bit more.

I'll remove reference to your mod if you don't plan to release it - though I think that you should, it sounds like you have a lot of cool stuff in it by now.

You may be right about vanilla stash content - I'll lower it to 5% in the default setting.

I think that the stash items are OK at least for vanilla game. Even though the config looks like you may get a lot of really good stuff I don't see this happen when playing the game. I'd say that getting your hands on the groza_m1 before your first mission in Cordon has a much bigger impact on gameplay. Besides, many of the really good items are not necessarily that useful at the time that you find them. This balances the fact that they are worth a lot... and finally, it could make you choose an entirely different path through the game ;)
User avatar
nandersen
Senior Resident
 
Posts: 212
Joined: 17 Sep 2008 17:24

Previous

Return to Modding Techniques

Who is online

Users browsing this forum: No registered users and 23 guests

cron