Looking for a way to make an ammo system

cub36

Villager
Member
Joined
Jul 28, 2012
Messages
20
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hi everybody,

in my game that im currently working on im looking for a way to have different weapons use different types of ammunition, ie bows will use arrows and crossbows will use bolts.

I'm presuming that there would be a way to do it with common events, but i'm pretty stuck on this.

Thanks
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I think it will be hard to do with CE... but I think I've seen a script for this somewhere here...
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
You can do this by common events, but that would either require complex coding for the case that there is no ammo (skill is already selected and you can't replace it, only force a subsitute), or the player would loose the action if there is no ammo.

Another variant would be a common parallel process that adds the skill only when ammo is available - but that would place the skill outside regular learning processes.

Best option is to go to the master script list (it's linked in the tutorial in my signature and on the script forums) and look for one of the skill cost scripts. Those scripts allow you to define items as a cost for using a skill.
 

CWells

Storyteller/Artist
Veteran
Joined
Apr 22, 2013
Messages
731
Reaction score
40
First Language
English
Primarily Uses
I was thinking about something like this. Here was my experimental idea. I never tested it though. It just floated in my head in..,ridiculous detail:

Make a variable and call it ammo capacity. Make two skills and call one shoot, the other shoot(check). (If you need to specify what the ammo is for then make a bunch of variables for the different ammunition)

Now make a Common Event with the conditional branch:

If ammo is = 0

"I'm empty!"

Else

force action Shoot Target=Random

Control Variable Ammo - 1

Branch end.

Give the character shoot(check)

Now in game, on the very turn that the character gets the weapon, during the event creation where character either buys the gun or finds it or whatever, put in:

Control Variable Ammo capacity Set 14 (For 14 shots)

There is of course one glaring issue with this:

"How can I have better control over who gets shot?"

If you put in the damage in the skill formula, Empty or not,, the damage portion will still go through. So you can't use the formula box. And if you do it this way, you can get the process working but will have no control over who you are targeting.

And as Andar hinted, there is no way to tell how much ammo you have from the skill so there is a high chance of players constantly hitting an empty ammo. Unless you make another thing for ammo check. There is lots to weave together.

If you want actual ammo just make an item called ammo with consume YES and set it so that using the item Sets the AmmoCapacity variable back to 14.
 

Oh yeah i should mention but you probably can guess already, that the shoot skill being called by force action is where the damage formula will be placed. And you can just call that one Shoot(check) or whatever, that name wont be seen. It is just shoot that you want shown so yeah, adjust the names as needed.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
I was thinking about something like this. Here was my experimental idea. I never tested it though. It just floated in my head in..,ridiculous detail:
The problem with your idea is that each skill needs a user (to get base parameter data etc).

If you have more than one actor who can use the gun, that common event rises in complexity by the need to find out which actor used the shoot(check) skill, and then branch to make the force action for that user. It's a lot easier to use one of the skill cost scripts and let the engine handle that logic...
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,050
Members
137,571
Latest member
grr
Top