ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Odd scripting question

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  12:12:12  14 July 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
 

Message edited by:
ddraig
07/14/2012 12:13:03
Messages: 158
Odd scripting question

I've run into quite a bit of a dilemma. It basically concerns a way of doing a certain thing and I'm not sure if there's a more elegant solution or not (I'm not a very good coder, and have only very recently started)

I'm modifying an AMK file, news_main.script

There's a function that determines what weapon a stalker was killed with.

Here's the exact function:

http://pastebin.com/1N0TpPvV

The problem is that I'm using a custom mod that switches arms based on what suit you're using, and it does this by creating seperate versions of all weapons with the name of the suit attached which then uses a seperate mesh for the hud display... this has created quite a messy script when I attempt to add them to this function (just adding the base weapon name doesn't really work, as thanks to the mod they don't really exist anymore)

This is the way the current script looks:

http://pastebin.com/zhVZNznN

As you can see, it's a bit headache inducing compared to the other one.. would there be an easy way to add all possible variants of a weapon and cutting down on the amount of entries? Something like wpn_name(wildcard_outfit) or something?
  17:55:17  14 July 2012
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349

if string.find(id, "wpn_pm") then
     return 1
end



etc etc
  18:10:08  14 July 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
 

Message edited by:
ddraig
07/14/2012 18:10:58
Messages: 158
It's that simple? Vintar, you're a true hero

Would it be possible to include an or statement in there? So to be something like


if string.find(id, "wpn_pm" or "wpn_fort") then
          return 1
end



Sorry if this is a really stupid question, but I really am terrible new this to this sort of thing,.
  21:21:07  14 July 2012
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
 

Message edited by:
Meltac
07/14/2012 21:21:35
Messages: 1519

---QUOTATION---
Would it be possible to include an or statement in there? So to be something like


if string.find(id, "wpn_pm" or "wpn_fort") then
          return 1
end


---END QUOTATION---



No, won't work that way. You'd need to write it like that:

if string.find(id, "wpn_pm") or string.find(id, "wpn_fort") then
          return 1
end

  02:46:19  15 July 2012
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
Messages: 158

---QUOTATION---
No, won't work that way. You'd need to write it like that:

if string.find(id, "wpn_pm") or string.find(id, "wpn_fort") then
          return 1
end


---END QUOTATION---



Thanks for the help! I love your dynamic shaders, by the way.

One thing that impresses me about the Stalker community is how helpful and amazing people can be.
  03:54:04  15 July 2012
profilee-mailreply Message URLTo the Top
Derranged
Senior Resident
 

 
On forum: 04/12/2010
Messages: 1009

---QUOTATION---
One thing that impresses me about the Stalker community is how helpful and amazing people can be.
---END QUOTATION---



I have to agree with you on that one. I am still learning what I have to learn, and the amount of support from the community has really helped me learn a lot.
  14:47:36  15 July 2012
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
I was just thinking, if you are using the arms match suit mod from myself and Buddiebbb, then none of this is needed. NPC`s dont use these weapons, they only use the standard ones.
It is needed however if you are wanting to know what the actor shot someone with, but ofcourse there are easier ways of doing that.
 
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-2021 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.