Jump to content
Highwind017

(ABS) Firearms using variable's for Ammo/Reloading

Recommended Posts

Not too sure if i've placed this in the right place, so excuse me if it's in the wrong place.

 

Before i begin, i'm going to say that the project i'm working on is using Falcao Pearl ABS (Action Battle System) and not the turnbased system that RPG Maker VX Ace uses by default. I am also aware that Falcao Pearl has a ammo system built in. But that's not quite what i want. Let me explain.

 

Alright, so for my game, The main character uses firearms as a means to defend herself. Prevously i was using max MP as the gun's capacity, so something like a AK47 would give her 31 MP or Bullets and in order to restore the spent MP you would have to reload using a skill that would restore 30 rounds, as long as you had the item in your inventory, such as the gun's magazine. Reloading would only take a second or two and would cast like a spell. However, as much as this system worked there was a few noticable flaws.

 

The main problem that I've yet to figure out with this methoid of Shooting and Reloading is how to have each weapon have their own MP pool which doesn't change when you unequip it/equip it later. Like, if you use up the ammo in your revolver which has 6 shots and your unable to reload it because you have back up ammo. You shouldn't be able to equip your Makarov, reload that (which has 12 rounds) and then change back to the revolver which suddenly has 6 shots again. As the same time, if you unequip your just reloaded Makarov to a melee weapon, suddenly your Makarov has lost that entire magazine when you equip it again.

 

Now, i was suggested to use variables, Store the ammo of each gun as a variable and as it's used it decreases it by 1 until you need to reload. Reloading would put it back to max and this would allow MP to be used for something like such as stamina. I don't know much about coding or using variables in such a fashion, i'm guessing you can use a common event for each weapon although i'm still not too sure about it. And that's where i require the help.

 

Now, yes. I am aware of Asagi's Gun Licence but i'm not sure if that would work with Falcao Pearl since i've not tested it yet with it. And from what i've seen so far of it, it doesnt have the magazine capacity system that i need. There's Bullpup Shooting Engine but... i can't understand any of it since it's all in brazilian, including the script.

 

Anyway, i hope you people can help me here. Thanks people.

Edited by Highwind017

Share this post


Link to post
Share on other sites

Definitely complicated and needs a solution.

 

You might need to set up a window using a script and display a variable for each gun, subtract from that when you shoot, add to it when you reload, and make sure you use the right variable when you switch guns.

Share this post


Link to post
Share on other sites

Pearl ABS already has ammo note tag for weapons. The note tag is listed in the script instructions.

Share this post


Link to post
Share on other sites

Yes, you said that in the last thread in the last form and i told you that doesn't have a reload system built in, it's more like a bow and arrow where you just get the next arrow and fire away.

 

I want a ammo/magazine system like A Nightmare To Remember, or something like that. I'm half tempted to ask the guy myself.

Share this post


Link to post
Share on other sites

 

.. i can't understand any of it since it's all in brazilian, including the script.

 

Anyway, i hope you people can help me here. Thanks people.

 

It's not "Brazilian" it's Portuguese. If you want I can translate it for you, just PM me.

Edited by Sughayyer

Share this post


Link to post
Share on other sites

Sorry, I forget sometimes what I post and where :D

 

Anyway, this is purely speculative but...

 

Maybe you could create a gun and have it call a common event through the note box. Have that common switch the players weapon with an identical weapon except that is has 'bullets'. Basically, while the second weapon is equipped, you could have it's attacks linked to another common event that adds a variable each time it's used. When the variable reaches 10 or 13 or whatever number of bullets you have, then it would activate another common event that is set up as a parallel process. The parallel process would then change the variable back to zero and switch the characters weapon back to the original which basically means it's empty. So then the player would have to use the empty weapon (essentially reloading it) and the process would begin again.

 

I'm fairly certain that it's all possible. I don't have time right now BC I work doubles every weekend but, I'd be glad to test it out Monday. Anyway, if you try doing it that way, let me know how it comes along

Share this post


Link to post
Share on other sites

It's not "Brazilian" it's Portuguese. If you want I can translate it for you, just PM me.

 

Really? Excuse my slight error. The website i saw it in had .br at the end so i assumed "Yeah, that's Brazilian"

 

