GreyWolfVino

Veteran
Veteran
Joined
Apr 12, 2018
Messages
31
Reaction score
3
First Language
English
Primarily Uses
RMMZ
Hey fellow game makers. I have an idea that I want to implement for RPG Maker MZ, but I am having difficulty proceeding. I have an archer actor in my game, and after watching the first three episodes of Marvel's Hawkeye, I wanted to implement an arrow system. So the bow is the weapon, but I want to create an arrow system that keeps track of how many arrows the archer has remaining internally and when the arrows run out. You would have to use a reload skill to get your arrows back.
For example:
Let's the archer at level 5 has access to 10 arrows
Attack (command) = 1 arrow used
Double Shot (skill) = 2 arrows used

Until the actor runs out of arrows, then they will have to use Reload (skill) to get their 10 arrows back
I am trying to add a bit of strategy and nuance to the archer actor and not feel like a warrior or a knight.
I also wanted to add a subsystem with Quivers. Quivers would be equipment that determines how many arrows the archer has to use.
For example:
Basic Quiver (equipment) = 6 total arrows
Stealth Quiver (equipment) = 4 total arrows
War Quiver (equipment) = 36 total arrows
If anyone could provide any suggestions, ideas, or anything, that would be greatly appreciated! I really appreciate any help you can provide.
Hawkeye.png
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,165
Reaction score
1,869
First Language
English
Primarily Uses
RMMV
So my best suggestion is a combination of Yanfly plugins. They're not free, but they should be able to do exactly what you want (and will come bundled with other stuff).

For a limited number of times you can use a given arrow type, then need to reload, there's Limited Skill Uses:

Then to change which arrows are in your quiver, there's Equip Battle Skills:

The latter has notetags you can put on your quiver items to set how many slots are available to equip your arrow skills.

Edit: I just noticed that you posted this in the MZ forum. I answered with MV plugins because your profile says you use MV...if you can clarify which engine you want this for, it might change the answers a bit. I dunno if there are equivalents for those plugins in MZ yet.
 

GreyWolfVino

Veteran
Veteran
Joined
Apr 12, 2018
Messages
31
Reaction score
3
First Language
English
Primarily Uses
RMMZ
So my best suggestion is a combination of Yanfly plugins. They're not free, but they should be able to do exactly what you want (and will come bundled with other stuff).

For a limited number of times you can use a given arrow type, then need to reload, there's Limited Skill Uses:

Then to change which arrows are in your quiver, there's Equip Battle Skills:

The latter has notetags you can put on your quiver items to set how many slots are available to equip your arrow skills.

Edit: I just noticed that you posted this in the MZ forum. I answered with MV plugins because your profile says you use MV...if you can clarify which engine you want this for, it might change the answers a bit. I dunno if there are equivalents for those plugins in MZ yet.
Thank you so much for trying to help and I'm sorry I did not clarify that I meant MZ. I don't know how to change my profile to say I use RMMZ now but I just changed it. Sorry for the confusion. I really do appreciate you trying to help.
 

GreyWolfVino

Veteran
Veteran
Joined
Apr 12, 2018
Messages
31
Reaction score
3
First Language
English
Primarily Uses
RMMZ

NaosoX

Veteran
Veteran
Joined
Feb 28, 2013
Messages
357
Reaction score
187
First Language
English
Primarily Uses
RMMZ
Glad to help, friend :smile:


Here's a setup to get you started.
Sample made using Visustella Sample Project


Create the Arrow Item
ItemArrow.png
Set Scope to None
Set Occasion Never
Add notetag:
Code:
<Max: 999>
Change this number to however many max Arrows you want to be able to have in party inventory.

Create Arrow Resource
Open Plugin Manager and double-click on VisuMZ_1_SkillsStatesCore > Skill Cost Types


SSCore.png

Right-click on potions, then paste it below and rename to Arrow
SkillCostType.png

