Script: check if the actor is equipped with a weapon

Status
Not open for further replies.

Nacura

Veteran
Veteran
Joined
Feb 4, 2018
Messages
125
Reaction score
14
First Language
Español
Primarily Uses
RMMV
Hello

I need help, I am creating a verification script, where I verify if the actor or group is equipping a weapon, I leave below the script I have.

Code:
$gameActors(1).equips(0).nil?
Greetings and thanks
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
512
Reaction score
238
First Language
German
Primarily Uses
RMMV
use f8 in game (the console) and write :
$gameActors
(+ use enter)
than you can find all related data which is in your project
Screenshot_1.png
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
You could try this:
JavaScript:
$gameActors.actor(1).weapons().length
It will be truthy if actor ID 1 has at least 1 weapon, else falsy.
It can be used in Conditional Branch > Script, or an if statement in a script call or plugin.
 

Nacura

Veteran
Veteran
Joined
Feb 4, 2018
Messages
125
Reaction score
14
First Language
Español
Primarily Uses
RMMV
You could try this:
JavaScript:
$gameActors.actor(1).weapons().length
It will be truthy if actor ID 1 has at least 1 weapon, else falsy.
It can be used in Conditional Branch > Script, or an if statement in a script call or plugin.
Yes it worked for me, thank you very much!

this code also works
Code:
$gameParty.leader().weapons().length
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
Yes it worked for me, thank you very much!

this code also works
Code:
$gameParty.leader().weapons().length
Note that this checks the equips of the party leader, who might not necessarily be actor ID 1. Depends what you're going for, how the player is allowed to rearrange the party, etc. :)

Good to hear you got it working, though! Happy RPG Making~ :kaojoy:
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,829
Reaction score
5,221
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,848
Messages
1,016,974
Members
137,562
Latest member
visploo100
Top