rad666a Posted December 21, 2009 Share Posted December 21, 2009 I want to create a script to allow you to reload a weapon ONLY when it's empty. Is there a way to do this, and if so...how? BTW, I have no problems with using FOSE. Thanks in advance. Link to comment Share on other sites More sharing options...
Cipscis Posted December 21, 2009 Share Posted December 21, 2009 There's no way to detect when a weapon's clip is empty via script just yet, so you'll have to take advantage of the fact that weapons will be reloaded automatically when their clip is emptied, provided there is more ammunition available. In order to prevent manual reloads, you'll want to change the GameSetting "fPlayerWeaponReloadTimer" to 0 (or, if that doesn't work, a very small value like 0.01). This will prevent the player from reloading their weapon manually - if they tap the reload button then they will just put their weapon away instead. Cipscis Link to comment Share on other sites More sharing options...
rad666a Posted December 21, 2009 Author Share Posted December 21, 2009 There's no way to detect when a weapon's clip is empty via script just yet, so you'll have to take advantage of the fact that weapons will be reloaded automatically when their clip is emptied, provided there is more ammunition available. In order to prevent manual reloads, you'll want to change the GameSetting "fPlayerWeaponReloadTimer" to 0 (or, if that doesn't work, a very small value like 0.01). This will prevent the player from reloading their weapon manually - if they tap the reload button then they will just put their weapon away instead. Cipscis Darn. I was hoping I could set it for a specific weapon. I guess I'll have to wait for FOSE to handle that ;). Thanks for the reply! Link to comment Share on other sites More sharing options...
Cipscis Posted December 21, 2009 Share Posted December 21, 2009 You could script the weapon so that it changes the GameSetting whenever the player equips/unequips it via FOSE's SetNumericGameSetting. Cipscis Link to comment Share on other sites More sharing options...
rad666a Posted December 21, 2009 Author Share Posted December 21, 2009 You could script the weapon so that it changes the GameSetting whenever the player equips/unequips it via FOSE's SetNumericGameSetting. Cipscis Yes, that could work, but there is something else I want to do. It's an M1 Garand, and right now, the "ping" sound the gun makes when empty only happens when the gun runs empty with more ammo in your inventory. I'd like to add the sound when you run out of ammo completely. Since for that I need a way to detect when you run out of ammo in the gun and in inventory, I'll wait for FOSE. Link to comment Share on other sites More sharing options...
johntheemoemu Posted December 22, 2009 Share Posted December 22, 2009 You could script the weapon so that it changes the GameSetting whenever the player equips/unequips it via FOSE's SetNumericGameSetting. Cipscis Yes, that could work, but there is something else I want to do. It's an M1 Garand, and right now, the "ping" sound the gun makes when empty only happens when the gun runs empty with more ammo in your inventory. I'd like to add the sound when you run out of ammo completely. Since for that I need a way to detect when you run out of ammo in the gun and in inventory, I'll wait for FOSE.If you're using FOSE, and you know the size of the clip of the weapon this script applies to, maybe you could create a short called 'clip' and, upon checking to see if the weapon is equipped, have each left mouse click deduct a round from the clip variable (using GetKeyPressed), and when it is 0, check to see if more ammo is in the player's inventory. I think that would work, right? I can't think of anything else you do with mouse1 when your gun is out other than shoot. Also, FOSE gives you the ability to disable a key. However, you'd have to assume that everyone is using the 'r' key for reloading. Actually, if I'm not mistaken, FOSE has a function that allows you to check INIs, and I'm pretty sure that keymapping is stored in an ini file. Keep in mind that I'm fairly new at this scripting business myself, so I could be waaaaaaaaaaaaaaaaaaaaay off the mark. Link to comment Share on other sites More sharing options...
Recommended Posts