W
Wild_West
Guest
I made an easy script for my chess game, that lets the pieces equip the weapons they can use for attacking the enemy side.
It works fine just for some reason not on the back pieces, only white.
The script doesn't name either side specifically, and both the white and black piece parent objects are using the script exactly the same way. If there's a deviation I can't see it.
The image illustrates what I mean :
The glowing symbol just shows that it's waiting to be equipped, and the one under the knight piece is equipped, and will move everywhere the knight does until it's either destroyed or lost from an in-game effect.
As I said I can't replicate this with the black pieces.
The weapon symbols are equipped after selection by pressing right on the mouse.
In the right mouse button for the black game piece parent
This isn't really important it just tells the weapon to move to the selected piece's X and Y to trigge the equipping script.
The script to equip the weapon
It works fine just for some reason not on the back pieces, only white.
The script doesn't name either side specifically, and both the white and black piece parent objects are using the script exactly the same way. If there's a deviation I can't see it.
The image illustrates what I mean :
As I said I can't replicate this with the black pieces.
The weapon symbols are equipped after selection by pressing right on the mouse.
In the right mouse button for the black game piece parent
Code:
///equip weapon
switch(object_index)
{
case black_bishop_obj : equip(axe_weapon_obj, black_bishop_obj);
equip(spear_weapon_obj, black_bishop_obj);
equip(wand_weapon_obj, black_bishop_obj);
break;
case black_queen_obj : equip(axe_weapon_obj, black_queen_obj);
equip(spear_weapon_obj, black_queen_obj);
equip(wand_weapon_obj, black_queen_obj);
break;
}
This isn't really important it just tells the weapon to move to the selected piece's X and Y to trigge the equipping script.
Code:
///equip(weapon, piece);
]if(argument0.image_speed > 0)
{
with(argument1)
{
argument0.x = argument1.x;
argument0.y = argument1.y;
}
}
The script to equip the weapon
Code:
///equip_to(piece);
if( place_meeting(x,y,argument0))
{
image_speed = 0;
image_index = 0;
target = argument0;
target.is_equipped = true;
target.equipment = name;
target.IN_plv = plv_bonus;
}
//stay at x and y start if no piece has been selected yet
if(target != noone)
{
x = target.x;
y = target.y;
}