----------------------------------------------------------------------------------------------------------------------------------------
IdleHunt = function(unit)
	if (unit.Type == "waypointdelivery.jeep" or unit.Type == "waypointdelivery.reconjeep" or unit.Type == "waypointdelivery.apctower" or unit.Type == "waypointdelivery.1tnk" or unit.Type == "waypointdelivery.2tnk" or unit.Type == "waypointdelivery.3tnk" or unit.Type == "waypointdelivery.4tnk" or unit.Type == "waypointdelivery.stnk" or unit.Type == "waypointdelivery.raytnk" or unit.Type == "waypointdelivery.vettnk" or unit.Type == "waypointdelivery.ctnk" or unit.Type == "waypointdelivery.latnk" or unit.Type == "waypointdelivery.ftnk" or unit.Type == "waypointdelivery.totnk" or unit.Type == "waypointdelivery.ttnk" or unit.Type == "waypointdelivery.ntnk" or unit.Type == "waypointdelivery.mcv")then
	else
		unit.GrantUpgrade("nocontrol")
		unit.GrantUpgrade("autocontrol")
		unit.GrantUpgrade("wandering")
		unit.Stance = "AttackAnything"
	end
	Trigger.OnIdle(unit, function(unit)
		if not unit.IsDead and unit.IsInWorld then
			unit.Hunt()
		end
	end)
