useWeaponOnCell

useWeaponOnCell

> Functions

Uses the equipped weapon on the cell cell.

Example: using the pistol on the nearest enemy:

var enemyCell = getCell(getNearestEnemy())
setWeapon(WEAPON_PISTOL)
useWeaponOnCell(enemyCell)
const enemyCell = Fight.getNearestEnemy().cell
Fight.me.setWeapon(Weapon.pistol)
Fight.me.useWeaponOnCell(enemyCell)
enemyCell = Fight.getNearestEnemy().cell
Fight.me.setWeapon(Weapon.pistol)
Fight.me.useWeaponOnCell(enemyCell)
Parameters
Return

Since USE_SUCCESS and USE_CRITICAL are 1 and 2 respectively, and the other values are 0 or negative, you can tell whether the weapon was used successfully with this test:

if (useWeaponOnCell(cell) > 0) {
	// It worked!
} else {
	// It failed!
}
if (Fight.me.useWeaponOnCell(cell) > 0) {
	// It worked!
} else {
	// It failed!
}
if Fight.me.useWeaponOnCell(cell) > 0:
	pass  # It worked!
else:
	pass  # It failed!
See also