ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
WIP COP-inspired inventory

« Previous 10 events | 1 2 3 4 5 6 7 8 9 10 ... 19 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  18:47:31  26 March 2012
profilee-mailreply Message URLTo the Top
ZaGaR
Skaarj Hybrid - NaPali survivor
(Resident)

 

 
On forum: 07/24/2007
Messages: 647
Kaidoni, if you plan to relax the use of both slots for the weapons, have you found animatios/visuals with single-handed option for these pieces? Most mods have the absurd situation where you climb the ladders holding a RPK, both hands visible . Utter nonsesne.
  18:55:30  26 March 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
03/26/2012 19:45:12
Messages: 1072
I'm bloomin' clueless (and hopeless). While it's probably very similar to the first method for living NPCs, I can't figure this out for the treasure manager script. I've meddled about a bit, but I'm no scripter... Obviously I don't call it in the treasure_manager script, since it seems to either do nothing or it totally kills the script. As for xr_motivator, I've had a few tries, but it certainly didn't like what I was doing. Unless, of course, everything has to be done with my custom ui script and bind_stalker...which I have been trying.

EDIT 2:


function ui_faction:Update()
  CUIScriptWnd.Update(self)
	
  if treasure_manager then
	if (npc and db.actor) then
		if has_alife_info("ui_car_body") then
			npc_comm = npc:character_community()
		end
	end

	local faction = npc_comm

	if faction == "stalker" then
	  self:display_texture("stalker")
	elseif faction == "trader" then
	  self:display_texture("stalker")
	elseif faction == "bandit" then
	  self:display_texture("bandit")
	elseif faction == "military" then
	  self:display_texture("military")
	elseif faction == "dolg" then
	  self:display_texture("dolg")
	elseif faction == "freedom" then
	  self:display_texture("freedom")
	elseif faction == "ecolog" then
	  self:display_texture("ecolog")
	elseif faction == "killer" then
	  self:display_texture("killer")
	elseif faction == "monolith" then
	  self:display_texture("monolith")
	elseif faction == "csky" then
	  self:display_texture("csky")
	else
	  self:display_texture("empty")
	end
  end
end



Well, if I go with the following in bind_stalker...


	if (npc and db.actor) then
		if has_alife_info("ui_car_body") then
			ui_faction.add_custom_inv()
		else
			ui_faction.remove_custom_inv()
		end
	end