Double-click Cost Calculation
Rename every instance of
Code:
POTION
to
Code:
ARROW
Code:
// Declare Variables
const user = this;
const skill = arguments[0];
let cost = 0;

// Calculations
const note = skill.note;
if (note.match(/<ARROW COST:[ ](\d+)>/i)) {
    cost += Number(RegExp.$1);
}
if (note.match(/<JS ARROW COST>\s*([\s\S]*)\s*<\/JS ARROW COST>/i)) {
    const code = String(RegExp.$1);
    eval(code);
}

// Apply Trait Cost Alterations
if (cost > 0) {
    const rateNote = /<ARROW COST:[ ](\d+\.?\d*)([%%])>/i;
    const rates = user.traitObjects().map((obj) => (obj && obj.note.match(rateNote) ? Number(RegExp.$1) / 100 : 1));
    const flatNote = /<ARROW COST:[ ]([\+\-]\d+)>/i;
    const flats = user.traitObjects().map((obj) => (obj && obj.note.match(flatNote) ? Number(RegExp.$1) : 0));
    cost = rates.reduce((r, rate) => r * rate, cost);
    cost = flats.reduce((r, flat) => r + flat, cost);
    cost = Math.max(1, cost);
}

// Set Cost Limits
if (note.match(/<ARROW COST MAX:[ ](\d+)>/i)) {
    cost = Math.min(cost, Number(RegExp.$1));
}
if (note.match(/<ARROW COST MIN:[ ](\d+)>/i)) {
    cost = Math.max(cost, Number(RegExp.$1));
}

// Return cost value
return Math.round(Math.max(0, cost));

Double-click on each following section and change every instance of
Code:
$dataItems[7]
to
Code:
$dataItems[38]
This number will refer to the Arrow Item we created. Be sure it matches your Item Database number.

Add new Database Types
DatabaseTypes.png
Add Skill Type Archery
Add Equipment Type Quiver


Create a Quiver Armor
ArmorQuiver.png
Set Armor Type to General Armor
Set Equipment Type to Quiver
Add notetag:
Code:
<Global Use Max: +6>
Set the number to however many you like. (spaces for arrows in quiver)

Create Skills!
Single Shot:
SingleShot.png
Set Skill Type to Archery
Add notetags:
Code:
<Arrow Cost: 1>
<Limited Uses: 0>
<User Skill 242 Uses: -1>
<Bypass Recover All Uses>

<Victory Uses Recover: 0>
<Escape Uses Recover: 0>
<Defeat Uses Recover: 0>
<After Battle Uses Recover: 0>

<Limited Uses: 0>
The skill starts with 0 uses, the equipped quiver will increase the max uses.
When using this skill:
<Arrow Cost: 1>
1 Arrow will be consumed.
<User Skill 242 Uses: -1>
Double Shot Skill will lose 1 use(to align with this skill having consumed 1 Arrow and 1 quiver use).
<Bypass Recover All Uses>
Recover All Skills or Items wont refresh the uses here.

<Victory Uses Recover: 0>
<Escape Uses Recover: 0>
<Defeat Uses Recover: 0>
<After Battle Uses Recover: 0>
No use recovery under these conditions.
(you can also set default settings in the plugin, but doing it by notetag will override the default, and still let others use those settings)

Double Shot
DoubleShot.png
Set Skill Type to Archery
Add notetags:

Code:
<Arrow Cost: 2>
<Limited Uses: 0>
<User Skill 241 Uses: -2>
<User Skill 242 Uses: -1>
<Bypass Recover All Uses>

<Victory Uses Recover: 0>
<Escape Uses Recover: 0>
<Defeat Uses Recover: 0>
<After Battle Uses Recover: 0>

