I’m pretty sure that there are a lot of looting systems out there, so again I thought I’d write one that I’d understand….so it’s going to be a very simple one.
The main idea is that the odds of getting a weapon type in the game, should range from good to bad. This should depend on the type of weapon,right?
So…currently I have 6 types of weapons built into the game.
- hands (no actual damage, it is like holstering you weapon…yes, there is a reason behind the madness).
- shotgun (spreadable bullets is a future concern)
So the odds of picking up the weapons should resemble:
- hands 100%
- revolver 60%
- pistol 50%
- shotgun (spreadable bullets is a future concern)40%
- MG 30%
- Rifle 20%
“But hold on! that doesn’t add up!” I head you say. Actually it does, in a round about kind of way.
So the pseudo flow would look like this.
1. You throw a 6 die to see which weapon you will get.
2. Then you throw a “100” die and if your value rolled is between 0 and the weapon’s probability, then you get it.
One last step though. You flip a coin to see if you actually get a weapon or the weapon type’s ammo. Which ends up being a random number between 0 and 20.
In code it looks a lot neater I have to say.
I haven’t actually added health and power ups. I’m still thinking about this. “Health” is something you should buy at a doctor’s office in a town. Not something a criminal should throw down…Or you open a chest in hell and out pops a bottle of ACME’s Cure Me Quick.
And power ups is the other. Let’s say you pickup a power up for your weapon…personally I don’t think that you should be fiddling with a weapon while there are monsters/bad guys around.
Maybe that is another feature I should add. When you buy a power up from the shops. There should be an odd chance of the person attaching it to your weapon to actually do damage to your weapon. i.e. degrade the weapon life or something like that.
BTW. weapon degradation is already included.
Well done and pat myself on the back for that.
O yeah…got the graphics to work as well and have been playing around with old GTA 1 sprites.