ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
NPC spawned by script automatically grouping even from across the map

Posted by/on
Question/AnswerMake Oldest Up Sort by Ascending
  17:02:05  22 February 2015
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
02/22/2015 17:02:48
Messages: 319
After further testing, I found out that using a silenced weapon didn't help either.
Even with proper comments on the ".ogg" sound files, all NPC from the same faction keep coming to investigate the "unfortunate accident" from across the map.

Why is this happening?
  13:44:27  22 February 2015
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
Messages: 319
NPC spawned by script automatically grouping even from across the map

Hi S.T.A.L.K.E.R.S.!

I'm having a problem with my NPCs.

Let's say that I spawn 2 neutral stalkers by script, very far from each other (they can't see or hear each other).
When I shoot one of them, the other "knows" it and come right to where I shot the first one to investigate, like he heard the shot or the screams...

How can I make it so that NPCs from the same faction aren't affected by this? Let's say that every time I spawn an NPC, I want him to be in a "new" group so when I kill him, no other NPC will care about it, even if they are from the same faction.


I did some testing with the all.spawn and Tolik, Wolf and Petruha to check if the variables "g_squad" & "g_group" had an impact on this matter and it did.
So I tried to manipulate those variables with "packet_utils.script" right after spawning a NPC but it doesn't do anything.
I change Tolik's "g_squad" to 1 and "g_group" to 127 so when I spawned 2 NPC, at least one of them should be "grouping" with him, but no cigar
Here's the code I'm running:
function spawn_npc(p_group)

local f_npc
	
local f_pos
local f_level_id
local f_game_id
local f_object_data

	
	f_pos			=	db.actor:position()
	f_level_id		=	db.actor:level_vertex_id()
	f_game_id		=	db.actor:game_vertex_id()

	f_npc			=	sim:create("esc_stalker_respawn_1", f_pos, f_level_id, f_game_id)
			
	f_object_data			=	packet_utils.get_object_data(f_npc)
	
	if (p_group == true) then
		f_object_data.g_squad	=	1
		f_object_data.g_group	=	127
	else
		f_object_data.g_squad	=	2
		f_object_data.g_group	=	30
	end
	
	packet_utils.set_object_data(f_npc, f_object_data)
	
	
end

Please note that when changing the variables for Tolik, Wolf and Petruha directly in "all.spawn", it does what it's supposed to do, meaning I can kill Wolf without the rookie camp moving a finger, as they are'nt in the same group anymore. Same with Tolik and Petruha, who are in the same group by default.


I also tried to alter their logic by setting a [danger@ignore] section. It kinda worked, as the stalkers from afar didn't get up to rush me, but once I got close to them, they were already enemies, because they "knew" I killed one guy from their faction 2km away...
I also looke into some script to find how NPC would detect a danger and eventually enter combat mode but didn't get far.


Thanks for any input on this.
SacriPan!
 
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.