ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
NPC guard run to his post

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  18:46:02  2 August 2014
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
Messages: 319
NPC guard run to his post

Hy guys,

When I assign a guard job to a NPC (via script/packet_utils), he runs towards the location if it's too far from its current position. Is there a way to make him go there only by walking?

It's a real problem cause if I got a team of 2 NPC spawning at the same spot and 1 is supposed to be a guard and the other is supposed to sit at a campfire, they don't make the "trip" together, which kinda ruins the idea of a group.

Is there a way to force the guard to walk all the way?
  20:11:35  2 August 2014
profilee-mailreply Message URLTo the Top
Steelyglint
Senior Resident
 

 
On forum: 06/06/2009
Messages: 5171
Could you give him instruction just to act as the 'campfire' NPC does until they reach the required spot, then have him reaching there trigger his 'guard' task?

.
  21:16:57  2 August 2014
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
08/03/2014 15:56:34
Messages: 319
I already thought of that workaround but I would have to assign the guard NPC to the campfire, which isn't good, since more than 8 NPC around the campfire is the maximum.
Let's say the guard I spawned is given the temporary job to go to a campfire, if 8 NPC are already assigned to it, this NPC will just stay still, his weapon holstered.

Besides, I would still have to know when he reaches the camp.
I could use a space restrictor though, but I don't know how it works (yet).

I could make a dummy job which is neither a guard job, neither a camper job and use a space restrictor and then give him is guard job.
Sounds a bit complicated just for what I wanna do.

I was hoping for a solution related to how AI choose its pace when going to a specific job.


EDIT:
I can't do anything if it implies doing it when the NPC reaches his guard job, as the player can witness this, I can't switch him offline and then back online in front of the player.
It has to be done when I assign him his logic. So I guess the dummy job and the space restrictor are definitely out of the question.
  16:36:31  3 August 2014
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
Messages: 319
Found it!

I changed "dist_walk" and "dist_run" in move_mgr.script to a higher value.
Indeed, NPC would start running if there objective was further than 10 meters...

Case closed
  13:41:06  7 August 2014
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
In logic you add:
def_state_moving1 = walk
def_state_moving2 = walk
def_state_moving3 = walk



IIRC
  13:59:18  7 August 2014
profilee-mailreply Message URLTo the Top
SacriPan
Senior Resident
 

 
On forum: 09/20/2009
 

Message edited by:
SacriPan
08/07/2014 13:59:58
Messages: 319
Good to know

But actually, I think it's the same thing, since these states of movement are defined in the "move_mgr.script" and applied to the NPC, depending on the variables "dist_walk" and "dist_run".

Here (from move_mgr.script):
--printf("_bp: move_mgr: distance to destination waypoint: %d", dist)
if dist <= dist_walk or t < self.walk_until then
self.cur_state_moving = self.default_state_moving1
elseif dist <= dist_run or t < self.run_until then
self.cur_state_moving = self.default_state_moving2
else
self.cur_state_moving = self.default_state_moving3
end


Thanks anyway.

BTW Vintar, did you have an other look at my other thread where NPC don't apply logic after I saved the game?
I use a workaround now so my MOD is "OK", but this problem remains very intriguing nonetheless
 
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-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.