local _animatedModel = nil function OnStart() local pos = _gameObject:GetPosition() print("Wellkommen! I'm attached to a gameobject at " .. tostring(pos) .. "!") -- Add a sensor volume so we'll know when something gets close. local sensorVolumeComponent = _gameObject:AddSensorVolumeComponent() sensorVolumeComponent:SetBoxRadius(5.0) sensorVolumeComponent:SetEnterEvent("OnEnter") sensorVolumeComponent:SetLeaveEvent("OnLeave") -- Add a Minotaur animated model to this here thing. _animatedModel = _gameObject:AddEMotionFXAnimatedModelComponent() _animatedModel:SetModelId(ResourceID(1010201, 2203)) while true do -- Idle for 10 seconds, do the Minotaur Shake for another three seconds, then go back to idle. Rinse and repeat. coroutine.yield(10 * 1000) _animatedModel:SetBoolAttribute("get_hit", true) coroutine.yield(3 * 1000) _animatedModel:SetBoolAttribute("get_hit", false) end end function OnEnter(args) _animatedModel:SetFloatAttribute("velocity", 10.0) args.source:SendEvent("OnMinotaur", {what="Hear Me Roar!"} ) end function OnLeave(args) _animatedModel:SetFloatAttribute("velocity", 0.0) args.source:SendEvent("OnMinotaur", {what="Yes, run away puny one!"} ) end -- Don't include this function at all, unless you really have to. function OnUpdate(deltaTime) --print("Dude! It's a brand new frame! It lasted " .. deltaTime) end