ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Calling Script Functions on Actor Firing Weapon

« Previous 10 events | 1 2 3 4 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  06:39:17  19 July 2013
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454

---QUOTATION---
http://pastebin.com/2ubBcscg
---END QUOTATION---


Thank you! But sadly, again there's a crash.
"attempt to call field 'state_read' (a nil value)"
I looked through packet_utils a bit and there are many state_read functions as members of different classes, though they all take two arguments rather than one. Really, I have no clue what's going on in packet_utils anyways so I'm not sure how to proceed.
  21:13:08  26 July 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
http://pastebin.com/2ubBcscg
Thank you! But sadly, again there's a crash.
"attempt to call field 'state_read' (a nil value)"
I looked through packet_utils a bit and there are many state_read functions as members of different classes, though they all take two arguments rather than one. Really, I have no clue what's going on in packet_utils anyways so I'm not sure how to proceed.
---END QUOTATION---


This thread is very interesting, I might have some use for what is going on here.

I'll do some research and let you all know what happens when I get to it.
  22:46:25  27 July 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
Messages: 867
The hell with it, Misery 2 is only a few days away and the script is more AI Tweaks related than Misery 2 related so I'm just going to release it: http://www.sendspace.com/file/ceqa2k
Besides that it's a utility script, not any direct script.

Anyways, here is a script that will definitely work with the above script: http://pastebin.com/YfjqRCyZ

Note that this script was made for CoP, but parts of it, especially the getting fire code part should work fine with SoC I would think.

You will also need the modified packet_utils.script (alun_utils.script in Misery 2 but I don't want to push it).

I see no reason why it shouldn't work unless you're doing something wrong as I've seen the same type of thing done in a mod on AMK forums (magazine mod in SOC forum).
  07:55:30  28 July 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
07/28/2013 9:20:10
Messages: 567
Is Alundaio human? Serious question. Anyway, here is what I have done so far:

- I added the above linked stpk_utils script into my scripts folder
- I added this code http://pastebin.com/v8tke3Mj to the bottom of my packet_utils script, and commented out the line with the auto_shotgun (SoC has no auto shotgun).
- I added this function http://pastebin.com/Zg9VH8Ew within my own script, daemonion_sound, in the scripts folder (but it can be added anywhere).
- I called my function, daemonion_sound.test_my_shit() in actor update in bind_stalker.


I tried adding my function to the callback section in _g.script, but it crashed. Anywho, the script works, but performance is awful as soon as I equip a weapon. I'm getting less than 1 FPS. But it works. I regain performance as soon as I holster any weapon.

Where do I go from here?
  17:13:30  28 July 2013
profilee-mailreply Message URLTo the Top
Jketiynu
Swartz
(Resident)

 

 
On forum: 04/05/2007
 

Message edited by:
Jketiynu
07/28/2013 17:14:24
Messages: 867

---QUOTATION---
Is Alundaio human? Serious question. Anyway, here is what I have done so far:

- I added the above linked stpk_utils script into my scripts folder
- I added this code http://pastebin.com/v8tke3Mj to the bottom of my packet_utils script, and commented out the line with the auto_shotgun (SoC has no auto shotgun).
- I added this function http://pastebin.com/Zg9VH8Ew within my own script, daemonion_sound, in the scripts folder (but it can be added anywhere).
- I called my function, daemonion_sound.test_my_shit() in actor update in bind_stalker.


I tried adding my function to the callback section in _g.script, but it crashed. Anywho, the script works, but performance is awful as soon as I equip a weapon. I'm getting less than 1 FPS. But it works. I regain performance as soon as I holster any weapon.

Where do I go from here?
---END QUOTATION---



I'm not sure if Alundaio is human. That's a good question.

I don't know why it's so slow. Even though Alundaio called it back in a special way in Misery 2 (if it got used, it's an unused script) I have a script that's similar that I just plop right in to bind_stalker:update() and I've never had issues.

Maybe there is some difference between how the scripts work between SOC and COP.

Anyways, Misery 2 is getting released really soon now so at this point I would just wait for that and look at the scripts (look specifically at axr_overheat and where it would get called). If they don't include that script, since it's unused, let me know and I'll send it over.

*Edit*
Maybe it requires using alun_utils?
  18:09:52  28 July 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
07/28/2013 18:11:19
Messages: 567
What does the "_s" in clsid.wpn_pm_s mean?

@Jketiynu: it might require alun_utils, but I think it would crash if it needed some variable defined or a function that wasn't found in stpk_utils.

I am curious as to why it crashes in _g.script. Mine looks like this: http://pastebin.com/FbtSi1aF

and I get this error:

Arguments     : LUA error: ...of chernobyl\gamedata\scripts\daemonion_sound.script:57: attempt to index field 'actor' (a nil value)



...line 57 is this
local actor = db.actor

in my function from here http://pastebin.com/Zg9VH8Ew
  19:00:30  28 July 2013
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
 

Message edited by:
TKGP
07/28/2013 19:01:13
Messages: 454

---QUOTATION---
attempt to index field 'actor' (a nil value)
---END QUOTATION---


I would guess the point at which you're calling it is before db.actor is initialized.

I've also put the new code into my scripts and while it doesn't crash any more, the innermost block ("do_some_shit" etc) never seems to get called. I've placed a few things throughout to check and it definitely gets to the point where it should be evaluating that conditional. Daemonion, was it successfully playing those sounds you inserted?
  19:11:46  28 July 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
attempt to index field 'actor' (a nil value)
I would guess the point at which you're calling it is before db.actor is initialized.

I've also put the new code into my scripts and while it doesn't crash any more, the innermost block ("do_some_shit" etc) never seems to get called. I've placed a few things throughout to check and it definitely gets to the point where it should be evaluating that conditional. Daemonion, was it successfully playing those sounds you inserted?
---END QUOTATION---


Did you frame rate drop substantially when unholstering a weapon?

My frame rate drops considerably, and, in order to play those sounds, I have to fire the gun at least a few times, and it takes one minute or more for the sounds to play. I believe this is due to the drop in frame rate (like I mentioned, it is 1 FPS for me when unholstering a weapon).

If I holster the gun before the sound plays, it won't trigger. I have to keep the gun out. Once the sound starts playing, I can holster it and it will keep going.

So, in short, it works for me, but there is a minute or more delay, at least with the code I am using.
  19:28:17  28 July 2013
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454

---QUOTATION---
Did you frame rate drop substantially when unholstering a weapon?
---END QUOTATION---


Yeah, it's pretty abysmal. Presumably stpk_utils.get_weapon_data just has too much overhead to be calling once every update. There are some small optimizations to be made in terms of only checking if the item is a weapon once etc but I don't really know what to do about the main issue.
  19:45:10  28 July 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
Did you frame rate drop substantially when unholstering a weapon?
Yeah, it's pretty abysmal. Presumably stpk_utils.get_weapon_data just has too much overhead to be calling once every update. There are some small optimizations to be made in terms of only checking if the item is a weapon once etc but I don't really know what to do about the main issue.
---END QUOTATION---


Perhaps those optimizations will help (in this case, the stereo audio) fire much more quickly.
 
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.