...nothing appears. But if I just go with if db.actor then the blank texture appears (basically the background on which the faction patches appear - I have to have it so that it will blend properly with the ui, or there's a white border around any of my textures). However, it appears for both dead NPCs and stash boxes.

EDIT: No plans to relax the use of slots any longer. Slot 1 will now be for pistols and the small shotguns since it just looks better overall.
  10:00:49  27 March 2012
profilee-mailreply Message URLTo the Top
Lijenstina
Doom metal in the shade of the flying radiators
(Resident)

 

 
On forum: 07/23/2005
 

Message edited by:
Lijenstina
03/27/2012 10:06:17
Messages: 1902

function ui_faction:Update()
  CUIScriptWnd.Update(self)
    local faction = "none"
    if db.actor then
      if has_alife_info("ui_car_body") then 
            if treasure_manager and treasure_manager.npc_comm then
	         faction = treasure_manager.npc_comm
	    else 
		  faction = "none"
	    end
        elseif db.actor:is_talking() then
            if xr_motivator and xr_motivator.npc_talks then
                  faction = xr_motivator.npc_community or "none"
            else
	          faction = "none"
	    end
	else
	     faction = "none"
	end
    end
    if faction == "stalker" then
	  self:display_texture("stalker")
	elseif faction == "trader" then
	  self:display_texture("stalker")
	elseif faction == "bandit" then
	  self:display_texture("bandit")
	elseif faction == "military" then
	  self:display_texture("military")
	elseif faction == "dolg" then
	  self:display_texture("dolg")
	elseif faction == "freedom" then
	  self:display_texture("freedom")
	elseif faction == "ecolog" then
	  self:display_texture("ecolog")
	elseif faction == "killer" then
	  self:display_texture("killer")
	elseif faction == "monolith" then
	  self:display_texture("monolith")
	elseif faction == "csky" then
	  self:display_texture("csky")
	else
	  self:display_texture("empty")
	end
  end
end



Add that code in the xr_motivator and the treasure_manager. Also add a global on the top of the treasure manager.
npc_comm = nil

This update code would work for displaying if the npc is talking and looting.
  13:40:03  27 March 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
03/27/2012 15:12:57
Messages: 1072
Bit more confused now. The ui_faction update function is from the custom ui script, not sure how it fits into treasure_manager or xr_motivator (not doubting your knowledge or anything, just a little confused by it needing to be placed in other scripts also), or how I'd change the function in the ui_faction script (where I call the different textures - e.g. "stalker" refers to the ending of the relevant texture, as the script incudes self.overlay:InitTexture("ui\\ui_faction_" .. idx)).

In fact, here's the ui script above the update function:


class "ui_faction" (CUIScriptWnd)

function ui_faction:__init() super()
  self:InitControls()
end

function ui_faction:InitControls()
  self:Init(0, 0, device().width, device().height)

  self.overlay = CUIStatic()
  self.overlay:SetAutoDelete(true)
	-- replace x, y with position of overlay texture (position on hud)
	-- and w, h with overlay texture's width and height, respectively
	-- you can use device().width instead of w if you want to set screen's
	-- width as a texture width
  self.overlay:Init(510, 613, 60, 60)
  self.overlay:InitTexture("ui\\ui_faction_empty")
  self.overlay:SetStretchTexture(true) -- to stretch texture based on w, h
  self.overlay:Show(false)
  self:AttachChild(self.overlay)

  self.hud_stage = "no"
end

--initialize and display overlay textures
function ui_faction:display_texture(idx)
	if self.hud_stage ~= idx then
		self.overlay:InitTexture("ui\\ui_faction_" .. idx)
		self.overlay:Show(true)
		self.hud_stage = idx
	end
end



Ignore the co-ordinates where I'm placing the texture...just placing them there for now in tests in the event that they appear *below* the main loot or trade panel textures, so at those co-ordinates they can be seen under a glass panel).

Sorry for my stupidity, I easily got the xr_motivator changes, but not the treasure_manager changes.

Also, here's what I currently have in xr_motivator for the trade screen textures (a slight modification on what you wrote):


	if self.object:is_talking() then
		npc_talks = true
		npc_community_trade = self.object:character_community()
		npc_rank_trade = self.object:rank()
	else
		npc_talks = false
		npc_community_trade = nil
		npc_rank_trade = nil
	end

  15:29:12  27 March 2012
profilee-mailreply Message URLTo the Top
Lijenstina
Doom metal in the shade of the flying radiators
(Resident)

 

 
On forum: 07/23/2005
 

Message edited by:
Lijenstina
03/27/2012 15:39:47
Messages: 1902
Sorry i did post it hastily.

I meant the code that i posted before ( my two previous posts mentioning xr_motivator and treasure_manager ) not the last post which is HUD/UI related.

The update function from the last post should go in your HUD/UI script.

To update the textures You need to know what is the community of the corpse that is looted - that is the code in the treasure_manager. The code in xr_motivator should return the community of the npc engaged in the conversation with the player.

Haven't looked into your new attach child code - should work - the main issue is knowing what to display.
  16:38:19  27 March 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
03/27/2012 17:12:30
Messages: 1072
That's okay, I'd probably be confused anyway. It's a wonder I got anything done with the ui, since I've mainly done it on the fly.

New problem...


Expression    : fatal error
Function      : CScriptEngine::lua_error
File          : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp
Line          : 73
Description   : <no expression>
Arguments     : LUA error: ...ow of chernobyl\gamedata\scripts\bind_stalker.script:398: attempt to index global 'ui_faction' (a nil value)



Here is the code, just as you posted (I hope, anyway):


function ui_faction:Update()
	CUIScriptWnd.Update(self)
	local faction = "none"
	if db.actor then
		if has_alife_info("ui_car_body") then 
			if treasure_manager and treasure_manager.npc_community_loot then
				faction = treasure_manager.npc_community_loot
			else 
				faction = "none"
			end
		elseif db.actor:is_talking() then
			if xr_motivator and xr_motivator.npc_talks then
				faction = xr_motivator.npc_community_trade or "none"
			else
				faction = "none"
			end
		else
			faction = "none"
		end
	end
    if faction == "stalker" then
	  self:display_texture("stalker")
	elseif faction == "trader" then
	  self:display_texture("stalker")
	elseif faction == "bandit" then
	  self:display_texture("bandit")
	elseif faction == "military" then
	  self:display_texture("military")
	elseif faction == "dolg" then
	  self:display_texture("dolg")
	elseif faction == "freedom" then
	  self:display_texture("freedom")
	elseif faction == "ecolog" then
	  self:display_texture("ecolog")
	elseif faction == "killer" then
	  self:display_texture("killer")
	elseif faction == "monolith" then
	  self:display_texture("monolith")
	elseif faction == "csky" then
	  self:display_texture("csky")
	else
	  self:display_texture("empty")
	end
end



In bind_stalker, my line reads:


	if db.actor then
		if has_alife_info("ui_trade") then
			ui_faction.add_custom_inv()
		else
			ui_faction.remove_custom_inv()
		end



I am now aware that I should also have ("ui_car_body" in there in addition, but I don't think that'd be responsible for the nil CTD.

In treasure_manager, I placed the relevant code at the end of the CTreasure:use(npc) function:


function CTreasure:use(npc)
	printf("TREASURE USE")

	local se_obj = alife():object(npc:id())
	if se_obj.treasure_processed == true then
		return
	end
	se_obj.treasure_processed = true
	
	npc_rank_name_for_tr = ranks.get_obj_rank_name(npc)
   
	--' Íóæíî ðàíäîìíî âûáðàòü îäèí èç òàéíèêîâ.
	local avail = {}
	local tr_sum = 0
	for k,v in pairs(self.treasure_info) do

		if v.done == false then
			local treasure_prob = xr_logic.pick_section_from_condlist(db.actor, npc, v.condlist)
		
			if treasure_prob == "" or treasure_prob == nil then
				treasure_prob = 0
			end

			if tonumber(treasure_prob) >= 0 and
			v.community[npc:character_community()] == true and
			v.active == false
			then
				if tonumber(treasure_prob) == 100 then
				
					self:give_treasure(k)
				else
					table.insert(avail, {k = k, prob = treasure_prob})
					tr_sum = tr_sum + treasure_prob
			
				end
			end
		end
	end

	if tr_sum == 0 or
		amk.real_rand(100) < opt.tr_v -- 65 (à äëÿ òåñòà è âñå 10)
	then
		return
	end

	local tr_w = amk.real_rand(tr_sum)
	
	for k,v in pairs(avail) do
		
		tr_w = tr_w - v.prob
		if tr_w <= 0 then
		
			self:give_treasure(v.k)
			break
		end
	end

	
	if (npc and db.actor) then
		if has_alife_info("ui_car_body") then
			npc_community_loot = npc:character_community()
			npc_rank_loot = npc:rank()
		end
	end
end



EDIT: Whoops...I probably should use tabs and not spaces in the scripts...EDIT 2: Now fixed in the code tags. EDIT 3: Looks a bit weird now.

The other code I posted at the top:


local treasure_manager = nil

local opt = {
	option_random_treasure = system_ini():r_s32("options","option_random_treasure"), -- Âêëþ÷åíèå/âûêëþ÷åíèå ðàíäîìíûõ òàéíèêîâ òàéíèêîâ (true/false)
	tr_v = system_ini():r_s32("options","treasure_dropout"), -- ×àñòîòà âûïàäà òàéíèêîâ ïðè âûïîëíåíîì condlist. ×åì ìåíüøå, òåì áîëüøå âåðîÿòíîñòü. (70)
	need_text = system_ini():r_s32("options","treasure_need_text"), --Âûâîä ñîäåðæèìîãî â íû÷êó
	-- Êîëè÷åñòâî ïðåäìåòîâ äëÿ êàæäîãî ðàíãà. Ïðè âûñòàâëåíèè íóæíî ïîìíèòü, ÷òî çíà÷åíèå íå äîëæíî ïðåâûøàòü 7 (òàê êàê ñóùåñòâóåò âåðîÿòíîñòü, ÷òî èãðà çàöèêëèòñÿ)
	novice_min = 1, -- ìèíèìóì ïðåäìåòîâ äëÿ íîâè÷êîâ ïðè ñïàâíå
	novice_max = 3, -- ìàêñèìóì ïðåäìåòîâ äëÿ íîâè÷êîâ ïðè ñïàâíå
	experienced_min = 1, -- ìèíèìóì ïðåäìåòîâ äëÿ áûâàëûõ ïðè ñïàâíå
	experienced_max = 3, -- ìàêñèìóì ïðåäìåòîâ äëÿ áûâàëûõ ïðè ñïàâíå
	veteran_min = 1, -- ìèíèìóì ïðåäìåòîâ äëÿ âåòåðàíîâ ïðè ñïàâíå
	veteran_max = 3, -- ìàêñèìóì ïðåäìåòîâ äëÿ âåòåðàíîâ ïðè ñïàâíå
	master_min = 1, -- ìèíèìóì ïðåäìåòîâ äëÿ ìàñòåðîâ ïðè ñïàâíå
	master_max = 3, -- ìàêñèìóì ïðåäìåòîâ äëÿ ìàñòåðîâ ïðè ñïàâíå
}

npc_community_loot = nil
npc_rank_loot = nil



Only the last two lines there are relevant, but it seems that posting them anywhere else and the script didn't like that one bit.

EDIT: Fixed the nil CTD errors, but now the trade faction patches are flickering, and loot ones still show as empty (but hey, no CTD ).
  17:52:30  27 March 2012
profilee-mailreply Message URLTo the Top
Lijenstina
Doom metal in the shade of the flying radiators
(Resident)

 

 
On forum: 07/23/2005
 

Message edited by:
Lijenstina
03/27/2012 17:58:19
Messages: 1902
The reason why the loot doesn't show is that the ui isn't called. Try this.


if db.actor then
    if (has_alife_info("ui_trade") or has_alife_info("ui_car_body")) then
	 ui_faction.add_custom_inv()
   else
	 ui_faction.remove_custom_inv()
   end
end



The flickering of textures, most likely, has to do with the display_texture function. I usually do the Show(boolean) calls.
  18:17:28  27 March 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
03/27/2012 19:02:49
Messages: 1072
Le sigh...there's always something silly missing. Mind you, my nil CTD error was due to a mix-up of spaces and tabs. I was flitting between one and the other, plus there was an extra end after I meddled about a bit.

EDIT: Nope, still not appearing it seems...

Plus the rank isn't appearing properly either with my other script.

EDIT 2: I went back to the old separate script method because the symbol kept flickering on the trade panel. Now it doesn't flicker any more. Still, the rank texture does not appear (and I made sure that the placeholder texture for rookies wasn't the blank texture)...
  19:15:00  27 March 2012
profilee-mailreply Message URLTo the Top
Lijenstina
Doom metal in the shade of the flying radiators
(Resident)

 

 
On forum: 07/23/2005
Messages: 1902
Post the script on the paste.bin

Should work maybe some detail is wrong.
  19:36:21  27 March 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
03/27/2012 20:25:46
Messages: 1072
Here is my ui_npc_rank script:

http://pastebin.com/sVTidfi8

Here is the older ui_faction script (the one where the faction patch flickers on and off):

http://pastebin.com/fxR4YuM3

As for xr_motivator, all I made was a simple adjustment:


	if self.object:is_talking() then
		npc_talks = true
		npc_community_trade = self.object:character_community()
		npc_rank_trade = self.object:character_rank()
	else
		npc_talks = false
		npc_community_trade = nil
		npc_rank_trade = nil
	end



Here's my other script for looting:

http://pastebin.com/1h2HA0wv

It only ever allows the blank texture to appear (by blank or empty, I mean the background on which any patch is placed, it can actually be seen).

Here's the excerpt from treasure_manager:

http://pastebin.com/1wQdxSAn
 
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-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.