Sorry, I forget sometimes what I post and where :D

 

Anyway, this is purely speculative but...

 

Maybe you could create a gun and have it call a common event through the note box. Have that common switch the players weapon with an identical weapon except that is has 'bullets'. Basically, while the second weapon is equipped, you could have it's attacks linked to another common event that adds a variable each time it's used. When the variable reaches 10 or 13 or whatever number of bullets you have, then it would activate another common event that is set up as a parallel process. The parallel process would then change the variable back to zero and switch the characters weapon back to the original which basically means it's empty. So then the player would have to use the empty weapon (essentially reloading it) and the process would begin again.

 

I'm fairly certain that it's all possible. I don't have time right now BC I work doubles every weekend but, I'd be glad to test it out Monday. Anyway, if you try doing it that way, let me know how it comes along

 

I'll try that out when i wake up tomorrow, i think i have a basic idea about it now that's been explained from someone who know's what they are doing more than me.

 

Can you use a variable for ammo?  If so you could keep it stored for when you change weapons, and use this http://www.rpgmakervxace.net/topic/2302-xs-variable-hud/ to display current ammo count.

 

Might use that with what Ninja said, i'll get experementing when i wake up tomorrow.

Share this post


Link to post
Share on other sites

I'm looking for the exact same thing, has there been any progress on the solution?

I'm working with very similar ideas with pistols, assault rifles etc... pistol especially i want it to be semi auto (the speed you tap the speed it shoots) but the catch has to be the reload (sound effect then slow pause) before you can continue. I'm sure it isn't that difficult, but maybe falcao could help?

Share this post


Link to post
Share on other sites

I actually just PM'd Highwind017 with a basic explanation of how to accomplish the task using Pearl ABS. I'll edit my post in a few with the message I sent.

 

 

EDIT:

Sent Today, 11:14 AM

Okay, so basically you need two weapons: The empty gun and the full gun.

You also need two skills and three common events: Skill A will call Common Event A, Skill B will call Common Event B.

 

1. Set the Empty Gun up as a ranged weapon that consumes an item (like an ammo clip) and have the weapon activate skill A. Skill A will call Common Event A. Have Common Event A swap out the Empty Gun for the Full Gun, add the amount of bullets you want the clip to contain, and activate a Switch. The switch will in turn activate Common Event C which will run as a parallel process to check a variable which you'll need to assign to Skill B.

 

2. Set the Full Gun up as a ranged weapon that consumes an item (the bullets gained from using the Empty Gun) and have the weapon activate skill B. Skill B will call Common Event B. Have Common Event B add +1 to a variable (the same variable you'll be using in Common Event C).

 

3. Common Event C needs to be set as a parallel process activated by the same switch you turned on with Common Event A. Set up a conditional branch to check for your variable used in Common Event B (the variable to check for should equal the amount of bullets gained with Common Event A. i.e. you gave player 10 bullets so check for variable to be equal to 10). When the condition is met, the full gun should be swapped out for the empty gun, the variable count should be reset to zero, and the switch should be turned off.

 

That is the basic gist of how it should be set up. Obviously you'll need to tweek parts of the Note tags in the weapons to make them work correctly but all the commands are explained in Falcao's script instructions. The skills are pretty basic and just need to call the common events. You can pretty much add any effects you want within the common events though. Hopefully my little explanation will get you started though. :) Good luck with your game!

 

 

@Weapon_OD: to accomplish the SE and waiting period after reloading/firing a weapon, you can change the Tool Cooldown, Tool Cast Animation, and/or some of the other NoteTags within the weapons notebox.

Edited by HumanNinja

Share this post


Link to post
Share on other sites

hmm i was thinking mayeb playing with the combo function, but instead of a chance to hit make it hit after so many successful hits, this way (lets say 9 shots) after 9 successive hits "combo" will be triggered and the combo is the reloading animation/sound effect along with a pause, then the normal attack continues. My only concern is the fact that some scripting may be needed to alter the combo system in Falcaos ABS.. Hmm..

Share this post


Link to post
Share on other sites

Alrighty then. I have made a breakthrough, thanks to Human Ninja. Using what he told me, I got it all working. But then i decided to ditch using variables all together after some experimenting. Let me explain.

 

