local objsrv = lgs.ObjectSrv
local propsrv = lgs.PropertySrv
local linksrv = lgs.LinkSrv
local linktoolsrv = lgs.LinkToolsSrv
--local dest,sour,flav = nil,nil,nil

--function StartAttack(msg)
--	dest,sour,flav = linktoolsrv.LinkGet(linksrv.GetOne("AIAwareness",script.objid))
--	print("Alerte, agro vers:",dest, "Depuis? :", sour)
--end

function Alertness(msg)
	if msg.level == 0 then
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high",vector(5,0,360))
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high2",vector(5,0,360))
		propsrv.Set(script.objid,"StTweqJoints","AnimS",0x1)
	end
	if msg.level == 1 then
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high",vector(10,0,360))
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high2",vector(10,0,360))
		propsrv.Set(script.objid,"StTweqJoints","AnimS",0x1)
	end
	if msg.level == 2 then
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high",vector(20,0,360))
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high2",vector(20,0,360))
		propsrv.Set(script.objid,"StTweqJoints","AnimS",0x1)
	end
	if msg.level == 3 then	
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high",vector(40,0,360))
		propsrv.Set(script.objid,"CfgTweqJoints","		rate-low-high2",vector(40,0,360))
		propsrv.Set(script.objid,"StTweqJoints","AnimS",0x1)
		
--		local vec = propsrv.Get(script.objid,"CfgTweqScale","x rate-low-high")
--		print("vecteur :", vec, "Vitesse :",vec[0], "Minim :", vec[1], "Maxi :", vec[2])
		
		propsrv.Set(script.objid,"StTweqScale","AnimS",0x1)
		objsrv.AddMetaProperty(script.objid,objsrv.Named("M-ILLDROWNYOU"))
	end
	return true
end