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 ... 11 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  01:23:42  7 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
09/07/2009 1:29:12
Messages: 2433

---QUOTATION---
That code is giving me this CTD when I approach the bridge:

watcher_act.script:160: attempt to index field 'squad_obj' (a nil value)
---END QUOTATION---



It never works the first time I'm gonna give it another look.

[EDIT]

Ok, try this:

function add_to_binder(object, char_ini, scheme, section, st)
local npc = object
st.disabled_objects = {}
local manager = object:motivation_action_manager()
local zombi = npc:character_community() == "zombied" or npc:character_community() == "trader" or npc:character_community() == "arena_enemy" or npc:name() == "mil_stalker0012" or npc:name() == "yantar_ecolog_general" or npc:name() == "mil_freedom_member0021"
local scripted = false
if db.storage[ npc:id() ] ~= nil and db.storage[ npc:id() ].squad_obj ~= nil then
scripted = db.storage[ npc:id() ].squad_obj:hasScriptedTarget()
end
local prop_idlecombat = xr_evaluators_id.state_mgr + 3
local prop_contact = xr_evaluators_id.stohe_meet_base + 1
if npc:story_id()~=4294967296 or zombi or scripted then

tell me if it works.
  02:59:47  7 September 2009
profilee-mailreply Message URLTo the Top
RoboMook
Senior Resident
 

 
On forum: 11/12/2008
Messages: 4387
Nope, 'fraid not

Looks like it's the same line causing problems though, the error I got this time was:

attempt to call method 'hasScriptedTarget' (a nil value)
  03:54:21  7 September 2009
profilee-mailreply Message URLTo the Top
x_Spartan_x
Whos got the Kokoretsi?
(Resident)

 

 
On forum: 07/07/2009
Messages: 1971
mm intresting, i think i know this one,(u guys are testing) il brb later with the positive tests, wont waste your time with negative ones.
so far ive sorted out few things, and also belive its actually more simple than what we think.
ok brb
  10:34:46  7 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433

---QUOTATION---
Nope, 'fraid not

Looks like it's the same line causing problems though, the error I got this time was:

attempt to call method 'hasScriptedTarget' (a nil value)
---END QUOTATION---



Ok, let's try a different method, try this one:

function add_to_binder(object, char_ini, scheme, section, st)
local npc = object
st.disabled_objects = {}
local manager = object:motivation_action_manager()
local zombi = npc:character_community() == "zombied" or npc:character_community() == "trader" or npc:character_community() == "arena_enemy" or npc:name() == "mil_stalker0012" or npc:name() == "yantar_ecolog_general" or npc:name() == "mil_freedom_member0021"
local board = sim_board.get_sim_board()
local scripted = false
if board ~= nil and board.squads ~= nil then
for i,squad in pairs(board.squads) do
for a,checked_npc in pairs(squad.squad_npc) do
if checked_npc:name() == npc:name() then
if squad:hasScriptedTarget() then
scripted = true
end
end
end
end
end

local prop_idlecombat = xr_evaluators_id.state_mgr + 3
local prop_contact = xr_evaluators_id.stohe_meet_base + 1
if npc:story_id()~=4294967296 or zombi or scripted or (board.squads == nil) then



Revert to the original version of the file and then add the changes. Let's hope it works this time.
  12:13:54  7 September 2009
profilee-mailreply Message URLTo the Top
x_Spartan_x
Whos got the Kokoretsi?
(Resident)

 

 
On forum: 07/07/2009
Messages: 1971
would this work, an if not, how would i disable certain items, im not really getting crashes, just not working, i havnt tryed this yet.. going now

class "act_grab_item" (action_base)
function act_grab_item:__init (action_name, st) super (nil, action_name) self.st = st end
function act_grab_item:initialize() action_base.initialize(self) local npc=self.object npc:set_item(object.idle,nil) npc:set_movement_type(move.walk) npc:set_mental_state(anim.danger) npc:set_body_state(move.crouch) npc:movement_enabled(true) local gi=getGObject(self.st) npc:set_sight(look.danger,nil,0) self.st.block_search=true if gi then if(IsStalker(gi) or IsMonster(gi)) then self.tt=time_global()+3000 else self.tt=time_global()+1000 utils.send_to_nearest_accessible_vertex(npc,gi:level_vertex_id()) end end self.force=vector():set(0,0,0) end
function act_grab_item:execute() action_base.execute(self) local npc=self.object local gi=getGObject(self.st) if not gi then return end if self.tt<time_global() then if gi and gi arent()==nil then gi:transfer_item(gi,npc) npc:enable_memory_object(gi,false) end clearGObject(self.st) end end
function act_grab_item:finalize() local npc=self.object self.st.block_search=nil npc:set_sight(look.danger,nil,0) trigger_timed(self.st,"tm1" self.st.dest_lvid=nil action_base.finalize(self) end
local nonos=item:section()~="bread" or item:section()~="bread2"
if nonos then
manager:add_action (actid_grab_item, (false))
end

nonos are the code word, for that trigger, the trigger is only thing that should trigger it.


as for your prob, i think you can just add the the Zombi triiger, on the list, exa

local zombi=npc:character_community()=="zombied" or npc:character_community()=="trader" or npc:character_community()=="arena_enemy" or npc:name()=="mil_stalker0012" or npc:name()=="yantar_ecolog_general" or npc:name()=="mil_freedom_member0021"

just add the actaul spawned names or codes from that particalaur area, dont forget the descr and misc\script for names and codes.

you might even have to open all.spawn and get the actual number codes, not sure, i still stuck on disabling items

brb
  17:00:45  7 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
I've cleared up the watcher_act.script a bit, I think it's going to be easier to read now.

Here's a link:

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

I havn't tested it though.

I also added two state restrictions, one for scripted squads and one for squads that are on the move, I don't know how will that turn out in practice. I know that one consequence is that squads will only start loonting if they find bodies on their final destination.
  20:09:53  7 September 2009
profilee-mailreply Message URLTo the Top
RoboMook
Senior Resident
 

 
On forum: 11/12/2008
Messages: 4387

---QUOTATION---
I also added two state restrictions, one for scripted squads and one for squads that are on the move, I don't know how will that turn out in practice. I know that one consequence is that squads will only start loonting if they find bodies on their final destination.
---END QUOTATION---



That sounds beneficial to me, it should stop the whole squad from committing suicide when one of them walks into an anomaly whilst travelling between points

Also, having them loot along the way can cause problems with the faction wars, it's yet another thing to distract NPC's on their way to capture a point. So that's a good move in my book.

I'll give it a test shortly...
  21:00:52  7 September 2009
profilee-mailreply Message URLTo the Top
RoboMook
Senior Resident
 

 
On forum: 11/12/2008
Messages: 4387
Ok that new one gives me this CTD:

watcher_act.script:516: attempt to index local 'checked_npc' (a number value)

The script looks nice and tidy now though, good work
  23:02:51  7 September 2009
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433

---QUOTATION---
Ok that new one gives me this CTD:

watcher_act.script:516: attempt to index local 'checked_npc' (a number value)

The script looks nice and tidy now though, good work
---END QUOTATION---



Yeah, apart from the fact that it's not working

Try this one:

http://www.megaupload.com/?d=EFWZV682
  23:16:57  7 September 2009
profilee-mailreply Message URLTo the Top
RoboMook
Senior Resident
 

 
On forum: 11/12/2008
Messages: 4387
Thats giving me:


---QUOTATION---
attempt to call method 'hasScriptedTarget' (a nil value)
---END QUOTATION---



still doesn't seem to like that one
 
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-2019 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.