ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Tying info to flash drives.

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  20:34:37  18 October 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
Messages: 133
Tying info to flash drives.

So, I have two ways of doing this, one returns recipe/stash info on the use of an item, the other gives the info when the item enters the player's inventory.

Here are both examples:



function on_item_use (obj)
local info=nil
if obj:section()=="dev_flash1" then
info="info_amk_recipt_simbion"
end
if db.actor==nil or info==nil or db.actor:has_info(info) then
return
end
db.actor:give_info_portion(info)
amk_dialogs.info_received()
end



--alternate scheme

function on_item_take (obj)
local info=nil
if obj:section()=="dev_flash1" then
info="info_amk_recipt_simbion"
end
if db.actor==nil or info==nil or db.actor:has_info(info) then
return
end
db.actor:give_info_portion(info)
amk_dialogs.info_received()
end


Do either of these appear correct? I should probably write one of them into a test script and put the item in question in the escape_dialog.script so I can see for myself.

The aim here is attach information from recipe info, and eventually certain stashes to flash drives so they won't get lost if an NPC dies.

Another thing I intend to do is place the info nested inside stashes, so that in order to find one stash, you may need to find another, and the last one might contain recipe info.

I already know that the SGM mod uses a similar system regarding stashes, and Clear Sky had the actor pay for info. So I'm thinking of hybridizing these qualities with SoC's existing stash system.
  23:13:23  18 October 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
Messages: 133
So I loaded it up, and I'm getting this error.

FATAL ERROR

[error]Expression : fatal error
[error]Function : CInifile::Load
[error]File : E:\stalker\patch_1_0004\xrCore\Xr_ini.cpp
[error]Line : 175
[error]Description : <no expression>
[error]Arguments : Duplicate section 'dev_flash1' found.


stack trace:

There are only 3 files that contain that section the config file, the script file, and and reference in the dialog. I think I may need to edit the script.
  00:40:47  19 October 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
 

Message edited by:
FatalFunnel
10/19/2012 0:42:58
Messages: 133
Okay, so I fixed the duplicate section error, it was just an oversight I made, the .ltx file contained a config that was already called for.

Now after loading up the game, and getting the object from Sid, I can use it, but it doesn't give me the info. I modified the code into this, and I still get nothing.

http://pastebin.com/2hAkR9se

I should probably just leave this to someone who actually knows what they're doing.
  01:24:35  19 October 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
 

Message edited by:
ddraig
10/19/2012 1:31:31
Messages: 158

---QUOTATION---
Okay, so I fixed the duplicate section error, it was just an oversight I made, the .ltx file contained a config that was already called for.

Now after loading up the game, and getting the object from Sid, I can use it, but it doesn't give me the info. I modified the code into this, and I still get nothing.

http://pastebin.com/2hAkR9se

I should probably just leave this to someone who actually knows what they're doing.
---END QUOTATION---



There's a slightly easier way to do this.

You don't really need to create an use object callback, you can use the take item callback that already exists and it will serve pretty much the same function.

So an example:

In the bind_stalker.script file there should be a line saying:


function actor_binder:on_item_take(obj)



Or something along those lines.

Create a quick reference to another script, to make things a bit tidier, along the lines of:


update_info.check_item_take(obj)



Then create a script called update_info.script (or whatever you like, just make sure to change the name in the function you use in bind_stalker) and create a new function along these lines:


function check_item_take(obj)
        if obj:section()=="item_name" then db.actor:give_info_portion("item_info")
end
end



(replace item_name and item_info with whatever item you've created and whatever info portion is going to give you the article you need)

If you want to add more, then use "elseif" with the same functionality but changing the names as appropriate.

What you then need to do, if you haven't done it already, is to create info portions that will give you the articles you want when they're given to you.

This should work, hopefully.

I'm not entirely sure this will work on items that are given to you, or that you buy, since there seems to be an on_trade callback in bind stalker that might need to have a something similar done to it for it to work, but it's worth a shot.

As for the stash thing, the same principle should work if you use take_item_from_box

You can create an item to place in a stash that will hopefully give you the location of another stash. I'm not entirely sure how stashes work so I'm not sure of the specifics.
  02:28:52  19 October 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
 

Message edited by:
FatalFunnel
10/19/2012 2:30:15
Messages: 133

---QUOTATION---
Okay, so I fixed the duplicate section error, it was just an oversight I made, the .ltx file contained a config that was already called for.

Now after loading up the game, and getting the object from Sid, I can use it, but it doesn't give me the info. I modified the code into this, and I still get nothing.

http://pastebin.com/2hAkR9se

I should probably just leave this to someone who actually knows what they're doing.

There's a slightly easier way to do this.

You don't really need to create an use object callback, you can use the take item callback that already exists and it will serve pretty much the same function.

So an example:

In the bind_stalker.script file there should be a line saying:


function actor_binder:on_item_take(obj)



Or something along those lines.

Create a quick reference to another script, to make things a bit tidier, along the lines of:


update_info.check_item_take(obj)



Then create a script called update_info.script (or whatever you like, just make sure to change the name in the function you use in bind_stalker) and create a new function along these lines:


function check_item_take(obj)
        if obj:section()=="item_name" then db.actor:give_info_portion("item_info")
end
end



(replace item_name and item_info with whatever item you've created and whatever info portion is going to give you the article you need)

If you want to add more, then use "elseif" with the same functionality but changing the names as appropriate.

What you then need to do, if you haven't done it already, is to create info portions that will give you the articles you want when they're given to you.

This should work, hopefully.

I'm not entirely sure this will work on items that are given to you, or that you buy, since there seems to be an on_trade callback in bind stalker that might need to have a something similar done to it for it to work, but it's worth a shot.

As for the stash thing, the same principle should work if you use take_item_from_box

You can create an item to place in a stash that will hopefully give you the location of another stash. I'm not entirely sure how stashes work so I'm not sure of the specifics.
---END QUOTATION---



You're right, it seems an item take script is better than having to use it to get the info. I'm glad that you helped me, it should use an actor_binder because that's one of the things I forgot to take into account with this. So, add update_info.script and add info portions.

Thanks, you just saved me man.

Stash information can be added to info portions just like recipes. I'll give an example, when you help Fox in the beginning of the game, he gives coords to a stash, the stash he gives is defined as an info portion.

See:

db.actor:give_info_portion("escape_fox_heal"
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2020 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.