So, I'm trying to put together a (hopefully) simple gun/ammo system but the system is turning out to be more complex than I anticipated.
I'm not using standard MP for magic, so I've replaced the MP system with an ammo system for guns. The guns are basically renamed "shields" that can be equipped and MP has been renamed Ammo.
Each gun grants access to a "Gun" skill category and one or more gun skills (so a basic pistol would just have "shoot" but an SMG would have "shoot", "burst fire" and "full auto spray", for example) and a Reload skill. Player max MP is 0 so the MP "bonus" granted by the gun becomes the only MP available. So a revolver grants 6 MP (one for each bullet) and Shoot restores your MP to max, using an appropriate quantity of Bullet items.
This is where things get more complicated...
1) First, when a character uses the Reload skill it needs to check whether the gun is already full and if so it can notify the player and prevent them from losing their action (so, if the gun already has max ammo then they can't lose their turn accidentally reloading). The same goes for if the player attempts to reload without any bullets in the inventory: they need to be notified without wasting a combat turn.
A more simple solution might be to seal the Reload skill if either of those conditions are true, but I don't know how I would do that either.
2) Second, when a character uses the Reload skill it needs to be able to check how many bullets the player needs to get back to full ammo, how many bullets they have and if they have fewer bullets than ammo needed then it only restores that much ammo.
So, if a player has 10 bullets and reloads a revolver with 0 out of 6 ammo, they'll lose 6 bullets and be restored back to maximum ammo, leaving them with 4 in their inventory. If they take six shots and go back to 0 ammo and reload again then it only restores 4 MP because that's how many bullets the player has.
3) Third, since players will be able to change their equipped gun, I would like to avoid them "losing" or "creating" ammo when this happens.
For example, a revolver would provide the player with 6 max ammo, but an SMG might provide them with 30 max ammo. If they equip the revolver, load it (giving 6 ammo) and then switch to the SMG then the max MP will simply rise to 30 without adjusting the current MP, effectively transforming the revolver ammo into SMG ammo. Likewise, if the player has a fully loaded 30-round SMG and switches to the revolver, their max ammo will drop down to 6. Not only would this create revolver ammo, it would eliminate the remaining 24 SMG bullets, because if they switch back to the SMG then they'll only have the 6 ammo in the revolver.
I'm wondering if it might be better to track ammo with a different system, maybe using independent variables instead of an MP substitution? So "revolver ammo" could be a variable and the various skills increase or decrease the variable? Any way to get a variable to display on the battle HUD in place of an MP or TP bar (neither is getting used in this game)?
I'm not using standard MP for magic, so I've replaced the MP system with an ammo system for guns. The guns are basically renamed "shields" that can be equipped and MP has been renamed Ammo.
Each gun grants access to a "Gun" skill category and one or more gun skills (so a basic pistol would just have "shoot" but an SMG would have "shoot", "burst fire" and "full auto spray", for example) and a Reload skill. Player max MP is 0 so the MP "bonus" granted by the gun becomes the only MP available. So a revolver grants 6 MP (one for each bullet) and Shoot restores your MP to max, using an appropriate quantity of Bullet items.
This is where things get more complicated...
1) First, when a character uses the Reload skill it needs to check whether the gun is already full and if so it can notify the player and prevent them from losing their action (so, if the gun already has max ammo then they can't lose their turn accidentally reloading). The same goes for if the player attempts to reload without any bullets in the inventory: they need to be notified without wasting a combat turn.
A more simple solution might be to seal the Reload skill if either of those conditions are true, but I don't know how I would do that either.
2) Second, when a character uses the Reload skill it needs to be able to check how many bullets the player needs to get back to full ammo, how many bullets they have and if they have fewer bullets than ammo needed then it only restores that much ammo.
So, if a player has 10 bullets and reloads a revolver with 0 out of 6 ammo, they'll lose 6 bullets and be restored back to maximum ammo, leaving them with 4 in their inventory. If they take six shots and go back to 0 ammo and reload again then it only restores 4 MP because that's how many bullets the player has.
3) Third, since players will be able to change their equipped gun, I would like to avoid them "losing" or "creating" ammo when this happens.
For example, a revolver would provide the player with 6 max ammo, but an SMG might provide them with 30 max ammo. If they equip the revolver, load it (giving 6 ammo) and then switch to the SMG then the max MP will simply rise to 30 without adjusting the current MP, effectively transforming the revolver ammo into SMG ammo. Likewise, if the player has a fully loaded 30-round SMG and switches to the revolver, their max ammo will drop down to 6. Not only would this create revolver ammo, it would eliminate the remaining 24 SMG bullets, because if they switch back to the SMG then they'll only have the 6 ammo in the revolver.
I'm wondering if it might be better to track ammo with a different system, maybe using independent variables instead of an MP substitution? So "revolver ammo" could be a variable and the various skills increase or decrease the variable? Any way to get a variable to display on the battle HUD in place of an MP or TP bar (neither is getting used in this game)?