ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
NPC Looting Script fix

« Previous 10 events | 1 2 3 4 5 6 7 8 9 10 11 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  03:26:07  8 September 2009
profilee-mailreply Message URLTo the Top
x_Spartan_x
Whos got the Kokoretsi?
(Resident)

 

 
On forum: 07/07/2009
Messages: 1971
nice file clean, il give it a few shots at it, i think i know that error,

the item\obj disabling im sort of figuered it out about 90 percent, its the damn tests take long,
ok il be back.

PS; i really dont want to remove looting from my mod, im not giveing up, damn it.
  12:59:03  8 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433

---QUOTATION---
Thats giving me:

attempt to call method 'hasScriptedTarget' (a nil value)

still doesn't seem to like that one
---END QUOTATION---



strange, it works fine in my game.
  13:16:55  8 September 2009
profilee-mailreply Message URLTo the Top
x_Spartan_x
Whos got the Kokoretsi?
(Resident)

 

 
On forum: 07/07/2009
Messages: 1971

---QUOTATION---
Thats giving me:

attempt to call method 'hasScriptedTarget' (a nil value)

still doesn't seem to like that one
---END QUOTATION---



i get same.
  23:00:13  8 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
09/09/2009 0:18:11
Messages: 2433
I am so SORRY! I was using a modified sim_squad_generic. It's natural that you don't have "hasScriptedTarget" defined.

There, this should prevent scripted squads from looting.

http://www.megaupload.com/?d=4KCUBL0D

RoboMook, what I changed is a global condition, meaning that it is set only once when the squad is spawned. Determining if squad is moving or not would be a dynamic condition because it changes frequently and I still don't know where those are set, so this will have to wait.

[EDIT]

I believe that conditions for "looting trigger" are defined in this function:

function ev_see_stuff:evaluate()

this part to be exact:

if (not npc:alive()) or xr_wounded.is_wounded(npc) or npc:best_enemy() or bad_danger(npc) or (actsch and db.storage[npc:id()][actsch].no_loot) then
if res then
freeGObject(self.st)
end
return false
end

default breaking conditions are:

not npc:alive() - looting npc is dead

xr_wounded.is_wounded(npc) - looting npc is squeaking on the ground

npc:best_enemy() - looting npc has a target

bad_danger(npc) - looting npc has enemies nearby

(actsch and db.storage[npc:id()][actsch].no_loot) - I believe that this means that looting npc cannot cary anything. This probably refers to "dont_spawn_character_supplies" command but I wouldn't bet money on it.

So, any more breaking conditions needed?

[EDIT2]

Checked, it works.

I added a condition that when squads are moving to another location then they won't stop to loot. Don't know if you want that one in or not.


There is one thing that bugs me though... Apparently the Hunting Rifle is higher in weapon hierarchy then any other Assault Rifle. Consequently npcs equip it whenever they pick up one. I really hate it when my Freedom guys in exos are running around with two shot peashooter. I tried to check it out but apparently this is handled by a hard-coded function "best_weapon()" so it would require to write a whole new script with a complete list of weapons and add each weapon some kind of value and weapons with bigger value would get selected first. After realising this I gave up on this idea.
  02:35:32  9 September 2009
profilee-mailreply Message URLTo the Top
RoboMook
Senior Resident
 

 
On forum: 11/12/2008
Messages: 4387

---QUOTATION---
I added a condition that when squads are moving to another location then they won't stop to loot. Don't know if you want that one in or not.
---END QUOTATION---



I'd certainly at least want to try that out, as it may help out with some undesirable behaviour (eg wandering into anomalies or hanging around looting instead of capturing the target).



---QUOTATION---
There is one thing that bugs me though... Apparently the Hunting Rifle is higher in weapon hierarchy then any other Assault Rifle. Consequently npcs equip it whenever they pick up one. I really hate it when my Freedom guys in exos are running around with two shot peashooter. I tried to check it out but apparently this is handled by a hard-coded function "best_weapon()" so it would require to write a whole new script with a complete list of weapons and add each weapon some kind of value and weapons with bigger value would get selected first. After realising this I gave up on this idea.
---END QUOTATION---



