ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Call of Pripyat Forum » Mod discussion
se_actor:STATE_Write and STATE_Read corruption

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  01:40:24  22 January 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
Messages: 2230
se_actor:STATE_Write and STATE_Read corruption

Anyone happen to know why the packet becomes corrupt when you try to add more properties? With other server objects you can add more data to be saved.

Also it appears that STATE_Read is called first before STATE_Write on a new game which is odd. Seems the packet is different sizes depending on whether the is loading a save or not.

I really need to be able to load certain data before any other object initializes or registers.
  10:35:44  22 January 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
Messages: 2230
Okay, in the future, if anyone is interested:


function se_actor:STATE_Read(packet, size)
	cse_alife_creature_actor.STATE_Read(self, packet, size)
	-- ïîä LevelEditor íå ïûòàòüñÿ ÷èòàòü èç ïàêåòà íè÷åãî
	if editor() then
		return
	end
--	if self.m_registred ~= true then
--		return
--	end
	if db.actor == nil then
		set_save_marker(packet, "load", false, "se_actor")
		self.start_position_filled = packet:r_bool()

		alun_utils.printf("size = %s",size)
		if (size >= 156) then
			-- Add stuff
		end
		set_save_marker(packet, "load", true, "se_actor")
	end
end



It appears on new game start the initial packet is a different size. Simply check if the size is greater then 156 and then you can add more properties as you wish.
  13:48:56  22 January 2013
profilee-mailreply Message URLTo the Top
gatopardo
Gato
(Resident)

 

 
On forum: 11/08/2011
Messages: 824

---QUOTATION---
Okay, in the future, if anyone is interested:


function se_actor:STATE_Read(packet, size)
	cse_alife_creature_actor.STATE_Read(self, packet, size)
	-- ïîä LevelEditor íå ïûòàòüñÿ ÷èòàòü èç ïàêåòà íè÷åãî
	if editor() then
		return
	end
--	if self.m_registred ~= true then
--		return
--	end
	if db.actor == nil then
		set_save_marker(packet, "load", false, "se_actor")
		self.start_position_filled = packet:r_bool()

		alun_utils.printf("size = %s",size)
		if (size >= 156) then
			-- Add stuff
		end
		set_save_marker(packet, "load", true, "se_actor")
	end
end



It appears on new game start the initial packet is a different size. Simply check if the size is greater then 156 and then you can add more properties as you wish.
---END QUOTATION---



What kind of stuff? properties with size > 156? I don't understand, maybe as I don't know what that script does.
  14:10:24  22 January 2013
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: 6342
Its packet_utils script, so its quite high level Stalker scripting. Its not a vanilla script, so don't worry too much about it.
  14:14:17  22 January 2013
profilee-mailreply Message URLTo the Top
r_populik
Senior Resident
 

 
On forum: 11/06/2011
Messages: 213

---QUOTATION---
its quite high level Stalker scripting
---END QUOTATION---


Well said.
  22:48:09  22 January 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
Messages: 2230
It is a modified STATE_Read function from vanilla se_actor.script.



---QUOTATION---
What kind of stuff? properties with size > 156? I don't understand, maybe as I don't know what that script does.
---END QUOTATION---



If you are familiar with saving data on objects, such as in se_stalker:STATE_Write and se_stalker:STATE_Read then this could be useful for someone. The example I showed is how to do it properly for se_actor. The size check just ensures not to save data on a new game so it doesn't corrupt the save.
 
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.: Call of Pripyat Forum » Mod discussion
 

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


 

Copyright © 1995-2022 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.