Following what he said word for word. I was able to make a ranged weapon such as a Pistol. This did have some minor flaws however. One being that you where unable to reload manually whenever you wanted to, if you tried to reload it would break because of the variable for each shot you've fired not matching up to what is remaining in the magazine. It gave me a basic gist of what to do and i ended up doing my own little thing to suit my own liking.

 

We have, like Human Ninja said. Two weapons that are the same. Because my Main Character is using a Makarov pistol. I have two versions of that one pistol. A Empty and a Loaded version. We also have two items (The Weapon in questions Magazine and Ammo), two skills (The weapon in questions "Reload" and "Shoot" skills) and two common events. Also, we used Yanfly Engine Ace - Adjust Limits v1.00.

 

49LBF.png

 

The Empty version of the Makarov has different note tags to the Loaded Makarov. The Empty version has no range, cannot do damage and when used, plays a sound of a pistol out of ammo. It also doesn't use any items or use any skills when used. It does however, like the Loaded Makarov give a skill, simply called "reload". Which will use up a magazine to give bullets, this skill is only usable by pressing "N" to open up your hotbar configuration, going to skills and equipping "reload" into a skills slot. You could make it so you can use that skill in the main menu but somehow that doesn't require an item.

 

When used, The reload skill will call Common Event A. Which will give 10 rounds, give you the loaded Makarov, equip it automatically and delete the "Empty" version from your inventory that you where previously using. It will also give and take away "Makarov reloaded", something you don't need but because Falcao Pearl ABS has the item pop up system. The last item of the list that is given to you will say, for example "[icon Here] Bullets - Makarov X10". I've made it so the last "item" is just saying "Makarov reloaded" to tell you that your pistol is reloaded and ready to fire.  Lastly, the switch for "Makarov Reloaded" will turn on, which is a parallel process which i'll explain in a moment. The only slight hick up with this is that it says "[!] Makarov reloaded X1", that should be fixable easily though once i figure that out. But nevermind that for now...

 

49MQ3.png

 

If the "reload" skill is used again however, it will not switch out the weapon but it will use a magazine for bullets and it will say "Makarov reloaded early", this is to simulate the "One in the Chamber" rule, If you where to take out the magazine out from a loaded pistol or, say assault rifle, a round would still be inside the gun, ready to fire. Putting a fresh magazine inside would give you an extra round to fire. So it would be 10 + 1. However you would lose the bullets remaining inside the previous magazine, So it would be best to reload just before your empty to prevent any waste. Now normally. What would happen is you could fire half of that magazine and reload it, ending up with 15 rounds, a few rounds more than it should be which can be fixed with Yanfly Engine Ace - Adjust Limits v1.00, Simply put in <max limit: x> in the note of the item, in this case the bullets used by the Makarov. Each Magazine will carry 10 rounds, but the limit will be 11 just so we can have "One in the Chamber". This will prevent the predicament of having too many ammo in a weapon that isn't supposed to have too much ammo. So your not going to have a revolver that should be carrying only 6 shots, but somehow has 99.

 

Also, it's not recommended to look through the barrel of your gun if it happens to jam, because of the One in the Chamber rule, and doing so is just plain silly.

 

296jammedgun.gif

 

Now, now that the gun is loaded. You can now fire it and reload whenever you want. Pressing F will spend one bullet (Tool Item Cost =) and will use the skill to fire the gun once using "Tool Invoke Skill =" due to Falcao Pearl ABS. I've made it so a Conditional Branch checks for the item "Bullets - Makarov", Which will do nothing if you still have rounds left in the magazine but will chance the "loaded" gun back to the empty one once it detects that there are no bullets left in your inventory. It will also tell you that your pistol is out of ammo and the switch for the Makarov loaded will turn off.

 

49NFq.png

 

And that's pretty much it, a working gun with reloading features. I'd imagine i can make it so  XS - Variable Hud will display Magazine and Bullet count closer together. But if this is done correctly it should be like this video that i just made just to demonstrate this.

 

http://www.youtube.com/watch?v=UCtUwsos9WI

 

Still wondering how to make a weapon fully automatic however, it might have something to do with the Combo System but it's not too important. I've got a excuse for a certain weapon that should be fully automatic be single shot only however.

Share this post


