ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
How to check whether weapon has built-in scope

« Previous 10 events | 1 2 3 4 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  22:48:31  1 February 2012
profilee-mailreply Message URLTo the Top
mnn
Senior Resident
 

 
On forum: 06/12/2009
Messages: 2694
There's no need to do that, fluffy. Weapons configs are part of system config, so it's simpler to read required values from system_ini()...
  00:59:49  2 February 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
 

Message edited by:
Nuor
02/02/2012 4:20:57
Messages: 735

---QUOTATION---
There's no need to do that, fluffy. Weapons configs are part of system config, so it's simpler to read required values from system_ini()...
---END QUOTATION---



pretty much


function is_scope_attached()
local sys_ini = system_ini()
local active_weap = db.actor:active_item()
local active_section = active_weap and active_weap:section() or "none"
if sys_ini:section_exist(active_section) and
	sys_ini:line_exist(active_section, "scope_status") and
	sys_ini:r_string(active_section,"scope_status") == 1 then
		return true
end
return false
end



I think that should be close

edit: oops forgot something
  10:40:52  2 February 2012
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
Messages: 1519
Cool, thanks Nuor Will try asap!
  00:29:10  4 February 2012
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
Messages: 1519
Just wanted to let you now that Nuor's approach works like charm! That's exactly what I was after - and now I included it in my util.script so that I won't forget it again

However, just one little thing: The sys_ini:r_string function returns a string rather than a number (as its name implies), so tonumber() is required when comparing to a digit.

Thanks again to all for your help
  01:10:12  4 February 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735

---QUOTATION---

However, just one little thing: The sys_ini:r_string function returns a string rather than a number (as its name implies), so tonumber() is required when comparing to a digit.

Thanks again to all for your help
---END QUOTATION---



yep that's what I get for not testing. I imagine "1" instead of 1 should work.
  01:49:55  5 February 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
Messages: 133

---QUOTATION---
My script controls some shader settings. For activating my nightvision scopes on-demand I need to know two things: First, if the player currently uses the scope, i.e. is in zoom/aim mode. That one I already got. And second, if the player's current weapon has a scope or not. That's what I'm looking for.
---END QUOTATION---



Wait, did you just mention that you're working on adding nightvision scopes?
  18:39:54  5 February 2012
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
Messages: 1519

---QUOTATION---
Wait, did you just mention that you're working on adding nightvision scopes?
---END QUOTATION---



Actually I've already done it

Will be part of version 1.1 of my Dynamic Shaders mod. I'm just trying to fix some issues and do some optimizations before I can upload...
  22:20:08  5 February 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735

---QUOTATION---
Wait, did you just mention that you're working on adding nightvision scopes?

Actually I've already done it

Will be part of version 1.1 of my Dynamic Shaders mod. I'm just trying to fix some issues and do some optimizations before I can upload...
---END QUOTATION---



I created one a couple of years ago. I't will be interesting to see what route you took.
  22:31:14  5 February 2012
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
Messages: 1519

---QUOTATION---
I created one a couple of years ago.
---END QUOTATION---



Oh really? Interesting. Could you provide a link? Did you use ppe's or shaders?


---QUOTATION---
I't will be interesting to see what route you took.
---END QUOTATION---



Fairly easy one (but fairly powerful as well, if you ask me). You'll see soon
  23:09:48  5 February 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735

---QUOTATION---
I created one a couple of years ago.

Oh really? Interesting. Could you provide a link? Did you use ppe's or shaders?


---END QUOTATION---



I just used an expanded set of ppe's.

It's triggered by checking conditions and can attach to a limited set of weapons as determined by ltx entry. It also makes use of a battery.

I haven't released it as I have it buried in the SMP2.5 along with a bunch of other new mods. I'm expecting the beta for that will be out soon. I've played with it for quite some time now and it seems to work fine.
 
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.