GreyWolfVino

Regular
Regular
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
Regular
Joined
Jul 2, 2014
Messages
12,755
Reaction score
11,371
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

Regular
Regular
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

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

NaosoX

Regular
Regular
Joined
Feb 28, 2013
Messages
696
Reaction score
431
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:

Hank18CL

Warper
Member
Joined
Aug 16, 2018
Messages
4
Reaction score
0
First Language
Spaanish
Primarily Uses
RMMV
Glad to help, friend :sonrisa:



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


Create the Arrow Item
View attachment 208575
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


View attachment 208582

Right-click on potions, then paste it below and rename to Arrow
View attachment 208583

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
View attachment 208577
Add Skill Type Archery
Add Equipment Type Quiver


Create a Quiver Armor
View attachment 208576
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:
View attachment 208578
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
View attachment 208579
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!
View attachment 208581
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
View attachment 208584

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>

<Comandos de batalla>
 Tipo ST: 3
 Tipo ST: 2
 Guardia
 Artículo
</Comandos de batalla>[/CÓDIGO]

<Reemplazar indicador MP: TP>
Esto reemplazará la posición del indicador MP con el indicador TP (MP ya no se usa).
<Reemplazar indicador TP: Flecha>
Esto reemplazará la posición del indicador TP con el recurso Flecha que creamos.
[SPOILER="Reemplazo de calibre"] [ATTACH type="full" alt="Estado de batalla.png"]208587[/ATTACH][/SPOILER]

<Ranuras de equipo>
Arma
Carcaj
Cabeza
Cuerpo
Accesorio
</Equip Slots>
Esto hará que la clase muestre solo estos tipos de equipos en el Menú de equipamiento (en este orden).
[SPOILER="Menú de equipamiento"] [ATTACH type="full" alt="EquipMenu.png"]208588[/ATTACH][/SPOILER]

<Comandos de batalla>
 Tipo ST: 3
 Tipo ST: 2
 Guardia
 Artículo
</Comandos de batalla>
Esto tendrá los comandos de batalla del actor para mostrar solo estas opciones.
SType: 3 es el tipo de habilidad 3 (Tiro con arco) que creamos.
SType: 2 es el tipo de habilidad 2 (Especial) por defecto (usualmente habilidades basadas en TP).

ajusta cualquiera de estos a tu gusto.
*NOTA El ataque básico no puede usar habilidades limitadas (así como otras funciones de complemento).
Puedes configurar la habilidad (que usa usos de habilidad limitados) como un elemento de comando de batalla, pero no puedes manipular los usos correctamente.
Por lo tanto, eliminar Attack por completo y simplemente tener un menú completo de tiro con arco parece la opción más fácil.

[/REVELACIÓN]

[SIZE=18px][B]¡Crea el Actor![/B][/SIZE]
[SPOILER="Crear el actor"][ATTACH type="full" alt="Actor.png"]208586[/ATTACH]
Equipa un arco y el carcaj que hicimos.
[/REVELACIÓN]


**DESCARGO DE RESPONSABILIDAD**
Solo configuré esto de una vez para brindarle un ejemplo de trabajo para jugar.
Tal como está, la configuración funcionará lógicamente; pero los usos de habilidades pueden haber mostrado cargos (ejemplo: 2/6) incluso cuando te quedas sin flechas.
No podrás usar la habilidad si no tienes flechas en tu inventario.
Crear habilidades que brinden múltiples golpes puede causar problemas: tener una habilidad dirigida a 2 enemigos aleatorios y nuestra etiqueta de notas configurada para disminuir los usos (eliminando los "usos" del carcaj de otras habilidades) se activará dos veces mientras que la habilidad utilizada se activa una vez.
Agregar etiquetas de notas para equilibrar los números tiene un error.
Ejemplo: Double Shot ataca a 2 enemigos aleatorios, elimina 1 uso de un solo disparo y 1 de doble disparo (lógico, ¿sí?)
El resultado elimina 2 usos de Single Shot (¡bueno! ya que la etiqueta de nota se llamó dos veces), pero elimina 1 de Double Shot (¡malo!).
Agregar una etiqueta de nota para eliminar un uso adicional de Double Shot da como resultado:
2 usos eliminados de Single Shot y 3 usos eliminados de Double Shot.
Nuestro carcaj ahora está desequilibrado. Es posible que pueda equilibrarlo matemáticamente con diferentes requisitos de flecha, pero eso se lo dejo a usted.


Juega con él para que se adapte a tu juego. ¡Divertirse!
[/QUOTE]
¿Hay alguna manera de asignar municiones específicas al carcaj? Por ejemplo, el personaje puede tener un carcaj para flechas y otro para virotes de ballesta.
 

Latest Threads

Latest Posts

Latest Profile Posts

The X-Mas and ~ all ~ December long Calendar Project seems to bring my machine right to the limit. A very good oportunity to test what my pc can do. Or at which point I should decide to take a step back from filling the rendering program with assets.
The new grafics card and ram do their job well, that's for sure. My own early Christmas gifts were a good investment.
my laptop keyboard gave up, they keep glitching out, it seems like it's time to finally replace them, honestly surprised it lasted this long.
Tiny setback. Turns out my Title Screen image and one of my primary background & avatar images are AI Generated. Glad I went back and checked all my resource links. So I am in hot pursuit of replacement images. Which is fine since I was still missing some images that I need anyway.
Watching Vibrato Chain Battle System is too awesome! watch I wish had this gfx and animation skill to make such game!
Got drawn back by a notification about QPlugins. For those who want the MZ versions I was using, they're on my Github. https://github.com/ImaginaryVillain/QPlugins I literally don't care what you do with them, have fun! :LZSlol:

Meanwhile.. I'm glorying over these 550 new Victorian house models Epic gave me this month. See next post for examples....

Forum statistics

Threads
136,892
Messages
1,271,117
Members
180,670
Latest member
jakkapong
Top