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 ... 12 13 14 15 16 17 18 19 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  15:52:30  6 May 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
05/06/2012 15:55:46
Messages: 1072
Further to the not using the update section of bind_stalker to update icons, is it possible for the following script to be called on level load also?


class "ui_cop_blood_empty" (CUIScriptWnd)

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

function ui_cop_blood_empty:InitControls()
    self:Init(0, 0, device().width, device().height)
    local xml = CScriptXmlInit()
    xml:ParseFile("ui_cop_radblood.xml")
	self.blood_empty = xml:InitStatic("blood_empty", self)
	self.blood_empty:Show(false)
end


function ui_cop_blood_empty:Update()
  CUIScriptWnd.Update(self)
	
  local bleeding = db.actor:get_bleeding()

	--display texture overlay based on actor's radiation levels
  if bleeding >= 0 and has_alife_info("ui_inventory") then
    self.blood_empty:Show(true)
  else
    self.blood_empty:Show(false)
  end
end

local HUD = nil

function add_empty_blood()
  if HUD == nil then
    HUD = ui_cop_blood_empty()
    get_hud():AddDialogToRender(HUD)
  end
end

function remove_empty_blood()
  if HUD ~= nil then
    get_hud():RemoveDialogToRender(HUD)
    HUD = nil
  end
end




class "ui_cop_blood_green" (CUIScriptWnd)

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

function ui_cop_blood_green:InitControls()
    self:Init(0, 0, device().width, device().height)
    local xml = CScriptXmlInit()
    xml:ParseFile("ui_cop_radblood.xml")
	self.blood_green = xml:InitStatic("blood_green", self)
	self.blood_green:Show(false)
end


function ui_cop_blood_green:Update()
	CUIScriptWnd.Update(self)

	local bleeding = db.actor:get_bleeding()

	if bleeding > 0 and bleeding < 0.26 then 
		self.blood_green:Show(true)
	else
		self.blood_green:Show(false)
	end
end

  local HUD = nil

function add_blood_green()
   if HUD == nil then
     HUD = ui_cop_blood_green()
    get_hud():AddDialogToRender(HUD)
  end
end

function remove_blood_green()
    if HUD ~= nil then
      get_hud():RemoveDialogToRender(HUD)
      HUD = nil
  end
end




class "ui_cop_blood_yellow" (CUIScriptWnd)

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

function ui_cop_blood_yellow:InitControls()
    self:Init(0, 0, device().width, device().height)
    local xml = CScriptXmlInit()
    xml:ParseFile("ui_cop_radblood.xml")
	self.blood_yellow = xml:InitStatic("blood_yellow", self)
	self.blood_yellow:Show(false)
end


function ui_cop_blood_yellow:Update()
	CUIScriptWnd.Update(self)

	local bleeding = db.actor:get_bleeding()

	if bleeding > 0.25 and bleeding < 0.51 then 
		self.blood_yellow:Show(true)
	else
		self.blood_yellow:Show(false)
	end
end

  local HUD = nil

function add_blood_yellow()
   if HUD == nil then
     HUD = ui_cop_blood_yellow()
    get_hud():AddDialogToRender(HUD)
  end
end

function remove_blood_yellow()
    if HUD ~= nil then
      get_hud():RemoveDialogToRender(HUD)
      HUD = nil
  end
end




class "ui_cop_blood_orange" (CUIScriptWnd)

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

function ui_cop_blood_orange:InitControls()
    self:Init(0, 0, device().width, device().height)
    local xml = CScriptXmlInit()
    xml:ParseFile("ui_cop_radblood.xml")
	self.blood_orange = xml:InitStatic("blood_orange", self)
	self.blood_orange:Show(false)
end


function ui_cop_blood_orange:Update()
	CUIScriptWnd.Update(self)

	local bleeding = db.actor:get_bleeding()

	if bleeding > 0.5 and bleeding < 0.76 then 
		self.blood_orange:Show(true)
	else
		self.blood_orange:Show(false)
	end
end

  local HUD = nil

