ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
Finding out what artifacts are on the actors belt

« Previous 10 events | 1 2 | All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  11:17:42  22 January 2011
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
Why do I always have to know everything...
There is a custom script called inventory.script which you can get from this mod: http://www.megaupload.com/?d=1PE9WLXG

However, it is used for SoC where it was doing a check of the belt content every time the player used the open/close inventory action. Since CS has no inventory open/close callback, at least not that I know of any, it has to be binded some other way. The trick is, you cannot use the standard :update(delta) function as the belt checking method spawns a game object which the author called a "separator". It's used as a marker for the iterate_inventory function to mark where the items iterated change from standard ones to attached ones. But the thing is, if we bound it to an updating function, it would clog the memory by constantly adding and removing the object to the server. Plus, I don't know how the changing amount of slots might affect the script's functioning, but it's a start right?
  11:45:36  22 January 2011
profilee-mailreply Message URLTo the Top
SetaKat
Ex modder, Zones only ferret and will someday release a game
(Resident)

 

 
On forum: 02/20/2010
Messages: 6340
And all I wanted to do was find out what artifacts were on the belt, see if they increase the actors satiety, and increase the actors satiety if they did.
Guess my hunger mod might have to go without this feature.
  12:52:33  22 January 2011
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
Messages: 1072
As mnn requested...

http://pastebin.com/M2QSbaYZ

However, since Smoq knows more about it...lol...I'd defer to him.
  14:14:54  22 January 2011
profilee-mailreply Message URLTo the Top
mnn
Senior Resident
 

 
On forum: 06/12/2009
Messages: 2694
smoq: So essentially that guy found out that :inventory_for_each() first serves items in backpack, then attached ones, right? Interesting...

btw. CS has the same callback functions as CoP does
actor_menu.script
AFAIK, not all of those worked in CoP, so this might apply for CS as well. I'm sure open/close inventory, dialog, dead body search works.

fluffy: Here's mockup, it wasn't tested. Add your own code to artifact_check.script

http://www.mediafire.com/?1237qcm19mpepat
  20:51:27  22 January 2011
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
01/22/2011 20:52:11
Messages: 2433

---QUOTATION---
smoq: So essentially that guy found out that :inventory_for_each() first serves items in backpack, then attached ones, right? Interesting...
---END QUOTATION---



Exactly. First it goes through "loose" items, then it lists items in slots. Which is logical, cause I believe items in backpack is an array while slots are probably just inexes. Thanks for the tip about actor_menu.script. Since the SoC method of inventory UI callback was missing in CS, I assumed they just scapped it.

@ Fluffy - Just remember the belt array is only updated when opening/closing the inventory UI, so if you remove an artifact via script from the belt, it will still be present in the belt array. Another thing is, that he array will still hold that artifact's data even if you remove it in-game using the inventory UI untill you close it.
This is why I didn't like this idea. I tweaked the file for SoC to update the array when you operate on belt items as well, but sent it to the guy who requested the moddification an deleted it after.
  21:46:41  22 January 2011
profilee-mailreply Message URLTo the Top
mnn
Senior Resident
 

 
On forum: 06/12/2009
Messages: 2694
smoq: When he remove artifacts in script, he can just call inventory.update() (+ some minor modification).

So how do you update the array when you operate on belt items? The only way I can think of is that you periodically check the inventory.
  15:36:14  23 January 2011
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
[qutoe]smoq: When he remove artifacts in script, he can just call inventory.update() (+ some minor modification).
---END QUOTATION---


I'm aware of that, but still, this is something that should not be omitted.


---QUOTATION---
So how do you update the array when you operate on belt items? The only way I can think of is that you periodically check the inventory.
---END QUOTATION---



Yes, every 1.5 second should be enough and only when the inventory is open. Plus the check should first "check" if the positions of items in the belt switched and only then do the belt checking. To do that simply create an array of item ids in the inventory when it is opened, and have another function compare it to the actual inventory state every 1.5 seconds. If they don't match, substitute the inital array with the current one and do the belt checking. If you simply do the belt checking periodically without the method I mentioned, in SoC the item's description that is in the centre of the UI will be gone(in CS the popup displaying the item's description and stats might disapper) because of the spawning of the "separator" item required for the belt check.

check check check...
 
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.: Clear Sky 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.