MZ Is there any way to get the array of armor ids for Player 1's equipment?

  • That's the problem I've had so far
    • I'm not proficient in scripting
Yes.

Edit: Okay that's long enough for the joke.

JavaScript:
$gameParty.leader().armors().map(armor => armor.id)
Yes.

Edit: Okay that's long enough for the joke.

JavaScript:
$gameParty.leader().armors().map(armor => armor.id)
Thank you very much.
  • The perfect solution to my problem
Yes.

Edit: Okay that's long enough for the joke.

JavaScript:
$gameParty.leader().armors().map(armor => armor.id)
  • hi
  • I found that he doesn't get duplicate array of armor ids
  • hi
  • I found that he doesn't get duplicate array of armor ids
I'm not sure what you mean by that.
I'm not sure what you mean by that.
  • Let's say I have two identical armor with ID 1
  • He only got one [1]
  • Sorry, my English is not good
  • Let's say I have two identical armor with ID 1
  • He only got one [1]
  • Sorry, my English is not good
Ah, so you don't want duplicates?
Ah, so you don't want duplicates?
no,I want all of them
Ah, so you don't want duplicates?
sorry
  • It was my mistake
  • It's ok now
  • 我有一个新问题
  • 从数组[1,1,2, 3]中删除1
  • 让它产生[1,2, 3]
  • 我有一个新问题
  • 从数组[1,1,2, 3]中删除1
  • 让它产生[1,2, 3]
If you want to remove duplicates you can do

[...new Set([1, 1, 2, 3])];
If you want to remove duplicates you can do

[...new Set([1, 1, 2, 3])];
  • The situation is this
  • In my game
  • Variable 1 is an array
  • The variable 3 is a possible duplicate value in the array
  • I want to remove one variable 3 from variable 1, not all of variable 3
You can use the .remove function for that:

[1, 1, 2, 2, 3, 3].remove(2) = [1, 1, 2, 3, 3]
You can use the .remove function for that:

[1, 1, 2, 2, 3, 3].remove(2) = [1, 1, 2, 3, 3]
I don't get it.
  • He deleted all the variables 3
  • QQ截图20230109113943.png

Original thread: https://forums.rpgmakerweb.com/threads/is-there-any-way-to-get-the-array-of-armor-ids-for-player-1s-equipment.153849/