Category: Objects
Since engine version: 5.1 OC
var index = 0, weapon_def, weapon_list = [];
while (weapon_def = GetDefinition(index))
{
if (weapon_def->~IsWeapon())
weapon_list[GetLength(weapon_list)] = weapon_def;
index++;
}
var spawn_weapon = weapon_list[Random(GetLength(weapon_list))];
CreateObject(spawn_weapon,AbsX(Random(LandscapeWidth())),0);
true on call of the function "IsWeapon" are put into an array. After that, a random item of these defintions is selected to spawn at a random position in the landscape.