Changing Actor Position

This is probably a simple Javascript goof, but I'm not well versed in the language.


I'm trying to change the Actors' formation on the battle screen to a diamond shape. I managed to track down the subroutine that controls that, and noticed that it's a pair of equations that control their X and Y positioning based on the actor's position index.


Sprite_Actor.prototype.setActorHome = function(index) {
this.setHome(600 + index * 32, 280 + index * 48);
};


To get the shape I wanted, I opted to use an if statement based on that index value.


Sprite_Actor.prototype.setActorHome = function(index) {
if (index = 1) {
this.setHome(500, 300);
} else if (index = 2) {
this.setHome(500, 450);
} else if (index = 3) {
this.setHome(400, 350);
} else {
this.setHome(600, 450);
};
};


For some reason, whenever I run this script in a battle test, all four actors and standing on top of each other in the same spot. I'm not sure why this is. Will an if statement just not work in this context due to some quirk of js? And I just doing it wrong? What would be a better way to do this?
I've moved this thread to Javascript/Plugin Support . Please be sure to post your threads in the correct forum next time. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/changing-actor-position.64601/