I'm still rather confused about exactly how the game ranks weapons for NPC's - the three things that I suspect are involved are the class, ef_weapon_type & ef_mainweapon_type specified in the weapon configs, and possibly mp_ranks.ltx (it certainly references that file when NPC's are deciding weather to pick-up a weapon).

The reason they like shotguns so much may well be that they are a higher ef_weapon_type (shotguns are all 7, assault rifles are 6), the only thing higher is sniper rifles.

Here's the ef_weapon_type ranks as I understand them:

1 - knife
5 - pistols
6 - assault rifles (inc. PKM)
7 - shotguns
8 - sniper rifles (inc. vintorez)
9 - ??
10 - thrown grenades

The ef_mainweapon_type value only exists in the 'main weapon' configs, not the pistols. Don't know what it does, it seems to be set the same for similar weapons, so maybe it has some bearing on how NPC's use a weapon (fire mode, distances, etc), I'm going to do some tests on this and see if I can clarify it's purpose.

Not entirely sure if the class has any bearing on it or not, but there are some patterns, for example the Groza & FN2000 have a class of their own (wp_groza), they also both have built-in grenade launchers, so the weapon class may have some bearing on NPC behaviour or preference. Again I need to test this, and also how mp_ranks is involved (if indeed it is).

I'll get back with (hopefully) some answers
  02:50:04  9 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
09/09/2009 2:51:10
Messages: 2433
@ RoboMook - did the file I uploaded work for scripted squads?

Here is the script with "move" condition blocker:

http://www.megaupload.com/?d=M3Y5NKPZ
  02:51:44  9 September 2009
profilee-mailreply Message URLTo the Top
RoboMook
Senior Resident
 

 
On forum: 11/12/2008
Messages: 4387

---QUOTATION---
@ RoboMook - did the file I uploaded work for scripted squads?

Here is the script with "move" condition blocker:

http://www.megaupload.com/?d=M3Y5NKPZ
---END QUOTATION---



Just about to try it out (been offline for a while).

Will get back to you in a moment...
  03:01:36  9 September 2009
profilee-mailreply Message URLTo the Top
RoboMook
Senior Resident
 

 
On forum: 11/12/2008
Messages: 4387

---QUOTATION---
@ RoboMook - did the file I uploaded work for scripted squads?

Here is the script with "move" condition blocker:

http://www.megaupload.com/?d=M3Y5NKPZ
---END QUOTATION---



Well, I just fired-up the Limansk bridge mission and I didn't get any CTD's or console errors, but it didn't stop the CS squad from looting

I used the second one you posted btw.
  12:32:12  9 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
09/09/2009 15:42:19
Messages: 2433

---QUOTATION---
@ RoboMook - did the file I uploaded work for scripted squads?

Here is the script with "move" condition blocker:

http://www.megaupload.com/?d=M3Y5NKPZ

Well, I just fired-up the Limansk bridge mission and I didn't get any CTD's or console errors, but it didn't stop the CS squad from looting

I used the second one you posted btw.
---END QUOTATION---



Hmm, now I see that the CS squad near the bridge is actually not scripted. I cannot find any scripted CSky squads in squad_descr_redforest.ltx. How the hell did they do this?

Are the bridge CSky npcs actually a squad or just a bunch of individual npcs? Check the PDA map if they have a squad dot.

[EDIT]

I added a condition to prevent looting for individual npcs anyway as almost all of them are suppose to be part of the storyline and some arn't suppose to move at all.

http://www.megaupload.com/?d=TX405OO5

Check if this one works, and still tell me if the csky guys near the bridge are a squad or not. And if there is a squad dot tell me if there are more then 5 csky guys around.

[EDIT2]

@ RoboMook - You're right about the weapon_type thing.
The higher the number the more preferable the weapon is. I wouldn't change the value in there though as changing the weapon type value might influence the way in which a given weapon is used by npc. I'm going to have to go around it somehow. :/
  15:45:08  9 September 2009
profilee-mailreply Message URLTo the Top
x_Spartan_x
Whos got the Kokoretsi?
(Resident)

 

 
On forum: 07/07/2009
 

Message edited by:
x_Spartan_x
09/10/2009 9:33:50
Messages: 1971

---QUOTATION---
@ RoboMook - did the file I uploaded work for scripted squads?

Here is the script with "move" condition blocker:

http://www.megaupload.com/?d=M3Y5NKPZ

Well, I just fired-up the Limansk bridge mission and I didn't get any CTD's or console errors, but it didn't stop the CS squad from looting

I used the second one you posted btw.

Hmm, now I see that the CS squad near the bridge is actually not scripted. I cannot find any scripted CSky squads in squad_descr_redforest.ltx. How the hell did they do this?

Are the bridge CSky npcs actually a squad or just a bunch of individual npcs? Check the PDA map if they have a squad dot.

[EDIT]

I added a condition to prevent looting for individual npcs anyway as almost all of them are suppose to be part of the storyline and some arn't suppose to move at all.

http://www.megaupload.com/?d=TX405OO5

Check if this one works, and still tell me if the csky guys near the bridge are a squad or not. And if there is a squad dot tell me if there are more then 5 csky guys around.
---END QUOTATION---



look in misc\script not desc.

or its in all.spawn. il look in all.spawn see if i can find, i only from now, have time to check looting script, altho i did try this, and will finish the res of test tomoro(had comp probs all day, plus i got to release v0.3 of add'on)
mmm il see what happens, and il specificly find the squads for you.

st.disabled_objects = {
item:section() ~= "bread"=true,
item:section() ~= "bread2"=true,
item:section() ~= "kolbasa"=true,
item:section() ~= "kolbasa2"=true
}

ive paced this at bottom of script, it was left blank, so i belive here you add the items\obj you dont want them to pick up.
i think here or maybe in the other, il test this and report.

PS; i got 2 types of bread and sausage, so its just test to see if they dont pick those up, later il fill it in properly.

hope this works.
 
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.