function add_blood_orange()
   if HUD == nil then
     HUD = ui_cop_blood_orange()
    get_hud():AddDialogToRender(HUD)
  end
end

function remove_blood_orange()
    if HUD ~= nil then
      get_hud():RemoveDialogToRender(HUD)
      HUD = nil
  end
end



class "ui_cop_blood_red" (CUIScriptWnd)

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

function ui_cop_blood_red:InitControls()
    self:Init(0, 0, device().width, device().height)
    local xml = CScriptXmlInit()
    xml:ParseFile("ui_cop_radblood.xml")
	self.blood_red = xml:InitStatic("blood_red", self)
	self.blood_red:Show(false)
end


function ui_cop_blood_red:Update()
	CUIScriptWnd.Update(self)

	local bleeding = db.actor:get_bleeding()

	if bleeding > 0.75 then 
		self.blood_red:Show(true)
	else
		self.blood_red:Show(false)
	end
end

  local HUD = nil

function add_blood_red()
   if HUD == nil then
     HUD = ui_cop_blood_red()
    get_hud():AddDialogToRender(HUD)
  end
end

function remove_blood_red()
    if HUD ~= nil then
      get_hud():RemoveDialogToRender(HUD)
      HUD = nil
  end
end



At the moment, I've got sections in the update section adding and removing the elements based on whether or not the inventory is open, as well as removing them in net_destroy. I've fiddled about a bit with the main script to see if I can add a check for
has_alife_info("ui_inventory")

, just on the empty icon for the moment, but it never appears (at all - I'd made sure to remove anything from bind_stalker's update section and only use the net_spawn and net_destroy sections).

I'm also wondering if Lijestina's scripts for calling the faction patches can have the same treatment? Or are the inventory icons and trade/loot faction patches an entirely separate issue, as they never appear unless a specific UI is open? It'd be great to not have the delay on textures appearing (most noticeable when trading with NPCs), although it's a minor issue at best.

Also, in case anyone is wondering why I divided the icons up like I did with the bleeding script, it's because I've tried them all together and they seem to overlap one another - that is, the player has to leave the inventory then come back to entirely remove the previous flashing icon, or it meshes with the present one being called in any given situation.
  16:56:16  6 May 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735
Use the single hud you created for the map texture, for your additions. You should be able to put the test for the current color of the icon in the update section.
  18:16:37  6 May 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
05/06/2012 19:36:45
Messages: 1072
One attempt that failed...


function ui_cop_health_empty:Update()
	CUIScriptWnd.Update(self)
	
	--display texture overlay based on actor's radiation levels
	local health = db.actor.health * 100
	if health >= 0 then
		if not has_alife_info("ui_inventory") then
			self.health_empty:Show(false)
		else
			self.health_empty:Show(true)
		end
	end
end



I've tried putting it other ways too, including with the info from the pda script. It just does not seem to want it to work.

EDIT: Another fail...


	if has_alife_info("ui_inventory") then
		if health >= 0 then
			self.health_empty:Show(true)
		end
	elseif not has_alife_info("ui_inventory") then
		if health >= 0 then
			self.health_empty:Show(false)
		end
	end
end



Not feeling too good at the moment, so it's probably not the best time to be messing about. Still, found an interesting bug while using the above - if the player turns the inventory on and off real fast a number of times, all the other colour icons and grey icons disappear, leaving just the above icon. LOL!

EDIT 2: Even tried...


	--display texture overlay based on actor's radiation levels
	if inventory_open ~= false then
		if health >= 0 then
			self.health_empty:Show(true)
		end
	else
		self.health_empty:Show(false)
	end
end

  20:05:29  6 May 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
 

Message edited by:
Nuor
05/06/2012 20:08:11
Messages: 735
Start by putting a debug statement in to test the values; health at least.
  20:16:22  6 May 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
05/06/2012 20:59:54
Messages: 1072
Well, the thing is, the health_empty icon does appear, but it seems only after turning the inventory on and off multiple times in quick succession, which is pretty odd...

Okay, debugging message added to amk.script:


  if ui_cop_health.ui_cop_health_empty then
    mylog("ui_cop_health script is valid")
  else
    mylog("ui_cop_health script is BROKEN")
  end



