Status
Not open for further replies.

Wisshy

Villager
Member
Joined
Jan 16, 2019
Messages
9
Reaction score
0
First Language
Português
Primarily Uses
RMMV
Hi. I would like to make an ability where the damage is increased if the user has no armor equipped. The damage formula is as follows: if has no armor equipped, the damage would be 110 + a.atk * 2 - b.def * 2.
If the user is using an armor, that damage formula would be 55 + a.atk * 2 - b. def * 2


How could I make it?
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
600
First Language
Italian
Primarily Uses
RMVXA
By "armor" do you mean specifically chest armor or are helms/accessories also included?
 

Wisshy

Villager
Member
Joined
Jan 16, 2019
Messages
9
Reaction score
0
First Language
Português
Primarily Uses
RMMV
By "armor" do you mean specifically chest armor or are helms/accessories also included?
Yeah. All kind of armor included. I'm making a game where the armor is a special kind of item that The actor (or enemy) can have. Like special gems. And this ability I am making is stronger when the user has no equipment.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
600
First Language
Italian
Primarily Uses
RMVXA
If that is the case, you can use this formula:
Code:
wa = a.equips.any? { |e| e.is_a?(RPG::Armor) }; a.atk * 2 - b.def * 2 + (wa ? 55 : 110)

I am not sure whether or not it fits because VX Ace formula box is very small, but it is not so long so I am quite positive.
 

Wisshy

Villager
Member
Joined
Jan 16, 2019
Messages
9
Reaction score
0
First Language
Português
Primarily Uses
RMMV
That worked perfectly well. Thanks. I could have never had imagine to put something like that.
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
689
Reaction score
448
First Language
English
Primarily Uses
RMVXA
@Heirukichi You could also do the following to save space:
Code:
wa = a.armors.any?; a.atk * 2 - b.def * 2 + (wa ? 55 : 110)
or:
Code:
a.atk * 2 - b.def * 2 + (a.armors.any? ? 55 : 110)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,731
First Language
English
Primarily Uses
RMVXA
@Wisshy
If your query is fully resolved, please Report your post and ask for the thread to be closed. Mods might not see a post, but they will see a Report.
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Finally started working on Grim Trigger episode 2 today :LZScat: it's half comic/half visual novel!

GfY3Rwj.png
Is it interesting to get more backstory on villains? A key moment in their past, their childhood, or maybe something that shows they've always been that way? To see or not to see?
"Everything tastes like chicken until it's chicken, then it doesn't taste like chicken."
Context: chicken samosas do not taste like chicken. I thought it was veggie samosas.
Just another ordinary evening.
This pig girl is a merchant and playable character.
Currently there's no name for her yet. a suggestion is welcomed.
Merchant.jpg
Merchant-1.jpg
Want for a Nail: I'm trying to figure out what controllers work with MZ, one support thread, a plugin request thread, a dead controller, and a $48 eBay purchase, and a PS1/PS2 USB adapter later. Still stuck with keyboard controls...

Forum statistics

Threads
110,353
Messages
1,052,586
Members
143,394
Latest member
flopinou74
Top