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 | All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  00:51:33  25 October 2013
profilee-mailreply Message URLTo the Top
gannebamm
has abondened XRay and uses Unity3D now
(Resident)

 

 
On forum: 05/02/2007
Messages: 1077

---QUOTATION---
Rather than checking the weapon condition, it checks the total amount of ammo a given weapon has.
Wouldn't that make it trigger on manually unloading the weapon?
---END QUOTATION---


guys, just look into the tgz files. I coded a CO2 spray feature which works with the same hack and doing it like a charm.
I have thought about these manual loading mechanisms and stuff, too. Even tough most features of TGZ where wip this one was finished in terms of functionality (but not balance).
You just have to head over the COP section and ask for the files, as for now i do not have them anymore. But the files where spread through the community so somebody will have them.
  17:25:25  25 October 2013
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
Messages: 1519
I would be good if, as soon as those files have reappeared, they would be re-uploaded and linked here as well - they might serve as a solid reference for many of us scripters !
  21:58:18  26 October 2013
profilee-mailreply Message URLTo the Top
gannebamm
has abondened XRay and uses Unity3D now
(Resident)

 

 
On forum: 05/02/2007
Messages: 1077

---QUOTATION---
I would be good if, as soon as those files have reappeared, they would be re-uploaded and linked here as well - they might serve as a solid reference for many of us scripters !
---END QUOTATION---


Here you go:
https://www.dropbox.com/sh/lw39q1ba6bzv1lt/xB4oiC31Ej

thanks to 2C.LiryC & david.m.e for the backup of TGZ files!


The interessting files for you are:
TGZ_update.script (function check_sprayed_wpn())
TGZ_wpn_spray.script

I save weapon infos into a table and check how those infos change over time. You are able to determine what action was done to the weapon in terms of current ammo capacity:

if TGZ_wpn_spray.weaponinfo[v].ammo_last == 0	-- not initialized/ reload
	then TGZ_wpn_spray.weaponinfo[v].ammo_last = old_wpn:get_ammo_in_magazine()
elseif TGZ_wpn_spray.weaponinfo[v].ammo_last < old_wpn:get_ammo_in_magazine()  -- had reloaded (activly)
	then TGZ_wpn_spray.weaponinfo[v].ammo_last = old_wpn:get_ammo_in_magazine()


For the weapon spray feature it was important to keep track of the sprayed weapon (ID wise) since you where able to do a certain amount of shots with the sprayed weapon before it through the spray boosted statistics get lowered again. Furthermore I had to keep track of every single bullet which left the magazine to precisly time the detoriation effect.

After reading my code is realize it is over complicated for your needs:
You could just keep track of the current weapon and if the ammo capacity is lowered since the last check - so a shot was made. If the weapon ID changed it isn`t the same weapon anymore and you don`t need to play the shot sound; if the ammo is higher than at your last check it was reloaded.
  22:07:50  26 October 2013
profilee-mailreply Message URLTo the Top
Meltac
messing with code
(Resident)

 

 
On forum: 01/21/2010
Messages: 1519
Thanks, man
  13:28:27  27 October 2013
profilee-mailreply Message URLTo the Top
ddraig
Senior Resident
 

 
On forum: 06/19/2012
Messages: 158

---QUOTATION---
Wouldn't that make it trigger on manually unloading the weapon?
---END QUOTATION---



When a weapon is unloaded it isn't counted as having a magazine so it doesn't call the function.
 
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.