Weapon reference in formula box

kaukusaki

Awesome Programmer Extraordinaire
Veteran
Joined
Jun 27, 2013
Messages
707
Reaction score
529
First Language
English
Primarily Uses
RMVXA
I've searched the forms for 2 hours and can't find the answer to what I'm looking for.
Basically I want to force a skill used if equipped with a certain weapon otherwise it's a standard attack.
I've tried a.weapons[N]; a.force_action(n, -2): a.atk but it errors out.
My Ruby coding isn't the best and maybe I'm just sleepy. What am I doing wrong?
Thanks in advance
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,248
Reaction score
1,250
First Language
Spanish
Primarily Uses
RMVXA
Code:
a.equip_slots[slot]  #returns type of item

or

a.weapons[index] #returns item object
all items equipped by an actor are grouped under @equips.
actor.weapons returns @equips.select{|item| item.is_weapon?}
check actor.equip_slots, actor.equips and actor.change_equip, you can probably follow the code from there.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Code:
a.weapons[0].id == weapon_id
You can use this as well

Edit: It may return an error if your character does not equip any weapon though
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,096
Members
137,587
Latest member
Usagiis
Top