Question 1 of 3 (Clear Sky)

Discussions on Modding of S.T.A.L.K.E.R. SoC & Clear Sky

Question 1 of 3 (Clear Sky)

Postby Victim on 18 Dec 2008 12:49

I was initially going to ask all 3 questions here but each may prove to be as complex to everyone else as they are to me, hence I'll keep each question separate. Thanks in advance for any feedback/suggestions/help.

Question: Does anyone know how I can get a working HUD Hunger icon into CS?

As we all know, it works just fine in SoC but it has been disabled or removed from CS. I do not know (nor can I fathom) the reason why GSC chose to do this.

What I've figured out for myself: Not a whole lot actually. ](*,)

I do know that "xrGame.dll" is involved but I'm not sure on what level - my own opinion is that once I've actually found the mechanism that triggers the beginning of health loss due to hunger, I should be able to use it to also prompt the HUD icon. Unfortunately "satiety_critical" which is ultimately responsible for deciding when health will begin to be lost doesn't really lead me anywhere other than to "xrGame.dll" where I'm then quickly baffled by the indecipherable symbols in the file (using XVI32 to view). There is a control for radiation in the "bind_stalker.script" but I've had no luck when attempting to duplicate it and then adjust it to suit the hunger level. Example:

Code: Select all
   --[[if actor.satiety()
         local hud = get_hud()
         local custom_static = hud:GetCustomStatic("cs_radiation_danger")
         if custom_static == nil then
               hud:AddCustomStatic("cs_radiation_danger", true)
               hud:GetCustomStatic("cs_radiation_danger"):wnd():SetTextST("st_radiation_danger")
         end
   else
         local hud = get_hud()
         local custom_static = hud:GetCustomStatic("cs_radiation_danger")
         if custom_static ~= nil then
               hud:RemoveCustomStatic("cs_radiation_danger")
         end
   end]]--


The error when using this is one that states something like: "bind_monster.script attempt to call bind_stalker.script" - which I'd assume occurs purely because the script above is utter rubbish - I know bugger-all about LUA. Alternatively, using this at the beginning of the above piece of script:

Code: Select all
   --[[if actor.satiety  >= 0.9 then
         local hud = get_hud()
...etc...


creates an error that states: "attempt to compare number with nil". This I 'think' I understand: "satiety" itself is not actually recognized by LUA, period. The script can't calculate ">= 0.9" because it doesn't have a reference against which to compare it. I've also tried the same script while using "if db.actor.satiety...if actor.satiety_critical...etc." but all of the hunger related [actor_condition] snippets that I've tried from "actor.ltx" have led me here to ask for help.

I hope for the sake of refining the CS Redux mod that someone can. I have 2 further questions which I'll write later. This one takes priority as it is by far the issue that impacts most negatively on the enjoyment of those that play the mod.

Question 2 will be: How can I make 'codelocks' work on inventory boxes - i.e. the combination safes that litter the Zone.
Question 3 will be: How can I best create (or integrate) a custom mission log - i.e. Adding a diary that may be updated to the inventory or adding custom missions to the "secondary tasks" list, or, adding an additional page/tab to the PDA that will automatically (via info_portion etc.) update and save/load custom data.

Thanks for reading. ;)
Victim
Senior Resident
 
Posts: 19
Joined: 22 Nov 2008 11:57

Re: Question 1 of 3 (Clear Sky)

Postby jamie1992 on 18 Dec 2008 13:31

Food consumption and Hunger Was taken out of clear sky, unless it was put back in during one of the new patchs, i played using 1.505 patch, and then havent played it since, and that was like 3-4 months ago something like that, i belive you would if you have not already reimplement hunger if its not done already as for the working HUD icon, im not quite sure sorry.
Wu Tang! Wu Tang! Wu Tang!
User avatar
jamie1992
Senior Resident
 
Posts: 802
Joined: 12 Sep 2008 23:04
Location: Oxford, Oxfordshire, United Kingdom

Re: Question 1 of 3 (Clear Sky)

Postby Nightwatch on 18 Dec 2008 23:10

I'm sorry that I cannot make any comments on these questions as I still don't have a copy of Clear Sky (I know it's a bit very late for still not owning one, but I'll get there eventually :mozilla_smile: )

PS: but on the satiety issue, from the examples you give, I would agree with you that Clear Sky might not recognize the satiety. If so, one would ask, why it has been left out?
User avatar
Nightwatch
Site Admin
 
Posts: 2676
Joined: 13 Apr 2007 05:42
Location: London, United Kingdom

Re: Question 1 of 3 (Clear Sky)

Postby NatVac on 22 Dec 2008 16:37

Victim wrote:The error when using this is one that states something like: "bind_monster.script attempt to call bind_stalker.script"

This implies that bind_stalker.script is not valid. That's probably because you made one or more syntactically incorrect changes to that file.

Disclaimer: I don't have Clear Sky, and will not be getting it primarily because of a personal anti-DRM boycott.

I assume you included the block comment lines because you copied this from your now-working script. And I assume you posted an excerpt from bind_stalker.script. My guess is that the actor.satiety() call is not valid in the first case, and the comparison if actor.satiety >= 0.9 results in the error "attempt to compare number with nil" because actor does not have a satiety property, or at least not one that is assigned a value.

You need to examine the object's supported features. The only suggestion I can make here: look at lua_help.script (if there is one in Clear Sky) to see what properties actor has. You are probably out of luck on the satiety stuff, but maybe there is something else there that you can use. It may also be possible to create your own variable and maintain it with timers and scripts.

(Side note re if actor.satiety(): Did you exprect a numeric value to be returned? In Lua, even a zero value for a number is considered to be a "true". You need an explicit false or nil for the test to fail. The test for the object would return true if the object exists. And, as you found out, you cannot compare a number with a nil.)

You might be able to treat inventory boxes as doors and add the support, or add/override an "on use" script to test for an inventory box and then throw up a keypad dialog. Perhaps you can derive a new object that combines the features you seek. (Yeah, I know, this isn't really an answer, but it's my way of saying I saw the question.)

Unfortunately I can only recommend something you are already doing: thoroughly examine the existing code that does what you want and adapt it to your purpose, and examine the work of others that have done work similar to what you want to do.
NatVac
Resident
 
Posts: 152
Joined: 16 Sep 2008 00:13
Location: Texas


Return to Modding Techniques

Who is online

Users browsing this forum: No registered users and 1 guest

cron