Link to post
Share on other sites

That's some great work the only thing I would consider is trying to make all weapons share the reload skill, seeing as if you had a game where near the end you had a handful of guns, switching the skill after equipping would get frustrating... especially in a horror/survival style situation. Besides that it looks very promising so far.

Share this post


Link to post
Share on other sites

Congrats to you! Nice job getting it working! Also, you can get rid of those pop ups by just deleting that particular script I think. I can't remember... If it's not a script, there is a place to hashtag it so as to get rid of it. I did it in one of my projects, just can't remember how at the moment :huh:

 

And like Weapon_OD said, it would be nice if you could work it out to having only one reload skill. Probably not so difficult as it would be tedious. I'm thinking it could be done with a lot of conditional branches to check which weapon is equipped.

Share this post


Link to post
Share on other sites

Hey man I had a crack emulating this effect but I appear to have screwed it up? think you could post a detailed explanation about EVERYTHING haha, I got the common events down pat, and i think the weapons, but I appear to have issues with the skills and it all linking together.. Did you include the whole variable idea with your demo?

 

Edited by Weapon_OD

Share this post


Link to post
Share on other sites

@ Weapon

 

No variable's are used. If your asking me.

 

@ Ninja

 

I'll try and sort out that later, but i think the "One Reload skill fits all" is low on the priority list right now.

Share this post


Link to post
Share on other sites

Ok i've got humans way working perfectly, but I'm still unhappy haha, I'll continue playing with it to try and make it perfecto! Thankyou both of you so far, couldn't of even gotten to this point without both of you.

 

 

EDIT:

 

yeah high ive got a few troubles with your way, ive done somethin wrong... Do you think you could send me screenshot fo your guns set up or a basic demo?

Edited by Weapon_OD

Share this post


Link to post
Share on other sites

okay thanks, first 

1- When the pistol is empty, I want it to continue making the click(empty sound) until i use the skill "reload", but as soon as my conditional (i added the req of having "Pistol Mag" in invent) finds the mag, it automatically reloads 21 bullets (instead of 9?)

 

2- Reload early works the first time (7 bullets left, reload early pops up and it reloads...) but then the second time it stacks the bullets

Besides that, everything else is fine.. when there are no mags left, and no bullets left it does not work and continues to make the empty sound, which is perfect...

 

I've fixed almost all the problems now, my one issue is it shows up "1" below the ammo in the skill bar for some reason, so instead of it saying 0 when there is no ammo, it says "0" then below it "1".

Also, I was wondering how to make the reload skill un-usable if there are no mags in inventory.


 

Edited by Weapon_OD

Share this post


Link to post
Share on other sites

Maybe make it a first conditional branch for A that searches for the Magazine item, and if it finds it then it searches to see if the switch is turned on and does it's thing like normal?

Share this post


Link to post
Share on other sites

Alrighty then. I have made a breakthrough, thanks to Human Ninja. Using what he told me, I got it all working. But then i decided to ditch using variables all together after some experimenting. Let me explain.

 

Following what he said word for word. I was able to make a ranged weapon such as a Pistol. This did have some minor flaws however. One being that you where unable to reload manually whenever you wanted to, if you tried to reload it would break because of the variable for each shot you've fired not matching up to what is remaining in the magazine. It gave me a basic gist of what to do and i ended up doing my own little thing to suit my own liking.

 

We have, like Human Ninja said. Two weapons that are the same. Because my Main Character is using a Makarov pistol. I have two versions of that one pistol. A Empty and a Loaded version. We also have two items (The Weapon in questions Magazine and Ammo), two skills (The weapon in questions "Reload" and "Shoot" skills) and two common events. Also, we used Yanfly Engine Ace - Adjust Limits v1.00.

 

49LBF.png

 

The Empty version of the Makarov has different note tags to the Loaded Makarov. The Empty version has no range, cannot do damage and when used, plays a sound of a pistol out of ammo. It also doesn't use any items or use any skills when used. It does however, like the Loaded Makarov give a skill, simply called "reload". Which will use up a magazine to give bullets, this skill is only usable by pressing "N" to open up your hotbar configuration, going to skills and equipping "reload" into a skills slot. You could make it so you can use that skill in the main menu but somehow that doesn't require an item.

 

