methods to hook dead_body_search_wnd_closed event plus another q?

sLoPpYdOtBiGhOlE
Scavenger
Posts: 36
Joined: 12 Jun 2017, 23:44

methods to hook dead_body_search_wnd_closed event plus another q?

Postby sLoPpYdOtBiGhOlE » 23 Jun 2017, 06:38

Hi,

I'd like to catch the event when player exits a container inventory preferably without editing the vanilla scripts that ship with CoC..
I saw in actor_menu.script there is a function that fires when the player exits the container menu.

Code: Select all

function dead_body_search_wnd_closed()
   --printf("---:>DeadBodySearch closed")
   dead_body_searching = false
   bind_container.curBoxID = nil
end


So I added a SendScriptCallback("dead_body_search_wnd_closed") to the function.

Code: Select all

function dead_body_search_wnd_closed()
   --printf("---:>DeadBodySearch closed")
   dead_body_searching = false
   bind_container.curBoxID = nil
   SendScriptCallback("dead_body_search_wnd_closed")
end


I added dead_body_search_wnd_closed to axr_main.intercepts

I registered for the event in my own script and it works as expected.

Is there a method for me to hook dead_body_search_wnd_closed event without me editing the vanilla scripts that come with CoC?

Edit:
Another question...
How do I access an offline container inventory list from se_obj id?
For online inv_box I use something like:
eg:

Code: Select all

if (IsInvbox(nil,se_obj:clsid())) then
   if (se_obj.online) then
      local box = level.object_by_id(se_obj.id)
      if (box) then
         if not (box:is_inv_box_empty()) then
            local function show_me(inv_box,item)
               printf("iterate item %s", item)
            end
            box:iterate_inventory_box(show_me,box)
         end
      end
   else
      -- get offline box inventory list?
   end
end

This works fine for an online inv_box.
So how do I access the same info for an offline inv_box that is in a different level to the player?

User avatar
Alundaio
S.T.A.L.K.E.R.
Posts: 1371
Joined: 26 May 2012, 22:26

Re: methods to hook dead_body_search_wnd_closed event plus another q?

Postby Alundaio » 24 Jun 2017, 18:25

Not possible to check inventory of offline objects directly. You have to check all objects parent id in a loop, like

Code: Select all

for id=1,65534 do
     local se_obj = alife():object(id)
     if (se_obj and se_obj.parent_id == YOUR_ID) then

     end
end


Is there a method for me to hook dead_body_search_wnd_closed event without me editing the vanilla scripts that come with CoC?
nope
"I have a dream that one day this community will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident; that all mods are created equal."

sLoPpYdOtBiGhOlE
Scavenger
Posts: 36
Joined: 12 Jun 2017, 23:44

Re: methods to hook dead_body_search_wnd_closed event plus another q?

Postby sLoPpYdOtBiGhOlE » 24 Jul 2017, 02:43

Thank you for taking the time to explain once again :)
I have another question(s), not quite related to the above.
So instead of posting a new thread I continue here...

Basically I've made an Unload All Weapons in inventory function.
But there are some basic things I'm unsure of.

How to tell if my loaded wpn_abakan is using ammo_5.45x39_fmj or ammo_5.45x39_ap?
Could be any weapon, just an example of what I'm asking.
I had no problem finding a count of ammo or the types of ammo the weapon can use.
But just didn't see an example of how to tell which type of ammo the weapon has loaded.


Return to “General Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest