local mobNum = 3 local spawnTime = 2 local spawnDist = 25 function onRebuildStart(self, msg) local player = msg.userID -- exclusion checks if player:GetImagination().imagination < 1 then return end player:PlayCinematic { pathName = "Base_QB_Wall" } end function onRebuildComplete( self, msg ) if ( msg ) then GAMEOBJ:GetTimer():AddTimerWithCancel(spawnTime, "SpawnStrombies", self ) self:SetFaction{faction = 16} end end function onRebuildCancel(self, msg) local player = msg.userID player:EndCinematic() end function spawnMobs(self) --target = GAMEOBJ:GetObjectByID(msg.objectID) if not self:GetVar("ambushFinished") then local oPos = {pos = self:GetPosition().pos} local posOffset = -10 local oDir = self:GetObjectDirectionVectors() local newPos = {x = oPos.pos.x + (oDir.forward.x * spawnDist), y = oPos.pos.y, z = oPos.pos.z + (oDir.forward.z * spawnDist)} --+ (oDir.forward.y * posOffset) oPos.rot = self:GetRotation() --print("************** Spawn Strombie **************") local config = { {"no_timed_spawn", true}, {"aggroRadius", 60}, {"tetherRadius", 70}, {"wanderRadius", 5} } for i=1, mobNum do local newOffset = {x = newPos.x, y = newPos.y, z = newPos.z + posOffset} RESMGR:LoadObject{ objectTemplate = 4712, x= newPos.x, y= newPos.y , z= newPos.z + posOffset, rw = oPos.rot.w, rx = -oPos.rot.x, ry = -oPos.rot.y, rz = -oPos.rot.z, owner = self, configData = config} -- posOffset = posOffset + 5 end end end function onChildLoaded( self, msg ) local spawnedMob = msg.childID spawnedMob:FollowTarget{targetID = self} spawnedMob:AddThreatRating{newThreatObjID = self, ThreatToAdd = 1000} end -- timers... function onTimerDone(self, msg) if msg.name == "SpawnStrombies" then --print('Spawning Strombies') spawnMobs(self) end end