When used, The reload skill will call Common Event A. Which will give 10 rounds, give you the loaded Makarov, equip it automatically and delete the "Empty" version from your inventory that you where previously using. It will also give and take away "Makarov reloaded", something you don't need but because Falcao Pearl ABS has the item pop up system. The last item of the list that is given to you will say, for example "[icon Here] Bullets - Makarov X10". I've made it so the last "item" is just saying "Makarov reloaded" to tell you that your pistol is reloaded and ready to fire.  Lastly, the switch for "Makarov Reloaded" will turn on, which is a parallel process which i'll explain in a moment. The only slight hick up with this is that it says "[!] Makarov reloaded X1", that should be fixable easily though once i figure that out. But nevermind that for now...

 

49MQ3.png

 

If the "reload" skill is used again however, it will not switch out the weapon but it will use a magazine for bullets and it will say "Makarov reloaded early", this is to simulate the "One in the Chamber" rule, If you where to take out the magazine out from a loaded pistol or, say assault rifle, a round would still be inside the gun, ready to fire. Putting a fresh magazine inside would give you an extra round to fire. So it would be 10 + 1. However you would lose the bullets remaining inside the previous magazine, So it would be best to reload just before your empty to prevent any waste. Now normally. What would happen is you could fire half of that magazine and reload it, ending up with 15 rounds, a few rounds more than it should be which can be fixed with Yanfly Engine Ace - Adjust Limits v1.00, Simply put in <max limit: x> in the note of the item, in this case the bullets used by the Makarov. Each Magazine will carry 10 rounds, but the limit will be 11 just so we can have "One in the Chamber". This will prevent the predicament of having too many ammo in a weapon that isn't supposed to have too much ammo. So your not going to have a revolver that should be carrying only 6 shots, but somehow has 99.

 

Also, it's not recommended to look through the barrel of your gun if it happens to jam, because of the One in the Chamber rule, and doing so is just plain silly.

 

296jammedgun.gif

 

Now, now that the gun is loaded. You can now fire it and reload whenever you want. Pressing F will spend one bullet (Tool Item Cost =) and will use the skill to fire the gun once using "Tool Invoke Skill =" due to Falcao Pearl ABS. I've made it so a Conditional Branch checks for the item "Bullets - Makarov", Which will do nothing if you still have rounds left in the magazine but will chance the "loaded" gun back to the empty one once it detects that there are no bullets left in your inventory. It will also tell you that your pistol is out of ammo and the switch for the Makarov loaded will turn off.

 

49NFq.png

 

And that's pretty much it, a working gun with reloading features. I'd imagine i can make it so  XS - Variable Hud will display Magazine and Bullet count closer together. But if this is done correctly it should be like this video that i just made just to demonstrate this.

 

http://www.youtube.com/watch?v=UCtUwsos9WI

 

Still wondering how to make a weapon fully automatic however, it might have something to do with the Combo System but it's not too important. I've got a excuse for a certain weapon that should be fully automatic be single shot only however.

Any chance of a tutorial explaining how to do it? I've been trying for the past few hours and I can't get it to work at all.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

If you read his whole post it actually tells you how to do it exactly

I did that multiple times and it didn't work. It wasnt until the fifth or sixth time did it work...somewhat. I'm now having a problem 'syncing' the bullets to the gun. If I keep the gun's Tool Item Cost to zero and reload, I'll have infinite ammo and no ammo count under the gun, but if I put it to 1 and reload, there's an 0 under the gun's icon and it doesn't work. What's happening here?

 

Also, this can't be used with the Victor Engine: Step Sound script as if you fire your gun, it'll cause the tile's sound to play.

Share this post


Link to post
Share on other sites

you can pm your demo and i can fix it for you, I just kept playing with falcaos abs settings until i got it working

Share this post


Link to post
Share on other sites

So it turns out you can use the Victor Engine: Step Sound script with this. You just need to put Tool Speed = 6 (Or higher) in your weapon's notebox. Anything lower than 6 causes your tile sound to play as the 'bullets' move.

 

 

you can pm your demo and i can fix it for you, I just kept playing with falcaos abs settings until i got it working

 

Why not just post whatever you've done here? I assume you followed Highwind's post, so we have the same setup.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted