ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Modify fighting distance between actor and ennemies

« Previous 10 events | 1 2 3 | All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  18:29:03  3 February 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
02/03/2013 18:35:06
Messages: 2230

if (enemy:id() == db.actor:id()) then
	local outfit = db.actor:item_in_slot(6)   
	if (outfit == "meceniy_outfit_new") then
		local dist = obj:position():distance_to_sqr(enemy:position())
		if (dist > 25) then
			return false
		end
	end
end



Just try only this in xr_combat_ignore.script at the top of is_enemy function. If it works just build on it. If you want to keep the actor hiding weapon for example place it in the actor_binder:update function. But evaluation of NPCs enemies should be handled directly in xr_combat_ignore.

Eventually you'll need to add a cooldown timer to it so the actor just doesn't go "invisible" when re-equipping the outfit in combat or going out-of-distance.
  09:28:40  4 February 2013
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349

---QUOTATION---

if (enemy:id() == db.actor:id()) then
	local outfit = db.actor:item_in_slot(6)   
	if (outfit == "meceniy_outfit_new") then
		local dist = obj:position():distance_to_sqr(enemy:position())
		if (dist > 25) then
			return false
		end
	end
end



Just try only this in xr_combat_ignore.script at the top of is_enemy function. If it works just build on it. If you want to keep the actor hiding weapon for example place it in the actor_binder:update function. But evaluation of NPCs enemies should be handled directly in xr_combat_ignore.

Eventually you'll need to add a cooldown timer to it so the actor just doesn't go "invisible" when re-equipping the outfit in combat or going out-of-distance.
---END QUOTATION---



I agree, the simpler the better. Although, my code will work if implemenyted correctly and may have done you some good to get it working for a learning experience
  17:58:35  7 February 2013
profilee-mailreply Message URLTo the Top
Belasco1968
(Novice)
 
On forum: 01/28/2013
Messages: 13
Hello Alundaio,
Hello Vintar,

I took a few days to test your two different suggestions of code.
Unfortunately, I get no change in the game.
I tried to reduce the distance at which enemies can see me, but without success.
I also tested to remove the lines of code about the distances. So, I haved a single parameter (if I wear the outfit, the enemies do not attack me).
No change in the game: enemies detect and attack me.

It seems like the game take no count of the code.


With the code of VINTAR:

I only made a change (distance_between(db.actor,enemy) >= 16 instead of <=16) because I wish that enemies cannot detect me on a distance more than 16 meters.
So, I also reverse the lines about hide/restore weapon.

Without call to the function in the bind_stalker (actor_binder:update(delta)), the game load but there is no difference in game.

With a call to the function (meceniy_work.stealthy_approach(npc_id)), the game crash on the load of the saved game with this error:
LUA error: ...ow of chernobyl\gamedata\scripts\bind_stalker.script:240: attempt to index global 'meceniy_work' (a nil value).

With the code of ALUNDAIO:

If I put only the code in xr_combat_ignore, there is no change in game. Enemies detect and attack me at the same distance as usual.

If I delete the two lines about the distance (to test only the reaction of enemies when I wear the suit), the game crash and the error log is:
LUA error: ...shadow of chernobyl\gamedata\scripts\xr_logic.script:226: attempt to index global 'xr_combat_ignore' (a nil value).
So, this time the error is in association with the xr_logic script.

If I put the complete code in xr_combat_ignore and a call to this function (xr_combat_ignore.is_enemy( obj, enemy, st )) in the bind_stalker (under function actor_binder:update(delta)),the game also crash on loading a saved game and now the error is:
LUA error: ...f chernobyl\gamedata\scripts\xr_combat_ignore.script:8: attempt to call method 'id' (a nil value).

I'm completely lost ....
None of the codes produce a change in the behavior of enemies in game.
Ok but WHY ?

Your two codes seem to me logical but they don't show a result in game.

Do you have any idea what I'm doing wrong ??

Thank you in advance !
  22:26:52  7 February 2013
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
Just seems you are not familiar with scripting and are implementing it incorrectly. First mistake you made was naming the script with a .ltx extension. I assume this is fixed. The second mistake you are making must be in the script itself IE syntax errors because your script is not parsed and returning nil. Thirdly, I`m not sure why you changed the distance in my example. you clearly stated that if you are wearing the suit and are less than 16m from any npc then they must not attack you. if you want it so that no-one will attack you further than 16m, well i say its impossible and unrealistic.
  15:39:50  12 February 2013
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
 

Message edited by:
ThunderFreak
02/12/2013 15:41:21
Messages: 685
I think I found a very simple way to get it done.

Take my relation scripts (already send to you) and as long as the actor is wearing a suit of a particular faction, the actor is member of that faction. This should be on large distances only. When the actor is approaching a faction put the actor back in his original faction and then the actor is treated on his original game relation to that faction. Illusion on distance.

Mission accomplished. 8)

For the distance when the actor should be back in his original faction you can set a variable distance to simulate that the faction member detecting you has good eyes or not so good.
  00:23:46  13 February 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
Take my relation scripts (already send to you)
---END QUOTATION---


Hey ThunderFreak, can you send me a copy of those, as well?


Thanks!
  09:24:05  13 February 2013
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
Messages: 685
I modified my relation script so the actor when wearing a specific suit is detected as a member of the faction the suit is belonging to on large distance and when close at a distance of 17 the actor is detected by his original faction.

Here is the link to my sky drive: https://skydrive.live.com/#cid=839FA75832089767&id=839FA75832089767!268
  04:51:16  14 February 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
I modified my relation script so the actor when wearing a specific suit is detected as a member of the faction the suit is belonging to on large distance and when close at a distance of 17 the actor is detected by his original faction.

Here is the link to my sky drive: https://skydrive.live.com/#cid=839FA75832089767&id=839FA75832089767!268
---END QUOTATION---


Thank you, sir!
  20:50:22  14 February 2013
profilee-mailreply Message URLTo the Top
Belasco1968
(Novice)
 
On forum: 01/28/2013
Messages: 13
And so:

1° Creation of a new faction which is neutral with other faction;

2° Attribute the camouflage suit (meceniy_outfit_new from the Stalkersoup Mod) to this new faction;

Everything is working perfectly !

Now, with a selected suit, you can get closer to enemies without being detected by them unless you're too closer of them.
Then you're real community is detected and if you are enemy, npc's try to kill you.

Here's a screenshot of the meceniy suit (camouflage):
[link]http://www.hostingpics.net/viewer.php?id=528980sspascal021413190131l01escape.jpg[/link]

Thanks to all of you for your invaluable help !
 
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-2021 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.