#------------------------------------------------------------------------------- # # This script allows for the definition of Ammunitions and weapons that can # consume them. To build an ammunition type, first add the name to the Ammo # Vocab entry in the redefinitions section of the script. # # To declare a weapon in the database as an ammunition: # Include the name of the ammo type surrounded by <> in the notes field. # for example: <arrow> # # To declare a weapon that consumes ammunition: # Include the term uses: followed by the ammo type surrounded by <> in the # notes field. for example: <uses:arrow> # # NOTE: Weapons can use more than one type of ammo! Include multiple tags # for each ammo type you wish to be equipable. # For example: <uses:bullet> <uses:grenade> # # To restrict the maximum equipable ammo for a weapon: # Include the max: attribute in the uses tag followed by the amount. # For example: <uses:bullet max:30> # # NOTE: If you include max: for one ammo type on a weapon, you must include # it for ALL ammo types for that weapon! # # To reload ammunition when using ammo-restricted weapons: # Include the reload tag in the notes of the skill. # For example: <reloads> # # To use ammo with skills: # Include the spendsAmmo tag followed by the amount to spend in the notes # field of the skill. # For example: <spendsAmmo:3> # #-------------------------------------------------------------------------------
In Redefinitions::
Set ammo type names and the generic ammo term here:
CODE
module Vocab #----------------------------------------------------------------------------- # You can define the names of your ammo types here. These are the terms used # in the notes field to delcare items as part of the system #----------------------------------------------------------------------------- Ammo = [ #Ammo1 Name "Arrow",
#Ammo2 Name "Bullet",
#Ammo3 Name "Grenade" ] AmmoGeneric = "Ammo" end
To add your own damage calculations for ranged weapons:
CODE
#----------------------------------------------------------------------------- # includes the calculations for weapons that use ammunition #----------------------------------------------------------------------------- def hit if two_swords_style n1 = weapons[0] == nil ? 95 : weapons[0].hit n2 = weapons[1] == nil ? 95 : weapons[1].hit n = [n1, n2].min elsif weapons[0] != nil and weapons[0].usesAmmo? n1 = weapons[0].hit n2 = weapons[1] == nil ? 95 : weapons[1].hit case $game_ammo.hitRateCalcType when 0 #addative n = n1 + n2 when 1 # average (rounds up) n = ((n1 + n2).to_f / 2).ceil when 2 #average (rounds down) n = (n1+ n2) / 2 when 3 #min n = [n1, n2].min when 4 #max n = [n1, n2].max #------------------------------------------------------------------------- # scripters can add their own damage calulation for ranged weapons here # by adding additional "when" statements to the case #------------------------------------------------------------------------- end else n = weapons[0] == nil ? 95 : weapons[0].hit end return n end
In Game_Ammo:
Select which damage formula to use:
CODE
#--------------------------------------------------------------------------- # set the type of hit calculation for ammos here # 0: Addative (weapon dmg + ammo dmg) # 1: Average (rounds up) # 2: Average (rounds down) # 3: Min # 4: Max #--------------------------------------------------------------------------- @hitRateCalcType = 0
Set auto-reloading behaviors:
CODE
#--------------------------------------------------------------------------- # Set this to true if you would like the characters to automatically # reload their weapons when they expend equiped ammunition. #--------------------------------------------------------------------------- @autoReload = false
and
CODE
#--------------------------------------------------------------------------- # Set this to true to enable the system to search for the first available # equipable ammo. Set to false to disable this capability. #--------------------------------------------------------------------------- @allowBlindReload = true
Compatibility
Requires RGSS2. (RMVX)
EXTENDS:
RPG::BaseItem
Vocab
Game_Actor
REDEFINES:
Scene_Title.create_game_objects
Scene_Battle.execute_action_attack
Scene_Battle.]execute_action_skill
Window_ActorCommand.setup
Game_Actor.skill_can_use?
Game_Party.gain_item
Window_Equip.refresh
OVERRIDES:
Scene_Battle.update_actor_command_selection
Game_Actor.hit
Game_Actor.weapons
Game_Actor.armors
Game_Actor.change_equip_by_id
Game_Actor.change_equip
Game_Actor.skill_effect
Window_EquipItem.include?
Screenshot
Coming Soon! (running out of time before class @.@)
Copy the script files into your game under the materials section. Configure database according to customization instructions!
Todo List:
Increase Compatibility
Add "quiver" system if possible
FAQ
None yet!
Terms and Conditions
Feel free to use this in your game, but please give me a shout in the credits! Also, feel free to edit this for your own personal purposes but please do not repost an edited version without my consent first.
I was wondering, if you used the skills, Dual, Double or Tripple Attack (or any skill but those where the three skills set in for the character), shouldn't the Ammo be depleted as well?
There are two Mandalorians are out in the woods. One of them collapses. He doesn't seem to be breathing and his eyes are glazed. The other Mandalorian takes out his communicator and contacts his commander. He gasps: "My partner has collapsed! I don't know what to do!" After a moment, the commander responds: "Calm down. I can help. First let's make sure your partner is dead." There is a silence then a blaster shot is heard. Back on the communicator, the Mandalorian says: "Okay, now what?"
I was wondering, if you used the skills, Dual, Double or Tripple Attack (or any skill but those where the three skills set in for the character), shouldn't the Ammo be depleted as well?
Yeah that's on the todo-list for the "real" release. I just needed to see if everything that is already implemented actually works.
Current Project[RC]: Twilight Realm 3DMMORPG w/dx9, and char creation through mysql after I get a server, now C++ scripting Current Project[VX]: Obsidian Trilogy just started 08/12/2008 Current Project[XP&RM2K3]: none
So could I use this to make disposable arrows? I mean, I know you said ammo and are thinking what would be the difference, I just wanna make sure. And is this just for a Action battle system or what?
Also, your link is broken...I think, its giving me a page load error when I click it.
So could I use this to make disposable arrows? I mean, I know you said ammo and are thinking what would be the difference, I just wanna make sure. And is this just for a Action battle system or what?
Also, your link is broken...I think, its giving me a page load error when I click it.
The link isn't actually broken, he just posted it backwards, so you just need to Copy + Paste, the http that's posted as a link.
There are two Mandalorians are out in the woods. One of them collapses. He doesn't seem to be breathing and his eyes are glazed. The other Mandalorian takes out his communicator and contacts his commander. He gasps: "My partner has collapsed! I don't know what to do!" After a moment, the commander responds: "Calm down. I can help. First let's make sure your partner is dead." There is a silence then a blaster shot is heard. Back on the communicator, the Mandalorian says: "Okay, now what?"
Group: Member
Posts: 52
Type: Event Designer
RM Skill: Beginner
Can you make ammo equippable? Say you use the "two swords style" option. One hand holds the weapon, the other holds the ammunition and it would have a specified number of shots.
So could I use this to make disposable arrows? I mean, I know you said ammo and are thinking what would be the difference, I just wanna make sure. And is this just for a Action battle system or what?
Also, your link is broken...I think, its giving me a page load error when I click it.
Fixed it.
QUOTE (Rukaroa @ Aug 27 2008, 09:42 PM)
Can you make ammo equippable? Say you use the "two swords style" option. One hand holds the weapon, the other holds the ammunition and it would have a specified number of shots.
Yes, that is exactly what this script does. However, you do not need to specify 2 swords style. The system is smart enough to know that if you equip an ammo you need a weapon to use it and vice versa.
Group: Member
Posts: 52
Type: Event Designer
RM Skill: Beginner
QUOTE (cmpsr2000 @ Aug 28 2008, 12:17 AM)
Yes, that is exactly what this script does. However, you do not need to specify 2 swords style. The system is smart enough to know that if you equip an ammo you need a weapon to use it and vice versa.
I just tried the demo and haven't found a problem yet. Keep it up!
Hey Composer. I must say that was fast in getting a beta-demo up. The script works well in the demo and I haven't noticed any bugs. I'm going to try it on a project with several scripts to see if their is any incompatability. Nice work on the setup it's nice and smooth and makes sense.
A feature I would really like to see is possibly a reload option, where Handgun A for instance can hold 10 rounds and if all 10 rounds are used the user must reload the weapon provided their is sufficient ammo to do so, maybe make it into a skill called 'reload'. I know this would take some editing of the battle menu and such and may cause some incompatibilies but it would be great to see. You could even put shots left/ max shots in the equip menu like the ammo. Like Handgun A 4 / 8.
Another feauture would be a use multiple ammo per attack. For instance Machine Gun A needs to use 5 rounds per attack or if there is say 3 rounds remaining it'll just do 3 shots instead of the 5 for less damage.
I understand these may be a pain or maybe you've already taken these into consideration. Just my two-cents.
Keep up the amazing work that you do.
__________________________
Currently working on:
Underground Syndicate (mafioso/modern type RPG) Mind Maze (old school dungeon crawler with a different feel) Dragon Adventure (Dragon Quest type fangame with more customization) Dark Grind (Survival horror RPG)
Group: Member
Posts: 52
Type: Event Designer
RM Skill: Beginner
Ah, to add to the suggestions, instead of having ammunition that shows how much you have left, I was thinking if there could be an option of having clips/magazines/quivers that have a specific number of ammunition. As the script stands right now, ammo seems like it will run out fast and keeping a healthy supply will be tough without having items that hold multiple shots.
This post has been edited by Rukaroa: Aug 30 2008, 05:23 AM
If you want to use this with the Tankentai SBS, please read this!
Go into your Config script and find these lines which are near the top of the configurations:
CODE
# Damage% modifications when using two weapons # 1st Atk, 2nd Atk TWO_SWORDS_STYLE = [50,100]
Change TWO_SWORD_STYLE to:
CODE
# Damage% modifications when using two weapons # 1st Atk, 2nd Atk TWO_SWORDS_STYLE = [100,50]
The "2nd Atk" variable can be any value you want, just make sure "1st Atk" is 100. To put it simply, the SBS recognizes the Ranged Weapon+Ammo as Two-Swords Style. Thus, the damage from the Ranged weapon will be 50% unless you change the TWO_SWORDS_STYLE "1st Atk" percentage to normal. In my next release, I'll have [100,50] as the default so no confusion happens.
If anyone wants to use the ammo script with Tankentai, please use a specialized ranged attack addon such as Kylock's Bow Addon. If you don't, the actor will walk up to the monster and hit it two times.
Otherwise, everything I've checked works well with the Tankentai SBS. Nice job, cmpsr.
Good deal. I'm glad this is working well for the most part. I am at dragon-con at the moment, but as soon as I return and have a little more time I'll post the new version with all the fixes and some of the mentioned improvements.
I get this error when the game even tries to start:
I copied the three scripts at the end of the demo (Redefinitions, Ammo and Game_Ammo) and also made arrows and a bow at the moment. I haven't made any bullets, grenades or any weapons that need them yet.
Can you help me find what the problem is?
I'll take a look at it today and see if I can replicate the problem.
Just to add, an error will happen when an unarmed character attacks in battle.
@cmpsr2000: AWESOME!!!
Good catch, I'll add a fix for that before publishing the next release candidate. I went ahead and added in the ability to reload, which took more time than I anticipated. I'm troubleshooting an equip-amount error, then I think it will be ready to be posted.
It doesn't want to allow the extra slots to exist. If you make it allow them with edits, it makes the wrong number of ammo display and will let only Two Swords Style actors use ammo. Help, please!
This post has been edited by Shadow Lord: Sep 3 2008, 12:00 PM
It doesn't want to allow the extra slots to exist. If you make it allow them with edits, it makes the wrong number of ammo display and will let only Two Swords Style actors use ammo. Help, please!
The odds of this being compatible with a multi-slot equip script are slim since the code *requires* redefining a Window_Equip method that is also going to be redefined by any multislot system that overwrites the current equip system instead of implementing a completely separate Scene. After a full version of this is released I will attempt to address this problem, but I am fairly confident it would require some code-patching to work.
Also, I'm working on something else that may help the problem, but it's a surprise!