And it seems that it is valid. Er...okay. That is without referencing health.
  20:58:49  6 May 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735

---QUOTATION---
Well, the thing is, the health_empty icon does appear, but it seems only after turning the inventory on and off multiple times in quick succession, which is pretty odd...
---END QUOTATION---



Part of the reason for putting the debug for health in is that it won't only tell you the value of health it will tell you when and if update is triggering.
  21:03:13  6 May 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
05/07/2012 1:07:25
Messages: 1072
Well, technically, no update should be triggering for this part of the UI except for when the inventory is open or closed. The health_empty is a grey button (one of those that Loner1 made), and it needs to be in there for the health_red icon as the xml entry for that texture makes it flash. I already know the other elements, the individual colour icons, work and update - it's just getting the part into the scripts where they only show when the inventory is open and not relying on bind_stalker for that.

EDIT: I just don't think it's going to work. These elements aren't always 'present' like the pda overlay, just waiting for a blowout or a weapon to be drawn, they are only made to appear when the inventory is opened. Given Lijestina's expertise in scripting and the fact he never questioned using bind_stalker update for turning the faction patches on and off, I'm assuming it simply isn't possible to load my inventory or trade/loot panel icons via net_spawn.
  15:56:02  7 May 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
05/08/2012 0:32:38
Messages: 1072
New issue...I cannot change the ui_hud_eat symbol in maingame.xml. Well, I can, but I can never change the position. For the bleeding overlay to work, icons_scroll_view must be set at x 0 and y 0, which causes a problem where the icons are in the top left corner. No issue there, the overlay covers the whole screen. Now comes the issue - I need the starvation_static, as there is no other way to check satiety, and I don't really want it in the top left corner. I've tried alternate textures, from a standalone texture file (1024x768) to extending ui_hud.dds to a full 2048x1024, and placing my eat icon where I want it to appear on the main HUD (in both cases I have made sure I referenced the texture in an xml file, the first my own and the latter ui_hud.xml), but it refuses altogether to allow this icon to appear. This doesn't really make much sense...