end
----------------------------------------------------------------------------------------------------------------------------------------
BindActorTriggers = function(a)
	if (a.Type == "waypointdelivery.jeep" or a.Type == "waypointdelivery.reconjeep" or a.Type == "waypointdelivery.apctower" or a.Type == "waypointdelivery.1tnk" or a.Type == "waypointdelivery.2tnk" or a.Type == "waypointdelivery.3tnk" or a.Type == "waypointdelivery.4tnk" or a.Type == "waypointdelivery.stnk" or a.Type == "waypointdelivery.raytnk" or a.Type == "waypointdelivery.vettnk" or a.Type == "waypointdelivery.ctnk" or a.Type == "waypointdelivery.latnk" or a.Type == "waypointdelivery.ftnk" or a.Type == "waypointdelivery.totnk" or a.Type == "waypointdelivery.ttnk" or a.Type == "waypointdelivery.ntnk" or a.Type == "waypointdelivery.mcv") then
	else
		if a.HasProperty("Hunt") then
			if a.Owner == creeps or a.Owner == ants or a.Owner == dinosaurs or a.Owner == aliens then
				Trigger.OnIdle(a, function(a)
					if a.IsInWorld and not a.IsDead then
						a.GrantUpgrade("nocontrol")
						a.GrantUpgrade("autocontrol")
						a.GrantUpgrade("wandering")
						a.Stance = "AttackAnything"
						a.Hunt()
					end
				end)
			elseif a.Owner == allies or a.Owner == england or a.Owner == france or a.Owner == germany then
				Trigger.OnIdle(a, function(a)
					if a.IsInWorld and not a.IsDead then
						a.GrantUpgrade("nocontrol")
						a.GrantUpgrade("autocontrol")
						a.GrantUpgrade("wandering")
						a.Stance = "AttackAnything"
						a.Hunt()
					end
				end)
			elseif a.Owner == ussr or a.Owner == russia or a.Owner == ukraine or a.Owner == china then
				Trigger.OnIdle(a, function(a)
					if a.IsInWorld and not a.IsDead then
						a.GrantUpgrade("nocontrol")
						a.GrantUpgrade("autocontrol")
						a.GrantUpgrade("wandering")
						a.Stance = "AttackAnything"
						a.Hunt()
					end
				end)
			elseif a.Owner == neutral then
				if a.Type == "trctr1" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				elseif a.Type == "trctr2" or a.Type == "trctr3" or a.Type == "trctr4" or a.Type == "trctr5" or a.Type == "trctr6" or a.Type == "trctr7" or a.Type == "trctr8" or a.Type == "trctr9" or a.Type == "trctr10" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				else
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.GrantUpgrade("autocontrol")
							a.Stance = "HoldFire"
							a.Hunt()
						end
					end)
				end
			elseif a.Owner == neutral0 then
				if a.Type == "trctr1" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				elseif a.Type == "trctr2" or a.Type == "trctr3" or a.Type == "trctr4" or a.Type == "trctr5" or a.Type == "trctr6" or a.Type == "trctr7" or a.Type == "trctr8" or a.Type == "trctr9" or a.Type == "trctr10" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				else
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.GrantUpgrade("autocontrol")
							a.Stance = "HoldFire"
							a.Hunt()
						end
					end)
				end
			elseif a.Owner == neutral1 then
				if a.Type == "trctr1" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				elseif a.Type == "trctr2" or a.Type == "trctr3" or a.Type == "trctr4" or a.Type == "trctr5" or a.Type == "trctr6" or a.Type == "trctr7" or a.Type == "trctr8" or a.Type == "trctr9" or a.Type == "trctr10" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				else
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.GrantUpgrade("autocontrol")
							a.Stance = "HoldFire"
							a.Hunt()
						end
					end)
				end
			elseif a.Owner == neutral2 then
				if a.Type == "trctr1" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				elseif a.Type == "trctr2" or a.Type == "trctr3" or a.Type == "trctr4" or a.Type == "trctr5" or a.Type == "trctr6" or a.Type == "trctr7" or a.Type == "trctr8" or a.Type == "trctr9" or a.Type == "trctr10" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				else
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.GrantUpgrade("autocontrol")
							a.Stance = "HoldFire"
							a.Hunt()
						end
					end)
				end
			elseif a.Owner == neutral3 then
				if a.Type == "trctr1" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				elseif a.Type == "trctr2" or a.Type == "trctr3" or a.Type == "trctr4" or a.Type == "trctr5" or a.Type == "trctr6" or a.Type == "trctr7" or a.Type == "trctr8" or a.Type == "trctr9" or a.Type == "trctr10" then
					local CivilianCraneVehicleExit = Utils.Random({ RandomEdgeRoadWaypoint, RandomEdgeRoadWaypoint01, RandomEdgeRoadWaypoint02, RandomEdgeRoadWaypoint03, RandomEdgeRoadWaypoint04 })
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.Stance = "HoldFire"
							a.Move(CivilianCraneVehicleExit.Location)
						end
					end)
					Trigger.OnEnteredFootprint({ CivilianCraneVehicleExit.Location }, function(b, id)
						if b.Owner == a.Owner and b.Type == a.Type and b == a then
							b.Destroy()
							Trigger.RemoveFootprintTrigger(id)
						end
					end)
				else
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.GrantUpgrade("autocontrol")
							a.Stance = "HoldFire"
							a.Hunt()
						end
					end)
				end
			elseif a.Owner == un or a.Owner == gdi then
				Trigger.OnIdle(a, function(a)
					if a.IsInWorld and not a.IsDead then
						a.GrantUpgrade("nocontrol")
						a.GrantUpgrade("autocontrol")
						a.GrantUpgrade("wandering")
						a.Stance = "AttackAnything"
						a.Hunt()
					end
				end)
			elseif a.Owner == nod or a.Owner == isis then
				if a.Type == "terrorist" then
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.DisguiseAsType("c" .. Utils.RandomInteger(1, 10), neutral)
--							a.Move(SpyWaypoint.Location)
--							a.Infiltrate(Prison)
							a.GrantUpgrade("nocontrol")
							a.GrantUpgrade("autocontrol")
							a.GrantUpgrade("wandering")
							a.Stance = "AttackAnything"
							a.Hunt()
						end
					end)
				else
					Trigger.OnIdle(a, function(a)
						if a.IsInWorld and not a.IsDead then
							a.GrantUpgrade("nocontrol")
							a.GrantUpgrade("autocontrol")
							a.GrantUpgrade("wandering")
							a.Stance = "AttackAnything"
							a.Hunt()
						end
					end)
				end
			else
				Trigger.OnIdle(a, function(a)
					if a.IsInWorld and not a.IsDead then
						a.GrantUpgrade("nocontrol")
						a.GrantUpgrade("autocontrol")
						a.GrantUpgrade("wandering")
						a.Stance = "AttackAnything"
						a.Hunt()
					end
				end)
			end
		end
	end
end
-----------------------------------------------------------------------------------------------------
LoadTransport = function(transport, passenger)
	transport.LoadPassenger(Actor.Create(passenger, false, { Owner = transport.Owner, Facing = transport.Facing }))
end
-----------------------------------------------------------------------------------------------------
LoadTransportCrate = function(transport, passenger)
	transport.LoadPassenger(Actor.Create(passenger, false, { Owner = neutral, Facing = Utils.RandomInteger(0, 255) }))
end
-----------------------------------------------------------------------------------------------------

