angryglock Posted August 29, 2014 Share Posted August 29, 2014 In the working script below: Begin OnFire if (RoseofSharonCassidyREF.GetItemCount Ammo44magnum <10) RoseofSharonCassidyREF.AddItem Ammo44magnum 50 endifEnd every time Cass fires the weapon the script is attached to it checks how much ammo she has. If it's below 10 she gets 50 rounds added to her inventory. It work just fine. However, I want the same script to work for any follower using the weapon. My question is how do I get the current user's (maybe the correct term is Actor's) REF so I can replace the RoseofSharonCassidyREF with the REF of the current user? Something like this: ref currentREFset currentRef to [?????????] ;where the ????? is the current follower using the weapon Begin OnFire if (currentREF.GetItemCount Ammo44magnum <10) currentREF.AddItem Ammo44magnum 50 endifEnd Sorry if this is poorly worded or I'm using the wrong terms. I'm new to geck scripting and without any proper dev tools it's seems to be a lot of trial and error for me. Link to comment Share on other sites More sharing options...
Ladez Posted August 29, 2014 Share Posted August 29, 2014 Try GetContainer. Since the script runs directly on the weapon reference, calling this will return the actor in possession of the weapon. Link to comment Share on other sites More sharing options...
angryglock Posted August 29, 2014 Author Share Posted August 29, 2014 Brilliant, thanks. This is what I ended up with and it's working well. You have to give the follower at least 2 ammo so he will equip the weapon, fire it once and then receive the new ammo. If you only give one, he will fire, unequip it since the ammo count is 0 before the script adds more ammo. Since script lag could come into play, giving around a full mag is a better idea.Other than that it's working even with 3 followers all using different weapons at the same time. I created 1 script per base ammo type for the guns I'm using and add that script to the weapon I want the follower to use. For instance, I gave Boone a silenced Hunting Rifle with this script. It's like he is taking care of his own scavenging needs. The nice part is I can take the gun and give it to any follower with the same result which makes this way better than using a token gun swap for a non-playable AmmoCompanion version. Of course it could be exploited for infinite ammo by removing the added ammo from the follower inventory but I don't think there is anyway around that. I don't think I can hide the ammo. I did add code to prevent the script from running if the player is using the weapon. Thanks for your help. ref myRefBegin OnFire set myRef to GetContainer if ( myRef != player ) if ( myRef.GetItemCount Ammo308 <10 ) myRef.AddItem Ammo308 50 1 endif endifEnd Link to comment Share on other sites More sharing options...
Recommended Posts