How do I get it to appear exactly where I want it to? I cannot change the position of icons_scroll view because it seems the individual elements themselves cannot be repositioned (I've tried). Either the eat icon appears in the top left, or there has to be a way to put it wherever I want it...

EDIT: In the meantime, new pics:
http://www.moddb.com/members/kaidonni/images/cop-inspired-hud-finished-ogse-version#imagebox
http://www.moddb.com/members/kaidonni/images/cop-inspired-hud-finished-ogse-version1#imagebox
http://www.moddb.com/members/kaidonni/images/cop-inspired-hud-finished-ogse-version2#imagebox
http://www.moddb.com/members/kaidonni/images/cop-inspired-hud-finished-ogse-version4#imagebox
http://www.moddb.com/members/kaidonni/images/cop-inspired-hud-finished-ogse-version6#imagebox

Note that the pic where I've moved the PDA minimap over for the eat icon is a later screenshot than the rest (which is why the minimap is closer to the left side of the screen in some pics). It might simply have to remain that way... It's just the way the game was coded, some things you can change, others you cannot (and some things you cannot change for some screens, whereas you can for others - the exit button for the inventory uses the same code as for the trade and loot panels, but the trade and loot panels seem to highlight the button differently, even with the seemingly responsible code from the relevant .xml files removed).

EDIT: Okay, so I can't have both the eat icon and the bleeding overlay using maingame.xml. The reason? Once the eat icon appears, the bleeding overlay moves down vertically, and a scroll bar appears. Whoops!

The following script as part of an attempt to fix this causes me trouble, though:


function ui_cop_blood_hud:Update()
	CUIScriptWnd.Update(self)

	local bleeding = db.actor:get_bleeding()

	if bleeding > 0 and not (db.actor:is_talking() or (has_alife_info("ui_inventory") or has_alife_info("ui_car_body") or has_alife_info("ui_pda"))) then
		self.blood_hud:Show(true)
	else
		self.blood_hud:Show(false)
	end
end



In bind_stalker I use net_spawn and net_destroy, not the update function. This, well...something causes a serious problem, probably in the above script. The xml code for the texture uses light_anim="ui_slow_blinking_alpha", and when opening the sleeping bag in the inventory, the sleeping bag ui keeps jumping between being on top of the inventory and behind it (the bits that overlap actually disappear behind the inventory texture). The other icons (the health, stamina, psy-health, bleeding and radiation buttons) also turn on and off (as in, they appear, then completely disappear, then re-appear). All of this is cyclical - in sync with the animation of the bleeding overlay. It also happens regardless of whether the player is bleeding or not.

Two possibilities - either the above code is faulty and needs something extra to prevent this, or I do away with the eat icon and just have the bleeding overlay. Not perfect, but better than a blood drop icon.

EDIT 2: It's a significant bug, as it happens with both the sleep and repair UI's. It might not matter so much for other mods, but then I can't be too sure about that...
  14:20:58  8 May 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
 

Message edited by:
Kaidonni
05/08/2012 17:09:39
Messages: 1072
I need help with the bleeding overlay, because the game refuses the aforementioned script. It keeps the flashing of the icons and sleep/repair boxes. I can't even seem to get a custom static in except through bind_stalker update, and that is unacceptable because there's a delay everytime it loads the overlay...

It won't even accept the following:


function hud_bleeding()
	local gcs = get_hud():GetCustomStatic("ui_hud_blood")
	if db.actor.get_bleeding() > 0 then
		if gcs == nil then get_hud():AddCustomStatic("ui_hud_blood") end
	else
		if gcs ~= nil then get_hud():RemoveCustomStatic("ui_hud_blood") end
	end
end



It simply wipes out the rest of the inventory icons. They never appear. The sleeping bag disappears on activating it.

EDIT: Here's the script at the moment, with the stupid flashing of the icons and sleep/repair UI :-

class "ui_cop_blood_hud" (CUIScriptWnd)

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

function ui_cop_blood_hud:InitControls()
    self:Init(0, 0, device().width, device().height)
    local xml = CScriptXmlInit()
    xml:ParseFile("ui_cop_radblood.xml")
	self.blood_hud = xml:InitStatic("blood_hud", self)
	self.blood_hud:Show(false)
end


function ui_cop_blood_hud:Update()
	CUIScriptWnd.Update(self)

	local bleeding = db.actor:get_bleeding()

	if bleeding > 0 then
		if not has_alife_info("ui_inventory") or
		not has_alife_info("ui_car_body") or
		not has_alife_info("ui_trade") or
		not has_alife_info("ui_pda") or
		not has_alife_info("ui_talk") then
			self.blood_hud:Show(true)
		elseif has_alife_info("ui_inventory") or
		has_alife_info("ui_car_body") or
		has_alife_info("ui_trade") or
		has_alife_info("ui_pda") or
		has_alife_info("ui_talk") then
			self.blood_hud:Show(false)
		else
		end
	else
		self.blood_hud:Show(false)
	end
end

  local HUD = nil

function add_blood_hud()
   if HUD == nil then
     HUD = ui_cop_blood_hud()
    get_hud():AddDialogToRender(HUD)
  end
end

function remove_blood_hud()
    if HUD ~= nil then
      get_hud():RemoveDialogToRender(HUD)
      HUD = nil
  end
end



I've made it more complicated in the hopes that I could have avoided the bug, but it's still there... I really don't want to sacrifice the eating icon, though (I have to if I use maingame.xml for the bleeding overlay), as there is no other way to tell the player they must eat.
  23:56:36  9 May 2012
profilee-mailreply Message URLTo the Top
Kaidonni
First the Zone, then the world!
(Resident)

 

 
On forum: 08/30/2008
Messages: 1072
A solution just occured to me if using a custom static or calling a texture the usual way can't work for the bleeding overlay - a post process effector. If it is a regular effect, then the colour could be tweaked to simulate the red flashing of the bleeding overlay.

All this so I can get the eat icon in...
 
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.