So I want to make a parallel common event to activate a State if the actor doesn't wear any armor Id 2 and 3.
Check if Actor is wearing any armor
RPG Maker MZ SupportWelcome!
In the JavaScript Support forum, there's a pinned thread with simple script calls listed.
Because MV and MZ have been out for years now, you can also find pretty much any simple question with a Google. I Googled "RPG Maker script call equipped slot" and the first hit has:
and the syntax to check for two things to be true is &&.
So you'd do a Conditional Branch -> Script:
replacing the "actor ID" in both places. No leading zeros.
In the JavaScript Support forum, there's a pinned thread with simple script calls listed.
Because MV and MZ have been out for years now, you can also find pretty much any simple question with a Google. I Googled "RPG Maker script call equipped slot" and the first hit has:
Code:
$gameActors.actor(actor ID).equips()[armor type ID]
and the syntax to check for two things to be true is &&.
So you'd do a Conditional Branch -> Script:
Code:
$gameActors.actor(actor ID).equips()[2] && $gameActors.actor(actor ID).equips()[3]
Personally I don't like using parallel process for infrequent checks like this. I mean, you probably only need to do it once when you exit the menu.
Something you might consider is modifying the functions in rmmz_scenes.js
It's like a one line addition to executeEquipChange to add or remove a status based on the actor's equipment. The change would happen without leaving the menu. No common event required.
You could also stick $gameTemp.reserveCommonEvent(ID) at the end of the map scene start() function. So when you return to a map from the menu the common event will automatically run once. No switches or conditions required.
Something you might consider is modifying the functions in rmmz_scenes.js
It's like a one line addition to executeEquipChange to add or remove a status based on the actor's equipment. The change would happen without leaving the menu. No common event required.
You could also stick $gameTemp.reserveCommonEvent(ID) at the end of the map scene start() function. So when you return to a map from the menu the common event will automatically run once. No switches or conditions required.
oh great this worked flawlessly , thank you !
I will look into that, I am brand new to RPG maker and javascript, so I'm currently on a learning process.
Does having a lot of common events lag the game ?
In this exact example I did a wait for 10 frames to refresh status
No. Having a lot of parallel/autorun events running more frequently than they need to can create lag.
That wouldn't create any performance impact. Another way you could implement this is with passive states.
Original thread: https://forums.rpgmakerweb.com/threads/check-if-actor-is-wearing-any-armor.156386/