MV Need help with a script

I don't really have any knowledge with JS but I'm tryna make an actor who uses this skill get a weapon,
this is the script call I used in a common event but its not working.

$gameActors.actor($gameVariables.value(1)).forceChangeEquip(0, $dataWeapons[10]);
The script call looks OK to me. Ideas:
  1. Maybe the variable is not the value you think it is, so it's affecting a different actor. You can test by adding a Show Text command immediately before the script call, e.g.

    ◆Text:None, Window, Bottom : :TEST! Variable 1 is \v[1].

  2. Maybe the actor is correct, but they cannot use that weapon type. They'll need an Equip Weapon trait matching the weapon's type.
I'm not 100% certain on this, but force change equip only works if you have whatever weapon you want to force equip in your inventory if I remember correctly. I had a similar issue back in the day but the memory is foggy.
The script call looks OK to me. Ideas:
  1. Maybe the variable is not the value you think it is, so it's affecting a different actor. You can test by adding a Show Text command immediately before the script call, e.g.

    ◆Text:None, Window, Bottom : :TEST! Variable 1 is \v[1].


  2. Maybe the actor is correct, but they cannot use that weapon type. They'll need an Equip Weapon trait matching the weapon's type.
yeah the variable value wasn't what I thought it was, i was able to fix it thank you
I'm not 100% certain on this, but force change equip only works if you have whatever weapon you want to force equip in your inventory if I remember correctly.
forceChangeEquip skips that check, you may be thinking of changeEquip.
yeah the variable value wasn't what I thought it was, i was able to fix it thank you
Great, you're welcome! 👋

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-a-script.149258/