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 Profile Posts

finally redesigned one of the major antagonist of my game, Pro... aka Prometheus.
Well, I've decided I'll take a break on making Forgotten Eclipse...and Make a mod for FNF
Trailer for my new game.
last one for a while

Forum statistics

Threads
110,314
Messages
1,052,256
Members
143,348
Latest member
AlbertNeko
Top