Picking Up Ammo

In my game, the players start with some ammo. However, that ammo is finite. How do I have them pick up more later on? I used some of the tutorial code, but the tutorial doesn't tell you how to pick up more ammo. Could someone help me out?


Alrighty. Let's begin :D (Pardon me for my bad English)

If you're talking about how the ammo is finite, you may as well want it to be stackable. I did a little research, and probably this site may help you:
https://github.com/ThePix/quest/wiki/Library:-Stackable-items
..though it involves a custom library

Anyways, back to the main topic. So first of all, you said that the player begins with this, if you may, a stack of ammo, and by time, the player may need more ammo. (Btw if you're only having problem with picking up then you can go to the ammo object tab and click on inventory tab. Make sure you've got the "object can be taken" box ticked)

But is the ammo location is set specifically just like those in battle royale-like games? Or, are you talking about ammo whose location may change by time?

If you're thinking about games where the ammo location is set, you may want to put several other ammo in rooms. Just make sure the alias is the same for the same type of ammo (or you can do clone object) and make sure it works the same as the ammo the player has at the very beginning of the game.

If you're thinking about ammo whose location may change by time, you can do this by setting up a script MoveObject that takes effect every few seconds or every turn. I think a turn script is the most befitting for this job, though.
However, if this is what you're going to do, you may consider one problem: players may be irritated when they get into the room seeing the ammo laying in the same room but then it disappears few seconds after they get into the room. If that's the case, the players may have to keep running for hours just to pick up ammo, isn't that annoying?

Because of that, add another script to the turn script and put the previously mentioned script within this one. This script will be something like: IF "player.parent=ammo.parent" (this is only if your player "name" is player and if your ammo "name", not alias, is ammo) then nothing happens. Else, move object ammo to object somewhere (if you're not using run script after few seconds)

I'm not really sure if that's what you're searching for, but hope it helps!


What I meant by the question was thus: If the player finds, say, twelve rounds in the environment somewhere, or finds ammo that has been dropped by an enemy. What would I include in the code to make it so the rounds would be added to the amount they already have.

But yeah, everything worked out. Thanks for the help.


What I meant by the question was thus: If the player finds, say, twelve rounds in the environment somewhere, or finds ammo that has been dropped by an enemy. What would I include in the code to make it so the rounds would be added to the amount they already have.

But yeah, everything worked out. Thanks for the help.


Personally I use a storage room for my items and I use volume as the amount I have which uses inventory limits as well. So if i pick up ammo after having non I pick up and increase volume by say 12, then when using ammo decrease volume of ammo by 1 then if equals 0 or lower set volume to 0 then move ammo to storage room for later use.


Log in to post a reply.

Support

Forums