The Geek Biker

Rambles of a geek that rides a bike

Simple looting system

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.

  1. hands (no actual damage, it is like holstering you weapon…yes, there is a reason behind the madness).
  2. revolver
  3. pistol
  4. shotgun (spreadable bullets is a future concern)
  5. MG
  6. Rifle.

So the odds of picking up the weapons should resemble:

  1. hands      100%
  2. revolver 60%
  3. pistol       50%
  4. shotgun (spreadable bullets is a future concern)40%
  5. MG     30%
  6. 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.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: