useWeapon
useWeapon
> Functions
Uses the equipped weapon on the entity entity.
Example: using the pistol on the nearest enemy:
Parameters
- entity: The target entity.
Return
- result: A value strictly greater than 0 if the attack was launched. The return values of useWeapon are:
- USE_CRITICAL, on a critical hit
- USE_SUCCESS, on success
- USE_INVALID_TARGET, if the target does not exist
- USE_NOT_ENOUGH_TP, if your entity does not have enough TP
- USE_INVALID_POSITION, if the range is wrong or the line of sight is not clear
- USE_MAX_USES, if the weapon has already been used too many times this turn.
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:
See also