-------------------------------------------------------------- -- Script on the Parrots Crash in Gnarled Forest -- keeps the player from getting to the treasure -- -- stolen from the spider cave entrance script in AG -- updated Brandi... 1/28/10 -- updated Brandi... 2/26/10 added check for ninja cowl -------------------------------------------------------------- require('o_mis') local textVar = Localize("PARROT_GUARDS_WARNING") -- default values for mBox local mBox = {boxTarget = nil, isDisp = false, isTouch = false, isFirst = true, boxSelf = nil, boxText = '', boxTime = 1 } function onStartup(self,msg) self:SetVar("playerIn",false) end function MakeBox() -- check to make sure we have a target if mBox.boxTarget == nil or mBox.isDisp then return end mBox.isDisp = true -- --print('Creating Box') newTime = mBox.boxTime GAMEOBJ:GetTimer():AddTimerWithCancel( newTime, "BoxTimer", mBox.boxSelf ) mBox.boxTarget:DisplayTooltip { bShow = true, strText = mBox.boxText, iTime = mBox.boxTime*1000 } end function onCollisionPhantom(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (player:GetID() ~= msg.objectID:GetID()) then return end if (self:GetVar("playerIn") == false) then local item = player:GetEquippedItemInfo{ slot = "hair" }.lotID --check to see if the player is wearing either the white or black ninja cowl, if they are, they can get through if item ~= 2641 and item ~= 2642 and item ~= 1889 then self:SetVar("playerIn",true) --Notify parrots to play alarm animation local Parrots = self:GetObjectsInGroup{ group = "Parrots"}.objects for i = 1, table.maxn (Parrots) do Parrots[i]:PlayAnimation{animationID = "alarm"} end knockback(self) else -- Tell the server to cast our slow skill self:FireEventServerSide{senderID = player, args = "Slow"} end end end function onOffCollisionPhantom(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local item = player:GetEquippedItemInfo{ slot = "hair" }.lotID --local playerID = msg.objectID:GetID() if (player:GetID() ~= msg.objectID:GetID()) then return else -- Removing item requirement in case you remove your cowl while in the volume --if item == 2641 or item == 2642 then -- Tell the server to cast our unslow skill self:FireEventServerSide{senderID = player, args = "Unslow"} --end end self:SetVar("playerIn",false) GAMEOBJ:GetTimer():CancelTimer( "knockagain",self ) end function knockback(self) if self:GetVar("playerIn") == false then return end GAMEOBJ:GetTimer():AddTimerWithCancel( 0.6, "playerEntered",self ) local AnimObj = self:GetObjectsInGroup{ group = 'ParrotCrash', ignoreSpawners = true }.objects[1] AnimObj:StopFXEffect{name = "parrotwall"} AnimObj:PlayFXEffect{name = "parrotwall", effectID = 967, effectType = "pushy"} AnimObj:PlayAnimation{ animationID = 'parrot', bPlayImmediate = true } end function onTimerDone(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (msg.name == "playerEntered") then if player then local dir = self:GetObjectDirectionVectors().forward dir.y = 20 dir.x = 5--dir.x * 50 dir.z = -60--dir.z * 50 mBox.boxTarget = player player:PlayFXEffect{name = "birdcavepushback", effectID = 1537, effectType = "create"}--effectID = 1378, effectType = "push-back"} player:PlayAnimation{ animationID = "knockback-recovery" } player:Knockback { vector = dir } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "knockagain",self ) end if not player then return end --or mBox.isTouch or mBox.isDisp mBox.boxSelf = self mBox.isTouch = true mBox.boxText = textVar GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", self ) end if (msg.name == "knockagain") then knockback(self) end if msg.name == "BoxTimer" then mBox.isDisp = false resetBox() end -- checks to see if EventTimer has been called and if we are ready to do MakeBox(), need a valid mBox.boxTarget if msg.name == "EventTimer" then if not mBox.boxTarget then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", mBox.boxSelf ) return end MakeBox() end end function resetBox() -- checks to see if we are ready to reset mBox if mBox.isDisp or mBox.isTouch then return end -- default values mBox = {boxTarget = nil, isDisp = false, isTouch = false, isFirst = true, boxSelf = nil, boxText = '', boxTime = 1 } end