<Limited Uses: 0>
The skill starts with 0 uses, the equipped quiver will increase the max uses.
When using this skill:
<Arrow Cost: 2>
2 Arrows will be consumed.
<User Skill 241 Uses: -2>
<User Skill 242 Uses: -1>
Single Shot Skill will lose 2 use(to align with this skill having consumed 2 arrows and 2 quiver uses).
Double Shot will lose 1 use(to align with this skill having consumed 2 arrows and 2 quiver uses(default use + 1)).
<Bypass Recover All Uses>
Recover All Skills or Items wont refresh the uses here.

<Victory Uses Recover: 0>
<Escape Uses Recover: 0>
<Defeat Uses Recover: 0>
<After Battle Uses Recover: 0>
No use recovery under these conditions.
(you can also set default settings in the plugin, but doing it by notetag will override the default, and still let others use those settings)

Reload!
Reload.png
Set Skill Type to Archery
Set Scope to User
Add notetag:
Code:
<User Global Uses: +99>
Set this number to whatever you like.
It will refill the Quiver availability up to this amount.


Create Archer Class

ArcherClass.png

Will use the pre-existing Hunter class in this sample.

Add Trait Skill Type Archery
Add the skills we made
Add notetags:
Code:
<Replace MP Gauge: TP>
<Replace TP Gauge: Arrow>

<Equip Slots>
Weapon
Quiver
Head
Body
Accessory
</Equip Slots>

<Battle Commands>
 SType: 3
 SType: 2
 Guard
 Item
</Battle Commands>

<Replace MP Gauge: TP>
This will replace the MP gauge position with the TP gauge(MP no longer used).
<Replace TP Gauge: Arrow>
This will replace the TP gauge position with the Arrow resource we created.
BattleStatus.png

<Equip Slots>
Weapon
Quiver
Head
Body
Accessory
</Equip Slots>
This will have the class show only these equipment types in the Equip Menu(in this order).
EquipMenu.png

<Battle Commands>
SType: 3
SType: 2
Guard
Item
</Battle Commands>
This will have the actor's battle commands to show only these choices.
SType: 3 is skill type 3(Archery) that we created.
SType: 2 is skill type 2(Special) as default(usually TP based skills).

adjust any of these to however you like.
*NOTE basic Attack cannot use limited skill uses(as well as other plugin functions).
You can set the skill(which uses limited skill uses) as a battle command item, but cant manipulate the uses properly.
So, removing Attack completely and just having an all-around Archery menu seems the easiest option.

Create the Actor!
Actor.png
Equip a bow and the quiver we made.


**DISCLAIMER**
I've only set this up in one go to provide you a working example to play off of.
As is, the setup will function logically; but Skill Uses may have displayed charges(example: 2/6) even when you run out of arrows.
You will not be able to use the skill if you have no arrows in your inventory.
Creating skills which provide multiple hits may cause issues: having a skill target 2 random enemies and our notetag set to decrease uses(removing quiver "uses" from other skills) will trigger twice while the used skill triggers once.
Adding notetags to balance the numbers has a bug.
Example: Double Shot attacks 2 random enemies, removes 1 use from single shot, and 1 from double shot(Logical, yes?)
The result removes 2 uses from Single Shot(good! as the notetag was called twice), but removes 1 from Double Shot(bad!).
Adding a notetag to remove an extra use from Double Shot results in:
2 uses removed from Single Shot, and 3 uses removed from Double Shot.
Our quiver is now unbalanced. You may be able to balance it mathematically with different arrow requirements, but I'll leave that to you.


Play around with it to suit you game. Have fun!
 
Last edited:

Latest Threads

Latest Profile Posts

My entire family and I have Covid... If it's this bad with the vaccine, without must be terrible. Stay safe, everyone. This thing is a doozy.
Ugh. Head heavy with sick juice. I wish I could work on my stuff. o_O
GZZPUeX.png

Overflow Form
I'm coming back to my work with Learn RPG Maker MV. Soon I'll be posting previews screenshots for my "paterons"! :guffaw:

Forum statistics

Threads
118,520
Messages
1,116,602
Members
155,534
Latest member
aubycringe
Top