Meteor 2 Scripting Functions
Weapon
int getWeapon(int objectID)
Get the specified object current weapon slot index.
print(getWeapon(PLAYER_OBJECT));
If the object was not found -1 is returned.
void setWeapon(int objectID, int slotIndex)
Set the specified object current weapon slot index (local player or server only).
setWeapon(PLAYER_OBJECT, 2);
void clampWeapon(int objectID)
Clamp an object's current weapon index to a valid (and owned for players) weapon slot (local player or server only).
giveItem(getLocalPlayer(), "PDW", -1);
clampWeapon(PLAYER_OBJECT);
Use this function to ensure an object's current weapon is valid, especially after removing player weapons.
bool hasWeapon(int objectID, weaponItemName string)
Determine if an object has a specific weapon.
print("Player has PDW: " + hasWeapon(PLAYER_OBJECT, "PDW"));
This function is normally used for player objects.
int getWeaponSlotItemNumber(int objectID, int slotIndex)
Get the item type index for an object weapon slot.
print(getWeaponSlotItemNumber(PLAYER_OBJECT, 0));
Returns -1 if the object or slot is invalid.
string getWeaponSlotItemName(int objectID, int slotIndex)
Get the item type name for a player weapon slot.
print(getWeaponSlotItemName(PLAYER_OBJECT, 0));
Returns empty string if the object or slot is invalid.
int getWeaponSlotsCount(int objectID)
Get the number of weapon slots an object has.
print("Player has " + getWeaponSlotsCount(PLAYER_OBJECT) + " weapon slots");
for(int i=0; i<getWeaponSlotsCount(PLAYER_OBJECT); i++)
{
print(i + ": " + getWeaponSlotItemName(PLAYER_OBJECT, i));
}
bool getAutoWeaponSwitchingEnabled(int objectID)
Determine if auto weapon switching is enabled for an object.
print(getAutoWeaponSwitchingEnabled(1));
void setAutoWeaponSwitchingEnabled(int objectID, bool enable)
Enable or disable auto weapon switching for an object.
if(isServer())
{
setAutoWeaponSwitchingEnabled(1, false);
}
Server only.
Non player objects periodically switch between weapon mounts if the mounts are not linked. Use this function to enable or disable this behaviour.
Index
Generated on the 24 June 2024 at 06:55:38 (UK Time)