ndpkfunction onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon1", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff1", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg endfunction onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon2", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff2", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg endfunction onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon3", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff3", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon4", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff4", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon5", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff5", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon6", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff6", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon7", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff7", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon8", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff8", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon9", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff9", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon10", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff10", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon11", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff11", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg endfunction onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon12", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff12", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg endfunction onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon13", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff13", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon14", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff14", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon15", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff15", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon16", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff16", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon17", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff17", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon18", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff18", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon19", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff19", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end function onStartup(self) print ("Starting up switch") self:PlayFXEffect{effectType = "create"} end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchon20", target = self} --self:PlayFXEffect{effectType = "action"} end msg.ignoreCollision = true return msg end function onOffCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() print("offcollision generated") -- If a player collided with me, then do our stuff --if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "switchoff20", target = self} --self:PlayFXEffect{effectType = "action"} -- end msg.ignoreCollision = true return msg end require('o_mis') function onStartup(self) self:SetVar("spawn_taken", "open") end function onStartup(self) end function onScriptNetworkVarUpdate(self,msg) if msg.tableOfVars[1].name == "broken" and msg.tableOfVars[1].value == true then end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "startup", self ) self:SetNetworkVar("broken", true ) self:SetFaction{faction = 101} --self:Die{ killerID = self } end function onRebuildComplete(self, msg) self:SetNetworkVar("broken", false ) end onTimerDone = function (self, msg) if msg.name == "startup" then self:RebuildReset{ bFail = false } self:SetNetworkVar("broken", true ) end end function RebuildComplete(self, msg) print("test") msg = temp end function onHit(self,msg) if msg then end end require('client/ai/L_BOUNCER_BASIC') function onCollisionPhantom(self, msg) local team = GAMEOBJ:GetZoneControlID():GetVar(msg.objectID:GetName().name) --print("Team =="..tostring(msg.objectID:GetNetworkVar("what_team")) if team == "A" then local target = msg.objectID local Groupname = self:GetVar("grp_name") local QBGroup = self:GetObjectsInGroup{ group = Groupname}.objects for i = 1, 3 do if QBGroup[i]:GetLOT().objtemplate == 4810 or QBGroup[i]:GetLOT().objtemplate == 4811 then if QBGroup[i]:GetNetworkVar("broken") ~= nil and QBGroup[i]:GetNetworkVar("broken") == false then bounceObj(self, target) msg.ignoreCollision = true return msg end end end end end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and (faction.faction == 101) then self:ShowEmbeddedEffect{type = "pickup"} local itemMsg = target:AddNewItemToInventory{ iObjTemplate = 2956 } target:EquipInventory{ itemtoequip = itemMsg.newObjID } self:Die{ killerID = msg.playerID, killType = "SILENT" } end if faction and (faction.faction == 100) and not self:GetVar("home") then end -- Ignore this on the server actually. More of a test than needed msg.ignoreCollision = true -- ONly do this once return msg end function onStartup(self) self:SetVar("home", true) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "startup", self ) self:SetNetworkVar("broken", true ) self:SetFaction{faction = 100} self:RebuildReset{ bFail = false } --self:Die{ killerID = self } end function onRebuildComplete(self, msg) self:SetNetworkVar("broken", false ) end onTimerDone = function (self, msg) if msg.name == "startup" then self:RebuildReset{ bFail = false } self:SetNetworkVar("broken", true ) end end function RebuildComplete(self, msg) print("test") msg = temp end function onHit(self,msg) if msg then end end require('client/ai/L_BOUNCER_BASIC') function onCollisionPhantom(self, msg) local team = GAMEOBJ:GetZoneControlID():GetVar(msg.objectID:GetName().name) if team == "B" then local target = msg.objectID local Groupname = self:GetVar("grp_name") local QBGroup = self:GetObjectsInGroup{ group = Groupname}.objects for i = 1, 3 do if QBGroup[i]:GetLOT().objtemplate == 4810 or QBGroup[i]:GetLOT().objtemplate == 4811 then if QBGroup[i]:GetNetworkVar("broken") ~= nil and QBGroup[i]:GetNetworkVar("broken") == false then bounceObj(self, target) msg.ignoreCollision = true return msg end end end end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_ZONEIN_POS"] = {x = 122.854, y = 278.0, z = -343.110} CONSTANTS["ROUNDS"] = 3 CONSTANTS["ROUND_TIME"] = 360 -------------------------------------------------------------- -- parses time to a string -------------------------------------------------------------- function ParseTime(numTime) local newTime = tonumber(numTime) local min = math.floor(newTime / 1000 / 60) newTime = newTime - (min * 1000 * 60) local sec = math.floor(newTime / 1000) newTime = newTime - (sec * 1000) local msec = math.floor(newTime) local strTime = "" if (min > 0) then strTime = ZeroPad(min,2) .. ":" .. ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) else strTime = ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) end return strTime end -------------------------------------------------------------- -- returns player num -- returns > 0 if valid -------------------------------------------------------------- function GetPlayerNum(self, player) for pnum = 1, #PLAYERS do if (player:GetID() == PLAYERS[pnum]) then return pnum end end return 0 end -------------------------------------------------------------- -- remove player from game -------------------------------------------------------------- function RemovePlayerFromGame(self, player) if (player) then local playerNum = GetPlayerNum(self, player) -- reset data PLAYERS[playerNum] = -1 local NoData = {} self:SetVar(player:GetID(), NoData) -- remove all boards RemoveBoardsFromPlayer(self, player) player:Teleport{pos = CONSTANTS["PLAYER_ZONEIN_POS"], bSetRotation = false} end end -------------------------------------------------------------- -- add new player for the race -------------------------------------------------------------- function AddNewPlayerToGame(self, player) if (player) then end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function StopGame(self) print("Game Stopped") end function onPlayerDied(self, msg) if msg == foo then end end -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) print("Game onStartup*******************") self:SetVar("what_team", "A") self:SetVar("total_players", 0) for i = 1, 8 do self:SetVar("PLAYER_"..i , nil) end --GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "LoadFlag", self ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "StartUp") then local spawnPoint1 = self:GetObjectsInGroup{ group = "spawn_blue" }.objects local spawnPoint2 = self:GetObjectsInGroup{ group = "spawn_red" }.objects for s = 1, 4 do spawnPoint2[s]:SetVar("spawn_taken", "open") end end if (msg.name == "StartGame") then StartGame(self) end if (msg.name == "TimeOut") then AbortGame(self) end if (msg.name == "EndGame") then StopGame(self) end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered Dots Board: " .. msg.playerID:GetName().name) getActivityUser(self) local player = msg.playerID local idString = player:GetID() local finalID = "|" .. idString for i = 1, 8 do if self:GetVar("PLAYER_"..i) == nil then storeObjectByName(self, "PLAYER_"..i, player) self:SetVar("PLAYERNAME_"..i, msg.playerID:GetName().name ) self:SetVar("PLAYEPOINTS_"..i, 0 ) print ("Saved Data for: "..msg.playerID:GetName().name ) if self:GetVar("what_team") == "A" then local spawnPoint = self:GetObjectsInGroup{ group = "spawn_blue" }.objects for i = 1, table.maxn (spawnPoint) do if spawnPoint[i]:GetVar("spawn_taken") == "open" then local spawnpos = spawnPoint[i]:GetPosition().pos spawnPoint[i]:SetVar("spawn_taken", true) player:Teleport{pos = spawnpos } player:SetFaction{faction = 101} self:SetVar("what_team", "B") local i = self:GetVar("total_players") self:SetVar("total_players",i+1) print ("Player Count: " ..self:GetVar("total_players") ) player:SetVar("what_team", "A") player:SetNetworkVar("what_team", "A") player:ServerSetUserCtrlCompPause{bPaused = true} self:SetVar(tostring(msg.playerID:GetName().name), "A") self:NotifyClientZoneObject{ name= player:GetName().name, param1 = 10 , param2 = 1 } break end end else local spawnPoint = self:GetObjectsInGroup{ group = "spawn_red" }.objects for i = 1, table.maxn (spawnPoint) do if spawnPoint[i]:GetVar("spawn_taken") == "open" then local spawnpos = spawnPoint[i]:GetPosition().pos spawnPoint[i]:SetVar("spawn_taken", true) player:Teleport{pos = spawnpos } player:SetFaction{faction = 100} self:SetVar("what_team", "A") local i = self:GetVar("total_players") self:SetVar("total_players",i+1) print ("Player Count: " ..self:GetVar("total_players") ) player:SetVar("what_team", "B") player:SetNetworkVar("what_team", "B") player:ServerSetUserCtrlCompPause{bPaused = true} self:SetVar(tostring(msg.playerID:GetName().name), "B") self:NotifyClientZoneObject{ name= player:GetName().name, param1 = 10 , param2 = 2 } break end end end break end end -- unpause player player:ServerSetUserCtrlCompPause{bPaused = false} end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onNotifyObject(self, msg) local whatPlayer = 0 if msg.name == "QBuildID" then local Player = getObjectByName(msg.ObjIDSender, "QB_PlayerID") local QBGroup = msg.ObjIDSender:GetVar("grp_name") self:SetVar(QBGroup, true) checkCells( self , msg.param1 ) end end -------------------------------------------------------------- -- Set/Reset Cells -------------------------------------------------------------- function SpawnCellOBJ(self,plnum,cell) local objects = self:GetObjectsInGroup{ group = "cell_grp"}.objects for i = 1, table.maxn (objects) do if objects[i]:GetVar("grp_name") == cell then local mypos = objects[i]:GetPosition().pos if plnum == 1 then RESMGR:LoadObject { objectTemplate = 3704 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, bIsSmashable = false } elseif plnum == 2 then RESMGR:LoadObject { objectTemplate = 3705 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, bIsSmashable = false } end end end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} --team A CONSTANTS["TEAM_PLAYER_1"] = { objID = 0, name = 0, team = "A", score = 0, deaths = 0 } CONSTANTS["TEAM_PLAYER_2"] = { objID = 0, name = 0, team = "A", score = 0, deaths = 0 } CONSTANTS["TEAM_PLAYER_3"] = { objID = 0, name = 0, team = "A", score = 0, deaths = 0 } CONSTANTS["TEAM_PLAYER_4"] = { objID = 0, name = 0, team = "A", score = 0, deaths = 0 } --team B CONSTANTS["TEAM_PLAYER_5"] = { objID = 0, name = 0, team = "B", score = 0, deaths = 0 } CONSTANTS["TEAM_PLAYER_6"] = { objID = 0, name = 0, team = "B", score = 0, deaths = 0 } CONSTANTS["TEAM_PLAYER_7"] = { objID = 0, name = 0, team = "B", score = 0, deaths = 0 } CONSTANTS["TEAM_PLAYER_8"] = { objID = 0, name = 0, team = "B", score = 0, deaths = 0 } CONSTANTS["PLAYER_1"] = "open" CONSTANTS["PLAYER_2"] = "open" CONSTANTS["PLAYER_3"] = "open" CONSTANTS["PLAYER_4"] = "open" CONSTANTS["PLAYER_5"] = "open" CONSTANTS["PLAYER_6"] = "open" CONSTANTS["PLAYER_7"] = "open" CONSTANTS["PLAYER_8"] = "open" function onNotifyClientZoneObject(self,msg) -- [ score ] --------------- 20 -- [ deaths ] ---------------- 15 --[ objID ] ---------------- 10 -- param1 = 10 ADD PLAYER ID -- name -- objID -- param2 TEAM 1 = A 2 = B if msg.param1 == 10 then --add player string.name and update team -- param1 == ObjID(int) , param2 = (1 = team A) (2 = team B) --if msg.param2 == 1 then for i = 1, 8 do if CONSTANTS["TEAM_PLAYER_"..i].objID == 0 then CONSTANTS["TEAM_PLAYER_"..i].name = msg.name print("SAVED TO CLIENT ="..tostring(CONSTANTS["TEAM_PLAYER_"..i].name)) if msg.param2 == 1 then self:SetVar(tostring(CONSTANTS["TEAM_PLAYER_"..i].name), "A") else self:SetVar(tostring(CONSTANTS["TEAM_PLAYER_"..i].name), "B") end break end end --end end end function onPlayerLoaded(self, msg) local player = msg.playerID for i = 1, 8 do if CONSTANTS["PLAYER_"..i] == "open" then CONSTANTS["PLAYER_"..i] = player end end end function GetTeam(self, name ) for i = 1, 8 do if name == CONSTANTS["TEAM_PLAYER_"..i].name then return CONSTANTS["TEAM_PLAYER_"..i].team end end end require('o_mis') function onStartup(self) self:SetVar("Slot_1", nil ) self:SetVar("Slot_2", nil ) self:SetVar("Slot_3", nil ) self:SetVar("Slot_4", nil ) self:SetVar("Snum", 1 ) end function onCollisionPhantom (self,msg) local target = msg.objectID if target:GetFaction().faction == 1 and not ( self:GetVar("Snum") >= 5 ) then for i = 1,4 do if self:GetVar("Slot_"..i ) == nil then self:SetVar("Slot_"..i, true ) local spawnPoint = self:GetObjectsInGroup{ group = "spawn_grp_blue" }.objects local spawnpos = spawnPoint[self:GetVar("Snum")]:GetPosition().pos target:Teleport{pos = spawnpos } target:SetFaction{faction = 7} t = self:GetVar("Snum") + 1 self:SetVar("Snum", t ) break end end end end require('o_mis') function onStartup(self) end function onCollisionPhantom (self,msg) end require('o_mis') CONSTANTS = {} CONSTANTS["PLAYER_RESPAWN_TIME"] = 5 function onStartup(self) end function onCollisionPhantom (self,msg) local target = msg.objectID if target:GetFaction().faction == 1 or target:GetFaction().faction == 7 then target:SetUserCtrlCompPause{bPaused = true} local theTime = GAMEOBJ:GetSystemTime() target:DisplayChatBubble{wsText = CONSTANTS["PLAYER_RESPAWN_TIME"] } GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "count", self ) end storeObjectByName(self, "player", target) end onTimerDone = function(self, msg) if msg.name == "count" and CONSTANTS["PLAYER_RESPAWN_TIME"] > 0 then player = getObjectByName(self, "player") s = CONSTANTS["PLAYER_RESPAWN_TIME"] - 1 CONSTANTS["PLAYER_RESPAWN_TIME"] = CONSTANTS["PLAYER_RESPAWN_TIME"] - 1 player:DisplayChatBubble{wsText = tostring(s) } timeplus(self) else player = getObjectByName(self, "player") CONSTANTS["PLAYER_RESPAWN_TIME"] = 5 player:SetUserCtrlCompPause{bPaused = false} local spawnPoint = self:GetObjectsInGroup{ group = "vol2" }.objects local spawnpos = spawnPoint[1]:GetPosition().pos player:Teleport{pos = spawnpos } end end function timeplus(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "count", self ) end require('o_mis') function onStartup(self) end function onCollisionPhantom (self,msg) local player = msg.objectID if player:GetFaction().faction == 100 or player:GetFaction().faction == 101 then if GAMEOBJ:GetZoneControlID():GetVar(player:GetName().name) == "A" then local spawnPoint = self:GetObjectsInGroup{ group = "spawn_blue" }.objects for i = 1, table.maxn (spawnPoint) do local ran = math.random(1,4) local spawnpos = spawnPoint[ran]:GetPosition().pos player:Teleport{pos = spawnpos } break end else local spawnPoint = self:GetObjectsInGroup{ group = "spawn_red" }.objects for i = 1, table.maxn (spawnPoint) do local ran = math.random(1,4) local spawnpos = spawnPoint[ran]:GetPosition().pos player:Teleport{pos = spawnpos } break end end end end -------------------------------------------------------------- -- Base Server side Foot Race script -- updated mrb... 2/17/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') function onStartup(self) local zControl = GAMEOBJ:GetZoneControlID() self:SendLuaNotificationRequest{requestTarget = zControl, messageName = "PlayerExit"} end function onFireEventServerSide(self, msg) --print('onFireEventServerSide ' .. msg.args) local tArgs = split(msg.args, "_") local player = false if tArgs[2] then player = GAMEOBJ:GetObjectByID(tArgs[2]) end if player then --print('found player ' .. player:GetName().name .. ' ********') if tArgs[1] == "updatePlayer" then UpdatePlayer(self, player) --UpdatePlayer(self, player, removePlayer) elseif tArgs[1] == "updatePlayerTrue" then UpdatePlayer(self, player, true) --UpdatePlayer(self, player, removePlayer) elseif tArgs[1] == "initialActivityScore" then InitialActivityScore(self, player, 1, msg.param1) --InitialActivityScore(self, player, scoreVar) elseif tArgs[1] == "PlayerWon" then if msg.param2 then player:SetFlag{iFlagID = msg.param2, bFlag = true} end StopActivity(self, player, 0, msg.param1 ) --StopActivity(self, player, scoreVar, value1Var, value2Var, quit ) end elseif tArgs[1] == "setupActivity" then SetupActivity(self, 9999, true) end end function notifyPlayerExit(self, other, msg) if not IsPlayerInActivity(self, msg.playerID) then return end UpdatePlayer(self, msg.playerID, true) -- if player logs out remove them from the activity end -------------------------------------------------------------- -- Base Foot Race script that handlese the client side logic -- updated mrb... 8/05/10 -- added stop all activity timers when player finishes the rece. -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('client/ai/AG/L_AG_NPC_NO_INTERACT') local gVars = {} local tGoalpostVars = {} ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function baseStartup(self) self:FireEventServerSide{senderID = self, args = "setupActivity"} -- send message to the server script to set up the activity math.randomseed( os.time() ) -- get random seed for randomizing numbers --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 30) -- Proximity speech AddInteraction(self, "proximityText", Localize("CHAT_FOOTRACE_A")) AddInteraction(self, "proximityText", Localize("CHAT_FOOTRACE_B")) AddInteraction(self, "proximityText", Localize("CHAT_FOOTRACE_C")) AddInteraction(self, "proximityAnim", "prox") end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function baseShutdown(self) -- turn of the generic UI timer if the script shuts down -- UI:SendMessage( "UdpateFootRaceScoreboard", {{"visible", false }} ) --we might want to throw the leaderboard up in this fail case so users can return to gameplay mode --from my understanding of the scripts this will shutdown when the race ends - which would be when we want the leaderboards anyway end ---------------------------------------------------------------- -- sets the local constants for this script ---------------------------------------------------------------- function setLocalVars(self, var1, var2) for k,v in pairs(var1) do self:SetVar(tostring(k), v) end self:SetVar("tGoalpostVars", var2) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local preConVar = self:GetVar("CheckPrecondition") -- if we dont have CheckPreconditions set in HF then return out of this function if not preConVar then return msg end -- TODO: need new tech to check all preconditions or need to redo and/or logic in Lua local tPreconditions = split(preConVar, ";") for k,v in ipairs(tPreconditions) do local check = msg.objIDUser:CheckPrecondition{PreconditionID = v} if not check.bPass then msg.HasReasonFromScript = true msg.Script_IconID = check.IconID msg.Script_Reason = check.FailedReason -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false break end end return msg end function onNotifyClientObject(self, msg) if msg.name == "ToggleLeaderBoard" and msg.paramObj:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("pushGameState", {{"state", "TimedRaceLeaderboard"}}) UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true}, {"hideReplay", true} } ) end end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function baseClientUse(self, msg) local playerID = GAMEOBJ:GetControlledID():GetID() -- check to see if we are the correct player if playerID ~= msg.user:GetID() or self:GetVar('isInUse') then return end local player = GAMEOBJ:GetObjectByID(playerID) local displayText = self:GetVar("sStopGoalText") or Localize("FOOT_RACE_START_QUESTION") local boxIdentifier = "Foot_Race_Start" -- tell the object to do what it's supposed to, then turn off the interaction icon toggleActivatorIcon(self, true) -- if player is in activity ask to stop other wise ask to start the foot race if IsPlayerInActivity(self, player) then displayText = self:GetVar("sStopGoalText") or Localize("FOOT_RACE_STOP_QUESTION") boxIdentifier = "Foot_Race_Stop" else self:SetVar("isInStartScreen", true) end player:DisplayMessageBox{bShow = true, imageID = 1, callbackClient = self, text = displayText, identifier = boxIdentifier} end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function baseTerminateInteraction(self, msg) msg.ObjIDTerminator:DisplayMessageBox{bShow = false} if msg.type ~= "user" then -- tell the object to do what it's supposed to, then turn off the interaction icon toggleActivatorIcon(self) end end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function baseMessageBoxRespond(self, msg) if not msg then return end local player = GAMEOBJ:GetControlledID() if msg.identifier == "Foot_Race_Stop" then if msg.iButton == 1 then ---------------------------------------------------------------------------------------------------------------------- --You respond in the positive to "I would like to stop playing the foot race" ---------------------------------------------------------------------------------------------------------------------- UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) StopFootRace(self, player) end -- tell the object to do what it's supposed to, then turn off the interaction icon toggleActivatorIcon(self) elseif msg.identifier == "Foot_Race_Start" then if msg.iButton == 1 and not IsPlayerInActivity(self, player) then -- add the new user self:FireEventServerSide{senderID = player, args = "updatePlayer_" .. player:GetID()} -- start the activity for the new user self:FireEventServerSide{senderID = player, args = "initialActivityScore_" .. player:GetID(), param1 = self:GetVar("startTime")} StartFootRace(self, player) self:SetVar("isInStartScreen", false) elseif self:GetVar("isInStartScreen") then toggleActivatorIcon(self) self:SetVar("isInStartScreen", false) end end end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide) local player = GAMEOBJ:GetControlledID() if not bHide then -- show the icon, cancel notification, set isInUse to false bHide = false self:SetVar('isInUse', false) else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) end self:SetIconAboveHead{iconMode = 1, iconType = 69, bIconOff = bHide} -- request the interaction update self:RequestPickTypeUpdate() end ---------------------------------------------- -- get a random obsticle based on the -- self:GetVar("obsticleLot") table and return it ---------------------------------------------- function getRandObsticles(self) local obsticleTable = self:GetVar("obsticleLot") if not obsticleTable then return {} end local obsticlePoints = {} local totalNodes = self:GetVar("total_spawner_nodes") -- if we want a finishline remove 1 from the total nodes if self:GetVar("finalGoalObsticleLot") > 0 then totalNodes = totalNodes - 1 end -- run through the total nodes and obsticle Lot table, then make a table of the resulting random objects/points. for i = 1, self:GetVar("numOfObsticles") do local pass = false while not pass do local rand = math.random(1,totalNodes) if not obsticlePoints[rand] then obsticlePoints[rand] = obsticleTable[math.random(1,#obsticleTable)] pass = true end end end return obsticlePoints end ---------------------------------------------- -- spawn in the goals and start the activity ---------------------------------------------- function StartFootRace(self, player) if self:GetVar('bRaceStarted') then return end self:SetVar('bRaceStarted', true) local path = LEVEL:GetPathWaypoints(self:GetVar("pathName")) self:SetVar('total_spawner_nodes', #path) local randObsticles = getRandObsticles(self) for k,v in ipairs(path) do -- set up the config data for each goal and load the object local config = { {"custom_script_client", "scripts/ai/ACT/FootRace/L_ACT_FOOT_RACE_GOAL.lua" }, {"groupID", "Goals;Goals_" .. k}, {"total_spawner_nodes", self:GetVar("total_spawner_nodes")}, {"node_number", k}, {"tGoalpostVars", self:GetVar("tGoalpostVars")}, {"renderDisabled", true}, } if randObsticles[k] then -- insert an obsticle in to the config data if appropriate table.insert(config, {"spawnObsticle", randObsticles[k]}) end if k == #path and self:GetVar("finalGoalObsticleLot") > 0 then -- insert the finish line in to the config data if appropriate table.insert(config, {"finalGoalObsticleLot", self:GetVar("finalGoalObsticleLot")}) end RESMGR:LoadObject{ objectTemplate = tostring(self:GetVar("goalLot")), x= v.pos.x, y= v.pos.y , z= v.pos.z, rw = v.rot.w, rx = v.rot.x, ry = v.rot.y, rz = v.rot.z, owner = self, configData = config} end freezePlayer(self, true) --freezePlayer(self, bFreeze) player:ShowActivityCountdown() ActivityTimerStart(self, "Start_Timer_Delay", -1, 3) --ActivityTimerStart(self, timerName, updateTime, stopTime) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function baseFireEvent(self, msg) if not msg then return end local tArgs = split(msg.args, "_") -- seperate out the objID and the message name local player = false local curTime = ActivityTimerGetRemainingTime(self, "Foot_Race_Timer") local displayText = false -- if we have an objID then get the lwoobj if tArgs[2] then -- if we dont have the local player return if tArgs[2] ~= GAMEOBJ:GetControlledID():GetID() then return else player = GAMEOBJ:GetObjectByID(tArgs[2]) end end -- send the correct message to the server side script and display the correct message based on tArgs[1] if curTime then if tArgs[1] == "PlayerHitGoal" then ActivityTimerAddTime(self, "Foot_Race_Timer", self:GetVar("addTime")) --ActivityTimerAddTime(self, timerName, addTime) UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", curTime + self:GetVar("addTime")}} ) elseif tArgs[1] == "PlayerHitFirstGoal" then --[[ if self:GetVar("sFirstGoalText") then displayText = self:GetVar("sFirstGoalText") else displayText = Localize("FOOT_RACE_FIRST_GOAL") end ]]-- ActivityTimerAddTime(self, "Foot_Race_Timer", self:GetVar("addTime")) --ActivityTimerAddTime(self, timerName, addTime) UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", curTime + self:GetVar("addTime")}} ) elseif tArgs[1] == "PlayerWon" and player then ---------------------------------------------------------------------------------------------------------------------- --pretty sure that this is the case where the player finishes the race and the leaderboard will get called --at this point the UI should be informed to stop updating the clock / what the final time is ---------------------------------------------------------------------------------------------------------------------- if ActivityTimerGetRemainingTime(self, "Foot_Race_Timer") < 1 then return end ActivityTimerStopAllTimers(self) if self:GetVar("sFinalGoalText") then displayText = self:GetVar("sFinalGoalText") .. ' ' .. SecondsToClock(curTime) else displayText = Localize("FOOT_RACE_FINAL_GOAL") .. ' ' .. SecondsToClock(curTime) end freezePlayer(self, true) --freezePlayer(self, bFreeze) player:PlayAnimation{animationID = "happy2", bPlayImmediate = true} local animTime = player:GetAnimationTime{animationID = "happy2"}.time self:SetVar("finalTime", curTime) UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", curTime}, {"raceComplete", true}} ) --ActivityTimerStart(self, timerName, updateTime, stopTime) ActivityTimerStart(self, "Finish_Anim_Timer", animTime, animTime) end end if displayText then UI:SendMessage( "UpdateFootRaceScoreboard", {{"message", displayText}} ) end end ---------------------------------------------- -- Shuts down the foot race ---------------------------------------------- function StopFootRace(self, sender) local player = GAMEOBJ:GetControlledID() local killObjs = self:GetObjectsInGroup{ group = 'Goals', ignoreSpawners = true }.objects if sender then player = sender end if IsPlayerInActivity(self, player) then -- remove the user self:FireEventServerSide{senderID = self, args = "updatePlayerTrue_" .. player:GetID()} end ActivityTimerStopAllTimers(self) for k,v in ipairs(killObjs) do GAMEOBJ:DeleteObject( v ) end self:SetVar('bRaceStarted', false) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function baseActivityTimerUpdate(self, msg) -- update the ui with the current time if msg.name == "Foot_Race_Timer" then UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", msg.timeRemaining}} ) end end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function baseActivityTimerDone(self, msg) if msg.name == "Start_Timer_Delay" then ---------------------------------------------------------------------------------------------------------------------- --The flow from accepting the footrace eventually gets to this statement after countdowns and animations ---------------------------------------------------------------------------------------------------------------------- ActivityTimerStart(self, "Foot_Race_Timer", 0.20, self:GetVar("startTime")) --ActivityTimerStart(self, timerName, updateTime, stopTime) ActivityTimerStart(self, "Foot_Race_Reset_Icon", 2, 2) --ActivityTimerStart(self, timerName, updateTime, stopTime) UI:SendMessage( "ToggleFootRaceScoreboard", {{"visible", true }, {"time", self:GetVar("startTime") }} ) freezePlayer(self) --freezePlayer(self, bFreeze) elseif msg.name == "Foot_Race_Reset_Icon" then -- tell the object to do what it's supposed to, then turn off the interaction icon toggleActivatorIcon(self) elseif msg.name == "Foot_Race_Timer" then ---------------------------------------------------------------------------------------------------------------------- --If the foot race timer dies, you failed to finish the footrace, no leaderboard displays, footrace widget needs to die ---------------------------------------------------------------------------------------------------------------------- UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) GAMEOBJ:GetControlledID():DisplayTooltip{ bShow = true, strText = Localize("FOOT_RACE_FAIL"), iTime = 1 } StopFootRace(self) elseif msg.name == "Finish_Anim_Timer" then ---------------------------------------------------------------------------------------------------------------------- --we reach here when the player successfully finished the footrace and the celebration animation ends ---------------------------------------------------------------------------------------------------------------------- local player = GAMEOBJ:GetControlledID() freezePlayer(self) if self:GetVar("completedFireEventGroup") then for k,v in ipairs(self:GetObjectsInGroup{ group = self:GetVar("completedFireEventGroup"), ignoreSpawners = true}.objects) do v:FireEventServerSide{senderID = self, args = "Foot_Race_Completed", param1 = player:GetID()} end end self:FireEventServerSide{senderID = self, args = "PlayerWon_" .. player:GetID(), param1 = self:GetVar("finalTime"), param2 = self:GetVar("completedSetFlagNum")} self:SetVar("finalTime", 0) StopFootRace(self, player) end end -------------------------------------------------------------- -- Foot Race Goal script that the player will trigger. -- updated mrb... 2/17/10 -------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; this spawns in the appropriate -- objects for the foot race goals. ---------------------------------------------------------------- function onStartup(self) self:SetVisible{visible = false, fadeTime = 0} self:AddObjectToGroup{group = 'Goals_' .. self:GetVar('node_number')} self:SetVar('NextGoal', 1) GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "spawnGoals", self ) end ---------------------------------------------------------------- -- called when the script is shut down; destoys the child objects ---------------------------------------------------------------- function onShutdown(self, msg) killGoalPosts(self) -- if the script shuts down kill all of the child objects end ---------------------------------------------------------------- -- called when the render component is loaded; plays the first effect. ---------------------------------------------------------------- function onChildRenderComponentReady(self,msg) if self:GetVar('node_number') == 1 then -- add delay to make sure the object is ready for an effect GAMEOBJ:GetTimer():AddTimerWithCancel(2, "Play_Goal_Post_Effect", self ) end end ---------------------------------------------------------------- -- Spawns the goal posts and obsticles for the foot race ---------------------------------------------------------------- function spawnGoalPosts(self) local oPos = {pos = self:GetPosition().pos} local gOffset = self:GetVar("tGoalpostVars.goalpostOffset") -- self:GetObjectScale().scale -- scale doesn't work when loading objects local posOffset = -gOffset local oDir = self:GetObjectDirectionVectors() local numToSpawn = 2 oPos.rot = self:GetRotation() if self:GetVar("spawnObsticle") or self:GetVar("finalGoalObsticleLot") then -- spawn an obsticle or finish line numToSpawn = 3 end local config = { {"groupID", "GoalPosts;Goals_" .. self:GetVar('node_number')} } for i=1, numToSpawn do -- spawn in the objects needed for this goal based on numToSpawn local spawnObj = self:GetVar("tGoalpostVars.goalpostLot") local dir = oDir.right if i == 3 then if self:GetVar("spawnObsticle") then spawnObj = self:GetVar("spawnObsticle") posOffset = 1 -- move the obsticle forward 1 unit so the player will collide with the obsticle first elseif self:GetVar("finalGoalObsticleLot") then spawnObj = self:GetVar("finalGoalObsticleLot") posOffset = -.5 -- move the finish line back .5 units so the player will collide with the trigger first end dir = oDir.forward end local newOffset = {x = oPos.pos.x + (dir.x * posOffset), y = oPos.pos.y, z = oPos.pos.z + (dir.z * posOffset)} if spawnObj and self and newOffset then -- load in the object RESMGR:LoadObject{ objectTemplate = spawnObj, x= newOffset.x, y= newOffset.y , z= newOffset.z, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = self, configData = config} end posOffset = gOffset end end ---------------------------------------------------------------- -- Plays the effect on the active goal ---------------------------------------------------------------- function PlayActiveEffect(self) if not self:GetVar("tGoalpostVars.nextEffectType") then return end local activeNode = self:GetVar('NextGoal') local nextObjs = self:GetObjectsInGroup{ group = 'Goals_' .. activeNode, ignoreSpawners = true }.objects for k,v in ipairs(nextObjs) do -- find the correct goal and play the active effect if v:GetLOT().objtemplate == self:GetVar("tGoalpostVars.goalpostLot") then v:PlayFXEffect{name = "ActiveEffect", effectType = self:GetVar("tGoalpostVars.nextEffectType"), effectID = self:GetVar("tGoalpostVars.nextEffectID")} end end end ---------------------------------------------------------------- -- Called when the player collides with the trigger volume; sends -- messages to the foot race npc ---------------------------------------------------------------- function onCollisionPhantom(self, msg) -- check to make sure we have the local player if msg.objectID:GetID() ~= GAMEOBJ:GetControlledID():GetID() then return end if not self:GetVar('isTriggered') then local nodeNum = self:GetVar('node_number') local activeNode = self:GetVar('NextGoal') if not activeNode then -- if we dont have an active node set it to the first one activeNode = 1 end if nodeNum ~= activeNode then return end -- if we're not in the active node the skip everything else local nodeTotal = self:GetVar("total_spawner_nodes") local parentObj = self:GetParentObj().objIDParent if parentObj then -- fire the correct event to this objects parent if nodeNum == 1 then parentObj:FireEvent{senderID = self, args = 'PlayerHitFirstGoal_' .. msg.objectID:GetID()} elseif nodeNum == nodeTotal then parentObj:FireEvent{senderID = self, args = 'PlayerWon_' .. msg.objectID:GetID()} else parentObj:FireEvent{senderID = self, args = 'PlayerHitGoal_' .. msg.objectID:GetID()} end else print('*** missing parentObj ***') end local tGoalObjs = self:GetObjectsInGroup{ group = 'Goals', ignoreSpawners = true }.objects for k,v in ipairs(tGoalObjs) do -- set NextGoal on all of the goal objects v:SetVar('NextGoal', nodeNum + 1) end self:SetVar('isTriggered', true) killGoalPosts(self) PlayActiveEffect(self) end end ---------------------------------------------------------------- -- Kills all of the child objects for this goal ---------------------------------------------------------------- function killGoalPosts(self) local nodeNum = self:GetVar('node_number') local killObjs = self:GetObjectsInGroup{ group = 'Goals_' .. nodeNum, ignoreSpawners = true }.objects for k,v in ipairs(killObjs) do --print('kill dem all ' .. k) if v:GetType().objType == "Smashables" or v:HasComponentType{iComponent = 7}.bHasComponent then -- if object is smashable call Die() v:Die() else -- no smashable so delete the object GAMEOBJ:DeleteObject( v ) end end end ---------------------------------------------------------------- -- Called when a timer is completed. ---------------------------------------------------------------- function onTimerDone(self, msg) if msg.name == "spawnGoals" then -- spawn the goals spawnGoalPosts(self) elseif msg.name == "Play_Goal_Post_Effect" then -- play the effect on the next active goal PlayActiveEffect(self) end end -------------------------------------------------------------- -- Foot Race script that -- updated mrb... 2/17/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT') local gVars = { pathName = "Foot_Race_Path_01", goalLot = 8575, obsticleLot = {8572, 8576, 8578, 8579, 6214,}, --6215, numOfObsticles = 2, finalGoalObsticleLot = 6216, sStopTooltipText = Localize("FOOT_RACE_STOP_QUESTION"), sStartTooltipText = Localize("FOOT_RACE_START_QUESTION"), sFirstGoalText = Localize("FOOT_RACE_FIRST_GOAL"), sFinalGoalText = Localize("FOOT_RACE_FINAL_GOAL"), startTime = 10, -- amount of time the player should start the race with addTime = 10, -- amount of time to add when the player hits a goal completedSetFlagNum = nil, -- sets the specified flag when the race is completed completedFireEventGroup = nil,} -- -ie- "PandaGroup" - calls FireEventServerSide message named Foot_Race_Completed to the group with the playerID as param1 -- these variabls are for setting up the goal posts only local tGoalpostVars = { goalpostLot = 3890, goalpostOffset = 5.2, -- how far right and left of the object to spawn in the goal posts. nextEffectID = 503, nextEffectType = "create",} ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function onStartup(self) setLocalVars(self, gVars, tGoalpostVars) baseStartup(self) end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self) end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function onClientUse(self, msg) baseClientUse(self, msg) end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function onTerminateInteraction(self, msg) baseTerminateInteraction(self, msg) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) baseMessageBoxRespond(self, msg) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function onFireEvent(self, msg) baseFireEvent(self, msg) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function onActivityTimerUpdate(self, msg) baseActivityTimerUpdate(self, msg) end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function onActivityTimerDone(self, msg) baseActivityTimerDone(self, msg) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["GOAL_LINE_LOT"] = 2717 CONSTANTS["CHECKPOINT_LOT"] = 2718 CONSTANTS["SPEEDBOOST_LOT"] = 2839 CONSTANTS["TRACK_WALL_LOT"] = 2487 -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- only do this for players with faction 1 local faction = msg.objectID:GetFaction() if faction and faction.faction == 1 then -- get the LOT local templateID = self:GetLOT().objtemplate local strType = "" -- send a message to the zone control object about this -- Goals send OffCollision / Checkpoints send Collision if (templateID == CONSTANTS["GOAL_LINE_LOT"]) then GAMEOBJ:GetZoneControlID():OffCollision{objectID = msg.objectID, senderID = self} elseif (templateID == CONSTANTS["CHECKPOINT_LOT"]) then GAMEOBJ:GetZoneControlID():Collision{objectID = msg.objectID, senderID = self} elseif (templateID == CONSTANTS["SPEEDBOOST_LOT"]) then msg.objectID:ActivateRacingPowerup{PowerupType = BOOST} elseif (templateID == CONSTANTS["TRACK_WALL_LOT"]) then msg.objectID:ActivateRacingPowerup{PowerupType = 0} end end msg.ignoreCollision = true return msg end --/////////////////////////////////////////////////////////////////////////////////////// --// Team Awesomer NPC -- SERVER Script --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Sent from a player when trying to use this object -------------------------------------------------------------- function onUse(self, msg) local strText = "Want to Race?" -- show a dialog box msg.user:DisplayMessageBox{bShow = true, imageID = 3, callbackClient = self, text = strText, identifier = "Race_Dialog"} end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- User wants to start shooting gallery, send him there if (msg.iButton == 1 and msg.identifier == "Race_Dialog") then -- tell zone control to prep the player to race GAMEOBJ:GetZoneControlID():MessageBoxRespond{iButton = 1, identifier = "Race_Mission", sender = msg.sender} end end--/////////////////////////////////////////////////////////////////////////////////////// --// Team Awesomer NPC -- SERVER Script --/////////////////////////////////////////////////////////////////////////////////////// CONSTANTS = {} -- @TODO:ISSUE - Lua cannot send client/single messages to non client OBJID's. Need a -- way to RerouteMessage in lua function onMissionDialogueOK(self, msg) -- get the user local user = msg.responder -- tell zone control to prep the player to race GAMEOBJ:GetZoneControlID():MessageBoxRespond{iButton = 1, identifier = "Race_Cannon_Mission", sender = user} end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["SMASHABLE_CONE"] = 2883 -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- pick a random explode factor local ran = math.random(2,3) -- set explode factor self:SetSmashableParams{fExplodeFactor = ran} end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) if (self:IsDead().bDead == false) then -- only do this for players with faction 1 local faction = msg.objectID:GetFaction() if faction and faction.faction == 1 then -- smash self self:Die{ killerID = self } -- do specials -- local templateID = self:GetLOT().objtemplate -- if (templateID == CONSTANTS["SMASHABLE_CONE"]) then msg.objectID:ActivateRacingPowerup{PowerupType = 1} msg.objectID:PlayAnimation{ animationID = "death-activity-racing", fPriority = 1.1 } -- end end end msg.ignoreCollision = true return msg end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if msg.name == "Smash" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["PROJECTILE_LOT"] = 1822 -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- ignore projectiles if (msg.objectID:GetLOT().objtemplate == CONSTANTS["PROJECTILE_LOT"]) then msg.ignoreCollision = true return msg end end --L_ACT_CANNON.lua -- Server Side -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS = {} -- Default Skill ID for the projectile CONSTANTS["IMPACT_SKILLID"] = 34 -- template for the projectile CONSTANTS["PROJECTILE_TEMPLATEID"] = 1822 -- offset to place the player during the activity CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -5.716} -- velocity of the projectile -- max distance = (v^2 / g) where v = velocity and g = the effect of gravity from the database. -- original value = 100. changed to 140 CONSTANTS["CANNON_VELOCITY"] = 129.0 -- Minimum distance that the cannon can hit CONSTANTS["CANNON_MIN_DISTANCE"] = 20.0 -- cooldown time for firing CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 -- muzzle offset CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} -- cannon time out for activity CONSTANTS["CANNON_TIMEOUT"] = 64.0 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- default the instance vars vec = {x = 0, y = 0, z = 0} self:SetVar("initVelVec",vec) -- set the parameters of the shooting gallery self:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- set the impact skill (forwards to the projectile) --self:SetActiveProjectileSkill{ skillID = CONSTANTS["IMPACT_SKILLID"] } self:SetVar("ImpactSkillID",CONSTANTS["IMPACT_SKILLID"]) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == CONSTANTS["PROJECTILE_TEMPLATEID"] then -- store who the parent is storeParent(self, msg.childID) local ballObj = msg.childID -- get the skill for the projectile skill = self:GetVar("ImpactSkillID") if (ballObj) and (getActivityUser(self)) and (skill) then -- store values in the projectile ballObj:SetVar("My_Faction", getActivityUser(self):GetFaction().faction) -- set the skill ballObj:SetActiveProjectileSkill{ skillID = skill } -- store the velocity local vec = self:GetVar("initVelVec") -- set projectile params if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) -- spawn the projectile local spawnPos = params.outSpawnPos RESMGR:LoadObject { objectTemplate = CONSTANTS["PROJECTILE_TEMPLATEID"], x = spawnPos.x, y = spawnPos.y, z = spawnPos.z, rw = 1, owner = self } self:PlayFXEffect{effectType = "onfire"} self:PlayFXEffect{effectType = "onfire2"} getActivityUser(self):PlayFXEffect{effectType = "SG-fire"} -- @TODO: rename this to a better message? -- Tell the zone control we just fired GAMEOBJ:GetZoneControlID():ShootingGalleryFire() end end -------------------------------------------------------------- -- Called when getting the cannon's faction -------------------------------------------------------------- function onGetFaction(self, msg) -- return the user's faction if (getActivityUser(self)) then msg.faction = getActivityUser(self):GetFaction().faction return msg end end -------------------------------------------------------------- -- Calculate the activity rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- Send the request to the zone control local newMsg = GAMEOBJ:GetZoneControlID():DoCalculateActivityRating { fValue1 = msg.fValue1, fValue2 = msg.fValue2, fValue3 = msg.fValue3, fValue4 = msg.fValue4, fValue5 = msg.fValue5, } -- return whatever the zone control gave us msg.outActivityRating = newMsg.outActivityRating return msg end -------------------------------------------------------------- -- Start or stop the activity -- @TODO: old func, replaced with onRequestActivityExit, change out later -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityStartStop{bStart = msg.bStart, userID = msg.userID} end -------------------------------------------------------------- -- User Exits Activity -------------------------------------------------------------- function onRequestActivityExit(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityExit{bUserCancel = msg.bUserCancel, userID = msg.userID} end --L_ACT_CANNONBALL.lua -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- cast the skill for the projectile -------------------------------------------------------------- function onProjectileImpact(self, msg) --skill = self:GetVar("ImpactSkillID") --if (skill) then -- self:CastSkill{skillID = skill} --end end -------------------------------------------------------------- -- return the parent's faction -------------------------------------------------------------- function onGetFaction(self, msg) msg.faction = self:GetVar("My_Faction") end -------------------------------------------------------------- -- Determine if the target is an enemy -------------------------------------------------------------- function onIsEnemy(self, msg) -- get our faction from our parent local myFaction = self:GetVar("My_Faction") -- get the target's faction local tgt = msg.targetID; local tgtFaction = tgt:GetFaction().faction -- target is an enemy if the faction is not the same as us msg.enemy = (myFaction ~= tgtFaction) return msg end -------------------------------------------------------------- -- We get this message when the projectile kills something -------------------------------------------------------------- function onUpdateMissionTask(self, msg) --forward message to parent getParent(self):UpdateMissionTask{target = msg.target, value = msg.value, value2 = msg.value2, taskType = msg.taskType} end-------------------------------------------------------------- -- Description: -- -- Server script for Shooting Gallery NPC in GF area. -- This NPC will react to a user interaction and prompt -- the user to start the shooting gallery. If the user -- presses yes, the NPC will send him to the GF SG instance. -- -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- Sent from a player when trying to use this object -------------------------------------------------------------- -------------------------------------------------------------- -- Sent from a player when trying to use this object -------------------------------------------------------------- function onUse(self, msg) local player = msg.user if player:CheckPrecondition{ PreconditionID = 32,iPreconditionType = 7 }.bPass then self:NotifyClientObject{name = "Clicked", paramObj = player, rerouteID = msg.player} else print("server click") self:NotifyClientObject{name = "PreconditionFail", paramObj = player, rerouteID = msg.player} end end-------------------------------------------------------------- -- Description: -- -- Server script for Shooting Gallery Actors in the instance. -- This object will register with the zone script who will -- then trigger animations and actions on this object. -- -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Description: -- -- Server script for Shooting Gallery Actors in the instance. -- This object will register with the zone script who will -- then trigger animations and actions on this object. -- -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end function onMissionDialogueOK(self, msg) local user = msg.responder user:TransferToZone{ zoneID = 1300 } --instance type invalid end--L_ACT_CANNON.lua -- Server Side -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS = {} -- Default Skill ID for the projectile CONSTANTS["IMPACT_SKILLID"] = 34 -- template for the projectile CONSTANTS["PROJECTILE_TEMPLATEID"] = 1822 -- offset to place the player during the activity CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -5.716} -- velocity of the projectile -- max distance = (v^2 / g) where v = velocity and g = the effect of gravity from the database. -- original value = 100. changed to 140 CONSTANTS["CANNON_VELOCITY"] = 129.0 -- Minimum distance that the cannon can hit CONSTANTS["CANNON_MIN_DISTANCE"] = 20.0 -- cooldown time for firing CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 -- muzzle offset CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} -- cannon time out for activity CONSTANTS["CANNON_TIMEOUT"] = 64.0 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- default the instance vars vec = {x = 0, y = 0, z = 0} self:SetVar("initVelVec",vec) -- set the parameters of the shooting gallery self:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- set the impact skill (forwards to the projectile) --self:SetActiveProjectileSkill{ skillID = CONSTANTS["IMPACT_SKILLID"] } self:SetVar("ImpactSkillID",CONSTANTS["IMPACT_SKILLID"]) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == CONSTANTS["PROJECTILE_TEMPLATEID"] then -- store who the parent is storeParent(self, msg.childID) local ballObj = msg.childID -- get the skill for the projectile skill = self:GetVar("ImpactSkillID") if (ballObj) and (getActivityUser(self)) and (skill) then -- store values in the projectile ballObj:SetVar("My_Faction", getActivityUser(self):GetFaction().faction) -- set the skill ballObj:SetActiveProjectileSkill{ skillID = skill } -- store the velocity local vec = self:GetVar("initVelVec") -- set projectile params if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) -- spawn the projectile local spawnPos = params.outSpawnPos RESMGR:LoadObject { objectTemplate = CONSTANTS["PROJECTILE_TEMPLATEID"], x = spawnPos.x, y = spawnPos.y, z = spawnPos.z, rw = 1, owner = self } self:PlayFXEffect{effectType = "onfire"} self:PlayFXEffect{effectType = "onfire2"} getActivityUser(self):PlayFXEffect{effectType = "SG-fire"} -- @TODO: rename this to a better message? -- Tell the zone control we just fired GAMEOBJ:GetZoneControlID():ShootingGalleryFire() end end -------------------------------------------------------------- -- Called when getting the cannon's faction -------------------------------------------------------------- function onGetFaction(self, msg) -- return the user's faction if (getActivityUser(self)) then msg.faction = getActivityUser(self):GetFaction().faction return msg end end -------------------------------------------------------------- -- Calculate the activity rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- Send the request to the zone control local newMsg = GAMEOBJ:GetZoneControlID():DoCalculateActivityRating { fValue1 = msg.fValue1, fValue2 = msg.fValue2, fValue3 = msg.fValue3, fValue4 = msg.fValue4, fValue5 = msg.fValue5, } -- return whatever the zone control gave us msg.outActivityRating = newMsg.outActivityRating return msg end -------------------------------------------------------------- -- Start or stop the activity -- @TODO: old func, replaced with onRequestActivityExit, change out later -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityStartStop{bStart = msg.bStart, userID = msg.userID} end -------------------------------------------------------------- -- User Exits Activity -------------------------------------------------------------- function onRequestActivityExit(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityExit{bUserCancel = msg.bUserCancel, userID = msg.userID} end --L_ACT_CANNON.lua -- Server Side -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS = {} -- Default Skill ID for the projectile CONSTANTS["IMPACT_SKILLID"] = 168 -- template for the projectile CONSTANTS["PROJECTILE_TEMPLATEID"] = 2716 -- offset to place the player during the activity CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -5.716} -- velocity of the projectile -- max distance = (v^2 / g) where v = velocity and g = the effect of gravity from the database. -- original value = 100. changed to 140 CONSTANTS["CANNON_VELOCITY"] = 140.0 -- Minimum distance that the cannon can hit CONSTANTS["CANNON_MIN_DISTANCE"] = 20.0 -- cooldown time for firing CONSTANTS["CANNON_REFIRE_RATE"] = 600.0 -- muzzle offset CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} -- cannon time out for activity CONSTANTS["CANNON_TIMEOUT"] = 64.0 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- default the instance vars vec = {x = 0, y = 0, z = 0} self:SetVar("initVelVec",vec) -- set the parameters of the shooting gallery self:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- set the impact skill (forwards to the projectile) --self:SetActiveProjectileSkill{ skillID = CONSTANTS["IMPACT_SKILLID"] } self:SetVar("ImpactSkillID",CONSTANTS["IMPACT_SKILLID"]) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == CONSTANTS["PROJECTILE_TEMPLATEID"] then -- store who the parent is storeParent(self, msg.childID) local ballObj = msg.childID -- get the skill for the projectile skill = self:GetVar("ImpactSkillID") if (ballObj) and (getActivityUser(self)) and (skill) then -- store values in the projectile ballObj:SetVar("My_Faction", getActivityUser(self):GetFaction().faction) -- set the skill ballObj:SetActiveProjectileSkill{ skillID = skill } -- store the velocity local vec = self:GetVar("initVelVec") -- set projectile params if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) -- spawn the projectile local spawnPos = params.outSpawnPos RESMGR:LoadObject { objectTemplate = CONSTANTS["PROJECTILE_TEMPLATEID"], x = spawnPos.x, y = spawnPos.y, z = spawnPos.z, rw = 1, owner = self } self:PlayFXEffect{effectType = "onfire"} self:PlayFXEffect{effectType = "onfire2"} getActivityUser(self):PlayFXEffect{effectType = "SG-fire"} -- @TODO: rename this to a better message? -- Tell the zone control we just fired GAMEOBJ:GetZoneControlID():ShootingGalleryFire() end end -------------------------------------------------------------- -- Called when getting the cannon's faction -------------------------------------------------------------- function onGetFaction(self, msg) -- return the user's faction if (getActivityUser(self)) then msg.faction = getActivityUser(self):GetFaction().faction return msg end end -------------------------------------------------------------- -- Calculate the activity rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- Send the request to the zone control local newMsg = GAMEOBJ:GetZoneControlID():DoCalculateActivityRating { fValue1 = msg.fValue1, fValue2 = msg.fValue2, fValue3 = msg.fValue3, fValue4 = msg.fValue4, fValue5 = msg.fValue5, } -- return whatever the zone control gave us msg.outActivityRating = newMsg.outActivityRating return msg end -------------------------------------------------------------- -- Start or stop the activity -- @TODO: old func, replaced with onRequestActivityExit, change out later -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityStartStop{bStart = msg.bStart, userID = msg.userID} end -------------------------------------------------------------- -- User Exits Activity -------------------------------------------------------------- function onRequestActivityExit(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityExit{bUserCancel = msg.bUserCancel, userID = msg.userID} end --L_ACT_CANNON.lua -- Server Side -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS = {} -- Default Skill ID for the projectile CONSTANTS["IMPACT_SKILLID"] = 169 -- template for the projectile CONSTANTS["PROJECTILE_TEMPLATEID"] = 4802 -- offset to place the player during the activity CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -5.716} -- velocity of the projectile -- max distance = (v^2 / g) where v = velocity and g = the effect of gravity from the database. -- original value = 100. changed to 140 CONSTANTS["CANNON_VELOCITY"] = 90.0 -- Minimum distance that the cannon can hit CONSTANTS["CANNON_MIN_DISTANCE"] = 20.0 -- cooldown time for firing CONSTANTS["CANNON_REFIRE_RATE"] = 1000.0 -- muzzle offset CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} -- cannon time out for activity CONSTANTS["CANNON_TIMEOUT"] = 64.0 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- default the instance vars vec = {x = 0, y = 0, z = 0} self:SetVar("initVelVec",vec) -- set the parameters of the shooting gallery self:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- set the impact skill (forwards to the projectile) --self:SetActiveProjectileSkill{ skillID = CONSTANTS["IMPACT_SKILLID"] } self:SetVar("ImpactSkillID",CONSTANTS["IMPACT_SKILLID"]) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == CONSTANTS["PROJECTILE_TEMPLATEID"] then -- store who the parent is storeParent(self, msg.childID) local ballObj = msg.childID -- get the skill for the projectile skill = self:GetVar("ImpactSkillID") if (ballObj) and (getActivityUser(self)) and (skill) then -- store values in the projectile ballObj:SetVar("My_Faction", getActivityUser(self):GetFaction().faction) -- set the skill ballObj:SetActiveProjectileSkill{ skillID = skill } -- store the velocity local vec = self:GetVar("initVelVec") -- set projectile params if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) -- spawn the projectile local spawnPos = params.outSpawnPos RESMGR:LoadObject { objectTemplate = CONSTANTS["PROJECTILE_TEMPLATEID"], x = spawnPos.x, y = spawnPos.y, z = spawnPos.z, rw = 1, owner = self } self:PlayFXEffect{effectType = "onfire"} self:PlayFXEffect{effectType = "onfire2"} getActivityUser(self):PlayFXEffect{effectType = "SG-fire"} -- @TODO: rename this to a better message? -- Tell the zone control we just fired GAMEOBJ:GetZoneControlID():ShootingGalleryFire() end end -------------------------------------------------------------- -- Called when getting the cannon's faction -------------------------------------------------------------- function onGetFaction(self, msg) -- return the user's faction if (getActivityUser(self)) then msg.faction = getActivityUser(self):GetFaction().faction return msg end end -------------------------------------------------------------- -- Calculate the activity rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- Send the request to the zone control local newMsg = GAMEOBJ:GetZoneControlID():DoCalculateActivityRating { fValue1 = msg.fValue1, fValue2 = msg.fValue2, fValue3 = msg.fValue3, fValue4 = msg.fValue4, fValue5 = msg.fValue5, } -- return whatever the zone control gave us msg.outActivityRating = newMsg.outActivityRating return msg end -------------------------------------------------------------- -- Start or stop the activity -- @TODO: old func, replaced with onRequestActivityExit, change out later -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityStartStop{bStart = msg.bStart, userID = msg.userID} end -------------------------------------------------------------- -- User Exits Activity -------------------------------------------------------------- function onRequestActivityExit(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityExit{bUserCancel = msg.bUserCancel, userID = msg.userID} end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "startup", self ) end function onRebuildComplete(self, msg) local Player1 = getObjectByName(GAMEOBJ:GetZoneControlID(), "PLAYER1") local Player2 = getObjectByName(GAMEOBJ:GetZoneControlID(), "PLAYER2") if Player1:GetName().name == msg.userID:GetName().name then QBP = 1 elseif Player2:GetName().name == msg.userID:GetName().name then QBP = 2 end self:SetVar("PlayerName", msg.userID:GetName().name) GAMEOBJ:GetZoneControlID():NotifyObject{ name="QBuildID", param1 = QBP , ObjIDSender = self } end onTimerDone = function (self, msg) if msg.name == "startup" then self:RebuildReset{ bFail = false } end end function fffRebuildComplete(self, msg) print("test") msg = temp end --L_NPC_FIREFLY_FLOWER local aggroRadius = 4 local skillID = 33 function onProximityUpdate(self, msg) if msg.status == "ENTER" then local faction = msg.objId:GetFaction() if faction and faction.faction == 1 then self:CastSkill{skillID = skillID, optionalTargetID = msg.objId} end end end function onStartup(self) self:SetProximityRadius { radius = aggroRadius } end -------------------------------------------------------------- -- Generic Activity manager script, holds a bunch of useful functions -- for creating activities. -- updated mrb... 2/17/10 -------------------------------------------------------------- ---------------------------------------------------------------- -- Sets up an activity of the object, only need to put in variable you want to change ---------------------------------------------------------------- function SetupActivity(self, nMaxUsers, getActivity) if getActivity then self:SetActivityParams{ activityID = self:GetVar('activityID'), modifyMaxUsers = true, maxUsers = nMaxUsers, modifyActivityActive = true, activityActive = true} return end -- set max users to something high self:SetActivityParams{ modifyMaxUsers = true, maxUsers = nMaxUsers, modifyActivityActive = true, activityActive = true} end ---------------------------------------------------------------- -- Returns true/false if a player is in the activity -- takes self and a PLAYER object ---------------------------------------------------------------- function IsPlayerInActivity(self, player) -- check if player is in activity local existMsg = self:ActivityUserExists{ userID = player } if (existMsg) then return existMsg.bExists end return false end ---------------------------------------------------------------- -- Updates players for the activity: addPlayer defaults to true ---------------------------------------------------------------- function UpdatePlayer(self, player, removePlayer) -- Response to Exit activity dialog and user pressed OK --print(tostring(removePlayer) .. ' ' .. self:GetActivityID().activityID) if removePlayer then -- remove the user --print('remove user ' .. player:GetName().name) self:RemoveActivityUser{ userID = player } elseif not removePlayer then -- add the new user --print('add user ' .. player:GetName().name) self:AddActivityUser{ userID = player } -- start the activity for the new user InitialActivityScore(self, player, 0) end end ---------------------------------------------------------------- -- Stores the start time for the player in the activity and -- sends messages to start it ---------------------------------------------------------------- function InitialActivityScore(self, player, scoreVar) self:SetActivityUserData{ userID = player, typeIndex = 0, value = tonumber(scoreVar) } end ---------------------------------------------------------------- -- adds the valueVar to the existing value of the index for the -- player in the activity ---------------------------------------------------------------- function UpdateActivityValue(self, player, valueIndex, valueVar) local newValue = self:GetActivityUserData{ userID = player, typeIndex = valueIndex}.outValue + valueVar --print(newValue) self:SetActivityUserData{ userID = player, typeIndex = valueIndex, value = newValue } end ---------------------------------------------------------------- -- Stores a vaariable for the player in the activity ---------------------------------------------------------------- function SetActivityValue(self, player, valueIndex, valueVar) self:SetActivityUserData{ userID = player, typeIndex = valueIndex, value = tonumber(valueVar) } end ---------------------------------------------------------------- -- Gets the value of the activity index for the player ---------------------------------------------------------------- function GetActivityValue(self, player, valueIndex) return self:GetActivityUserData{ userID = player, typeIndex = valueIndex}.outValue end ---------------------------------------------------------------- -- StopActivity message ---------------------------------------------------------------- function StopActivity(self, player, scoreVar, value1Var, value2Var, quit ) -- user is trying to cancel if quit then -- remove the user from activity self:RemoveActivityUser{ userID = player } else -- store the time as activity rating [1] self:SetActivityUserData{ userID = player, typeIndex = 0, value = scoreVar } if value1Var ~= nil then self:SetActivityUserData{ userID = player, typeIndex = 1, value = value1Var } elseif value2Var ~= nil then self:SetActivityUserData{ userID = player, typeIndex = 2, value = value2Var } end -- distribute rewards self:DistributeActivityRewards{ userID = player, bAutoAddCurrency = true, bAutoAddItems = true } -- Update Leaderboards for this user self:UpdateActivityLeaderboard{ userID = player } local actID = self:GetActivityID().activityID -- get the leaderboard data for the user and update summary screen if it exists player:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = actID } self:NotifyClientObject{name = "ToggleLeaderBoard", param1 = actID, paramObj = player , rerouteID = player} -- remove the user from activity self:RemoveActivityUser{ userID = player } end end ---------------------------------------------------------------- -- GetLeaderboard Data message ---------------------------------------------------------------- function GetLeaderboardData(self, player, activityID) -- get the leaderboard data for the user and update summary screen if it exists player:RequestActivitySummaryLeaderboardData{ user = player, target = self, queryType = 1, gameID = activityID } end ---------------------------------------------------------------- -- Start activity timer ---------------------------------------------------------------- function ActivityTimerStart(self, timerName, updateTime, stopTime) if stopTime then self:ActivityTimerSet{name = timerName, updateInterval = updateTime, duration = stopTime} else self:ActivityTimerSet{name = timerName, updateInterval = updateTime} end end ---------------------------------------------------------------- -- Reset an activity timer ---------------------------------------------------------------- function ActivityTimerReset(self, timerName) self:ActivityTimerReset{name = timerName} end ---------------------------------------------------------------- -- Stop activity timer ---------------------------------------------------------------- function ActivityTimerStop(self, timerName) --print('** stop activity timer ' .. timerName .. ' now **') self:ActivityTimerStop{name = timerName} end ---------------------------------------------------------------- -- Stop activity timer ---------------------------------------------------------------- function ActivityTimerStopAllTimers(self) self:ActivityTimerStopAllTimers() end ---------------------------------------------------------------- -- Add time to activity timer ---------------------------------------------------------------- function ActivityTimerAddTime(self, timerName, addTime) self:ActivityTimerModify{name = timerName, timeToAdd = addTime} end ---------------------------------------------------------------- -- Get remaining activity timer time ---------------------------------------------------------------- function ActivityTimerGetRemainingTime(self, timerName) local timerInfo = self:ActivityTimerGet{name = timerName} return timerInfo.timeRemaining end ---------------------------------------------------------------- -- Get remaining activity timer time ---------------------------------------------------------------- function ActivityTimerGetCurrentTime(self, timerName) local timerInfo = self:ActivityTimerGet{name = timerName} return timerInfo.timeElapsed end ---------------------------------------------------------------- -- Custom function: splits a string based on patern and returns a table ---------------------------------------------------------------- function split(str, pat) local t = {} -- NOTE: use {n = 0} in Lua-5.0 local fpat = "(.-)" .. pat local last_end = 1 local s, e, cap = str:find(fpat, 1) while s do if s ~= 1 or cap ~= "" then table.insert(t,cap) end last_end = e+1 s, e, cap = str:find(fpat, last_end) end if last_end <= #str then cap = str:sub(last_end) table.insert(t, cap) end return t end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local eChangeType = "POP" if bFreeze then if playerID:IsDead().bDead then --print('frozen') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Freeze_Again", self ) return end eChangeType = "PUSH" end playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } --print('Player ' .. playerID:GetName().name .. ' ' .. eChangeType .. ' is frozen: ' .. tostring(self:GetVar('frozen')) .. ' ' .. tostring(playerID:GetStunned().bCanMove)) if playerID:GetStunned().bCanMove and eChangeType == "PUSH" then print(playerID:GetName().name .. ' is still able to move') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Try_Freeze_Again", self ) end end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 or nSeconds == nil then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function onTimerDone(self, msg) if msg.name == "Try_Freeze_Again" then freezePlayer(self, true) end end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Generic Rebuild -- Script --// - Creates a spawned entity to trigger the break on the rebuild --/////////////////////////////////////////////////////////////////////////////////////// -- TODO: need to create offset based on rotation of the object local detector_anim_delay = 7.0 local spawnDistance = -20.0 local entityTemplateID = 2223 -- This rebuild resets as soon as it is spawned function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "BreakSelf",self ) end -- Called anytime the rebuild object's state changes -- We use this to kick off the NPC break process on completion of the activity function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then -- start a timer that will start the process GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "BeginScriptedProcess",self ) end end -- Store the parent in the child function onChildLoaded(self, msg) if msg.templateID == entityTemplateID then storeParent(self, msg.childID) end end onTimerDone = function(self, msg) if msg.name == "BreakSelf" then self:RebuildReset() end -- Start the scripted break process if msg.name == "BeginScriptedProcess" then --local anim_time = self:GetAnimationTime{ animationID = "rebuild-complete" }.time self:PlayFXEffect{effectType = "rebuild-complete"} -- start a timer that will spawn a rebuild break entity GAMEOBJ:GetTimer():AddTimerWithCancel( detector_anim_delay, "SpawnRebuildBreakEntity",self ) end -- Spawns the break entity into the world nearby if msg.name == "SpawnRebuildBreakEntity" then -- get the heading and create a vector using spawn distance -- ninja detector animation needs the vector to be opposite the heading local heading = getHeading(self) heading.x = heading.x * spawnDistance heading.y = heading.y * spawnDistance heading.z = heading.z * spawnDistance -- add some offset local mypos = self:GetPosition().pos mypos.x = mypos.x + heading.x mypos.y = mypos.y + heading.y mypos.z = mypos.z + heading.z RESMGR:LoadObject { objectTemplate = entityTemplateID , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self } end end ------------------------------------------------------ --Script for the mines V.2 ------------------------------------------------------ require('o_mis') local interactRadius = 10 local maxWarnings = 3 function onStartup(self) --print("mine starting up") self:SetVar("RebuildComplete", false) self:SetProximityRadius { radius = interactRadius } end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then --print("Rebuild complete") storeObjectByName(self, "Builder", msg.player) self:SetVar("RebuildComplete", true) self:SetVar("NumWarnings", 0 ) self:AddObjectToGroup{group = "reset"} end end function onProximityUpdate(self, msg) if (msg.status == "ENTER") and (self:GetVar("RebuildComplete") == true) and (getObjectByName(self, "Builder"):IsEnemy{targetID = msg.objId}.enemy) then --print("Enemy detected") self:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.25 , "Tick", self ) end end onTimerDone = function(self, msg) if msg.name == "Tick" then if (self:GetVar("NumWarnings") >= maxWarnings) then --print("Mine exploded!") self:CastSkill{skillID = 317 , optionalOriginatorID = getObjectByName(self, "Builder") } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "BlowedUp", self ) --self:PlayFXEffect{name = "cannonbig", effectID = 71, effectType = "onfire_large"} --self:Die{ killerID = self } else --print("Beep!") self:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.25 , "Tick", self ) self:SetVar("NumWarnings", (self:GetVar("NumWarnings") + 1)) end end if msg.name == "BlowedUp" then self:Die{ killerID = self } end end--L_ACT_CANNON.lua -- Server Side require('o_mis') -- template for the projectile (water effect cannon ball) local ballTemplateID = 2357 -- offset to place the player during the activity local playerOffset = {x = 4, y = 0, z = -4} -- velocity of the projectile -- max distance = (v^2 / g) where v = velocity and g = the effect of gravity from the database. -- original value = 100. changed to 140 local velocity = 129.0 -- Minimum distance that the cannon can hit local minDist = 20.0 -- cooldown time for firing local refireRate = 800.0 -- muzzle offset local barrelOffset = {x = 0, y = 4.3, z = 9} -- cannon time out for activity local cannonTimeOut = -1.0 function onStartup(self) -- default the instance vars vec = {x = 0, y = 0, z = 0} self:SetVar("initVelVec",vec) -- set the parameters of the shooting gallery self:SetShootingGalleryParams{playerPosOffset = playerOffset, projectileVelocity = velocity, cooldown = refireRate, muzzlePosOffset = barrelOffset, minDistance = minDist, timeLimit = cannonTimeOut} end function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == ballTemplateID then -- store who the parent is storeParent(self, msg.childID) local ballObj = msg.childID if (ballObj) then ballObj:SetFaction{ faction = self:GetFaction().faction } local vec = self:GetVar("initVelVec") if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) -- spawn the projectile local spawnPos = params.outSpawnPos RESMGR:LoadObject { objectTemplate = ballTemplateID, x = spawnPos.x, y = spawnPos.y, z = spawnPos.z, rw = 1, owner = self } self:PlayFXEffect{effectType = "onfire"} end end --L_ACT_CANNONBALL.lua require('o_mis') local skillID = 47 -- cast the skill for the projectile function onProjectileImpact(self, msg) self:CastSkill{skillID = skillID} end function onUpdateMissionTask(self, msg) --forward message to parent getParent(self):UpdateMissionTask{target = msg.target, value = msg.value, taskType = msg.taskType} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Pirate_d1" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 20 -- Tether Radius Set['tetherSpeed'] = 10 -- Tether Speed Set['wanderRadius'] = 3 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Patroler" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "once" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "minigame-22" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 5 -- Waypoint Speed (Travle speed) -- Patrol Events ------------------------------------------------------ Set['WayPointEvent'] = true -- Bool Active -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 7 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = 21 --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight'] = 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "interact" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "interact" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- -- pick a random explode factor local ran = math.random(1,4) -- set explode factor self:SetSmashableParams{fExplodeFactor = ran} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Ninja_a5" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 20 -- Tether Radius Set['tetherSpeed'] = 10 -- Tether Speed Set['wanderRadius'] = 3 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Patroler" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "once" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "minigame-23" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 5 -- Waypoint Speed (Travle speed) -- Patrol Events ------------------------------------------------------ Set['WayPointEvent'] = true -- Bool Active -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 7 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = 20 --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight'] = 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "interact" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "interact" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- -- pick a random explode factor local ran = math.random(1,4) -- set explode factor self:SetSmashableParams{fExplodeFactor = ran} end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Minigame Rebuild -- Script --// - Resurrects the entity after the rebuild is put back together --/////////////////////////////////////////////////////////////////////////////////////// -- this is the spawn time for NPCs based on the state of the rebuild local completeSpawnTime = 5.0 local destroyedSpawnTime = 7.0 -- delay until the very first spawn starts local spawnFirstStartDelay = 10.0 -- NPC template IDs local ninjaTemplate = 2352 local ninjaFaction = 20 local pirateTemplate = 2353 local pirateFaction = 21 function onStartup(self) -- set the spawn time to be the complete since the rebuild starts complete self:SetVar("spawnTime",completeSpawnTime) -- start a timer that will start the spawns GAMEOBJ:GetTimer():AddTimerWithCancel( spawnFirstStartDelay, "SpawnEntity",self ) end -- Called anytime the rebuild object's state changes -- We use this to resurrect the object function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- set the spawn time self:SetVar("spawnTime",completeSpawnTime) -- resurrect the object self:Resurrect() -- restart the spawn timer GAMEOBJ:GetTimer():AddTimerWithCancel( completeSpawnTime, "SpawnEntity",self ) end end -- called on death function onDie(self, msg) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- set the spawn time self:SetVar("spawnTime",destroyedSpawnTime) -- break the rebuild self:RebuildReset() -- restart the spawn timer GAMEOBJ:GetTimer():AddTimerWithCancel( destroyedSpawnTime, "SpawnEntity",self ) end onTimerDone = function(self, msg) -- Start the scripted break process if msg.name == "SpawnEntity" then local entityTemplateID = 0 -- set the correct template based on faction if (self:GetFaction().faction == ninjaFaction) then entityTemplateID = ninjaTemplate elseif (self:GetFaction().faction == pirateFaction) then entityTemplateID = pirateTemplate end -- get our position and spawn the object if (entityTemplateID ~= 0) then local mypos = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = entityTemplateID , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, bIsSmashable = true } end -- start a timer that will spawn the next one local time = self:GetVar("spawnTime") GAMEOBJ:GetTimer():AddTimerWithCancel( time, "SpawnEntity",self ) end end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Generic Rebuild -- Script --// - Creates a spawned entity to complete the maelstrom portal mission for Numb Chuck --/////////////////////////////////////////////////////////////////////////////////////// -- This rebuild resets as soon as it is spawned function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "BreakSelf",self ) RESMGR:LoadObject { objectTemplate = 3076 , x= -263.94 , y= 133.09 , z= 459.125 , owner = self } -- Crystal 1 RESMGR:LoadObject { objectTemplate = 3076 , x= -257.06 , y= 133.15, z= 514.45 , owner = self } -- Crystal 2 RESMGR:LoadObject { objectTemplate = 3000 , x= -292.29 , y= 133.09 , z= 479.82 , owner = self } -- Gas Trigger end function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then -- start a timer that will start the process GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "BeginScriptedProcess",self ) end if (msg.iState == 2) then RESMGR:LoadObject { objectTemplate = 3043 , x= -279.88 , y= 133.10 , z= 489.49 , owner = self } -- Mission Giver getID_any(self, "Crystal_1"):Die{ killType = "SILENT" } getID_any(self, "Crystal_2"):Die{ killType = "SILENT" } getID_any(self, "GasTrigger"):Die{ killType = "SILENT" } GAMEOBJ:GetTimer():AddTimerWithCancel( 120, "TimeReset",self ) end end -- Store the parent in the child function onChildLoaded(self, msg) if msg.templateID == 3043 then -- misson setID_any(self,msg.childID, "MissionGiver") msg.childID:SetParentObj{ bSetToSelf = false } msg.childID:FaceTarget{location = {x= -264.037, z=486.601}} end if msg.templateID == 3076 then -- crystal if self:GetVar("Crystal_1") == nil then setID_any(self,msg.childID, "Crystal_1") else setID_any(self,msg.childID, "Crystal_2") end end if msg.templateID == 3000 then -- gas setID_any(self,msg.childID, "GasTrigger") end end onTimerDone = function(self, msg) if msg.name == "BreakSelf" then self:RebuildReset() end -- Start the scripted break process if msg.name == "BeginScriptedProcess" then self:PlayFXEffect{effectType = "rebuild-complete"} end if msg.name == "TimeReset" then self:RebuildReset() getID_any(self, "MissionGiver"):Die{ killType = "SILENT" } RESMGR:LoadObject { objectTemplate = 3076 , x= -263.94 , y= 133.09 , z= 459.125 , owner = self } -- Crystal 1 RESMGR:LoadObject { objectTemplate = 3076 , x= -257.06 , y= 133.15, z= 514.45 , owner = self } -- Crystal 2 RESMGR:LoadObject { objectTemplate = 3000 , x= -292.29 , y= 133.09 , z= 479.82 , owner = self } -- Gas Trigger end end function onMissionDialogueOK(self, msg) if self:GetLOT{}.objtemplate == 3043 then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:RebuildReset() getID_any(self, "MissionGiver"):Die{ killType = "SILENT" } RESMGR:LoadObject { objectTemplate = 3076 , x= -263.94 , y= 133.09 , z= 459.125 , owner = self } -- Crystal 1 RESMGR:LoadObject { objectTemplate = 3076 , x= -257.06 , y= 133.15, z= 514.45 , owner = self } -- Crystal 2 RESMGR:LoadObject { objectTemplate = 3000 , x= -292.29 , y= 133.09 , z= 479.82 , owner = self } -- Gas Trigger end end function setID_any(self,ID, string) idString = ID:GetID() finalID = "|" .. idString self:SetVar(string, finalID) end function getID_any(self, string ) targetID = self:GetVar(string) return GAMEOBJ:GetObjectByID(targetID) end require('State') require('o_onEvent') require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// OUTHOUSE -- Script --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:SetName { name = "OutHouse" } self:RebuildReset() end -------------------------------------------------------------- -- Description: -- -- Server script for Shooting Gallery NPC in GF area. -- This NPC will react to a user interaction and prompt -- the user to start the shooting gallery. If the user -- presses yes, the NPC will send him to the GF SG instance. -- -------------------------------------------------------------- -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- User wants to start Pet Ranch, send him there if (msg.iButton == 1 and msg.identifier == "Pet_Ranch_Start") then --msg.sender:Help{ iHelpID = 0 } msg.sender:TransferToZone{ zoneID = 330 } end end-------------------------------------------------------------- -- Description: -- -- This NPC allows the player to get out of the pet instance and back to YouReeka -- -------------------------------------------------------------- -------------------------------------------------------------- -- Sent from a player when trying to use this object -------------------------------------------------------------- function onUse(self, msg) local strText = "Exit Pet Ranch?" -- show a dialog box msg.user:DisplayMessageBox{bShow = true, imageID = 3, callbackClient = self, text = strText, identifier = "Pet_Ranch_Exit"} end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- User wants to start shooting gallery, send him there if (msg.iButton == 1 and msg.identifier == "Pet_Ranch_Exit") then msg.sender:TransferToZone{ zoneID = 312, pos_x = -199, pos_y = 302, pos_z = -103 } end end--L_ACT_PLAYER_DEATH_TRIGGER.lua -- instantly kills players when they touch anything with this script on it -------------------------------------------------------------- -- onCollision -------------------------------------------------------------- function onCollisionPhantom(self, msg) local target = msg.objectID target:RequestDie{killerID = self, killType = "SILENT"} end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Generic Rebuild -- Script --// - The spawned entity that will be breaking a rebuild --/////////////////////////////////////////////////////////////////////////////////////// local anim_attack_delay = 0.2 local attackDistance = -4.0 local delay_time = 1.5 function onStartup(self) -- delay until the animation has a chance to play on the client local anim_time = self:GetAnimationTime{ animationID = "rebuild-enter" }.time GAMEOBJ:GetTimer():AddTimerWithCancel( anim_time + delay_time, "TimerMoveToTarget",self ) end function onArrived(self, msg) -- for some reason there needs to be a delay when an NPC arrives at a waypoint -- otherwise some actions and animations will get overriden or will not play GAMEOBJ:GetTimer():AddTimerWithCancel( delay_time, "ArrivedDelayTimer",self ) end onTimerDone = function(self, msg) -- This timer starts the NPC moving to the target if msg.name == "TimerMoveToTarget" then -- set our destination local heading = getHeading(getParent(self)) heading.x = heading.x * attackDistance heading.y = heading.y * attackDistance heading.z = heading.z * attackDistance local dest = getParent(self):GetPosition().pos dest.x = dest.x + heading.x dest.y = dest.y + heading.y dest.z = dest.z + heading.z -- goto our destination self:GoTo{speed = 1.5, target = dest} end -- This timer starts after the NPC has hit the waypoint if msg.name == "ArrivedDelayTimer" then local anim_time = self:GetAnimationTime{ animationID = "rebuild-attack" }.time self:PlayFXEffect{effectType = "rebuild-attack"} getParent(self):PlayFXEffect{effectType = "rebuild-complete-2"} -- start a timer for the rebuild reset GAMEOBJ:GetTimer():AddTimerWithCancel( anim_time, "TimerRebuildReset",self ) -- start a timer for exit GAMEOBJ:GetTimer():AddTimerWithCancel( anim_time + anim_attack_delay, "TimerEntityExit",self ) end if msg.name == "TimerEntityExit" then local anim_time = self:GetAnimationTime{ animationID = "rebuild-exit" }.time self:PlayFXEffect{effectType = "rebuild-exit"} GAMEOBJ:GetTimer():AddTimerWithCancel( anim_time + anim_attack_delay, "TimerDeleteObject",self ) end if msg.name == "TimerDeleteObject" then GAMEOBJ:DeleteObject(self) end if msg.name == "TimerRebuildReset" then getParent(self):RebuildReset() --self:PlayAnimation{animationID = "rebuild-complete"} end end -- Called anytime the rebuild object's state changes -- We use this to notify the zone that we've completed out rebuild function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "rebuildcomplete" .. self:GetLOT().objtemplate, target = self} end end require('State') require('o_onEvent') require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Rebuild Tutorial -- SERVER Script --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) -- tell the zone controller we are loaded GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} -- Hide the activator until someone requests it self:DisplayRebuildActivator{bShow = false} -- break the rebuild self:RebuildReset() end --/////////////////////////////////////////////////////////////////////////////////////// --// Rebuild Tutorial NPC -- SERVER Script --/////////////////////////////////////////////////////////////////////////////////////// CONSTANTS = {} CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"] = 0 CONSTANTS["CLIENT_TOOLTIP_MISSION_COMPLETE"] = 1 -- @TODO:ISSUE - Lua cannot send client/single messages to non client OBJID's. Need a -- way to RerouteMessage in lua function onMissionDialogueOK(self, msg) -- get the user local user = msg.responder -- on accept if (msg.bIsComplete == false) then -- tell the zone controller we are loaded (this will show the activator) GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} -- pop a tooltip on the player --self:Help{rerouteID = user, iHelpID = CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"]} -- on complete else -- pop a tooltip on the player --self:Help{rerouteID = user, iHelpID = CONSTANTS["CLIENT_TOOLTIP_MISSION_COMPLETE"]} end endrequire('o_mis') local delay_time = 1.5 function onStartup(self) -- pick a random explode factor local ran = math.random(1,5) -- set explode factor self:SetSmashableParams{fExplodeFactor = ran} -- set the current waypoint number self:SetVar("CurWaypoint", 1) -- delay to move somewhere GAMEOBJ:GetTimer():AddTimerWithCancel( delay_time, "MoveToWP",self ) end function onArrived(self, msg) local curWP = self:GetVar("CurWaypoint") if (curWP <= 3) then -- for some reason there needs to be a delay when an NPC arrives at a waypoint -- otherwise some actions and animations will get overriden or will not play GAMEOBJ:GetTimer():AddTimerWithCancel( delay_time, "MoveToWP",self ) else -- forward this onto the parent getParent(self):Arrived() GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "TimerDeleteObject",self ) --self:KillObj{targetID = self} end end function onDie(self, msg) -- notify zone object of the mission task update (temp msg to talk to it) getParent(self):UpdateMissionTask{target = self} end function onGetActivityPoints(self, msg) local SpawnData = self:GetVar("SpawnData") if (SpawnData) then msg.points = SpawnData.sdScore end return msg end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if msg.name == "MoveToWP" then -- get waypoint data local curWP = self:GetVar("CurWaypoint") -- get spawn data local SpawnData = self:GetVar("SpawnData") local dest = self:GetVar("Waypoint" .. curWP) if (SpawnData and dest) then -- set the current waypoint number curWP = curWP + 1 self:SetVar("CurWaypoint", curWP) -- move to the waypoint self:GoTo{speed = SpawnData.sdSpeed, target = dest} end end if msg.name == "TimerDeleteObject" then -- @TODO: Is this the best way to delete an object from script?? -- This generates a bunch of messages about OffCollision etc... getParent(self):UpdateMissionTask{target = self} self:MoveToDeleteQueue{} end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- pick a random explode factor local ran = math.random(2,2) -- set explode factor self:SetSmashableParams{fExplodeFactor = 2.5} --GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "ChangeSpeed",self ) end -------------------------------------------------------------- -- Get the score for the target -------------------------------------------------------------- function onGetActivityPoints(self, msg) local SpawnData = self:GetVar("SpawnData") if (SpawnData) then msg.points = SpawnData.sdScore msg.addTime = SpawnData.sdTimeScore --- Addscore here *************************************************************************** end return msg end -------------------------------------------------------------- -- continue doign waypoints -- @TODO: modify speed/path/etc -------------------------------------------------------------- function onArrived(self, msg) -- do speed change ChangeSpeed(self) if (msg.isLastPoint == true) then Despawn(self) end if (msg.actions) then if msg.actions[1].name == "PlayAim" then local aimName = msg.actions[1].value DoObjectAction(self, "anim", aimName) end end -- local i = 1 -- if(msg.actions) then -- while (msg.actions[i]) do -- print(msg.actions[i].name) -- print(msg.actions[i].value) -- i = i + 1 -- end -- end self:ContinueWaypoints() end -------------------------------------------------------------- -- when at last waypoint, notify the parent to respawn -------------------------------------------------------------- function onPlatformAtLastWaypoint(self, msg) -- notify zone object of the mission task update (temp msg to talk to it) getParent(self):NotifyObject{ObjIDSender = self, name="FinishedPath"} end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- Change the speed every 5 seconds if msg.name == "ChangeSpeed" then -- pick a random speed local ran = math.random(1,4) self:SetPathingSpeed{ speed = ran } GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "ChangeSpeed",self ) end if msg.name == "Despawn" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self, killType = "SILENT" } end end -------------------------------------------------------------- -- Try to change the targets speed -------------------------------------------------------------- function ChangeSpeed(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to change speed? if ((SpawnData.sdChangeSpeed == true) and (math.random() <= SpawnData.sdSpeedChance)) then -- get a speed local newSpeed = (math.random() * (SpawnData.sdMaxSpeed - SpawnData.sdMinSpeed)) + SpawnData.sdMinSpeed -- set the new speed self:SetPathingSpeed{ speed = newSpeed } end end end -------------------------------------------------------------- -- Try to despawn the target -------------------------------------------------------------- function Despawn(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to despawn? if (SpawnData.sdDespawnTime == true) then local timeout = 1 -- use 10 second timeout so platforms aren't killed on the client before they finish their path if ( SpawnData.sdMovingPlat == true ) then timeout = 10 end GAMEOBJ:GetTimer():AddTimerWithCancel( timeout, "Despawn",self ) end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 2.5 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 1.8 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 1.5 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 3 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 1.4 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 0 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 1.9 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 100 return msg end local waterheight = 222 local waterlow = 201 function onArrived(self,msg) if self:GetPosition().pos.y > waterheight then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "CheckHeightDown",self ) elseif self:GetPosition().pos.y < waterheight then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "CheckHeightUp",self ) end end function onTimerDone(self, msg) if msg.name == "CheckHeightDown" then if self:GetPosition().pos.y > waterheight then elseif self:GetPosition().pos.y < waterheight then self:PlayFXEffect{effectType = "fade_down"} end elseif msg.name == "CheckHeightUp" then if self:GetPosition().pos.y > waterlow then self:PlayFXEffect{effectType = "fade_up"} elseif self:GetPosition().pos.y < waterlow then end end endrequire('State') require('o_onEvent') require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Team Nine Times Platform Rebuild -- SERVER Script --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) -- break the rebuild -- For some reason, this doesn't work from the zone script, though the rebuild cannon does self:RebuildReset() end --L_ACT_TEAM_NINES_REBUILDABLE_CANNON.lua -- Server Side -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/ACT/L_ACT_CANNON') -------------------------------------------------------------- -- Handles the object being destroyed -------------------------------------------------------------- function onDie(self, msg) -- cancel any activity going on self:RequestActivityExit{userID = getActivityUser(self), bUserCancel = true} -- reset the rebuild self:RebuildReset() end -------------------------------------------------------------- -- Handles the object changing rebuild states -------------------------------------------------------------- function onRebuildNotifyState(self, msg) -- if someone just finished rebuilding if (msg.iState == 3) and (self:IsDead().bDead == true) then -- revive this object so it can be killed again self:Resurrect() end end -------------------------------------------------------------- -- Description: -- -- Server script for PvP area. -- This NPC will react to a user interaction and prompt -- the user to start the PvP area. If the user -- presses yes, the NPC will send him to the PvP test instance. -- -------------------------------------------------------------- -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- CONSTANTS = {} CONSTANTS["TEAM1_PODIUM"] = { x = -245.0, y = 202.0, z = 191.0 } CONSTANTS["TEAM2_PODIUM"] = { x = -197.0, y = 202.0, z = 234.0 } local timerTick = 0 local tPlayers = {} local playerCount = 0 local minimumPlayers = 2 local teamSender = nil function onMessageBoxRespond(self, msg) if (msg.iButton == 1 and msg.identifier == "PvP_Start") then table.insert(tPlayers, msg.sender) teamSender = msg.sender end end function UpdateWaitState(self) local minimumCount = minimumPlayers - playerCount if(minimumCount == 1) then self:NotifyClientZoneObject{ name = "UpdateWaitStateBox" , paramStr = "Waiting for ("..minimumCount..") more player. Press OK to exit Lobby." } end if(minimumCount > 1) then self:NotifyClientZoneObject{ name = "UpdateWaitStateBox" , paramStr = "Waiting for ("..minimumCount..") more players. Press OK to exit Lobby."} end end function onFireEventServerSide(self, msg) if msg.args == 'add_Player' then playerCount = playerCount + 1; local playerTeam = playerCount; while(playerTeam > 1) do playerTeam = playerTeam - 2 end if(playerTeam == 0) then teamSender:Teleport{ pos = CONSTANTS["TEAM1_PODIUM"], bSetRotation = true } else teamSender:Teleport{ pos = CONSTANTS["TEAM2_PODIUM"], bSetRotation = true } end UpdateWaitState(self) timerTick = 10 GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartDelay", self ) end if msg.args == 'remove_Player' then table.remove(tPlayers, msg.senderID:GetID()) playerCount = playerCount - 1; if(playerCount == 0) then GAMEOBJ:GetTimer():CancelAllTimers(self) else timerTick = 10 GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartDelay", self ) end UpdateWaitState(self) end end function onTimerDone(self, msg) if msg.name == "StartDelay" then if(playerCount < minimumPlayers) then GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartDelay", self ) else self:NotifyClientZoneObject{ name = "CloseWaitStateBox" } self:NotifyClientZoneObject{ name = "Update_Timer", param1 = timerTick } GAMEOBJ:GetTimer():AddTimerWithCancel(1, "ClockCountDown", self ) end end if msg.name == "ClockCountDown" then timerTick = timerTick - 1 if timerTick == 0 then for k,v in ipairs(tPlayers) do v:TransferToZone{ zoneID = 420 } end self:NotifyClientZoneObject{ name = "Kill_Timer", param1 = 0 } GAMEOBJ:GetTimer():CancelAllTimers(self) playerCount = 0 else self:NotifyClientZoneObject{ name = "Update_Timer", param1 = timerTick } GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "ClockCountDown", self ) end end end --L_ACT_PLAYER_DEATH_TRIGGER.lua -- instantly kills players when they touch anything with this script on it -------------------------------------------------------------- -- onCollision -------------------------------------------------------------- function onCollisionPhantom(self, msg) print ("Car collided with DeathPlane") local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 113 and target:IsDead().bDead == false then target:Die{killerID = self} end return msg end --L_ACT_CANNON.lua -- Server Side -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS = {} -- Default Skill ID for the projectile CONSTANTS["IMPACT_SKILLID"] = 125 -- template for the projectile CONSTANTS["PROJECTILE_TEMPLATEID"] = 3880 -- offset to place the player during the activity CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 5.642, y = 0.637, z = -2.451} -- velocity of the projectile -- max distance = (v^2 / g) where v = velocity and g = the effect of gravity from the database. -- original value = 100. changed to 140 CONSTANTS["CANNON_VELOCITY"] = 20.0 -- Minimum distance that the cannon can hit CONSTANTS["CANNON_MIN_DISTANCE"] = 1.0 -- cooldown time for firing CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 -- muzzle offset CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} -- cannon time out for activity CONSTANTS["CANNON_TIMEOUT"] = 64.0 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- default the instance vars vec = {x = 0, y = 0, z = 0} self:SetVar("initVelVec",vec) -- set the parameters of the shooting gallery self:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- set the impact skill (forwards to the projectile) --self:SetActiveProjectileSkill{ skillID = CONSTANTS["IMPACT_SKILLID"] } self:SetVar("ImpactSkillID",CONSTANTS["IMPACT_SKILLID"]) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == CONSTANTS["PROJECTILE_TEMPLATEID"] then -- store who the parent is storeParent(self, msg.childID) local ballObj = msg.childID -- get the skill for the projectile skill = self:GetVar("ImpactSkillID") if (ballObj) and (getActivityUser(self)) and (skill) then -- store values in the projectile ballObj:SetVar("My_Faction", getActivityUser(self):GetFaction().faction) -- set the skill ballObj:SetActiveProjectileSkill{ skillID = skill } -- store the velocity local vec = self:GetVar("initVelVec") -- set projectile params if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) -- spawn the projectile local spawnPos = params.outSpawnPos RESMGR:LoadObject { objectTemplate = CONSTANTS["PROJECTILE_TEMPLATEID"], x = spawnPos.x, y = spawnPos.y, z = spawnPos.z, rw = 1, owner = self } self:PlayFXEffect{effectType = "onfire"} self:PlayFXEffect{effectType = "onfire2"} getActivityUser(self):PlayFXEffect{effectType = "SG-fire"} -- @TODO: rename this to a better message? -- Tell the zone control we just fired GAMEOBJ:GetZoneControlID():ShootingGalleryFire() end end -------------------------------------------------------------- -- Called when getting the cannon's faction -------------------------------------------------------------- function onGetFaction(self, msg) -- return the user's faction if (getActivityUser(self)) then msg.faction = getActivityUser(self):GetFaction().faction return msg end end -------------------------------------------------------------- -- Calculate the activity rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- Send the request to the zone control local newMsg = GAMEOBJ:GetZoneControlID():DoCalculateActivityRating { fValue1 = msg.fValue1, fValue2 = msg.fValue2, fValue3 = msg.fValue3, fValue4 = msg.fValue4, fValue5 = msg.fValue5, } -- return whatever the zone control gave us msg.outActivityRating = newMsg.outActivityRating return msg end -------------------------------------------------------------- -- Start or stop the activity -- @TODO: old func, replaced with onRequestActivityExit, change out later -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityStartStop{bStart = msg.bStart, userID = msg.userID} end -------------------------------------------------------------- -- User Exits Activity -------------------------------------------------------------- function onRequestActivityExit(self, msg) -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityExit{bUserCancel = msg.bUserCancel, userID = msg.userID} end function onCollision(self, msg) self:PlayFXEffect{effectType = "trail"} --print "i just cast a skill" self:KillObj{targetID = self} --print "i just killed myself" end return msg end function onCollision(self, msg) self:PlayFXEffect{effectType = "trail"} --print "i just cast a skill" self:KillObj{targetID = self} --print "i just killed myself" end return msg end function onCollision(self, msg) self:PlayFXEffect{effectType = "trail"} --print "i just cast a skill" self:KillObj{targetID = self} --print "i just killed myself" end return msg end function onCollision(self, msg) self:PlayFXEffect{effectType = "trail"} --print "i just cast a skill" self:KillObj{targetID = self} --print "i just killed myself" end return msg endrequire('State') require('Vector') local ATTACK_DIST = 5; local RUN_SPEED = 4; function onStartup(self) local AGGRO_RAD = 50; local MAX_PARENT_DIST = 200; self:AddSkill{skillID = 55} storeObj(self, nil, "myTarget"); print("Your pet is ready") print("ParentID = ", self:GetVar("parentID")) self:SetProximityRadius { radius = AGGRO_RAD, name = "aggro" }; self:SetProximityRadius { radius = MAX_PARENT_DIST, name = "parentRad" }; self:UseStateMachine(); addState(FollowParent, "FollowParent", "FollowParent", self); addState(Aggro, "Aggro", "Aggro", self); addState(CatchUp, "CatchUp", "CatchUp", self); beginStateMachine( "FollowParent", self ); end -------------------------------------------------------- -- PUT THIS IN A UTIL SCRIPT -------------------------------------------------------- function storeObj(self, target, name) if(target) then idString = target:GetID(); finalID = "|" .. idString; self:SetVar(name, finalID); else self:SetVar(name, nil); end end function getObj(self, name) targetID = self:GetVar(name); if(targetID) then return GAMEOBJ:GetObjectByID(targetID); else return nil; end end ------------------------------------------------------------------------------------------------------------ -- Follow Parent ------------------------------------------------------------------------------------------------------------ FollowParent = State.create(); FollowParent.onEnter = function(self) self:PetFollowOwner{ bFollowState = true } end FollowParent.onExit = function(self) self:PetFollowOwner{ bFollowState = false } end ------------------------------------------------------------------------------------------------------------ -- Aggro ------------------------------------------------------------------------------------------------------------ Aggro = State.create(); ----------------------------------------------------------------------------- -- onEnter ----------------------------------------------------------------------------- Aggro.onEnter = function(self) local INITIAL_ATTACK_TIME = .5; local parentObj = getObj(self, "parentID"); parentObj:PetFollowOwner{ bFollowState = false } -- Start the heartbeat self:SetVar("readyToAttack", false); GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ); local target = getObj(self, "myTarget"); if target:IsDead().bDead then setState("FollowParent",self); else self:FollowTarget { targetID = target,ATTACK_DIST, speed = RUN_SPEED, keepFollowing = true }; end end -- end function ----------------------------------------------------------------------------- -- onExit ----------------------------------------------------------------------------- Aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self); storeObj(self, nil, "myTarget"); -- parentObj:PetFollowOwner{ bFollowState = true } end ----------------------------------------------------------------------------- -- Aggro update ----------------------------------------------------------------------------- Aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true); DoAttack(self); local castTime = 1.5; GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ); end end ----------------------------------------------------------------------------- -- onArrived ----------------------------------------------------------------------------- Aggro.onArrived = function(self, msg) DoAttack(self); end -- This will be called if FollowTarget fails. That would only fail because the target has died, Aggro.onCancelled = function(self, msg) setState("FollowParent",self); end ----------------------------------------------------------------------------- -- onArrived ----------------------------------------------------------------------------- function DoAttack(self) if(self:GetVar("readyToAttack") == false) then return end if CanAttackTarget(self) then self:SetVar("readyToAttack", false) self:PlayFXEffect{effectType = "run"} self:CastSkill{skillID = 55 } -- TODO: This should be defined somewhere easier to find end end function CanAttackTarget(self) local myTarget = getObj(self, "myTarget"); local range = ATTACK_DIST; local myPos = Vector.new(self:GetPosition().pos) local hisPos = Vector.new(myTarget:GetPosition().pos) local dist = hisPos - myPos if not myTarget:Exists() or myTarget:IsDead().bDead then setState("FollowParent",self) return false end -- If we are close enough and if the object is in the FOV, then attack if dist:sqrLength() <= range * range then --and (self:IsObjectInFOV { target = myTarget, radius = 5 , minRange = 0, maxRange = 100 }.result) then return true end return false end -- end CanAttackTarget ------------------------------------------------------------------------------------------------------------ -- Catch up to parent ------------------------------------------------------------------------------------------------------------ CatchUp = State.create(); CatchUp.onEnter = function(self) self:PetFollowOwner{ bFollowState = true } end CatchUp.onProximityUpdate = function(self, msg) -- ENTER -- if the object is the owner, go to FollowParent if(msg.name == "parentRad") then if (msg.status == "ENTER" and msg.objId:GetID() == getObj(self, "parentID"):GetID()) then setState("FollowParent", self) end end end ------------------------------------------------------------------------------------------------------------ -- Global functions ------------------------------------------------------------------------------------------------------------ function onProximityUpdate(self, msg) if(msg.name == "aggro") then if getObj(self, "myTarget") then return end if(msg.status == "ENTER") and self:IsEnemy{ targetID = msg.objId }.enemy == true and not msg.objId:IsDead().bDead then storeObj(self, msg.objId, "myTarget"); setState("Aggro", self) end else -- ENTER -- check if object is an enemy and attack. if(msg.status == "LEAVE") then -- if msg.status == "LEAVE" if(msg.objId:GetID() == getObj(self, "parentID"):GetID()) then setState("CatchUp", self); end end end end -------------------------------------------------------------- -- Handles the object changing rebuild states -------------------------------------------------------------- local SPAWN_SPEED = 8; local MAX_SPAWNS = 6; local ACTIVATE_RAD = 30; local DEACTIVATE_RAD = 300; function onRebuildNotifyState(self, msg) -- if someone just started rebuilding if (msg.iState == 3) then self:SetVar("numSpawns", 0); GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "spawnTime", self ); end end function onStartup(self) self:RebuildReset() self:DisplayRebuildActivator{ bShow = false } self:SetProximityRadius { radius = ACTIVATE_RAD, name = "build" }; self:SetProximityRadius { radius = DEACTIVATE_RAD, name = "reset" }; end function onTimerDone(self,msg) local spawnCount = self:GetVar("numSpawns"); if(spawnCount < MAX_SPAWNS) then spawnCount = spawnCount + 1; self:SetVar("numSpawns", spawnCount); local pos = self:GetPosition().pos local randX = math.random(-10, 10); local randZ = math.random(-10, 10); RESMGR:LoadObject { objectTemplate = 2884 , x = pos.x + randX, y = pos.y , z = pos.z + randZ, owner = self } GAMEOBJ:GetTimer():AddTimerWithCancel( SPAWN_SPEED , "spawnTime", self ); end end function onProximityUpdate(self,msg) local faction = msg.objId:GetFaction(); if(faction and faction.faction == 1) then self:RebuildStart {userID = msg.objId} if(msg.name == "build" and msg.status == "ENTER") then msg.objId:SetAttr{ string = "maxlife", value = 10, ID = msg.objId} msg.objId:SetAttr{ string = "maxarmor", value = 5, ID = msg.objId} msg.objId:SetAttr{ string = "life", value = 10, ID = msg.objId} msg.objId:SetAttr{ string = "armor", value = 5, ID = msg.objId} elseif(msg.name == "reset" and msg.status == "LEAVE") then self:RebuildReset() end -- if name is build elseif name is reset end -- if faction is 1 end -- function require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 11 Set['OverRideHealth'] = false Set['Health'] = 3 Set['OverRideImag'] = false Set['Imagination'] = 10 Set['OverRideImmunity'] = false Set['Immunity'] = false Set['OverRideName'] = true Set['Name'] = "NINJA" Set['EmoteReact'] = false Set['Emote_EffectID'] = 4 Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --- ////////////////////////////////////////////// Set['EmoteEvent'] = true Set['Emote_EventName'] = "testRebuild" Set['Emote_Name'] = "wave" Set['Emote_EventDelay'] = 2 --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] -- Aggro Set['OverRideAggro'] = true Set['aggroRadius'] = 10 -- Aggro FOV Set['UseAggroFOV'] = false Set['aggroFOVRadius'] = 20 Set['aggroFOV'] = 180 -- Conduct Set['OverRideConduct'] = true Set['conductRadius'] = 20 -- Conduct FOV Set['UseConductFOV'] = true Set['conductFOVRadius'] = 15 Set['conductFOV'] = 180 -- Tether Set['OverRideTether'] = true Set['tetherRadius'] = 45 -- Wander Set['OverRideWander'] = true Set['wanderRadius'] = 20 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Patroler" --["Patroler"],["Guard"],["Wander"],[Frozen] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "wptest" -- ["name of way point set"] Set['WayPointDelay'] = "all" -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 3 Set['WayPointDMax'] = 4 Set['WayPointSpeed'] = 1 -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false Set['WanderChance'] = 100 Set['WanderDelayMin'] = 5 Set['WanderDelayMax'] = 5 -- effect 1 Set['WEmote_1'] = 100 -- Weight Set['WEmoteType_1'] = "salute" Set['WEmoteEffe_1'] = 4 -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = false Set['WEmoteType_2'] = "breakdance" Set['WEmoteEffe_2'] = 4 --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]["Friendly"] Set['AggroNPC'] = false -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_ID'] = 3 -- effectID of Emmote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false Set['FearNPC'] = false Set['FearCombat'] = false Set['FearHP'] = false Set['FearHPamount'] = 1 -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee"-- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 20 -- Flee Distance Set['FearTime'] = 8 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 3 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = nil -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "salute" Set['FearEffectID'] = 4 -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight']= 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Conduct_CoolDown'] = 5 -- Cool down is start after the conduct has completed. -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "after" -- When Emote is played ['before']/['after']/['both']. Set['Con_1_Type'] = "flee" -- String name of type ['follow'],['face'] Set['Con_1_Distance'] = 3 -- Option Distance [ follow = distance to npc ] Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action ( Targets and Truns the NPC ) Set['Con_1_Delay'] = 2 -- Delay after the Acton is completed Set['Con_1_Speed'] = 5 -- move speed -- goto set Pos [ Optional ] Set['Con_1_Use_xyz'] = false Set['Con_1_gotoX'] = 0 -- x Set['Con_1_gotoY'] = 0 -- y Set['Con_1_gotoZ'] = 0 -- z -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_EffectID'] = 4 -- Effect ID Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EDelay'] = 0.5 -- Animation Delay Set['Con_1_ESkill'] = true Set['Con_1_ESkillID'] = 11 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false Set['Con_2_AFaction'] = 3 -- Faction of the NPC/Player -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "after" -- When Action is played before/after Set['Con_2_Type'] = "sneakto" -- String name of type ['follow'],['face'] Set['Con_2_Distance'] = 4 -- Option Distance [ follow = distance to npc ] Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_Speed'] = 2 -- move speed -- goto set Pos [ Optional ] Set['Con_2_Use_xyz'] = false Set['Con_2_gotoX'] = 0 -- x Set['Con_2_gotoY'] = 0 -- y Set['Con_2_gotoZ'] = 0 -- z -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_EffectID'] = 4 -- Effect ID Set['Con_2_EffectType'] = "chicken" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EDelay'] = 8.75 -- Delay (Min should be the animation time) Set['Con_2_ESkill'] = false Set['Con_2_ESkillID'] = 31 --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 170 -- Spawner ID [1802 = Pirate] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Raduis Min Distance Set['Pet_DisMax'] = 20 -- Raduis Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" --[[ --///////////////////////////////////////////////////////////////////////// _ ____ _____ / \ / ___| |_ _| / _ \ | | | | / ___ \ | |___ | | /_/ \_\ \____| |_| --]] Set['Act_Active'] = false Set['Act_SpawnInMode'] = "emoteBreak" -- ["broken"], ["emoteBreak"], Set['Act_Spawn'] = 170 -- activitie to spawn Set['Act_Reset'] = 120 -- time in Idle state before reseting. ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_onEvent') require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// OUTHOUSE -- Script --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:SetVar("OutHouseState", 1) --- 1 hole -- 2 broken -- 3 Build Complted self:UseStateMachine{} self:SetName { name = "OutHouse" } -- Rotate an object by a given number of degrees HouseDead = State.create() HouseDead.onEnter = function(self) self:KillObj{ targetID = self } end -- ////////////////////////////////////////////////////////////////////////////////// -- Idle State -- ////////////////////////////////////////////////////////////////////////////////// ParentIdle = State.create() ParentIdle.onEnter = function(self) if self:GetVar("OutHouseState") == 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "BreakOuthouse",self ) end end ParentIdle.onArrived = function(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Load Childern State -- ////////////////////////////////////////////////////////////////////////////////// LoadChildren = State.create() LoadChildren.onEnter = function(self) end LoadChildren.onArrived = function(self) end -------------------------------------------------------------------------------------- addState(HouseDead, "HouseDead", "HouseDead", self) addState(ParentIdle, "ParentIdle", "ParentIdle", self) addState(LoadChildren,"LoadChildren","LoadChildren",self) beginStateMachine("ParentIdle", self) ParentIdle.onEnter(self) end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 8 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Red Siege Ninja" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 900 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 900 -- Tether Radius Set['tetherSpeed'] = 10 -- Tether Speed Set['wanderRadius'] = 3 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 0 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight'] = 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "interact" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "interact" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- --require('o_mis') local CONSTANTS = {} CONSTANTS["STREAK_MOD"] = 5 CONSTANTS["STREAK_BONUS"] = {1,5,10} -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- pick a random explode factor math.randomseed( os.time() ) -- set explode factor self:SetSmashableParams{fExplodeFactor = 2.5} end -------------------------------------------------------------- -- Get the score for the target -------------------------------------------------------------- function onGetActivityPoints(self, msg) local SpawnData = self:GetVar("SpawnData") if (SpawnData) then if (SpawnData.sdScore ) then msg.points = (SpawnData.sdScore ) end msg.addTime = SpawnData.sdTimeScore self:SetActivityUserData{userID = GAMEOBJ:GetZoneControlID():GetActivityUser{}.userID, typeIndex =5 , value = msg.points } end return msg end function NotifyParentToRespawn(self) local parentID = GAMEOBJ:GetObjectByID(self:GetVar("My_Parent_ID")) if parentID:Exists() then parentID:NotifyObject{ObjIDSender = self, name="FinishedPath"} end Despawn(self) end -------------------------------------------------------------- -- continue doign waypoints -- @TODO: modify speed/path/etc -------------------------------------------------------------- function onArrived(self, msg) if (msg.isLastPoint == true) then NotifyParentToRespawn(self) return end -- do speed change ChangeSpeed(self) if (msg.actions) then if msg.actions[1].name == "PlayAim" then local aimName = msg.actions[1].value local anim_time = self:GetAnimationTime{ animationID = aimName }.time if (tonumber(anim_time) > 0) then self:PlayAnimation{animationID = aimName} end end end self:ContinueWaypoints() end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) -- Change the speed every 5 seconds if msg.name == "ChangeSpeed" then -- pick a random speed local ran = math.random(1,4) self:SetPathingSpeed{ speed = ran } GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "ChangeSpeed",self ) elseif msg.name == "Despawn" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self, killType = "SILENT" } end end -------------------------------------------------------------- -- Try to change the targets speed -------------------------------------------------------------- function ChangeSpeed(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to change speed? if ((SpawnData.sdChangeSpeed == true) and (math.random() <= SpawnData.sdSpeedChance)) then -- get a speed local newSpeed = math.random(SpawnData.sdMinSpeed, SpawnData.sdMaxSpeed) -- set the new speed self:SetPathingSpeed{ speed = newSpeed } end end end -------------------------------------------------------------- -- Try to despawn the target -------------------------------------------------------------- function Despawn(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to despawn? if (SpawnData.sdDespawnTime == true) then local timeout = 1 -- use 10 second timeout so platforms aren't killed on the client before they finish their path if ( SpawnData.sdMovingPlat == true ) then timeout = 10 end GAMEOBJ:GetTimer():AddTimerWithCancel( timeout, "Despawn",self ) end else GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self, killType = "SILENT" } end end function onStartup(self) print("Starting timer") self:ActivityTimerSet{name = "testTimer", duration = 30, updateInterval = 5} end function onActivityTimerUpdate(self, msg) print("Timer " .. msg.name .. " sent us an update.") print(" " .. tostring(msg.timeElapsed) .. " seconds have passed, " .. tostring(msg.timeRemaining) .. " seconds remain.") end function onActivityTimerDone(self, msg) print("Timer " .. msg.name .. " has ended, " .. tostring(msg.timeElapsed) .. " seconds passed since it was set.") end function onChoicebuildComplete(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{name = "ChoicebuildChanged", param1 = msg.index, ObjIDSender = self} end -------------------------------------------------------------------------------------------------------- -- Server-side script for Concert Props Choice Builds. Each prop can be built into 1 of 4 types. -- If all 4 are built into the same thing, the Stage transforms, and 30 seconds later they all return to their "default" state (the object's render component) -- Based on scripts\ai\YRK\L_TB_BENCH.lua -- 5023 AG - Stage Rocket OLD 4029 AG Fog Machine Choice Build -- 4891 AG - Stage Spot Light OLD 4030 AG Spotlight Choice Build -- 5024 AG - Stage laser OLD 4031 AG Laser Light Choice Build -- 4858 AG - Speaker OLD 4032 AG Speaker Choice Build --HF waypoints used to spawn in choice builds --Concert_Prop_1 --Concert_Prop_2 --Concert_Prop_3 --Concert_Prop_4 --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('c_AvantGardens') -- All the lot nums for the prop choicebuilds LOT_NUMS = {} LOT_NUMS[1] = { CONSTANTS["LOT_CHOICEBUILD_ROCKET"], CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"], CONSTANTS["LOT_CHOICEBUILD_LASER"], CONSTANTS["LOT_CHOICEBUILD_SPEAKER"] } -- old Lot Nums from Bench script = { 3626, 3627, 3628, 3700 } function onStartup(self) end function onTripleBuildSelect(self, msg) local canswap = 0 -- Make sure we are allowed to spawn the piece they are requesting for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(LOT_NUMS[i][a] == msg.lotnum) then canswap = 1 -- how do you break out of a loop in lua? end end end if(canswap == 0) then --print("CANT SWAP") return end local mypos = self:GetPosition().pos local myRot = self:GetRotation() --print (self:GetID()) self:GetParentObj().objIDParent:NotifyObject{ObjIDSender=self, name="ChoicebuildChanged", param1=msg.lotnum} RESMGR:LoadObject { objectTemplate = msg.lotnum, x= mypos.x, y= mypos.y , z= mypos.z, owner = self:GetParentObj().objIDParent, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } GAMEOBJ:DeleteObject(self) --take imagination from the player msg.user:SetImagination{imagination = msg.user:GetImagination{}.imagination - 1} end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require ('o_mis') require('c_AvantGardens') require('o_ChoicebuildBonus') -- determines when all 4 choicebuilds match -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- all 4 LOT's CONSTANTS["CHOICEBUILD_LOTS"] = {} CONSTANTS["CHOICEBUILD_LOTS"][1] = CONSTANTS["LOT_CHOICEBUILD_ROCKET"] CONSTANTS["CHOICEBUILD_LOTS"][2] = CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"] CONSTANTS["CHOICEBUILD_LOTS"][3] = CONSTANTS["LOT_CHOICEBUILD_LASER"] CONSTANTS["CHOICEBUILD_LOTS"][4] = CONSTANTS["LOT_CHOICEBUILD_SPEAKER"] -- the LOT of the prop produced by each of the choicebuild indices CONSTANTS["CHOICEBUILD_LOT_BY_INDEX"] = {} CONSTANTS["CHOICEBUILD_LOT_BY_INDEX"][0] = CONSTANTS["LOT_CHOICEBUILD_LASER"] CONSTANTS["CHOICEBUILD_LOT_BY_INDEX"][1] = CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"] CONSTANTS["CHOICEBUILD_LOT_BY_INDEX"][2] = CONSTANTS["LOT_CHOICEBUILD_ROCKET"] CONSTANTS["CHOICEBUILD_LOT_BY_INDEX"][3] = CONSTANTS["LOT_CHOICEBUILD_SPEAKER"] -- the name to use when saving the concert shell particle effect CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"] = {} CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_ROCKET"]] = "flameShellEffect" CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"]] = -1 CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_LASER"]] = -1 CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_SPEAKER"]] = "speakerShellEffect" -- the name to use when saving the concert hill particle effect CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"] = {} CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_ROCKET"]] = -1 CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"]] = "spotlightHillEffect" CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_LASER"]] = "laserHillEffect" CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_SPEAKER"]] = -1 -- the name to use when saving the discoball particle effect CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"] = {} CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_ROCKET"]] = -1 CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"]] = -1 CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_LASER"]] = "laserDiscoballEffect" CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"][CONSTANTS["LOT_CHOICEBUILD_SPEAKER"]] = -1 -- 5023 AG - Stage Rocket OLD 4029 AG Fog Machine Choice Build -- 4891 AG - Stage Spot Light OLD 4030 AG Spotlight Choice Build -- 5024 AG - Stage laser OLD 4031 AG Laser Light Choice Build -- 4858 AG - Speaker OLD 4032 AG Speaker Choice Build local CHOICEBUILDS = nil local ChoicebuildGroup = "CBGroup" -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup(self) registerWithZoneControlObject(self) -- let the bonus script(o_ChoicebuildBonus.lua) know the name of our group SetGroupName( self, ChoicebuildGroup ) self:SetVar( "bAllAlike", false ) end -------------------------------------------------------------- -- notification to object -------------------------------------------------------------- function onNotifyObject(self,msg) if msg.name == "ChoicebuildChanged" then local group = self:GetObjectsInGroup{ group = ChoicebuildGroup, ignoreSpawners = true }.objects -- if we havn't filled in our choicebuilds yet if CHOICEBUILDS == nil then CHOICEBUILDS = {} for i = 1, #group do CHOICEBUILDS[group[i]:GetID()] = -1 end -- tell the bonus script to initialize its copy of the array of indices too InitializeIndices( self ) end --set the choicebuild's current state CHOICEBUILDS[msg.ObjIDSender:GetID()] = msg.param1 -- remember whether they were all alike before this choice local bAlikeBefore = DoAllChoicebuildsMatch( self ) -- pass it on to the bonus script and have it call RewardBonus if all 4 choicebuilds match SetIndex( self, msg.ObjIDSender:GetID(), msg.param1, true ) -- check whether they all match now -- if they were alike and now aren't, make sure the platforms aren't steps anymore -- and that the bonus particles are cancelled local bAlikeNow = DoAllChoicebuildsMatch( self ) if ( bAlikeBefore == true and bAlikeNow == false ) then self:SetVar( "bAllAlike", false ) GAMEOBJ:GetTimer():CancelTimer("StageResetTime", self) SignalMovingPlatforms( self, false ) UpdateParticleEffects( self, -1 ) end elseif ( msg.name == "StoreLargePlatform" ) then storeObjectByName( self, "LargePlatform", msg.ObjIDSender ) elseif ( msg.name == "StoreSmallPlatform" ) then storeObjectByName( self, "SmallPlatform", msg.ObjIDSender ) elseif ( msg.name == "ResetChoiceBuilds" ) then resetCBs( self ) elseif msg.name == "ChoicebuildSmashed" then -- remember that this choicebuild is currently a pile of bricks rather than any of the 4 choices CHOICEBUILDS[msg.ObjIDSender:GetID()] = -1 SetIndex( self, msg.ObjIDSender:GetID(), -1, false ) -- make sure the platforms aren't steps anymore and that the bonus particles are cancelled if ( self:GetVar( "bAllAlike" ) == true ) then self:SetVar( "bAllAlike", false ) GAMEOBJ:GetTimer():CancelTimer("StageResetTime", self) SignalMovingPlatforms( self, false ) UpdateParticleEffects( self, -1 ) end end end -------------------------------------------------------------- -- LoadObjectAtPoint -------------------------------------------------------------- function LoadObjectAtPoint(self, templateID, pathname) local pathMsg = LEVEL:GetPathWaypoints (pathname) if (tostring(type(pathMsg)) == "table") then for i, v in pairs(pathMsg) do RESMGR:LoadObject { objectTemplate = templateID, x = v.pos.x, y = v.pos.y, z = v.pos.z, rw = v.rot.w, rx = v.rot.x, ry = v.rot.y, rz = v.rot.z, owner = self } end end end -------------------------------------------------------------- -- child object loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- store who the parent is storeParent(self, msg.childID) UpdateParticleEffects( self, -1 ) end -------------------------------------------------------------- -- reset the choicebuilds -------------------------------------------------------------- function resetCBs(self) -- cancel any bonus particle effects received from having the choicebuilds match UpdateParticleEffects( self, -1 ) -- if the choicebuilds are already different, then don't reset them because players are already changing them -- we only want to reset them if they are all alike now if ( DoAllChoicebuildsMatch( self ) == false ) then return end --if we have the choicebuilds, ask them to reset if CHOICEBUILDS ~= nil then for k,j in pairs(CHOICEBUILDS) do GAMEOBJ:GetObjectByID(k):RequestActivityExit() end end local group = self:GetObjectsInGroup{ group = ChoicebuildGroup, ignoreSpawners = true }.objects -- reset the choicebuild variables CHOICEBUILDS = {} for i = 1, #group do CHOICEBUILDS[group[i]:GetID()] = -1 end -- tell the bonus script to reset its indices as well InitializeIndices( self ) end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "StageResetTime") then -- tell the stage's moving platforms to move back into their original positions that look like extensions of the stage -- they will send a message back once they're in their original positions, so we can reset the choice builds at that time SignalMovingPlatforms( self, false ) resetCBs(self) end end -------------------------------------------------------------- -- tell the two moving platforms to move to the other configuration -- bSteps should be true if you want them to become steps up to the golden brick -- and false if you want them to look like an extension of the stage -------------------------------------------------------------- function SignalMovingPlatforms( self, bSteps ) local largePlatform = getObjectByName( self, "LargePlatform" ) local smallPlatform = getObjectByName( self, "SmallPlatform" ) local szSignal = "TurnIntoExtensionOfStage" if ( bSteps == true ) then szSignal = "TurnIntoSteps" end if( largePlatform ~= nil and largePlatform:Exists() ) then largePlatform:NotifyObject{ name = szSignal } end if( smallPlatform ~= nil and smallPlatform:Exists() ) then smallPlatform:NotifyObject{ name = szSignal } end end -------------------------------------------------------------- -- returns whether or not the given LOT is one of the choicebuild props -------------------------------------------------------------- function IsValidChoicebuildLOT( LOT ) return ( LOT == CONSTANTS["LOT_CHOICEBUILD_ROCKET"] or LOT == CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"] or LOT == CONSTANTS["LOT_CHOICEBUILD_LASER"] or LOT == CONSTANTS["LOT_CHOICEBUILD_SPEAKER"] ) end -------------------------------------------------------------- -- update the particle effects due to the current state of the 4 choicebuilds -- if one of the choicebuild option indices is passed in, play the corresponding effect and cancel any existing ones -- if -1 is passed in, then cancel any existing effects -------------------------------------------------------------- function UpdateParticleEffects( self, index ) if ( index == -1 ) then CancelAllDiscoballEffects( self ) CancelAllShellEffects( self ) CancelAllHillEffects( self ) else local LOT = CONSTANTS["CHOICEBUILD_LOT_BY_INDEX"][index] UpdateDiscoballEffects( self, LOT ) UpdateShellEffects( self, LOT ) UpdateHillEffects( self, LOT ) end end -------------------------------------------------------------- -- update the discoball particle effects because all 4 props have the given LOT -------------------------------------------------------------- function UpdateDiscoballEffects( self, LOT ) -- get the object that the effects should be attached to local discoballGroup= self:GetObjectsInGroup{ group = CONSTANTS["CHOICEBUILD_DISCOBALL_GROUP"], ignoreSpawners = true }.objects -- get the discoball particle effect info for this LOT local desiredEffectNum = CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"][LOT] local desiredEffectSave = CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"][LOT] local desiredEffectName = CONSTANTS["CHOICEBUILD_EFFECT_NAME"][LOT] -- cancel any other effects on the discoball for LOTindex = 1, #CONSTANTS["CHOICEBUILD_LOTS"] do local testLOT = CONSTANTS["CHOICEBUILD_LOTS"][LOTindex] local testEffectNum = CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"][testLOT] if ( testEffectNum ~= -1 and testEffectNum ~= desiredEffectNum ) then local cancelEffectName = CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"][testLOT] for groupIndex = 1, table.maxn ( discoballGroup ) do discoballGroup[groupIndex]:StopFXEffect{ name = cancelEffectName } end end end -- start the desired effect on the discoball, if there is one if ( desiredEffectNum ~= -1 ) then for i = 1, table.maxn ( discoballGroup ) do --discoballGroup[i]:PlayFXEffect{ name = desiredEffectSave, effectID = desiredEffectNum, effectType = desiredEffectName } discoballGroup[i]:PlayFXEffect{ name = desiredEffectSave, effectType = desiredEffectName } end end end -------------------------------------------------------------- -- update the concert shell particle effects because all 4 props have the given LOT -------------------------------------------------------------- function UpdateShellEffects( self, LOT ) -- get the object that the effects should be attached to local shellGroup= self:GetObjectsInGroup{ group = CONSTANTS["CHOICEBUILD_SHELL_GROUP"], ignoreSpawners = true }.objects -- get the concert shell particle effect info for this LOT local desiredEffectNum = CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"][LOT] local desiredEffectSave = CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"][LOT] local desiredEffectName = CONSTANTS["CHOICEBUILD_EFFECT_NAME"][LOT] -- cancel any other effects on the concert stage for LOTindex = 1, #CONSTANTS["CHOICEBUILD_LOTS"] do local testLOT = CONSTANTS["CHOICEBUILD_LOTS"][LOTindex] local testEffectNum = CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"][testLOT] if ( testEffectNum ~= -1 and testEffectNum ~= desiredEffectNum ) then local cancelEffectName = CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"][testLOT] for groupIndex = 1, table.maxn ( shellGroup ) do shellGroup[groupIndex]:StopFXEffect{ name = cancelEffectName } end end end -- start the desired effect on the shell, if there is one if ( desiredEffectNum ~= -1 ) then for i = 1, table.maxn ( shellGroup ) do --shellGroup[i]:PlayFXEffect{ name = desiredEffectSave, effectID = desiredEffectNum, effectType = desiredEffectName } shellGroup[i]:PlayFXEffect{ name = desiredEffectSave, effectType = desiredEffectName } end end end -------------------------------------------------------------- -- update the concert hill particle effects because all 4 props have the given LOT -------------------------------------------------------------- function UpdateHillEffects( self, LOT ) -- get the object that the effects should be attached to local hillGroup= self:GetObjectsInGroup{ group = CONSTANTS["CHOICEBUILD_HILL_GROUP"], ignoreSpawners = true }.objects -- get the concert shell particle effect info for this LOT local desiredEffectNum = CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"][LOT] local desiredEffectSave = CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"][LOT] local desiredEffectName = CONSTANTS["CHOICEBUILD_EFFECT_NAME"][LOT] -- cancel any other effects on the concert hill for LOTindex = 1, #CONSTANTS["CHOICEBUILD_LOTS"] do local testLOT = CONSTANTS["CHOICEBUILD_LOTS"][LOTindex] local testEffectNum = CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"][testLOT] if ( testEffectNum ~= -1 and testEffectNum ~= desiredEffectNum ) then local cancelEffectName = CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"][testLOT] for groupIndex = 1, table.maxn ( hillGroup ) do hillGroup[groupIndex]:StopFXEffect{ name = cancelEffectName } end end end -- start the desired effect on the shell, if there is one if ( desiredEffectNum ~= -1 ) then for i = 1, table.maxn ( hillGroup ) do --shellGroup[i]:PlayFXEffect{ name = desiredEffectSave, effectID = desiredEffectNum, effectType = desiredEffectName } hillGroup[i]:PlayFXEffect{ name = desiredEffectSave, effectType = desiredEffectName } end end end -------------------------------------------------------------- -- cancel any effects on the discoball -------------------------------------------------------------- function CancelAllDiscoballEffects( self ) -- get the object that any existing effects are attached to local discoballGroup= self:GetObjectsInGroup{ group = CONSTANTS["CHOICEBUILD_DISCOBALL_GROUP"], ignoreSpawners = true }.objects -- cancel any effects on the discoball for LOTindex = 1, #CONSTANTS["CHOICEBUILD_LOTS"] do local nextLOT = CONSTANTS["CHOICEBUILD_LOTS"][LOTindex] local nextEffectNum = CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"][nextLOT] if ( nextEffectNum ~= -1 ) then local cancelEffectName = CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_SAVE"][nextLOT] for groupIndex = 1, table.maxn ( discoballGroup ) do discoballGroup[groupIndex]:StopFXEffect{ name = cancelEffectName } end end end end -------------------------------------------------------------- -- cancel any effects on the concert stage -------------------------------------------------------------- function CancelAllShellEffects( self ) -- get the object that any existing effects are attached to local shellGroup= self:GetObjectsInGroup{ group = CONSTANTS["CHOICEBUILD_SHELL_GROUP"], ignoreSpawners = true }.objects -- cancel any effects on the concert shell for LOTindex = 1, #CONSTANTS["CHOICEBUILD_LOTS"] do local nextLOT = CONSTANTS["CHOICEBUILD_LOTS"][LOTindex] local nextEffectNum = CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"][nextLOT] if ( nextEffectNum ~= -1 ) then local cancelEffectName = CONSTANTS["CHOICEBUILD_SHELL_EFFECT_SAVE"][nextLOT] for groupIndex = 1, table.maxn ( shellGroup ) do shellGroup[groupIndex]:StopFXEffect{ name = cancelEffectName } end end end end -------------------------------------------------------------- -- cancel any effects on the concert hill -------------------------------------------------------------- function CancelAllHillEffects( self ) -- get the object that any existing effects are attached to local hillGroup= self:GetObjectsInGroup{ group = CONSTANTS["CHOICEBUILD_HILL_GROUP"], ignoreSpawners = true }.objects -- cancel any effects on the concert shell for LOTindex = 1, #CONSTANTS["CHOICEBUILD_LOTS"] do local nextLOT = CONSTANTS["CHOICEBUILD_LOTS"][LOTindex] local nextEffectNum = CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"][nextLOT] if ( nextEffectNum ~= -1 ) then local cancelEffectName = CONSTANTS["CHOICEBUILD_HILL_EFFECT_SAVE"][nextLOT] for groupIndex = 1, table.maxn ( hillGroup ) do hillGroup[groupIndex]:StopFXEffect{ name = cancelEffectName } end end end end -------------------------------------------------------------- -- called by the bonus script when we just set the index on one of the choicebuilds -- and now they all match -------------------------------------------------------------- function RewardBonus( self, index ) self:SetVar( "bAllAlike", true ) -- start a timer to reset the choicebuilds GAMEOBJ:GetTimer():AddTimerWithCancel( 30.0 , "StageResetTime", self ) -- tell the stage's moving platforms to move so that they become steps up to the golden brick SignalMovingPlatforms( self, true ) UpdateParticleEffects( self, index ) end -------------------------------------------------------------- -- Server-side death trigger that will kill the player with a -- specific animation. Change the Custom Variables to fit your -- needs. -- mrb... 5/21/09 -- djames: updated 9/28/09 -------------------------------------------------------------- local deathAnimation = "big-shark-death" function onFireEventServerSide(self, msg) if (msg.args == "achieve" ) then -- Note the reverse order of the updates; if you don't do it this way, it will update 445 and then immediately update 446 which we don't want in the same death. msg.senderID:UpdateMissionTask{taskType = "complete", value = 447, value2 = 1, target = self} msg.senderID:UpdateMissionTask{taskType = "complete", value = 446, value2 = 1, target = self} msg.senderID:UpdateMissionTask{taskType = "complete", value = 445, value2 = 1, target = self} end end function onCollisionPhantom(self, msg) if msg.objectID:GetFaction().faction == 1 then msg.objectID:RequestDie{killerID = self, deathType = deathAnimation} else msg.objectID:RequestDie{killerID = self, killType = VIOLENT} end end-------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == 2) then -- Set to Darkling hated smashable faction self:SetFaction{ faction = 16 } local MortarList = self:GetObjectsInGroup{group = "Mortar_"..self:GetVar("target")}.objects local awesome = self:GetVar("target") for i = 1, #MortarList do MortarList[i]:CastSkill{skillID = 318 ,optionalTargetID = self } end end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 1 local iplayer = "" function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- ---------------------------------- --Turns the AI Off so the unbuilt bricks do not attack the darkling. setState("AiDisable",self) ----------------------------------* end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } --------------------------------------- -- Testing drop loot instead of cast skill -- setState("AiEnable",self) -- self:CastSkill{skillID = 201} ----------------------------------------- self:SetVar("DieTime", 25) self:SetVar("DropLifeTime", 3) self:SetVar("DropArmorTime", 6) self:SetVar("DropImagTime", 4) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DropLifeTime") , "DropLifeTime", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DropArmorTime") , "DropArmorTime", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DropImagTime") , "DropImagTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end --Gets the player that built the generator -- Commented out for the time being just in case we need it. function onRebuildStart(self, msg) -- storeObjectByName (self, "playerID", msg.userID ) iplayer = msg.userID end ------------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end if msg.name == "DropLifeTime" then local newID = GAMEOBJ:GenerateSpawnedID() self:DropLoot{itemTemplate = 177,owner = iplayer, lootID = newID, rerouteID = iplayer, sourceObj = self} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DropLifeTime") , "DropLifeTime", self ) end if msg.name == "DropArmorTime" then local newID2 = GAMEOBJ:GenerateSpawnedID() GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DropArmorTime") , "DropArmorTime", self ) self:DropLoot{itemTemplate = 6431,owner = iplayer, lootID = newID2, rerouteID = iplayer, sourceObj = self} end if msg.name == "DropImagTime" then GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DropImagTime") , "DropImagTime", self ) local newID1 = GAMEOBJ:GenerateSpawnedID() self:DropLoot{itemTemplate = 935,owner = iplayer, lootID = newID1, rerouteID = iplayer, sourceObj = self} end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- constants -------------------------------------------------------------- CONSTANTS["HOTDOG_CART_RESPAWN_DELAY"] = 10.0 -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup(self) registerWithZoneControlObject(self) --self:PlayAnimation{ animationID = "idle" } burno1Time = 4.3333 -- time for burno1 animation to play before calling on burno2 burno2Time = 5.2 -- time for burno2 animation to play before calling on burno3 end -------------------------------------------------------------- -- child loaded (the hotdog cart) -------------------------------------------------------------- -- store the hotdog cart so we can check its state function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["LOT_BURNO_HOTDOG_CART"] ) then storeParent( self, msg.childID ) end end -------------------------------------------------------------- -- notify object --the rebuild state changed --or the zone script just let us know that we're ready to spawn the cart the first time -------------------------------------------------------------- function onNotifyObject( self, msg ) if ( msg.name == "loadCart" ) then LoadHotdogCart( self ) -- if the rebuild is complete elseif ( msg.name == "rebuildDone" ) then -- start a timer to notify when to change animations GAMEOBJ:GetTimer():CancelAllTimers(self) GAMEOBJ:GetTimer():AddTimerWithCancel( burno1Time, "justFixedCart", self ) -- play the burno1 love animation self:PlayAnimation{ animationID = "burno1" } -- if the player is fixing the cart elseif ( msg.name == "rebuildFixing" ) then -- play the build hover happy animation self:PlayAnimation{ animationID = "build" } -- if the player fixing the cart used the UI button to cancel the quickbuild partway through elseif ( msg.name == "rebuildCancelled" ) then GAMEOBJ:GetTimer():CancelAllTimers(self) LoadHotdogCart( self ) end end -------------------------------------------------------------- -- timers -------------------------------------------------------------- -- when one of the animation timers is done function onTimerDone(self, msg) -- when burno2 anim is done if msg.name == "burno2Timer" then -- play the burno3 anim self:PlayAnimation{ animationID = "burno3" } -- when the burno1 timer ends. elseif msg.name == "justFixedCart" then -- play burno2 anim self:PlayAnimation{ animationID = "burno2" } -- start timer for anim GAMEOBJ:GetTimer():CancelAllTimers(self) GAMEOBJ:GetTimer():AddTimerWithCancel( burno2Time, "burno2Timer", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["HOTDOG_CART_RESPAWN_DELAY"], "respawnCart", self ) elseif msg.name == "respawnCart" then LoadHotdogCart( self ) end end -------------------------------------------------------------- -- spawn the hotdog cart -------------------------------------------------------------- function LoadHotdogCart( self ) --Get Burno's position and rotation for use in spawning the hotdog cart local mypos = self:GetPosition().pos local myRot = self:GetRotation() --This is the offset distance for the cart local offsetDist = { x = -12.0, y = 0.0, z = 7.0 } --set the position for the cart local newPos = self:GetParallelPosition{ referenceObject = self, offset = offsetDist }.newPosition -- raise the y a bit to make sure that the bricks fall down onto the path and not through it --use this string to get the rebuild activator to spawn properly -- March 31, 2009 note: -- we need to offset the activator a little since the player is now repositioned based on where the activator is -- if we don't adjust the y, then the player moves below the pathway or the bricks fall through it -- we also adjust the x and z so that the player isn't standing in the middle of where the cart is built local posString = self:CreatePositionString{x = newPos.x + 1.25, y = newPos.y + 2.0, z = newPos.z + 1.25 }.string local config = {{"rebuild_activators", posString}} --load in the cart RESMGR:LoadObject { objectTemplate = 4046, x= newPos.x, y= newPos.y , z= newPos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config} end ---- Moves the bus door while players are close to it. ---- Updated: 7/01/09 jnf... ---- Updated: 5/19/10 djames... added second proxy radius and outerCounter -- the logic behind opening and closing the door is based on two proximity radii -- it is possible for players to leave the proximity sphere unintentionally -- when the bus moves up because the sphere moves with the bus -- by maintaining two counters, for both the inner and outer radii, players will -- only be considered "in" proximity if they are inside both radii and they will -- only be considered "out" of proximity if they are outside both radii local ProxRadius = 75 -- the radius for "inner" proximity detection local OuterProxRadius = 85 -- the radius for "outer" proximity detection local soundName = '{9a24f1fa-3177-4745-a2df-fbd996d6e1e3}' function onStartup(self) self:SetVar("counter", 0) self:SetVar("outerCounter", 0) self:SetProximityRadius{radius = ProxRadius, name = "busDoor"} self:SetProximityRadius{radius = OuterProxRadius, name = "busDoorOuter"} self:StopPathing() end function moveDoor(self, bOpen) --print('move door **************') if bOpen then --print('open door **************') self:GoToWaypoint{iPathIndex = 0} else --print('close door **************') self:GoToWaypoint{iPathIndex = 1} end self:PlayNDAudioEmitter{m_NDAudioEventGUID = soundName} end function onProximityUpdate(self, msg) -- If this isn't the proximity radius for the bus door behavior, then we're done here if (msg.name ~= "busDoor" and msg.name ~= "busDoorOuter") then return end local faction = msg.objId:GetFaction() -- Make sure only humans are taken into account if faction.faction ~= 1 then return end local counter = self:GetVar("counter") local outerCounter = self:GetVar("outerCounter") if (msg.status == "ENTER") then if (msg.name == "busDoor") then counter = counter + 1 elseif (msg.name == "busDoorOuter") then outerCounter = outerCounter + 1 end -- move up when a player is inside both radii if (counter == 1 and outerCounter >= 1) then moveDoor(self, true) end elseif (msg.status == "LEAVE") then if (msg.name == "busDoor") then if counter > 0 then counter = counter - 1 end elseif (msg.name == "busDoorOuter") then if outerCounter > 0 then outerCounter = outerCounter - 1 end end -- move down when no players are inside either radii if (counter == 0 and outerCounter == 0) then moveDoor(self, false) end end --print('proximity update: status='..msg.status..', name='..msg.name..', counter='..counter..', outerCounter='..outerCounter) self:SetVar("counter", counter) self:SetVar("outerCounter", outerCounter) end function onArrivedAtDesiredWaypoint(self, msg) if msg.iPathIndex == 1 then self:PlayFXEffect{ name = "busDust", effectType = "create"} -- effectID = 642, --print('play effect busDust') end end --------------------------------------------------------------------------------------------------------- -- Server-side script for Concert instrument Quick Builds. --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup( self, msg ) -- needs to register with the server-side zone script -- in case the player exits, logs out, etc. while playing an instrument. -- the server-side zone script receives a PlayerExit msg, which it can then pass on to the instruments registerWithZoneControlObject( self ) end -------------------------------------------------------------- -- Event from client-side -------------------------------------------------------------- function onFireEventServerSide( self, msg ) if ( msg.args == "reset" ) then self:RebuildReset{} elseif ( msg.args == "playInstrumentAnim" ) then msg.senderID:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_ANIM"][msg.param1], fPriority = 4.0 } self:NotifyClientObject{ name = "checkInstrumentAnim" } elseif ( msg.args == "playSmashAnim" ) then msg.senderID:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_SMASH_ANIM"][msg.param1], fPriority = 4.0 } elseif ( msg.args == "startMusic" ) then AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][msg.param1], true ) storeObjectByName( self, "musicPlayer", msg.senderID ) elseif ( msg.args == "stopMusic" ) then AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][msg.param1], false ) self:SetVar( "musicPlayer", nil ) elseif ( msg.args == "stopPlaying" ) then self:NotifyClientObject{ name = "stopPlaying", paramObj = msg.senderID } elseif ( msg.args == "loadEquippables" ) then self:NotifyClientObject{ name = "loadEquippables", paramObj = msg.senderID } elseif ( msg.args == "reequipItem" ) then ReequipInventoryItem( msg.senderID, msg.param1 ) end end -------------------------------------------------------------- -- Start or stop the given the music -------------------------------------------------------------- function AlterMusic( self, szMusicName, bActivate ) local soundRepeaters = self:GetObjectsInGroup{ group = "ConcertSoundRepeater", ignoreSpawners = true }.objects for i = 1, table.maxn (soundRepeaters) do if ( bActivate ) then soundRepeaters[i]:ActivateNDAudioMusicCue{ m_NDAudioMusicCueName = szMusicName } else soundRepeaters[i]:DeactivateNDAudioMusicCue{ m_NDAudioMusicCueName = szMusicName } end end end -------------------------------------------------------------- -- object notification from server-side zone script -------------------------------------------------------------- function onNotifyObject( self, msg ) if ( msg.name == "playerExit" ) then CancelMusicIfPlayerLeft( self, msg.ObjIDSender ) StopPlayingIfPlayerLeft( self, msg.ObjIDSender ) end end -------------------------------------------------------------- -- a player left the zone -- they could have exited via the x, the menu, or slash command -- or logged out via the menu or slash command -- or gone back to Character Select via the menu -- or had a client crash -- or the map could have been reloaded -- check if the player that left was the one playing this instrument -- if so, stop the music -------------------------------------------------------------- function CancelMusicIfPlayerLeft( self, exitPlayer ) local musicPlayer = getObjectByName( self, "musicPlayer" ) if ( musicPlayer == nil ) then return end -- if the player that left was the one playing this instrument, stop the music if ( self:GetVar( "musicPlayer" ) == exitPlayer:GetID() ) then local myLOT = self:GetLOT{}.objtemplate AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][myLOT], false ) -- also, make sure that if the player who left logs back in, -- other clients don't see it come in doing the instrument animation musicPlayer:PlayAnimation{ animationID = "ben_is_king", fPriority = 4.0 } self:SetVar( "musicPlayer", nil ) end end -------------------------------------------------------------- -- a player left the zone -- they could have exited via the x, the menu, or slash command -- or logged out via the menu or slash command -- or gone back to Character Select via the menu -- or had a client crash -- or the map could have been reloaded -- tell the client-side script to check if the player that left was the one playing this instrument -- and if so, forget about them -------------------------------------------------------------- function StopPlayingIfPlayerLeft( self, exitPlayer ) self:NotifyClientObject{ name = "playerLeft", paramObj = exitPlayer } end -------------------------------------------------------------- -- before playing the instrument, any inventory items the player had in-hand were unequipped -- re-equip the one with the given LOT now -------------------------------------------------------------- function ReequipInventoryItem( player, LOT ) -- go through the player's inventory and find the slot that holds this LOT -- once we find it, re-equip that item local numInventoryItems = player:GetInventorySize{ inventoryType = 1 }.size -- 1 is INVENTORY_DEFAULT in lwoCommon / include / InventoryTypes.h for i = 0, numInventoryItems do local checkItem = player:GetInventoryItemInSlot{ slot = i }.itemID if ( checkItem:Exists() ) then if ( checkItem:GetLOT().objtemplate == LOT ) then local invItem = player:GetInventoryItemInSlot{ slot = i }.itemID player:EquipInventory{ itemtoequip = invItem } end end -- end Exists() end -- end for loop end function onRebuildNotifyState( self, msg) if ( msg.iState == 4 ) then local choicebuild = self:GetParentObj().objIDParent GAMEOBJ:GetZoneControlID():NotifyObject{ name = "ChoicebuildSmashed", ObjIDSender = choicebuild } end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["QuickbuildTurretLOT"] = 6254 CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ ////////////////////////////////////////////////////////////////////////////////w _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 3 -- Min Wander Delay Set['WanderDelayMax'] = 6 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- ------ --self:SetVar("PrepTime", 10) --setState("AiDisable",self) --GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("PrepTime") , "PrepTime", self ) --self:ActivatePhysics{bActive = false} self:SetFaction{faction = 4} end -------------------------------------------------------------------------------- -- onTemplateDie -- -- Notes: Called when onDie occurs in the master template script attached -- to this 'robotanist'. -------------------------------------------------------------------------------- function onTemplateDie(self, msg) --print("TEMPLATE DIE") setState("AiDisable",self) local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x, y = mypos.y, z = mypos.z }.string local myRot = self:GetRotation() local parent = msg.killerID; local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true}, {"currentTime", 0} , {"CheckPrecondition" , "21"} } local terrainY = PHYSICS:GetTerrainHeightPosition(mypos.x, mypos.y, mypos.z); mypos.y = terrainY RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildTurretLOT"], x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config, owner = parent } end --[[ ------------------------ -- Tells the robot to turn on AI and Physics and start working ------------------------- onTimerDone = function(self, msg) if msg.name == "PrepTime" then self:SetFaction{faction = 4} setState("AiEnable",self) self:ActivatePhysics{bActive = true} ProximityPuls(self) end end --]]require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["QuickbuildTurretLOT"] = 8432 CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ ////////////////////////////////////////////////////////////////////////////////w _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 0 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- ------ --self:SetVar("PrepTime", 10) --setState("AiDisable",self) --GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("PrepTime") , "PrepTime", self ) --self:ActivatePhysics{bActive = false} self:SetFaction{faction = 4} end -------------------------------------------------------------------------------- -- onTemplateDie -- -- Notes: Called when onDie occurs in the master template script attached -- to this 'robotanist'. -------------------------------------------------------------------------------- function onTemplateDie(self, msg) --print("TEMPLATE DIE") setState("AiDisable",self) local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x, y = mypos.y, z = mypos.z }.string local myRot = self:GetRotation() local parent = msg.killerID; local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true}, {"currentTime", 0} , {"CheckPrecondition" , "21"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildTurretLOT"], x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config, owner = parent } end --[[ ------------------------ -- Tells the robot to turn on AI and Physics and start working ------------------------- onTimerDone = function(self, msg) if msg.name == "PrepTime" then self:SetFaction{faction = 4} setState("AiEnable",self) self:ActivatePhysics{bActive = true} ProximityPuls(self) end end --]]require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 25 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 6 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 200 return msg end function onDie(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Spiderling", param1 = 200, ObjIDSender = msg.killerID} end -- Designed for use with the wall trigger object, will move -- player which ever direction you rotate the z axis(the up face in HF) -- Created: 4/29/09 mrb... local pID = nil local forceMod = 2 function onStartup(self) self:SetVar('isOn', true) self:SetVar('isColliding', false) end -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided if msg.objectID and self:GetVar('isOn') then self:SetVar('isColliding', true) pID = msg.objectID GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PushTimer", self) end end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) -- Says we have finished colliding tries to resetBox() if msg.objectID then self:SetVar('isColliding', false) --print('Exiting') pID = nil forceMod = 2 end end function onTimerDone(self, msg) if not pID then return end -- keep pushing while isColliding == true if msg.name == "PushTimer" and self:GetVar('isColliding') and self:GetVar('isOn') then local oDir = {z = self:GetVar('DirX'),y = self:GetVar('DirY'),x = self:GetVar('DirZ')} -- pushes the player back based on the forceMod * the z rotation of the object pID:Knockback{vector={x=oDir.x,y=oDir.y ,z=forceMod * oDir.z}} -- tick the forceMod to get the player out forceMod = forceMod + 0.5 -- start the next timer GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PushTimer", self) end end function onFireEvent(self, msg) if msg.args == 'off' then self:SetVar('isOn', false) end if msg.args == 'on' then self:SetVar('isOn', true) end end function onStartup(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 10.0, "Asplode",self ) --self:PlayFXEffect{name = "kaboom", effectType = "boom"} GAMEOBJ:GetTimer():AddTimerWithCancel( 1.7, "BOOMIES",self ) self:SetVar("posx", self:GetPosition().pos.x ) self:SetVar("posy", self:GetPosition().pos.y ) self:SetVar("posz", self:GetPosition().pos.z ) self:SetVar("rotx", self:GetRotation{}.x) self:SetVar("roty", self:GetRotation{}.y) self:SetVar("rotz", self:GetRotation{}.z) self:SetVar("rotw", self:GetRotation{}.w) end function onTimerDone(self, msg) if msg.name == "Asplode" then local superran = math.random(-20,20) local timerran = math.random(0,10) self:SetPosition{pos = {x = self:GetVar("posx") + superran, y = self:GetVar("posy"), z = self:GetVar("posz") + superran}} self:SetRotation{x=self:GetVar("rotx"), y=self:GetVar("roty"), z=self:GetVar("rotz"), w=self:GetVar("rotw")} GAMEOBJ:GetTimer():AddTimerWithCancel( (10.0 + timerran), "Asplode",self ) -- GAMEOBJ:GetTimer():AddTimerWithCancel( 1.7, "BOOMIES",self ) self:CastSkill{skillID = 318} --self:PlayFXEffect{name = "kaboom", effectType = "boom"} -- elseif msg.name == "BOOMIES" then end endrequire('o_mis') function onStartup(self) self:SetVar('isOn', false) self:SetVar('isAlive', true) toggleFX(self) self:PlayFXEffect{name = "fanOn", effectID = 495, effectType = "fanOn"} end function toggleFX(self, isHit) local myGroup = string.gsub(self:GetVar("groupID"),"%;","") local volumeGroup = self:GetObjectsInGroup{ group = myGroup, ignoreSpawners = true }.objects if not volumeGroup or not self:GetVar('isAlive') then return end if self:GetVar('isOn') then --print('turnOn fan physics off ') self:PlayAnimation{animationID = 'fan-off', bPlayImmediate = true} self:StopFXEffect{name = "fanOn"} for i = 1, table.maxn ( volumeGroup ) do volumeGroup[i]:SetPhysicsVolumeEffectStatus{bActive = false} self:SetVar('isOn', false) if not isHit then self:GetObjectsInGroup{ group = myGroup .. 'fx', ignoreSpawners = true }.objects[1]:PlayAnimation{animationID = 'trigger', bPlayImmediate = true} end end elseif not self:GetVar('isOn') and self:GetVar('isAlive') then --print('turnOn fan physics on ') self:PlayAnimation{animationID = 'fan-on', bPlayImmediate = true} self:PlayFXEffect{name = "fanOn", effectID = 495, effectType = "fanOn"} for i = 1, table.maxn ( volumeGroup ) do volumeGroup[i]:SetPhysicsVolumeEffectStatus{bActive = true} self:SetVar('isOn', true) if not isHit then self:GetObjectsInGroup{ group = myGroup .. 'fx', ignoreSpawners = true }.objects[1]:PlayAnimation{animationID = 'idle', bPlayImmediate = true} end end end end function onFireEvent( self, msg ) -- check to make sure there is a message associated with the FireEvent --print('Fired Event') if not msg.args or not self:GetVar('isAlive') then return end local fText = split(msg.args, ',')[1] --print(fText) if (fText == 'turnOn' and self:GetVar('isOn')) or (fText == 'turnOff' and not self:GetVar('isOn')) then return end toggleFX(self) end function onOnHit(self, msg) --print('died') if self:GetVar('isOn') then toggleFX(self, true) end self:SetVar('isAlive', false) end -------------------------------------------------------------- -- (SERVER SIDE) Script for old man sherland -- scene 3 -- -- Interacts with players in proximity and animates. -- [proxDistance] : set in config data for proximity distance -------------------------------------------------------------- -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- local defaultProx = 15.0 -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) if msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 then self:StopPathing() GAMEOBJ:GetTimer():CancelAllTimers( self ) self:FaceTarget{target = msg.objId, degreesOff = 25, keepFacingTarget = true, bInstant = true} self:PlayAnimation{animationID = "missionState1"} elseif msg.status == "LEAVE" and msg.objId:GetFaction().faction == 1 then GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "ProxCheck",self ) end end -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) local myProx = self:GetVar("proxDistance") if not (myProx) then myProx = defaultProx end self:SetProximityRadius{radius = myProx} -- From Old AG. The Current Felix does not follow a path. --Only commented and not deleted in case a path is added at a later date. --self:FollowWaypoints() end -------------------------------------------------------------- -- Determines if any players are currently in proximity -------------------------------------------------------------- function ArePlayersInProximity(self) local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then return true; end index = index + 1 end return false; end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- check for players in proximity if (msg.name == "ProxCheck") then if (ArePlayersInProximity(self) == false) then --Commented out as current Felix is not on a path. Did not delete in case Felix is added to a path later. --self:FollowWaypoints() end end end-- This script is attached to the [server] finish line quickbuild in AG. -- It handles ending the player's cinematic if the build is cancelled. function onRebuildCancel(self, msg) --print('onRebuildCancel') local player = msg.userID if player:Exists() then player:EndCinematic() end end function onStartup( self ) self:SetVar( "bFinishedBuild", false ) end function onRebuildNotifyState(self, msg) local Burno = self:GetParentObj().objIDParent if( Burno == nil or Burno:Exists() == false ) then return end -- a player just did the quickbuild. if (msg.iState == 3) then self:SetVar( "bFinishedBuild", true ) Burno:NotifyObject{ ObjIDSender = self, name = "rebuildDone" } -- a player is currently fixing me elseif (msg.iState == 1) then Burno:NotifyObject{ ObjIDSender = self, name = "rebuildFixing" } -- the quickbuild is being reset either -- because a player finished it or -- because a player was doing the quickbuild, but used the UI button to exit before finishing it elseif ( msg.iState == 4 ) then if ( self:GetVar( "bFinishedBuild" ) == true ) then self:SetVar( "bFinishedBuild", false ) else Burno:NotifyObject{ ObjIDSender = self, name = "rebuildCancelled" } end end end -- KEEPING THIS AROUND JUST IN CASE -- This is the state to tell Burno that the cart is broken. Don't need it due to timers and idles. --if (msg.iState == 0) then -- The cart(me) just broke -- local Burno = self:GetParentObj().objIDParent -- if( Burno ~= nil and Burno:Exists() ) then -- Burno:NotifyObject{ ObjIDSender = self, name = "rebuildBroken" } -- end --endrequire('o_mis') function onDie(self, msg) local BobMissionStatus = msg.killerID:GetMissionState{missionID = 173}.missionState -- If the spaceman bob mission is complete. if ( BobMissionStatus >= 8 ) then local amount = math.random(1, 2) for i = 1, amount, 1 do local newID = GAMEOBJ:GenerateSpawnedID() self:DropLoot{ itemTemplate = 935, owner = msg.killerID, lootID = newID, rerouteID = msg.killerID, sourceObj = self } end end crateAnimal(self) end function crateAnimal(self) local mypos = self:GetPosition().pos -- How often do we spawn weird creatures local funnychance = math.random(0, 25) -- What kind of creatures do we want? Will be expanded in the future. local animaltype = 1 if funnychance == 1 then if animaltype == 1 then -- Spawn the Crate Chicken RESMGR:LoadObject { objectTemplate = 8114 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, bIsSmashable = false } end end endfunction onStartup(self) math.randomseed( os.clock() * 1000 ) --print('randomseed ' .. os.clock()* 1000) end function onUse(self, msg) if self:GetLOT().objtemplate == 6859 and not self:GetVar('isInUse') then --print('pass sever') local obj = self:GetObjectsInGroup{ group = "Jet_FX", ignoreSpawners = true }.objects[1] self:NotifyClientObject{name = 'toggleInUse', param1 = 1} self:SetVar('isInUse', true) obj:PlayAnimation{ animationID = "jetFX" } self:PlayFXEffect{name = "radarDish", effectType = "create", effectID = 641} GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "radarDish", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.5, "PlayEffect", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( LEVEL:GetCinematicInfo( "Jet_Cam_01" )+5, "CineDone", self ) end end function onRebuildComplete(self, msg) if self:GetLOT().objtemplate == 6209 then local obj = self:GetObjectsInGroup{ group = "Jet_FX", ignoreSpawners = true }.objects[1] local objGroup = self:GetVar("groupID") or "" obj:PlayAnimation{ animationID = "jetFX" } if string.gsub(objGroup,"%;","") == "Base_Radar" then GAMEOBJ:GetTimer():AddTimerWithCancel( 2.5, "PlayEffect", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( LEVEL:GetCinematicInfo( "Jet_Cam_01" )+5, "CineDone", self ) end end end function onTimerDone (self,msg) if (msg.name == "radarDish") then self:StopFXEffect{name = msg.name} elseif (msg.name == "PlayEffect") then -- group name = mortarMain local obj = self:GetObjectsInGroup{ group = "mortarMain", ignoreSpawners = true }.objects local test = math.random(1,#obj) --print(test .. " --> " .. #obj) if test > 0 then obj[test]:CastSkill{ skillID = 318 } end elseif (msg.name == "CineDone") then self:NotifyClientObject{name = 'toggleInUse', param1 = -1} self:SetVar('isInUse', false) end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetVar("FireTime", math.random(1, 3)) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("FireTime") , "FireTime", self ) end ------------------------- -- Check Timers and fire skill ------------------------- onTimerDone = function(self, msg) if msg.name == "FireTime" then self:CastSkill{skillID = 204} self:SetVar("FireTime", math.random(1, 3)) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("FireTime") , "FireTime", self ) end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 16 function onStartup(self) self:SetProximityRadius { radius = 0, name = "spiderProx" } self:SetVar("built", 0) self:SetVar("TickTime", 1) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then print("*******faction change ENABLED*******") -- Set to Darkling hated smashable faction self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } self:SetProximityRadius { radius = 60 } --self:SetVar("TickTime", 1) -- GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) self:SetVar("built", 1) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end -- Checks to see if the collector casts its stun and updates the mission if it did. -- This is a temporary solution and only works for 1 player. function onCastSkill(self, msg) local player = getObjectByName(self, "playerID") if player ~= nil then player:UpdateMissionTask{target = self, value = 1, value2 = 1, taskType = "kill"} local SurvivalMissionState = player:GetMissionState{ missionID = 335 }.missionState --- If the mission requirements are done, kill the collector and start a timer to zone the player out. if (SurvivalMissionState == 4 or SurvivalMissionState == 12) and self:GetHealth{}.health < 500 then self:SetVar("ExitTime", 5) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("ExitTime") , "ExitTime", self ) self:SetMaxHealth{health = 9999} self:SetHealth{health = 9999} end end end --Gets the player that built the collector so we can update the mission for that player. function onRebuildStart(self, msg) storeObjectByName (self, "playerID", msg.userID ) end ------------------------- -- Check if the timer for the force exit is done, then zone player. ------------------------- onTimerDone = function(self, msg) if msg.name == "ExitTime" then local player = getObjectByName(self, "playerID") if player ~= nil then --player:TransferToZone{ zoneID = 22 } player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end end if msg.name == "TickTime" then -- print("%%%%%%%%%%pulsing this prox") self:CastSkill{skillID = 193} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end end ----------------------- --Checking Proximity for spiderlings ----------------------- function onProximityUpdate(self, msg) if msg.status == "ENTER" and self:GetVar("built") == 1 then local faction = msg.objId:GetFaction() if faction and faction.faction == 35 then GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) -- print("@@@@found critter in prox") --self:CastSkill{skillID = skillID, optionalTargetID = msg.objId} end end if msg.status == "LEAVE" and self:GetVar("built") == 1 then local faction = msg.objId:GetFaction() if faction and faction.faction == 35 then -- print("+++++++++++++++++Critter left the prox") GAMEOBJ:GetTimer():CancelTimer("TickTime", self) end end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- On startup -------------------------------------------------------------- function onStartup(self) registerWithZoneControlObject(self) end local lootLOT = 935 -- LOT of the loot object to spawn local numToSpawn = 3 -- number of loot objects to spawn local cooldownTime = 5 -- how long to wait before you can interact with the object again function onUse(self, msg) msg.user:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} if self:GetVar("bActive") then return end local player = msg.user self:SetVar("bActive", true) for i = 1, numToSpawn do local newSpawner = GAMEOBJ:GenerateSpawnedID() self:DropLoot{owner = player, lootID = newSpawner, itemTemplate = lootLOT, rerouteID = player, sourceObj = self} end GAMEOBJ:GetTimer():AddTimerWithCancel( cooldownTime , "InteractionCooldown", self ) end function onTimerDone(self, msg) if msg.name == "InteractionCooldown" then self:SetVar("bActive", false) end end function onCollisionPhantom(self,msg) if msg.objectID:GetFaction().faction == 1 then self:CastSkill{skillID = 692} end endlocal qbPlayer = '' local qbPlayerStartTime = 1 local startTime = 8 local killTime = 10 local proxRadius = 5 -- Gets everything setup correctly at startup function onStartup(self) end function onRebuildComplete( self, msg ) if ( msg ) then self:SetProximityRadius{radius = proxRadius} qbPlayer = msg.userID:GetID() GAMEOBJ:GetTimer():AddTimerWithCancel(killTime, "KillTimer", self ) self:StopPathing() end end function onProximityUpdate(self, msg) if self:GetVar("qbPlayerRdy") then return end if msg.status == "ENTER" then local target = msg.objId local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 and not self:GetVar("qbPlayerRdy") then GAMEOBJ:GetTimer():CancelTimer('KillTimer', self) if target:GetID() == qbPlayer and not self:GetVar("qbPlayerRdy") then --print('player collided') GAMEOBJ:GetTimer():CancelAllTimers(self) self:SetVar("qbPlayerRdy", true) self:StartPathing() elseif not self:GetVar("ElevatorRdy") then GAMEOBJ:GetTimer():AddTimerWithCancel(startTime, "StartElevator", self ) end self:SetVar("ElevatorRdy") end end end -- timers... function onTimerDone(self, msg) if msg.name == "StartElevator" then self:StartPathing() end if msg.name == "KillTimer" then GAMEOBJ:DeleteObject(self) end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 1 function onStartup(self) --self:SetVar("TickTime", 1) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. -- self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } GAMEOBJ:GetZoneControlID():NotifyObject{ name="built", ObjIDSender= self} end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end --[[ function onDie(self, msg) --GAMEOBJ:GetZoneControlID():NotifyObject{ name="qbdead", param1 = 200, ObjIDSender = msg.killerID} end --]]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 endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["StrombieFaction"] = 103 CONSTANTS["CorruptedRobotanistFaction"] = 102 CONSTANTS["QuickbuildRobotanistLOT"] = 4928 function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 80 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -- onTemplateHit -- -- Notes: Called when onHit occurs in the master template script attached -- to this 'robotanist'. -------------------------------------------------------------------------------- function onTemplateHit(self, msg) local attackerFaction = msg.attacker:GetFaction().faction -- If it is a Maelstrom Zombie if ( attackerFaction == CONSTANTS["StrombieFaction"] ) then --print("*****CHANGING FACTION*****") self:SetFaction{ faction = CONSTANTS["CorruptedRobotanistFaction"] } -- Add one health to the robotanist to account for damage taken from Maelstrom Zombie. local inHealth = self:GetHealth().health self:SetHealth{ health = inHealth + 1 } -- Attach corrupted effect -- What happens if we attach this effect, and then someone in the distance comes closer and -- the robotanists ghosts in, will they see the effect? self:PlayFXEffect{ name = "corrupt", effectType = "maelstrom"} self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) end end -------------------------------------------------------------------------------- -- onTemplateDie -- -- Notes: Called when onDie occurs in the master template script attached -- to this 'robotanist'. -------------------------------------------------------------------------------- function onTemplateDie(self, msg) print("TEMPLATE DIE") local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x, y = mypos.y, z = mypos.z }.string local myRot = self:GetRotation() local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true} } RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildRobotanistLOT"], x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["QuickbuildRobotanistLOT"] = 4928 CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 80 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -- onTemplateDie -- -- Notes: Called when onDie occurs in the master template script attached -- to this 'robotanist'. -------------------------------------------------------------------------------- function onTemplateDie(self, msg) --print("TEMPLATE DIE") local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x, y = mypos.y, z = mypos.z }.string local myRot = self:GetRotation() local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true} }--, {"pathset", self:GetVar("pathset") } , {"SpawnedVar", self:GetVar("SpawnedVar") } } RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildRobotanistLOT"], x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config } end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then --print("*******AI ENABLED*******") setState("AiEnable",self) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then --print("*******AI DISABLED*****") setState("AiDisable",self) end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onTemplateDie (self, msg ) if msg == true then end end --[[ -- Advanced Functions and Events tied to the template function onTemplateChangeWaypoints(self, msg) -- called on an object when the waypoint event for Changing Waypoints happens -- return true to halt process in the AI system end function onTemplateProximityUpdate (self, msg) end function onTemplateTimerDone (self, msg ) end function onTemplateHit (self, msg ) end function onTemplateDie (self, msg ) end function onTemplateLeftTetherRadius ( self, msg ) end --]] function onFireEventServerSide( self, msg ) if ( msg.args == "zonePlayer" ) then -- the mosaic portal needs to do this, but it doesn't exist server-side. asking this object to do it instead. msg.senderID:TransferToZone{ zoneID = 312 } --instance type single end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["StrombieFaction"] = 103 CONSTANTS["CorruptedRobotanistFaction"] = 102 CONSTANTS["FriendlyRobotanistFaction"] = 104 CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["QuickbuildRobotanistLOT"] = 4928 function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 80 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- setState("AiDisable",self) end -------------------------------------------------------------------------------- -- onTemplateHit -- -- Notes: Called when onHit occurs in the master template script attached -- to this 'robotanist'. -------------------------------------------------------------------------------- function onTemplateHit(self, msg) local attackerFaction = msg.attacker:GetFaction().faction -- If it is a Maelstrom Zombie if ( attackerFaction == CONSTANTS["StrombieFaction"] ) then self:SetFaction{ faction = CONSTANTS["CorruptedRobotanistFaction"] } -- Add one health to the robotanist to account for damage taken from Maelstrom Zombie. local inHealth = self:GetHealth().health self:SetHealth{ health = inHealth + 1 } -- Attach corrupted effect -- What happens if we attach this effect, and then someone in the distance comes closer and -- the robotanists ghosts in, will they see the effect? self:PlayFXEffect{ name = "corrupt", effectType = "maelstrom"} self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) end end -------------------------------------------------------------------------------- -- onTemplateDie -- -- Notes: Called when onDie occurs in the master template script attached -- to this 'robotanist'. -------------------------------------------------------------------------------- function onTemplateDie(self, msg) --print("TEMPLATE DIE") local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x, y = mypos.y, z = mypos.z }.string local myRot = self:GetRotation() local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true} } RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildRobotanistLOT"], x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config } end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) -- Has been built if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to un-corrupted robotanist faction self:SetFaction{ faction = CONSTANTS["FriendlyRobotanistFaction"] } setState("AiEnable",self) end end function onEmoteReceived(self,msg) if (msg.emoteID == 356) then self:PlayAnimation{ animationID = "salutePlayer" } end end -------------------------------------------------------------- -- Server Constants/Settings for Avant Gardens Scripts -- -- We need this because the server cannot use the other -- constants file due to "Localize" calls -------------------------------------------------------------- CONSTANTS = {} CONSTANTS["COURSE_MANAGER_GROUP"] = "race" CONSTANTS["COURSE_MANAGER_LOT"] = 6011 CONSTANTS["COUNTDOWN_DELAY_SEC"] = 3 -------------------------------------------------------------- -- Locates the course manager object in the course manager -- group. -------------------------------------------------------------- function GetCourseManager(self) -- get all objects in course manager group local objects = self:GetObjectsInGroup{ group = CONSTANTS["COURSE_MANAGER_GROUP"] }.objects -- loop through objects and return the first object that matches the -- course manager lot for i = 1, table.maxn (objects) do if (objects[i]:GetLOT().objtemplate == CONSTANTS["COURSE_MANAGER_LOT"]) then return objects[i] end end return nil end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 80 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ ////////////////////////////////////////////////////////////////////////////////w _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 1 function onStartup(self) self:SetVar("TickTime", 1) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } self:CastSkill{skillID = 200} self:SetVar("DieTime", 25) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end --Gets the player that built the generator -- Commented out for the time being just in case we need it. --[[ function onRebuildStart(self, msg) storeObjectByName (self, "playerID", msg.userID ) end --]] ------------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end if msg.name == "TickTime" then self:CastSkill{skillID = 200} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end end function onFireEventServerSide(self, msg) --print('notify object now') if (msg.args == "achieve" ) then --print("ive achieved") msg.senderID:UpdateMissionTask{taskType = "complete", value = 488, value2 = 1, target = self} end end local lootLOT = 935 -- LOT of the loot object to spawn local numToSpawn = 3 -- number of loot objects to spawn local cooldownTime = 5 -- how long to wait before you can interact with the object again function onUse(self, msg) --print("clicked!") local player = msg.user if self:GetVar("bActive") then return end --self:PlayFXEffect{name = "electro_disk", effectType = "create", effectID = 1391} GAMEOBJ:GetTimer():AddTimerWithCancel( cooldownTime , "InteractionCooldown", self ) if (player:GetFlag{iFlagID = 66}.bFlag == true) then msg.user:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} self:SetVar("bActive", true) for i = 1, numToSpawn do --print("spawning powerup") local newSpawner = GAMEOBJ:GenerateSpawnedID() self:DropLoot{owner = player, lootID = newSpawner, itemTemplate = lootLOT, --[[bUsePosition = true,--]] rerouteID = player, sourceObj = self} self:PlayFXEffect{effectType = "cast" } end end end function onTimerDone(self, msg) --print("ready to spawn") if msg.name == "InteractionCooldown" then self:SetVar("bActive", false) --self:StopFXEffect{name = "electro_disk"} end end -------------------------------------------------------------- -- Server-side death trigger that will kill the player with a -- specific animation. Change the Custom Variables to fit your -- needs. -- mrb... 5/21/09 -- djames: updated 9/28/09 -------------------------------------------------------------- -- Custom Variables -------------------------------------------------------------- local deathAnimation = "electro-shock-death" -- Animation to play on the player when it dies -------------------------------------------------------------- -- onCollisionPhantom handles the player colliding with the -- attached object (i.e. water plane) by making them die -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("******* onCollisionPhantom (server)") local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then --print("******* RequestDie (server)") target:RequestDie{killerID = self, deathType = deathAnimation} end return msg end ------------------------------------------------------------ --plays the shock animation on the player when they interact with the broken console on the space ship ------------------------------------------------------------ local ShockAnim = "knockback-recovery" local FXTime = 2.0 function onUse(self, msg) --print("clicked!") msg.user:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} if self:GetVar("bActive") then return end local player = msg.user self:SetVar("bActive", true) player:PlayAnimation{animationID = ShockAnim, bPlayImmediate = true} player:Knockback{vector={x=-20, y=10, z=-20}} self:PlayFXEffect{name = "console_sparks", effectType = "create", effectID = 1430} GAMEOBJ:GetTimer():AddTimerWithCancel(FXTime, "FXTime", self ) end function onTimerDone(self, msg) self:StopFXEffect{name = "console_sparks"} self:SetVar("bActive", false) endlocal repTime = 2 -- base time for the first shake local randTime = 10 -- number put into the math.random() to get the next shake local shakeRad = 500.0 -- radius away from object clients should shake local debrisObj = '' --local randFX = {{'fx' = 'shipboom1', 'id' = 559},{'fx' = 'shipboom2', 'id' = 560},{'fx' = 'shipboom3', 'id' = 561}} -- two different shake effect, only have one uncommented at a time local fxName = "camshake-bridge" -- Lighter Shake with Angry animation --local fxName = "camshake" -- Big Shake function newTime() local time = math.random(randTime) if time < randTime/2 then time = time + randTime/2 end return repTime + time end function onStartup(self) -- see if object has some varibles set in HF if self:GetVar("MaxRepTime") ~= nil then randTime = self:GetVar("MaxRepTime") end if self:GetVar("Radius") ~= nil then shakeRad = self:GetVar("Radius") end if self:GetVar("EffectName") ~= nil then fxName = self:GetVar("EffectName") end debrisObj = self:GetObjectsInGroup{ group = "DebrisFX"}.objects[1] -- Initialize the pseudo random number generator and return math.randomseed( os.time() ) -- Do the first Shake Timer on start up GAMEOBJ:GetTimer():AddTimerWithCancel( repTime , "ShakeTimer", self ) end function onTimerDone(self, msg) -- check to make sure there is a message and the timer name is correct local shipFXObj = self:GetObjectsInGroup{ group = "ShipFX"}.objects[1] local shipFX2Obj = self:GetObjectsInGroup{ group = "ShipFX2"}.objects[1] if msg.name == "ShakeTimer" then -- Start another shake timer with newTime() GAMEOBJ:GetTimer():AddTimerWithCancel( newTime(), "ShakeTimer", self ) -- Shakes the players using the variables at the top of the script self:PlayEmbeddedEffectOnAllClientsNearObject{ radius = shakeRad, fromObjectID = self, effectName = fxName } -- Plays ship debris effect debrisObj:PlayFXEffect{ name = "Debris", effectType = "DebrisFall"} -- Plays ship FX local randFX = math.random(3) shipFXObj:PlayFXEffect{ name = "FX", effectType = 'shipboom' .. randFX, effectID = 559} --print('playFX **** ' .. randFX) local animTime = shipFXObj:GetAnimationTime{animationID = 'explosion' .. randFX}.time GAMEOBJ:GetTimer():AddTimerWithCancel( animTime, "ExplodeIdle", self ) -- Plays ship FX2 --shipFX2Obj:PlayFXEffect{ name = "FX2", effectType = 'ship-shake', effectID = 578} shipFX2Obj:PlayAnimation{ animationID = 'explosion'} end if msg.name == "ExplodeIdle" then shipFXObj:PlayAnimation{ animationID = 'idle'} shipFX2Obj:PlayAnimation{ animationID = 'idle'} --print('reset FX idle ****') end end function onStartup(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel(5.0, "FloaterScale", self) end function onTimerDone(self, msg) if msg.name == "FloaterScale" then -- Type of objects called local scaletype = math.random(1,5) --print ("Scale " .. scaletype) self:PlayAnimation{animationID = "scale_0" .. scaletype} GAMEOBJ:GetTimer():AddTimerWithCancel(0.4, "FloaterPath", self) elseif msg.name == "FloaterPath" then local pathtype = math.random(1,4) local randtime = math.random(20,25) --print ("Move " .. pathtype) self:PlayAnimation{animationID = "path_0" .. pathtype} GAMEOBJ:GetTimer():AddTimerWithCancel(randtime, "FloaterScale", self) end end-- When FireEvent is called on this object create a message box with the given text. -- Trigger format should be: MessageBox, your text here, *optional time in sec* -- Created: 5/26/09 mrb... local textVar = "The Maelstrom is too dangerous here - for now." -- Added to Localization table as "SPIDER_CAVE_MESSAGE" require('o_mis') -- default values for mBox local mBox = {boxTarget = nil, isDisp = false, isTouch = false, isFirst = true, boxSelf = nil, boxText = '', boxTime = 1 } 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 -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided if msg.objectID then local dir = self:GetObjectDirectionVectors().forward mBox.boxTarget = msg.objectID -- push-back effect 1378 -- PlayFXEffect msg.objectID:PlayFXEffect{name = "pushBack", effectID = 1378, effectType = "create"}--effectID = 1378, effectType = "push-back"} msg.objectID:PlayAnimation{ animationID = "knockback-recovery" } dir.y = dir.y + 15 dir.x = dir.x * 100 dir.z = dir.z * 100 msg.objectID:Knockback { vector = dir } end if not msg.objectID or mBox.isTouch or mBox.isDisp then return end --print('starting EventTimer') mBox.boxSelf = self mBox.isTouch = true mBox.boxText = textVar GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", self ) end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) -- Says we have finished colliding tries to resetBox() if msg.objectID then mBox.isTouch = false resetBox() --print('Exiting') end end function onTimerDone(self, msg) -- Says we are done with the displaying the message box, tries to resetBox() if msg.name == "BoxTimer" then mBox.isDisp = false resetBox() --print('Box Timer Done') 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 --print('EventTimer not long enough.... running again') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", mBox.boxSelf ) return end --print('EventTimer Done!!!') MakeBox() end end -- resets local data mBox 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 } endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 135 -- Aggro Radius Set['conductRadius'] = 135 -- Conduct Radius Set['tetherRadius'] = 135 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 135 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('o_mis') require('State') require('o_StateCreate') --/////////////////////////////////////////////////////////////////////////////////////// --// Robotonist Spawer Script --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) storeObjectByName(self, "crystal", self) self:SetVar("NumberOfChildern", 0 ) -- Dont not change this Val <<< self:SetVar("WP_Num", 1) -- Dont not change this Val <<< --///////////////////////////////////////////// -- Settings (Alpha =a) " a_1 (Num = 1) a_1 = the WayPoint Set --///////////////////////////////////////////// self:SetVar("PetNames", "robotonist") self:SetVar("WP_Alpha", "bot") -- starting letter of the Way Point ( a_1 = a) or (anyName_1) self:SetVar("MaxPets", 3) -- Max Pets Spawn in the wrold self:SetVar("TotalPets", 10) -- Total Number of Pets spawn points self:SetVar("PetID", 4019) --///////////////////////////////////////////// --///////////////////////////////////////////// -- define total pet IDs for i = 1, self:GetVar("TotalPets") do self:SetVar("Pet_"..i, self:GetVar("PetID")) -- attach WP to NPC self:SetVar("slot_"..i, nil ) end for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) self:SetVar(FinalName, "NotSpawned") end self:UseStateMachine{} ParentIdle = State.create() ParentIdle.onEnter = function(self) setState("ReSpawnChild",self) end ParentIdle.onArrived = function(self) end ---------------------------------------------------------------------------------- -- /////////////////////////////////////////////////////////////////////////////// -- ReSpawn Childern State -- /////////////////////////////////////////////////////////////////////////////// ReSpawnChild = State.create() ReSpawnChild.onEnter = function(self) if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") then local ran = GetValidRandom(self) for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) if ran == i and self:GetVar(FinalName) == "NotSpawned" then SpawnPet(self, i ) end end end end ReSpawnChild.onArrived = function(self) end ---------------------------------------------------------------------------------- addState(ParentIdle, "ParentIdle", "ParentIdle", self) addState(ReSpawnChild,"ReSpawnChild","ReSpawnChild",self) beginStateMachine("ParentIdle", self) ParentIdle.onEnter(self) end onChildLoaded = function(self,msg) local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("SpawnedVar", FinalName ) local FreeSlot = GetValidRandom(self) msg.childID:SetVar("attached_path", self:GetVar("WP_Alpha").."_"..self:GetVar("ChildLoadNUM")) -- msg.childID:SetVar("I_Have_A_Parent", true ) storeParent(self, msg.childID) end --************************************************************************************ --** Funcitons --************************************************************************************ function SpawnPet(self, num ) for i = 1, self:GetVar("TotalPets") do if num == i then local firstWP = GAMEOBJ:GetWaypointPos( self:GetVar("WP_Alpha").."_"..i, 1) self:SetVar("ChildLoadNUM", i ) local config = { {"pathset", self:GetVar("WP_Alpha").."_"..i} , {"renderDisabled", false} } RESMGR:LoadObject { objectTemplate = self:GetVar( "Pet_"..i ) , x= firstWP.x , y= firstWP.y , z= firstWP.z , owner = self ,configData = config } -- A1 self:SetVar(self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i, "Spawned" ) local NChildern = self:GetVar("NumberOfChildern") + 1 self:SetVar("NumberOfChildern", NChildern ) break end end if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") + 1 then setState("ReSpawnChild",self) end end function GetValidRandom(self) while true do NUM = math.random(1,self:GetVar("TotalPets")) FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..NUM) if self:GetVar(FinalName) == "NotSpawned" then break end end return NUM end -------------------------------------------------------------- -- Notification to object -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "DeadChild") then --print("Parent Enter DeadChild State****************************************") local NChildern = self:GetVar("NumberOfChildern") - 1 self:SetVar("NumberOfChildern", NChildern ) setState("ReSpawnChild",self) end end function onStartup(self) self:StopPathing() end -------------------------------------------------------------- -- upon reaching a waypoint in its path -------------------------------------------------------------- function onArrived( self, msg ) if msg.wayPoint == 0 then self:StopPathing() end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 25 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 3 -- Min Wander Delay Set['WanderDelayMax'] = 6 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['tetherRadius'] = 65 -- Tether Radius Set['wanderRadius'] = 60 -- Wander Radius Set['aggroRadius'] = 55 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherSpeed'] = 8 -- Tether Speed --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 25 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 71 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 1 -- Min Wander Delay Set['WanderDelayMax'] = 4 -- Max Wander Delay Set['WanderSpeed'] = 3 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["DarklingMechLOT"] = 6253 CONSTANTS["QuickbuildTurretLOT"] = 6254 CONSTANTS["TickTime"] = 1 CONSTANTS["KillTime"] = 20 function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 20 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- ---------------------------------- -- Sets the turret's life timer and disables its AI which will only be active after rebuild. self:SetVar("TickTime", 1) self:SetVar("currentTime", 1) --disable AI here: self:EnableCombatAIComponent{bEnable = false} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) ----------------------------------* self:SetVar("building", 0) self:SetGravityScale{scale = 0.0} self:SetStunImmunity{StateChangeType = "PUSH", bImmuneToStunAttack = true, bImmuneToInterrupt = true} -- Make immune to stuns self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true } -- Make immune to move/teleport behaviors end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Enable AI here: self:EnableCombatAIComponent{bEnable = true} self:SetVar("building", 0) GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end ------------------------- -- Tells the turret to die after the timer runs out. ------------------------- onTimerDone = function(self, msg) -- 1 second tick timer to increment an overall time (currentTime) if msg.name == "TickTime" then self:SetVar("currentTime", (self:GetVar("currentTime") + 1)) -- When the currentTime exceeds 49 seconds and the player is not currently building, kill the turret if (self:GetVar("currentTime") >= CONSTANTS["KillTime"]) and (self:GetVar("building") == 0)then self:EnableCombatAIComponent{bEnable = false} self:Die() self:SetVar("currentTime", 0) end GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end end ----------------------------- -- Getting the playerID of the rebuilder and setting new timer for the life of the turret ----------------------------- function onRebuildStart(self, msg) self:LockNodeRotation{nodeName = "base"} storeObjectByName (self, "playerID", msg.userID ) -- GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("building", 1) end ----------------------------- -- Reroute Kill credit to the player ----------------------------- function onUpdateMissionTask(self,msg) if msg then local player = getObjectByName(self, "playerID") if player then player:UpdateMissionTask{target = msg.target, value = msg.value, value2 = msg.value2, taskType = msg.taskType} end end end ---------------------------------- -- Ensuring the turret is spawned in if the player cancels the rebuild. --------------------------------- --[[ function onRebuildCancel(self, msg) self:EnableCombatAIComponent{bEnable = false} self:SetVar("building", 0) if (self:GetVar("currentTime") < 21) then local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x, y = mypos.y, z = mypos.z }.string local myRot = self:GetRotation() local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true}, {"currentTime", self:GetVar("currentTime")} }--, {"CheckPrecondition" , "0:21"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildTurretLOT"], x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config, owner = parent } end end --]]require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["DarklingMechLOT"] = 6253 CONSTANTS["QuickbuildTurretLOT"] = 6254 CONSTANTS["TickTime"] = 1 function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 20 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- ---------------------------------- -- Sets the turret's life timer and disables its AI which will only be active after rebuild. self:SetVar("TickTime", 1) self:SetVar("currentTime", 1) --disable AI here: self:EnableCombatAIComponent{bEnable = false} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) ----------------------------------* self:SetVar("building", 0) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Enable AI here: self:EnableCombatAIComponent{bEnable = true} self:SetVar("building", 0) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end ----------------------------- -- Getting the playerID of the rebuilder and setting new timer for the life of the turret ----------------------------- function onRebuildStart(self, msg) self:LockNodeRotation{nodeName = "base"} storeObjectByName (self, "playerID", msg.userID ) -- GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("building", 1) end ---------------------------------- -- Ensuring the turret is spawned in if the player cancels the rebuild. --------------------------------- --[[ function onRebuildCancel(self, msg) self:EnableCombatAIComponent{bEnable = false} self:SetVar("building", 0) if (self:GetVar("currentTime") < 21) then local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x, y = mypos.y, z = mypos.z }.string local myRot = self:GetRotation() local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true}, {"currentTime", self:GetVar("currentTime")} }--, {"CheckPrecondition" , "0:21"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildTurretLOT"], x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config, owner = parent } end end --]]function onChoicebuildComplete(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel(0.1, "resetUI", self ) end --timers... function onTimerDone(self, msg) if msg.name == "resetUI" then GAMEOBJ:GetZoneControlID():FireEvent{senderID = self, args = "DeactivateRewards"} GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SetGameState"} self:Die{killerID = self} end end --local misID = 479 -- missionID from DB --function onUse(self, msg) -- -- get player who clicked on us -- local player = msg.user -- if (player:GetMissionState{missionID = misID}.missionState > 1 ) then --(player:GetMissionState{missionID = misID}.missionState > 4 ) -- complete -- self:NotifyClientObject{name = 'ShowWaveHelpUI', paramObj = player, rerouteID = msg.player} -- else -- player:DisplayTooltip{ bShow = true, strText = "Visit Nimbus Station to unlock this Survival Mini-Game!", iTime = 3500 } --print('you need to finish mission ' .. misID) -- end -- --self:Help{rerouteID = player, iHelpID = 0} --end --------------------------------------------- -- When the player accepts the final WISP mission in ag, -- the player will zone to an instance of the mission. ---------------------------------------------- CONSTANTS = {} CONSTANTS["SurvivalScenarioInstanceMission"] = 350 function onMissionDialogueOK(self, msg) local user = msg.responder local mission = msg.missionID local missionstate = user:GetMissionState{missionID = CONSTANTS["SurvivalScenarioInstanceMission"] }.missionState if mission == CONSTANTS["SurvivalScenarioInstanceMission"] and (missionstate == 2 or missionstate == 10) then user:TransferToZone{ zoneID = 427, ucInstanceType = 1 } end end --------------------------------------------- -- When the player accepts the final WISP mission in ag, -- the player will zone to an instance of the mission. ---------------------------------------------- CONSTANTS = {} CONSTANTS["SurvivalScenarioInstanceMission"] = 335 function onMissionDialogueOK(self, msg) local user = msg.responder local mission = msg.missionID local missionstate = user:GetMissionState{missionID = CONSTANTS["SurvivalScenarioInstanceMission"] }.missionState if mission == CONSTANTS["SurvivalScenarioInstanceMission"] and (missionstate == 2 or missionstate == 10) then user:TransferToZone{ zoneID = 430, ucInstanceType = 1 } end end function onMessageBoxRespond(self, msg) if (msg.iButton == 1) then msg.sender:TransferToZone{ zoneID = 430 , ucInstanceType = 1 } end end function onUse(self, msg) -- get player who clicked on us local player = msg.user self:Help{rerouteID = player, iHelpID = 0} end function onFireEventServerSide(self, msg) if (msg.args == "ZonePlayer") then msg.senderID:TransferToZone{ zoneID = msg.param1 } end end-------------------------------------------------------------- -- (SERVER SIDE) Obstacle Course Starter NPC -- -- Starts the course for the player -------------------------------------------------------------- ---------------------------------------------------------------- -- Includes ---------------------------------------------------------------- require('ai/AG/L_AG_SCENE_2_INCLUDE') MS_IN_SEC = 1000 ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function onStartup(self) -- set max users to something high self:SetActivityParams{ modifyActivityActive=true, activityActive = true, maxUsers = 9999, modifyMaxUsers = true } self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="PlayerExit"} end ---------------------------------------------------------------- -- Returns true/false if a player is in the activity -- takes SELF and a PLAYER object ---------------------------------------------------------------- function IsPlayerInActivity(self, player) -- check if player is in activity local existMsg = self:ActivityUserExists{ userID = player } if (existMsg) then return existMsg.bExists end return false end ---------------------------------------------------------------- -- Happens on interaction for server ---------------------------------------------------------------- function onUse(self, msg) -- get player who clicked on us local player = msg.user -- check if player is in course if ( IsPlayerInActivity(self, player) == true ) then -- offer exit self:Help{rerouteID = player, iHelpID = 0} else -- offer start activity self:Help{rerouteID = player, iHelpID = 1} end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- Response to Exit activity dialog and user pressed OK if ( msg.identifier == "player_dialog_cancel_course" and msg.iButton == 1) then -- remove the user self:RemoveActivityUser{ userID = msg.sender } -- Response to Start activity dialog and ok is pressed and player is not in activity elseif (msg.identifier == "player_dialog_start_course" and msg.iButton == 1 and IsPlayerInActivity(self, msg.sender) == false) then -- add the new user self:AddActivityUser{ userID = msg.sender } -- start the activity for the new user StartActivity(self, msg.sender) end end ---------------------------------------------------------------- -- Stores the start time for the player in the activity and -- sends messages to start it ---------------------------------------------------------------- function StartActivity(self, player) -- get the current time in sec local startTime = (GAMEOBJ:GetSystemTime() / MS_IN_SEC) + 4 self:SetActivityUserData{ userID = player, typeIndex = 1, value = tonumber(startTime) } end ---------------------------------------------------------------- -- Handle FireEvent message ---------------------------------------------------------------- function onFireEvent(self, msg) -- user is trying to cancel if ( msg.args == "course_cancel" and IsPlayerInActivity(self, msg.senderID) == true ) then --print(msg.senderID:GetName().name .. ' canceled the race') self:NotifyClientObject{name = "stop_timer" , param1 = 1, rerouteID = msg.senderID} -- remove the user from activity self:RemoveActivityUser{ userID = msg.senderID } -- notify user of remove self:Help{rerouteID = msg.senderID, iHelpID = 2} elseif ( msg.args == "course_finish" and IsPlayerInActivity(self, msg.senderID) == true ) then -- store the finish time in sec local endTime = GAMEOBJ:GetSystemTime() / MS_IN_SEC -- store the time as activity rating [1] self:SetActivityUserData{ userID = msg.senderID, typeIndex = 2, value = tonumber(endTime) } -- distribute rewards self:DistributeActivityRewards{ userID = msg.senderID, bAutoAddCurrency = true, bAutoAddItems = true } -- do complete activity events --self:CompleteActivity{ userID = msg.senderID } self:CompleteActivity{ userID = msg.senderID} -- remove the user from activity self:RemoveActivityUser{ userID = msg.senderID } end end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function notifyPlayerExit(self, other, msg) if IsPlayerInActivity(self, msg.playerID) then -- remove the user from activity self:RemoveActivityUser{ userID = msg.playerID } end end -------------------------------------------------------------- -- Passes start/end time and gets the total time -------------------------------------------------------------- function GetTotalTime(startTime, endTime) -- calculate total time (subtract countdown and cap at 0) local totalTime = tonumber(endTime) - tonumber(startTime) --totalTime = totalTime -- - CONSTANTS["COUNTDOWN_DELAY_SEC"] if (totalTime < 0) then totalTime = 0 end return math.floor(totalTime) end -------------------------------------------------------------- -- Called when the activity is trying to calculate final rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- get the time for the player local totalTime = GetTotalTime(msg.fValue2, msg.fValue3) msg.outActivityRating = totalTime return msg end -------------------------------------------------------------- -- Called when the activity is trying to complete -------------------------------------------------------------- function onDoCompleteActivityEvents(self, msg) -- get the time for the player local totalTime = GetTotalTime(msg.fValue2, msg.fValue3) self:SetActivityUserData{ userID = msg.userID, typeIndex = 1, value = tonumber(totalTime) } --print(msg.userID:GetName().name .. " Total Time" .. msg.fValue2 .. " - " .. msg.fValue3 .. " = " .. totalTime) -- complete mission 286 if it's not already complete if msg.userID:GetMissionState{missionID = 286}.missionState < 8 then msg.userID:UpdateMissionTask{taskType = "complete", value = 286, value2 = 1, target = self} end -- complete activities (Note: negate time to work with perform activity task types / convert back to ms) totalTime = totalTime -- * MS_IN_SEC --total time has to be negative for perform activity task to function properly msg.userID:UpdateMissionTask{ taskType = "performact_time", value2 = self:GetActivityID().activityID, value = totalTime * -1 } -- Update Leaderboards for this user (Note: negate time to work with perform activity task types) self:UpdateActivityLeaderboard{ userID = msg.userID } local actID = self:GetActivityID().activityID -- get the leaderboard data for the user and update summary screen if it exists msg.userID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = actID } self:NotifyClientObject{name = "ToggleLeaderBoard", param1 = actID, paramObj = msg.userID , rerouteID = msg.userID} --print(msg.senderID:GetName().name .. ' finished the race') self:NotifyClientObject{name = "stop_timer" , param1 = 1, param2 = totalTime, rerouteID = msg.userID} -- notify user of remove self:Help{rerouteID = msg.userID, iHelpID = 3} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = .75 -- Tether Speed Set['wanderRadius'] = 10 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 15 -- Max Wander Delay Set['WanderSpeed'] = 0.35 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------- -- constants -------------------------------------------------------------- CONSTANTS = {} CONSTANTS["START_OVER_TIMER"] = 30.0 -- seconds allowed before -- the quickbuild is replaced with a good, pathing robotonist -- (without giving the player credit for fixing it ) -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["START_OVER_TIMER"], "revertToOriginal", self ) end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then -- a player just did the quickbuild. GAMEOBJ:GetTimer():CancelTimer("revertToOriginal", self) -- spawn in a fixed robotonist and get rid of the quickbuild ReplaceWithGoodRobotonist( self ) -- TODO: give credit toward the repair 3 corrupted robotonists mission end end -------------------------------------------------------------- -- spawn in a good, pathing robotonist -------------------------------------------------------------- function ReplaceWithGoodRobotonist( self ) -- TODO: spawn in a good robotonist at the first waypoint -- get rid of the quickbuild GAMEOBJ:DeleteObject( self ) end -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone(self, msg) if ( msg.name == "revertToOriginal") then -- get rid of the quickbuild activator and pile of bricks self:DisplayRebuildActivator{ bShow = false } -- ran out of time to do the quickbuild, start over with a good robotonist ReplaceWithGoodRobotonist( self ) end end function onRebuildNotifyState(self, msg) if msg.iState == 2 then self:PlayFXEffect{effectType = "rebuild-complete"} end if msg.iState == "BreakSelf" then self:PlayFXEffect{effectType = "rebuild-smash"} end end -------------------------------------------------------------- -- (SERVER SIDE) Trigger for Course Cancel -- -- Cancels the course for the player -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/AG/L_AG_SCENE_2_INCLUDE') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- --function onStartup(self) --print("cancel trigger startup") --end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollisionPhantom(self, msg) -- if a player is colliding with us if (msg.objectID:IsCharacter().isChar == true) then -- get the manager local manager = GetCourseManager(self) -- notify manager of collision if (manager) then manager:FireEvent{ args = "course_cancel", senderID = msg.objectID } end end return msg end -------------------------------------------------------------- -- (SERVER SIDE) Trigger for Course Finish -- -- Finishes the course for the player -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/AG/L_AG_SCENE_2_INCLUDE') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- --function onStartup(self) --print("goal trigger startup") --end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollisionPhantom(self, msg) -- if a player is colliding with us if (msg.objectID:IsCharacter().isChar == true) then -- get the manager local manager = GetCourseManager(self) -- notify manager of collision if (manager) then manager:FireEvent{ args = "course_finish", senderID = msg.objectID } end end return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["QuickbuildTurretLOT"] = 6254 CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- suspends scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 180 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 250 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ ////////////////////////////////////////////////////////////////////////////////w _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetFaction{faction = 4} end function onGetActivityPoints(self, msg) msg.points = 200 return msg end function onDie(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Mech", param1 = 200, ObjIDSender = msg.killerID} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- suspends scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 60 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 250 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 340 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onGetActivityPoints(self, msg) msg.points = 300 return msg end function onDie(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Spiderling", param1 = 300, ObjIDSender = msg.killerID} end --------------------------------------------- -- When the player clicks the sign, they will be ported to their last zone -- and the mission will be cancelled. ---------------------------------------------- CONSTANTS = {} CONSTANTS["SurvivalScenarioInstanceMission"] = 335 ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function onStartup(self) end function onUse(self, msg) local user = msg.user user:CancelMission{missionID = CONSTANTS["SurvivalScenarioInstanceMission"] } user:TransferToLastNonInstance{ playerID = user, bUseLastPosition = true } endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- suspends scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 70 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 250 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 40 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = true Set['aggroFOV'] = 300 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 4 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end function onGetActivityPoints(self, msg) msg.points = 100 return msg end function onDie(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Strombie", param1 = 100, ObjIDSender = msg.killerID} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 51 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- local aggroRadius = 50 local localskillID = 69 -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) self:SetProximityRadius { radius = aggroRadius, FOVradius = 45} end -------------------------------------------------------------- -- On proximity -------------------------------------------------------------- function onProximityUpdate(self, msg) if msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 or msg.objId:GetFaction().faction == 101 then --print "just entered the if statement" self:KillObj{targetID = msg.objId} --print "i just cast a skill" end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 11 Set['OverRideHealth'] = false Set['Health'] = 3 Set['OverRideImag'] = false Set['Imagination'] = 10 Set['OverRideImmunity'] = false Set['Immunity'] = false Set['OverRideName'] = true Set['Name'] = "MAX" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] -- Aggro Set['OverRideAggro'] = true Set['aggroRadius'] = 10 -- Aggro FOV Set['UseAggroFOV'] = false Set['aggroFOVRadius'] = 20 Set['aggroFOV'] = 180 -- Conduct Set['OverRideConduct'] = true Set['conductRadius'] = 15 -- Conduct FOV Set['UseConductFOV'] = false Set['conductFOVRadius'] = 15 Set['conductFOV'] = 180 -- Tether Set['OverRideTether'] = true Set['tetherRadius'] = 45 -- Wander Set['OverRideWander'] = true Set['wanderRadius'] = 8 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Patroler" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "small" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 Set['WayPointDMax'] = 0 Set['WayPointSpeed'] = 1 -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false Set['WanderChance'] = 100 Set['WanderDelayMin'] = 1 Set['WanderDelayMax'] = 2 -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" Set['WEmoteEffe_1'] = 4 -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true Set['WEmoteType_2'] = "breakdance" Set['WEmoteEffe_2'] = 4 --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral] Set['AggroNPC'] = false Set['AggroDist'] = 4 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_ID'] = 3 -- effectID of Emmote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false Set['FearNPC'] = false Set['FearCombat'] = false Set['FearHP'] = false Set['FearHPamount'] = 1 -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "FleeEmote"-- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 40 -- Flee Distance Set['FearTime'] = 8 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 6 -- NPC walk speed Set['FearFace'] = false -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = nil -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "lookBack" Set['FearEffectID'] = 63 -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight']= 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Conduct_CoolDown'] = 5 -- Cool down is start after the conduct has completed. -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AChance'] = 10 -- Chance to Play Set['Con_1_Order'] = "after" -- When Emote is played ['before']/['after']/['both']. Set['Con_1_Type'] = "flee" -- String name of type ['follow'],['face'] Set['Con_1_Distance'] = 3 -- Option Distance [ follow = distance to npc ] Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action ( Targets and Truns the NPC ) Set['Con_1_Delay'] = 2 -- Delay after the Acton is completed Set['Con_1_Speed'] = 5 -- move speed -- goto set Pos [ Optional ] Set['Con_1_Use_xyz'] = false Set['Con_1_gotoX'] = 0 -- x Set['Con_1_gotoY'] = 0 -- y Set['Con_1_gotoZ'] = 0 -- z -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_EffectID'] = 4 -- Effect ID Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EDelay'] = 0.5 -- Animation Delay Set['Con_1_ESkill'] = true Set['Con_1_ESkillID'] = 11 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "after" -- When Action is played before/after Set['Con_2_Type'] = "follow" -- String name of type ['follow'],['face'] Set['Con_2_Distance'] = 3 -- Option Distance [ follow = distance to npc ] Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_Speed'] = 2 -- move speed -- goto set Pos [ Optional ] Set['Con_2_Use_xyz'] = false Set['Con_2_gotoX'] = 0 -- x Set['Con_2_gotoY'] = 0 -- y Set['Con_2_gotoZ'] = 0 -- z -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_EffectID'] = 4 -- Effect ID Set['Con_2_EffectType'] = "breakdance" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EDelay'] = 3 -- Delay Set['Con_2_ESkill'] = true Set['Con_2_ESkillID'] = 31 ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 11 Set['OverRideHealth'] = false Set['Health'] = 3 Set['OverRideImag'] = false Set['Imagination'] = 10 Set['OverRideImmunity'] = true Set['Immunity'] = true Set['OverRideName'] = true Set['Name'] = "Test Vender" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] -- Aggro Set['OverRideAggro'] = true Set['aggroRadius'] = 10 -- Aggro FOV Set['UseAggroFOV'] = false Set['aggroFOVRadius'] = 20 Set['aggroFOV'] = 180 -- Conduct Set['OverRideConduct'] = true Set['conductRadius'] = 20 -- Conduct FOV Set['UseConductFOV'] = true Set['conductFOVRadius'] = 15 Set['conductFOV'] = 180 -- Tether Set['OverRideTether'] = true Set['tetherRadius'] = 45 -- Wander Set['OverRideWander'] = true Set['wanderRadius'] = 8 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "small" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 Set['WayPointDMax'] = 0 Set['WayPointSpeed'] = 1 -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false Set['WanderChance'] = 100 Set['WanderDelayMin'] = 5 Set['WanderDelayMax'] = 5 -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" Set['WEmoteEffe_1'] = 4 -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true Set['WEmoteType_2'] = "breakdance" Set['WEmoteEffe_2'] = 4 --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Friendly] Set['AggroNPC'] = false Set['AggroDist'] = 4 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_ID'] = 3 -- effectID of Emmote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false Set['FearNPC'] = false Set['FearCombat'] = false Set['FearHP'] = false Set['FearHPamount'] = 1 -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee"-- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 20 -- Flee Distance Set['FearTime'] = 8 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 3 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = nil -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "salute" Set['FearEffectID'] = 4 -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight']= 100 Set['Conduct_1_Active'] = true -- Conduct 1 Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Conduct_CoolDown'] = 5 -- Cool down is start after the conduct has completed. -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Emote is played ['before']/['after']/['both']. Set['Con_1_Type'] = "face" -- String name of type ['follow'],['face'] Set['Con_1_Distance'] = 0 -- Option Distance [ follow = distance to npc ] Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action ( Targets and Truns the NPC ) Set['Con_1_Delay'] = 0 -- Delay after the Acton is completed Set['Con_1_Speed'] = 5 -- move speed -- goto set Pos [ Optional ] Set['Con_1_Use_xyz'] = false Set['Con_1_gotoX'] = 0 -- x Set['Con_1_gotoY'] = 0 -- y Set['Con_1_gotoZ'] = 0 -- z -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_EffectID'] = 10 -- Effect ID Set['Con_1_EffectType'] = "alert" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EDelay'] = 0.5 -- Animation Delay Set['Con_1_ESkill'] = false Set['Con_1_ESkillID'] = 11 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false Set['Con_2_AFaction'] = 3 -- Faction of the NPC/Player -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "after" -- When Action is played before/after Set['Con_2_Type'] = "sneakto" -- String name of type ['follow'],['face'] Set['Con_2_Distance'] = 4 -- Option Distance [ follow = distance to npc ] Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_Speed'] = 2 -- move speed -- goto set Pos [ Optional ] Set['Con_2_Use_xyz'] = false Set['Con_2_gotoX'] = 0 -- x Set['Con_2_gotoY'] = 0 -- y Set['Con_2_gotoZ'] = 0 -- z -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_EffectID'] = 4 -- Effect ID Set['Con_2_EffectType'] = "chicken" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EDelay'] = 8.75 -- Delay (Min should be the animation time) Set['Con_2_ESkill'] = false Set['Con_2_ESkillID'] = 31 ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end --[[ -- Advanced Functions and Events tied to the template function onTemplateChangeWaypoints(self, msg) -- called on an object when the waypoint event for Changing Waypoints happens -- return true to halt process in the AI system end function onTemplateProximityUpdate (self, msg) end function onTemplateTimerDone (self, msg ) end function onTemplateHit (self, msg ) end function onTemplateDie (self, msg ) end function onTemplateLeftTetherRadius ( self, msg ) end --]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('c_Zorillo') function onStartup(self) Set = {} self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) end function onUse(self, msg) 'self:PlayAnimation(animationID = "turn") 'emote(self, self, "turn") 'SetMouseOverDistance(self, 100) ' local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) ' player:PlayAnimation{animationID = "ship-wheel"} ' self:PlayAnimation{animationID = "turn"} endrequire('o_mis') local effect_interval = 1.0 function onStartup(self) self:SetPickType{ePickType = 14} end function onClientUse(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayAnimation{animationID = "ship-wheel"} self:PlayAnimation{animationID = "turn"} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- use native code AI? Set['SuspendLuaAI'] = true -- a state suspending scripted AI --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] Set['SuspendLuaMovementAI'] = true -- suspends lua control of movement --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- mhealth = self:GetMaxHealth{}.health time = 0 timerRunning = false avgDPS = {} avgDPS[1] = nil end function onTemplateHit (self, msg ) local dmg = mhealth - self:GetHealth{}.health SendNetWorkVar( self , "TotalHealth", "" , "", "", "", dmg, "" ) if not timerRunning then GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "dpsTimer", self ) SendNetWorkVar( self , "StateRunning", "" , "", "", "", "", "" ) timerRunning = true end end function onUse(self,msg) if msg.user then SendNetWorkVar( self , "pushState", msg.user , self, "", "", "", "" ) storeObjectByName(self, "player", msg.user) end end function onMessageBoxRespond(self,msg) if msg.identifier == "exit" then print "exit" -- pop game State GAMEOBJ:GetTimer():CancelAllTimers( self ) SendNetWorkVar( self , "reset", "" , "", "", "", "", "" ) SendNetWorkVar( self , "popState", "" , "", "", "", "", "" ) elseif msg.identifier == "stop" then print "stop" -- Stop the timer GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetImmunity{immunity = true} time = 0 elseif msg.identifier == "reset" then -- reset Table for i,v in ipairs(avgDPS) do table.remove(avgDPS,i) end avgDPS[1] = nil -- set immunity timeSent = false self:SetImmunity{immunity = false} -- Cancel All timers and reset GAMEOBJ:GetTimer():CancelAllTimers( self ) timerRunning = false time = 0 -- send UI State SendNetWorkVar( self , "reset", "" , "", "", "", "", "" ) -- reset NPC stats self:SetHealth{health = mhealth} -- reset PLAYER stats local player = getObjectByName(self, "player") local pmh = player:GetMaxHealth{}.health player:SetHealth{health = pmh } local pmi = player:GetMaxImagination{}.imagination player:SetImagination{ imagination = pmi} end end function onTemplateTimerDone (self, msg ) if msg.name == "dpsTimer" then time = time + 1 timeSent = false if avgDPS[1] == nil then local x = mhealth - self:GetHealth{}.health avgDPS[1] = x SendNetWorkVar( self , "Current", "" , "", "", "", x, time ) timeSent = true last = self:GetHealth{}.health else local x = last - self:GetHealth{}.health if x >= 1 then table.insert(avgDPS,(#avgDPS + 1),x) tbtotal = 0 for i,v in ipairs(avgDPS) do tbtotal = tbtotal + avgDPS[i] end local t = roundFloat(tbtotal / #avgDPS,1) SendNetWorkVar( self , "Current", "" , "" , ""..t.."", "nil", x, time ) timeSent = true last = self:GetHealth{}.health end end if not timeSent then SendNetWorkVar( self , "timer", "" , "" , "", "", time, "" ) end GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "dpsTimer", self ) end end function roundFloat(what, precision) local temp = math.floor(what*math.pow(10,precision)+0.5) / math.pow(10,precision) local temp2 = string.format("%.2f", temp) return temp2 end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "BroomBot" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end ------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- -- EXAMPLE INTERACTION SCRIPT (Client Version) -- For server version look for EXAMPLE_INTERACTION_SERVER.lua -- This script allows a player to interact with an object. It only allows interaction if -- the player has more than certain amount of imagination. -- The server version of this script will actually remove the imagination from the player ------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- local imaginationRequirement = 4 function onCheckUseRequirements( self, msg ) -- We require imagination to use this object local playerImagination = msg.objIDUser:GetImagination().imagination -- The player can only use this object is they have enough imagination local canUse = playerImagination >= imaginationRequirement; -- We don't need to report most of this information unless this check is coming from the UI if ( msg.isFromUI ) then -- This MUST be set to true, otherwise all requirements from this script will be ignored msg.HasReasonFromScript = true -- True if player has less than four imagination msg.Script_Failed_Requirement = (playerImagination < imaginationRequirement) if not canUse then -- Pass the text we want to show, we only need to pass text if they fail the requirement msg.Script_Reason = Localize("NOT_ENOUGH_IMAGINATION") end -- Pass an icon to show as well, we pass this whether or not they failed the requirement -- This iconID references the 'IconID' column in the 'Icons' DB table. msg.Script_IconID = 3118; -- This is the amount that will show up on the icon (as a number) msg.Script_TargetAmount = imaginationRequirement; -- If you pass a 'TargetLOT' AND a 'TargetAmount', the icon will grab the appropriate iconID -- automatically based on the LOT of the object. This way if you don't know the IconID, you can -- use this instead. In the case of this script however, we're already passing an IconID, so -- we'll leave this commented out. --msg.Script_TargetLOT = 1234; end if not canUse then -- This is the bool we set to actually prevent interaction. This should NEVER -- get set to true under any circumstance. Only set it to false, and only when -- the player fails a requirement check. msg.bCanUse = false if not msg.isFromUI then print("PLAYER FAILED TO USE THIS OBJECT"); end end return msg end -- This function is called when the object starts up or someone requests a pick type update -- Handling this to set pick type on an object, which makes it able to be interactive function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type (Setting to -1 makes something non-interactive) end return msg end -- This function is called when the player tries to interact with an object, but only if the player -- passes the CheckUseRequirements check. 'onClientUse' is client-only, 'onUse' is server-only function onClientUse(self, msg) -- If I wanted to do something on the client when the player successfully uses this object, -- I could do that here. In the case of this script we're removing imagination on the server -- so we don't need to do anything here. print("CLIENT INTERACTION SUCCESS"); end ------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- -- EXAMPLE INTERACTION SCRIPT (Client Version) -- For server version look for EXAMPLE_INTERACTION_SERVER.lua -- This script allows a player to interact with an object. It only allows interaction if -- the player has more than certain amount of imagination. -- The server version of this script will actually remove the imagination from the player ------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------- local imaginationRequirement = 4 function onCheckUseRequirements( self, msg ) -- We do the same checks here as we did on the client, for security purposes. -- We require imagination to use this object local playerImagination = msg.objIDUser:GetImagination().imagination -- The player can only use this object is they have enough imagination local canUse = playerImagination >= imaginationRequirement; if not canUse then -- This is the bool we set to actually prevent interaction. This should NEVER -- get set to true under any circumstance. Only set it to false, and only when -- the player fails a requirement check. msg.bCanUse = false end return msg end -- This function is called when the player tries to interact with an object, but only if the player -- passes the CheckUseRequirements check. 'onUse' is server-only, 'onClientUse' is client-only function onUse(self, msg) print("SERVER INTERACTION SUCCESS, " .. imaginationRequirement .. " imagination removed by the server"); -- Drain some imagination from the player msg.user:ModifyImagination{ amount = -imaginationRequirement } end---------------------------------------------------------- --Script by Devon J -- 8/2/10 -- fills up the player's health, armor and imagination when -- they enter the instance ---------------------------------------------------------- function onPlayerLoaded(self, msg) local player = msg.playerID local maxHealth = player:GetMaxHealth{}.health local maxArmor = player:GetMaxArmor{}.armor local maxImagination = player:GetMaxImagination{}.imagination player:SetHealth{ health = maxHealth } --print("set health=" .. player:GetHealth{}.health) player:SetArmor{ armor = maxArmor } --print("set armor=" .. player:GetArmor{}.armor) player:SetImagination{ imagination = maxImagination } --print("set imagination=" .. player:GetImagination{}.imagination) end -------------------------------------------------------------- -- Server side script for the lootable chest for the dragon fight. -- -- created by mrb... 7/23/10 -------------------------------------------------------------- --------------------------------------------------------- -- ON START UP --------------------------------------------------------- function onStartup(self) -- set up the activity self:SetActivityParams{ modifyMaxUsers = true, maxUsers = 4, modifyActivityActive = true, activityActive = true} end function onUse(self,msg) local player = msg.user -- if the player isn't in the activity then add them if not self:ActivityUserExists{userID = player}.bExists then self:AddActivityUser{ userID = player } end spawnLoot(self, player) end function spawnLoot(self, player, matrix) -- give out activity rewards self:DistributeActivityRewards{userID = player, bAutoAddCurrency = false, bAutoAddItems = false} -- remove the player from the activity self:RemoveActivityUser{userID = player} end -------------------------------------------------------------- -- Calculate an activity rating for this object -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) msg.outActivityRating = 1 return msg end ---------------------------------------------------------------------- --updates achievement when player passes through a volume ---------------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("collided") local player = msg.objectID player:UpdateMissionTask{taskType = "complete", value = 849, value2 = 1, target = self} endrequire('o_mis') require('State') function onStartup(self) --########################################################### --########## Set Variables --########################################################### self:SetVar("REBUILD_STATE", "null") self:SetProximityRadius { radius = 20 , name = "aggroRadius" } self:SetProximityRadius { radius = 50 , name = "resetRadius" } storeHomePoint(self) -- Start Break timer -- GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "BreakStart",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 8, "BreakBase",self ) local pos = getHomePoint(self) RESMGR:LoadObject { objectTemplate = 3086 , x= pos.x , y= pos.y , z= pos.z , owner = self } -- Student 1 self:UseStateMachine{} --########################################################### --########## STATES --########################################################### Idle = State.create() Idle.onEnter = function(self) end Idle.onArrived = function(self) end --########################################################### --########## TETHER --########################################################### tether = State.create() tether.onEnter = function(self) -- Rebuild Reset -- self:RebuildReset() end tether.onArrived = function(self,msg) end --########################################################### --########## AGGRO --########################################################### aggro = State.create() -- Aggro onEnter aggro.onEnter = function(self) local INITIAL_ATTACK_TIME = 1 -- Start the heartbeat self:SetVar("readyToAttack", false) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) local myPos = getHomePoint(self) local target = getMyTarget(self) if target:IsDead().bDead then setState("tether",self) else self:SetTetherPoint { tetherPt = myPos,radius = 60 } self:FollowTarget { targetID = target, radius = 15 ,speed = 0 , keepFollowing = true } end end -- end function aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = 1 GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) else onTimerDone(self, msg) end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end -- This will be called if FollowTarget fails. That would only fail because the target has died or logged out. In any case, the target was lost aggro.onCancelled = function(self, msg) setState("tether",self) end function DoAttack(self) if(self:GetVar("readyToAttack") == false) then return end if CanAttackTarget(self) then self:SetVar("readyToAttack", false) if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end self:CastSkill{skillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] } end end addState(Idle, "Idle", "Idle", self) addState(tether, "tether", "tether", self) addState(aggro, "aggro", "aggro", self) beginStateMachine("Idle", self) end --########################################################### --########## CAN ATTACK --########################################################### function CanAttackTarget(self) local myTarget = getMyTarget(self) local range = 12 local myPos = Vector.new(self:GetPosition().pos) local hisPos = Vector.new(myTarget:GetPosition().pos) local dist = hisPos - myPos if not myTarget:Exists() or myTarget:IsDead().bDead then setState("tether",self) return false end if self:GetVar("REBUILD_STATE") == "broke" then return false end -- If we are close enough and if the object is in the FOV, then attack if dist:sqrLength() <= range * range then --and (self:IsObjectInFOV { target = myTarget, radius = 5 , minRange = 0, maxRange = 100 }.result) then return true end return false end -- end CanAttackTarget --########################################################### --########## PROXIMITY --########################################################### function onProximityUpdate(self, msg) if msg.objType == "Enemies" or msg.objType == "NPC" or msg.objType == "Rebuildables" and msg.objId:GetFaction().faction == 1 and self:GetVar("REBUILD_STATE") ~= "broke" and msg.status == "ENTER" and msg.name == "aggroRadius" then storeTarget(self, msg.objId) setState("aggro", self) end if msg.objType == "Enemies" or msg.objType == "NPC" or msg.objType == "Rebuildables" and msg.objId:GetFaction().faction == 1 and self:GetVar("REBUILD_STATE") ~= "broke" and msg.status == "EXIT" and msg.name == "resetRadius" then local pet = getPet(self, "Child" , 1 ) pet:Die{ killType = "SILENT" } GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "BreakStart",self ) end end --########################################################### --########## REBUILD NOTIFY --########################################################### function onRebuildNotifyState(self, msg) if (msg.iState) == 2 then GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "SpawnBase",self ) self:SetVar("REBUILD_STATE", "null") end if (msg.iState) == 4 then -- Cancle self:SetImmunity{ immunity = true } self:SetVar("REBUILD_STATE", "broke") end end --########################################################### --########## ON HIT --########################################################### function onOnHit(self,msg) hp = self:GetHealth{}.health print("health ="..hp) if hp < 7 then storeTarget(self, msg.attacker) GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "BreakStart",self ) local pet = getPet(self, "Child" , 1 ) pet:Die{ killType = "SILENT"} setState("aggro", self) end end --########################################################### --########## CHILD LOADED --########################################################### onChildLoaded = function(self,msg) storePet(self, msg.childID, "Child" , 1 ) end --########################################################### --########## TIMER --########################################################### onTimerDone = function(self, msg) if msg.name == "BreakStart" then self:SetVar("REBUILD_STATE", "broke") self:RebuildReset() self:SetImmunity{ immunity = true } self:SetHealth{ health = 10 } end if msg.name == "BreakBase" then local pet = getPet(self, "Child" , 1 ) pet:Die{ killType = "SILENT" } end if msg.name == "SpawnBase" then local pos = getHomePoint(self) RESMGR:LoadObject { objectTemplate = 3086 , x= pos.x , y= pos.y , z= pos.z , owner = self } -- Student 1 self:SetImmunity{ immunity = false } end end ----------------------------------------------------------------------------- --candle script to turn the effects off and on again ----------------------------------------------------------------------------- function onStartup(self) self:PlayFXEffect{name = "candle_light", effectID = 2108, effectType = "create"} self:SetVar("Smoke", 5) self:SetVar("AmHit", false) end function onOnHit(self, msg) if self:GetVar("AmHit") == false then msg.attacker:UpdateMissionTask{taskType = "complete", value = 850, value2 = 1, target = self} self:SetVar("AmHit", true) self:SetHealth{health = 9999} self:StopFXEffect{name = "candle_light"} self:PlayFXEffect{name = "candle_smoke", effectID = 2109, effectType = "create"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Smoke") , "SmokeTime", self ) end end function onSkillEventFired( self, msg ) if msg.wsHandle == "waterspray" then if self:GetVar("AmHit") == false then msg.casterID:UpdateMissionTask{taskType = "complete", value = 850, value2 = 1, target = self} self:SetVar("AmHit", true) self:StopFXEffect{name = "candle_light"} self:PlayFXEffect{name = "candle_smoke", effectID = 2109, effectType = "create"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Smoke") , "SmokeTime", self ) end end end function onTimerDone(self, msg) self:SetVar("AmHit", false) self:StopFXEffect{name = "candle_smoke"} self:PlayFXEffect{name = "candle_light", effectID = 2108, effectType = "create"} end CONSTANTS = {} CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"] = 0 CONSTANTS["CLIENT_TOOLTIP_MISSION_COMPLETE"] = 1 require('o_mis') function onStartup(self) self:SetVar("Zone", 0 ) end -- @TODO:ISSUE - Lua cannot send client/single messages to non client OBJID's. Need a function onMissionDialogueOK(self, msg) local user = msg.responder if self:GetLOT{}.objtemplate == 3043 then end end -------------------------------------------------------- --horsemen 1 script -------------------------------------------------------- function onStartup(self) --print("horseman 1 starting up") --print( tostring(self:GetVar("groupID")) ) for groupName in string.gmatch(self:GetVar("groupID"), "%w+;") do -------------------------------------------------------------- --get the name of the group that the object is in and trim off the ';'s -------------------------------------------------------------- groupName = string.sub(groupName, 1, -2) local mygroup = self:GetObjectsInGroup{group = groupName, ignoreSpawners = true}.objects -------------------------------------------------------------- --for the object in my group with ID 8551, tell it I spawned -------------------------------------------------------------- for i, object in ipairs(mygroup) do if object:GetLOT().objtemplate == 8551 then object:FireEvent{args = "ISpawned", senderID = self} --print("telling the turret I spawned") end end end end -- on horseman death function onDie(self,msg) -- if Brick Fury killed the horseman if msg.killerID:GetLOT().objtemplate == 8665 then -- get the mission update volume by group name, tell it Brick fury killed the horseman local volume = self:GetObjectsInGroup{group = "HorsemenTrigger", ignoreSpawners = true}.objects[1] --I'm assuming there is only one volume if volume then volume:FireEvent{senderID = self; args = "HorsemanDeath"} end end endrequire('o_mis') require('State') function onStartup(self) --########################################################### --########## Set Variables --########################################################### self:SetVar("REBUILD_STATE", "null") self:SetProximityRadius { radius = 20 , name = "aggroRadius" } self:SetProximityRadius { radius = 50 , name = "resetRadius" } storeHomePoint(self) -- Start Break timer -- GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "BreakStart",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 8, "BreakBase",self ) local pos = getHomePoint(self) RESMGR:LoadObject { objectTemplate = 3086 , x= pos.x , y= pos.y , z= pos.z , owner = self } -- Student 1 self:UseStateMachine{} --########################################################### --########## STATES --########################################################### Idle = State.create() Idle.onEnter = function(self) end Idle.onArrived = function(self) end --########################################################### --########## TETHER --########################################################### tether = State.create() tether.onEnter = function(self) -- Rebuild Reset -- self:RebuildReset() end tether.onArrived = function(self,msg) end --########################################################### --########## AGGRO --########################################################### aggro = State.create() -- Aggro onEnter aggro.onEnter = function(self) local INITIAL_ATTACK_TIME = 1 -- Start the heartbeat self:SetVar("readyToAttack", false) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) local myPos = getHomePoint(self) local target = getMyTarget(self) if target:IsDead().bDead then setState("tether",self) else self:SetTetherPoint { tetherPt = myPos,radius = 60 } -- self:FollowTarget { targetID = target, radius = 15 ,speed = 0 , keepFollowing = true } self:FaceTarget{ target = getMyTarget(self), degreesOff = 5, keepFacingTarget = true } end end -- end function aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = 1 GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) else onTimerDone(self, msg) end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end -- This will be called if FollowTarget fails. That would only fail because the target has died or logged out. In any case, the target was lost aggro.onCancelled = function(self, msg) setState("tether",self) end function DoAttack(self) if(self:GetVar("readyToAttack") == false) then return end if CanAttackTarget(self) then self:SetVar("readyToAttack", false) if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end self:CastSkill{skillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] } end end addState(Idle, "Idle", "Idle", self) addState(tether, "tether", "tether", self) addState(aggro, "aggro", "aggro", self) beginStateMachine("Idle", self) end --########################################################### --########## CAN ATTACK --########################################################### function CanAttackTarget(self) local myTarget = getMyTarget(self) local range = 12 local myPos = Vector.new(self:GetPosition().pos) local hisPos = Vector.new(myTarget:GetPosition().pos) local dist = hisPos - myPos if not myTarget:Exists() or myTarget:IsDead().bDead then setState("tether",self) return false end if self:GetVar("REBUILD_STATE") == "broke" then return false end -- If we are close enough and if the object is in the FOV, then attack if dist:sqrLength() <= range * range then --and (self:IsObjectInFOV { target = myTarget, radius = 5 , minRange = 0, maxRange = 100 }.result) then return true end return false end -- end CanAttackTarget --########################################################### --########## PROXIMITY --########################################################### function onProximityUpdate(self, msg) if msg.objType == "Enemies" or msg.objType == "NPC" or msg.objType == "Rebuildables" and msg.objId:GetFaction().faction == 1 and self:GetVar("REBUILD_STATE") ~= "broke" and msg.status == "ENTER" and msg.name == "aggroRadius" then storeTarget(self, msg.objId) setState("aggro", self) end if msg.objType == "Enemies" or msg.objType == "NPC" or msg.objType == "Rebuildables" and msg.objId:GetFaction().faction == 1 and self:GetVar("REBUILD_STATE") ~= "broke" and msg.status == "LEAVE" and msg.name == "resetRadius" then local pet = getPet(self, "Child" , 1 ) pet:Die{ killType = "SILENT" } GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "BreakStart",self ) end end --########################################################### --########## REBUILD NOTIFY --########################################################### function onRebuildNotifyState(self, msg) if (msg.iState) == 2 then GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "SpawnBase",self ) self:SetVar("REBUILD_STATE", "null") end if (msg.iState) == 1 then local targets = msg.player storeTarget(self, targets) self:FaceTarget{ target = targets, degreesOff = 5, keepFacingTarget = true } setState("aggro", self) end if (msg.iState) == 4 then -- Cancle self:SetImmunity{ immunity = true } self:SetVar("REBUILD_STATE", "broke") end end --########################################################### --########## ON HIT --########################################################### function onOnHit(self,msg) hp = self:GetHealth{}.health print("health ="..hp) if hp < 7 then storeTarget(self, msg.attacker) GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "BreakStart",self ) local pet = getPet(self, "Child" , 1 ) pet:Die{ killType = "SILENT"} setState("aggro", self) end end --########################################################### --########## CHILD LOADED --########################################################### onChildLoaded = function(self,msg) storePet(self, msg.childID, "Child" , 1 ) end --########################################################### --########## TIMER --########################################################### onTimerDone = function(self, msg) if msg.name == "BreakStart" then self:SetVar("REBUILD_STATE", "broke") self:RebuildReset() self:SetImmunity{ immunity = true } self:SetHealth{ health = 10 } end if msg.name == "BreakBase" then local pet = getPet(self, "Child" , 1 ) pet:Die{ killType = "SILENT" } end if msg.name == "SpawnBase" then local pos = getHomePoint(self) RESMGR:LoadObject { objectTemplate = 3086 , x= pos.x , y= pos.y , z= pos.z , owner = self } -- Student 1 self:SetImmunity{ immunity = false } end end require('o_mis') require('State') function onStartup(self) self:SetVar("Student_1", 0 ) self:SetVar("Student_2", 0 ) self:SetVar("Student_3", 0 ) self:SetVar("Student_4", 0 ) self:SetVar("Student_5", 0 ) self:SetVar("Student_6", 0 ) self:SetVar("Student_7", 0 ) self:SetVar("Student_8", 0 ) self:SetVar("Count", 0 ) self:SetVar("Loaded", false ) -- Student 2497 ----------------------------------------------------------------------------------------------- -- Create States ----------------------------------------------------------------------------------------------- self:UseStateMachine{} Idle = State.create() Idle.onEnter = function(self) if self:GetVar("Loaded") then GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "crane", self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "loadStudents", self ) end end Idle.onArrived = function(self) end addState(Idle, "Idle", "Idle", self) beginStateMachine("Idle", self) end onTimerDone = function(self, msg) if msg.name == "loadStudents" then local s = 1 local student = self:GetObjectsInGroup{ group = "Sensei_kids" }.objects --print(tostring(table.maxn (student))) if table.maxn (student) == 16 then for i = 1, table.maxn (student) do if ( student[i]:GetLOT().objtemplate == 2497 ) then storeObjectByName(self, "Student_"..s , student[i]) s = s + 1 end end self:SetVar("Loaded", true ) end setState("Idle", self ) end if msg.name == "crane" then for i = 1, 8 do Emote.emote( getObjectByName(self, "Student_"..i ), self , "crane" ) end Emote.emote( self, self, "crane" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 15.33 , "bow", self ) end if msg.name == "bow" then Emote.emote( self, self , "bow" ) for i = 1, 8 do Emote.emote( getObjectByName(self, "Student_"..i ), self , "bow" ) end Emote.emote( self, self, "bow" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "tiger", self ) end if msg.name == "tiger" then Emote.emote( self, self , "tiger" ) for i = 1, 8 do Emote.emote( getObjectByName(self, "Student_"..i ), self , "tiger" ) end Emote.emote( self, self, "tiger" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 15.33 , "bow2", self ) end if msg.name == "bow2" then Emote.emote( self, self, "bow" ) for i = 1, 8 do Emote.emote( getObjectByName(self, "Student_"..i ), self , "bow" ) end Emote.emote( self, self, "bow" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "mantis", self ) end if msg.name == "mantis" then Emote.emote( self, self, "mantis" ) for i = 1, 8 do Emote.emote( getObjectByName(self, "Student_"..i ), self , "mantis" ) end Emote.emote( self, self, "mantis" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 15.33, "bow3", self ) end if msg.name == "bow3" then Emote.emote( self, self, "bow" ) for i = 1, 8 do Emote.emote( getObjectByName(self, "Student_"..i ), self , "bow" ) end Emote.emote( self, self, "bow" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "repeat", self ) end if msg.name == "repeat" then GAMEOBJ:GetTimer():CancelAllTimers( self ) setState("Idle", self) end end function onStartup(self) endrequire('o_mis') require('State') function onStartup(self) self:SetVar("Student_1", 0 ) self:SetVar("Student_2", 0 ) self:SetVar("Student_3", 0 ) self:SetVar("Student_4", 0 ) self:SetVar("Student_5", 0 ) self:SetVar("Student_6", 0 ) self:SetVar("Student_7", 0 ) self:SetVar("Sensei_1", 0 ) self:SetVar("Bricks_1", 0 ) RESMGR:LoadObject { objectTemplate = 2497 , x= 256.084 , y= 270.126 , z= -230.392 , owner = self } -- Student 1 RESMGR:LoadObject { objectTemplate = 2497 , x= 258.456 , y= 270.127 , z= -238.713 , owner = self } -- Student 2 RESMGR:LoadObject { objectTemplate = 2497 , x= 268.206 , y= 270.127 , z= -227.332, owner = self } -- Student 3 RESMGR:LoadObject { objectTemplate = 2497 , x= 270.281 , y= 270.127 , z= -235.269 , owner = self } -- Student 4 RESMGR:LoadObject { objectTemplate = 2497 , x= 248.752 , y= 270.463 , z= -200.577 , owner = self } -- Student 5 RESMGR:LoadObject { objectTemplate = 2497 , x= 258.873 , y= 270.290 , z= -197.299 , owner = self } -- Student 6 RESMGR:LoadObject { objectTemplate = 2497 , x= 261.941 , y= 270.023 , z= -207.558 , owner = self } -- Student 7 local config = { {"groupID", "Minimap_MissionGivers"}, {"renderDisabled", false} } RESMGR:LoadObject { objectTemplate = 2498 , x= 201.760 , y= 274.553 , z= -232.331 , owner = self, configData = config } -- Sensei --RESMGR:LoadObject { objectTemplate = 2499 , x= 197.06 , y= 282.19 , z= -233.25 , owner = self } -- Bricks self:UseStateMachine{} --self:SetPosition{ x= 247, y= 270, z= -199 } ------------------------------------------------------ Idle Idle = State.create() Idle.onEnter = function(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "crane", self ) end Idle.onArrived = function(self) end ------------------------------------------------------- Anima 1 Animaton_1 = State.create() Animaton_1.onEnter = function(self) end ------------------------------------------------------- Anima 2 Animaton_1.onArrived = function(self) end Animaton_2 = State.create() Animaton_2.onEnter = function(self) end Animaton_2.onArrived = function(self) end addState(Animaton_1, "Animaton_1", "Animaton_1", self) addState(Animaton_2, "Animaton_2", "Animaton_2", self) addState(Idle, "Idle", "Idle", self) beginStateMachine("Idle", self) end onChildLoaded = function(self,msg) if msg.childID:GetLOT().objtemplate == 2497 then for i = 1, 7 do if self:GetVar("Student_"..i) == 0 then storePet(self, msg.childID, "Student_" , i ) break end end msg.childID:SetRotation(self:GetRotation()) end if msg.childID:GetLOT().objtemplate == 2498 then if self:GetVar("Sensei_1") == 0 then storePet(self, msg.childID, "Sensei_" , 1 ) msg.childID:FaceTarget{location = {x= 207.880, z=-230.764}} msg.childID:FaceTarget{location = {x= 207.880, z=-230.764}} end end if msg.childID:GetLOT().objtemplate == 2499 then if self:GetVar("Bricks_1") == 0 then storePet(self, msg.childID, "Bricks_" , 1 ) setState("Animaton_1",self) end end msg.childID:SetParentObj{ bSetToSelf = false } end function emote(self,target,skillType) self:SetVar("EmbeddedTime", self:GetAnimationTime{ animationID = skillType }.time) self:PlayFXEffect {priority = 1.2, effectType = skillType} end onTimerDone = function(self, msg) if msg.name == "crane" then Emote.emote( self, self , "crane" ) getPet(self, "Sensei_" , 1 ):SetRotation{ y= 0.51481799602509, x= 0, w=0.8038604259491, z=0 } for i = 1, 7 do Emote.emote( getPet(self, "Student_" , i ), getPet(self, "Student_" , i ) , "crane" ) end Emote.emote( getPet(self, "Sensei_" , 1 ), getPet(self, "Sensei_" , 1 ) , "crane" ) --Emote.emote( getPet(self, "Bricks_" , 1 ), getPet(self, "Bricks_" , 1 ) , "crane" ) getPet(self, "Sensei_" , 1 ):FaceTarget{location = {x= 253.02, z=-219.15}} GAMEOBJ:GetTimer():AddTimerWithCancel( 15.33 , "bow", self ) end if msg.name == "bow" then Emote.emote( self, self , "bow" ) for i = 1, 7 do Emote.emote( getPet(self, "Student_" , i ), getPet(self, "Student_" , i ) , "bow" ) end Emote.emote( getPet(self, "Sensei_" , 1 ), getPet(self, "Sensei_" , 1 ) , "bow" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "tiger", self ) end if msg.name == "tiger" then Emote.emote( self, self , "tiger" ) for i = 1, 7 do Emote.emote( getPet(self, "Student_" , i ), getPet(self, "Student_" , i ) , "tiger" ) end Emote.emote( getPet(self, "Sensei_" , 1 ), getPet(self, "Sensei_" , 1 ) , "tiger" ) -- Emote.emote( getPet(self, "Bricks_" , 1 ), getPet(self, "Bricks_" , 1 ) , "tiger" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 15.33 , "bow2", self ) end if msg.name == "bow2" then Emote.emote( self, self , "bow" ) for i = 1, 7 do Emote.emote( getPet(self, "Student_" , i ), getPet(self, "Student_" , i ) , "bow" ) end Emote.emote( getPet(self, "Sensei_" , 1 ), getPet(self, "Sensei_" , 1 ) , "bow" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "mantis", self ) end if msg.name == "mantis" then Emote.emote( self, self , "mantis" ) for i = 1, 7 do Emote.emote( getPet(self, "Student_" , i ), getPet(self, "Student_" , i ) , "mantis" ) end Emote.emote( getPet(self, "Sensei_" , 1 ), getPet(self, "Sensei_" , 1 ) , "mantis" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 15.33, "bow3", self ) end if msg.name == "bow3" then Emote.emote( self, self , "bow" ) for i = 1, 7 do Emote.emote( getPet(self, "Student_" , i ), getPet(self, "Student_" , i ) , "bow" ) end Emote.emote( getPet(self, "Sensei_" , 1 ), getPet(self, "Sensei_" , 1 ) , "bow" ) --Emote.emote( getPet(self, "Bricks_" , 1 ), getPet(self, "Bricks_" , 1 ) , "mantis" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "repeat", self ) end if msg.name == "repeat" then GAMEOBJ:GetTimer():CancelAllTimers( self ) setState("Idle", self) end end --------------------------------------------------------- --FV QB turret 1 --------------------------------------------------------- function onStartup(self) self:SetVar("AmBuilt", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then self:SetVar("AmBuilt", true) --self:PlayFXEffect{name = "laser", effectID = 478, effectType = "create"} for groupName in string.gmatch(self:GetVar("groupID"), "%w+;") do -------------------------------------------------------------- --if the rebuild is complete, get my group name and trim off the ';'s -------------------------------------------------------------- groupName = string.sub(groupName, 1, -2) mygroup = self:GetObjectsInGroup{group = groupName, ignoreSpawners = true}.objects -------------------------------------------------------------- --tell the object in my group with ID 7816 (the horseman) to die --tell the effects node (9889) to play effects -------------------------------------------------------------- for i, object in ipairs(mygroup) do if object:GetLOT().objtemplate == 7816 then --object:PlayFXEffect{name = "bullet_explosion", effectID = 1133, effectType = create} object:Die{killType = "VIOLENT"} elseif object:GetLOT().objtemplate == 9889 then --object:PlayFXEffect{name = "glow", effectID = 935, effectType = "create"} object:NotifyObject{name = "DoorUp"} end end end elseif msg.iState == 4 then self:SetVar("AmBuilt", false) --print("iState == 4") for groupName in string.gmatch(self:GetVar("groupID"), "%w+;") do -------------------------------------------------------------- --if I'm broken, find the objects in my group and trim off the ';'s -------------------------------------------------------------- groupName = string.sub(groupName, 1, -2) mygroup = self:GetObjectsInGroup{group = groupName, ignoreSpawners = true}.objects -------------------------------------------------------------- --tell the effects node in my group (9889) to stop playing effects -------------------------------------------------------------- for i, object in ipairs(mygroup) do if object:GetLOT().objtemplate == 9889 then --object:StopFXEffect{name = "glow"} object:NotifyObject{name = "DoorDown"} end end end end end function onFireEvent(self, msg) --print("notify object") if msg.args == "ISpawned" and self:GetVar("AmBuilt") then msg.senderID:Die{killType = "VIOLENT"} end end------------------------------------------------------------------------------ --paradox refinery pipe quickbuilds that update the mission once all are built ------------------------------------------------------------------------------ function onStartup(self) self:SetVar("AmBuilt", false) self:SetVar("Pipe2Built", false) self:SetVar("Pipe3Built", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then self:SetVar("AmBuilt", true) if self:GetVar("Pipe2Built") ==true and self:GetVar("Pipe3Built") == true then print("mission completed") msg.player:UpdateMissionTask{taskType = "complete", value = 769, value2 = 1, target = self} msg.player:PlayCinematic{pathName = "ParadoxPipeFinish", leadIn = 2.0} return end local object = self:GetObjectsInGroup{group = "ParadoxPipes2", ignoreSpawners = true}.objects[1] if object then print("telling pipe 2 I am built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe1Up", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "ParadoxPipes3", ignoreSpawners = true}.objects[1] if object then print("telling pipe 3 I am built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe1Up", ObjIDSender = self} end elseif msg.iState == 4 then self:SetVar("AmBuilt", false) local object = self:GetObjectsInGroup{group = "ParadoxPipes2", ignoreSpawners = true}.objects[1] if object then print("telling pipe 2 I am NOT built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe1Down", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "ParadoxPipes3", ignoreSpawners = true}.objects[1] if object then print("telling pipe 3 I am NOT built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe1Down", ObjIDSender = self} end end end function onNotifyObject(self, msg) if msg.name == "Pipe2Up" then self:SetVar("Pipe2Built", true) elseif msg.name == "Pipe2Down" then self:SetVar("Pipe2Built", false) elseif msg.name == "Pipe3Up" then self:SetVar("Pipe3Built", true) elseif msg.name == "Pipe3Down" then self:SetVar("Pipe3Built", false) end end------------------------------------------------------------------------------ --paradox refinery pipe 2 quickbuild that update the mission once all are built ------------------------------------------------------------------------------ function onStartup(self) self:SetVar("Pipe1Built", false) self:SetVar("AmBuilt", false) self:SetVar("Pipe3Built", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then self:SetVar("AmBuilt", true) if self:GetVar("Pipe1Built") ==true and self:GetVar("Pipe3Built") == true then print("mission completed") msg.player:UpdateMissionTask{taskType = "complete", value = 769, value2 = 1, target = self} msg.player:PlayCinematic{pathName = "ParadoxPipeFinish", leadIn = 2.0} return end local object = self:GetObjectsInGroup{group = "ParadoxPipes1", ignoreSpawners = true}.objects[1] if object then print("telling pipe 1 I am built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe2Up", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "ParadoxPipes3", ignoreSpawners = true}.objects[1] if object then print("telling pipe 3 I am built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe2Up", ObjIDSender = self} end elseif msg.iState == 4 then self:SetVar("AmBuilt", false) local object = self:GetObjectsInGroup{group = "ParadoxPipes1", ignoreSpawners = true}.objects[1] if object then print("telling pipe 1 I am NOT built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe2Down", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "ParadoxPipes3", ignoreSpawners = true}.objects[1] if object then print("telling pipe 3 I am NOT built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe2Down", ObjIDSender = self} end end end function onNotifyObject(self, msg) if msg.name == "Pipe1Up" then self:SetVar("Pipe1Built", true) elseif msg.name == "Pipe1Down" then self:SetVar("Pipe1Built", false) elseif msg.name == "Pipe3Up" then self:SetVar("Pipe3Built", true) elseif msg.name == "Pipe3Down" then self:SetVar("Pipe3Built", false) end end------------------------------------------------------------------------------ --paradox refinery pipe 3 quickbuild that update the mission once all are built ------------------------------------------------------------------------------ function onStartup(self) self:SetVar("Pipe1Built", false) self:SetVar("Pipe2Built", false) self:SetVar("AmBuilt", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then self:SetVar("AmBuilt", true) if self:GetVar("Pipe1Built") ==true and self:GetVar("Pipe2Built") == true then print("mission completed") msg.player:UpdateMissionTask{taskType = "complete", value = 769, value2 = 1, target = self} msg.player:PlayCinematic{pathName = "ParadoxPipeFinish", leadIn = 2.0} return end local object = self:GetObjectsInGroup{group = "ParadoxPipes1", ignoreSpawners = true}.objects[1] if object then print("telling pipe 1 I am built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe3Up", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "ParadoxPipes2", ignoreSpawners = true}.objects[1] if object then print("telling pipe 2 I am built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe3Up", ObjIDSender = self} end elseif msg.iState == 4 then self:SetVar("AmBuilt", false) local object = self:GetObjectsInGroup{group = "ParadoxPipes1", ignoreSpawners = true}.objects[1] if object then print("telling pipe 1 I am NOT built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe3Down", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "ParadoxPipes2", ignoreSpawners = true}.objects[1] if object then print("telling pipe 2 I am NOT built") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "Pipe3Down", ObjIDSender = self} end end end function onNotifyObject(self, msg) if msg.name == "Pipe1Up" then self:SetVar("Pipe1Built", true) elseif msg.name == "Pipe1Down" then self:SetVar("Pipe1Built", false) elseif msg.name == "Pipe2Up" then self:SetVar("Pipe2Built", true) elseif msg.name == "Pipe2Down" then self:SetVar("Pipe2Built", false) end end------------------------------------------------------------------------------ --paradox refinery pipe quickbuilds that update the mission once all are built -- --Created by SY 7/28/10 ------------------------------------------------------------------------------ function onRebuildComplete(self, msg) local myGroup = "AllPipes" local groupObjs = self:GetObjectsInGroup{ group = myGroup, ignoreSpawners = true }.objects local indexCount = 0 self:SetVar("PlayerID", "|" .. msg.userID:GetID()) for k,v in ipairs(groupObjs) do if v:GetRebuildState().iState == 2 then indexCount = indexCount + 1 end end if indexCount >= 2 then local refinery = self:GetObjectsInGroup{ group = "Paradox", ignoreSpawners = true }.objects[1] if refinery then refinery:PlayFXEffect{name = "pipeFX", effectID = 3999, effectType = "create"} end for k,v in ipairs(groupObjs) do local player = GAMEOBJ:GetObjectByID(v:GetVar("PlayerID")) if player and player:Exists() then player:UpdateMissionTask{taskType = "complete", value = 769, value2 = 1, target = self} player:PlayCinematic{pathName = "ParadoxPipeFinish", leadIn = 2.0} end v:SetVar("PlayerID", false) end end end function onRebuildNotifyState(self, msg) if msg.iState == 4 then local refinery = self:GetObjectsInGroup{ group = "Paradox", ignoreSpawners = true }.objects[1] if refinery then refinery:StopFXEffect{name = "pipeFX"} end end end ---------------------------------------------------------------------- --updates achievement when player passes through a volume ---------------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("collided") local player = msg.objectID if player:CheckPrecondition{ PreconditionID = 53,iPreconditionType = 0 }.bPass then player:UpdateMissionTask{taskType = "complete", value = 848, value2 = 1, target = self} end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 40 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 40 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 40 -- Tether Radius Set['tetherSpeed'] = 2 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 4 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.6 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end ------------------------------------------------------------- --Ronin script that kills them after a certain time ------------------------------------------------------------- function onStartup(self) self:AddObjectToGroup{group = "RoninEnemies"} GAMEOBJ:GetTimer():AddTimerWithCancel( 60 , "Dead", self ) end function onTimerDone(self, msg) if msg.name == "Dead" then self:RequestDie{killType = SILENT} end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Darkling Robotonist" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 80 -- Tether Radius Set['tetherSpeed'] = 3 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end ------------------------------------------------------ --Spawns a ronin from the statue ------------------------------------------------------ local interactRadius = 15 local hatchTime = 2.0 function onStartup(self) self:SetVar("hatching", false) self:SetProximityRadius { radius = interactRadius } --print("Egg Startup!") end function onProximityUpdate(self, msg) --print("proximity update!") local isHuman = msg.objId:IsCharacter().isChar local player = msg.objId --local hatchSpider = 1 --local chanceToHatch = math.random(2) if (msg.status == "ENTER") and (isHuman) and self:GetVar("hatching") == false --[[and (chanceToHatch == hatchSpider)--]] then -------------------------------------------------------------- --when a human player enters the proximity of the statue, start --a timer and cast a skill to have nearby statues start to spawn too -------------------------------------------------------------- --print("Look out!") player:UpdateMissionTask{taskType = "complete", value = 845, value2 = 1, target = self} self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 2260, effectType = "rebuild_medium"} self:CastSkill{skillID = 305} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) --local pos = self:GetPosition().pos --self:Die() --RESMGR:LoadObject { objectTemplate = 6444 , x = pos.x , y = pos.y , z = pos.z , owner = self } --elseif (chanceToHatch ~= hatchSpider) then --print("I'm a dud!") end end function onOnHit(self, msg) --print("egg hit!") if self:GetVar("hatching") == false then -------------------------------------------------------------- --if the statue isn't hatching already, then begin the hatching --timer on hit -------------------------------------------------------------- self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 2260, effectType = "rebuild_medium"} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) if msg.attacker:GetLOT().objtemplate ~= 8571 then self:CastSkill{skillID = 305} end end end function onTimerDone(self, msg) --print("timer done!") -------------------------------------------------------------- --play an effect, kill the statue, and spawn a ronin at statue location -------------------------------------------------------------- self:PlayFXEffect{name = "egg_puff_b", effectID = 644, effectType = "create"} local pos = self:GetPosition().pos self:Die() local config = { {"tetherRadius", 120 }, {"aggroRadius", 100}, {"wanderRadius", 70 }} RESMGR:LoadObject { objectTemplate = 7815 , x = pos.x , y = pos.y , z = pos.z , owner = self,configData = config } endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 15 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 60 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 10 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 15 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 60 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 10 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end ---------------------------------------------------------------- -- base logic for shrine spawners; when all players -- have left the proximity the waitTime starts, when this is -- finished a random spawnNumbers will be picked and spawned -- updated mrb... 12/15/09 ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the template onStartUp happens ---------------------------------------------------------------- function baseOnStartUp(self, gVars) -- send the configured variables to the base script math.randomseed( os.time() ) self:SetProximityRadius { radius = gVars.proxRaidus, name = gVars.spawnerNames[1] } spawnMobs(self, gVars) end function getPlayerNum(self, tObj) local playerNum = 0 for k,v in pairs(tObj) do if v:GetFaction().faction == 1 then playerNum = playerNum + 1 end end --print('player num ' .. playerNum) return playerNum end ---------------------------------------------------------------- -- called when the template onProximityUpdate happens ---------------------------------------------------------------- function baseOnProximityUpdate(self, msg, gVars) if msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 then --print('In') GAMEOBJ:GetTimer():CancelAllTimers(self) elseif msg.status == "LEAVE" and msg.objId:GetFaction().faction == 1 then --print('Out') local playerNum = getPlayerNum(self, self:GetProximityObjects{ name = gVars.spawnerNames[1] }.objects) if playerNum < 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( gVars.waitTime, "DealyTimer", self ) elseif playerNum < 2 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "CheckTimer", self ) end end end ---------------------------------------------------------------- -- called when the template onTimerDone happens ---------------------------------------------------------------- function baseOnTimerDone(self, msg, gVars) if msg.name == "DealyTimer" then --print(#self:GetProximityObjects{ name = gVars.spawnerNames[1] }.objects) if getPlayerNum(self, self:GetProximityObjects{ name = gVars.spawnerNames[1] }.objects) < 1 then --print('spawnMobsNow') spawnMobs(self, gVars) else --print('timer again') GAMEOBJ:GetTimer():AddTimerWithCancel( gVars.waitTime, "DealyTimer", self ) end elseif msg.name == "CheckTimer" then --print(#self:GetProximityObjects{ name = gVars.spawnerNames[1] }.objects) local playerNum = getPlayerNum(self, self:GetProximityObjects{ name = gVars.spawnerNames[1] }.objects) if playerNum < 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( gVars.waitTime, "DealyTimer", self ) elseif playerNum < 2 then --print('timer again') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "CheckTimer", self ) end end end ---------------------------------------------------------------- -- Custom function: Kills all of the mobs on the spawner networks ---------------------------------------------------------------- function killMobs(spawnNetwork) --print('in Kill') for k,v in pairs(spawnNetwork.spawnerNames) do local spawner = LEVEL:GetSpawnerByName(v) if spawner then --print('kill now') spawner:SpawnerDestroyObjects() spawner:SpawnerDeactivate() end end end ---------------------------------------------------------------- -- Custom function: Decides how to spawne mobs ---------------------------------------------------------------- function spawnMobs(self, tNetwork) --print('spawnMobs') killMobs(tNetwork) local rand = math.random(1, #tNetwork.spawnNumbers) for i = 1, #tNetwork.spawnNumbers[rand] do local spawner = LEVEL:GetSpawnerByName(tNetwork.spawnerNames[i]) if spawner then spawner:SpawnerSetNumToMaintain{uiNum = tNetwork.spawnNumbers[rand][i]} if not spawner:SpawnerIsActive().bActive then --print('activate now ' .. tNetwork.spawnerNames[i] .. ' number to maintain ' .. tNetwork.spawnNumbers[rand][i] ) spawner:SpawnerActivate() end --print('reset now') spawner:SpawnerReset() end end end function onOnHit(self, msg) local player = msg.attacker local missionState = player:GetMissionState{missionID = 509}.missionState if missionState == 1 then -- Mission has not been accepted yet return end if missionState > 7 then -- Any mission 8 or higher is complete return end local BrickLot = -1 local MyLot = self:GetLOT{}.objtemplate local PreconditionNum = -1 if MyLot == 7606 then BrickLot = 7436 PreconditionNum = 100 elseif MyLot == 7620 then BrickLot = 7437 PreconditionNum = 101 elseif MyLot == 7621 then BrickLot = 7438 PreconditionNum = 102 elseif MyLot == 7622 then BrickLot = 7439 PreconditionNum = 103 end if player:CheckPrecondition{ PreconditionID = PreconditionNum,iPreconditionType = 0 }.bPass then -- player already has one, don't spawn another return end if BrickLot ~= -1 then local newSpawner = GAMEOBJ:GenerateSpawnedID() self:DropLoot{owner = player, lootID = newSpawner, itemTemplate = BrickLot, rerouteID = player, sourceObj = self} end end ----------------------------------------------------------------------------- --candle script to turn the effects off and on again ----------------------------------------------------------------------------- function onOnHit(self, msg) self:SetHealth{health = 9999} end--------------------------------------------------------------- --left console to be rebuilt to cause the blue brick to become available --------------------------------------------------------------- function onStartup(self) self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then --print("console built") self:SetVar("IAmBuilt", true) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console built, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleLeftUp", ObjIDSender = self} end elseif msg.iState == 4 then self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console destroyed, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleLeftDown", ObjIDSender = self} end end end function onUse(self, msg) --print("console being used") if self:GetVar("AmActive") == true then return end if self:GetVar("IAmBuilt") == true then self:SetVar("AmActive", true) --print("the console has been activated") local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console activated") object:NotifyObject{name = "ConsoleLeftActive", ObjIDSender = self} end end end--------------------------------------------------------------- --right console to be rebuilt to cause the blue brick to become available --------------------------------------------------------------- function onStartup(self) self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then --print("console built") self:SetVar("IAmBuilt", true) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console built, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleRightUp", ObjIDSender = self} end elseif msg.iState == 4 then self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console destroyed, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleRightDown", ObjIDSender = self} end end end function onUse(self, msg) --print("console being used") if self:GetVar("AmActive") == true then return end if self:GetVar("IAmBuilt") == true then self:SetVar("AmActive", true) --print("the console has been activated") local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console activated") object:NotifyObject{name = "ConsoleRightActive", ObjIDSender = self} end end end-------------------------------------------------------------------------- --object playing effects in the crypt scene -------------------------------------------------------------------------- function onFireEventServerSide(self, msg) if msg.args ~= "DoorReady" then return end self:PlayFXEffect{name = "smoke", effectID = 2847, effectType = "create"} end function onNotifyObject(self, msg) --print("got message") if msg.name == "DoorUp" then --print("door is up") self:PlayFXEffect{name = "door", effectID = 2844, effectType = "create"} self:StopFXEffect{name = "smoke"} elseif msg.name == "DoorDown" then --print("door is down") self:PlayFXEffect{name = "smoke", effectID = 2847, effectType = "create"} self:StopFXEffect{name = "door"} end end-- Script for the golem QB which will need to be completed to expose the Maelstrom Dragon's weak point to the player function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 10.5 , "GolemBreakTimer", self ) end function onRebuildNotifyState(self, msg) local Dragon = self:GetParentObj().objIDParent if( Dragon == nil or Dragon:Exists() == false ) then return end -- a player just did the quickbuild. if (msg.iState == 2) then -- Notify the Dragon that the build is done and using the player as the sender so we can update missions. Dragon:NotifyObject{ ObjIDSender = msg.player, name = "rebuildDone" } GAMEOBJ:GetTimer():CancelTimer("GolemBreakTimer", self); -- Cancel the revive timer to restart it GAMEOBJ:GetTimer():AddTimerWithCancel( 10.5 , "GolemBreakTimer", self ) --self:PlayAnimation{ animationID = "dragonsmash1" } self:PlayAnimation{ animationID = "dragonsmash" } -- GAMEOBJ:GetTimer():AddTimerWithCancel( 3.667 , "loopingTimer", self ) end -- the rebuild was cancelled if (msg.iState == 4) then Dragon:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } end end function onDie(self, msg) local Dragon = self:GetParentObj().objIDParent if( Dragon == nil or Dragon:Exists() == false ) then return end Dragon:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } end onTimerDone = function(self, msg) if msg.name == "GolemBreakTimer" then self:SetRebuildState{iState = 4} self:Die{} end -- if msg.name == "loopingTimer" then -- self:PlayAnimation{ animationID = "dragonsmash2" } -- GAMEOBJ:GetTimer():AddTimerWithCancel( 9, "endTimer", self ) -- end -- if msg.name == "endTimer" then -- self:PlayAnimation{ animationID = "dragonsmash3" } -- end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 75 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} GAMEOBJ:GetTimer():AddTimerWithCancel( 40 , "StromDie", self ) end function onTimerDone(self, msg) if msg.name == "StromDie" then self:RequestDie{} end end --------------------------------------------------------------------- --plays effects and spawns in the imagination brick in the paradox facility in FV --------------------------------------------------------------------- function onStartup(self) self:SetVar("ConsoleLEFTActive", false) self:SetVar("ConsoleRIGHTtActive", false) end function onFireEventServerSide(self, msg) -------------------------------------------------------------- --plays effects once it recieves a specific server side message -------------------------------------------------------------- if msg.args ~= "PlayFX" then return end self:PlayFXEffect{name = "LeftPipeOff", effectID = 2774, effectType = "create"} self:PlayFXEffect{name = "RightPipeOff", effectID = 2777, effectType = "create"} self:PlayFXEffect{name = "imagination_canister", effectID = 2750, effectType = "create"} self:PlayFXEffect{name = "canister_light_filler", effectID = 2751, effectType = "create"} end function onNotifyObject(self, msg) local BrickSpawner = LEVEL:GetSpawnerByName("ImaginationBrick") local BugSpawner = LEVEL:GetSpawnerByName("MaelstromBug") local CanisterSpawner = LEVEL:GetSpawnerByName("BrickCanister") -------------------------------------------------------------- --checking for the status of the consoles to see whether they are built and/or active -------------------------------------------------------------- if msg.name == "ConsoleLeftUp" then self:StopFXEffect{name = "LeftPipeOff"} self:PlayFXEffect{name = "LeftPipeEnergy", effectID = 2775, effectType = "create"} elseif msg.name == "ConsoleLeftDown" then self:SetVar("ConsoleLEFTActive", false) self:StopFXEffect{name = "LeftPipeEnergy"} self:StopFXEffect{name = "LeftPipeOn"} self:PlayFXEffect{name = "LeftPipeOff", effectID = 2774, effectType = "create"} elseif msg.name == "ConsoleLeftActive" then self:SetVar("ConsoleLEFTActive", true) self:StopFXEffect{name = "LeftPipeEnergy"} self:PlayFXEffect{name = "LeftPipeOn", effectID = 2776, effectType = "create"} elseif msg.name == "ConsoleRightUp" then self:StopFXEffect{name = "RightPipeOff"} self:PlayFXEffect{name = "RightPipeEnergy", effectID = 2778, effectType = "create"} elseif msg.name == "ConsoleRightDown" then self:SetVar("ConsoleRIGHTActive", false) self:StopFXEffect{name = "RightPipeEnergy"} self:StopFXEffect{name = "RightPipeOn"} self:PlayFXEffect{name = "RightPipeOff", effectID = 2777, effectType = "create"} elseif msg.name == "ConsoleRightActive" then self:SetVar("ConsoleRIGHTActive", true) self:StopFXEffect{name = "RightPipeEnergy"} self:PlayFXEffect{name = "RightPipeOn", effectID = 2779, effectType = "create"} end -------------------------------------------------------------- --playing effects and/or spawning/killing objects based on whether or not the consoles are active -------------------------------------------------------------- if self:GetVar("ConsoleLEFTActive") == true and self:GetVar("ConsoleRIGHTActive") == true then -------------------------------------------------------------- --play effects on the blue brick and destroy the canister that --it is inside of if both consoles are active -------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "Brick", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "bluebrick", effectID = 122, effectType = "create"} object:PlayFXEffect{name = "imaginationexplosion", effectID = 1034, effectType = "cast"} end local object = self:GetObjectsInGroup{group = "Canister", ignoreSpawners = true}.objects[1] if object then object:RequestDie{killType = "SILENT"} end CanisterSpawner:SpawnerDestroyObjects() CanisterSpawner:SpawnerDeactivate() elseif self:GetVar("ConsoleLEFTActive") == true or self:GetVar("ConsoleRIGHTActive") == true then -------------------------------------------------------------- --spawn the brick in and kill off the fish if only one console is active --also bring the canister back in if it was removed while the brick was in -------------------------------------------------------------- BrickSpawner:SpawnerActivate() local object = self:GetObjectsInGroup{group = "Brick", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "bluebrick"} end BugSpawner:SpawnerDestroyObjects() BugSpawner:SpawnerDeactivate() CanisterSpawner:SpawnerReset() CanisterSpawner:SpawnerActivate() else BrickSpawner:SpawnerDestroyObjects() BrickSpawner:SpawnerDeactivate() BrickSpawner:SpawnerReset() BugSpawner:SpawnerReset() BugSpawner:SpawnerActivate() end end-- When the flying dragon arrives at certain waypoints it tells objects on the platforms to fire skills. function onArrived(self, msg) if msg.wayPoint == 4 then self:PlayAnimation{ animationID = "attack1", fPriority = 2 } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.75 , "platform1attack", self ) end if msg.wayPoint == 12 then self:PlayAnimation{ animationID = "attack2", fPriority = 2 } local group2 = self:GetObjectsInGroup{ group = "dragonFireballs2" , ignoreSpawners = true}.objects if group2 == nil then return end group2[1]:CastSkill { skillID = 762 } local minionCount = 1 for i = 2, #group2 do if minionCount == 4 then return end if math.random(1,5) > 3 then group2[i]:CastSkill { skillID = 762 } minionCount = minionCount + 1 end end end if msg.wayPoint == 16 then self:PlayAnimation{ animationID = "attack3", fPriority = 2 } GAMEOBJ:GetTimer():AddTimerWithCancel( .5 , "platform3attack", self ) end end function onTimerDone(self, msg) if msg.name == "platform1attack" or msg.name == "platform3attack" then local groupName if msg.name == "platform1attack" then groupName = "dragonFireballs1" elseif msg.name == "platform3attack" then groupName = "dragonFireballs3" end local group = self:GetObjectsInGroup{ group = groupName , ignoreSpawners = true}.objects if group == nil then return end group[1]:CastSkill { skillID = 762 } local minionCount = 1 for i = 2, #group do if minionCount == 4 then return end if math.random(1,5) > 3 then group[i]:CastSkill { skillID = 762 } minionCount = minionCount + 1 end end end end function onFireEvent(self, msg) if ( msg.args == "fireball1") then self:CastSkill{skillID = 762} end end --------------------------------------------------------------------- --spawns x amount of imagination once the gong is hit depending on the items equipped --------------------------------------------------------------------- local lootLOT = 935 -- LOT of the loot object to spawn local numToSpawn = 2 -- number of loot objects to spawn local numToSpawnWithHammer = 12 -- number of loot objects to spawn when the hammer is equipped local cooldownTime = 5 -- how long to wait before you can interact with the object again function onOnHit(self, msg) --print("hit!") local player = msg.attacker self:SetHealth{health = 9999} if self:GetVar("bActive") then return end GAMEOBJ:GetTimer():AddTimerWithCancel( cooldownTime , "InteractionCooldown", self ) self:SetVar("bActive", true) --------------------------------------------------------------------- --check to see if the player has the hammer equipped --------------------------------------------------------------------- if player:CheckPrecondition{ PreconditionID = 96,iPreconditionType = 0 }.bPass then player:UpdateMissionTask{taskType = "complete", value = 847, value2 = 1, target = self} for i = 1, numToSpawnWithHammer do --print("spawning powerup for hammer") local newSpawner = GAMEOBJ:GenerateSpawnedID() self:DropLoot{owner = player, lootID = newSpawner, itemTemplate = lootLOT, --[[bUsePosition = true,--]] rerouteID = player, sourceObj = self} self:PlayFXEffect{effectType = "cast" } end --------------------------------------------------------------------- --spawn a regular amount if they don't have the hammer --------------------------------------------------------------------- else for i = 1, numToSpawn do --print("spawning powerup") local newSpawner = GAMEOBJ:GenerateSpawnedID() self:DropLoot{owner = player, lootID = newSpawner, itemTemplate = lootLOT, --[[bUsePosition = true,--]] rerouteID = player, sourceObj = self} self:PlayFXEffect{effectType = "cast" } end end end function onTimerDone(self, msg) --print("ready to spawn") if msg.name == "InteractionCooldown" then self:SetVar("bActive", false) end end -------------------------------------------------------------- -- server script on a trigger in FV to prototype Brick Fury shooting horsemen that have been lured into his range -- -- created Brandi... 2/19/10 -- updated Steve... 5/14/10 - added achievement update for 854 -------------------------------------------------------------- --when a player enters the trigger volume, add them to the player table function onCollisionPhantom(self,msg) -- check if the player collided with the trigger if msg.objectID:GetLOT().objtemplate == 1 then local player = msg.objectID -- already know it was a player that collided local ptable = self:GetVar("pTable") --table containing players in the volume if not ptable then -- if the table doesnt already exist (no one is in it), create it ptable = {} else for k,v in ipairs(ptable) do if v == player:GetID() then -- check to see if the player is already in the table return end end end -- the player isnt already in the table, so put them there table.insert(ptable,msg.objectID:GetID()) --set the table back to the set var self:SetVar("pTable",ptable) end end -- when the player leaves the trigger volume, remove them from the player table function onOffCollisionPhantom(self,msg) -- check to see if it was a player that left the volume if msg.objectID:GetLOT().objtemplate == 1 then -- check to see if there is a player table if self:GetVar("pTable") then local player = msg.objectID -- already know it was a player that collided local ptable = self:GetVar("pTable") local removeP = 0 -- create variable for the player for k,v in ipairs(ptable) do if v == player:GetID() then removeP = k break end end -- remove the player from the table table.remove(ptable,removeP) -- if there's still players in the table, set it back to set var, otherwise set it to nil if #ptable ~= 0 then self:SetVar("pTable",ptable) else self:SetVar("pTable",nil) end end end end function onFireEvent(self,msg) -- Fire event from scripts\ai\FV\L_ACT_HORSEMEN_1.lua if msg.args == "HorsemanDeath" then -- check for a player table local ptable = self:GetVar("pTable") if ptable then -- for all the players in the player table, check to see if they are in the lure the horsemen mission for k,v in ipairs(ptable) do local player = GAMEOBJ:GetObjectByID(v) if player:GetMissionState{missionID = 854}.missionState ~= 8 then -- if the player hasn't completed the achievement, then update it player:UpdateMissionTask{taskType = "complete", value = 854, value2 = 1, target = self} end if player:GetMissionState{missionID = 738}.missionState == 2 then -- accepted but not completed the mission player:UpdateMissionTask{taskType = "complete", value = 738, value2 = 1, target = self} end end end end end -- Script to make the dragon spawn in a QB on armor depletion to allow the player to smash the dragon --require('State') --require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["DragonSmashingGolem"] = 8340 CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 local chestObject = 11229 function onStartup(self) self:SetVar("Trg.1", 0 ) -- This is used to keep track of child objects (quick builds) since there is no function to "get" children --Used to identify that the "weak spot" is vulnerable self:SetVar("weakspot",0) -- 0 = not exposed, 1 = is exposed, 2 = not exposed but stunned self:SetStunImmunity{StateChangeType = "PUSH", bImmuneToStunAttack = true, bImmuneToInterrupt = true} -- Make immune to stuns self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true } -- Make immune to knockbacks and pulls end --check if armor is depleted then start timer and make it immune to damage function onOnHit(self, msg) self:PlayFXEffect{effectType = "gothit"} if self:GetArmor().armor < 1 then if self:GetVar("weakspot") == 0 then -- weakspot is NOT exposed GAMEOBJ:GetTimer():AddTimerWithCancel( 12 , "ReviveTimer", self )-- Set a time to revive the dragon self:EnableCombatAIComponent {bEnable = false} self:ClearThreatList() -- Clear out hate list so the enemy doesn't try to attack anyone self:CancelSkillCast() self:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true} -- fully stun the dragon so it can't move or attack self:SetStatusImmunity{StateChangeType = "PUSH", bImmuneToBasicAttack = true, bImmuneToDOT = true} -- Make immune to damage until the "weakspot" is exposed self:SetVar("weakspot", 2) -- sets to an unchecked weakspot value to set up enough time for the troll to spawn in and let animations play self:ChangeIdleFlags{off = 9} self:PlayAnimation{ animationID = "stunstart" , fPriority = 1.7} GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "timeToStunLoop", self ) -- spawn in the QB to smash the dragon in front of the dragon local mypos = self:GetPosition().pos local spawnFwd = self:GetPlayerForward().fwd spawnFwd.x = spawnFwd.x * 10 spawnFwd.z = spawnFwd.z * 10 local myRot = self:GetRotation() local parent = msg.killerID; --spawn quick build on dragon's look dir local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() oPos.pos = self:GetPosition().pos oPos.pos.y = oPos.pos.y oPos.pos.x = oPos.pos.x - (oDir.backward.x * 8) oPos.pos.z = oPos.pos.z - (oDir.backward.z * 8) local posString = self:CreatePositionString{ x = (oPos.pos.x+spawnFwd.x), y = oPos.pos.y, z = (oPos.pos.z+spawnFwd.z) }.string local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", 15}, {"no_timed_spawn", true}, {"currentTime", 0} } RESMGR:LoadObject { objectTemplate = CONSTANTS["DragonSmashingGolem"], x= mypos.x, y= mypos.y, z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y , rz = myRot.z, configData = config, owner = self } self:SetVar("QBAlive", true) end -- if the dragon is struck while weakspot is exposed if self:GetVar("weakspot") == 1 then self:RequestDie{killerID = GAMEOBJ:GetObjectByID(self:GetVar("Smasher"))} end end end -- Check timer to revive function onTimerDone(self, msg) -- Is it time for the dragon to get up and fight again? if msg.name == "ReviveHeldTimer" then GAMEOBJ:GetTimer():AddTimerWithCancel( 2.5 , "backToAttack", self ) -- self:PlayAnimation{ animationID = "quickbuildhold03" } -- Is it time to expose the dragon's weak spot? elseif msg.name == "ExposeWeakSpotTimer" then self:SetVar("weakspot", 1) -- the weak spot is now exposed self:SetStatusImmunity{StateChangeType = "POP", bImmuneToBasicAttack = true, bImmuneToDOT = true} --if msg.name == "LoopTimer" then -- self:PlayAnimation{ animationID = "quickbuildhold02" } --end elseif msg.name == "timeToStunLoop" then self:PlayAnimation{ animationID = "stunloop" , fPriority = 1.8} elseif msg.name == "ReviveTimer" then self:PlayAnimation{ animationID = "stunend" , fPriority = 2.0} GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "backToAttack", self ) elseif msg.name == "backToAttack" then self:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} self:SetStatusImmunity{StateChangeType = "POP", bImmuneToBasicAttack = true, bImmuneToDOT = true} self:EnableCombatAIComponent {bEnable = true} self:ChangeIdleFlags{on = 9} ProximityPuls(self) -- check proximity for enemies self:SetArmor{armor = 35} -- give partial armor back self:SetHealth{health = 100} -- give life back self:SetVar("weakspot", 0) -- weak spot is not exposed end end --Store the QB so we can use it to smash the Dragon function onChildLoaded( self,msg ) if ( msg.templateID == CONSTANTS["DragonSmashingGolem"]) then storeParent( self, msg.childID ) local t = self:GetVar("Trg") -- Save Target ID's/ for i = 1, table.maxn( t ) do if self:GetVar("Trg."..i) == nil or self:GetVar("Trg."..i) == 0 then storeChild(self, msg.childID , i) self:SetVar("Trg."..i+1, 0 ) end end end end --Notify the Dragon when the rebuild state changes function onNotifyObject( self, msg ) -- if the rebuild is complete if ( msg.name == "rebuildDone" ) then --Getting the sender ID which we set as the player and storing it for the DIE call self:SetVar("Smasher", "|" .. msg.ObjIDSender:GetID()) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.8 , "ExposeWeakSpotTimer", self ) GAMEOBJ:GetTimer():CancelTimer("ReviveTimer", self); -- Cancel the revive timer to restart it GAMEOBJ:GetTimer():AddTimerWithCancel( 10.5 , "ReviveHeldTimer", self ) self:PlayAnimation{ animationID = "quickbuildhold" , fPriority = 1.9} -- GAMEOBJ:GetTimer():AddTimerWithCancel( 2.6 , "LoopTimer", self ) -- Was the rebuild canceled? elseif ( msg.name == "rebuildCancel" ) then self:SetVar("QBAlive", false) end end function onDie(self,msg) -- get the location of the pet dig to spawn the crab there local mypos = self:GetPosition().pos local myRot = self:GetRotation() -- spawn a treasure chest RESMGR:LoadObject { objectTemplate = chestObject , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y , rz = myRot.z} for i = 1, table.maxn( self:GetVar("Trg")) do local child = getChild(self, i) if child:Exists() then child:RequestDie{killType = "VIOLENT"} end end end function getChild(self, num) targetID = self:GetVar("Trg."..num ) return GAMEOBJ:GetObjectByID(targetID) end function storeChild(self, target, num) idString = target:GetID() finalID = "|" .. idString self:SetVar("Trg."..num , finalID) end -- Script used to start and kill a skill on an object that will be randomly spawing through a spawner network. local mySkill = 831 function onStartup(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "startSkill", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.5 , "killSelf", self ) end function onTimerDone(self, msg) if msg.name == "startSkill" then self:CastSkill{skillID = mySkill} end if msg.name == "killSelf" then self:RequestDie() end end-------------------------------------------------------------- -- Script for Forbidden Valley Guards. There are two guards at the gate in FV. If you emote a "Roar" animation in front of either, the other laughs. -- created eb... 6/25/10 -------------------------------------------------------------- function onStartup(self,msg) -- Making both guards identifiable to getobjectsingroup self:AddObjectToGroup{group = "ninjaguard"} end function onEmoteReceived(self,msg) local ninjas = self:GetObjectsInGroup{ group = "ninjaguard"}.objects if (msg.emoteID ~= 392) then -- If player tries any emote other than roar, just shake her head self:PlayAnimation{ animationID = "no" } else if self:GetLOT().objtemplate == 7412 and msg then -- Make the guard look scared self:PlayAnimation{ animationID = "scared" } -- Tell the other guard to laugh for i = 1, table.maxn (ninjas) do if (ninjas[i]:GetLOT().objtemplate == 11128) then ninjas[i]:PlayAnimation{ animationID = "laugh_rt" } end end elseif self:GetLOT().objtemplate == 11128 then -- Make the guard look scared self:PlayAnimation{ animationID = "scared" } -- Tell the other guard to laugh for i = 1, table.maxn (ninjas) do if (ninjas[i]:GetLOT().objtemplate == 7412) then ninjas[i]:PlayAnimation{ animationID = "laugh_lt" } end end end end end-------------------------------------------------------------- -- Server side script on the panda pet -- this script control the pandas life before he is tamed by a player -- created by Steve... -- created from Brandi's Lion script... 2/17/10 -- updated by Dallas 7/29/10 - fixed 'or' statement -------------------------------------------------------------- function onStartup(self) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local player = self:GetVar("tamer") self:SetNetworkVar("pandatamer", player) --kill the panda after 2 minutes if the player who spawned it doesn't tame it GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "killSelf",self ) --print("panda pet server script starting up") end function onNotifyPetTamingMinigame(self,msg) --if the player begins the taming minigame, cancel the timer that kills the panda if msg.notifyType == "BEGIN" then GAMEOBJ:GetTimer():CancelTimer("killSelf",self) --if the player fails or quits the minigame, kill the panda elseif msg.notifyType == ("QUIT") or msg.notifyType == ("FAILED") then self:Die{killerID = self, killType = "SILENT"} --if the player succeeds in the minigame, command the panda to go to the player, otherwise he could teleport off -- because the minigame tells him to go to his spawn point, and he doesnt have one elseif msg.notifyType == "SUCCESS" then local player = msg.PlayerTamingID self:CommandPet{iPetCommandType = 6} local pandas = self:GetObjectsInGroup{ group = "pandas", ignoreSpawners = true }.objects --print("before "..#pandas) --print("remove object from group panda"..player:GetID()) self:RemoveObjectFromGroup{group = "pandas"} self:RemoveObjectFromGroup{group = "panda"..player:GetID()} local pandas2 = self:GetObjectsInGroup{ group = "pandas", ignoreSpawners = true }.objects --print("after "..#pandas2) player:SetFlag{iFlagID = 82, bFlag = true} end end function onTimerDone (self,msg) --print("panda server timer done") -- kill the panda if he's been alive for too long. pandas have a very short life span if (msg.name == "killSelf") then --print("panda timer finished, killSelf") --double check not to kill a panda that is actually someones pet if self:IsPetWild{}.bIsPetWild == false then --print("pet is wild") return end self:Die{killerID = self, killType = "SILENT"} end end ---------------------------------------------------------- --server side script for Panda ---------------------------------------------------------- --[[function onStartup(self) print("panda server starting up") end--]] function onFireEventServerSide(self, msg) if msg.args == "Foot_Race_Completed" then self:FireEventClientSide{args = msg.args} --print("firing serverside event") --mypos.x = mypos.x + 20 --set the tamer as the player to check that only this player can tame that lion -- and set the group id to include the player id to make sure this player can only spawn one lion at a time local config = { { "tamer", player:GetID() } , { "groupID", "lion"..player:GetID()..";lions" } } RESMGR:LoadObject { objectTemplate = 5643 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, configData = config } else return end end---------------------------------------------------------- --client side script to spawn the Panda ---------------------------------------------------------- function onCollisionPhantom(self, msg) --print("player collided") local player = msg.senderID --print("activity ID = " .. player:GetCurrentActivityID().iActivity) if player:GetFlag{iFlagID = 81}.bFlag --[[and not player:GetFlag{iFlagID = 82}.bFlag and player:GetCurrentActivityID().iActivity == 48--]] then --player:SetFlag{iFlagID = 81, bFlag = false} --self:FireEventClientSide{args = msg.args} local raceObject = self:GetObjectsInGroup{group = "PandaRaceObject", ignoreSpawners = true}.objects[1] if raceObject then --print("found race object") if raceObject:ActivityUserExists{userID = player}.bExists then --print("here comes the panda") local pandas = self:GetObjectsInGroup{ group = "pandas", ignoreSpawners = true }.objects local playerpanda = self:GetObjectsInGroup{ group = "panda"..player:GetID(), ignoreSpawners = true }.objects if #playerpanda > 0 then --print("You already spawned a panda") self:FireEventClientSide{args = "playerPanda", senderID = player} return end if #pandas > 4 then --print("There are too many pandas right now, try again in a few minutes") self:FireEventClientSide{args = "tooManyPandas", senderID = player} return end --print("spawning Panda Pet") --mypos.x = mypos.x + 20 --set the tamer as the player to check that only this player can tame that panda -- and set the group id to include the player id to make sure this player can only spawn one panda at a time local config = { { "tamer", player:GetID() } , { "groupID", "panda"..player:GetID()..";pandas" } } local mypos = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = 5643 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, configData = config } end end end endfunction onRebuildComplete(self, msg) local player = msg.userID:GetID() local object = self:GetObjectsInGroup{group = "qbtele_01", ignoreSpawners = true}.objects[1] if object then local tele = object:GetPosition().pos msg.userID:Teleport {pos = {x = tele.x, y = tele.y, z = tele.z}, bIgnoreY = false} --object:PlayFXEffect{name = "febuildpop", effectID = 105, effectType = "create"} end end-------------------------------------------------------------- -- template for setting up shrine spawners; when all players -- have left the proximity the waitTime starts, when this is -- finished a random spawnNumbers will be picked and spawned -- updated mrb... 12/15/09 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/FV/L_FV_BASE_SHRINE_SPAWNER') --============================================================ -- template specific local variables local gVars = { -- name of spawner networks from HF spawnerNames = {'temple_one_mob_a', 'temple_one_mob_b', 'temple_one_mob_c'}, -- how many of each spawnerNames to spawn; spawnerNames[2] corresponds to spawnNumbers[random][2] spawnNumbers = { {4, 0, 1},{1, 0, 0},{4, 0, 0},{2, 0, 0},{2, 1, 0},{4, 0, 0},{3, 0, 0},{0, 2, 1},{4, 0, 0},{2, 0, 0},{3, 1, 0},{4, 0, 0},{4, 0, 0},{0, 0, 3},{4, 0, 0},{0, 0, 0}}, -- this is the size of the proximity sphere proxRaidus = 200, -- how long to wait after all players/pets have left the proxRaidus before spawning in new mobs waitTime = 1, } --============================================================ -- happens when the script is loaded function onStartup(self) print('startup') baseOnStartUp(self, gVars) end -- happens when the proximity is updated function onProximityUpdate(self, msg) baseOnProximityUpdate(self, msg, gVars) end -- timers... function onTimerDone(self, msg) baseOnTimerDone(self, msg, gVars) end-------------------------------------------------------------- -- template for setting up shrine spawners; when all players -- have left the proximity the waitTime starts, when this is -- finished a random spawnNumbers will be picked and spawned -- updated mrb... 12/15/09 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/FV/L_FV_BASE_SHRINE_SPAWNER') --============================================================ -- template specific local variables local gVars = { -- name of spawner networks from HF spawnerNames = {'Area_1_Mob_A', 'Area_1_Mob_B','Area_1_Mob_C'}, -- how many of each spawnerNames to spawn; spawnerNames[2] corresponds to spawnNumbers[random][2] spawnNumbers = { {3, 0, 0},{1, 1, 1},{0, 3, 0},{0, 1, 2},{0, 0, 3} }, -- this is the size of the proximity sphere proxRaidus = 50, -- how long to wait after all players/pets have left the proxRaidus before spawning in new mobs waitTime = 1, } --============================================================ -- happens when the script is loaded function onStartup(self) baseOnStartUp(self, gVars) end -- happens when the proximity is updated function onProximityUpdate(self, msg) baseOnProximityUpdate(self, msg, gVars) end -- timers... function onTimerDone(self, msg) baseOnTimerDone(self, msg, gVars) end -------------------------------------------------------------- -- template for setting up shrine spawners; when all players -- have left the proximity the waitTime starts, when this is -- finished a random spawnNumbers will be picked and spawned -- updated mrb... 12/15/09 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/FV/L_FV_BASE_SHRINE_SPAWNER') --============================================================ -- template specific local variables local gVars = { -- name of spawner networks from HF spawnerNames = {'temple_three_mob_a', 'temple_three_mob_b','temple_three_mob_c'}, -- how many of each spawnerNames to spawn; spawnerNames[2] corresponds to spawnNumbers[random][2] spawnNumbers = { {4, 0, 0},{4, 0, 0},{2, 0, 1},{3, 1, 1},{4, 0, 0},{3, 1, 0},{3, 0, 0},{4, 0, 0},{3, 1, 0},{2, 0, 0},{4, 0, 0},{3, 0, 0},{5, 0, 0},{4, 0, 0},{4, 0, 0},{0, 2, 0},{4, 0, 0},{3, 0, 0},{3, 1, 1},{0, 0, 1} }, -- this is the size of the proximity sphere proxRaidus = 200, -- how long to wait after all players/pets have left the proxRaidus before spawning in new mobs waitTime = 1, } --============================================================ -- happens when the script is loaded function onStartup(self) print('startup') baseOnStartUp(self, gVars) end -- happens when the proximity is updated function onProximityUpdate(self, msg) baseOnProximityUpdate(self, msg, gVars) end -- timers... function onTimerDone(self, msg) baseOnTimerDone(self, msg, gVars) end -------------------------------------------------------------- -- template for setting up shrine spawners; when all players -- have left the proximity the waitTime starts, when this is -- finished a random spawnNumbers will be picked and spawned -- updated mrb... 12/15/09 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/FV/L_FV_BASE_SHRINE_SPAWNER') --============================================================ -- template specific local variables local gVars = { -- name of spawner networks from HF spawnerNames = {'temple_two_mob_a', 'temple_two_mob_b','temple_two_mob_c'}, -- how many of each spawnerNames to spawn; spawnerNames[2] corresponds to spawnNumbers[random][2] spawnNumbers = { {4, 0, 0},{2, 0, 0},{3, 1, 0},{2, 1, 1},{3, 0, 0},{0, 2, 0},{4, 0, 0},{2, 0, 0},{3, 1, 1},{3, 0, 0},{4, 0, 0},{0, 0, 1},{0, 0, 0} }, -- this is the size of the proximity sphere proxRaidus = 300, -- how long to wait after all players/pets have left the proxRaidus before spawning in new mobs waitTime = 1, } --============================================================ -- happens when the script is loaded function onStartup(self) --print('startup') baseOnStartUp(self, gVars) end -- happens when the proximity is updated function onProximityUpdate(self, msg) baseOnProximityUpdate(self, msg, gVars) end -- timers... function onTimerDone(self, msg) baseOnTimerDone(self, msg, gVars) end -------------------------------------------------------------- -- Description: -- -- Server script for Guild Master NPC in FV area. -- This NPC will react to a user interaction and display -- the guild creation screen. -------------------------------------------------------------- -- Sent from a player when trying to use this object -------------------------------------------------------------- function onUse(self, msg) -- show a dialog box msg.user:DisplayGuildCreateBox{bShow} end -------------------------------------------------------------- -- Server Script on the ninja guy in Forbidden valley -- this script adds all the free the ninjas missions -- updated Steve... 3/24/10 -------------------------------------------------------------- -- when the player accepts the free the ninjas mission, this gives him all of the ninjas free me missions function onMissionDialogueOK(self,msg) local player = msg.responder if msg.missionID == 705 and msg.iMissionState == 1 then player:AddMission{ missionID = 701} player:AddMission{ missionID = 702} player:AddMission{ missionID = 703} player:AddMission{ missionID = 704} player:SetFlag{iFlagID = 68, bFlag=true} elseif msg.missionID == 786 then player:SetFlag{iFlagID = 81, bFlag=true} end endrequire('o_mis') require('State') require('o_StateCreate') require('o_WayPoints') --/////////////////////////////////////////////////////////////////////////////////////// --// Seige Dir --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:SetVar("NumberOfChildern", 0 ) -- Dont not change this Val <<< self:SetVar("WP_Num", 1) -- Dont not change this Val <<< --///////////////////////////////////////////// -- Settings (Alpha =a) " a_1 (Num = 1) a_1 = the WayPoint Set --///////////////////////////////////////////// self:SetVar("PetNames", "pirate") self:SetVar("WP_Alpha", "n") -- starting letter of the Way Point ( a_1 = a) or (anyName_1) self:SetVar("MaxPets", 3) -- Max Pets Spawn in the wrold self:SetVar("TotalPets", 6) -- Total Number of Pets self:SetVar("PetID", 2584) --///////////////////////////////////////////// --///////////////////////////////////////////// -- define total pet IDs for i = 1, self:GetVar("TotalPets") do self:SetVar("Pet_"..i, self:GetVar("PetID")) -- attach WP to NPC self:SetVar("slot_"..i, nil ) end for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) self:SetVar(FinalName, "NotSpawned") end self:UseStateMachine{} ParentIdle = State.create() ParentIdle.onEnter = function(self) setState("ReSpawnChild",self) end ParentIdle.onArrived = function(self) end DeadChild = State.create() DeadChild.onEnter = function(self) local NChildern = self:GetVar("NumberOfChildern") - 1 self:SetVar("NumberOfChildern", NChildern ) setState("ReSpawnChild",self) end DeadChild.onArrived = function(self) end ---------------------------------------------------------------------------------- -- /////////////////////////////////////////////////////////////////////////////// -- ReSpawn Childern State -- /////////////////////////////////////////////////////////////////////////////// ReSpawnChild = State.create() ReSpawnChild.onEnter = function(self) if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") then local ran = GetValidRandom(self) for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) if ran == i and self:GetVar(FinalName) == "NotSpawned" then SpawnPet(self, i ) end end end end ReSpawnChild.onArrived = function(self) end ---------------------------------------------------------------------------------- addState(ParentIdle, "ParentIdle", "ParentIdle", self) addState(DeadChild, "DeadChild", "DeadChild", self ) addState(ReSpawnChild,"ReSpawnChild","ReSpawnChild",self) beginStateMachine("ParentIdle", self) ParentIdle.onEnter(self) end onChildLoaded = function(self,msg) local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("SpawnedVar", FinalName ) local FreeSlot = GetValidRandom(self) msg.childID:SetVar("attached_path", self:GetVar("WP_Alpha").."_"..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("I_Have_A_Parent", true ) storeParent(self, msg.childID) end --************************************************************************************ --** Funcitons --************************************************************************************ function SpawnPet(self, num ) for i = 1, self:GetVar("TotalPets") do if num == i then local firstWP = GAMEOBJ:GetWaypointPos( self:GetVar("WP_Alpha").."_"..i, 1) self:SetVar("ChildLoadNUM", i ) RESMGR:LoadObject { objectTemplate = self:GetVar( "Pet_"..i ) , x= firstWP.x , y= firstWP.y , z= firstWP.z , owner = self } -- A1 self:SetVar(self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i, "Spawned" ) local NChildern = self:GetVar("NumberOfChildern") + 1 self:SetVar("NumberOfChildern", NChildern ) break end end if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") + 1 then setState("ReSpawnChild",self) end end function GetValidRandom(self) while true do NUM = math.random(1,self:GetVar("TotalPets")) FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..NUM) if self:GetVar(FinalName) == "NotSpawned" then break end end return NUM end -------------------------------------------------------------- -- Server side to make an object only be smashable with a specific hammer -- this script is intended to prototype gameplay, not as a final solution. -- updated Brandi... 2/25/10 -------------------------------------------------------------- local hammers = { 2963,3014,3015,3016} function onOnHit(self,msg) local player = msg.attacker --makes sure the player is the only client to see this local item = player:GetEquippedItemType{ slot = "special_r" }.lotID local smash = false -- check to see if the player had one of the hammers equipped, door can only be smashed with one of the hammers for k,v in ipairs(hammers) do if item == v then smash = true break end end --if the player hit the door with one of the hammers if smash == true then self:RequestDie{killerID = self, killType = VIOLENT} else self:SetHealth{health = 99999} end endrequire('o_mis') require('State') function onCollisionPhantom(self, msg) if not self:GetVar("Trg") then self:SetVar("Trg.1", 0 ) end local target = msg.objectID if ( target:GetFaction().faction == 1 ) then local t = self:GetVar("Trg") -- Save Target ID's for i = 1, table.maxn( t ) do if self:GetVar("Trg."..i) == nil or self:GetVar("Trg."..i) == 0 then storePlayer(self, target , i) self:SetVar("running", true) setState("aggro", self) break end end end end function onOffCollisionPhantom (self,msg) local target = msg.senderID if ( target:GetFaction().faction == 1 ) then for i = 1, table.maxn( self:GetVar("Trg")) do if getPlayer(self, i):GetName().name == target:GetName().name then self:SetVar( "Trg."..i, nil ) break end end end end function CanAttackTarget(self , target) local myTarget = target local range = 50 local myPos = Vector.new(self:GetPosition().pos) local hisPos = Vector.new(target:GetPosition().pos) local dist = hisPos - myPos if not target:Exists() or target:IsDead().bDead then return false end if dist:sqrLength() <= range * range then return true end return false end -- end CanAttackTarget function onStartup(self) self:SetVar("running", false) -- Create Player Table Trg = {} Trg[1] = 0 self:SetVar("Trg",Trg) --########################################################### --########## STATES --########################################################### -- Idle Idle = State.create() Idle.onEnter = function(self) end Idle.onArrived = function(self) end -- Aggro aggro = State.create() aggro.onEnter = function(self) if self:GetVar("Trg") then for i = 1, table.maxn( self:GetVar("Trg")) do local Player = getPlayer(self, i) local item = Player:GetEquippedItemType{ slot = "hair" }.lotID if item ~= 3068 then self:CastSkill{ optionalTargetID = Player ,skillID = 103 } end if (Player:IsDead().bDead) then for i = 1, 10 do if getPlayer(self, i) == Player then table.remove(self:GetVar("Trg"), i) break end end end end end local theTime = GAMEOBJ:GetTimer():GetTime("timerAggro",self ) -- print(theTime) if self:GetVar("running") == true and self:GetVar("Trg") and theTime == 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "timerAggro", self ) else self:SetVar("running", false) end end aggro.onArrived = function(self) end addState(Idle, "Idle", "Idle", self) addState(aggro, "aggro", "aggro", self) beginStateMachine("Idle", self) end function getPlayer(self, num) targetID = self:GetVar("Trg."..num ) return GAMEOBJ:GetObjectByID(targetID) end function storePlayer(self, target, num) idString = target:GetID() finalID = "|" .. idString self:SetVar("Trg."..num , finalID) end onTimerDone = function(self, msg) if msg.name == "timerAggro" then setState("aggro",self) end end -------------------------------------------------------------- --pillar 1 script for gauntlet level -------------------------------------------------------------- function onStartup(self) --self:AddObjectToGroup{name = "pillar"} --print("pillar 1 starting up!") end function onDie(self, msg) --print("pillar 1 destroyed!") local friends = self:GetObjectsInGroup{group = "pillar", ignoreSpawners = true}.objects[1] if friends then friends:NotifyObject{name = "P_1_Destroyed", ObjIDSender = self} end end-------------------------------------------------------------- --pillar 2 script for gauntlet level -------------------------------------------------------------- function onStartup(self) --self:AddObjectToGroup{name = "pillar"} --print("pillar 2 starting up!") end function onDie(self, msg) --print("pillar 2 destroyed!") local friends = self:GetObjectsInGroup{group = "pillar", ignoreSpawners = true}.objects[1] if friends then friends:NotifyObject{name = "P_2_Destroyed", ObjIDSender = self} end end-------------------------------------------------------------- --pillar 3 script for gauntlet level -------------------------------------------------------------- function onStartup(self) --self:AddObjectToGroup{name = "pillar"} --print("pillar 3 starting up!") end function onDie(self, msg) --print("pillar 3 destroyed!") local friends = self:GetObjectsInGroup{group = "pillar", ignoreSpawners = true}.objects[1] if friends then friends:NotifyObject{name = "P_3_Destroyed", ObjIDSender = self} end end-------------------------------------------------------------- --pillar 4 script for gauntlet level -------------------------------------------------------------- function onStartup(self) --self:AddObjectToGroup{name = "pillar"} --print("pillar 4 starting up!") end function onDie(self, msg) --print("pillar 4 destroyed!") local friends = self:GetObjectsInGroup{group = "pillar", ignoreSpawners = true}.objects[1] if friends then friends:NotifyObject{name = "P_4_Destroyed", ObjIDSender = self} end end-------------------------------------------------------------- --Main Jail script for gauntlet level -------------------------------------------------------------- function onStartup(self) self:AddObjectToGroup{name = "pillar"} --print("Jail starting up!") self:SetVar("Pillar_1_Destroyed", false) self:SetVar("Pillar_2_Destroyed", false) self:SetVar("Pillar_3_Destroyed", false) self:SetVar("Pillar_4_Destroyed", false) end function onNotifyObject(self, msg) --print("Jail got a message!") if (msg.name == "P_1_Destroyed") then --print("first pillar destroyed!") self:SetVar("Pillar_1_Destroyed", true) elseif (msg.name == "P_2_Destroyed") then self:SetVar("Pillar_2_Destroyed", true) elseif (msg.name == "P_3_Destroyed") then self:SetVar("Pillar_3_Destroyed", true) elseif (msg.name == "P_4_Destroyed") then self:SetVar("Pillar_4_Destroyed", true) end if (self:GetVar("Pillar_1_Destroyed") == true) and (self:GetVar("Pillar_2_Destroyed") == true) and (self:GetVar("Pillar_3_Destroyed") == true) and (self:GetVar("Pillar_4_Destroyed") == true) then self:Die() --print("all pillars destroyed!") local spawnerObj = LEVEL:GetSpawnerByName("FinalSpawn") if spawnerObj then spawnerObj:SpawnerDeactivate() spawnerObj:SpawnerDestroyObjects() end end end CONSTANTS = {} CONSTANTS["DOOR1_LOT"] = 2892 CONSTANTS["DOOR2_LOT"] = 2893 CONSTANTS["DOOR3_LOT"] = 2894 CONSTANTS["DOOR4_LOT"] = 2895 function onCollision(self, msg) local player = msg.objectID local teleportTarget = {} local LOT = self:GetLOT().objtemplate if( LOT == CONSTANTS["DOOR1_LOT"] ) then teleportTarget = { x = -529, y = 208, z = 796 } elseif( LOT == CONSTANTS["DOOR2_LOT"] ) then teleportTarget = { x = -316, y = 198, z = 640 } elseif( LOT == CONSTANTS["DOOR3_LOT"] ) then teleportTarget = { x = -714, y = 208, z = 916 } elseif( LOT == CONSTANTS["DOOR4_LOT"] ) then teleportTarget = { x = 632, y = 208, z = 558 } end player:Teleport{ pos = teleportTarget } end require('State') require('o_StateCreate') require('o_Main') CONSTANTS = {} CONSTANTS["PATH1"] = "TestPath" CONSTANTS["PATH2"] = "TestPath2" CONSTANTS["path_jump"] = 16 CONSTANTS["path_jump_height"] = 148.1 CONSTANTS["path2_jump"] = 999 CONSTANTS["path2_win"] = 21 CONSTANTS["death_height"] = 133 function onStartup(self) local pos = self:GetPosition().pos; self:SetVar("x", pos.x) self:SetVar("z", pos.z) self:SetVar("time", 0) GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "HeightCheck",self ) end onTimerDone = function(self, msg) --print (msg.name) if (msg.name =="HeightCheck") then local pos = self:GetPosition().pos; local x = self:GetVar("x") local z = self:GetVar("z") local time = self:GetVar("time") pos.y = 0 local myPos = Vector.new(pos) local lastPos = Vector.new(x,0,z) local diff = myPos-lastPos local dist = diff:sqrLength() if (time > 2) then if (dist < 16) then local curPath = self:GetVar("CurPath") if (curPath ~= nil) then print ("early reverse") self:SetCurrentPath{pathName=curPath, bReverse=true} end end end local pos = self:GetPosition().pos; self:SetVar("x", pos.x) self:SetVar("z", pos.z) self:SetVar("time", time+1) --print (pos.y) if (pos.y < CONSTANTS["death_height"]) then self:Die{killerID = self} else GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "HeightCheck",self ) end end end function onArrived(self, msg) self:SetVar("CurPath", msg.pathName) -- get waypoint data --local curWP = self:GetVar("CurWaypoint") print(msg.pathName..":".. msg.wayPoint) if (msg.pathName == CONSTANTS["PATH1"]) then if (msg.wayPoint == CONSTANTS["path_jump"]) then local pos = self:GetPosition().pos if (pos.y > CONSTANTS["path_jump_height"]) then self:SetCurrentPath{pathName=CONSTANTS["PATH2"]} -- self:SetVar("CurWaypoint", 0) --else -- self:SetVar("CurWaypoint", 1) end end end if (msg.pathName == CONSTANTS["PATH2"]) then -- if (msg.wayPoint == CONSTANTS["path2_jump"]) then -- if (curWP ~= nil and curWP > 0) then -- self:SetCurrentPath{pathName=CONSTANTS["PATH1"]} -- self:SetVar("CurWaypoint", 0) -- else -- self:SetVar("CurWaypoint", 1) -- end -- end if (msg.wayPoint == CONSTANTS["path2_win"]) then getParent(self):UpdateMissionTask{taskType = "phlegming_win", target=self} self:SetVar("win", 1) end end --getParent(self):Arrived{pathName = msg.pathName, wayPoint = msg.wayPoint} end function onDie(self, msg) if (self:GetVar("win") == nil) then getParent(self):UpdateMissionTask{taskType = "phlegming_die", target=self} end end function onPathStuck(self, msg) local curPath = self:GetVar("CurPath") self:SetCurrentPath{pathName=curPath, bReverse=true} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] --Set['skillID'] = 9 Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 500 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Dragon Boss" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 0 -- Conduct Radius Set['tetherRadius'] = 0 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 2 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --///////////////////////////////////////////////////////////////////////// ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- -- dragon boss special code onDragonBossInit(self) end -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS = {} -- Default Skill ID for the projectile CONSTANTS["IMPACT_SKILLID"] = 71 -- template for the fireball projectile CONSTANTS["PROJECTILE_TEMPLATEID"] = 2716 -- rough height and length of the dragon boss (to spawn fireballs from) CONSTANTS["DRAGON_HEIGHT"] = 20.0 CONSTANTS["DRAGON_LENGTH"] = 95.0 -- rough height of the minifig's torso (so fireballs can target them better) CONSTANTS["MINIFIG_HEIGHT"] = 1.5 -- how fast the fireballs move in meters per sec CONSTANTS["PROJECTILE_SPEED"] = 85.0 -- the distance at which the dragon will start attacking opponents CONSTANTS["DRAGON_AGGRO_RADIUS"] = 500.0 -- how often the dragon's shoots his fire balls in seconds (range of time) CONSTANTS["ATTACK_DELAY_MIN"] = 1.5 CONSTANTS["ATTACK_DELAY_MAX"] = 4.5 -- amount of time between when dragon starts attack animation and fireball actually spawns CONSTANTS["FIREBALL_ANIM_DELAY"] = 0.05 -- an area around the player at which the dragon actually attacks (never dead-on) CONSTANTS["FIREBALL_TARGET_OFFSET"] = 7.0 -- the number of targets that the dragon will keep track of at once CONSTANTS["MAX_DRAGON_TARGETS"] = 10 -------------------------------------------------------------- -- Special Init Code -------------------------------------------------------------- function onDragonBossInit(self) print("Creating Dragon") for u = 1,CONSTANTS["MAX_DRAGON_TARGETS"] do self:SetVar("Attacking"..u, false) self:SetVar("TargetOpponent"..u, "") end self:SetProximityRadius { radius = CONSTANTS["DRAGON_AGGRO_RADIUS"], name = "SeekOpponents" } -- kick off the initial search (if he has no targets, he'll just search again) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "AttackOpponents", self ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) --print("Timer Hit") if msg.name == "AttackOpponents" then print("Getting Ready to Attack") self:PlayAnimation{animationID = "attack"} -- GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FIREBALL_ANIM_DELAY"], "ShootFireball", self ) -- --elseif msg.name == "ShootFireball" then -- -- print("Shooting Fireball!") local targetID = getRandomTarget(self) if targetID ~= "" then finalID = "|" .. targetID self:SetVar("ProjectileTargetID", finalID) -- store the ID so we know where to aim the projectile when it's ready local spawnPos = self:GetPosition().pos local spawnFwd = self:GetPlayerForward().fwd spawnFwd.x = spawnFwd.x * CONSTANTS["DRAGON_LENGTH"] spawnFwd.z = spawnFwd.z * CONSTANTS["DRAGON_LENGTH"] -- spawn the projectile RESMGR:LoadObject { objectTemplate = CONSTANTS["PROJECTILE_TEMPLATEID"], x = spawnPos.x+spawnFwd.x, y = spawnPos.y+CONSTANTS["DRAGON_HEIGHT"], z = spawnPos.z+spawnFwd.z, rw = 1, owner = self } end local delay_time = math.random(CONSTANTS["ATTACK_DELAY_MIN"],CONSTANTS["ATTACK_DELAY_MAX"]) GAMEOBJ:GetTimer():AddTimerWithCancel( delay_time, "AttackOpponents", self ) end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) --print("Child Loaded") -- if we loaded a projectile, fire it if msg.templateID == CONSTANTS["PROJECTILE_TEMPLATEID"] then -- print("Getting Target...") -- store who the parent is storeParent(self, msg.childID) local projObj = msg.childID -- get the skill for the projectile --skill = self:GetVar("ImpactSkillID") skill = CONSTANTS["IMPACT_SKILLID"] -- get the target that we're firing at local enemyID = self:GetVar("ProjectileTargetID") if (projObj) and (skill) and (enemyID ~= "") then print("Fireball Created") -- store values in the projectile projObj:SetVar("ImpactSkillID", skill) projObj:SetVar("My_Faction", self:GetFaction().faction) --projObj:SetFaction{faction = self:GetFaction().faction} -- position of ourselves and the target local enemyObj = GAMEOBJ:GetObjectByID(enemyID) if (enemyObj ~= nil) then -- give it a small amount of variance so it's not perfectly spot-on local enemyPos = Vector.new(getRandomPos(self,enemyObj:GetPosition().pos,CONSTANTS["FIREBALL_TARGET_OFFSET"])) enemyPos.y = enemyPos.y + CONSTANTS["MINIFIG_HEIGHT"] local localPos = Vector.new(projObj:GetPosition().pos) local dir = enemyPos - localPos local firstVec = dir:normalize() * CONSTANTS["PROJECTILE_SPEED"] -- store the velocity and force it to be heading in a downward direction (since right now projectiles only die when they hit the ground) -- TODO -> get projectiles to also have a time and/or distance limit on them so they don't go flying off forever, then get rid of this local vec = { x = firstVec.x, y = firstVec.y, z = firstVec.z } if (vec.y > -0.5) then vec.y = -0.5 end -- set projectile params projObj:SetProjectileParams{initVel = vec, iProjectileType = 2, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- When enemies enter the proximity radius -------------------------------------------------------------- function onProximityUpdate(self, msg) print("Proximity Update!") -- if this was a proximity update for seeking an opponent and the object is of the 'player faction'... if ( ( msg.name == "SeekOpponents" ) and ( msg.objId:GetFaction().faction == 1 ) ) then ------- and ( msg.objType == "Enemies" ) print("Player Proximity Change!") if ( msg.status == "ENTER" ) then addTarget( self, msg.objId:GetID() ) else removeTarget( self, msg.objId:GetID() ) end end end -------------------------------------------------------------- -- Stores an object ID into an 'array' of potential targets -------------------------------------------------------------- function addTarget(self, objId) local alreadyTargeted = false local emptySlot = 0 for u = 1,CONSTANTS["MAX_DRAGON_TARGETS"] do if ( self:GetVar("Attacking"..u) ~= true ) then if ( emptySlot == 0 ) then emptySlot = u end if ( self:GetVar("TargetOpponent"..u) == objId ) then alreadyTargeted = true end end end if ( alreadyTargeted == false and emptySlot ~= 0 ) then --print("Enemy Within Radius") self:SetVar("Attacking"..emptySlot, true) finalID = "|" .. objId self:SetVar("TargetOpponent"..emptySlot, finalID) end end -------------------------------------------------------------- -- Removes an object ID from the 'array' of potential targets -------------------------------------------------------------- function removeTarget(self, objId) for u = 1,CONSTANTS["MAX_DRAGON_TARGETS"] do if ( self:GetVar("Attacking"..u) == true and self:GetVar("TargetOpponent"..u) == objId ) then --print("Enemy Leaving Radius") self:SetVar("Attacking"..u, false) self:SetVar("TargetOpponent"..u, "") end end end -------------------------------------------------------------- -- Returns an object ID at random from the 'array' of potential targets -------------------------------------------------------------- function getRandomTarget(self) local totalTargets = 0 -- count up how many targets to random between for u = 1,CONSTANTS["MAX_DRAGON_TARGETS"] do if ( self:GetVar("Attacking"..u) == true ) then totalTargets = totalTargets + 1 end end if ( totalTargets > 0 ) then local randomTarget = math.random(1,totalTargets) --print( "random target " .. randomTarget ) -- now run through that many available targets for the actual one for u = 1,CONSTANTS["MAX_DRAGON_TARGETS"] do if ( self:GetVar("Attacking"..u) == true ) then randomTarget = randomTarget - 1 if ( randomTarget == 0 ) then return self:GetVar("TargetOpponent"..u) end end end end return "" end -------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- ---- OLD CODE BEING SAVED 'JUST IN CASE' BELOW THIS POINT ---- -------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- -- -- if this was a proximity update for seeking an opponent and the object is of the 'player faction'... -- if ( ( msg.name == "SeekOpponents" ) and ( msg.objId:GetFaction().faction == 1 ) ) then ------- and ( msg.objType == "Enemies" ) -- -- print("Player Proximity Change!") -- -- if ( msg.status == "ENTER" ) then -- -- if ( self:GetVar("Attacking") ~= true ) then -- -- print("Enemy Within Radius") -- self:SetVar("Attacking", true) -- finalID = "|" .. msg.objId:GetID() -- self:SetVar("TargetOpponent", finalID) -- GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "AttackOpponents", self ) -- -- end -- -- addTarget( self, msg.objId:GetID() ) -- -- else -- -- if ( self:GetVar("Attacking") == true and self:GetVar("TargetOpponent") == msg.objId:GetID() ) then -- -- print("Enemy Leaving Radius") -- self:SetVar("Attacking", false) -- self:SetVar("TargetOpponent", "") -- GAMEOBJ:GetTimer():CancelAllTimers( self ) -- -- end -- -- removeTarget( self, msg.objId:GetID() ) -- -- end -- -- end -- --end --L_ENEMY_FIREBALL.lua -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- cast the skill for the projectile -------------------------------------------------------------- function onProjectileImpact(self, msg) skill = self:GetVar("ImpactSkillID") if (skill) then self:CastSkill{skillID = skill} end end -------------------------------------------------------------- -- return the parent's faction -------------------------------------------------------------- function onGetFaction(self, msg) msg.faction = self:GetVar("My_Faction") end -------------------------------------------------------------- -- Determine if the target is an enemy -------------------------------------------------------------- function onIsEnemy(self, msg) -- get our faction from our parent local myFaction = self:GetVar("My_Faction") -- get the target's faction local tgt = msg.targetID; local tgtFaction = tgt:GetFaction().faction -- target is an enemy if the faction is not the same as us msg.enemy = (myFaction ~= tgtFaction) return msg end -------------------------------------------------------------- -- We get this message when the projectile kills something -------------------------------------------------------------- --function onUpdateMissionTask(self, msg) -- --forward message to parent -- getParent(self):UpdateMissionTask{target = msg.target, value = msg.value, taskType = msg.taskType} --end -------------------------------------------------------------- -- Ignore collisions with our same faction -------------------------------------------------------------- function onCollision(self, msg) local target = msg.objectID -- if we want to check for player status: local faction = target:GetFaction() if faction and faction.faction == self:GetVar("My_Faction") then msg.ignoreCollision = true else msg.ignoreCollision = false end return msg end --L_ENV_LAVA.lua -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- When objects collide with this one -------------------------------------------------------------- function onCollision(self, msg) -- print( "Obj Hit Me" ) local target = msg.objectID -- if we want to check for player status: -- local faction = target:GetFaction() -- if faction and faction.faction == 1 then -- -- object is a player -- end if target:IsDead().bDead == false then -- send a message to kill the object that landed here target:Die{ killerID = self } msg.ignoreCollision = false else msg.ignoreCollision = true end return msg end --~ function onCollision(self, msg) --~ local target = GAMEOBJ:GetZoneControlID() --~ self:KillObj{targetID = self} -- Send the message to the zone object, who will relay it to C++ --~ target:ArcadeScoreEvent{objectID = self} --~ end --~ function onCollision(self, msg) --~ local target = msg.objectID --~ local faction = target:GetFaction() --~ local target = GAMEOBJ:GetZoneControlID() --~ -- If a player collided with me, then do our stuff --~ if faction and faction.faction == 1 then --~ --print "just entered the if statement" --~ self:PlayFXEffect{effectType = "pickup"} --~ target:ArcadeScoreEvent{objectID = self} --~ print("onCollision") --~ --print "i just cast a skill" --~ self:KillObj{targetID = self} --~ --print "i just killed myself" --~ --~ end --~ -- Ignore this on the server actually. More of a test than needed --~ msg.ignoreCollision = true --~ -- ONly do this once --~ return msg --~ end --L_SPECIAL_NINJA-FLAG-SPAWNER.lua -- local newcurrency = 0 function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() local score = GAMEOBJ:GetZoneControlID() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then --print "just entered the if statement" self:PlayFXEffect{effectType = "pickup"} self:KillObj{targetID = self} -- Send the message to the zone object, who will relay it to C++ score:ArcadeScoreEvent{objectID = self} --newcurrency = target:GetCurrency().currency --newcurrency = newcurrency + 100 -- target:SetCurrency {currency = newcurrency} --print "i just cast a skill" --self:KillObj{targetID = self} --print "i just killed myself" end -- Ignore this on the server actually. More of a test than needed msg.ignoreCollision = true -- ONly do this once return msg end-- require('State') --require('o_StateCreate') --require('o_mis') --require('o_Main') function onStartup(self) Set = {} self:FollowWaypoints() Set['WanderSpeed'] = 50 -- Move speed end -- called on every waypoint (bug with final waypoint function onArrived(self, msg) print("onArrived", msg.wayPoint) if msg.actions then --print("some actions") --print(msg.actions[1].name) if msg.actions and msg.actions[1].name == "onAlmostEnd" then print("yep im dead") self:KillObj{targetID=self} end end --self:ContinueWaypoints(); -- Explained below end -- require('State') --require('o_StateCreate') require('o_mis') --require('o_Main') --[[ Base functionality for wocka ghosts (pathfinding etc.) v 1.0 ]]-- local strCurrentDirection = "N" --default north local timeCooldown = 0 local bTipGhostStun = false function onStartup(self) Set = {} -- what does this do? self:AddSkill{75} self:FollowWaypoints() self:SetProximityRadius { radius = 5 , name = "GhostStun" } --Set['WanderSpeed'] = 50 -- Move speed end --[[ strDir1 and 2 must be capital letters, N, S, E, W, representing the four cardinal directions. returns true if strDir1 is directly opposed to strDir2, false otherwise ]]-- function isOppositeDirection(strDir1, strDir2) if strDir1 == "N" and strDir2 == "S" then return true end if strDir1 == "S" and strDir2 == "N" then return true end if strDir1 == "E" and strDir2 == "W" then return true end if strDir1 == "W" and strDir2 == "E" then return true end if strDir2 == "N" and strDir1 == "S" then return true end if strDir2 == "S" and strDir1 == "N" then return true end if strDir2 == "E" and strDir1 == "W" then return true end if strDir2 == "W" and strDir1 == "E" then return true end return false end --[[ returns a string N, S, E, W based on my current linear velocity assumes orientation of X+ being E, X- being W, AND >>>>>> ***** Z- being N, Z+ being S ******** <<<<< ]]-- function getCurrentCardinalDirection(pSelf) local vFacing = pSelf:GetPlayerForward().fwd if math.abs(vFacing.x) > math.abs(vFacing.z) then -- x is bigger than z if vFacing.x > 0 then return "E" else return "W" end else -- z is bigger than x if vFacing.z > 0 then return "S" else return "N" end end -- should never return this return nil end --[[ called on every waypoint, waypoints are 0 based in Lua script Assumptions: 1) EOP actions should never happen on the same waypoint as JXN_X actions. 2) EOP action values will always be in the form "" Actions: Name Values EOP ,, End Of Path JXN ,, Junction. Should have one JXN action for every possible jump ]]-- function onArrived(self, msg) strCurrentDirection = getCurrentCardinalDirection(self) --print("onArrived:", msg.wayPoint, "current direction:", strCurrentDirection) --DEBUG if msg.actions then local s local t local iNumActions = #msg.actions --print(#msg.actions) -- how many actions for index, value in ipairs(msg.actions) do --print(index, value.name, value.value) --DEBUG ----------------------- teleport if name == "teleport" then local s = value local t = split(s, ',') local xSplit= {x=t[1] , y=t[2] , z=t[3] } self:Teleport{ pos = xSplit} --self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) --setState("WayPointEvent", self) --If we reach end of path, transition to next appropriate path and node elseif value.name == "EOP" then s = value.value t = split(s, ',') -- t[1] == new path -- t[2] == new waypoint -- t[3] == new direction if t[3] ~= nil then if isOppositeDirection(strCurrentDirection, t[3]) then break -- don't change direction if you're just bouncing without a wall in front of you else strCurrentDirection = string.upper(t[3]) end end if t[2] == nil then t[2] = 0 end --print ("At EOP, changing path to:", t[1], t[2], strCurrentDirection) --DEBUG self:SetVar("attached_path", t[1]) self:SetVar("attached_path_start", t[2]) self:FollowWaypoints() break --If we reach a junction, determine if we should go in a new direction (never in opposite of current direction) elseif string.find(value.name,"JXN") ~= nil then -- randomly pick a new direction, % based on number of JXNs (2.0: never reverse direction, will need to store current direction) local iChance local iRoll if iNumActions == 1 then iChance = 50 elseif iNumActions == 2 then iChance = 33 elseif iNumActions == 3 then iChance = 25 else iChance = 25 end iRoll = math.random(100) --print("At JXN, %chance to change:",iChance," rolled a",iRoll) --DEBUG if iRoll < iChance then s = value.value t = split(s, ',') -- t[1] == new path -- t[2] == new waypoint -- t[3] == new direction if t[3] ~= nil then if isOppositeDirection(strCurrentDirection, t[3]) then --print("not changing due to opposite direction") --DEBUG break -- don't change direction if you're just bouncing without a wall in front of you else strCurrentDirection = string.upper(t[3]) end end if t[2] == nil then t[2] = 0 end --print ("Changing path to:", t[1], t[2], strCurrentDirection) --DEBUG self:SetVar("attached_path", t[1]) self:SetVar("attached_path_start", t[2]) self:FollowWaypoints() end end end end -- if there are no messages, carry on self:ContinueWaypoints(); end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "StunCooldown") then timeCooldown = 0 end end function onProximityUpdate(self, msg) local foundFaction = msg.objId:GetFaction().faction local myFaction = self:GetFaction().faction if myFaction == foundFaction then return end print("something near, me:", myFaction, "it:", foundFaction) -- DEBUG local bSuccess = false -- need to make sure to addskill onstartup --[[CastSkill number skillID OBJECT optionalTargetID bool succeeded -- this is set when you call the function. Check it to see if it succeeded number timeToRecast -- this is set when you call it. It tells you how long to wait until you can cast it again ]]-- --if timeCooldown == 0 then --local timeCooldown = 2 --msg.objId:SetStunned{true} -- display tooltip to all players in race --[[for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if ((winner:GetID() == PLAYERS[pnum])) then -- show tooltip to winner player:DisplayTooltip{ bShow = true, strText = "You Win!\n Waiting for other players." } player:PlayFXEffect{effectType = "fireworks"} elseif (player and playerData) then -- show tooltip to others player:DisplayTooltip{ bShow = true, strText = "Winner: " .. winnerName .. "\nRace ends in " .. CONSTANTS["RACE_FINISH_TIME"] .. " seconds.", iTime = 5000 } end end]]-- --optionalTargetID = self, self:CastSkill{skillID = 75 ,succeeded = bSuccess, timeToRecast = timeCooldown} -- sonic boom stun skill --~ if not bTipGhostStun then --~ print ("tip") --~ --local player = GAMEOBJ:GetObjectByID(msg.objId) --~ --print("player id:",player:GetID()) --~ msg.objId:DisplayToolTip{bShow=true, strText = "Watch out! Ghosts stun you!"} --~ bTipGhostStun = true --~ end --self:CastSkill{skillID = 54 ,optionalTargetID = msg.objId, succeeded = bSuccess, timeToRecast = timeCooldown} -- sonic boom stun skill --print("timeCooldown", timeCooldown, "bsuccess", bSuccess) -- DEBUG --GAMEOBJ:GetTimer():AddTimerWithCancel( timeCooldown, "StunCooldown", self ) --end --[[ if msg.objType == "Enemies" or msg.objType == "NPC" or msg.objType == "Rebuildables" then ---------------------------------------------------------------------------------- --------------------------------------------------------------------------------- -- Follow Code -- if foundFaction == 1 and self:GetVar("Set.FollowActive") and (self:GetVar("Imfollowing") == nil or self:GetVar("Imfollowing") == false) and self:GetVar("Imfollowing") ~= "done" then if msg.status == "ENTER" and msg.name == "conductRadius" then storeHomePoint(self) storeTarget(self, msg.objId) setState("Follow", self) end end --print(msg.objId:GetName().name) -- Fear Flee onProx if ( self:GetVar("Set.FearPlayer") or self:GetVar("Set.FearNPC") ) and not self:GetVar("inpursuit") and self:GetVar("tetherON") ~= true and not self:GetVar("Fleeing") then -- Chance to Flee -- local ran = math.random(1,100) if ran <= self:GetVar('Set.FearChance') then -- Get Player Faction here -- if self:GetVar('Set.FearPlayer') and msg.objId:GetFaction().faction == 1 then self:SetVar("FearFound", true) end -- Get NPC Faction List here -- if self:GetVar('Set.FearNPC') then for u = 1,4 do if msg.objId:GetFaction().faction == self:GetVar("Set.FearNPC_"..u) then self:SetVar("FearFound", true) end end end -- Store target if found if self:GetVar("FearFound") then storeTarget(self, msg.objId) end if msg.status == "ENTER" and msg.name == "conductRadius" and not self:GetVar("FearFlee_CoolDown") and self:GetVar("FearFound") and self:GetVar("Set.FearFOV") == nil then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = self:GetVar("Set.tetherRadius") } setState("FearFlee",self) end if msg.status == "ENTER" and msg.name == "conductFOVRadius" and not self:GetVar("FearFlee_CoolDown") and self:GetVar("FearFound") and self:GetVar("Set.FearFOV") > 0 then local infront = self:IsObjectInFOV { target = msg.objId, radius = self:GetVar("Set.FearFOV") , minRange = 0, maxRange = 100 }.result if infront then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = self:GetVar("Set.tetherRadius") } setState("FearFlee",self) end end end end if msg.status == "ENTER" and (self:GetVar("Set.Conduct_1_Active") or self:GetVar("Set.FollowActive")) and not self:GetVar("inpursuit") then local foundFaction = msg.objId:GetFaction().faction if foundFaction == self:GetVar("Set.Con_1_AFaction") and self:GetVar("Set.Con_1_Type") == "sneakto" and self:GetVar("Set.Conduct_1_Active") then self:SetVar("FoundFOVtarget", true) elseif foundFaction == self:GetVar("Set.Con_2_AFaction") and self:GetVar("Set.Con_2_Type") == "sneakto" and self:GetVar("Set.Conduct_2_Active") then self:SetVar("FoundFOVtarget", true) else self:SetVar("FoundFOVtarget", false) end if msg.name == "conductRadius" and msg.objId:GetVar("inpursuit") ~= true and not self:GetVar("inpursuit") and not self:GetVar("FoundFOVtarget") then if (foundFaction == self:GetVar("Set.Con_1_AFaction") and self:GetVar("Set.Con_1_Type") ~= "sneakto") or (foundFaction == self:GetVar("Set.Con_2_AFaction") and self:GetVar("Set.Con_2_Type") ~= "sneakto")then local ran = math.random(1,100) if self:GetVar("Set.Conduct_MainWeight") >= ran then self:SetVar("ConductCoolingDown",true) self:SetVar("inpursuit", true) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = self:GetVar("Set.tetherRadius") } storeHomePoint(self) storeTarget(self, msg.objId) conductTrigger(self,msg.objId:GetFaction().faction) end end end end if msg.name == "conductFOVRadius" and not msg.objId:GetVar("inpursuit") and not self:GetVar("inpursuit") and not self:GetVar("ConductCoolingDown") then if msg.objId:GetFaction().faction == self:GetVar("Set.Con_1_AFaction") or msg.objId:GetFaction().faction == self:GetVar("Set.Con_2_AFaction") and msg.status == "ENTER" then local ran = math.random(1,100) if self:GetVar("Set.Conduct_MainWeight") >= ran then local infront = self:IsObjectInFOV { target = msg.objId, radius = self:GetVar("Set.conductFOV") , minRange = 0, maxRange = 100 }.result if infront then self:SetVar("ConductCoolingDown",true) self:SetVar("inpursuit", true) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = self:GetVar("Set.tetherRadius") } storeHomePoint(self) storeTarget(self, msg.objId) conductTrigger(self,msg.objId:GetFaction().faction) end end end end ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ --------- Helper On Enter if msg ~= nil and checkFaction == 0 then if msg.status == "ENTER" and msg.objId:GetFaction().faction == self:GetVar("HelpFaction") and not msg.objId:IsDead().bDead and msg.name == "HelpRadius" and msg.objId:GetVar("inpursuit") == true and self:GetVar("inpursuit") == false then target = getMyTarget(msg.objId) -- print("My Target is ==="..target) if target ~= nil then storeTarget(self, target) else print("Error i dont have a target") end setState("aggro", self) end end --- Aggro On Enter -- Get Hate List if self:GetVar("Set.AggroNPC") then for i = 1, 4 do if msg.objId:GetFaction().faction == self:GetVar("Set.NPCHated_"..i) then self:SetVar("FoundHated", true) end end end if msg.status == "ENTER" and (self:IsEnemy{ targetID = msg.objId }.enemy or self:GetVar("FoundHated")) and not msg.objId:IsDead().bDead and msg.name == "aggroRadius" and self:GetVar("FleeStatus") ~= 1 then GAMEOBJ:GetTimer():CancelAllTimers( self ) if self:GetVar("Set.Aggression") == "Aggressive" or self:GetVar("Set.Aggression") == "PassiveAggres" then storeTarget(self, msg.objId) if self:GetVar("aggrotarget") == 0 and self:GetVar("AggroDelayDone") then if self:GetVar("Set.AggroEmote") and self:GetVar("AggroDelayDone") then self:FaceTarget{ target = getMyTarget(self), degreesOff = 5, keepFacingTarget = true } Emote.emote(self,target , self:GetVar("Set.AggroE_Type")) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("inpursuit", true) self:SetVar("aggrotarget",1) storeHomePoint(self) self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.AggroE_Delay") , "AggroEmote", self ) self:SetVar("AggroDelayDone", false) setState("Idle",self) else GAMEOBJ:GetTimer():CancelTimer( "Conduct", self ) self:SetVar("inpursuit", true) storeHomePoint(self) local myPos = self:GetPosition().pos self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("Se.tetherRadius") } self:SetVar("aggrotarget",1) end end if aggroTarget ~= 2 and self:GetVar("AggroDelayDone") then setState("aggro", self) end end end end ]]-- end function onStartup(self) self:SetProximityRadius { radius = 10, name = "swapScheme" }; end function onProximityUpdate(self, msg) if msg.status == "ENTER" then msg.objId:SetPlayerControlScheme { iScheme = 3, bSwitchCam = true} self:PlayFXEffect {effectType = "intro"} msg.objId:ShowActivityCountdown { bPlayCountdownSound = false, bPlayAdditionalSound = false, sndName = "no_sound", stateToPlaySoundOn = 0 } msg.objId:PlayFXEffect{effectType = "fireworks"} end end -- require('State') --require('o_StateCreate') --require('o_mis') --require('o_Main') function onStartup(self) Set = {} self:FollowWaypoints() Set['WanderSpeed'] = 50 -- Move speed end -- called on every waypoint function onArrived(self, msg) print("onArrived", msg.wayPoint) if msg.actions then print("some actions") print(msg.actions[1].name) if msg.actions and msg.actions[1].name == "onAlmostEnd" then print("yep im dead") self:KillObj{targetID=self} end end --self:ContinueWaypoints(); -- Explained below end function onStartup(self) self:SetProximityRadius { radius = 40, name = "swapScheme" }; end onTimerDone = function(self, msg) if (msg.name == "Go") then print("end") UI:DisplayToolTip{strDialogText = "You reached the end! Good Job!", strImageName = "", bShow=true, iTime=0} end end function onProximityUpdate(self, msg) if msg.status == "ENTER" then --print("end") msg.objId:PlayFXEffect{effectType = "fireworks"} end end function onStartup(self) self:SetProximityRadius { radius = 40, name = "swapScheme" }; end function onProximityUpdate(self, msg) if msg.status == "ENTER" then --print("start") msg.objId:ShowActivityCountdown { bPlayCountdownSound = false, bPlayAdditionalSound = false, sndName = "no_sound", stateToPlaySoundOn = 0 } end end function onStartup(self) self:SetProximityRadius { radius = 40, name = "swapScheme" }; end function onProximityUpdate(self, msg) if msg.status == "ENTER" then --print("Pac end") msg.objId:SetPlayerControlScheme { iScheme = 1, bSwitchCam = true} end end function onStartup(self) self:SetProximityRadius { radius = 40 ,name = "swapScheme" }; end function onProximityUpdate(self, msg) if msg.status == "ENTER" then --print("Pac start") msg.objId:SetPlayerControlScheme { iScheme = 3, bSwitchCam = true} self:PlayFXEffect {effectType = "intro"} end end function onStartup(self) --UI:SendChat{ChatString = "bumper:onStartup", ChatType = "LOCAL", Timestamp = 500} -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} --UI:SendChat{ChatString = "rock:onstartup", ChatType = "LOCAL", Timestamp = 500} end CONSTANTS = {} CONSTANTS["CONTROLLER_LOT"] = 2873 CONTROLLER = {} -- Register important objects when loaded function onObjectLoaded(self, msg) -- controller object loaded if (msg.templateID == CONSTANTS["CONTROLLER_LOT"]) then CONTROLLER = msg.objectID --UI:SendChat{ChatString = "zone:onObjectLoaded", ChatType = "LOCAL", Timestamp = 500} end end -- Relay the event to the C++ controller function onArcadeScoreEvent(self, msg) CONTROLLER:ArcadeScoreEvent{objectID = msg.objectID} --UI:SendChat{ChatString = "zone:onArcadeScoreEvent", ChatType = "LOCAL", Timestamp = 500} end function IsLocalCharacter(target) return GAMEOBJ:GetLocalCharID() == target:GetID() end function onStartup(self) self:SetProximityRadius { radius = 30, name = "clientRadius" } end function onProximityUpdate(self, msg) --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// if msg.name == "clientRadius" and msg.status == "ENTER" and IsLocalCharacter(msg.objId) and msg.objId:GetFaction().faction == 1 then if self:GetVar("FollowState") == nil then local ran = math.random(1,30) if ran == 20 then self:DisplayChatBubble{wsText = "Help!" } self:PlayFXEffect {priority = 1.2, effectType = "scared"} end end end --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// end function emote(self,target, skillType) self:PlayFXEffect {priority = 1.2, effectType = skillType} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] --[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 3 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] --[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('/ai/GC_2/mission_Main') function onStartup(self) Miss = {} --///////////////////////////////////////////////////////////////////////// -- Enter/Exit Conduct Radius --///////////////////////////////////////////////////////////////////////// Miss['Conduct_CoolDown'] = 0.5 -- Effects the Trigger time upone exiting/entering the conduct radius. Miss['Conduct_Delay'] = 0.1 -- Delay before triggering the emote. Miss['Main_EmoteID'] = 69 -- Global emote ID -- Conduct Radius Miss['OverRideConduct'] = true Miss['conductRadius'] = 20 -- Conduct ----------------------- OnEnter -- Conduct ----------------------- OnEnter Miss['Emote_enter'] = "enter" -- Conduct ----------------------- OnExit Miss['Emote_onExit'] = "leave" --/////////////////////////////////////////////////////////////////////////// -- Buy Sell --/////////////////////////////////////////////////////////////////////////// -- Emote ------------------------------------------------------[[ OnAVAILABLE ]] Miss['Emote_onAVAILABLE'] = "missionState1" -- Emote -----------------------------------------------------[[ OnACTIVE ]] Miss['Emote_onACTIVE '] = "missionState2" -- Emote -----------------------------------------------------[[ OnREADY_TO_COMPLETE ]] Miss['Emote_onREADY_TO_COMPLETE '] = "missionState3" -- Emote -----------------------------------------------------[[ OnSTATE_COMPLETED ]] Miss['Emote_onSTATE_COMPLETED '] = "missionState4" --[[ LWO_MissSION_STATE_AVAILABLE = 0x1, LWO_MissSION_STATE_ACTIVE = 0x2, LWO_MissSION_STATE_READY_TO_COMPLETE = 0x4, LWO_MissSION_STATE_COMPLETED = 0x8, --]] ------ Do not change -------------------------------------------------------- self:SetVar("Miss",Miss) GetMissionVars(self) CreateMissionStates(self) ------------------------------------------------------------------------------- endrequire('o_mis') require('State') function onStartup(self) self:SetVar("Mission_A_Brick", 0 ) self:SetVar("Mission_A_State", "idle") self:SetVar("Mission_B_Brick", 0 ) self:SetVar("Mission_B_State", "idle") self:SetVar("Trigger_A_ID", 0) self:SetVar("Trigger_B_ID", 0) self:SetVar("MissionDone",false) brick_a_count = 0 mission_a_state = "idle" self:SetVar("skybox","mesh/env/challenge_sky_light_2awesome.nif") self:SetVar("skylayer","(invalid)") self:SetVar("ringlayer0","(invalid)") self:SetVar("ringlayer1","(invalid)") self:SetVar("ringlayer2","(invalid)") self:SetVar("ringlayer3","(invalid)") --GAMEOBJ:GetZoneControlID() self:UseStateMachine{} Idle = State.create() Idle.onEnter = function(self) end Idle.onArrived = function(self) end Stage1 = State.create() Stage1.onEnter = function(self) if self:GetVar("Mission_A_Brick") == 15 then self:SetVar("Mission_A_State","ADONE") end end Stage1.onArrived = function(self) end Stage2 = State.create() Stage2.onEnter = function(self) end Stage2.onArrived = function(self) end Stage3 = State.create() Stage3.onEnter = function(self) LEVEL:SetSkyDome ( self:GetVar("skybox") ) LEVEL:SetLights( true,0x5E994F, --ambient color true,0xFFFFFF, --directional color true,0xFFFFFF, --specular color true,0xFFFFFF, --upper Hemi color true,{550.0,-1990.0,550.0}, --directional direction true,0xBCEEFF, --fog color true, --modifying draw distances (all of them) 150.0, 150.0, --fog near min/max 999.0, 999.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 1695.0, 1695.0, --static object cutoff min/max 1195.0, 1195.0, --dynamic object cutoff min/max false,"mesh/env/challenge_sky_light_2awesome.nif" ) end Stage3.onArrived = function(self) end addState(Stage1, "Stage1", "Stage1", self) addState(Stage2, "Stage2", "Stage2", self) addState(Stage3, "Stage3", "Stage3", self) addState(Idle, "Idle", "Idle", self) beginStateMachine("Idle", self) end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) local t = msg msg = msg end function getA(self) targetID = self:GetVar("Trigger_A_ID") return GAMEOBJ:GetObjectByID(targetID) end-- Saved Vars function GetMissionVars(self) self:SetVar("ConductCoolDown", false) self:SetVar("ConductTimer_Started",false) self:SetVar("Emote_onExitBuyActive",false) Emote = {emote = emote} end function IsLocalCharacter(target) return GAMEOBJ:GetLocalCharID() == target:GetID() end function CreateMissionStates(self) if self:GetVar('Miss.OverRideConduct') then self:SetProximityRadius { radius = self:GetVar("Miss.conductRadius") , name = "conductRadius" } end self:UseStateMachine{} -- Idle State MissionIdle = State.create() MissionIdle.onEnter = function(self) end MissionIdle.onArrived = function(self) end -- Emote State MissionEmote = State.create() MissionEmote.onEnter = function(self) -- self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } emote(self, getMyMissionTarget(self), self:GetVar("EmoteType") ) -- print(debug.traceback()) end MissionEmote.onArrived = function(self) end addState(MissionIdle, "MissionIdle", "MissionIdle", self) addState(MissionEmote, "MissionEmote", "MissionEmote", self) beginStateMachine("MissionIdle", self) MissionIdle.onEnter(self) end function onProximityUpdate(self, msg) self:SetVar("skybox","mesh/env/challenge_sky_light_2awesome.nif") self:SetVar("skylayer","(invalid)") self:SetVar("ringlayer0","(invalid)") self:SetVar("ringlayer1","(invalid)") self:SetVar("ringlayer2","(invalid)") self:SetVar("ringlayer3","(invalid)") if msg.objType == "Enemies" or msg.objType == "NPC" then if msg.name == "conductRadius" and msg.status == "ENTER" and IsLocalCharacter(msg.objId) and msg.objId:GetFaction().faction == 1 then end end end function storeMissionTarget(self, target) idString = target:GetID() finalID = "|" .. idString self:SetVar("myMissionTarget", finalID) end function getMyMissionTarget(self) targetID = self:GetVar("myMissionTarget") return GAMEOBJ:GetObjectByID(targetID) end function emote(self,target, skillType) self:SetVar("EmbeddedTime", self:GetAnimationTime{ animationID = "interact" }.time) self:PlayFXEffect {priority = 1.2, effectType = skillType} end onNotifyMission = function(self,msg) msg = msg end onTerminateInteraction = function(self, msg) if foo == nil then print("Closed the windows") end endrequire('State') require('/ai/GC_2/mission_Main') function onStartup(self) Miss = {} --///////////////////////////////////////////////////////////////////////// -- Enter/Exit Conduct Radius --///////////////////////////////////////////////////////////////////////// Miss['Conduct_CoolDown'] = 0.5 -- Effects the Trigger time upone exiting/entering the conduct radius. Miss['Conduct_Delay'] = 0.1 -- Delay before triggering the emote. Miss['Main_EmoteID'] = 69 -- Global emote ID -- Conduct Radius Miss['OverRideConduct'] = true Miss['conductRadius'] = 20 -- Conduct ----------------------- OnEnter -- Conduct ----------------------- OnEnter Miss['Emote_enter'] = "enter" -- Conduct ----------------------- OnExit Miss['Emote_onExit'] = "leave" --/////////////////////////////////////////////////////////////////////////// -- Buy Sell --/////////////////////////////////////////////////////////////////////////// -- Emote ------------------------------------------------------[[ OnAVAILABLE ]] Miss['Emote_onAVAILABLE'] = "missionState1" -- Emote -----------------------------------------------------[[ OnACTIVE ]] Miss['Emote_onACTIVE '] = "missionState2" -- Emote -----------------------------------------------------[[ OnREADY_TO_COMPLETE ]] Miss['Emote_onREADY_TO_COMPLETE '] = "missionState3" -- Emote -----------------------------------------------------[[ OnSTATE_COMPLETED ]] Miss['Emote_onSTATE_COMPLETED '] = "missionState4" --[[ LWO_MissSION_STATE_AVAILABLE = 0x1, LWO_MissSION_STATE_ACTIVE = 0x2, LWO_MissSION_STATE_READY_TO_COMPLETE = 0x4, LWO_MissSION_STATE_COMPLETED = 0x8, --]] ------ Due not change -------------------------------------------------------- self:SetVar("Miss",Miss) GetMissionVars(self) CreateMissionStates(self) ------------------------------------------------------------------------------- end--/////////////////////////////////////////////////////////////////////////////////////// --// Team Awesomer NPC -- SERVER Script --/////////////////////////////////////////////////////////////////////////////////////// CONSTANTS = {} CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"] = 0 CONSTANTS["CLIENT_TOOLTIP_MISSION_COMPLETE"] = 1 require('o_mis') require('State') function onStartup(self) self:SetVar("Zone", 0 ) end -- @TODO:ISSUE - Lua cannot send client/single messages to non client OBJID's. Need a function onMissionDialogueOK(self, msg) -- get the user local user = msg.responder -- tell zone control to prep the player to race if self:GetVar("Zone") == 0 then self:SetVar("Zone", 1 ) GAMEOBJ:GetZoneControlID():SetVar("Mission_A_State","started") end if GAMEOBJ:GetZoneControlID():GetVar("Mission_A_State") == "ADONE" then GAMEOBJ:GetZoneControlID():SetVar("Mission_A_State","travleA") local tar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetZoneControlID():GetVar("Trigger_A_ID")) setState("sendAway",tar) end end require('State') require('/ai/GC_2/mission_Main') function onStartup(self) Miss = {} --///////////////////////////////////////////////////////////////////////// -- Enter/Exit Conduct Radius --///////////////////////////////////////////////////////////////////////// Miss['Conduct_CoolDown'] = 0.5 -- Effects the Trigger time upone exiting/entering the conduct radius. Miss['Conduct_Delay'] = 0.1 -- Delay before triggering the emote. Miss['Main_EmoteID'] = 69 -- Global emote ID -- Conduct Radius Miss['OverRideConduct'] = true Miss['conductRadius'] = 20 -- Conduct ----------------------- OnEnter -- Conduct ----------------------- OnEnter Miss['Emote_enter'] = "enter" -- Conduct ----------------------- OnExit Miss['Emote_onExit'] = "leave" --/////////////////////////////////////////////////////////////////////////// -- Buy Sell --/////////////////////////////////////////////////////////////////////////// -- Emote ------------------------------------------------------[[ OnAVAILABLE ]] Miss['Emote_onAVAILABLE'] = "missionState1" -- Emote -----------------------------------------------------[[ OnACTIVE ]] Miss['Emote_onACTIVE '] = "missionState2" -- Emote -----------------------------------------------------[[ OnREADY_TO_COMPLETE ]] Miss['Emote_onREADY_TO_COMPLETE '] = "missionState3" -- Emote -----------------------------------------------------[[ OnSTATE_COMPLETED ]] Miss['Emote_onSTATE_COMPLETED '] = "missionState4" --[[ LWO_MissSION_STATE_AVAILABLE = 0x1, LWO_MissSION_STATE_ACTIVE = 0x2, LWO_MissSION_STATE_READY_TO_COMPLETE = 0x4, LWO_MissSION_STATE_COMPLETED = 0x8, --]] ------ Due not change -------------------------------------------------------- self:SetVar("Miss",Miss) GetMissionVars(self) CreateMissionStates(self) ------------------------------------------------------------------------------- end--/////////////////////////////////////////////////////////////////////////////////////// --// Team Awesomer NPC -- SERVER Script --/////////////////////////////////////////////////////////////////////////////////////// CONSTANTS = {} CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"] = 0 CONSTANTS["CLIENT_TOOLTIP_MISSION_COMPLETE"] = 1 require('o_mis') require('State') function onStartup(self) self:SetVar("Zone", 0 ) end -- @TODO:ISSUE - Lua cannot send client/single messages to non client OBJID's. Need a function onMissionDialogueOK(self, msg) -- get the user local user = msg.responder -- tell zone control to prep the player to race if GAMEOBJ:GetZoneControlID():GetVar("MissionDone") and self:GetVar("Zone") == 0 then self:SetVar("Zone", 1 ) PoS = getMeanderPoint(self) RESMGR:LoadObject { objectTemplate = 2897 , x = PoS.x , y = PoS.y , z = PoS.z ,owner = self } user:CastSkill{skillID = 72 } end end require('o_mis') require('State') function onStartup(self) self:SetName { name = "Scene Dir" } self:SetProximityRadius { radius = 500 , name = "ALL" } self:SetVar("Mission_A_State", "idle") self:SetVar("Mission_B_State", "idle") self:UseStateMachine{} Idle = State.create() Idle.onEnter = function(self) local foundObj = self:GetProximityObjects { name = "ALL"}.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetName().name == "Trigger_1" or foundObj[i]:GetName().name == "Contest Brick Walker" or foundObj[i]:GetName().name == "Contest Red Brick Walker" or foundObj[i]:GetName().name == "Contest Scene Dir Main" then StoreOutHouse( foundObj[i], self) end end end Idle.onArrived = function(self) end Stage1 = State.create() Stage1.onEnter = function(self) end Stage1.onArrived = function(self) end Stage2 = State.create() Stage2.onEnter = function(self) end Stage2.onArrived = function(self) end Stage3 = State.create() Stage3.onEnter = function(self) end Stage3.onArrived = function(self) end addState(Stage1, "Stage1", "Stage1", self) addState(Stage2, "Stage2", "Stage2", self) addState(Stage3, "Stage3", "Stage3", self) addState(Idle, "Idle", "Idle", self) beginStateMachine("Idle", self) end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] --[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('o_mis') require('State') function onStartup(self) self:SetName { name = self:GetVar("Trigger 1") } self:SetProximityRadius { radius = 20 , name = "BRICKS" } storeMeanderPoint(self) self:UseStateMachine{} Idle = State.create() Idle.onEnter = function(self) end Store = State.create() Store.onEnter = function(self) myPos = getMeanderPoint(self) local PoS = getRandomPos(self,myPos,10) getMyTarget(self):GoTo { speed = 3, target = { x = PoS.x , z = PoS.z , y = PoS.y, }, } end Store.onArrived = function(self) end sendAway = State.create() sendAway.onEnter = function(self) local foundObj = self:GetProximityObjects { name = "BRICKS"}.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetFaction().faction == 7 then foundObj[i]:FollowTarget { targetID = getRudPeer(self) , radius = 3 ,speed = 4, keepFollowing = false } end end end sendAway.onArrived = function(self) end addState(Store, "Store", "Store", self) addState(sendAway, "sendAway", "sendAway", self) addState(Idle, "Idle", "Idle", self) beginStateMachine("Idle", self) Idle.onEnter(self) end function onProximityUpdate(self, msg) local foundFaction = msg.objId:GetFaction().faction if foundFaction == 1 and self:GetVar("StoredPlayerID") == nil then StoreRudPeer(self,msg.objId) local idString = self:GetID() local finalID = "|" .. idString GAMEOBJ:GetZoneControlID():SetVar("Trigger_A_ID", finalID) self:SetVar("StoredPlayerID", 1) end if foundFaction == 7 and msg.status == "ENTER" and GAMEOBJ:GetZoneControlID():GetVar("Mission_A_State") ~= "travleA" then storeTarget(self, msg.objId) msg.objId:SetVar("Imfollowing","done") msg.objId:SetVar("PointInLine",nil) msg.objId:SetVar("EndOfLineTarget",nil) getRudPeer(self):UpdateMissionTask{ target = msg.objId , value = 1, taskType = "kill" } GAMEOBJ:GetZoneControlID():SetVar("Mission_A_Brick", GAMEOBJ:GetZoneControlID():GetVar("Mission_A_Brick") + 1 ) if GAMEOBJ:GetZoneControlID():GetVar("Mission_A_Brick") == 15 then local foundObj = self:GetProximityObjects { name = "BRICKS"}.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetFaction().faction == 7 then foundObj[i]:SetVar("Imfollowing", false) end end end setState("Stage1", GAMEOBJ:GetZoneControlID()) setState("Store", self) end end require('o_mis') require('State') function onStartup(self) self:SetProximityRadius { radius = 25 , name = "HAX" } self:SetVar("skybox","mesh/env/challenge_sky_light_2awesome.nif") self:SetVar("skylayer","(invalid)") self:SetVar("ringlayer0","(invalid)") self:SetVar("ringlayer1","(invalid)") self:SetVar("ringlayer2","(invalid)") self:SetVar("ringlayer3","(invalid)") end function onProximityUpdate(self, msg) if self:GetVar("haxor") == nil then LEVEL:SetSkyDome ( self:GetVar("skybox") ) LEVEL:SetLights( true,0x5E994F, --ambient color true,0xFFFFFF, --directional color true,0xFFFFFF, --specular color true,0xFFFFFF, --upper Hemi color true,{550.0,-1990.0,550.0}, --directional direction true,0xBCEEFF, --fog color true, --modifying draw distances (all of them) 150.0, 150.0, --fog near min/max 850.0, 850.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 1510.0, 1510.0, --static object cutoff min/max 1010.0, 1010.0, --dynamic object cutoff min/max false,"mesh/env/challenge_sky_light_2awesome.nif" ) end end function onStartup(self) self:SetVar("attached_path", "hax") self:SetVar("attached_path_start", 0 ) self:FollowWaypoints() end require('o_mis') function onStartup(self) self:SetName { name = self:GetVar("Trigger 1") } self:SetProximityRadius { radius = 50 , name = "BRICKS" } self:SetProximityRadius { radius = 15 , name = "BRICKS2" } storeMeanderPoint(self) self:SetVar("spawned1", 0 ) end function onProximityUpdate(self, msg) local foundFaction = msg.objId:GetFaction().faction if foundFaction == 1 and self:GetVar("StoredPlayerID") == nil then StoreRudPeer(self,msg.objId) end if foundFaction == 1 and self:GetVar("StoredPlayerID") == nil then StoreRudPeer(self,msg.objId) self:SetVar("StoredPlayerID", 1) end if foundFaction == 7 and msg.status == "ENTER" and msg.name == "BRICKS" then PoS = getMeanderPoint(self) msg.objId:GoTo { speed = 3, target = { x = -45 , z = -165 , y = 913 , }, } end if foundFaction == 7 and msg.status == "ENTER" and msg.name == "BRICKS2" then msg.objId:Teleport{ x=0,y=0,z=0} self:SetVar("spawned1", self:GetVar("spawned1") + 1 ) getRudPeer(self):UpdateMissionTask{ target = msg.objId , value = 1, taskType = "kill" } if self:GetVar("spawned1") >= 14 then RESMGR:LoadObject { objectTemplate = 2897 , x = -37.18 , y = 912.89 , z = -165.56 ,owner = self } end if self:GetVar("spawned1") >= 24 and self:GetVar("bb") == nil then self:SetVar("bb","bla") RESMGR:LoadObject { objectTemplate = 2898 , x = -37.18 , y = 912.89 , z = -165.56 ,owner = self } RESMGR:LoadObject { objectTemplate = 2864 , x = -25.18 , y = 912.89 , z = -152.56 ,owner = self } GAMEOBJ:GetZoneControlID():SetVar("MissionDone",true) self:CastSkill{skillID = 72 } end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Generic Ambient NPC Script" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Generic Boss Enemy Script" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Generic Elite Enemy Script" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Generic Miniboss Enemy Script" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Generic Mob Enemy Script" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Generic Neutral Enemy Script" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end ----------------------------------------------------------- --spawns random bad guys from each maelstrom object destroyed ----------------------------------------------------------- local maxToSpawn = 3 local chanceToSpawn = 4 local enemyType1 = 7815 local enemyType2 = 6789 local enemyType3 = 6806 --[[function onStartup(self) print("starting up") end--]] function onDie(self, msg) local pos = self:GetPosition().pos local config = { {"tetherRadius", 120 }, {"aggroRadius", 100}, {"wanderRadius", 70 }} local spawnThisType = math.random(chanceToSpawn) local spawnThisMany = math.random(maxToSpawn) --print("spawnThisMany = " .. spawnThisMany) if spawnThisType == 1 or spawnThisType == 2 then --print("spawning ronin") for i =1, spawnThisMany do RESMGR:LoadObject { objectTemplate = enemyType1 , x = pos.x , y = pos.y , z = pos.z , owner = self,configData = config } end elseif spawnThisType == 3 then --print("spawning pirates") for i = 1, spawnThisMany do RESMGR:LoadObject { objectTemplate = enemyType2 , x = pos.x , y = pos.y , z = pos.z , owner = self,configData = config } end elseif spawnThisType == 4 then --print("spawning ape") --for i = 1, spawnThisMany do RESMGR:LoadObject { objectTemplate = enemyType3 , x = pos.x , y = pos.y , z = pos.z , owner = self,configData = config } end --[[RESMGR:LoadObject { objectTemplate = 7815 , x = pos.x +2, y = pos.y , z = pos.z +2, owner = self,configData = config } RESMGR:LoadObject { objectTemplate = 7815 , x = pos.x -2, y = pos.y , z = pos.z -2, owner = self,configData = config }--]] end-------------------------------------------------------------- -- Transfers player to last known non instance -- -- created mrb... 7/16/10 -------------------------------------------------------------- function onUse(self, msg) -- display confirmation tool tip to player msg.user:DisplayMessageBox{ bShow = true, imageID = 1, callbackClient = self, text = "Do you want to exit the Dragon Instance?", identifier = "Instance_Exit"}--TODO: this needs to be localized end function onMessageBoxRespond(self, msg) -- transfer player to last non instance if msg.identifier == "Instance_Exit" and msg.iButton == 1 then msg.sender:TransferToLastNonInstance{ playerID = msg.sender, bUseLastPosition = true } end end require('o_mis') function onStartup(self) -- Choose a random number from 1 - 6. local dieRoll = math.random(1,6) local Anim= { "Die-Roll-1", "Die-Roll-2", "Die-Roll-3", "Die-Roll-4", "Die-Roll-5", "Die-Roll-6" } -- put any world messages concerning the die roll here GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "DoneRolling", self ) self:PlayFXEffect {effectType = Anim[dieRoll]} local player = self:GetParentObj().objIDParent if dieRoll == 6 then player:UpdateMissionTask{taskType = "complete", value = 756, value2 = 1, target = self} end end function onTimerDone(self, msg) if msg.name == "DoneRolling" then self:RequestDie{killerID = self, killType = "SILENT"} end end ------------------------------------------------------ -- Generic Script to attach to the server side of a -- NPC so that it will follow paths and wander around. -- -- created 6/17/10 mrb... ------------------------------------------------------ function onStartup(self) self:SetVar("Set.SuspendLuaMovementAI", true) -- a state suspending scripted movement AI self:SetVar("Set.MovementType", "Wander") -- this is how the NPC will behave when not on a path. -- Wander Settings --------------------------------------------------------- self:SetVar("Set.WanderChance",100) -- Main Weight self:SetVar("Set.WanderDelayMin",5) -- Min Wander Delay self:SetVar("Set.WanderDelayMax", 5) -- Max Wander Delay self:SetVar("Set.WanderSpeed",1) -- Move speed self:SetVar("Set.wanderRadius",5) -- Move radius end ------------------------------------------------------ -- Generic Script to attach to the server side of a -- NPC so that it will follow paths and wander around. -- -- created 7/06/10 btarr... ------------------------------------------------------ function onStartup(self) self:SetVar("Set.SuspendLuaMovementAI", true) -- a state suspending scripted movement AI self:SetVar("Set.MovementType", "Wander") -- this is how the NPC will behave when not on a path. -- Wander Settings --------------------------------------------------------- self:SetVar("Set.WanderChance",100) -- Main Weight self:SetVar("Set.WanderDelayMin",5) -- Min Wander Delay self:SetVar("Set.WanderDelayMax", 5) -- Max Wander Delay self:SetVar("Set.WanderSpeed",1) -- Move speed self:SetVar("Set.wanderRadius",30) -- Move radius end ------------------------------------------------------ -- Generic Script to attach to the server side of a -- NPC so that it will follow paths and wander around. -- -- created 7/06/10 btarr... ------------------------------------------------------ function onStartup(self) self:SetVar("Set.SuspendLuaMovementAI", true) -- a state suspending scripted movement AI self:SetVar("Set.MovementType", "Wander") -- this is how the NPC will behave when not on a path. -- Wander Settings --------------------------------------------------------- self:SetVar("Set.WanderChance",100) -- Main Weight self:SetVar("Set.WanderDelayMin",5) -- Min Wander Delay self:SetVar("Set.WanderDelayMax", 5) -- Max Wander Delay self:SetVar("Set.WanderSpeed",1) -- Move speed self:SetVar("Set.wanderRadius",15) -- Move radius end ------------------------------------------------------ -- Generic Script to attach to the server side of a -- NPC so that it will follow paths and wander around. -- -- created 7/06/10 btarr... ------------------------------------------------------ function onStartup(self) self:SetVar("Set.SuspendLuaMovementAI", true) -- a state suspending scripted movement AI self:SetVar("Set.MovementType", "Wander") -- this is how the NPC will behave when not on a path. -- Wander Settings --------------------------------------------------------- self:SetVar("Set.WanderChance",100) -- Main Weight self:SetVar("Set.WanderDelayMin",5) -- Min Wander Delay self:SetVar("Set.WanderDelayMax", 5) -- Max Wander Delay self:SetVar("Set.WanderSpeed",1) -- Move speed self:SetVar("Set.wanderRadius",5) -- Move radius end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["DarklingMechLOT"] = 6253 function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- ---------------------------------- -- Sets the turret's life timer and disables its AI which will only be active after rebuild. self:SetVar("TurretLifeTime", 30) setState("AiDisable",self) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TurretLifeTime") , "TurretLifeTime", self ) ----------------------------------* end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- print("*******AI ENABLED*******") setState("AiEnable",self) ProximityPuls(self) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end ------------------------- -- Tells the turret to die after the timer runs out. ------------------------- onTimerDone = function(self, msg) if msg.name == "TurretLifeTime" then local player = getObjectByName(self, "playerID") if player ~= nil then self:RebuildCancel{ userID = player } end setState("AiDisable",self) self:Die() end end ----------------------------- -- Getting the playerID of the rebuilder and setting new timer for the life of the turret ----------------------------- function onRebuildStart(self, msg) storeObjectByName (self, "playerID", msg.userID ) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("TurretLifeTime", 30) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TurretLifeTime") , "TurretLifeTime", self ) end -- copy of CHOICEBUILD_STAGE_OBJECT.lua --- on the choicebuild object require('o_mis') --need to reset the TikiSet to false on all the quickbuilds either on ramp build or on distory -- or manually have the tiki heads reset in the database function onChoicebuildComplete(self, msg) local manager = self:GetObjectsInGroup{ group = 'TikiPuzzleManager', ignoreSpawners = true }.objects[1] local groupID = split(self:GetVar('groupID'), ';')[2] -- check to see if the object group matches the choicebuild index if groupID == 'LargeTiki' and msg.index == 2 then print("large tiki in the right spot") self:SetVar('TikiSet', true) elseif groupID == "MediumTiki" and msg.index == 1 then print("meduim tiki in the right spot") self:SetVar('TikiSet', true) --manager:NotifyObject{ ObjIDSender = self, name = "CorrectTimer" } elseif groupID == "SmallTiki" and msg.index == 0 then print("small tiki in the right spot") self:SetVar('TikiSet', true) --manager:NotifyObject{ ObjIDSender = self, name = "CorrectTimer" } --else --GAMEOBJ:GetTimer():AddTimerWithCancel(30, "WrongTikiTimer", self ) --print ("wrong tiki timer start !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") end manager:NotifyObject{ ObjIDSender = self, name = "CorrectTimer" } local group = self:GetObjectsInGroup{ group = 'CBGroup', ignoreSpawners = true }.objects local tikiTest = 0 for i = 1, #group do -- test each object in table group to see if GetVar('TikiSet') is true, if so add 1 to tikiTest if group[i]:GetVar('TikiSet') then tikiTest = tikiTest + 1 end end -- if all objects have been created in the correct locations then we are going to spawn the ramp if tikiTest == 3 then print('spawn in ramp') --LEVEL:ActivateSpawner("Ramp") manager:NotifyObject{ ObjIDSender = self, name = "RampTimer" } local rampSpawner = LEVEL:GetSpawnerByName("Ramp") if rampSpawner then rampSpawner:SpawnerActivate() end end end function onTimerDone(self, msg) if msg.name == "WrongTikiTimer" then print ("wrong timer done") self:Die{ killType = "SILENT" } end end ------------------------------------------------ -- L_BOMB_CRATE.lua -- Used to handle the maelstrom chests in GF when they are hit by a player so they explode and give mission credit -- Last Edited: 8-4-10 -- Edited by: MEdwards ------------------------------------------------ function onStartup(self) self:SetProximityRadius { radius = 20 } self:SetVar("playersNearChest", 0) self:SetProximityRadius { radius = 10 ,name = "crateHitters" } end function onOnHit(self, msg) local player = msg.attacker if not self:GetVar("bIsHit") then ------------------------------ -- Used to make the smasher of the crate be killed if they are too close local foundObj = self:GetProximityObjects{ name = "crateHitters" }.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetID() == player:GetID() then player:RequestDie() --break end end -------------------------------- self:SetVar("bIsHit" , true) self:CastSkill{skillID = 147, optionalOriginatorID = player} --self:GetSkills().skills[1] } -- has skill 147 (aoe that deals 2 damage) self:PlayEmbeddedEffectOnAllClientsNearObject{ radius = 16.0, fromObjectID = self, effectName = "camshake" } self:Die() --update the mission related to the crates player:UpdateMissionTask {taskType = "complete", value = 333, value2 = 1, target = self} --update the achievements related to the crates player:UpdateMissionTask{taskType = "complete", value = 430, value2 = 1, target = self} player:UpdateMissionTask{taskType = "complete", value = 431, value2 = 1, target = self} player:UpdateMissionTask{taskType = "complete", value = 432, value2 = 1, target = self} player:UpdateMissionTask{taskType = "complete", value = 454, value2 = 1, target = self} player:UpdateMissionTask{taskType = "complete", value = 455, value2 = 1, target = self} player:UpdateMissionTask{taskType = "complete", value = 456, value2 = 1, target = self} player:UpdateMissionTask{taskType = "complete", value = 457, value2 = 1, target = self} player:UpdateMissionTask{taskType = "complete", value = 458, value2 = 1, target = self} end end -- Plays a shake when a player is close function onProximityUpdate(self, msg) if (msg.status == "ENTER") then local faction = msg.objId:GetFaction() if faction and faction.faction == 1 then self:PlayAnimation{ animationID = "bounce" } self:PlayFXEffect{ name = "bouncin", effectType = "anim" } self:SetVar("playersNearChest", (self:GetVar("playersNearChest") + 1 )) end end if (msg.status == "LEAVE") then local faction = msg.objId:GetFaction() if faction and faction.faction == 1 then self:SetVar("playersNearChest", (self:GetVar("playersNearChest") - 1 )) if self:GetVar("playersNearChest") < 1 then self:PlayAnimation{ animationID = "idle" } self:StopFXEffect{ name = "bouncin" } self:SetVar("playersNearChest", 0) end end end endrequire('o_mis') function onCollisionPhantom(self, msg) --print ("You entered") LEVEL:SetLights( true, 0x476A72, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 1300.00, -1990.00, -2990.00 }, --directional direction true, 0x4FBCD3, --fog color true, --modifying draw distances (all of them) 80.0, 80.0, --fog near min/max 500.0, 298.0, --fog far min/max 175.0, 175.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 8500.0, 8500.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "Mesh\env\env_won_gnar_jungle_sky.nif" ) end function onOffCollisionPhantom(self, msg) --print ("You exited") LEVEL:SetLights( true, 0x476a72, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 1300.00, -1990.00, -2990.00 }, --directional direction true, 0x3a7599, --fog color true, --modifying draw distances (all of them) 50.0, 50.0, --fog near min/max 500.0, 174.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "Mesh\env\env_sky_headspace_01.nif" ) endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onCollisionPhantom(self, msg) --print ("You entered") LEVEL:SetLights( true, 0x476A72, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 1300.00, -1990.00, -2990.00 }, --directional direction true, 0x4FBCD3, --fog color true, --modifying draw distances (all of them) 80.0, 80.0, --fog near min/max 500.0, 298.0, --fog far min/max 175.0, 175.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 8500.0, 8500.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "Mesh\env\env_won_gnar_jungle_sky.nif", 3.0 ) endfunction onCollisionPhantom(self, msg) --print ("You exited") LEVEL:SetLights( true, 0x476a72, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 1300.00, -1990.00, -2990.00 }, --directional direction true, 0x3a7599, --fog color true, --modifying draw distances (all of them) 50.0, 50.0, --fog near min/max 500.0, 174.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "Mesh\env\env_sky_headspace_01.nif", 3.0 ) end function onRebuildNotifyState(self, msg) local Ape = self:GetParentObj().objIDParent if( Ape == nil or Ape:Exists() == false ) then return end -- a player just did the quickbuild. if (msg.iState == 2) then -- Notify the APE that the build is done and using the player as the sender so we can update missions. Ape:NotifyObject{ ObjIDSender = msg.player, name = "rebuildDone" } self:SetVar("AnchorBreakTime", 1) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("AnchorBreakTime") , "AnchorBreakTime", self ) end if (msg.iState == 6) then --Ape:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } self:RequestDie{} end end function onDie(self, msg) local Ape = self:GetParentObj().objIDParent if( Ape == nil or Ape:Exists() == false ) then return end Ape:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } end function onTimerDone(self, msg) if msg.name == "AnchorBreakTime" then self:RequestDie{} end end -------------------------------------------------------------- -- Server Script on the archway in Gnarled Forest -- this script casts skill on rebuild compete -- trent... 06/09/10 -------------------------------------------------------------- function onRebuildComplete(self,msg) if msg.userID then msg.userID:CastSkill{skillID = 863 , optionalTargetID = msg.userID } end end --banana cluster spawn from hit tree require('TestAndExample/MessageNotification/notificationDemoHelpers') function onStartup(self) --can this carry over to another function with a server script, wtih multiple versions of this script running at the same time? spawnBanana(self) end function spawnBanana(self) local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() oPos.pos = self:GetPosition().pos oPos.pos.y = oPos.pos.y + 12 oPos.pos.x = oPos.pos.x - (oDir.left.x * 5) oPos.pos.z = oPos.pos.z - (oDir.left.z * 5) oPos.rot = self:GetRotation() local group = "bc"..self:GetVar("number") --print(group) local config = { { "groupID" , group } } RESMGR:LoadObject { objectTemplate = 6909, x= oPos.pos.x, y= oPos.pos.y , z= oPos.pos.z, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = self, configData = config} end function onChildLoaded( self, msg ) local floatingbanana = self:GetObjectsInGroup{group = "bc"..self:GetVar("number"), ignoreSpawners = true}.objects[1] storeObjectByName(self,"floatingbanana",floatingbanana) --print(#floatingbanana) self:SendLuaNotificationRequest{requestTarget=floatingbanana, messageName="Die"} end --on hit function onOnHit(self, msg) self:SetHealth{health = 9999} local group = "bc"..self:GetVar("number") local clustergroup = self:GetObjectsInGroup{ group = group, ignorespawners = true }.objects local bgroup = "FallB"..self:GetVar("number") local bconfig = { { "groupID" , bgroup } } --print(#clustergroup) --if banana cluster exists if #clustergroup == 0 then return end --print("clustergroup") --delete banana cluster in the tree for k,v in ipairs(clustergroup) do --GAMEOBJ:DeleteObject(v) v:Die{ killType = "SILENT" } end local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() oPos.pos = self:GetPosition().pos oPos.pos.y = oPos.pos.y + 15 oPos.pos.x = oPos.pos.x - (oDir.left.x * 5) oPos.pos.z = oPos.pos.z - (oDir.left.z * 5) oPos.rot = self:GetRotation() --Spawn in falling banana config data 6718 local bgroup = "FallB"..self:GetVar("number") local bconfig = { { "groupID" , bgroup } } RESMGR:LoadObject { objectTemplate = 6718, x= oPos.pos.x, y= oPos.pos.y , z= oPos.pos.z, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = obj, configData = bconfig} --GAMEOBJ:GetTimer():AddTimerWithCancel( 30, "bananaTimer", self ) --start timer end function notifyDie(self,other,msg) --print("i have death") GAMEOBJ:GetTimer():AddTimerWithCancel( 30, "bananaTimer", self ) end --on timer done function onTimerDone(self, msg) if msg.name == "bananaTimer" then --respawn banana cluster in tree 6909 put it back in that group spawnBanana(self) end end ----on the banana cluster script ---- send ondie message -------------------------------------------------------------- -- Script on the banana clusters in Gnarled Forest to kill them after 100 seconds -- -- updated Brandi... 3/19/10 -------------------------------------------------------------- function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 100, "startup", self ) end function onTimerDone(self, msg) if (msg.name == "startup") then self:RequestDie{killerID = self, killType = SILENT} end end-------------------------------------------------------------- -- Script on the banana clusters in Gnarled Forest Client Side to -- handle renderupdates. -- -- updated Lucas Utterback... 5/10/10 -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetUpdatable{bUpdatable=true}; end--require('State') --require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["QuickbuildAnchorLOT"] = 7549 --get a real number for this thing CONSTANTS["GroundPoundSkill"] = 725 CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) self:SetVar("Trg.1", 0 ) -- used to store QBs the ape spawns so we can kill them if the ape dies by damage self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true } -- Make immune to move/teleport behaviors self:SetVar("KnockedOut", false) -- make a var used to see if the ape has been knocked out end --When this skill is cast, spawn the anchor QB function onCastSkill(self, msg) if msg.skillID == CONSTANTS["GroundPoundSkill"] and not self:GetVar("QBAlive") then GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "SpawnQBTime", self ) end end --check if armor is depleted then start timer and change faction function onOnHit(self, msg) if self:GetArmor{}.armor < 1 and self:GetVar("KnockedOut") == false then self:EnableCombatAIComponent {bEnable = false} self:ClearThreatList() self:CancelSkillCast() self:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true} self:SetVar("ReviveTime", 12) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("ReviveTime") , "ReviveTime", self ) self:SetVar("KnockedOut", true) GAMEOBJ:GetTimer():CancelTimer("SpawnQBTime", self) self:ChangeIdleFlags{off = 9} self:PlayAnimation{animationID = "disable",fPriority = 1.7} end end -- Check timer to revive function onTimerDone(self, msg) if msg.name == "ReviveTime" then self:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true} self:EnableCombatAIComponent {bEnable = true} ProximityPuls(self) self:SetArmor{armor = 25} self:SetVar("KnockedOut", false) self:ChangeIdleFlags{on = 9} end if msg.name == "SpawnQBTime" then local mypos = self:GetPosition().pos local myRot = self:GetRotation() local parent = msg.killerID; --put quick build on Apes look dir local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() oPos.pos = self:GetPosition().pos oPos.pos.y = oPos.pos.y oPos.pos.x = oPos.pos.x - (oDir.backward.x * 8) oPos.pos.z = oPos.pos.z - (oDir.backward.z * 8) local posString = self:CreatePositionString{ x = (oPos.pos.x), y = oPos.pos.y, z = (oPos.pos.z) }.string local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", 10}, {"no_timed_spawn", true}, {"currentTime", 0} } RESMGR:LoadObject { objectTemplate = CONSTANTS["QuickbuildAnchorLOT"], x= mypos.x, y= mypos.y + 13, z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y , rz = myRot.z, configData = config, owner = self } self:SetVar("QBAlive", true) end if msg.name == "SmashApeTime" then --Smashing the ape and calling the player as the killer self:Die{killerID = GAMEOBJ:GetObjectByID(self:GetVar("Smasher"))} end end --Notify the Ape when the rebuild state changes function onNotifyObject( self, msg ) -- if the rebuild is complete if ( msg.name == "rebuildDone" ) then --Getting the sender ID which we set as the player and storing it for the DIE call self:SetVar("Smasher", "|" .. msg.ObjIDSender:GetID()) self:SetVar("SmashApeTime", .5) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("SmashApeTime") , "SmashApeTime", self ) end if ( msg.name == "rebuildCancel" ) then --print("************rebuild should be canceled") self:SetVar("QBAlive", false) -- now, clear out the child for i = 1, table.maxn( self:GetVar("Trg") ) do local childId = self:GetVar("Trg."..i) local senderId = msg.ObjIDSender:GetID() --print("Checking child: "..childId.." against "..senderId) if childId == senderId then --print(" Erasing from slot: "..i) self:SetVar("Trg."..i , 0) break end end end end --Store the QB so we can use it to smash the ape function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["QuickbuildAnchorLOT"]) then --print("Anchor child loaded: "..msg.childID:GetID()) storeParent( self, msg.childID ) local t = self:GetVar("Trg") -- Save Target ID's/ for i = 1, table.maxn( t ) + 1 do if self:GetVar("Trg."..i) == nil or self:GetVar("Trg."..i) == 0 then --print(" Storing in slot: "..i) storeChild(self, msg.childID , i) break end end end end -- Smash the ape on death (also kill any QBs it dropped) function onDie(self,msg) --print("Ape died...") for i = 1, table.maxn( self:GetVar("Trg")) do local child = getChild(self, i) if child:Exists() then --print(" Killing child ("..child:GetID()..") in slot: "..i) self:SetVar("Trg."..i, 0) child:RequestDie{killType = "VIOLENT"} break end end end --Get the QB/s that the dragon spawns function getChild(self, num) targetID = self:GetVar("Trg."..num ) return GAMEOBJ:GetObjectByID(targetID) end -- Store the QB/s that the dragon spawns function storeChild(self, target, num) idString = target:GetID() finalID = "|" .. idString self:SetVar("Trg."..num , finalID) end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] --Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius --Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 51 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] --Set['aggroRadius'] = 25 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius --Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 51 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 3 -- Min Wander Delay Set['WanderDelayMax'] = 6 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end function onNotifyObject(self,msg) if msg.name == "flagDugUp" then self:NotifyClientObject{ name = "changePhysics" , paramObj = GAMEOBJ:GetObjectByID(msg.param1) , rerouteID = msg.paramObj } --print(" ##################### server object notified") end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 55 function onStartup(self) self:SetVar("TickTime", 1) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } self:CastSkill{skillID = 200} self:SetVar("DieTime", 25) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end --Gets the player that built the generator -- Commented out for the time being just in case we need it. --[[ function onRebuildStart(self, msg) storeObjectByName (self, "playerID", msg.userID ) end --]] ------------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end if msg.name == "TickTime" then self:CastSkill{skillID = 200} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end end-------------------------------------------------------------- -- Server Script on the jailkeep in Gnarled Forest -- this script adds all the feed the ninjas missions and alerts the ninjas to show their icons -- updated Brandi... 2/22/10 -------------------------------------------------------------- -- when the player accepts the jailkeep mission, this gives him all of the ninjas feed me missions function onMissionDialogueOK(self,msg) print("mission state "..msg.iMissionState) local player = msg.responder if msg.missionID == 385 and msg.iMissionState == 1 then player:AddMission{ missionID = 386} player:AddMission{ missionID = 387} player:AddMission{ missionID = 388} player:AddMission{ missionID = 390} --get all the ninjas by group and tell them to show their icons local ninjas = self:GetObjectsInGroup{ group = 'Ninjas', ignoreSpawners = true }.objects for k,v in ipairs(ninjas) do --v:FireEventClientSide{senderID = self, args = 'showIcon'} end -- turn the icons on the ninjas back off, so the player doesn't see the next ninja mission yet elseif msg.missionID == 385 and msg.iMissionState == 4 then local ninjas = self:GetObjectsInGroup{ group = 'Ninjas', ignoreSpawners = true }.objects for k,v in ipairs(ninjas) do --v:FireEvent{senderID = self, args = 'hideIcon'} end -- if the player completes the jail keep mission after getting the free the ninjas mission, it re-adds the missions for the player if (player:GetFlag{iFlagID = 68}.bFlag == true) then player:AddMission{ missionID = 701} player:AddMission{ missionID = 702} player:AddMission{ missionID = 703} player:AddMission{ missionID = 704} end end endrequire('o_mis') --[[function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end ]]-- function onUse(self,msg) -- set camera, lock player (teleport player?) local player = msg.user print(player) storeObjectByName(self, "Cannoneer", msg.user) player:PlayCinematic { pathName = "JailCam_"..self:GetVar('Jail') } GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "lightcannon",self ) player:SetUserCtrlCompPause{bPaused = true} -- play animation on player player:PlayAnimation{ animationID = "scratch" } -- start timer for cannon animation to start end function onTimerDone(self,msg) --if player animation done -- play cannon firing animation -- play cinematic of cannon ball flying local player = getObjectByName(self, "Cannoneer") if (msg.name == "lightcannon") then local cineTime = tonumber(LEVEL:GetCinematicInfo("JailCannonCam_"..self:GetVar('Jail'))) player:PlayCinematic { pathName = "JailCannonCam_"..self:GetVar('Jail') } GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "explodedoor",self ) end if (msg.name == "explodedoor") then player:PlayCinematic { pathName = "JailNinjaCam_"..self:GetVar('Jail') } local ninja = self:GetObjectsInGroup{group = "JailNinja"..self:GetVar('Jail'), ignoreSpawners = true}.objects[1] local jailcell = self:GetObjectsInGroup{group = "JailCell"..self:GetVar('Jail'), ignoreSpawners = true}.objects print("JailCell"..self:GetVar('Jail').. " " .. #jailcell) for k,v in ipairs(jailcell) do --GAMEOBJ:DeleteObject(v) print("v") v:Die{ killType = "VIOLENT"} end GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "alldone",self ) ninja:PlayAnimation{animationID = 'sleep', bPlayImmediate = true} end if (msg.name == "alldone") then print("alldone") player:SetUserCtrlCompPause{bPaused = false} end endfunction onStartup(self,msg) --print("Jail0"..self:GetVar("Wall")) end function onRebuildComplete(self,msg) local PirateSpawner = LEVEL:GetSpawnerByName("Jail0"..self:GetVar("Wall")) local CaptainSpawner = LEVEL:GetSpawnerByName("JailCaptain0"..self:GetVar("Wall")) PirateSpawner:SpawnerDeactivate() CaptainSpawner:SpawnerDeactivate() end function onRebuildNotifyState(self, msg) --print(msg.iState) if (msg.iState == 4) then --print("Reset Spawners") local PirateSpawner = LEVEL:GetSpawnerByName("Jail0"..self:GetVar("Wall")) local CaptainSpawner = LEVEL:GetSpawnerByName("JailCaptain0"..self:GetVar("Wall")) PirateSpawner:SpawnerReset() CaptainSpawner:SpawnerReset() PirateSpawner:SpawnerActivate() CaptainSpawner:SpawnerActivate() end end-- Script used to start and kill a skill on an object that will be randomly spawing through a spawner network. local mySkill = 607 function onStartup(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "startSkill", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5 , "killSelf", self ) end function onTimerDone(self, msg) if msg.name == "startSkill" then self:CastSkill{skillID = mySkill} end if msg.name == "killSelf" then self:RequestDie() end endfunction onUse(self,msg) self:PlayNDAudioEmitter{m_NDAudioEventGUID = "{500434f3-3e21-48f6-87d7-928487ff280e}"} --local dancers = self:GetObjectsInGroup{ group = Dance, ignorespawners = true }.objects self:GetObjectsInGroup{ group = "Dance", ignoreSpawners = true }.objects[1]:PlayAnimation{animationID = 'dance', bPlayImmediate = true} --dancers[1]:PlayAnimation{ animationID = "dance" } print("organ") end-- Can't fire a skill from the client, so we're receiving messages from the player on client side collision with our parrot volume. function onFireEventServerSide( self, msg ) if ( msg.args == "Slow" ) then self:CastSkill{skillID = 795, optionalTargetID = msg.senderID} elseif ( msg.args == "Unslow" ) then self:CastSkill{skillID = 796, optionalTargetID = msg.senderID} end end-------------------------------------------------------------- -- Script on the red X to spawn certain pets digs -- -- created by brandi 3/9/10 -- edited 5/24/09 -------------------------------------------------------------- function onRebuildComplete(self,msg) --get the position and rotation of the X to spawn the pet treasure node in the same location. local oPos = { pos = {}, rot = {}} oPos.pos = self:GetPosition().pos local player = msg.userID:GetID() -- if this is one of the x builds in GF, they have flagNum config data put on them in HF if self:GetVar("flagNum") then --load the pet treasure node, passing the player the built the X as a varible and the config data of the collible flag number local config = { { "groupID" , "Flag"..self:GetVar("flagNum") },{ "builder" , '|'..player },{ "X" , '|' .. self:GetID() } } --X is to smash this quickbuild RESMGR:LoadObject { objectTemplate = 7410, x= oPos.pos.x, y= oPos.pos.y + .5 , z= oPos.pos.z, owner = self, configData = config} -- the only other x build is in AG else local mission = msg.userID:GetMissionState{missionID = 746}.missionState --if the player is not on the missions 746 from Captain jack, then spawn a normal pet dig if mission ~= 2 then local config = { { "builder" , '|'..player },{ "X" , '|' .. self:GetID() } } --X is to smash this quickbuild RESMGR:LoadObject { objectTemplate = 3495, x= oPos.pos.x, y= oPos.pos.y + .5 , z= oPos.pos.z, owner = self, configData = config} -- the player is on mission 746, spawn the pet dig that spits out pic of Captain Jacks mom else local config = { { "builder" , '|'..player },{ "X" , '|' .. self:GetID() } } --X is to smash this quickbuild RESMGR:LoadObject { objectTemplate = 9307, x= oPos.pos.x, y= oPos.pos.y + .5 , z= oPos.pos.z, owner = self, configData = config} end end end require('o_mis') -- used for getObjectByName function onStartup(self) --self:SetVar("NodeClaimed", false) --pet treasure chest is spawned in on quickbuild of X, this kills if after 45 seconds if unused GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "KillChest", self ) end function onCollisionPhantom(self, msg) --gets the pet that collided with the pet treause local target = msg.senderID --print(target:GetID()) -- Make sure the target is a tame pet (wild pets don't care about treasure) local isPet = target:GetIsPet() if (self:IsDead().bDead ~= true and isPet.bIsPet == true and isPet.bIsWild == false) then --print("COLLISION: " .. target:GetName().name) --print("COLLISION" .. target:GetName().name) --gets the player that built the X, and was stored on the pet treasure box local player = self:GetVar("builder") --print(player) --sets the pet owner based on the pet that collided with the pet treasure node local petOwner = target:GetParentObj().objIDParent:GetID() --print(petOwner) --checks to see if the pet that collided with the treasure if the pet of the player who built the X if (player == petOwner) then -- If chest hasn't already been claimed by another pet -- Make sure the chest hasn't already been claimed by another pet --local claimed = self:GetVar("NodeClaimed") --print("claimed=" .. tostring(claimed)) --if (claimed == false or claimed == target) then -- If pet is not in the process of using an ability already if ( target:GetPetAbilityObject().bHasAbilityObj == false ) then storeObjectByName(self, "Pet", target) --print("NODE NOW CLAIMED") -- Pet marks chest as claimed so another pet cannot grab it --self:SetVar("NodeClaimed", target) -- Let pet know they're at a dig location target:NotifyPet{ ObjIDSource = target , ObjToNotifyPetAbout = self , iPetNotificationType = 6 } -- Store the ID of the pet that has found the treasure storeObjectByName(self, "activator", target) end --end end end end function onOffCollisionPhantom(self, msg) local target = msg.senderID -- Make sure the target is a tame pet (wild pets don't care about treasure) local isPet = target:GetIsPet() if (isPet.bIsPet == true and isPet.bIsWild == false) then --print("OFF COLLISION" .. target:GetName().name) local activator = getObjectByName(self, "activator") if ( activator and ( target:GetID() == getObjectByName(self, "activator"):GetID() )and (target:GetID() == self:GetVar("builder") ) )then --self:SetVar("NodeClaimed", false) -- Notify pet they've left the pet switch target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 7 } end end end function onNotifyObject(self, msg) -- If treasure node receives notification a pet is digging it up if ( msg.name == "petdughere" ) then self:SetNetworkVar("treasure_dug", true) local petOwner = msg.ObjIDSender:GetParentObj().objIDParent local player = GAMEOBJ:GetObjectByID(self:GetVar("builder")) --print("petOwner is "..petOwner:GetID().." and player is "..player:GetID()) --:GetName().name -- check to make sure the pet owner is still the player who built the X, just another check if (petOwner:GetID() == player:GetID()) then --print("in petowner = player") local PlayerFlagNum = 0 --set the flag number to check/set on the player based on which flag in GF it is. --player flag number set in the database if (self:GetVar("groupID") == "Flag1") then PlayerFlagNum = 61 elseif (self:GetVar("groupID") == "Flag2") then PlayerFlagNum = 62 elseif (self:GetVar("groupID") == "Flag3") then PlayerFlagNum = 63 end --check to see if they player as dug the flag up before if not player:GetFlag{iFlagID = PlayerFlagNum}.bFlag then -- Ability is done being used, remove using-ability state from pet msg.ObjIDSender:RemovePetState{iStateType = 9} --get the flag based on the group, to change the collision group and visiblity on those scripts --assume only one object in group local flag = self:GetObjectsInGroup{ group = self:GetVar("groupID"), ignoreSpawners = true }.objects[1] --local player = petOwner --notifies script on the flag L_GF_DUG_FLAG_CLIENT flag:NotifyClientObject{ name = "changePhysics" , paramObj = GAMEOBJ:GetObjectByID(msg.param1) , rerouteID = player }--NotifyObject{ name = "flagDugUp", paramObj = petOwner } --set the player flag for this collectible flag so next time the player digs it, he'll get generic pet loot instead petOwner:SetFlag{iFlagID = PlayerFlagNum, bFlag = true} GAMEOBJ:DeleteObject(self) else --remove the dig state from the pet msg.ObjIDSender:RemovePetState{iStateType = 9} self:Die{ killType = "VIOLENT" , killerID = petOwner } --GAMEOBJ:DeleteObject(self) end --cancel the timer to kill the treasure chest, and kill it early GAMEOBJ:GetTimer():CancelTimer("KillChest", self); --smash the built X if it is still built GAMEOBJ:GetObjectByID(self:GetVar("X")):Die{ killType = "VIOLENT" } end end end function onTimerDone(self, msg) if ( msg.name == "KillChest" ) then local target = getObjectByName(self, "Pet") -- Pet 'kills' the treasure node, causing it to spawn a treasure chest --check to make sure the pet actually existing, if no pet, then just kill the node if target then target:RemovePetState{iStateType = 9} target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 7 } end GAMEOBJ:DeleteObject(self) end end function onDie(self,msg) local myParent = getParent(self) if ( self:GetVar("I_Have_A_Parent") ) then myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") end -- Let the scene's treasure node spawner know this treasure has died, so it can spawn another one later. getParent(self):NotifyObject{name = "died"} end local pickPriority = 0.8 local pickType = 0 function onStartup(self, msg) --print("Treasure startup") pickType = 0 self:SetVar("isCharacterNearby", false) end function onDie(self, msg) --print("Treasure died") -- terminate the player's interaction (could be this treasure or the pet) local localCharacterID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localCharacterID:TerminateInteraction{ ETerminateType="user", ObjIDTerminator=localCharacterID } pickType = -1 self:RequestPickTypeUpdate{} end function onCollisionPhantom(self, msg) --print("CollisionPhantom: sender=" .. msg.senderID:GetName().name) --print("CollisionPhantom: self=" .. self:GetName().name) if (msg.senderID:IsCharacter{}.isChar and msg.senderID:GetID() == GAMEOBJ:GetLocalCharID()) then self:SetVar("isCharacterNearby", true) -- start a timer to check if the player is in proximity with a pet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end function onOffCollisionPhantom(self, msg) --print("OffCollisionPhantom: sender=" .. msg.senderID:GetName().name) if (msg.senderID:IsCharacter{}.isChar and msg.senderID:GetID() == GAMEOBJ:GetLocalCharID()) then self:SetVar("isCharacterNearby", false) pickType = -1 GAMEOBJ:GetTimer():CancelTimer("UpdateIcons", self); self:RequestPickTypeUpdate{} end end function onTimerDone(self, msg) --print(self:GetName().name .. ".TimerDone: " .. msg.name) if ( msg.name == "UpdateIcons" ) then if ( self:GetVar("isCharacterNearby") == true) then local oldPickType = pickType pickType = -1 local pet = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetPetID().objID if (self:IsDead{}.bDead == true) then -- chest is dead, hide the icon pickType = -1 elseif (pet:Exists() == false) then -- no pet, show the icon pickType = 14 elseif (pet:IsPetUsingAbility().bIsUsingAbility == false) then -- pet not signaling, show the icon pickType = 14 end --print("PickType=" .. tostring(pickType) .. ", oldPickType=" ..tostring(oldPickType)) if (pickType ~= oldPickType) then self:RequestPickTypeUpdate{} end -- start the timer again --GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end end function onScriptNetworkVarUpdate(self,msg) local i = 1 while i <= #msg.tableOfVars do local tableVar = msg.tableOfVars[i][1] if ( tableVar == "treasure_dug" ) then if ( msg.tableOfVars[i][2] == true ) then self:PlayFXEffect{effectType = "dug_up"} self:SetTransparency{fAlphaValue = 0.2} return end end i = i + 1 end end function onGetPriorityPickListType(self, msg) if ( pickPriority >= msg.fCurrentPickTypePriority ) then if (pickType ~= 0) then --print("Set pickType=" .. tostring(pickType)) msg.ePickType = pickType end msg.fCurrentPickTypePriority = pickPriority end return msg end function onClientUse(self, msg) -- the only way for a player to use this item is by hitting their interact button -- the only time the interact button is available here is when the pick type is 14 -- the only time the pick type is 14 is when the player doesn't have a pet or the digging ability -- therefore, show the tooltip indicating they need a pet msg.user:DisplayTooltip{ bShow = true, strText = Localize("PR_DIG_TUTORIAL_04"), iTime = 3000 } end-------------------------------------------------------------- -- Description: Server side script for verifying racing -- instancing information. Add this script to a minigame instancer -- to add drag to interact and double click functionality. -- -- Updated 4/26/10 mrb... added proximity and onCheckWithinBounds -------------------------------------------------------------- function onStartup(self) -- set up a proximity monitor based on the HF interaction distance self:SetProximityRadius{radius = self:GetVar("interaction_distance"), name = "Interaction_Distance"} end function onMatchGetDataForPlayer(self, msg) msg.bOK = false --Verify that the activityID the player is requesting matches my activity ID and the player dragged an item if msg.playerChoices.droppedItem == nil or self:GetActivityID().activityID ~= msg.activityID then return end local modObj = GAMEOBJ:GetObjectByID(msg.playerChoices.droppedItem) -- Check the players inventory for the item and fail if not if not modObj or msg.player:GetInvItemCount{iObjID=modObj}.itemCount < 1 or modObj:GetLOT().objtemplate ~= 8092 then return end -- Save this out now for the destination map msg.finalValues.droppedItem = msg.playerChoices.droppedItem -- Approve of the player selections msg.bOK = true -- Calculate the players point worth msg.points = 1 return msg end function onCheckWithinBounds(self, msg) --print('onCheckWithinBounds ' .. msg.requestingObj:GetItemOwner().ownerID:GetName().name .. ' --> ' .. msg.requestingObj:GetName().name) local playerID = msg.requestingObj:GetItemOwner().ownerID:GetID() -- loop through the objects in proximity and see if the player requesting the double click is there for k,v in ipairs(self:GetProximityObjects{name = "Interaction_Distance"}.objects) do if v:GetID() == playerID then self:SetNetworkVar("bPassedCheck", {playerID, msg.requestingObj:GetID()}) msg.altMessage = "Loading Race with selected Car." break end end return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] =2 CONSTANTS["EnemySmashableFaction"] = 115 function onStartup(self) self:SetVar("TickTime", 1) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } -- Cast the stun skill self:CastSkill{skillID = 499} -- set a time to smash QB self:SetVar("DieTime", 25) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) -- start timer to cast skill GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end ----------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end if msg.name == "TickTime" then self:CastSkill{skillID = 499} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end endfunction onUse(self,msg) self:PlayAnimation{ animationID = "jump" } --print("pirate") end-- copy of L_AG_CONCERT_PROP_QUICKBUILD.lua (ON THE OBJECT BUILT THOUGH THE CHOICEBUILD) function onStartup(self) --self:SetVar("groupID","TikiHeads") self:AddObjectToGroup{ group = "TikiHeads" } print("*******************NEW TIKI CREATED ************************!!!!!!!!!!!!!") end function onRebuildNotifyState( self, msg) --print (msg.iState) if ( msg.iState == 4 ) then -- the choice build is smashed print("******************* TIKI SMASHED ************************!!!!!!!!!!!!!") --self:GetParentObj().objIDParent:SetVar('TikiSet', false) self:SetVar('TikiSet', false) print('destroy ramp') --LEVEL:DestroySpawnerObjects("Ramp") --LEVEL:ResetSpawner("Ramp") local rampSpawner = LEVEL:GetSpawnerByName("Ramp") if rampSpawner then rampSpawner:SpawnerDestroyObjects() rampSpawner:SpawnerReset() end end end-------------------------------------------------------------- -- Server side script for tiki torches that spawn imagination -- updated mrb... 6/2/10 - added TerminateIneraction -- updated brandi 8/2/10 - made cool down timers based on animation time instead of fixed time -------------------------------------------------------------- local lootLOT = 935 -- LOT of the loot object to spawn local numToSpawn = 3 -- number of loot objects to spawn function onStartup(self) lightTorch(self) end function lightTorch(self) self:PlayFXEffect{name = "tikitorch", effectID = 611, effectType = "fire"} self:SetVar("isBurning",true) end function onUse(self, msg) if self:GetVar("bActive") then return end local cooldownTime = self:GetAnimationTime{ animationID = "interact" }.time local player = msg.user self:PlayAnimation{ animationID = "interact" } self:SetVar("bActive", true) self:SetVar("userID", player:GetID()) for i = 1, numToSpawn do local newSpawner = GAMEOBJ:GenerateSpawnedID() self:DropLoot{owner = player, lootID = newSpawner, itemTemplate = lootLOT, rerouteID = player, sourceObj = self} end GAMEOBJ:GetTimer():AddTimerWithCancel( cooldownTime , "InteractionCooldown", self ) end function onSkillEventFired( self, msg ) if msg.wsHandle == "waterspray" then if self:GetVar("isBurning") then local cooldownTime = self:GetAnimationTime{ animationID = "water" }.time self:PlayAnimation{ animationID = "water" } self:StopFXEffect{name = "tikitorch"} self:PlayFXEffect{effectID = 611, effectType = "water"} self:PlayFXEffect{effectID = 611, effectType = "steam"} msg.casterID:UpdateMissionTask{taskType = "complete", value = 472, value2 = 1, target = self} GAMEOBJ:GetTimer():AddTimerWithCancel( cooldownTime, "Relight",self ) self:SetVar("isBurning",false) end end end function onTimerDone(self, msg) if msg.name == "Relight" then lightTorch(self) elseif msg.name == "InteractionCooldown" then local player = GAMEOBJ:GetObjectByID(self:GetVar("userID")) if player then player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end self:SetVar("bActive", false) self:SetVar("userID", false) end end --function onMessageBoxRespond(self, msg) -- if (msg.iButton == 1) then -- msg.sender:TransferToZone{ zoneID = 1301 } -- end --end --function onCollisionPhantom(self,msg) --onUse(self, msg) -- -- get player who clicked on us -- local player = msg.senderID -- self:Help{rerouteID = player, iHelpID = 0} --end function moveDoor(obj, goForward) local doorObj = obj:GetObjectsInGroup{ group = "Fire_Puzzle_Mover" }.objects for k,v in ipairs(doorObj) do v:StartPathing() --print ("dont know why it isnt pathing") end end function onTimerDone(self, msg) if msg.name == "DoorUp" then moveDoor(self, false) --print ("door should be moving up") end end function onMissionDialogueOK(self, msg) if msg.bIsComplete == true and msg.missionID == 331 then --print ("turned in mission") moveDoor(self, true) GAMEOBJ:GetTimer():AddTimerWithCancel( 28, "DoorUp", self ) local player = msg.responder if (player:GetFlag{iFlagID = 24}.bFlag == true) then return end player:SetFlag{iFlagID = 24, bFlag = true} end endrequire('o_mis') function onRebuildComplete(self, msg) local player = msg.userID storeObjectByName(self, "Swinger", player) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "Start",self ) end function onTimerDone(self, msg) local player = getObjectByName(self, "Swinger") if msg.name == "Start" then player:PlayAnimation{ animationID = "crow-swing", fPriority = 4.0 } self:PlayAnimation{ animationID = "swing" } end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 12 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onFireEvent( self, msg ) if ( msg.args ) then if self:GetVar("ambushFoo") == nil then --~ print("*****triggered fireEvent path movement **************") if self:GetVar("teleLoc") then local s = self:GetVar("teleLoc") local t = split(s, '_') local xSplit= {x=t[1] , y=t[2] , z=t[3] } --~ for k,v in pairs(xSplit) do print(x) end self:Teleport{ pos = xSplit} end --~ WayPointEventFunc(self,"changeWP","Ambush01,3") WayPointEventFunc(self,"changeWP",self:GetVar("pathVar")..",1") self:SetVar("ambushFoo", "asdf") end end end --[[ -- Advanced Functions and Events tied to the template function onTemplateChangeWaypoints(self, msg) -- called on an object when the waypoint event for Changing Waypoints happens -- return true to halt process in the AI system end function onTemplateProximityUpdate (self, msg) end function onTemplateTimerDone (self, msg ) end function onTemplateHit (self, msg ) end function onTemplateDie (self, msg ) end function onTemplateLeftTetherRadius ( self, msg ) end function onTemplateCustomStateEnter(self, msg) end function onTemplateCustomStateArrived(self, msg) end --]] require('o_mis') require('State') require('o_StateCreate') require('o_WayPoints') --/////////////////////////////////////////////////////////////////////////////////////// --// Seige Dir --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:SetVar("NumberOfChildern", 0 ) -- Dont not change this Val <<< self:SetVar("WP_Num", 1) -- Dont not change this Val <<< --///////////////////////////////////////////// -- Settings (Alpha =a) " a_1 (Num = 1) a_1 = the WayPoint Set --///////////////////////////////////////////// self:SetVar("PetNames", "ninja") self:SetVar("WP_Alpha", "a") -- starting letter of the Way Point ( a_1 = a) or (anyName_1) self:SetVar("MaxPets", 3) -- Max Pets Spawn in the wrold self:SetVar("TotalPets", 6) -- Total Number of Pets self:SetVar("PetID", 2244) --///////////////////////////////////////////// --///////////////////////////////////////////// -- define total pet IDs for i = 1, self:GetVar("TotalPets") do self:SetVar("Pet_"..i, self:GetVar("PetID")) -- attach WP to NPC self:SetVar("slot_"..i, nil ) end for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) self:SetVar(FinalName, "NotSpawned") end self:UseStateMachine{} ParentIdle = State.create() ParentIdle.onEnter = function(self) setState("ReSpawnChild",self) end ParentIdle.onArrived = function(self) end DeadChild = State.create() DeadChild.onEnter = function(self) local NChildern = self:GetVar("NumberOfChildern") - 1 self:SetVar("NumberOfChildern", NChildern ) setState("ReSpawnChild",self) end DeadChild.onArrived = function(self) end ---------------------------------------------------------------------------------- -- /////////////////////////////////////////////////////////////////////////////// -- ReSpawn Childern State -- /////////////////////////////////////////////////////////////////////////////// ReSpawnChild = State.create() ReSpawnChild.onEnter = function(self) if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") then local ran = GetValidRandom(self) for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) if ran == i and self:GetVar(FinalName) == "NotSpawned" then SpawnPet(self, i ) end end end end ReSpawnChild.onArrived = function(self) end ---------------------------------------------------------------------------------- addState(ParentIdle, "ParentIdle", "ParentIdle", self) addState(DeadChild, "DeadChild", "DeadChild", self ) addState(ReSpawnChild,"ReSpawnChild","ReSpawnChild",self) beginStateMachine("ParentIdle", self) ParentIdle.onEnter(self) end onChildLoaded = function(self,msg) local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("SpawnedVar", FinalName ) local FreeSlot = GetValidRandom(self) msg.childID:SetVar("attached_path", self:GetVar("WP_Alpha").."_"..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("I_Have_A_Parent", true ) storeParent(self, msg.childID) end --************************************************************************************ --** Funcitons --************************************************************************************ function SpawnPet(self, num ) for i = 1, self:GetVar("TotalPets") do if num == i then local firstWP = GAMEOBJ:GetWaypointPos( self:GetVar("WP_Alpha").."_"..i, 1) self:SetVar("ChildLoadNUM", i ) RESMGR:LoadObject { objectTemplate = self:GetVar( "Pet_"..i ) , x= firstWP.x , y= firstWP.y , z= firstWP.z , owner = self } -- A1 self:SetVar(self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i, "Spawned" ) local NChildern = self:GetVar("NumberOfChildern") + 1 self:SetVar("NumberOfChildern", NChildern ) break end end if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") + 1 then setState("ReSpawnChild",self) end end function GetValidRandom(self) while true do NUM = math.random(1,self:GetVar("TotalPets")) FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..NUM) if self:GetVar(FinalName) == "NotSpawned" then break end end return NUM end require('o_mis') require('State') require('o_StateCreate') require('o_WayPoints') --/////////////////////////////////////////////////////////////////////////////////////// --// Seige Dir --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:SetVar("NumberOfChildern", 0 ) -- Dont not change this Val <<< self:SetVar("WP_Num", 1) -- Dont not change this Val <<< --///////////////////////////////////////////// -- Settings (Alpha =a) " a_1 (Num = 1) a_1 = the WayPoint Set --///////////////////////////////////////////// self:SetVar("PetNames", "nin") self:SetVar("WP_Alpha", "b") -- starting letter of the Way Point ( a_1 = a) or (anyName_1) self:SetVar("MaxPets", 3) -- Max Pets Spawn in the wrold self:SetVar("TotalPets", 6) -- Total Number of Pets self:SetVar("PetID", 2245) --///////////////////////////////////////////// --///////////////////////////////////////////// -- define total pet IDs for i = 1, self:GetVar("TotalPets") do self:SetVar("Pet_"..i, self:GetVar("PetID")) -- attach WP to NPC self:SetVar("slot_"..i, nil ) end for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) self:SetVar(FinalName, "NotSpawned") end self:UseStateMachine{} ParentIdle = State.create() ParentIdle.onEnter = function(self) setState("ReSpawnChild",self) end ParentIdle.onArrived = function(self) end DeadChild = State.create() DeadChild.onEnter = function(self) local NChildern = self:GetVar("NumberOfChildern") - 1 self:SetVar("NumberOfChildern", NChildern ) setState("ReSpawnChild",self) end DeadChild.onArrived = function(self) end ---------------------------------------------------------------------------------- -- /////////////////////////////////////////////////////////////////////////////// -- ReSpawn Childern State -- /////////////////////////////////////////////////////////////////////////////// ReSpawnChild = State.create() ReSpawnChild.onEnter = function(self) if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") then local ran = GetValidRandom(self) for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) if ran == i and self:GetVar(FinalName) == "NotSpawned" then SpawnPet(self, i ) end end end end ReSpawnChild.onArrived = function(self) end ---------------------------------------------------------------------------------- addState(ParentIdle, "ParentIdle", "ParentIdle", self) addState(DeadChild, "DeadChild", "DeadChild", self ) addState(ReSpawnChild,"ReSpawnChild","ReSpawnChild",self) beginStateMachine("ParentIdle", self) ParentIdle.onEnter(self) end onChildLoaded = function(self,msg) local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("SpawnedVar", FinalName ) local FreeSlot = GetValidRandom(self) msg.childID:SetVar("attached_path", self:GetVar("WP_Alpha").."_"..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("I_Have_A_Parent", true ) storeParent(self, msg.childID) end --************************************************************************************ --** Funcitons --************************************************************************************ function SpawnPet(self, num ) for i = 1, self:GetVar("TotalPets") do if num == i then local firstWP = GAMEOBJ:GetWaypointPos( self:GetVar("WP_Alpha").."_"..i, 1) self:SetVar("ChildLoadNUM", i ) RESMGR:LoadObject { objectTemplate = self:GetVar( "Pet_"..i ) , x= firstWP.x , y= firstWP.y , z= firstWP.z , owner = self } -- A1 self:SetVar(self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i, "Spawned" ) local NChildern = self:GetVar("NumberOfChildern") + 1 self:SetVar("NumberOfChildern", NChildern ) break end end if self:GetVar("NumberOfChildern") < self:GetVar("MaxPets") + 1 then setState("ReSpawnChild",self) end end function GetValidRandom(self) while true do NUM = math.random(1,self:GetVar("TotalPets")) FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..NUM) if self:GetVar(FinalName) == "NotSpawned" then break end end return NUM end -------------------------------------------------------------- -- Server side script on the object to spawn the lion pet -- lion has to be spawned for a server side script because the lion is a pet to be tamed -- pet taming minigame runs on the server as well as the client -- created by Brandi... 2/17/10 -------------------------------------------------------------- function onCheckUseRequirements(self,msg) local player = msg.objIDUser local lions = self:GetObjectsInGroup{ group = "lions", ignoreSpawners = true }.objects local playerlion = self:GetObjectsInGroup{ group = "lion"..player:GetID(), ignoreSpawners = true }.objects if #playerlion > 0 or #lions > 4 then self:FireEventClientSide{args = "tooManyLions", senderID = player} msg.bCanUse = false return msg end end function onUse(self,msg) local mypos = self:GetPosition().pos local myrot = self:GetRotation() local player = msg.user -- off sets the lion spawn so it doesn't spawn in the middle of the spawner object -- this is arbitrary and will be changed depending on where this goes in a level mypos.x = mypos.x + 30 mypos.z = mypos.z-20 --set the tamer as the player to check that only this player can tame that lion -- and set the group id to include the player id to make sure this player can only spawn one lion at a time local config = { { "tamer", player:GetID() } , { "groupID", "lion"..player:GetID()..";lions" } } local newLion = RESMGR:LoadObject { objectTemplate = 3520 , x = mypos.x , y = mypos.y , z = mypos.z , rw = myrot.w, rx = -1 , ry = -1 , rz = myrot.z ,owner = self, configData = config } player:PlayCinematic { pathName = "Lion_spawn" } end function onMissionDialogueOK(self, msg) if msg.bIsComplete == true and msg.missionID == self:GetVar("missionID") then --msg.missionID == self:GetVar("missionID") --set in config data on object in HF print ("turned in mission") local player = msg.responder if (player:GetFlag{iFlagID = 24}.bFlag == true) then return end --set flag to true so we know the player has alread done this player:SetFlag{iFlagID = 24, bFlag = true} end end-------------------------------------------------------------- -- Script for the falling volumes -- updated Brandi... 1/29/10 -------------------------------------------------------------- require('o_mis') local effectPlayed = false function onCollisionPhantom(self, msg) local player = msg.objectID if player:GetID() == GAMEOBJ:GetControlledID():GetID() then --setting a player flag so if a player falls though two+ volumes, the camera only gets set once if effectPlayed == false then self:SendLuaNotificationRequest{requestTarget=player, messageName="Resurrect"} self:SendLuaNotificationRequest{requestTarget=player, messageName="PlayerReady"} effectPlayed = true local config = { {"objectID", msg.objectID:GetID()}, {"leadIn", 0.1}, {"leadOut", 0}, {"lag", 0.1}, {"lockPos", true} } msg.objectID:AddCameraEffect{ effectType = "lookAt", effectID = "lookatFall", configData = config } storeObjectByName(self, "player", player) end end end function notifyResurrect(self, player, msg) effectPlayed = false player:RemoveCameraEffect{ effectID = "lookatFall" } self:SendLuaNotificationCancel{requestTarget=player, messageName="Resurrect"} end function notifyPlayerReady(self, player, msg) effectPlayed = false player:RemoveCameraEffect{ effectID = "lookatFall" } self:SendLuaNotificationCancel{requestTarget=player, messageName="PlayerReady"} end function onShutdown(self) local player = getObjectByName(self, "player") if player then player:RemoveCameraEffect{ effectID = "lookatFall" } end end local skillid = 43 local ProxRadius = 2 local FIRE_COOLDOWN = 2 function onStartup(self) self:SetVar("counter", 0) self:SetProximityRadius{radius = ProxRadius} self:SetVar("isBurning",true) self:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} end function onFireEventServerSide(self, msg) if msg.args == 'physicsReady' then self:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} end end function onProximityUpdate(self, msg) if self:GetVar("isBurning") then if msg.status == "ENTER" then local target = msg.objId local faction = target:GetFaction() if faction.faction == 1 then local counter = self:GetVar("counter") counter = counter + 1 self:SetVar("counter", counter) if counter == 1 then self:CastSkill{skillID = skillid } msg.objId:UpdateMissionTask{taskType = "complete", value = 440, value2 = 1, target = self} GAMEOBJ:GetTimer():AddTimerWithCancel(FIRE_COOLDOWN, "TimeBetweenCast", self ) --print "Set the timer" end -- end if counter == 1 end -- end if faction = 1 else local counter = self:GetVar("counter") if counter > 0 then counter = counter - 1 self:SetVar("counter", counter) if counter == 0 then -- cancelling the timer GAMEOBJ:GetTimer():CancelAllTimers( self ) end end end -- end if msg.status == "ENTER" end end function onSkillEventFired( self, msg ) if msg.wsHandle == "waterspray" then if self:GetVar("isBurning") then self:StopFXEffect{ name = "Burn" } --obj:PlayFXEffect{ name = "Off", effectID = 295, effectType = "end"} -- could be a transitional effect self:PlayFXEffect{ name = "Off", effectID = 295, effectType = "idle"} GAMEOBJ:GetTimer():AddTimerWithCancel( 37, "FireRestart", self ) self:SetVar("isBurning",false) player = msg.casterID end end end -- turns fire on/off based on burn variable, needs: obj = LWOOBJID, burn = bool function onTimerDone(self, msg) if (msg.name == "TimeBetweenCast") then GAMEOBJ:GetTimer():AddTimerWithCancel(FIRE_COOLDOWN, "TimeBetweenCast", self ) self:CastSkill{skillID = skillid} end if msg.name == "FireRestart" then if not self:GetVar("isBurning") then self:SetVar("isBurning",true) self:StopFXEffect{ name = "Off" } self:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} end end end require('o_mis') local gemsShot = 0 local firstShooter = "" local target = "" --local bouncer1Obj = "" local bouncer2Obj = "" local bouncer3Obj = "" local bouncer4Obj = "" function onStartup(self, msg) -- bouncer1Obj = self:GetObjectsInGroup{ group = "TikiBouncer01" }.objects bouncer2Obj = self:GetObjectsInGroup{ group = "TikiBouncer02" }.objects bouncer3Obj = self:GetObjectsInGroup{ group = "TikiBouncer03" }.objects bouncer4Obj = self:GetObjectsInGroup{ group = "TikiBouncer04" }.objects end function onFireEvent( self, msg ) local var = split(msg.args, ',') print (var[1]) print (var[2]) if ( msg.args ) then if self:GetVar("GemShot") == nil then if ( gemsShot == 0 ) then --print( bouncer1Obj[1]) print("*****triggered fireEvent path movement **************") GAMEOBJ:GetTimer():AddTimerWithCancel( 50 , "GemTimer", self ) firstShooter = var[2] playersBounce( self, msg ) end gemsShot = gemsShot + 1 print("****************"..gemsShot.."*****************") if ( gemsShot >= 4 ) then playersBounce( self, msg ) gemsShot = 0 GAMEOBJ:GetTimer():CancelTimer("GemTimer", self); end end end end function playersBounce (self, msg) local bouncerObj = {} if ( firstShooter == "G1" ) then bouncerObj = self:GetObjectsInGroup{ group = "TikiBouncer01", ignoreSpawner = true}.objects idString = bouncerObj[1]:GetLOT().objtemplate print(idString) elseif ( firstShooter == "G2" ) then target = bouncer2Obj elseif ( firstShooter == "G3" ) then target = bouncer3Obj elseif ( firstShooter == "G4" ) then target = bouncer4Obj end print("************ BouncerPlayers in order "..firstShooter.." first ****************") --bouncerObj[1]:BouncerActiveStatus{bActive = true} --self:BouncerTriggered{triggerObj = idString} --GAMEOBJ:DeleteObject( bouncerObj[1] ) self:BouncePlayer{ ObjIDBouncer = bouncerObj[1] } end function BouncePlayers( self ) local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then --print ( "------------------------------------------------------------------" ) --print ( "hazmat bouncer BouncePlayers: found a player on the bouncepad" ) --print ( "------------------------------------------------------------------" ) self:BouncerTriggered{triggerObj = target} end index = index + 1 end end function onTimerDone(self, msg) if msg.name == "GemTimer" then if ( gemsShot >= 4 ) then print("************* 4 Gems Shot ************") playersBounce( self, msg ) end gemsShot = 0 end end--Created: 6/7/09 bla, borrowed heavily from QA_MESSAGEBOX -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided if self:GetVar("triggered") ~= true then --print ("You entered") self:SetVar("triggered", true) --LEVEL:ActivateSpawner("Ambush") local ambushSpawner = LEVEL:GetSpawnerByName("Ambush") if ambushSpawner then ambushSpawner:SpawnerActivate() end GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "TriggeredTimer", self ) end end --[[ OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) -- Says we have finished colliding tries to resetBox() --LEVEL:DeactivateSpawner("Ambush") print ("Exiting") end ]]-- function onTimerDone(self, msg) if msg.name == "TriggeredTimer" then --print ("timer done") self:SetVar("triggered", false) --LEVEL:ResetSpawner("Ambush") local ambushSpawner = LEVEL:GetSpawnerByName("Ambush") if ambushSpawner then ambushSpawner:SpawnerReset() end end end function onMessageBoxRespond(self,msg) --print("identifier == "..msg.identifier ) if msg.iButton == 1 and msg.identifier == "PlaySG" then msg.sender:TransferToZone{ zoneID = 1302, ucInstanceType = 1 } --instance type single end end function onFireEventServerSide(self, msg) --print('onFireEventServerSide ' .. msg.args .. ' ' .. msg.senderID:GetName().name .. ' ' .. msg.param1) if msg.args == "TransferToInstance" then msg.senderID:TransferToZone{ zoneID = msg.param1, ucInstanceType = 1 } --instance type single end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 180 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 200 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 180 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 200 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = true Set['aggroFOV'] = 300 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 4 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- if not self:GetVar("attached_path") then ProximityPuls(self) end self:OverrideFriction{bEnableOverride = true, fFriction = 40} end function onGetActivityPoints(self, msg) msg.points = 100 return msg end function onDie(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Strombie", param1 = 100, ObjIDSender = msg.killerID} end -------------------------------------------------------------------------------------------------------- -- Server-side script for Concert Props Choice Builds. Each prop can be built into 1 of 4 types. -- If all 4 are built into the same thing, the Stage transforms, and 30 seconds later they all return to their "default" state (the object's render component) -- Based on scripts\ai\YRK\L_TB_BENCH.lua -- 5023 AG - Stage Rocket OLD 4029 AG Fog Machine Choice Build -- 4891 AG - Stage Spot Light OLD 4030 AG Spotlight Choice Build -- 5024 AG - Stage laser OLD 4031 AG Laser Light Choice Build -- 4858 AG - Speaker OLD 4032 AG Speaker Choice Build --HF waypoints used to spawn in choice builds --Concert_Prop_1 --Concert_Prop_2 --Concert_Prop_3 --Concert_Prop_4 --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('c_GnarledForest') --[[ -- All the lot nums for the prop choicebuilds LOT_NUMS = {} LOT_NUMS[1] = { CONSTANTS["LOT_CHOICEBUILD_SMALL"], CONSTANTS["LOT_CHOICEBUILD_MEDIUM"], CONSTANTS["LOT_CHOICEBUILD_LARGE"] } function onStartup(self) end function onTripleBuildSelect(self, msg) local canswap = 0 -- Make sure we are allowed to spawn the piece they are requesting for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(LOT_NUMS[i][a] == msg.lotnum) then canswap = 1 -- how do you break out of a loop in lua? end end end if(canswap == 0) then print("CANT SWAP") return end local mypos = self:GetPosition().pos local myRot = self:GetRotation() --print (self:GetID()) self:GetParentObj().objIDParent:NotifyObject{ObjIDSender=self, name="ChoicebuildChanged", param1=msg.lotnum} RESMGR:LoadObject { objectTemplate = msg.lotnum, x= mypos.x, y= mypos.y , z= mypos.z, owner = self:GetParentObj().objIDParent, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } GAMEOBJ:DeleteObject(self) --take imagination from the player msg.user:SetImagination{imagination = msg.user:GetImagination{}.imagination - 1} end ]]-- function onNotifyObject(self, msg) if ( msg.name == "CorrectTimer" ) then GAMEOBJ:GetTimer():CancelTimer("RightTikiTimer", self) GAMEOBJ:GetTimer():AddTimerWithCancel(30, "RightTikiTimer", self ) elseif ( msg.name == "RampTimer" ) then GAMEOBJ:GetTimer():CancelTimer("RightTikiTimer", self) GAMEOBJ:GetTimer():AddTimerWithCancel(45, "TikiPuzzle", self ) end end function resetEverything(self) local CHOICEBUILDS = self:GetObjectsInGroup{ group = 'TikiHeads', ignoreSpawners = true}.objects if CHOICEBUILDS ~= nil then for k,v in ipairs(CHOICEBUILDS) do v:Die() --print(v) end end --LEVEL:DestroySpawnerObjects("Ramp") --LEVEL:ResetSpawner("Ramp") local rampSpawner = LEVEL:GetSpawnerByName("Ramp") if rampSpawner then rampSpawner:SpawnerDestroyObjects() rampSpawner:SpawnerReset() end local group = self:GetObjectsInGroup{ group = 'CBGroup', ignoreSpawners = true }.objects for i = 1, #group do -- test each object in table group to see if GetVar('TikiSet') is true, if so add 1 to tikiTest if group[i]:GetVar('TikiSet') then group[i]:SetVar('TikiSet', false) end end end function onTimerDone(self, msg) if msg.name == "TikiPuzzle" then GAMEOBJ:GetTimer():CancelTimer("RightTikiTimer", self) print ("puzzle timer done") resetEverything(self) elseif msg.name == "RightTikiTimer" then print ("right timer done") resetEverything(self) end end -- Plays a sparkle FX when anything touches this phantom physics object function onCollisionPhantom(self, msg) local target = msg.objectID target:PlayFXEffect{effectID = 3671 , effectType = "cast" } end ---------------------------------------------------------- --Script by Steve Y -- 6/23/10 --plays a cinematic when the player enters a volume ---------------------------------------------------------- function onCollisionPhantom(self, msg) local player = msg.objectID if (player:GetFlag { iFlagID = 112 }.bFlag == false) then player:SetFlag { iFlagID = 112, bFlag = true } player:PlayCinematic { pathName = "IntroCam_3" } end end------------------------------------------------------------------------ --Script by Steve Y -- 6/23/10 --Sets the player flag 112 for the LS intro cinematic on the player to false when the player leaves ------------------------------------------------------------------------ function onUse(self, msg) local player = msg.user player:SetFlag { iFlagID = 112, bFlag = false } player:TransferToZone {zoneID = 1200, pos_x = -330, pos_y = 288, pos_z = 210, rot_x = 145} end-------------------------------------------------------------- -- Activity manager: Including this file gives the basic setup -- and managment of an activity. -- mrb... 9/26/09 -------------------------------------------------------------- function SurvivalStartup() local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] --print('registering Lua Notification') GAMEOBJ:GetZoneControlID():SendLuaNotificationRequest{requestTarget=mgr, messageName="ActivityTimerDone"} GAMEOBJ:GetZoneControlID():SendLuaNotificationRequest{requestTarget=mgr, messageName="ActivityTimerUpdate"} end ---------------------------------------------------------------- -- Sets up an activity of the object, only need to put in variable you want to change ---------------------------------------------------------------- function SetupActivity(nMaxUsers) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] -- set max users to something high mgr:SetActivityParams{ modifyMaxUsers = true, maxUsers = nMaxUsers, modifyActivityActive = true, activityActive = true} GAMEOBJ:GetZoneControlID():SendLuaNotificationRequest{requestTarget=mgr, messageName="DoCalculateActivityRating"} end ---------------------------------------------------------------- -- Returns true/false if a player is in the activity -- takes mgr and a PLAYER object ---------------------------------------------------------------- function IsPlayerInActivity(player) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] -- check if player is in activity local existMsg = mgr:ActivityUserExists{ userID = player } if (existMsg) then return existMsg.bExists end return false end ---------------------------------------------------------------- -- Updates players for the activity: addPlayer defaults to true ---------------------------------------------------------------- function UpdatePlayer(player, removePlayer) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] -- Response to Exit activity dialog and user pressed OK if removePlayer and IsPlayerInActivity(player) then -- remove the user mgr:RemoveActivityUser{ userID = player } elseif not removePlayer and not IsPlayerInActivity(player) then -- add the new user mgr:AddActivityUser{ userID = player } -- start the activity for the new user StartActivity(player, 0) end end ---------------------------------------------------------------- -- Stores the start time for the player in the activity and -- sends messages to start it ---------------------------------------------------------------- function StartActivity(player, scoreVar) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] mgr:SetActivityUserData{ userID = player, typeIndex = 0, value = tonumber(scoreVar) } end ---------------------------------------------------------------- -- adds the valueVar to the existing value of the index for the -- player in the activity ---------------------------------------------------------------- function UpdateActivityValue(player, valueIndex, valueVar) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] local newValue = mgr:GetActivityUserData{ userID = player, typeIndex = valueIndex}.outValue + valueVar --print(newValue) mgr:SetActivityUserData{ userID = player, typeIndex = valueIndex, value = newValue } end ---------------------------------------------------------------- -- Stores a vaariable for the player in the activity ---------------------------------------------------------------- function SetActivityValue(player, valueIndex, valueVar) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] mgr:SetActivityUserData{ userID = player, typeIndex = valueIndex, value = tonumber(valueVar) } end ---------------------------------------------------------------- -- Gets the value of the activity index for the player ---------------------------------------------------------------- function GetActivityValue(player, valueIndex) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] return mgr:GetActivityUserData{ userID = player, typeIndex = valueIndex}.outValue end ---------------------------------------------------------------- -- StopActivity message ---------------------------------------------------------------- function StopActivity(player, scoreVar, value1Var, value2Var, quit ) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] --GAMEOBJ:GetZoneControlID():SendLuaNotificationCancel{requestTarget=mgr, messageName="ActivityTimerDone"} --GAMEOBJ:GetZoneControlID():SendLuaNotificationCancel{requestTarget=mgr, messageName="ActivityTimerUpdate"} -- user is trying to cancel if quit then -- remove the user from activity mgr:RemoveActivityUser{ userID = player } else -- store the time as activity rating [1] mgr:SetActivityUserData{ userID = player, typeIndex = 0, value = scoreVar } if value1Var ~= nil then mgr:SetActivityUserData{ userID = player, typeIndex = 1, value = value1Var } elseif value2Var ~= nil then mgr:SetActivityUserData{ userID = player, typeIndex = 2, value = value2Var } end -- distribute rewards mgr:DistributeActivityRewards{ userID = player, bAutoAddCurrency = true, bAutoAddItems = true } -- Update Leaderboards for this user mgr:UpdateActivityLeaderboard{ userID = player } -- get the leaderboard data for the user and update summary screen if it exists mgr:RequestActivitySummaryLeaderboardData{ user = player, queryType = 7 } -- remove the user from activity mgr:RemoveActivityUser{ userID = player } end end ---------------------------------------------------------------- -- GetLeaderboard Data message ---------------------------------------------------------------- function GetLeaderboardData( self, player, activityID ) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] -- get the leaderboard data for the user and update summary screen if it exists mgr:RequestActivitySummaryLeaderboardData{ user = player, target = self, queryType = 7, gameID = activityID } end ---------------------------------------------------------------- -- Start activity timer ---------------------------------------------------------------- function ActivityTimerStart(timerName, updateTime, stopTime) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] if stopTime then mgr:ActivityTimerSet{name = timerName, updateInterval = updateTime, duration = stopTime} else mgr:ActivityTimerSet{name = timerName, updateInterval = updateTime} end end ---------------------------------------------------------------- -- Reset an activity timer ---------------------------------------------------------------- function ActivityTimerReset(timerName) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] mgr:ActivityTimerReset{name = timerName} end ---------------------------------------------------------------- -- Stop activity timer ---------------------------------------------------------------- function ActivityTimerStop(timerName) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] --print('** stop activity timer ' .. timerName .. ' now **') mgr:ActivityTimerStop{name = timerName} end ---------------------------------------------------------------- -- Stop activity timer ---------------------------------------------------------------- function ActivityTimerStopAllTimers() local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] mgr:ActivityTimerStopAllTimers() end ---------------------------------------------------------------- -- Add time to activity timer ---------------------------------------------------------------- function ActivityTimerAddTime(timerName, addTime) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] mgr:ActivityTimerModify{naem = timerName, timeToAdd = addTime} end ---------------------------------------------------------------- -- Get remaining activity timer time ---------------------------------------------------------------- function ActivityTimerGetRemainingTime(timerName) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] local timerInfo = mgr:ActivityTimerGet{name = timerName} return timerInfo.timeRemaining end ---------------------------------------------------------------- -- Get remaining activity timer time ---------------------------------------------------------------- function ActivityTimerGetCurrentTime(timerName) local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] local timerInfo = mgr:ActivityTimerGet{name = timerName} return timerInfo.timeElapsed end require('o_mis') require('client/ai/NP/L_NP_NPC') -------------------------------------------------------------- -- Description: -- -- Client script for PvP Lobby. -- Lets client know the object can be interacted with -- -------------------------------------------------------------- CONSTANTS = {} CONSTANTS["PVP_BASE"] = { x = -266.0, y = 200.0, z = 270.0 } local inLobby = false -------------------------------------------------------------- -- Handle this message to override pick type -------------------------------------------------------------- function onStartup(self) AddInteraction(self, "interactionAnim", "greet") end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) local strText = "Enter PvP Lobby?" -- show a dialog box local args = { {"bShow", true}, {"imageID", 2}, {"callbackClient", self}, {"text", strText}, {"strIdentifier", "PvP_Start"} } UI:SendMessage("DisplayMessageBox", args) end function onMessageBoxRespond(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- User wants to start PvP map, send him to team platform if (msg.iButton == 1 and msg.identifier == "PvP_Start") then self:FireEventServerSide{ senderID = msg.sender, args = 'add_Player' } player:SetUserCtrlCompPause{ bPaused = true } inLobby = true end -- User wants to exit PvP map if (msg.iButton == 1 and msg.identifier == "WaitState") then self:FireEventServerSide{ senderID = msg.sender, args = 'remove_Player' } player:Teleport{ pos = CONSTANTS["PVP_BASE"], bSetRotation = true } player:SetUserCtrlCompPause{ bPaused = false } inLobby = false end end function onNotifyClientZoneObject(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.name == "UpdateWaitStateBox" then --player:DisplayChatBubble{ wsText = msg.paramStr } local args = { {"bShow", inLobby}, {"imageID", 0}, {"callbackClient", self}, {"text", msg.paramStr}, {"strIdentifier", "WaitState"} } UI:SendMessage("DisplayMessageBox", args) end if msg.name == "CloseWaitStateBox" then local args = { {"bShow", false}, {"imageID", 0}, {"callbackClient", self}, {"text", msg.paramStr}, {"strIdentifier", "WaitState"} } UI:SendMessage("DisplayMessageBox", args) end if msg.name == "Update_Timer" then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", inLobby }, {"itime", SecondsToClock( msg.param1 ) } }) end if msg.name == "Kill_Timer" then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }}) player:SetUserCtrlCompPause{ bPaused = false } end end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end -------------------------------------------------------------- -- Server side Script on the Binoculars -- updates the achievement -- -- updated Brandi... 2/2/10 -- updated Brandi... 3/17/10 -------------------------------------------------------------- -- setting all the achievement id variables based on the map number local mission = {misID1000 = 488, --SPACESHIP misID1100 = 489, --AG misID1200 = 511, --NS misID1201 = 510, --PR misID1300 = 420, --GF misID1400 = 695} --FV function onUse(self, msg) local map = LEVEL:GetCurrentZoneID() local player = msg.user --grab the achievement id from the top of the script local achieve = mission["misID"..map] local AchievementState = player:GetMissionState{ missionID = achieve }.missionState if (AchievementState < 4) then --if the player hasnt gotten the binocular achievement yet local number = self:GetVar('number') local newmap =string.sub(map,0,2) if number then local flagNumber = tonumber(newmap..number) --check to see if the player has used this binocular before, if so skip the rest if (player:GetFlag{iFlagID = flagNumber}.bFlag == true) then return end --set flag to true so we know the player has alread done this, turn off the effect player:SetFlag{iFlagID = flagNumber, bFlag = true} self:FireEventClientSide{ args = 'achieve', rerouteID = player } --player:UpdateMissionTask{taskType = "complete", value = achieve, value2 = 1, target = self} end end end require('o_mis') function onStartup(self) -- print("New Rocket Launch Server") self:SetVar("nPlayers",0) self:SetVar("currentPlayer",nil) end function onFireEventServerSide(self, msg) local targetZone = self:GetVar("targetZone") local targetScene = self:GetVar("targetScene") if targetScene == nil then targetScene = "" end local gmlevel = self:GetVar("GMLevel") if gmlevel == nil then gmlevel = 0 end -- print ("FireServerEvent " .. msg.args .. " target " .. targetZone .. ":" .. targetScene .. " " .. gmlevel .. "sender " .. msg.senderID:GetID() ) if msg.args == "ClearLauncher" then GAMEOBJ:GetTimer():CancelTimer("LaunchTimedOut",self) self:SetVar("nPlayers",0) self:SetVar("currentPlayer",nil) end if (msg.args == "ZonePlayer") then if msg.senderID:GetGMLevel{}.ucGMLevel >= gmlevel then msg.senderID:TransferToZone{ zoneID = self:GetVar("targetZone"), spawnPoint = self:GetVar("targetScene"), bCheckTransferAllowed = true } end end end function onCheckUseRequirements(self,msg) -- print ("CheckUseRequirements for the Rocket Launch") local player = msg.objIDUser local item = msg.objIDObjectForUse local itemlot = msg.itemLOT msg.bCanUse = true local nPlayers = self:GetVar("nPlayers") if nPlayers>0 then local player=getObjectByName(self,"currentPlayer") if player ~= nil and player:Exists() then msg.bCanUse = false return msg else nPlayers = 0 self:SetVar("currentPlayer",nil) end end local assemblyComponent = 61 local rocketAssemblyID = 1 local itemid = player:GetComponentData { objLOT=itemlot, componentType=assemblyComponent }.componentID if itemid ~= rocketAssemblyID then player:DisplayTooltip { bShow = true, strText = "You can only drop rockets on the launchpad. Drop your rocket from your Model tab.", iTime = 5000 } msg.bCanUse=false end return msg end function onUseItemOn(self,msg) print ("ObjUseItemOn for the Rocket Launch") local player = msg.serverPlayerID local rocket = msg.itemToUse -- print ("NRLS player " .. player:GetID() .. " rocket " .. rocket:GetID() ) self:SetVar("nPlayers",1) storeObjectByName(self,"currentPlayer",player) storeObjectByName(self,"rocket",rocket) self:FireEventClientSide{senderID = player, args = "RocketEquipped" , object = rocket } GAMEOBJ:GetTimer():AddTimerWithCancel( 90, "LaunchTimedOut",self ) end function onCheckWithinBounds(self,msg) -- print ("BoundsCheck for the Rocket Launch") local nPlayers = self:GetVar("nPlayers") if nPlayers>0 then local player=getObjectByName(self,"currentPlayer") if player ~= nil and player:Exists() then msg.bInBounds = false return msg else nPlayers = 0 self:SetVar("currentPlayer",nil) end end local rocket = msg.requestingObj local player = rocket:GetItemOwner().ownerID -- print ("Rocket " .. rocket:GetID() .. " player " .. player:GetID() ) local selfpos = self:GetPosition{}.pos local playerpos = msg.point local distance2 = (selfpos.x-playerpos.x)*(selfpos.x-playerpos.x) + (selfpos.z-playerpos.z)*(selfpos.z-playerpos.z) if distance2 > 100 then msg.bInBounds = false return msg end self:SetVar("nPlayers",1) msg.bInBounds = true storeObjectByName(self,"currentPlayer",player) self:FireEventClientSide{senderID = player, args = "RocketEquipped" , object = rocket } GAMEOBJ:GetTimer():AddTimerWithCancel( 90, "LaunchTimedOut",self ) return msg end -- the LaunchTimedOut is a hack. If, for whatever reason, the launch -- sequence doesn't complete as it ought, this will clear the server -- script and allow the next person to launch function onTimerDone (self,msg) if (msg.name == "LaunchTimedOut") then self:SetVar("nPlayers",0) self:SetVar("currentPlayer",nil) end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- use native code AI? Set['SuspendLuaAI'] = true -- a state suspending scripted AI --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] Set['SuspendLuaMovementAI'] = true -- suspends lua control of movement --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end --[[ -- Advanced Functions and Events tied to the template function onTemplateChangeWaypoints(self, msg) -- called on an object when the waypoint event for Changing Waypoints happens -- return true to halt process in the AI system end function onTemplateProximityUpdate (self, msg) end function onTemplateTimerDone (self, msg ) end function onTemplateHit (self, msg ) end function onTemplateDie (self, msg ) end function onTemplateLeftTetherRadius ( self, msg ) end function onTemplateCustomStateEnter(self, msg) end function onTemplateCustomStateArrived(self, msg) end --]] ------------------------------------------------------------- -- Deactivate spawner networks when kill switch is activated -- Updated 3/26 Darren McKinsey ------------------------------------------------------------- local spawnerNames = {"strombieA","strombieB","strombieC","strombieD","mechA","mechB","spiderA","spiderB","spiderC"} local timerTick = 0 function onStartup(self) --print("startup") end function onObjectActivated(self, msg) --print("object activated") -- self:ActivityTimerSet{ name = "ticks", duration = 10, updateInterval = 1 } GAMEOBJ:GetTimer():AddTimerWithCancel( .5 , "ticks", self ) end function onTimerDone(self, msg) --print("got update") if msg.name == "ticks" then --print("ticks") timerTick = timerTick + 1 local i = timerTick local spawnerName = spawnerNames[i] local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then --print("got spawner") spawner:SpawnerDestroyObjects{bDieSilent = false} spawner:SpawnerDeactivate() end if timerTick <= #spawnerNames then GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "ticks", self ) end end end -- for i,spawnerName in ipairs (spawnerNames) do -- local spawner = LEVEL:GetSpawnerByName(spawnerName) -- if spawner then -- spawner:SpawnerDestroyObjects{bDieSilent = false} -- spawner:SpawnerDeactivate() -- end -- end-- require('o_mis') --------------------------------------------------------- Radar Dish Rebuild Effects Updated 3/15 Darren McKinsey --------------------------------------------------------- -- CONSTANTS = {} -- CONSTANTS["NO_OBJECT"] = "0" -- function onStartup(self) -- print("play maelstrom effect") -- local wallFX = self:GetObjectsInGroup{ group = "wallEffect_01" ,ignoreSpawners = true }.objects -- for i = 1, #wallFX do -- DoObjectAction(wallFX[i], "effect", "beam") -- end --self:PlayFXEffect{name = "maelstromcloud", effectType = "create", effectID = 1153} --stopeffects DoObjectAction(wallFX[i], "stopeffects", "beam") -- end ----------------------------------------------------------- -- Checks Mission Status to start Air Strike -- Updated 3/22 Darren McKinsey ----------------------------------------------------------- -- function onStartup(self) -- math.randomseed( os.time() ) -- end function onMissionDialogueOK(self,msg) print("called mission giver") if (msg.bIsComplete == true) then print('Bomb Now') end end -- function onUse(self, msg) -- if self:GetLOT().objtemplate == 6859 and not self:GetVar('isInUse') then --print('pass sever') -- local obj = self:GetObjectsInGroup{ group = "Jet_FX", ignoreSpawners = true }.objects[1] -- self:NotifyClientObject{name = 'toggleInUse', param1 = 1} -- self:SetVar('isInUse', true) -- obj:PlayAnimation{ animationID = "jetFX" } -- self:PlayFXEffect{name = "radarDish", effectType = "create", effectID = 641} -- GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "radarDish", self ) -- GAMEOBJ:GetTimer():AddTimerWithCancel( 2.5, "PlayEffect", self ) -- GAMEOBJ:GetTimer():AddTimerWithCancel( LEVEL:GetCinematicInfo( "Jet_Cam_01" )+5, "CineDone", self ) -- end -- end -- function onRebuildComplete(self, msg) -- if self:GetLOT().objtemplate == 6209 then -- local obj = self:GetObjectsInGroup{ group = "Jet_FX", ignoreSpawners = true }.objects[1] -- obj:PlayAnimation{ animationID = "jetFX" } -- end -- end -- function onTimerDone (self,msg) -- if (msg.name == "radarDish") then -- self:StopFXEffect{name = msg.name} -- elseif (msg.name == "PlayEffect") then --group name = mortarMain -- local obj = self:GetObjectsInGroup{ group = "mortarMain", ignoreSpawners = true }.objects -- local test = math.random(1,#obj) --print(test) -- if test > 0 then -- obj[test]:CastSkill{ skillID = 318 } -- end -- elseif (msg.name == "CineDone") then -- self:NotifyClientObject{name = 'toggleInUse', param1 = -1} -- self:SetVar('isInUse', false) -- end -- end ----------------------------------------------------------- -- Physics volume script, knocks player back. Can be turned off with other object scripts -- Updated 3/15 Darren McKinsey ----------------------------------------------------------- function onStartup(self) self:SetVar("Active", true) end function onCollisionPhantom(self, msg) print("Collision") -- Gets the target id that has collided if msg.objectID then if self:GetVar("Active") == true then local dir = self:GetObjectDirectionVectors().forward -- push-back effect 1378 -- PlayFXEffect msg.objectID:PlayFXEffect{name = "pushBack", effectID = 1378, effectType = "create"}--effectID = 1378, effectType = "push-back"} msg.objectID:PlayAnimation{ animationID = "knockback-recovery" } dir.y = dir.y + 25 dir.x = dir.x * 25 dir.z = dir.z * 25 msg.objectID:Knockback { vector = dir } end end end ----------------------------------------------------------- -- Radar Dish Rebuild Effects -- Updated 3/15 Darren McKinsey ----------------------------------------------------------- --self:SetRebuildState{iState = 0} function onRebuildComplete(self,msg) print("called rebuild") self:PlayFXEffect{name = "radarDish", effectType = "create", effectID = 641} end ------------------------------------------------------------- -- Deactivate spawner networks when kill switch is activated -- Updated 3/26 Darren McKinsey ------------------------------------------------------------- -- table of spawner networks -- local spawnerNames = {"strombieA","strombieB","strombieC","strombieD","mechA","mechB","spiderA","spiderB","spiderC"} --,"wallEffect_03"} -- msg sent from switch in level -- function onFireEvent(self, msg) -- print("Switch On!!!!") -- for i,spawnerName in ipairs (spawnerNames) do -- local spawner = LEVEL:GetSpawnerByName(spawnerName) -- if spawner then -- spawner:SpawnerDestroyObjects{bDieSilent = false} -- spawner:SpawnerDeactivate() -- end -- end -- end ----------------------------------------------------------- -- Manage local mission, reset mission on death || Manage spawners, and reset them on death -- Updated 4/5 Darren McKinsey ----------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" local spawnerNames = {"spider_01","spider_02","spider_03","spider_04","smallCrates_01","smallCrates_02","mediumCrate_01"} local missionNum = 808 local missionGiver = "missionGiver" -- if the player loads in and the mission has not been completed then reset the mission function onPlayerLoaded(self, msg) player = msg.playerID if player then self:SetVar("player", msg.playerID:GetID()) if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end end -- request notification when player accepts mission local object = self:GetObjectsInGroup{group = missionGiver, ignoreSpawners = true}.objects[1] if object then self:SendLuaNotificationRequest{requestTarget = object, messageName = "MissionDialogueOK" } end end -- reset spawners if the player kills a couple of mobs then accepts mission (otherwise they will not be able to complete the mission function notifyMissionDialogueOK(self,other,msg) if (msg.iMissionState <= 2) then for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerActivate{} spawner:SpawnerReset{} end end end end -- remove current mobs and reset spawners if the player dies function onPlayerDied(self, msg) for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerDestroyObjects{bDieSilent = true} spawner:SpawnerActivate{} spawner:SpawnerReset{} end end -- reset the players mission if the player has the mission and dies if msg.playerID:GetID() == self:GetVar("player") then local hasMission = player:GetHasMission{iMissionID = missionNum}.bHasMission if hasMission == true then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} player:AddMission{missionID = missionNum} end end end end -- if player exits map without completing mission the mission is reset (removed) function onPlayerExit(self, msg) local player = msg.playerID if player then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end end end ----------------------------------------------------------- -- Manage local mission, reset mission on death || Manage spawners, and reset them on death -- Updated 4/13 Darren McKinsey ----------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" local spawnerNames = {"stromling_01","stromling_02","stromling_03","stromling_04","picnic_01","hedgehog_01","barrier_01"} local missionNum = 810 local missionGiver = "missionGiver" -- if the player loads in and the mission has not been completed then reset the mission function onPlayerLoaded(self, msg) player = msg.playerID if player then self:SetVar("player", msg.playerID:GetID()) if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end end -- request notification when player accepts mission local object = self:GetObjectsInGroup{group = missionGiver, ignoreSpawners = true}.objects[1] if object then self:SendLuaNotificationRequest{requestTarget = object, messageName = "MissionDialogueOK" } end end -- reset spawners if the player kills a couple of mobs then accepts mission (otherwise they will not be able to complete the mission) function notifyMissionDialogueOK(self,other,msg) if (msg.iMissionState <= 2) then for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerActivate{} spawner:SpawnerReset{} end end end end -- remove current mobs and reset spawners if the player dies function onPlayerDied(self, msg) for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerDestroyObjects{bDieSilent = true} spawner:SpawnerActivate{} spawner:SpawnerReset{} end end -- reset the players mission if the player has the mission and dies if msg.playerID:GetID() == self:GetVar("player") then local hasMission = player:GetHasMission{iMissionID = missionNum}.bHasMission if hasMission == true then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} player:AddMission{missionID = missionNum} end end end end -- if player exits map without completing mission the mission is reset (removed) function onPlayerExit(self, msg) local player = msg.playerID if player then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end end end ----------------------------------------------------------- -- Deactivate spawner areas if all mobs in area have been killed -- Updated 3/24 Darren McKinsey ----------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" --the amount of mobs allowed before shutting off the area local mobTarget = 0 -- the table of wall effects local wallGroupNames = {"wallEffectA","wallEffectB"} --,"wallEffectC"} -- the table of spawnernetworks local spawnerNamesA = {"strombieA","mechA"} --,"wallEffect_03"} local spawnerNamesB = {"strombieB","mechB"} --,"wallEffect_03"} local spawnerGroups = {spawnerNamesA,spawnerNamesB} local groupA = 1 local groupB = 1 --local missionState = player:GetMissionState{missionID = 785}.missionState function onPlayerReady(self, msg) --print("startup") -- set spawners to be notified when something dies that they spawned for i,spawnerGroup in ipairs (spawnerGroups) do for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then self:SendLuaNotificationRequest{requestTarget = spawner, messageName = "NotifySpawnerOfDeath"} end end end -- turn on wall effects for i,groupName in ipairs (wallGroupNames) do local wallFX = self:GetObjectsInGroup{ group = groupName ,ignoreSpawners = true }.objects if wallFX then for i = 1, #wallFX do DoObjectAction(wallFX[i], "effect", "beam") end end end end -- When death notified the all spawn networks are checked for having no mobs on them, if the set of networks has zero mobs the corresponding area is opened up. function notifyNotifySpawnerOfDeath(self, other, msg) -- add currently spawned mobs from each network in group print("mob death") for i,spawnerGroup in ipairs (spawnerGroups) do currentSpawned = 0 for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) mobs = spawner:SpawnerGetCurrentSpawned().iSpawned currentSpawned = currentSpawned + mobs end -- print(currentSpawned) for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then if currentSpawned == mobTarget then ------------------------------------- -- Section for each Spawner Group -- ------------------------------------- if spawnerGroup == spawnerNamesA and groupA == 1 then --print("turn off groupA") groupA = 0 -- shut off spawner networks for i,spawnerName in ipairs (spawnerGroup) do local spawnerOFF = LEVEL:GetSpawnerByName(spawnerName) spawnerOFF:SpawnerDeactivate() end -- shut off physics local object = self:GetObjectsInGroup{group = "physics_01", ignoreSpawners = true}.objects[1] if object then object:SetVar("Active", false) end -- shut off maelstrom effects local wallFX = self:GetObjectsInGroup{ group = "wallEffectA" ,ignoreSpawners = true }.objects if wallFX then for i = 1, #wallFX do DoObjectAction(wallFX[i], "stopeffects", "beam") end end end ------------------------------------- ------------------------------------- -- Section for each Spawner Group -- ------------------------------------- if spawnerGroup == spawnerNamesB and groupB == 1 then --print("turn off groupB") groupB = 0 -- shut off spawner networks for i,spawnerName in ipairs (spawnerGroup) do local spawnerOFF = LEVEL:GetSpawnerByName(spawnerName) spawnerOFF:SpawnerDeactivate() end -- shut off physics local object = self:GetObjectsInGroup{group = "physics_02", ignoreSpawners = true}.objects[1] if object then object:SetVar("Active", false) end -- shut off maelstrom effects local wallFX = self:GetObjectsInGroup{ group = "wallEffectB" ,ignoreSpawners = true }.objects if wallFX then for i = 1, #wallFX do DoObjectAction(wallFX[i], "stopeffects", "beam") end end end end end end end end require('o_mis') local missionGiver = "missiongiver" -- the table of spawnernetworks local spawnerNames1 = {"SpawnPath001","1"} local spawnerNames2 = {"SpawnPath002","2"} local spawnerNames3 = {"SpawnPath003","3"} local spawnerNames4 = {"SpawnPath004","4"} local spawnerGroups = {spawnerNames1,spawnerNames2,spawnerNames3,spawnerNames4} local mobsKilled = 0 ---------------------------------------------------------------------------- -- On Player Load Check for Battle Mission if True then Reset Mission ---------------------------------------------------------------------------- function onPlayerLoaded(self, msg) player = msg.playerID if player then storeObjectByName(self, "PLAYER", player) self:SetVar("player", msg.playerID:GetID() ) if player:GetMissionState{missionID = 805}.missionState <= 4 then player:ResetMissions{missionID = 805} end -- if player is dead Resurrect if player:IsDead{}.bDead then player:Resurrect() end -- request notification when player accepts mission local object = self:GetObjectsInGroup{group = missionGiver, ignoreSpawners = true}.objects[1] if object then self:SendLuaNotificationRequest{requestTarget = object, messageName = "MissionDialogueOK" } end end end ---------------------------------------------------------------------------- -- On Player Die Reset Battle Mission + Reset Stage ---------------------------------------------------------------------------- function onPlayerDied(self, msg) if msg.playerID:GetName().name == self:GetVar("player") then local hasMission = player:GetHasMission{iMissionID = 805}.bHasMission ResetBattle(self) if hasMission then if player:GetMissionState{missionID = 805}.missionState <= 10 then player:ResetMissions{missionID = 805} end end end end ---------------------------------------------------------------------------- -- On Player Exit Reset Battle Mission ---------------------------------------------------------------------------- function onPlayerExit(self, msg) local player = msg.playerID if player then player:CancelMission{missionID = 805} end end ---------------------------------------------------------------------------- -- Set NotifySpawnerOfDeath msg ---------------------------------------------------------------------------- function onPlayerReady(self, msg) -- set spawners to be notified when something dies that they spawned for i,spawnerGroup in ipairs (spawnerGroups) do for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then self:SendLuaNotificationRequest{requestTarget = spawner, messageName = "NotifySpawnerOfDeath"} end end end end ---------------------------------------------------------------------------- -- ON NotifySpawnerOfDeath msg ---------------------------------------------------------------------------- function notifyNotifySpawnerOfDeath(self, other, msg) mobsKilled = mobsKilled + 1 if mobsKilled >= 40 then for i,spawnerGroup in ipairs (spawnerGroups) do for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerDestroyObjects{bDieSilent = true} spawner:SpawnerDeactivate() end end end end end ---------------------------------------------------------------------------- -- ON Dialogue OK Button Press ---------------------------------------------------------------------------- function notifyMissionDialogueOK(self,msg) local player = getObjectByName(self, "PLAYER") local State = player:GetMissionState{missionID = 805}.missionState if State == 1 or State == 9 then -- Deactivate Spawners for i,spawnerGroup in ipairs (spawnerGroups) do for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerDestroyObjects{bDieSilent = true} spawner:SpawnerDeactivate() end end end elseif State == 2 or State == 10 then -- Activate Spawners for i,spawnerGroup in ipairs (spawnerGroups) do for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerActivate() spawner:SpawnerReset() end end end mobsKilled = 0 end end ---------------------------------------------------------------------------- -- Reset Network Spawners ---------------------------------------------------------------------------- function ResetBattle(self) for i,spawnerGroup in ipairs (spawnerGroups) do for i,spawnerName in ipairs (spawnerGroup) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerActivate() spawner:SpawnerReset() end end end end ----------------------------------------------------------- -- Manage local mission, reset mission on death || Manage spawners, and reset them on death -- Updated 4/12 Darren McKinsey ----------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" local spawnerNames = {"ronin_01","ronin_02","ronin_03","ronin_04",} local missionNum = 811 local missionGiver = "missionGiver" -- if the player loads in and the mission has not been completed then reset the mission function onPlayerLoaded(self, msg) player = msg.playerID if player then self:SetVar("player", msg.playerID:GetID()) self:SendLuaNotificationRequest{ requestTarget = player, messageName = "NotifyMission" } if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end end -- request notification when player accepts mission local object = self:GetObjectsInGroup{group = missionGiver, ignoreSpawners = true}.objects[1] if object then self:SendLuaNotificationRequest{requestTarget = object, messageName = "MissionDialogueOK" } end end -- if player completes mission task destroy statues function notifyNotifyMission(self,other,msg) -- print("notify mission state") -- print(msg.missionState) if (msg.missionID == missionNum) and (msg.missionState >= 4) then print("Mission State 4") for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerDeactivate{} spawner:SpawnerDestroyObjects{bDieSilent = false} end end -- ronin = self:GetObjectsInGroup{group = RoninEnemies, ignoreSpawners = true}.objects -- ronin:RequestDie{killType = SILENT} end end -- reset spawners if the player kills a couple of mobs then accepts mission (otherwise they will not be able to complete the mission function notifyMissionDialogueOK(self,other,msg) if (msg.iMissionState <= 2) then for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerActivate{} spawner:SpawnerReset{} end end end end -- remove current mobs and reset spawners if the player dies function onPlayerDied(self, msg) for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerDestroyObjects{bDieSilent = true} spawner:SpawnerActivate{} spawner:SpawnerReset{} end end -- reset the players mission if the player has the mission and dies if msg.playerID:GetID() == self:GetVar("player") then local hasMission = player:GetHasMission{iMissionID = missionNum}.bHasMission if hasMission == true then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} player:AddMission{missionID = missionNum} end end end end -- if player exits map without completing mission the mission is reset (removed) function onPlayerExit(self, msg) local player = msg.playerID if player then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end self:SendLuaNotificationCancel{ requestTarget = player, messageName = "NotifyMission" } end end ----------------------------------------------------------- -- Manage local mission, reset mission on death || Manage spawners, and reset them on death -- Updated 4/5 Darren McKinsey ----------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" local spawnerNames = {"pirates_01","pirates_02","pirates_03","pirates_04","chestSmall_01","chestSmall_02","chestLarge_01","barrel_01"} local missionNum = 785 local missionGiver = "missionGiver" -- if the player loads in and the mission has not been completed then reset the mission function onPlayerLoaded(self, msg) player = msg.playerID if player then self:SetVar("player", msg.playerID:GetID()) if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end end -- request notification when player accepts mission local object = self:GetObjectsInGroup{group = missionGiver, ignoreSpawners = true}.objects[1] if object then self:SendLuaNotificationRequest{requestTarget = object, messageName = "MissionDialogueOK" } end end -- reset spawners if the player kills a couple of mobs then accepts mission (otherwise they will not be able to complete the mission function notifyMissionDialogueOK(self,other,msg) if (msg.iMissionState <= 2) then for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerActivate{} spawner:SpawnerReset{} end end end end -- remove current mobs and reset spawners if the player dies function onPlayerDied(self, msg) for i,spawnerName in ipairs (spawnerNames) do local spawner = LEVEL:GetSpawnerByName(spawnerName) if spawner then spawner:SpawnerDestroyObjects{bDieSilent = true} spawner:SpawnerActivate{} spawner:SpawnerReset{} end end -- reset the players mission if the player has the mission and dies if msg.playerID:GetID() == self:GetVar("player") then local hasMission = player:GetHasMission{iMissionID = missionNum}.bHasMission if hasMission == true then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} player:AddMission{missionID = missionNum} end end end end -- if player exits map without completing mission the mission is reset (removed) function onPlayerExit(self, msg) local player = msg.playerID if player then if player:GetMissionState{missionID = missionNum}.missionState <= 4 then player:ResetMissions{missionID = missionNum} end end end -------------------------------------------------------------- -- Description: Server side script for verifying racing -- instancing information. Add this script to a minigame instancer -- to add drag to interact and double click functionality. -- -- Updated 4/26/10 mrb... added proximity and onCheckWithinBounds -------------------------------------------------------------- function onStartup(self) -- set up a proximity monitor based on the HF interaction distance self:SetProximityRadius{radius = self:GetVar("interaction_distance"), name = "Interaction_Distance"} end function onMatchGetDataForPlayer(self, msg) msg.bOK = false --Verify that the activityID the player is requesting matches my activity ID and the player dragged an item if msg.playerChoices.droppedItem == nil or self:GetActivityID().activityID ~= msg.activityID then return end local modObj = GAMEOBJ:GetObjectByID(msg.playerChoices.droppedItem) -- Check the players inventory for the item and fail if not if not modObj or msg.player:GetInvItemCount{iObjID=modObj}.itemCount < 1 or modObj:GetLOT().objtemplate ~= 8092 then return end -- Save this out now for the destination map msg.finalValues.droppedItem = msg.playerChoices.droppedItem -- Approve of the player selections msg.bOK = true -- Calculate the players point worth msg.points = 1 return msg end function onCheckWithinBounds(self, msg) --print('onCheckWithinBounds ' .. msg.requestingObj:GetItemOwner().ownerID:GetName().name .. ' --> ' .. msg.requestingObj:GetName().name) local playerID = msg.requestingObj:GetItemOwner().ownerID:GetID() -- loop through the objects in proximity and see if the player requesting the double click is there for k,v in ipairs(self:GetProximityObjects{name = "Interaction_Distance"}.objects) do if v:GetID() == playerID then self:SetNetworkVar("bPassedCheck", {playerID, msg.requestingObj:GetID()}) msg.altMessage = "Loading Race with selected Car." break end end return msg end ------------------------------------------------------ --Spider Egg script ------------------------------------------------------ local interactRadius = 15 local hatchTime = 2.0 function onStartup(self) self:SetVar("hatching", false) self:SetProximityRadius { radius = interactRadius } end function onProximityUpdate(self, msg) local isHuman = msg.objId:IsCharacter().isChar if (msg.status == "ENTER") and (isHuman) and self:GetVar("hatching") == false then --print("Look out!") self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} self:CastSkill{skillID = 305} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) end end function onOnHit(self, msg) --print("egg hit!") if self:GetVar("hatching") == false then self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) if msg.attacker:GetLOT().objtemplate ~= 6598 then self:CastSkill{skillID = 305} end end end function onTimerDone(self, msg) --print("timer done!") self:PlayFXEffect{name = "egg_puff_b", effectID = 644, effectType = "create"} local pos = self:GetPosition().pos self:Die() RESMGR:LoadObject { objectTemplate = 6444 , x = pos.x , y = pos.y , z = pos.z , owner = self } end function onNotifyObject(self,msg) if msg.name == "hatch" and self:GetVar("hatching") == false then self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} self:CastSkill{skillID = 305} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) end end function onDie(self,msg) if msg.killerID ~= self then GAMEOBJ:GetZoneControlID():NotifyObject{name = "EggDestroyed" ,ObjIDSender = msg.killerID} end end -- Timed zone script for battle instancerequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) self:AddObjectToGroup{group = "SpiderDen"} Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then --print("*******AI ENABLED*******") self:SetFaction{faction = 106} setState("AiEnable",self) ProximityPuls(self) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) then object:NotifyObject{name = "killMe", ObjIDSender = self} end end end end function onDie(self, msg) print("turret down!") local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) then object:NotifyObject{name = "dontShoot", ObjIDSender = self} end end end--L_ACT_PLAYER_DEATH_TRIGGER.lua -- instantly kills players when they touch anything with this script on it require('o_mis') -------------------------------------------------------------- -- onCollisionPhantom -------------------------------------------------------------- function onCollisionPhantom (self,msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 or faction and faction.faction == 100 or faction and faction.faction == 101 and target:IsDead().bDead == false then local FlagFound = removeflags(self, target) -- Return red flag if GAMEOBJ:GetZoneControlID():MiniGameGetTeam{ playerID = target}.teamID == 1 then if FlagFound then local redFlag = GAMEOBJ:GetObjectByID(GAMEOBJ:GetZoneControlID():GetVar("Red_Flag_1")) local redpos = redFlag:GetPosition().pos GAMEOBJ:GetZoneControlID():SetVar("Con.Red_Flag_Home", true) RESMGR:LoadObject { objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlagOBJ") , x= redpos.x, y= redpos.y , z= redpos.z, owner = self } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = target:GetName().name.."Killed him self, Red Flag Returned!!" } end end -- Return blue flag if GAMEOBJ:GetZoneControlID():MiniGameGetTeam{ playerID = target}.teamID == 2 then local FlagFound = removeflags(self, target) if FlagFound then local blueFlag = GAMEOBJ:GetObjectByID(GAMEOBJ:GetZoneControlID():GetVar("Blue_Flag_1")) local bluepos = blueFlag:GetPosition().pos GAMEOBJ:GetZoneControlID():SetVar("Con.Blue_Flag_Home", true) RESMGR:LoadObject { objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlagOBJ") , x= bluepos.x, y= bluepos.y , z= bluepos.z} GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = target:GetName().name.."Killed him self, Blue Flag Returned!!" } end end target:Die{killerID = self} end end function removeflags(self, player) for i =0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate == GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlag_LootOBJ") then local item = player:GetInventoryItemInSlot{slot = 1 }.itemID player:GetInventoryItemInSlot{slot = i }.itemID:UnEquipItem{bImmediate = true} player:RemoveItemFromInventory{ iObjTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlag_LootOBJ") } return true end end end for i =0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate == GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlag_LootOBJ") then local item = player:GetInventoryItemInSlot{slot = 1 }.itemID player:GetInventoryItemInSlot{slot = i }.itemID:UnEquipItem{bImmediate = true} player:RemoveItemFromInventory{ iObjTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlag_LootOBJ") } return true end end end endrequire('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Blue_Flag", ObjIDSender = self } endrequire('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Blue_Mark", ObjIDSender = self } end require('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Blue_Point", ObjIDSender = self } endrequire('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Blue_Spawn", ObjIDSender = self } endfunction onStartup(self) if GAMEOBJ:GetZoneControlID():GetVar("isMinigame") == nil or GAMEOBJ:GetZoneControlID():GetVar("isMinigameStarted") == false then player = self:GetItemOwner{}.ownerID end end require('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Red_Flag", ObjIDSender = self } endrequire('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Red_Mark", ObjIDSender = self } endrequire('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Red_Point", ObjIDSender = self } endrequire('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Red_Spawn", ObjIDSender = self } end function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="Blue_Spawn", paramObj = self } end function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="Blue_Spawn", paramObj = self } end -------------------------------------------------------------- -- Death trigger that will spawn and object while the player is -- dying. Change the Custom Variables to fit your needs. -- mrb... 5/21/09 -------------------------------------------------------------- -- Custom Variables -------------------------------------------------------------- local deathAnimation = "shark-death" -- Animation to play on the player when it dies local deathObject = 6268 -- Object to spawn when the player dies local deathObjectOffset = {x=0,y=0,z=0} -- Offset to apply when spawning the deathObject local deathObjectAnimation = "idle" -- name of the animation playing on the deathObject -------------------------------------------------------------- -- onCollision -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("collision!") local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and target:IsDead().bDead == false and faction.faction == 1 or faction.faction == 100 or faction.faction == 101 then SpawnDeathObject(self, target) end return msg end -------------------------------------------------------------- -- SpawnDeathObject kills the player using the deathAnimation, -- and spawns in the deathObject. -------------------------------------------------------------- function SpawnDeathObject(self, target) --print("******* Kill Player *******") target:Die{killerID = self, deathType = deathAnimation} -- get the position and rotation of the player local oPos = {pos = target:GetPosition().pos} oPos.rot = target:GetRotation() --print("******* Spawn Death Object *******") local config = { {"no_timed_spawn", true}, {"groupID", "DeathObject"} } RESMGR:LoadObject{ objectTemplate = deathObject, x= oPos.pos.x + deathObjectOffset.x, y= oPos.pos.y + deathObjectOffset.y, z= oPos.pos.z + deathObjectOffset.z, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = self, configData = config} end -------------------------------------------------------------- -- onChildLoaded start a timer to remove the deathObject based -- on it's deathObjectAnimation time. -------------------------------------------------------------- function onChildLoaded( self, msg ) local animTime = msg.childID:GetAnimationTime{animationID = deathObjectAnimation} GAMEOBJ:GetTimer():AddTimerWithCancel(animTime.time, "RemoveDeathObject", self ) end -------------------------------------------------------------- -- timers... -------------------------------------------------------------- function onTimerDone(self, msg) if msg.name == "RemoveDeathObject" then --print('******* Remove the Death Object *******') local deathObj = self:GetObjectsInGroup{ group = "DeathObject" }.objects for k,v in ipairs(deathObj) do GAMEOBJ:DeleteObject(v) end end end require('o_mis') function onCollisionPhantom (self,msg) local player = msg.objectID if ( player:GetFaction().faction == 101 ) then local item = player:GetEquippedItemType{ slot = "hair" }.lotID -- Check to see if my flag is here if item == GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlag_LootOBJ") and GAMEOBJ:GetZoneControlID():GetVar("Con.Blue_Flag_Home") then for i =0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate == GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlag_LootOBJ") then local item = player:GetInventoryItemInSlot{slot = i }.itemID player:GetInventoryItemInSlot{slot = i }.itemID:UnEquipItem{bImmediate = true} player:RemoveItemFromInventory{ iObjTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlag_LootOBJ") } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = player:GetName().name.." Captured The Red Flag!!" } local team = GAMEOBJ:GetZoneControlID():MiniGameGetTeam{playerID = player}.teamID GAMEOBJ:GetZoneControlID():MiniGameAddTeamScore{teamID = team, scoreType = 0, score = 1 } GAMEOBJ:GetZoneControlID():MiniGameAddPlayerScore{playerID = player, scoreType = 2, score = 1 } -- Cap Score GAMEOBJ:GetZoneControlID():MiniGameAddPlayerScore{playerID = player, scoreType = 4, score = GAMEOBJ:GetZoneControlID():GetVar("Set.CTF_CAPTS") } -- Cap Points GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToclient_bubble" , paramStr = "+"..GAMEOBJ:GetZoneControlID():GetVar("Set.CTF_CAPTS").." ("..GAMEOBJ:GetZoneControlID():MiniGameGetPlayerScore{playerID= player, scoreType= 4}.score..")" ,paramObj = player } -- send to Client bubble txt GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "CaptedFlag", self ) end end end end end end function onStartup(self, msg) end function onTimerDone(self, msg) if msg.name == "CaptedFlag" then local team_1 = GAMEOBJ:GetZoneControlID():MiniGameGetTeamScore{teamID = 1, scoreType = 0 }.score local team_2 = GAMEOBJ:GetZoneControlID():MiniGameGetTeamScore{teamID = 2, scoreType = 0 }.score GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Blue Team Score! ("..team_1..") Red Team Score! ("..team_2..")" } if team_1 == GAMEOBJ:GetZoneControlID():GetVar("Set.Score_To_Complete") then GAMEOBJ:GetZoneControlID():MiniGameSetTeamScore{teamID = 1, scoreType = 0, score = 0 } GAMEOBJ:GetZoneControlID():MiniGameSetTeamScore{teamID = 2, scoreType = 0, score = 0 } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Blue Team Won the Match!!" } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="FreezAllPlayers" ,param1 = GAMEOBJ:GetZoneControlID():GetVar("Set.Number_Of_Teams")} GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "MatchWon", self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "CaptedFlag2", self ) end end if msg.name == "CaptedFlag2" then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Reseting Red Flag in 5 Seconds!" } GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "CaptedFlag3", self ) end if msg.name == "CaptedFlag3" then GAMEOBJ:GetZoneControlID():SetVar("Con.Red_Flag_Home", true) local redFlag = getObjectByName( GAMEOBJ:GetZoneControlID(), "Red_Flag_1") local redpos = redFlag:GetPosition().pos RESMGR:LoadObject { objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlagOBJ") , x= redpos.x, y= redpos.y , z= redpos.z, owner = GAMEOBJ:GetZoneControlID() } end if msg.name == "MatchWon" then GAMEOBJ:GetZoneControlID():SetVar("Con.Red_Flag_Home", true) local redFlag = getObjectByName( GAMEOBJ:GetZoneControlID(), "Red_Flag_1") local redpos = redFlag:GetPosition().pos RESMGR:LoadObject { objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.RedFlagOBJ") , x= redpos.x, y= redpos.y , z= redpos.z, owner = GAMEOBJ:GetZoneControlID() } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Starting Match in 15 Seconds!" } GAMEOBJ:GetTimer():AddTimerWithCancel( 15 , "restart", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "showpoints", self ) end if msg.name == "restart" then GAMEOBJ:GetZoneControlID():NotifyObject{name = "reStartCTF" } end if msg.name == "showpoints" then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_points" } end end require('o_mis') function onCollisionPhantom (self,msg) local player = msg.objectID if ( player:GetFaction().faction == 100 ) then local item = player:GetEquippedItemType{ slot = "hair" }.lotID -- Check to see if my flag is here if item == GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlag_LootOBJ") and GAMEOBJ:GetZoneControlID():GetVar("Con.Red_Flag_Home") then for i =0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate == GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlag_LootOBJ") then local item = player:GetInventoryItemInSlot{slot = i }.itemID player:GetInventoryItemInSlot{slot = i }.itemID:UnEquipItem{bImmediate = true} player:RemoveItemFromInventory{ iObjTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlag_LootOBJ") } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = player:GetName().name.." Captured The Blue Flag!!" } local team = GAMEOBJ:GetZoneControlID():MiniGameGetTeam{playerID = player}.teamID GAMEOBJ:GetZoneControlID():MiniGameAddTeamScore{teamID = team, scoreType = 0, score = 1 } GAMEOBJ:GetZoneControlID():MiniGameAddPlayerScore{playerID = player, scoreType = 2, score = 1 } -- Cap Score GAMEOBJ:GetZoneControlID():MiniGameAddPlayerScore{playerID = player, scoreType = 4, score = GAMEOBJ:GetZoneControlID():GetVar("Set.CTF_CAPTS") } -- Cap Points GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToclient_bubble" , paramStr = "+"..GAMEOBJ:GetZoneControlID():GetVar("Set.CTF_CAPTS").." ("..GAMEOBJ:GetZoneControlID():MiniGameGetPlayerScore{playerID = player, scoreType= 4}.score..")" ,paramObj = player} -- send to Client bubble txt GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "CaptedFlag", self ) end end end end end end function onStartup(self, msg) end function onTimerDone(self, msg) if msg.name == "CaptedFlag" then local team_1 = GAMEOBJ:GetZoneControlID():MiniGameGetTeamScore{teamID = 1, scoreType = 0 }.score local team_2 = GAMEOBJ:GetZoneControlID():MiniGameGetTeamScore{teamID = 2, scoreType = 0 }.score GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Blue Team Score! ("..team_1..") Red Team Score! ("..team_2..")" } if team_2 == GAMEOBJ:GetZoneControlID():GetVar("Set.Score_To_Complete") then GAMEOBJ:GetZoneControlID():MiniGameSetTeamScore{teamID = 1, scoreType = 0, score = 0 } GAMEOBJ:GetZoneControlID():MiniGameSetTeamScore{teamID = 2, scoreType = 0, score = 0 } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Red Team Won the Match!!" } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="FreezAllPlayers" ,param1 = GAMEOBJ:GetZoneControlID():GetVar("Set.Number_Of_Teams") } GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "MatchWon", self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "CaptedFlag2", self ) end end if msg.name == "CaptedFlag2" then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Reseting Blue Flag in 5 Seconds!" } GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "CaptedFlag3", self ) end if msg.name == "CaptedFlag3" then GAMEOBJ:GetZoneControlID():SetVar("Con.Blue_Flag_Home", true) local redFlag = getObjectByName( GAMEOBJ:GetZoneControlID(), "Blue_Flag_1") local redpos = redFlag:GetPosition().pos RESMGR:LoadObject { objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlagOBJ") , x= redpos.x, y= redpos.y , z= redpos.z, owner = GAMEOBJ:GetZoneControlID() } end if msg.name == "MatchWon" then GAMEOBJ:GetZoneControlID():SetVar("Con.Blue_Flag_Home", true) local redFlag = getObjectByName( GAMEOBJ:GetZoneControlID(), "Blue_Flag_1") local redpos = redFlag:GetPosition().pos RESMGR:LoadObject { objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.BlueFlagOBJ") , x= redpos.x, y= redpos.y , z= redpos.z, owner = GAMEOBJ:GetZoneControlID() } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Starting Match in 15 Seconds!" } GAMEOBJ:GetTimer():AddTimerWithCancel( 15 , "restart", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "showpoints", self ) end if msg.name == "restart" then GAMEOBJ:GetZoneControlID():NotifyObject{name = "reStartCTF" } end if msg.name == "showpoints" then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "sendToAllclients_points" } end end require('o_mis') function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Yellow_Spawn", ObjIDSender = self } end ----------------------------------------------------------------- --tells the fuse platform to light up and start moving towards it's destination ----------------------------------------------------------------- function onDie(self, msg) --telling the fuse to start local object = self:GetObjectsInGroup{group = "Fuse", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 16, bAllowPathingDirectionChange = false} object:PlayFXEffect{name = "firebrick", effectID = 270, effectType = "create"} object:PlayFXEffect{name = "bigboomsupercharge", effectID = 580, effectType = "create"} end local object = self:GetObjectsInGroup{group = "MaelstromWall2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = false} end --initiating all the spawner networks local spawnerObj = LEVEL:GetSpawnerByName("Final_Apes_1") if spawnerObj then spawnerObj:SpawnerActivate() spawnerObj:SpawnerReset() end local spawnerObj = LEVEL:GetSpawnerByName("Final_Captains_1") if spawnerObj then spawnerObj:SpawnerActivate() spawnerObj:SpawnerReset() end local spawnerObj = LEVEL:GetSpawnerByName("Final_Pirates_1") if spawnerObj then spawnerObj:SpawnerActivate() spawnerObj:SpawnerReset() end end----------------------------------------------------------------- --script telling the fuse/platform to blow up the barrel when it reaches the final waypoint ----------------------------------------------------------------- function onArrived(self, msg) ----------------------------------------------------------------- --testing to see if on the last waypoint ----------------------------------------------------------------- if msg.wayPoint == 16 then ----------------------------------------------------------------- --killing the wall inside the log ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "MaelstromWall", ignoreSpawners = true}.objects[1] if object then --object:PlayFXEffect{name = "bigboomsupercharge", effectID = 580, effectType = "create"} object:Die() end local object = self:GetObjectsInGroup{group = "MaelstromEye", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "bigboomsupercharge", effectID = 580, effectType = "create"} object:PlayFXEffect{name = "explosion", effectID = 1034, effectType = "cast"} object:PlayFXEffect{name = "smoke", effectID = 2856, effectType = "fire"} end ----------------------------------------------------------------- --playing the cannon fire effect ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "CannonFire", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "cannonbig", effectID = 71, effectType = "onfire_large"} end ----------------------------------------------------------------- --deactivating the spawner networks ----------------------------------------------------------------- local spawnerObj = LEVEL:GetSpawnerByName("Final_Apes_1") if spawnerObj then spawnerObj:SpawnerDeactivate() spawnerObj:SpawnerDestroyObjects{bDieSilent = false} end local spawnerObj = LEVEL:GetSpawnerByName("Final_Captains_1") if spawnerObj then spawnerObj:SpawnerDeactivate() spawnerObj:SpawnerDestroyObjects{bDieSilent = false} end local spawnerObj = LEVEL:GetSpawnerByName("Final_Pirates_1") if spawnerObj then spawnerObj:SpawnerDeactivate() spawnerObj:SpawnerDestroyObjects{bDieSilent = false} end self:StopFXEffect{name = "firebrick"} end endfunction onStartup(self) self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true } end ------------------------------------------------------------------------ --Pirate Side Scroller Zone Script ------------------------------------------------------------------------ function onMessageBoxRespond(self, msg) local player = msg.sender if(msg.iButton == 1 and msg.identifier == "ActivityButton") then player:DisplayMessageBox{bShow = true, imageID = 1, callbackClient = self, text = "Do you want to return to Gnarled Forest?" , identifier = "Exit"} elseif(msg.iButton == 1 and msg.identifier == "Exit") then player:TransferToLastNonInstance() end end----------------------------------------------------------------------- --script to change the camera when the player enters a volume in the first spider encounter area ----------------------------------------------------------------------- function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then --local playerAsID = GAMEOBJ:GetLocalCharID() --local player = GAMEOBJ:GetObjectByID(playerAsID) CAMERA:ActivateCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetRenderCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetCameraLookAtPoint("CAMERA_SIDE_SCROLLER", 0, -0.3, 1) CAMERA:SetCameraZoom("CAMERA_SIDE_SCROLLER", 50) end end----------------------------------------------------------------------- --script to change the camera when the player enters a volume in the first spider encounter area ----------------------------------------------------------------------- function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then --local playerAsID = GAMEOBJ:GetLocalCharID() --local player = GAMEOBJ:GetObjectByID(playerAsID) CAMERA:ActivateCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetRenderCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetCameraLookAtPoint("CAMERA_SIDE_SCROLLER", 0, -0.3, 1) CAMERA:SetCameraZoom("CAMERA_SIDE_SCROLLER", 50) UI:SendMessage("GameStateChanged", {{"user",tostring(playerID) }} ) UI:SendMessage("ToggleActivityCloseButton", {{"Toggle",true}}) end end-- ================================================ -- L_ACT_CANNON.lua -- Client Side -- updated 5/7/10 mrb... - refactored next best -- ================================================ require('o_mis') -- global vars ------------------------------- local tMedals = { {name = Localize("Missions_102_name"), score = 50000}, -- 102; High Scoring Pirate 1 {name = Localize("Missions_338_name"), score = 125000}, -- 339; High Scoring Pirate 2 {name = Localize("Missions_339_name"), score = 250000}, -- 339; High Scoring Pirate 3 {name = Localize("Missions_340_name"), score = 500000}, } -- 340; High Scoring Pirate local audioVars = { Intro = "GF_SG_Intro", GameOver = "GF_SG_Game-Over", Core = "GF_SG_Core", SuperCharge = "GF_SG_Super-Cannon", ChestOpening = "{7e264cc1-5524-4f79-8c70-00df13756f1b}", } function StartLuaNotify(self) self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="StartModelVisualization"} end function StopLuaNotify(self) self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="StartModelVisualization"} end function onStartup(self) -- Load client side parameters Here self:SetColor{ iLEGOColorID = 0 } self:SetVar("OverRideScore", true) self:SetVar("FoundFriendGuild", false) myTotalScore = 0 self:SetVar("mySCORE", 0) self:SetVar("Started", false) self:SetVar("Time", 1) GAMEOBJ:GetZoneControlID():NotifyClientObject{ name ="storeCannonClient" , paramObj = self} StartLuaNotify(self) end function onScriptNetworkVarUpdate(self,msg) for k,v in pairs(msg.tableOfVars) do --print ("k: " .. tostring(k)) --print ("v: " ..tostring(v)) if k == "initialskill" then self:SetVar("CBSkill", v) elseif k == "currentScore" then self:SetVar("mySCORE", v) elseif k == "count" then self:SetVar("Time", v) self:SetVar("Started", true) self:SetVar("TotalTime", v) UI:SendMessage("UpdateSG", { {"sgTimer", tostring(v) } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Count", self ) elseif k == "Stop" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("Started", false) UI:SendMessage("UpdateSG", { {"sgTimer", " " } }) self:SetVar("Time", GAMEOBJ:GetZoneControlID():GetVar("timelimit")) elseif k == "cbskill" then self:SetVar("CBSkill", v) elseif k == "updateScore" then if self:GetVar("HoldingTopScore") then UI:SendMessage( "UpdateSG", {{"opponentScore", tostring(v) }, {"opponentName", msg.paramObj:GetName().name } } ) else self:SetVar("TotalScore", v) UI:SendMessage( "UpdateSG", {{"opponentScore", self:GetVar("NextBest") }, {"opponentName", self:GetVar("NextBestName") }, {"sgScore", v} } ) checkNextHighScore(self, v) end elseif k == "ShowStreak" then UI:SendMessage("UpdateSG", { {"sgStreak", v } ,{"sgHideStreak", false }}) elseif k == "HideStreak" then UI:SendMessage("UpdateSG", {{"sgHideStreak", true }} ) elseif k == "charge_counting" then UI:SendMessage("UpdateSG", { {"scDeCharge", v } } ) elseif k == "mHit" then -- mulit hIt UI:SendMessage("UpdateSG", { {"multiHit", true } } ) elseif k == "cStreak" then -- current Streak UI:SendMessage("UpdateSG", { {"streakCount", v } } ) elseif k == "Mark1" then UI:SendMessage("UpdateSG", { {"sgFeedBack1", true } } ) elseif k == "Mark2" then UI:SendMessage("UpdateSG", { {"sgFeedBack2", true } } ) elseif k == "Mark3" then UI:SendMessage("UpdateSG", { {"sgFeedBack3", true } } ) elseif k == "UnMarkAll" then UI:SendMessage("UpdateSG", { {"sgFeedBackUnMark", true } } ) elseif k == "game_timelimit" then self:SetVar("timelimit", v ) elseif k == "ClientZone_SetNextBest" then self:SetVar("NextBest", v) elseif k == "UI_Score" then -- Update the end score board local var = split(v, "_") UI:SendMessage("ToggleScoreboardinfo", {{"visible", true }} ) UI:SendMessage( "ScoreUI", {{"totalScore", var[1] } , {"waveScore1", var[2] } ,{"waveScore2", var[3] }, {"waveScore3", var[4] },{"numShots", var[5] } ,{"numKills", var[6] } ,{"longestStreak", var[7] }} ) elseif k == "Clear" then UI:SendMessage("UpdateSG", { {"sgHideStreak", true } ,{"sgStreak", "0" }, {"reseting", true } }) UI:SendMessage("ToggleScoreboardinfo", {{"visible", false }} ) elseif k == "wave.waveStr" then UI:SendMessage("ToggleFlashingText", {{"visible", true}, {"text", v}}) elseif k == "wave.waveNum" then UI:SendMessage("UpdateSG", { {"sgWave", tostring(v) } }) elseif k == "showLoadingUI" then UI:SendMessage("ToggleInstanceStart", { {"visible", true } }) GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Intro } elseif k == "Audio_Start_Intro" then local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) UI:SendMessage("Togglesg_scoreboard", { {"visible", true }}) -- audio player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.GameOver } player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Intro } player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Core } elseif k == "Audio_Final_Wave_Done" then local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) UI:SendMessage("Togglesg_scoreboard", { {"visible", false }}) -- audio player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Core } player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.SuperCharge } player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.GameOver } elseif k == "SuperChargeBar" then UI:SendMessage("UpdateSG", { {"scBar", v } } ) local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) if v == 100 then player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.SuperCharge } else player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.SuperCharge } end elseif k == "hitFriend" then -- Hit Friend params.friendlyHit Boolean UI:SendMessage("UpdateSG", { {"friendlyHit", true } } ) elseif k == "HideScoreBoard" then UI:SendMessage("Togglesg_scoreboard", { {"visible", false } }) UI:SendMessage("UpdateSG", { {"sgTimer", " " } }) elseif k == "modelPercent" then UI:SendMessage("UpdateSG", { {"modelPercent", v } } ) elseif k == "rewardAdded" then local rewards = self:GetVar("rewardModels") if rewards then table.insert(rewards, v) else rewards = {v} end self:SetVar("rewardModels", rewards) elseif k == "UI_Rewards" then ----print("Money>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "..var[1]) UI:SendMessage("ToggleScoreboardinfo", {{"visible", true }} ) UI:SendMessage("Togglesg_scoreboard", { {"visible", false }}) UI:SendMessage("ToggleInstanceRewards", {{"visible", true},{"bHasModelDisplay", true} }) UI:SendMessage("ToggleLeaderboard", { {"id", v} } ) self:SetVar("TotalScore", 0 ) end end end function addTimer(self) if self:GetVar("Started") and self:GetVar("Time") then local cTimer = self:GetVar("Time") -1 if cTimer < 0 then GAMEOBJ:GetTimer():CancelAllTimers(self) self:SetVar("Started", false) UI:SendMessage("UpdateSG", { {"sgTimer", " " } }) self:SetVar("Time", GAMEOBJ:GetZoneControlID():GetVar("timelimit")) return end self:SetVar("Time", cTimer) UI:SendMessage("UpdateSG", { {"sgTimer", tostring(cTimer) } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Count", self ) end end function onTimerDone(self,msg) if msg.name =="Count" then addTimer(self) elseif msg.name == "flytimer" then local visObj = getObjectByName(self, "currentDisplayModel") visObj:SetPosition{pos = visObj:GetSubNodePosition{}.pos} visObj:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("bagPosX"), y = self:GetVar("bagPosY")}, effectType = "flytobag", effectID = 595, boxExtents = self:GetVar("bagWidth"), bUseInitialScale = true} visObj:SetVisible{fadeTime = 0.2, visible = false} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.25 , "endTimer", self ) elseif msg.name == "endTimer" then removeFXObject(self) if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) self:SetVar("rewardModels", nil) local test = self:GetVar("rewardModels") for i =1, #test do self:SetVar("rewardModels."..i.."", nil) end end end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] local n = 1 local tableValues = {} for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Score"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("bShowedPlayer", false) self:SetVar("NextBest", false) self:SetVar("NextBestName", false) self:SetVar("LeaderTable", tableValues) setNextHighScore(self, iScore) end end function setNextHighScore(self, iScore) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local name_value = 0 local score_value = 0 local name = 0 local score = 0 local tableValues = self:GetVar("LeaderTable") or {} local curName = self:GetVar("NextBestName") local playerScore = 0 if not curName then curName = player:GetName().name end for testName = 1, #tableValues do if tableValues[testName] == curName then name = testName score = (testName + 1) if name ~= 1 then name_value = (testName - 2) score_value = (testName - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif name_value == 1 then name_value = 1 score_value = 2 end end if tableValues[testName] == player:GetName().name then self:SetVar("FoundPlayer", true ) playerScore = tableValues[(testName + 1)] end end local uiName = tableValues[name] or player:GetName().name local uiScore = tableValues[score] or playerScore local uiNextName = tableValues[name_value] or player:GetName().name local uiNextScore = tableValues[score_value] or playerScore if not self:GetVar("bShowedPlayer") then uiNextName = uiName uiNextScore = uiScore end if not iScore then iScore = 0 end local highestScore = tableValues[2] or 0 if iScore >= math.floor(highestScore) or not self:GetVar("FoundPlayer") then local pass = false for k,v in ipairs(tMedals) do if iScore < v.score then uiNextName = v.name uiNextScore = v.score pass = true break end end if not pass then self:SetVar("HoldingTopScore", true) uiNextName = player:GetName().name uiNextScore = iScore end end UI:SendMessage("UpdateSG", {{"opponentScore", tostring(uiNextScore) }, {"opponentName", tostring(uiNextName) } } ) self:SetVar("NextBest", math.floor(uiNextScore) ) self:SetVar("NextBestName", uiNextName ) self:SetVar("bShowedPlayer", true) --GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name= "ClientZone_SetNextBest", paramStr = tostring(tableValues[score_value]) } end function checkNextHighScore(self, iScore) if not iScore or not self:GetVar('NextBest') then return end if iScore >= self:GetVar('NextBest') then setNextHighScore(self, iScore) end end function onShootingGalleryFire(self, msg) local CBskillID = self:GetVar("CBSkill") self:CastSkill{skillID = CBskillID, lastClickedPosit=msg.targetPos, bUsedMouse=true}--, optionalTargetID = msg.objId} self:PlayFXEffect{effectType = "onfire"} self:PlayFXEffect{effectType = "onfire2"} if getActivityUser(self):Exists() then getActivityUser(self):PlayFXEffect{effectType = "SG-fire"} end end function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end ------------------------------------------------------------------- from client zone script function onShutdown(self, msg) self:SetVar("TotalScore", 0 ) StopLuaNotify(self) UI:SendMessage( "EnableSpeedChat", {} ) UI:SendMessage( "ToggleScoreboardinfo", { {"visible", false } } ) UI:SendMessage( "popGameState", { {"state", "shootinggallery" } } ) end function notifyStartModelVisualization(self, other, msg) self:SetVar("modelVisIndex", 1) self:SetVar("modelPosX", msg.x1) self:SetVar("bagPosX", msg.x2) self:SetVar("modelPosY", msg.y1) self:SetVar("bagPosY", msg.y2) self:SetVar("modelWidth", msg.width1) self:SetVar("bagWidth", msg.width2) local rewards = self:GetVar("rewardModels") if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) end end function onChildRenderComponentReady(self, msg) if self:GetVar("currentDisplayModelLOT") and msg.childLOT == self:GetVar("currentDisplayModelLOT") then msg.childID:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("modelPosX"), y = self:GetVar("modelPosY")}, effectType = "flytoscreen", effectID = 595, boxExtents = self:GetVar("modelWidth")} GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "flytimer", self ) playChestAnimation(self) storeObjectByName(self, "currentDisplayModel", msg.childID) end end function removeFXObject(self) if self:GetVar("currentDisplayModel") ~= "0" then GAMEOBJ:DeleteObject(getObjectByName(self, "currentDisplayModel")) self:SetVar("currentDisplayModel", "0") end end function createNextVisObject(self) local rewards = self:GetVar("rewardModels") if not rewards then return false end local index = self:GetVar("modelVisIndex") if index <= #rewards then local grp = self:GetObjectsInGroup{ignoreSpawners=true,group = "ChestGroup" }.objects for i, obj in pairs(grp) do local pos = obj:GetPosition().pos self:SetVar("currentDisplayModelLOT", rewards[index]) RESMGR:LoadObject{ objectTemplate = rewards[index], x = pos.x, y = pos.y, z = pos.z, owner = self} self:SetVar("modelVisIndex", self:GetVar("modelVisIndex") + 1) end else return false end return true end function playChestAnimation(self) local chestObjects = self:GetObjectsInGroup{group = "ChestGroup", ignoreSpawners = true}.objects if #chestObjects > 0 then for index, chest in pairs(chestObjects) do chest:PlayNDAudioEmitter{m_NDAudioEventGUID = audioVars.ChestOpening} -- play sound for chest opening chest:PlayAnimation{animationID = "open"} end else print("ERROR: Failed to find chest object.") end end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Client side script for GF SG Effects --// - Hides the effect actors --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) -- instant hide of object self:SetVisible { visible = false, fadeTime = 0 } end function onStartup(self) self:SetVar("Started", false) self:SetVar("Time", 1) end function onTimerDone(self,msg) if msg.name =="Count" and self:GetVar("Started") then local cTimer = self:GetVar("Time") -1 self:SetVar("Time", cTimer) UI:SendMessage("ChageUI", { {"sgTimer", tostring(cTimer) } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Count", self ) if cTimer < 0 then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("Started", false) UI:SendMessage("ChageUI", { {"sgTimer", " " } }) self:SetVar("Time", GAMEOBJ:GetZoneControlID():GetVar("timelimit")) end end end function onNotifyClientObject(self, msg) if msg.name == "count" then self:SetVar("Time", GAMEOBJ:GetZoneControlID():GetVar("timelimit")) self:SetVar("Started", true) self:SetVar("TotalTime", msg.parma1) UI:SendMessage("ChageUI", { {"sgTimer", tostring(msg.param1) } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Count", self ) end if msg.name == "Stop" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("Started", false) UI:SendMessage("ChageUI", { {"sgTimer", " " } }) self:SetVar("Time", GAMEOBJ:GetZoneControlID():GetVar("timelimit")) end end require('o_mis') function onStartup(self) self:SetVar("currentModel", -1) self:SetVar("childObject", "0") end function onSetModelToBuild(self, msg) if self:GetVar("currentModel") ~= -1 and msg.templateID ~= -1 then local myPos = self:GetPosition{}.pos local myRot = self:GetRotation{} RESMGR:LoadObject{objectTemplate = self:GetVar("currentModel"), x = myPos.x, y = myPos.y, z = myPos.z, rw = myRot.w, rx = myRot.x, ry = myRot.y, rz = myRot.z, owner = self} end self:SetVar("currentModel", msg.templateID) end function onChildRenderComponentReady(self, msg) removeSlamObject(self) storeObjectByName(self, "childObject", msg.childID) msg.childID:PlayFXEffect{effectType = "slamshake", priority = 0.4, effectID = 595} GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "slamtimer", self ) end function onTimerDone(self, msg) if msg.name == "slamtimer" then getObjectByName(self, "childObject"):PlayFXEffect{ effectType = "flyto", priority = 0.4, effectID = 595} local chestObjects = self:GetObjectsInGroup{group = "ChestGroup", ignoreSpawners = true}.objects if #chestObjects > 0 then for index, chest in pairs(chestObjects) do chest:PlayAnimation{animationID = "open"} end else print("ERROR: Failed to find chest object.") end GAMEOBJ:GetTimer():AddTimerWithCancel( 0.75 , "flytimer", self ) elseif msg.name == "flytimer" then removeSlamObject(self) end end function removeSlamObject(self) if self:GetVar("childObject") ~= "0" then GAMEOBJ:DeleteObject(getObjectByName(self, "childObject")) self:SetVar("childObject", "0") end endrequire('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Generic Rebuild -- Script (CLIENT) --// - The spawned entity that will be breaking a rebuild --/////////////////////////////////////////////////////////////////////////////////////// local effect_interval = 0.25 function onRenderComponentReady(self, msg) -- start a timer that will play the effects GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) end onTimerDone = function(self, msg) -- play the effect if msg.name == "DoEffect" then -- play the wake effect every interval self:PlayFXEffect{effectType = "onmove"} -- start a timer that will play the effects GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) end end local m_totalscore = 0 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) self:SetVar("CONSTANTS", CONSTANTS) self:SetVar("timelimit", waves[1].timeLimit) end -------------------------------------------------------------- -- put the player in the cannon, does not start the cannon -------------------------------------------------------------- function enterCannon(self) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both start it if ((cannon) and (player)) then cannon:RequestActivityEnter{bStart = false, userID = player} end end function freezePlayer(playerID, bFreeze) local eChangeType = "POP" local bVisible = true if bFreeze then eChangeType = "PUSH" bVisible = false end playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function mainPlayerLoaded(self, msg) ----print ("Player Entered: " .. msg.playerID:GetName().name) -- stun and move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not.....ghosting distance? local player = msg.playerID freezePlayer(player, true) player:CancelMission{ missionID = 30 } if (LOCALS["GameStarted"] == false) then -- get the player local player = getObjectByName("activityPlayer") -- store the player for later use if (player == nil) then storeObjectByName("activityPlayer", msg.playerID) end end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function mainObjectLoaded(self, msg) -- Cannon Object Loaded if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then -- store the cannon object for use later storeObjectByName("cannonObject", msg.objectID) if (LOCALS["GameStarted"] == false) then -- try to put hte player in the cannon enterCannon(self) end end end function onActivityStateChangeRequest(self,msg) if (msg.wsStringValue == 'clientready') then -- put the player in the cannon enterCannon(self) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) self:SetVar("TotalScore", 0 ) self:SetVar("rewardModels", {} ) UI:SendMessage( "MinimizeChat", {} ) UI:SendMessage( "DisableSpeedChat", {} ) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) end function onPlayerReady(self) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) self:SetVar("PlayerReady", true) checkEverythingReady(self) end function checkEverythingReady(self) local cannonclient = GAMEOBJ:GetObjectByID(self:GetVar("Cannon_ClientOBJ")) local ready = self:GetVar("PlayerReady") if (cannonclient ~= nil and ready ~= nil and ready == true) then self:ActivityStateChangeRequest{wsStringValue='clientready'} --Notify the server we're ready to enter the activity end end function onNotifyClientObject(self,msg) if msg.name == "storeCannonClient" then self:SetVar("Cannon_ClientOBJ", msg.paramObj) checkEverythingReady(self) end end function onShutdown(self, msg) UI:SendMessage( "EnableSpeedChat", {} ) UI:SendMessage( "popGameState", { {"state", "shootinggallery" } } ) end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') require('ai/MINIGAME/SG_GF/L_GF_SG') -- @TODO: Add Path Changing on waypoint, need to get [Closest Waypoint on New Path] -- Also need [Number of Waypoints on Path] -- @TODO: Optimize -------------------------------------------------------------- -- Locals and Constants CONSTANTS = {} TABLES = {} LOCALS = {} -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS["PLAYER_START_POSx"] = -908.542480 CONSTANTS["PLAYER_START_POSy"] = 229.773178 CONSTANTS["PLAYER_START_POSz"] = -908.542480 CONSTANTS["PLAYER_START_ROTw"] = 0.91913521289825 CONSTANTS["PLAYER_START_ROTx"] = 0 CONSTANTS["PLAYER_START_ROTy"] = 0.39394217729568 CONSTANTS["PLAYER_START_ROTz"] = 0 -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["IMPACT_SKILLID"] = 34 CONSTANTS["PROJECTILE_TEMPLATEID"] = 1822 CONSTANTS["CANNON_PLAYER_OFFSETx"] = 6.652 CONSTANTS["CANNON_PLAYER_OFFSETy"] = 0 CONSTANTS["CANNON_PLAYER_OFFSETz"] = -1.188 CONSTANTS["Reward_Model_Matrix"] = 157 CONSTANTS["CANNON_VELOCITY"] = 129.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 CONSTANTS["CANNON_BARREL_OFFSETx"] = 0 CONSTANTS["CANNON_BARREL_OFFSETy"] = 4.3 CONSTANTS["CANNON_BARREL_OFFSETz"] = 9 CONSTANTS["CANNON_SUPER_CHARGE"] = 6297 CONSTANTS["CANNON_PROJECTILE"] = 1822 CONSTANTS["CANNON_SUPERCHARGE_SKILL"] = 249 CONSTANTS["CANNON_SKILL"] = 228 CONSTANTS["CANNON_TIMEOUT"] = -1 CONSTANTS["CANNON_FOV"] = 58.6 CONSTANTS["CANNON_USE_LEADERBOARDS"] = true CONSTANTS["STREAK_MOD"] = 2 -- for Animations TABLES["VALID_ACTORS"] = {3109, 3110, 3111, 3112, 3125, 3126} TABLES["STREAK_BONUS"] = {1,2,5,10} TABLES["VALID_EFFECTS"] = {3122} -- Super Charger is charged for this amount of time CONSTANTS["ChargedTime"] = 10 -- The amount of points needed to supper charge CONSTANTS["ChargedPoints"] = 25000 -- Modle reward grp name CONSTANTS["Reward_Model_GrpName"] = "QBRewardGroup" -- Activity ID CONSTANTS["ActivityID"] = 1864 -- Activity ID -- Reward Score and Loot Matrix\ -- 1 CONSTANTS["Score_Reward_1"] = 50000 CONSTANTS["Score_LootMatrix_1"] = 157 -- 2 CONSTANTS["Score_Reward_2"] = 100000 CONSTANTS["Score_LootMatrix_2"] = 187 -- 3 CONSTANTS["Score_Reward_3"] = 200000 CONSTANTS["Score_LootMatrix_3"] = 188 -- 4 CONSTANTS["Score_Reward_4"] = 400000 CONSTANTS["Score_LootMatrix_4"] = 189 -- 5 CONSTANTS["Score_Reward_5"] = 800000 CONSTANTS["Score_LootMatrix_5"] = 190 -------------------------------------------------------------- -- Wave Data waves = {} PLAYER_SCORE = {} -------------------------------------------------------------- -- Syntax: [Time] [Text to Show Player] -------------------------------------------------------------- AddWave(waves, 30.0, "Wave;One" ) AddWave(waves, 30.0, "Wave;Two" ) AddWave(waves, 30.0, "Wave;Three" ) -- wave constants CONSTANTS["NUM_WAVES"] = #waves CONSTANTS["FIRST_WAVE_START_TIME"] = 4.0 CONSTANTS["IN_BETWEEN_WAVE_PAUSE"] = 7.0 -------------------------------------------------------------- -- Spawn Data spawns = {} SPAWN_DATA = {} -------------------------------------------------------------- -- Startup do not chaged!!! -------------------------------------------------------------- function onStartup(self) targetSettings(self) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 --self:SetVar("StreakBonus",0) self:SetVar("StopCharge", false ) self:SetVar("NumberOfCharges", 0 ) wave1Score = 0 wave2Score = 0 wave3Score = 0 self:SetVar("WaveStatus", true) --self:SetVar("StreakBonus", 0) self:SetVar("CONSTANTS", CONSTANTS) self:SetVar("timelimit", waves[1].timeLimit) totalscore = 0 --setCONSTANTS(self, spawns, SPAWN_DATA, CONSTANTS, waves, PLAYER_SCORE, EFFECTS, ACTORS, LOCALS ) end -------------------------------------------------------------- -- target Settings -------------------------------------------------------------- function targetSettings(self) -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- AddSpawn - configures data for the spawn and adds it. Can -- only have one. -- Syntax: AddSpawn(spawn, paths, [Template ID], -- [Initial Spawn Time Min], [Initial Spawn Time Max], [Does Respawn], -- [Respawn Time Min], [Respawn Time Max], -- [Initial Speed], [Score], [Change Speed at Waypoints], -- [Chance to Change Speed], [Min Speed], [Max Speed], -- [Is Moving Platform], [Despawn On Last Waypoint], [Time Score]) -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 10.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 2 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 5000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 3 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_1") AddPath(paths, "Wave_3_Ship_2") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Sub_1") AddPath(paths, "Wave_3_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 5000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ness_1") AddPath(paths, "Wave_1_Ness_2") AddPath(paths, "Wave_2_Ness_1") AddSpawn(spawn,paths, 2565, 10.0, 15.0, true, 10.0, 15.0, 2.0, 10000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Friendly 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_3") AddPath(paths, "Wave_3_FShip_4") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) end ---------------------------------------------------------------------------------------------------------------------------- -- Do not Chage -- ---------------------------------------------------------------------------------------------------------------------------- function onPlayerLoaded(self, msg) if (msg) then mainPlayerLoaded(self, msg) end end function onObjectLoaded(self, msg) if (msg) then mainObjectLoaded(self, msg) end end function onNotifyObject(self, msg) if( msg) then mainNotifyObject(self, msg) end end --L_ACT_CANNON.lua -- Server Side -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') spawns = {} SPAWN_DATA = {} CONSTANTS = {} waves = {} PLAYER_SCORE = {} EFFECTS = {} ACTORS = {} LOCALS = {} local m_totalScore = 0 local g_const = {} -------------------------------------------------------------- -- target Settings -------------------------------------------------------------- function targetSettings(self) -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- AddSpawn - configures data for the spawn and adds it. Can -- only have one. -- Syntax: AddSpawn(spawn, paths, [Template ID], -- [Initial Spawn Time Min], [Initial Spawn Time Max], [Does Respawn], -- [Respawn Time Min], [Respawn Time Max], -- [Initial Speed], [Score], [Change Speed at Waypoints], -- [Chance to Change Speed], [Min Speed], [Max Speed], -- [Is Moving Platform], [Despawn On Last Waypoint], [Time Score]) -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 10.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 2 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 5000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 3 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_1") AddPath(paths, "Wave_3_Ship_2") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Sub_1") AddPath(paths, "Wave_3_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 5000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ness_1") AddPath(paths, "Wave_1_Ness_2") AddPath(paths, "Wave_2_Ness_1") AddSpawn(spawn,paths, 2565, 10.0, 15.0, true, 10.0, 15.0, 2.0, 10000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Friendly 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_3") AddPath(paths, "Wave_3_FShip_4") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) end function StartLuaNotify(self) self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ActivityStateChangeRequest"} self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="MessageBoxRespond"} self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="NotifyObject"} self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ObjectLoaded"} end function StopLuaNotify(self) self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ActivityStateChangeRequest"} self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="MessageBoxRespond"} self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="NotifyObject"} self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ObjectLoaded"} end -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state targetSettings(self) resetVars(self) LOCALS["GameStarted"] = false m_totalScore = 0 math.randomseed( os.time() ) -- default the instance vars self:SetVar("initVelVec",{x = 0, y = 0, z = 0}) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} StartLuaNotify(self) -------------------------------------------------------------- -- Constants -------------------------------------------------------------- local zoneID = GAMEOBJ:GetZoneControlID() g_const = zoneID:GetVar("CONSTANTS") self:SetVar("ImpactSkillID",g_const.IMPACT_SKILLID) local startObj = self:GetObjectsInGroup{ignoreSpawners=true,group = "start_pos" }.objects[1] if startObj then local selfPos = self:GetPosition().pos local startPos = startObj:GetPosition().pos local pos = {x = 0, y = 0, z = 0} -- z and x must be switched and negative when sending to the SetShootingGalleryParams pos.z = -(startPos.x - selfPos.x) pos.y = startPos.y - selfPos.y pos.x = -(startPos.z - selfPos.z) g_const["CANNON_PLAYER_OFFSET"] = pos end self:SetShootingGalleryParams{playerPosOffset = g_const.CANNON_PLAYER_OFFSET, projectileVelocity = g_const.CANNON_VELOCITY, cooldown = g_const.CANNON_REFIRE_RATE, muzzlePosOffset = g_const.CANNON_BARREL_OFFSET, minDistance = g_const.CANNON_MIN_DISTANCE, timeLimit = g_const.CANNON_TIMEOUT, cameraFOV = g_const.CANNON_FOV, bUseLeaderboards = g_const.CANNON_USE_LEADERBOARDS } self:SetVar("TIME_LIMIT", zoneID:GetVar("timelimit")) -- for Animations self:SetVar("VALID_ACTORS", {3109, 3110, 3111, 3112, 3125, 3126}) self:SetVar("VALID_EFFECTS", {3122}) self:SetVar("STREAK_BONUS", {1,2,5,10}) self:SetVar("mHit", 0) self:SetVar("Super_Charge_Active", false) self:SetVar("Matrix", 1) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 resetVars(self) end function resetVars(self) LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["GameStarted"] = false self:SetVar("m_shotsFired",0) self:SetVar("m_maxStreak",0) self:SetVar("m_misses",0) self:SetVar("m_curStreak",0) --self:SetVar("m_targetsHit",0) self:SetVar("m_killsSinceLastShot",0) self:SetVar("Current_Super_Charged_Time", 0) self:SetVar("StreakBonus",0) self:SetVar("LastSuperTotal", nil ) self:SetVar("currentReward", -1) self:SetVar("rewards", {-1}) --print('*******************************************') --print('stop super charge from resetVars') toggleSuperCharge(self, false) self:SetVar("ImpactSkillID",g_const.IMPACT_SKILLID) -- reset scores if g_const.NUM_WAVES then for waveNum = 1, tonumber(g_const.NUM_WAVES) do PLAYER_SCORE[waveNum] = 0 end end ActivityTimerStopAllTimers(self) end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == g_const.PROJECTILE_TEMPLATEID then local ballObj = msg.childID -- get the skill for the projectile local skill = self:GetVar("ImpactSkillID") -- store who the parent is self:SetVar("parent", msg.childID) -- TODO: this should probably be setting the childs parent to self, fix or remove if (ballObj) and (getActivityUser(self)) and (skill) then -- store values in the projectile ballObj:SetVar("My_Faction", getActivityUser(self):GetFaction().faction) storeObjectByName("Player", getActivityUser(self)) -- set the skill ballObj:SetActiveProjectileSkill{ skillID = skill } -- store the velocity local vec = self:GetVar("initVelVec") -- set projectile params if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- play animations on all actors in the scene, and others -------------------------------------------------------------- function PlaySceneAnimation(self, anim, bPlayCannon, bPlayPlayer) -- play animation on actors local friends = self:GetObjectsInGroup{ group = "cannongroup" }.objects for i = 1, table.maxn (friends) do if friends[i] then friends[i]:PlayAnimation{ animationID = anim } end end -- play on cannon if (bPlayCannon == true) then self:PlayAnimation{ animationID = anim } end -- play on player if (bPlayPlayer == true) then local player = getObjectByName("activityPlayer") player:PlayAnimation{ animationID = anim } end end -------------------------------------------------------------- -- play effects on all effects in the scene -------------------------------------------------------------- function PlaySceneEffect(effectName) -- trigger effects on effect objects for k,v in ipairs(EFFECTS) do local effect = GAMEOBJ:GetObjectByID(v) effect:PlayFXEffect{ effectType = effectName } end end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) self:SetVar("m_shotsFired", self:GetVar("m_shotsFired") + 1) local player = getActivityUser(self) self:PlayFXEffect{effectType = "onfire", ignoreID = player} self:PlayFXEffect{effectType = "onfire2", ignoreID = player} player:PlayFXEffect{effectType = "SG-fire", ignoreID = player} -- Tell the zone control we just fired GAMEOBJ:GetZoneControlID():ShootingGalleryFire() end -- play fire animation on actors PlaySceneAnimation(self, "fire", false, false) PlaySceneEffect("fire") end -------------------------------------------------------------- -- Called when getting the cannon's faction -------------------------------------------------------------- function onGetFaction(self, msg) -- return the user's faction if (getActivityUser(self)) then msg.faction = getActivityUser(self):GetFaction().faction return msg end end function toggleSuperCharge(self, enable) local iSkillID = g_const.CANNON_SKILL local iCooldown = g_const.CANNON_REFIRE_RATE local bSetChargedState = false local meItem1 = self:GetInventoryItemInSlot{slot = 0}.itemID local meItem2 = self:GetInventoryItemInSlot{slot = 1}.itemID if enable and self:GetVar("Super_Charge_Active") then return elseif enable and not self:GetVar("Super_Charge_Active") then self:EquipInventory{ itemtoequip = meItem1} self:EquipInventory{ itemtoequip = meItem2} iSkillID = g_const.CANNON_SUPERCHARGE_SKILL iCooldown = 400 bSetChargedState = true --print('enable super charge') else self:UnEquipInventory{ itemtounequip = meItem1} self:UnEquipInventory{ itemtounequip = meItem2} self:SetVar("NumberOfCharges", 0 ) --print('stop super charge') end self:SetShootingGalleryParams{ playerPosOffset = g_const.CANNON_PLAYER_OFFSET, projectileVelocity = g_const.CANNON_VELOCITY, cooldown = iCooldown, muzzlePosOffset = g_const.CANNON_BARREL_OFFSET, minDistance = g_const.CANNON_MIN_DISTANCE, cameraFOV = g_const.CANNON_FOV, bUseLeaderboards = g_const.CANNON_USE_LEADERBOARDS, timeLimit = -1 } self:SetNetworkVar("cbskill", iSkillID) self:SetVar("Super_Charge_Active", bSetChargedState) --print("Charge State = " .. tostring(bSetChargedState)) if not enable then self:SetVar("m_killsSinceLastShot", 0) end end function TimerToggle(self, bStart) if bStart then local wave = GAMEOBJ:GetZoneControlID():GetVar("ThisWave") self:SetNetworkVar("count", self:GetVar("TIME_LIMIT")) self:SetVar("Started", true) else -- Stop Timer on Client self:SetNetworkVar("Stop", true) end end function pauseChargeCannon(self) local superChargeTime = math.ceil(ActivityTimerGetRemainingTime(self, "Super_Charge_Timer")) if superChargeTime < 1 and superChargeTime > 0 then superChargeTime = 1 end self:SetVar("Super_Charge_Paused", true) self:SetVar("Current_Super_Charged_Time", superChargeTime) self:SetNetworkVar("charge_counting", math.ceil(superChargeTime)) --print('** Pause Super Charge Timer (time remaining = ' .. superChargeTime .. ') **') ActivityTimerStop(self, "Super_Charge_Timer") end function StartChargedCannon(self, optionalTime) local iTime = optionalTime if not iTime then iTime = g_const.ChargedTime end self:SetVar("Super_Charge_Paused", false) toggleSuperCharge(self, true) ActivityTimerStart(self, "Super_Charge_Timer", 1, iTime) if not self:GetVar("WaveStatus") then pauseChargeCannon(self) end end function onActivityNotify(self,msg) -- Don't count any of this if we're firing our super charged cannon ball if (msg.notification["shot_done"]) then if (self:GetVar("m_killsSinceLastShot") <= 0) and msg.notification["shot_done"] ~= g_const.CANNON_SUPER_CHARGE then self:SetVar("m_curStreak", 0) -- This account for real misses self:SetVar("m_misses", self:GetVar("m_misses") + 1) self:SetNetworkVar("HideStreak", true) self:SetNetworkVar("UnMarkAll", true) elseif self:GetVar("m_killsSinceLastShot") > 1 then self:SetNetworkVar("mHit", true) end if msg.notification["shot_done"] ~= g_const.CANNON_SUPER_CHARGE then updateStreak(self) -- if we're ready to super charge do it if self:GetVar("bReadyToSuperCharge") then StartChargedCannon(self) self:SetNetworkVar("SuperChargeBar", 100) self:SetVar("LastSuperTotal", m_totalScore) end end self:SetVar("m_killsSinceLastShot", 0) self:SetVar("bReadyToSuperCharge", false) end end function intdiv(a,b) return math.floor(a/b) end function getCurrentBonus(self) local streak = self:GetVar("m_curStreak") -- Cap the streak if (streak > 12) then streak = 12 end local res = intdiv(streak, 3) return res end function updateStreak(self) local streakBonus = getCurrentBonus(self) local curStreak = self:GetVar("m_curStreak") local marks = math.mod(curStreak, 3) self:SetNetworkVar("cStreak", curStreak) -- Update the marks if curStreak >= 0 and curStreak < 13 then -- Mark 1 if marks == 1 then self:SetNetworkVar("Mark1", true) elseif marks == 2 then self:SetNetworkVar("Mark2", true) elseif marks == 0 and curStreak > 0 then self:SetVar("StreakBonus", streakBonus) self:SetNetworkVar("ShowStreak", streakBonus + 1) --self:SetNetworkVar("ShowStreak", streakBonus + 1) self:SetNetworkVar("Mark3", true) else self:SetVar("StreakBonus", streakBonus) self:SetNetworkVar("UnMarkAll", true) end end end -- activity timers ii ---------------------------------------------------------------- -- When ActivityTimerUpdate is sent, basically when a timer hits it updateInterval. ---------------------------------------------------------------- function onActivityTimerUpdate(self, msg) --print('** ActivityTimerUpdate: ' .. msg.name) if msg.name == "Super_Charge_Timer" and not self:GetVar("Super_Charge_Paused") then --print('update super charge timer to: ' .. msg.timeRemaining) self:SetNetworkVar("charge_counting", msg.timeRemaining) elseif msg.name == "endGameBuffer" then local cannonballs = self:GetObjectsInGroup{ group = "cannonball" }.objects if #cannonballs <= 1 then --print('Stop game after endGameBuffer') RecordPlayerWaveScore(self) stopGame(self, false) end end end ---------------------------------------------------------------- -- When ActivityTimerDone is sent, basically when the activity timer has reached it's duration. ---------------------------------------------------------------- function onActivityTimerDone(self, msg) --print('** ActivityTimerDone: ' .. msg.name) if msg.name == "Super_Charge_Timer" and not self:GetVar("Super_Charge_Paused") then if self:GetVar("WaveStatus") or self:GetVar("Current_Super_Charged_Time") < 1 then --print('super charge timer finished') self:SetNetworkVar("charge_counting", 999) --self:SetVar("chargeUI", 100 ) self:SetNetworkVar("SuperChargeBar", 0) --if self:GetVar("Super_Charge_Active") then --print("stop super charge, timer is done") toggleSuperCharge(self, false) --end end elseif (string.starts(msg.name,"SpawnWave")) then -- parse the name to get out the wave number if (LOCALS["GameStarted"] == true) then local waveNum = LOCALS["ThisWave"] local player = getObjectByName("activityPlayer") -- store this wave number self:SetVar("WaveStatus", true) self:SetVar("ThisWave", waveNum) if waveNum ~= 1 and self:GetVar("Super_Charge_Paused") then --print('****') --print('start super charge from SpawnWave Current time: ' .. self:GetVar("Current_Super_Charged_Time")) StartChargedCannon(self, self:GetVar("Current_Super_Charged_Time")) self:SetVar("Current_Super_Charged_Time", 0) end TimerToggle(self, true) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self,true) end -- there are no more waves left so stop game after this wave if (tonumber(waveNum) >= g_const.NUM_WAVES) then ActivityTimerStart(self, "GameOver", self:GetVar("TIME_LIMIT"), self:GetVar("TIME_LIMIT")) else -- setup next wave ActivityTimerStart(self, "EndWave" .. waveNum, self:GetVar("TIME_LIMIT"), self:GetVar("TIME_LIMIT")) end if player then self:StartActivityTime{ rerouteID = player, startTime = self:GetVar("TIME_LIMIT") } self:ActivityPause{ rerouteID = player, bPause = false } end end elseif (string.starts(msg.name,"EndWave")) then -- called when a wave ends, contains the number of the next wave if (LOCALS["GameStarted"] == true) then self:SetVar("WaveStatus", false) -- get rid of current spawns TimerToggle(self) -- record the score RecordPlayerWaveScore(self) -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,8) -- store the next wave number waveNum = tonumber(waveNum) + 1 LOCALS["ThisWave"] = waveNum -- Do whatever we need to during the pause, wave begins after pause -- play wave animation on actors, cannon, and player PlaySceneAnimation(self, "wave" .. LOCALS["ThisWave"], true, true) -- display wave number to player DisplayWaveNumberToPlayer(self, waveNum) -- there are no more waves left so stop game after this wave if (waveNum > g_const.NUM_WAVES) then -- Game Over ActivityTimerStart(self, "GameOver", 0.1, 0.1) else -- setup next wave ActivityTimerStart(self, "SpawnWave" .. waveNum, g_const.IN_BETWEEN_WAVE_PAUSE, g_const.IN_BETWEEN_WAVE_PAUSE) end local player = getObjectByName("activityPlayer") if player then self:ActivityPause{rerouteID = player, bPause = true} end if self:GetVar("Super_Charge_Active") and not self:GetVar("Super_Charge_Paused") then pauseChargeCannon(self) end end elseif (msg.name == "GameOver") then -- Send buffer timer here local player = getObjectByName("activityPlayer") local cannonballs = self:GetObjectsInGroup{ group = "cannonball" }.objects self:ActivityPause{ rerouteID = player, bPause = true } if #cannonballs >= 1 then --print('start endGameBuffer') ActivityTimerStart(self, "endGameBuffer", 1, #cannonballs) else --print('stopGame now') RecordPlayerWaveScore(self) stopGame(self, false) end TimerToggle(self) elseif (string.starts(msg.name,"DoSpawn")) then if (LOCALS["GameStarted"] == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] local templateID = SpawnData.sdTemplate -- get the position of the first waypoint local startPos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) local config = {{"spawndata", SpawnData},{"streakmod", g_const.STREAK_MOD}, {"streakbonus", self:GetVar("STREAK_BONUS")}, {"wave", LOCALS["ThisWave"]}, {"custom_script_server", "scripts/ai/ACT/SG_TARGET.lua" }, {"custom_script_client", "scripts/client/ai/SG_TARGET_CLIENT.lua" }} -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = startPos.x, y = startPos.y, z = startPos.z, owner = self, configData = config} end elseif msg.name == "endGameBuffer" then RecordPlayerWaveScore(self) stopGame(self, false) end end function registerHit(self, target) local points = target:GetActivityPoints{}.points -- Only apply bonus to positive things and don't do streak etc for negative if (points >= 0) then points = points + (points * getCurrentBonus(self)) --self:SetVar("m_targetsHit", self:GetVar("m_targetsHit") + 1) self:SetVar("m_killsSinceLastShot", self:GetVar("m_killsSinceLastShot") + 1) if (not self:GetVar("Super_Charge_Active")) then self:SetVar("m_curStreak", self:GetVar("m_curStreak") + 1) if (self:GetVar("m_curStreak") > self:GetVar("m_maxStreak")) then self:SetVar("m_maxStreak", self:GetVar("m_curStreak")) end end else if (not self:GetVar("Super_Charge_Active")) then self:SetVar("m_curStreak", 0) -- This accounts for friendlies self:SetVar("m_misses", self:GetVar("m_misses") + 1) end self:SetNetworkVar("hitFriend", true) end self:NotifyClientShootingGalleryScore{rerouteID = getActivityUser(self), target = target, targetPos = target:GetPosition().pos, score=points} end function onUpdateMissionTask(self, msg) -- We get these forwarded to us by the cannon ball if msg.taskType == "kill" then local points = msg.target:GetActivityPoints{}.points registerHit(self, msg.target) getActivityUser(self):UpdateMissionTask{target = msg.target, value = msg.value, value2 = msg.value2, taskType = msg.taskType} -- If we have a bonus, use it local bonus = self:GetVar("StreakBonus") if (bonus > 0) and (points > 0) then points = points + points * bonus end m_totalScore = m_totalScore + points self:SetNetworkVar("updateScore", tonumber(m_totalScore)) local lastSuperTotal = self:GetVar("LastSuperTotal") or 0 scScore = m_totalScore - lastSuperTotal if not self:GetVar("Super_Charge_Active") and scScore >= g_const.ChargedPoints then self:SetVar("bReadyToSuperCharge", true) end local rewardS = 0 local rewardF = 0 if self:GetVar("Matrix") <= 5 then local scoreRewardNum = "Score_Reward_"..self:GetVar("Matrix") local RewardAmount = g_const[scoreRewardNum] / 100 * 3 rewardS = (m_totalScore / RewardAmount) rewardF = round((rewardS * 3),0) if rewardF > 100 then rewardF = 100 end self:SetNetworkVar("modelPercent", rewardF) end if (rewardF > 0 and rewardF < 200) and self:GetVar("Matrix") <= 5 then local obj = self:GetObjectsInGroup{ignoreSpawners=true,group = g_const.Reward_Model_GrpName }.objects --RWS -- check to make sure obj[1] is not nil, mrb... if obj[1] then obj[1]:SpawnModelBricks{amount=(rewardF/100),pos=msg.target:GetPosition().pos} if rewardF >= 100 then --print('giving new model score is: ' .. m_totalScore) spawnNewModel(self) self:SetVar("Matrix" , self:GetVar("Matrix") + 1 ) end end end self:SetNetworkVar("beatHighScore", tostring(m_totalScore)) checkSpawn(self, msg.target) end end -------------------------------------------------------------- -- put the player in the cannon, does not start the cannon -------------------------------------------------------------- function onRequestActivityEnter(self, msg) storeObjectByName("activityPlayer", msg.userID) self:SetNetworkVar("HideScoreBoard", true) self:SetNetworkVar("ReSetSuperCharge", true) self:SetNetworkVar("showLoadingUI", true) -- Preloading reload animations -- Cannonballs, plunger, and pirate local sceneactors = self:GetObjectsInGroup{ group = "cannongroup" }.objects for i = 1, table.maxn (sceneactors) do if sceneactors[i] then sceneactors[i]:PreloadAnimation{animationID = "wave1", respondObjID = self} end end msg.userID:PreloadAnimation{animationID = "wave1", respondObjID = self} self:PreloadAnimation{animationID = "wave1", respondObjID = self} end --------------------------------------- from zone function spawnNewModel(self) if self:GetVar("currentReward") ~= -1 then local rewards = self:GetVar("rewards") if rewards and rewards[1] ~= -1 then table.insert(rewards, self:GetVar("currentReward")) else rewards = {self:GetVar("currentReward")} end self:SetVar("rewards",rewards) self:SetNetworkVar("rewardAdded", self:GetVar("currentReward")) end local obj = self:GetObjectsInGroup{ignoreSpawners=true,group= g_const.Reward_Model_GrpName}.objects if(#obj > 0) then for index, rewardObj in pairs(obj) do local items = GAMEOBJ:RollLoot(g_const["Score_LootMatrix_"..self:GetVar("Matrix")], getObjectByName("activityPlayer")) for LOT,count in pairs(items) do rewardObj:SetModelToBuild{templateID=LOT} self:SetVar("currentReward", LOT) end end end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self) -- clear score self:SetNetworkVar("game_timelimit", self:GetVar("TIME_LIMIT")) self:SetNetworkVar("Audio_Start_Intro", true) self:SetVar("currentReward", -1) local obj = self:GetObjectsInGroup{ignoreSpawners=true,group= g_const.Reward_Model_GrpName}.objects for i, j in pairs(obj) do j:SetModelToBuild{templateID=-1} end local idString = self:GetID() -- get the player local player = getObjectByName("activityPlayer") if player then -- Telkl the client to get the initial data for showing the top score local targetID = self:GetActivityUser().userID targetID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = self:GetActivityID().activityID } -- put the player in if we have to, otherwise start if ((self:GetActivityUser().userID):GetID() == player:GetID()) then --print("starting game") self:ActivityStart{ rerouteID = player } end self:SetNetworkVar("Clear", true) DoGameStartup(self) end spawnNewModel(self) end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bCanceling) self:SetNetworkVar("ReSetSuperCharge", true) self:SetNetworkVar("HideSuper", true) --print("STOPING GAME ******************************************") -- get the player local player = getObjectByName("activityPlayer") -- if we have both stop it if we need to, but dont exit if player then -- Now retrieve everything form the cannon. We have the score here so we do the rest here too local streak = self:GetVar("m_maxStreak") local misses = self:GetVar("m_misses") local fired = self:GetVar("m_shotsFired") self:SetActivityUserData{ userID = player, typeIndex = 0, value = m_totalScore } self:SetActivityUserData{ userID = player, typeIndex = 1, value = streak } --print('stop super charge from stopGame()') toggleSuperCharge(self, false) local percentage = 0 if (fired > 0) then percentage = (fired-misses) / fired end self:SetActivityUserData{ userID = player, typeIndex = 2, value = percentage } -- Tell the leaderboard to store everything self:UpdateActivityLeaderboard{ userID = player } self:ActivityStop{rerouteID = player, bExit = false, bUserCanceled = bCanceling} self:SetNetworkVar("Clear", true) DoGameShutdown(self) self:SetVar("Mym_totalScore", m_totalScore) m_totalScore= 0 LOCALS["GameStarted"] = false -- if we are not exiting, show the summary and allow for retry if (bCanceling == false) then showSummaryDialog(self, fired, fired-misses, streak) end awardModels(self:GetVar("rewards"), player) resetVars(self) end end function awardModels(rewards, player) if not rewards then return end for index, reward in pairs(rewards) do if reward ~= -1 then player:AddItemToInventory{iObjTemplate = reward, invType = 5 --[[5 is INVENTORY_MODEL--]] } end end end -------------------------------------------------------------- -- sends a message to display the current wave text to player -------------------------------------------------------------- function DisplayWaveNumberToPlayer(self, waveNum) local player = getObjectByName("activityPlayer") if (player) then self:SetNetworkVar("wave", {waveNum = waveNum, waveStr = self:GetVar("TIME_LIMIT")}) end end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self, shots, kills, streak) -- get player local player = getObjectByName("activityPlayer") if player then -- do summary dialog -- Wave Score local score = m_totalScore local r = self:GetActivityReward{ playerID = player} local rstring = (r.rewardMoney..","..r.rewardItem1Name..","..r.rewardItem1Image..","..r.rewardItem1StackSize..","..r.rewardItem2Name..","..r.rewardItem2Image..","..r.rewardItem2StackSize) local rscore = ( self:GetVar("Mym_totalScore").."_"..PLAYER_SCORE[1].."_"..PLAYER_SCORE[2].."_"..PLAYER_SCORE[3].."_"..shots.."_"..kills.."_"..streak ) self:SetNetworkVar("UI_Score", tostring(rscore)) -- Send the activity ID down to the client self:SetNetworkVar("UI_Rewards", self:GetActivityID().activityID) self:SetNetworkVar("Audio_Final_Wave_Done", true) local targetID = self:GetActivityUser().userID targetID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = self:GetActivityID().activityID } end end function RecordPlayerWaveScore(self) -- get wave number local waveNum = tonumber(LOCALS["ThisWave"]) if (waveNum > 0) then -- get total current score local score = m_totalScore -- to get the wave score we must subtract prior waves from it for waves = 1, waveNum - 1 do score = score - PLAYER_SCORE[waves] end -- store the new score PLAYER_SCORE[waveNum] = score --print("*************** SCORE? "..PLAYER_SCORE[waveNum]) end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- also return the score as the result for the activity msg.outActivityRating = m_totalScore return msg end function checkSpawn(self, target) local waveNum = tonumber(LOCALS["ThisWave"]) if (LOCALS["GameStarted"] == true) and (waveNum) and (waveNum > 0) then local spawnData = target:GetVar("SpawnData") -- spawn the right object if (spawnData) and (spawnData.sdRespawn == true) and (target:GetVar("wave") == LOCALS["ThisWave"]) then spawns[waveNum][spawnData.sdnum].sdLastPath = spawnData.sdPath SpawnObject(spawnData.sdnum,spawns[waveNum][spawnData.sdnum],self,false) end end end function RemovePlayerFromZone(self, player) if not player then return end player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end -------------------------------------------------------------- -- User is exiting via cancel -------------------------------------------------------------- function onRequestActivityExit(self, msg) if (msg.bUserCancel == true) then stopGame(self,msg.bUserCancel) RemovePlayerFromZone(self, msg.userID) self:SetNetworkVar("showLoadingUI", true) resetVars(self) end end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars resetVars(self) LOCALS["GameStarted"] = true self:SetNetworkVar("Clear", true) -- start the first wave LOCALS["ThisWave"] = 1 if g_const.FIRST_WAVE_START_TIME < 1 then g_const.FIRST_WAVE_START_TIME = 1 end ActivityTimerStart(self, "SpawnWave1", g_const.FIRST_WAVE_START_TIME, g_const.FIRST_WAVE_START_TIME) end ----------------------------------------------------------------- -- Target Spawning logic ----------------------------------------------------------------- -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- look through spawn data to find the most recent data -- that matches the template local SpawnData = GetLatestSpawnDataByTemplate(self,msg.templateID) if (SpawnData) then local curSpawnNum = IncrementVarAndReturn("CurSpawnNum") -- store spawn for use later storeObjectByName("spawnObject" .. curSpawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child (@TODO: Need to Optimize) msg.childID:SetVar("SpawnData", SpawnData) if (SpawnData.sdMovingPlat == true) then msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } msg.childID:SetCurrentPath{ pathName = SpawnData.sdPath, startPoint = 0 } else -- assign child's waypoint msg.childID:SetVar("attached_path",SpawnData.sdPath) msg.childID:SetVar("attached_path_start",0) local startpos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) msg.childID:SetPosition{pos = startpos} -- start child on path msg.childID:FollowWaypoints() msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } end end end -------------------------------------------------------------- -- return if template is a valid actor -------------------------------------------------------------- function IsValidActor(templateID) for k,v in ipairs(self:GetVar("VALID_ACTORS")) do if templateID == v then return true end end return false end -------------------------------------------------------------- -- return if template is a valid effect -------------------------------------------------------------- function IsValidEffect(templateID) for k,v in ipairs(self:GetVar("VALID_EFFECTS")) do if templateID == v then return true end end return false end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) ----print("DoGameShutdown GAME ******************************************") LOCALS["GameStarted"] = false -- cancel all timers ActivityTimerStopAllTimers(self) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- Get a random path -------------------------------------------------------------- function GetRandomPath(self, spawn, lastPath) -- pick a random local newPath = lastPath local lastRandomPath = self:GetVar("lastRandomPath") or "" if not lastPath then lastPath = "" end if #spawn.path > 1 then local newPathTable = {} for k,v in ipairs(spawn.path) do -- if we find the lastPath or lastRandomPath then remove it from the temp table if v ~= lastPath or v ~= lastRandomPath then table.insert(newPathTable, v) end end -- if we still have paths to pick from then get a random path if newPathTable then --print('** multi Path ' .. #newPathTable ) newPath = spawn.path[math.random(1,#newPathTable)] else -- otherwise use the first path newPath = false end else --print('** one Path') if spawn.path[1] == lastRandomPath then newPath = false else newPath = spawn.path[1] end end --print('spawn: ' .. spawn.id .. ' @ ' .. tostring(newPath) .. ' : lastPath = ' .. lastPath)-- .. ' : lastRandPath = ' .. lastRandomPath) self:SetVar("lastRandomPath", newPath) return newPath end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self, bSpawnNow) -- get the current spawn number local spawnNum = IncrementVarAndReturn("SpawnNum") local newPath = GetRandomPath(self, spawn, spawn.sdLastPath) if not newPath then spawn.bRespawn = false end -- save the spawn data for the object when it is loaded local SpawnData = { sdTemplate = spawn.id, sdRespawn = spawn.bRespawn, sdSpeed = spawn.speed, sdScore = spawn.score, sdPath = newPath, sdnum = num, sdChangeSpeed = spawn.bChangeSpeed, sdSpeedChance = spawn.speedChangeChance, sdMinSpeed = spawn.minSpeed, sdMaxSpeed = spawn.maxSpeed, sdMovingPlat = spawn.bMovingPlatform, sdDespawnTime = spawn.despawnTime, sdTimeScore = spawn.timeScore, bSpawned = false} -- store the data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum -- spawn now and use initial spawn times if (bSpawnNow == true) then if (spawn.initSpawnTimeMin > 0 and spawn.initSpawnTimeMax > 0) then local ranSpawnTime = (math.random() * (spawn.initSpawnTimeMax - spawn.initSpawnTimeMin)) + spawn.initSpawnTimeMin --print ("init spawning with time " .. ranSpawnTime) if ranSpawnTime < 1 then ranSpawnTime = 1 end ActivityTimerStart(self, timerName, ranSpawnTime, ranSpawnTime) else ActivityTimerStart(self, timerName, 1, 1) end elseif (spawn.bRespawn == true) then -- respawn, use respawn times -- pick a random spawn time local ranSpawnTime = (math.random() * (spawn.maxTime - spawn.minTime)) + spawn.minTime if ranSpawnTime < 1 then ranSpawnTime = 1 end ActivityTimerStart(self, timerName, ranSpawnTime, ranSpawnTime) end end -------------------------------------------------------------- -- destroys all spawns -------------------------------------------------------------- function DestroyAllSpawns(self) local maxSpawnNum = LOCALS["CurSpawnNum"] for spawn = 1, maxSpawnNum do local spawnObject = getObjectByName("spawnObject" .. spawn) if (spawnObject) then if (spawnObject:Exists() and not spawnObject:IsDead().bDead) then --print("removing spawn object " .. spawn) spawnObject:Die{killerID = spawnObject, killType = "SILENT"} end end end -- reset vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 end -------------------------------------------------------------- -- look through spawn data to find the most recent data -- that matches the template, returns nil or data -------------------------------------------------------------- function GetLatestSpawnDataByTemplate(self,templateID) local spawnNum = LOCALS["SpawnNum"] while (spawnNum > 0) do -- get the data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] -- check spawn flag and template if (SpawnData.bSpawned == false and templateID == SpawnData.sdTemplate) then -- set spawned flag SpawnData.bSpawned = true -- re-save data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- return the good data return SpawnData end -- try prev spawn data spawnNum = spawnNum - 1 end return nil end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function notifyMessageBoxRespond(self, other, msg) if other:GetID() ~= GAMEOBJ:GetZoneControlID():GetID() then return end --print(msg.identifier .. " - " .. msg.iButton) -- make sure this is the right player local player = getObjectByName("activityPlayer") if not player then return end if (player:GetID() == msg.sender:GetID()) then if msg.identifier == "Scoreboardinfo" then strText = "Retry?" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Retry"} else -- User wants to retry or is closing the big help to start the game if ((msg.iButton == 1 and (msg.identifier == "Shooting_Gallery_Retry" or msg.identifier == "RePlay")) or (msg.identifier == "SG1")) then self:SetNetworkVar("Clear", true) startGame(self) elseif (msg.iButton == 0 and (msg.identifier == "Shooting_Gallery_Retry" or msg.identifier == "RePlay")) then -- User wants to quit -- called before we leave the cannon, so we can trigger a loading screen -- as soon as possible. Should still remove player from cannon on server self:RequestActivityExit{userID = player, bUserCancel = false} RemovePlayerFromZone(self, player) elseif (msg.iButton == 1 and (msg.identifier == "Shooting_Gallery_Exit" or msg.identifier == "Exit")) then RemovePlayerFromZone(self, player) self:RequestActivityExit{userID = player, bUserCancel = true} end end end end function notifyObjectLoaded(self, other, msg) if other:GetID() ~= GAMEOBJ:GetZoneControlID():GetID() then return end if ( IsValidActor(msg.templateID) == true ) then -- store the actor local nextActor = #ACTORS + 1 ACTORS[nextActor] = msg.objectID:GetID() elseif ( IsValidEffect(msg.templateID) == true ) then -- check for effects -- store the actor local nextEffect = #EFFECTS + 1 EFFECTS[nextEffect] = msg.objectID:GetID() end end function onNotifyObject(self, msg) if (msg.name == "FinishedPath") then checkSpawn(self, msg.ObjIDSender) end end function notifyActivityStateChangeRequest(self,other,msg) if other:GetID() ~= GAMEOBJ:GetZoneControlID():GetID() then return end if (msg.iNumValue1 == 1000) then -- retry startGame(self) elseif (msg.iNumValue1 == 7777) then -- qurriey local targetID = self:GetActivityUser().userID targetID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = self:GetActivityID().activityID } elseif (msg.iNumValue1 == 2000) then -- exit local player = getObjectByName("activityPlayer") strText = "Exit?" -- show the summary message box player:DisplayMessageBox{ bShow = true, imageID = 1, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Exit"} elseif (msg.iNumValue1 == 1200) then -- play startGame(self) end end --L_ACT_CANNONBALL.lua -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -- Ian G. There is now a detructible component attached to this object so we do not handle -- get faction or isenemy in lua anymore. -------------------------------------------------------------- -- return the parent's faction -------------------------------------------------------------- --function onGetFaction(self, msg) -- msg.faction = self:GetVar("My_Faction") --end -------------------------------------------------------------- -- Determine if the target is an enemy -------------------------------------------------------------- --function onIsEnemy(self, msg) -- get our faction from our parent -- local myFaction = self:GetVar("My_Faction") -- get the target's faction -- local tgt = msg.targetID; -- local tgtFaction = tgt:GetFaction().faction -- target is an enemy if the faction is not the same as us -- msg.enemy = (myFaction ~= tgtFaction) -- return msg --end function onStartup(self) self:AddObjectToGroup{ group = "cannonball" } end-------------------------------------------------------------- -- Description: -- -- Server script for Shooting Gallery Actors in the instance. -- This object will register with the zone script who will -- then trigger animations and actions on this object. -- -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Description: -- -- Server script for Shooting Gallery Actors in the instance. -- This object will register with the zone script who will -- then trigger animations and actions on this object. -- -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{name = "Cannon_Timer" , ObjIDSender = self } self:SetVar("chargeUI", 100) self:SetVar("charge_count", 10) self:SetVar("charge_keep", 0 ) self:SetVar("SC_ACTIVE", false) end function onNotifyObject(self,msg) --- Start Timer on Client if msg.name == "Start" then self:SetVar("Started", true) local wave = GAMEOBJ:GetZoneControlID():GetVar("ThisWave") self:NotifyClientObject{name = "count", param1 = GAMEOBJ:GetZoneControlID():GetVar("timelimit") , paramStr = wave } end -- Stop Timer on Client if msg.name == "Stop" then self:NotifyClientObject{name = "Stop"} end if msg.name == "StartCharge" then print(" ********* Timer StartCharge") ctimer = GAMEOBJ:GetZoneControlID():GetVar("CONSTANTS.ChargedTime") / 10 GAMEOBJ:GetTimer():AddTimerWithCancel( ctimer , "ChargedCompet", self ) self:SetVar("charge_keep", 9 ) end if msg.name =="ResetCharge" then print(" ********* Timer ResetCharge") GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "ChargedCompet", self ) end end function onTimerDone(self,msg) if msg.name == "ChargedCompet" then chargeTime = self:GetVar("chargeUI") - 10 chargeCount = self:GetVar("charge_count") - 1 if GAMEOBJ:GetZoneControlID():GetVar("WaveStatus") then local myParent = self:GetParentObj().objIDParent if chargeCount == 0 then self:SetVar("charge_keep", 0 ) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "charge_counting", param1 = 999 } self:SetVar("charge_count", 10) self:SetVar("chargeUI", 100 ) if self:GetVar("SC_ACTIVE") then -- print("Send Reset ****************************************") myParent:NotifyObject{ name = "CannonReg" } self:SetVar("SC_ACTIVE", false) end else if not self:GetVar("SC_ACTIVE") then -- print("Send Charge ****************************************") myParent:NotifyObject{ name = "CannonSupper" } self:SetVar("SC_ACTIVE", true) end GAMEOBJ:GetZoneControlID():NotifyObject{name = "ResetCharge" } self:SetVar("charge_keep", self:GetVar("charge_keep") -1 ) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "charge_counting", param1 = chargeTime } self:SetVar("charge_count", chargeCount ) self:SetVar("chargeUI", chargeTime ) ctimer = GAMEOBJ:GetZoneControlID():GetVar("CONSTANTS.ChargedTime") / 10 GAMEOBJ:GetTimer():AddTimerWithCancel( ctimer , "ChargedCompet", self ) end if self:GetVar("chargeUI") == 0 then self:SetVar("chargeUI", 100) end end end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') require('ai/MINIGAME/SG_GF/L_GF_SG') -- @TODO: Add Path Changing on waypoint, need to get [Closest Waypoint on New Path] -- Also need [Number of Waypoints on Path] -- @TODO: Optimize -------------------------------------------------------------- -- Locals and Constants LOCALS = {} CONSTANTS = {} STORECONSTANTS = {} -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS["PLAYER_START_POSx"] = -446.288849 CONSTANTS["PLAYER_START_POSy"] = 277.685211 CONSTANTS["PLAYER_START_POSz"] = 56.183247 CONSTANTS["PLAYER_START_ROTw"] = 0.91913521289825 CONSTANTS["PLAYER_START_ROTx"] = 0 CONSTANTS["PLAYER_START_ROTy"] = 0.39394217729568 CONSTANTS["PLAYER_START_ROTz"] = 0 -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["IMPACT_SKILLID"] = 34 CONSTANTS["PROJECTILE_TEMPLATEID"] = 1822 CONSTANTS["CANNON_PLAYER_OFFSETx"] = 6.652 CONSTANTS["CANNON_PLAYER_OFFSETy"] = 0 CONSTANTS["CANNON_PLAYER_OFFSETz"] = -1.188 CONSTANTS["CANNON_VELOCITY"] = 129.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 CONSTANTS["CANNON_BARREL_OFFSETx"] = 0 CONSTANTS["CANNON_BARREL_OFFSETy"] = 4.3 CONSTANTS["CANNON_BARREL_OFFSETz"] = 9 CONSTANTS["CANNON_TIMEOUT"] = -1 CONSTANTS["CANNON_FOV"] = 50.0 CONSTANTS["CANNON_USE_LEADERBOARDS"] = true CONSTANTS["STREAK_MOD"] = 2 -- for Animations STORECONSTANTS["VALID_ACTORS"] = {3109, 3110, 3111, 3112, 3125, 3126} STORECONSTANTS["STREAK_BONUS"] = {1,2,5,10} STORECONSTANTS["VALID_EFFECTS"] = {3122} -- Super Charger is charged for this amount of time CONSTANTS["ChargedTime"] = 10 -- The amount of points needed to supper charge CONSTANTS["ChargedPoints"] = 25000 -- Activity ID CONSTANTS["ActivityID"] = 4 CONSTANTS["Reward_Model_GrpName"] = "QBRewardGroup" ACTORS = {} -- stores actors for the instance EFFECTS = {} -- stores effects for the instance -------------------------------------------------------------- -- Wave Data waves = {} PLAYER_SCORE = {} -------------------------------------------------------------- -- Syntax: [Time] [Text to Show Player] -------------------------------------------------------------- AddWave(waves, 30.0, "Wave;One" ) AddWave(waves, 30.0, "Wave;Two" ) AddWave(waves, 30.0, "Wave;Three" ) -- wave constants STORECONSTANTS["NUM_WAVES"] = #waves CONSTANTS["FIRST_WAVE_START_TIME"] = 4.0 CONSTANTS["IN_BETWEEN_WAVE_PAUSE"] = 7.0 -------------------------------------------------------------- -- Spawn Data spawns = {} SPAWN_DATA = {} -------------------------------------------------------------- -- Startup do not chaged!!! -------------------------------------------------------------- function onStartup(self) targetSettings(self) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 self:SetVar("StreakBouns",0) self:SetVar("StopCharge", false ) self:SetVar("NumberOfCharges", 0 ) wave1Score = 0 wave2Score = 0 wave3Score = 0 self:SetVar("WaveStatus", true) self:SetVar("StreakBouns", 0) setCONSTANTS( self,spawns,SPAWN_DATA,CONSTANTS , waves, PLAYER_SCORE, EFFECTS , ACTORS,STORECONSTANTS ) self:SetVar("CONSTANTS", CONSTANTS) self:SetVar("timelimit", waves[1].timeLimit) totalscore = 0 end -------------------------------------------------------------- -- target Settings -------------------------------------------------------------- function targetSettings(self) -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Obj_1") AddPath(paths, "Wave_1_Obj1_2") AddSpawn(spawn,paths, 6015, --[Template ID] 0.0, --[Initial Spawn Time Min] 2.0, --[Initial Spawn Time Max] true, --[Does Respawn] 0, --[Respawn Time Min], 2, --[Respawn Time Max] 2.0, --[Initial Speed] 10000, --[Score] false, --[Change Speed at Waypoints] 0.0, --[Chance to Change Speed] 1.0, --[Min Speed] 1.0, --[Max Speed] false, --[Is Moving Platform] true, --[Despawn On Last Waypoint] 0.0) --[Time Score] AddSpawnsForWave(spawns,spawn) -- Wave 2 Spawns spawn = {} paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Obj_1") AddPath(paths, "Wave_1_Obj1_2") AddSpawn(spawn,paths, 5946, --[Template ID] 0.0, --[Initial Spawn Time Min] 2.0, --[Initial Spawn Time Max] true, --[Does Respawn] 0, --[Respawn Time Min], 2, --[Respawn Time Max] 2.0, --[Initial Speed] 10000, --[Score] false, --[Change Speed at Waypoints] 0.0, --[Chance to Change Speed] 1.0, --[Min Speed] 1.0, --[Max Speed] false, --[Is Moving Platform] true, --[Despawn On Last Waypoint] 0.0) --[Time Score] AddSpawnsForWave(spawns,spawn) -- Wave 3 Spawns spawn = {} paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Obj_1") AddPath(paths, "Wave_1_Obj1_2") AddSpawn(spawn,paths, 6300, --[Template ID] 0.0, --[Initial Spawn Time Min] 2.0, --[Initial Spawn Time Max] true, --[Does Respawn] 0, --[Respawn Time Min], 2, --[Respawn Time Max] 2.0, --[Initial Speed] 10000, --[Score] false, --[Change Speed at Waypoints] 0.0, --[Chance to Change Speed] 1.0, --[Min Speed] 1.0, --[Max Speed] false, --[Is Moving Platform] true, --[Despawn On Last Waypoint] 0.0) --[Time Score] AddSpawnsForWave(spawns,spawn) end ---------------------------------------------------------------------------------------------------------------------------- -- Do not Chage -- ---------------------------------------------------------------------------------------------------------------------------- function onPlayerLoaded(self, msg) if (msg) then mainPlayerLoaded(self, msg) end end function onObjectLoaded(self, msg) if (msg) then mainObjectLoaded(self, msg) end end function onNotifyObject(self, msg) if( msg) then mainNotifyObject(self, msg) end end function onPlayerExit( self, msg) if (msg) then mainPlayerExit( self, msg) end end function onShootingGalleryFire(self, msg) if (msg) then mainShootingGalleryFire( self, msg) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"] = 3 CONSTANTS["HELP_SCREEN_TEXT"] = "fdsa" -- was "SG1" but ths was causing the game to start onStartup --[[ UISendMessage switchGameState("pushGameState"); switchGameState.args["state"] = "shootinggallery"; LWOSENDMESSAGE(LWO_MAIN_INTERFACE_UI, &switchGameState); This turns it off: UISendMessage switchGameState("pushGameState"); switchGameState.args["state"] = "gameplay"; // Or previous state LWOSENDMESSAGE(LWO_MAIN_INTERFACE_UI, &switchGameState); --]] -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) self:SetVar("TotalScore", 0 ) self:SetVar("rewardModels", {} ) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) end function onPlayerReady(self) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) self:SetVar("PlayerReady", true) -- get local player local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Intro" } -- check the tooltip flag local tooltipMsg = player:GetTooltipFlag{iToolTip = CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"]} if (tooltipMsg.bFlag == false) then -- set the tooltip? else -- fake the msgbox close to start the activity GAMEOBJ:GetZoneControlID():MessageBoxRespond{ identifier = CONSTANTS["HELP_SCREEN_TEXT"], sender = player } end checkEverythingReady(self) end function checkEverythingReady(self) local cannonclient = getObjectByName(self, "Cannon_ClientOBJ") local ready = self:GetVar("PlayerReady") if (cannonclient ~= nil and ready ~= nil and ready == true) then self:ActivityStateChangeRequest{wsStringValue='clientready'} --Notify the server we're ready to enter the activity end end function onNotifyClientObject(self,msg) if msg.name == "storeCannonClient" then storeObjectByName(self,"Cannon_ClientOBJ", msg.paramObj ) checkEverythingReady(self) end end function onNotifyClientZoneObject(self,msg) if msg.name == "game_timelimit" then self:SetVar("timelimit", msg.param1 ) elseif msg.name == "ClientZone_SetNextBest" then self:SetVar("NextBest", msg.paramStr) elseif msg.name == "beatHighScore" then if self:GetVar("NextBest") ~= "nil" then --print("next Best **************** ".. self:GetVar("NextBest").." My Score: ==== "..tonumber(msg.paramStr)) --[[ if tonumber(msg.paramStr) > tonumber(self:GetVar("NextBest")) then ----print("Sending msg to Cannon Client") local cannonclient = getObjectByName(self, "Cannon_ClientOBJ") --print("Name of cannonclient"..tostring(cannonclient)) cannonclient:NotifyObject{ name = "beatHighScore" ,ObjIDSender = self} end --]] end elseif msg.name == "UI_Score" then -- Update the end score board local var = split(msg.paramStr, ",") UI:SendMessage( "ScoreUI", {{"totalScore", var[1] } , {"waveScore1", var[2] } ,{"waveScore2", var[3] }, {"waveScore3", var[4] },{"numShots", var[5] } ,{"numKills", var[6] } ,{"longestStreak", var[7] }} ) elseif msg.name =="UI_Rewards" then local var = split(msg.paramStr, ",") ----print("Money>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "..var[1]) UI:SendMessage("SetRewards", {{"money", var[1]},{"item1Name", var[2]} ,{"item1Image", var[3]} ,{"item1StackSize", ""} ,{"item2Name", var[5]} ,{"item2Image", var[6]} ,{"item2StackSize", ""} } ) UI:SendMessage( "ToggleScore", {{"toggleMenu", true }} ) self:SetVar("TotalScore", 0 ) elseif msg.name == "Clear" then UI:SendMessage("ResetUI", { {"reseting", true } }) UI:SendMessage("StreakUI", { {"sgHideStreak", true } ,{"sgStreak", "0" }}) elseif msg.name == "wave" then UI:SendMessage("ChageUI", { {"sgWave", tostring(msg.param1) } }) elseif msg.name =="updatescore" then --print("Z Client ".. tostring(msg.param1)) local cannonclient = getObjectByName(self, "Cannon_ClientOBJ") cannonclient:NotifyObject{ name = "currentScore" , param2 = msg.param1} self:SetVar("TotalScore", tostring(msg.param1)) UI:SendMessage("ChageUI", { {"sgScore", tostring(msg.param1) } }) elseif msg.name == "exit" then UI:SendMessage( "popGameState", {{"state", "shootinggallery" }} ) UI:SendMessage("ToggleScore", { {"ToggleScore", true } }) UI:SendMessage("HideScoreBoard", { {"sgHide", true } }) elseif msg.name == "showloadingUI" then UI:SendMessage("ToggleInstanceStart", { {"visible", true } }) elseif msg.name == "ShowStreak" then UI:SendMessage("StreakUI", { {"sgStreak", msg.paramStr } ,{"sgHideStreak", false }}) elseif msg.name == "HideStreak" then UI:SendMessage("StreakUI", {{"sgHideStreak", true }} ) elseif msg.name == "Audio_Start_Intro" then GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Game-Over" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Intro" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Core" } UI:SendMessage("HideUI", { {"sgHide", false }}) self:FireEventServerSide{args = "CannonStored"} elseif msg.name == "Audio_Final_Wave_Done" then UI:SendMessage("HideUI", { {"sgHide", true }}) GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Core" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Game-Over" } elseif msg.name == "Audio_Exit" then GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Game-Over" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Intro" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Core" } elseif msg.name == "SuperChargeBar" then UI:SendMessage("SuperChargUI", { {"scBar", msg.paramStr } } ) elseif msg.name == "charge_counting" then UI:SendMessage("SuperChargUI", { {"scDeCharge", tostring(msg.param1) } } ) elseif msg.name == "mHit" then -- mulit hIt -- params.multiHit Boolean UI:SendMessage("UpdateSG", { {"multiHit", true } } ) elseif msg.name == "hitFriend" then -- Hit Friend params.friendlyHit Boolean UI:SendMessage("UpdateSG", { {"friendlyHit", true } } ) elseif msg.name == "targetEscaped" then -- target escaped play area, used for Duck SG: params.targetEscaped Boolean; mrb... UI:SendMessage("UpdateSG", { {"targetEscaped", true } } ) elseif msg.name == "cStreak" then -- current Streak params.streakCoun UI:SendMessage("UpdateSG", { {"streakCount", msg.paramStr } } ) elseif msg.name == "Mark1" then UI:SendMessage("ChageUI", { {"sgFeedBack1", true } } ) elseif msg.name == "Mark2" then UI:SendMessage("ChageUI", { {"sgFeedBack2", true } } ) elseif msg.name == "Mark3" then UI:SendMessage("ChageUI", { {"sgFeedBack3", true } } ) elseif msg.name == "UnMarkAll" then UI:SendMessage("ChageUI", { {"sgFeedBackUnMark", true } } ) elseif msg.name == "HideScoreBoard" then --UI:SendMessage("HideUI", { {"sgHide", true } }) UI:SendMessage("HideUI", { {"sgHide", true } }) UI:SendMessage("ChageUI", { {"sgTimer", " " } }) elseif msg.name == "modelPercent" then UI:SendMessage("UpdateSG", { {"modelPercent", msg.paramStr } } ) elseif msg.name == "rewardAdded" then local rewards = self:GetVar("rewardModels") if rewards then table.insert(rewards, msg.param1) else rewards = {msg.param1} end self:SetVar("rewardModels", rewards) end end function onShutdown(self, msg) self:SetVar("TotalScore", 0 ) UI:SendMessage( "popGameState", {{"state", "shootinggallery" }} ) UI:SendMessage("ToggleScore", { {"ToggleScore", true } }) UI:SendMessage("HideUI", { {"sgHide", true } }) UI:SendMessage("EmbedUI", { {"sgembed", true } } ) end function onStartModelVisualization(self, msg) self:SetVar("modelVisIndex", 1) self:SetVar("modelPosX", msg.x1) self:SetVar("bagPosX", msg.x2) self:SetVar("modelPosY", msg.y1) self:SetVar("bagPosY", msg.y2) self:SetVar("modelWidth", msg.width1) self:SetVar("bagWidth", msg.width2) local rewards = self:GetVar("rewardModels") if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) end end function onChildRenderComponentReady(self, msg) if self:GetVar("currentDisplayModelLOT") and msg.childLOT == self:GetVar("currentDisplayModelLOT") then msg.childID:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("modelPosX"), y = self:GetVar("modelPosY")}, effectType = "flytoscreen", effectID = 595, boxExtents = self:GetVar("modelWidth")} GAMEOBJ:GetTimer():AddTimerWithCancel( 4 , "flytimer", self ) playChestAnimation(self) storeObjectByName(self, "currentDisplayModel", msg.childID) end end function onTimerDone(self, msg) if msg.name == "flytimer" then local visObj = getObjectByName(self, "currentDisplayModel") visObj:SetPosition{pos = visObj:GetSubNodePosition{}.pos} visObj:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("bagPosX"), y = self:GetVar("bagPosY")}, effectType = "flytobag", effectID = 595, boxExtents = self:GetVar("bagWidth"), bUseInitialScale = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.25 , "endTimer", self ) elseif msg.name == "endTimer" then removeFXObject(self) if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) self:SetVar("rewardModels", nil) local test = self:GetVar("rewardModels") for i =1, #test do self:SetVar("rewardModels."..i.."", nil) end end end end function removeFXObject(self) if self:GetVar("currentDisplayModel") ~= "0" then GAMEOBJ:DeleteObject(getObjectByName(self, "currentDisplayModel")) self:SetVar("currentDisplayModel", "0") end end function createNextVisObject(self) local rewards = self:GetVar("rewardModels") local index = self:GetVar("modelVisIndex") if rewards and index <= #rewards then local grp = self:GetObjectsInGroup{ignoreSpawners=true,group = "ChestGroup" }.objects for i, obj in pairs(grp) do local pos = obj:GetPosition().pos self:SetVar("currentDisplayModelLOT", rewards[index]) RESMGR:LoadObject{ objectTemplate = rewards[index], x = pos.x, y = pos.y, z = pos.z, owner = self} self:SetVar("modelVisIndex", self:GetVar("modelVisIndex") + 1) end else return false end return true end function playChestAnimation(self) local chestObjects = self:GetObjectsInGroup{group = "ChestGroup", ignoreSpawners = true}.objects if #chestObjects > 0 then for index, chest in pairs(chestObjects) do chest:PlayAnimation{animationID = "open"} end else print("ERROR: Failed to find chest object.") end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') require('ai/MINIGAME/SG_GF/L_GF_SG') -- @TODO: Add Path Changing on waypoint, need to get [Closest Waypoint on New Path] -- Also need [Number of Waypoints on Path] -- @TODO: Optimize -------------------------------------------------------------- -- Locals and Constants LOCALS = {} CONSTANTS = {} STORECONSTANTS = {} -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS["PLAYER_START_POSx"] = -908.542480 CONSTANTS["PLAYER_START_POSy"] = 229.773178 CONSTANTS["PLAYER_START_POSz"] = -908.542480 CONSTANTS["PLAYER_START_ROTw"] = 0.91913521289825 CONSTANTS["PLAYER_START_ROTx"] = 0 CONSTANTS["PLAYER_START_ROTy"] = 0.39394217729568 CONSTANTS["PLAYER_START_ROTz"] = 0 -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 7583 CONSTANTS["IMPACT_SKILLID"] = 396 CONSTANTS["PROJECTILE_TEMPLATEID"] = 7833 CONSTANTS["CANNON_PLAYER_OFFSETx"] = 6.652 CONSTANTS["CANNON_PLAYER_OFFSETy"] = 0 CONSTANTS["CANNON_PLAYER_OFFSETz"] = -1.188 CONSTANTS["Reward_Model_Matrix"] = 157 CONSTANTS["CANNON_VELOCITY"] = 220.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 130.0 CONSTANTS["CANNON_REFIRE_RATE"] = 400 --800 CONSTANTS["CANNON_BARREL_OFFSETx"] = 0 CONSTANTS["CANNON_BARREL_OFFSETy"] = 4.3 CONSTANTS["CANNON_BARREL_OFFSETz"] = 9 CONSTANTS["CANNON_SUPER_CHARGE"] = 7849 CONSTANTS["CANNON_PROJECTILE"] = 1822 CONSTANTS["CANNON_SUPERCHARGE_SKILL"] = 398 CONSTANTS["CANNON_SKILL"] = 397 CONSTANTS["CANNON_TIMEOUT"] = -1 CONSTANTS["CANNON_FOV"] = 25 --26 CONSTANTS["CANNON_USE_LEADERBOARDS"] = true CONSTANTS["STREAK_MOD"] = 2 -- for Animations STORECONSTANTS["VALID_ACTORS"] = {3109, 3110, 3111, 3112, 3125, 3126} STORECONSTANTS["STREAK_BONUS"] = {1,2,5,10} STORECONSTANTS["VALID_EFFECTS"] = {3122} -- Super Charger is charged for this amount of time CONSTANTS["ChargedTime"] = 10 -- The amount of points needed to supper charge CONSTANTS["ChargedPoints"] = 25000 -- Modle reward grp name CONSTANTS["Reward_Model_GrpName"] = "QBRewardGroup" -- Activity ID CONSTANTS["ActivityID"] = 7583 -- Activity ID -- Reward Score and Loot Matrix\ -- 1 CONSTANTS["Score_Reward_1"] = 50000 CONSTANTS["Score_LootMatrix_1"] = 279 -- 2 CONSTANTS["Score_Reward_2"] = 100000 CONSTANTS["Score_LootMatrix_2"] = 280 -- 3 CONSTANTS["Score_Reward_3"] = 200000 CONSTANTS["Score_LootMatrix_3"] = 281 -- 4 CONSTANTS["Score_Reward_4"] = 400000 CONSTANTS["Score_LootMatrix_4"] = 282 -- 5 CONSTANTS["Score_Reward_5"] = 800000 CONSTANTS["Score_LootMatrix_5"] = 283 local targetEscapedValue = -1000 ACTORS = {} -- stores actors for the instance EFFECTS = {} -- stores effects for the instance -------------------------------------------------------------- -- Wave Data waves = {} PLAYER_SCORE = {} -------------------------------------------------------------- -- Syntax: [Time] [Text to Show Player] -------------------------------------------------------------- AddWave(waves, 30.0, "Wave;One" ) AddWave(waves, 30.0, "Wave;Two" ) AddWave(waves, 30.0, "Wave;Three" ) -- wave constants STORECONSTANTS["NUM_WAVES"] = #waves CONSTANTS["FIRST_WAVE_START_TIME"] = 4.0 CONSTANTS["IN_BETWEEN_WAVE_PAUSE"] = 4.0 -------------------------------------------------------------- -- Spawn Data spawns = {} SPAWN_DATA = {} -------------------------------------------------------------- -- Startup do not chaged!!! -------------------------------------------------------------- function onStartup(self) targetSettings(self) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 self:SetVar("StreakBouns",0) self:SetVar("StopCharge", false ) self:SetVar("NumberOfCharges", 0 ) wave1Score = 0 wave2Score = 0 wave3Score = 0 self:SetVar("WaveStatus", true) self:SetVar("StreakBouns", 0) setCONSTANTS( self,spawns,SPAWN_DATA,CONSTANTS , waves, PLAYER_SCORE, EFFECTS , ACTORS,STORECONSTANTS ) self:SetVar("CONSTANTS", CONSTANTS) self:SetVar("timelimit", waves[1].timeLimit) totalscore = 0 end -------------------------------------------------------------- -- target Settings -------------------------------------------------------------- function targetSettings(self) -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- AddSpawn - configures data for the spawn and adds it. Can -- only have one. -- Syntax: AddSpawn(spawn, paths, [Template ID], -- [Initial Spawn Time Min], [Initial Spawn Time Max], [Does Respawn], -- [Respawn Time Min], [Respawn Time Max], -- [Initial Speed], [Score], [Change Speed at Waypoints], -- [Chance to Change Speed], [Min Speed], [Max Speed], -- [Is Moving Platform], [Despawn On Last Waypoint], [Time Score]) -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} -------------------------------------------------------------- -- Ducks 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_1") AddPath(paths, "Row_2_Ducks_1") AddPath(paths, "Row_3_Ducks_1") AddSpawn(spawn,paths, 6920, 0.0, 1.0, true, 2.0, 8.0, 2.0, 1500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_2_Ducks_3") AddPath(paths, "Row_3_Ducks_3") AddSpawn(spawn,paths, 6919, 0.0, 1.0, true, 2.0, 8.0, 10.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_1") AddPath(paths, "Row_2_Ducks_2") AddPath(paths, "Row_3_Ducks_3") AddSpawn(spawn,paths, 6920, 0.0, 2.0, true, 2.0, 8.0, 2.0, 1500, true, 0.5, 1.0, 3.0, true, true, 0.0) -- Ducks 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_3") AddPath(paths, "Row_2_Ducks_3") AddPath(paths, "Row_3_Ducks_3") AddSpawn(spawn,paths, 6918, 1.0, 3.0, true, 2.0, 8.0, 10.0, 1000, true, 0.5, 1.0, 3.0, true, true, 0.0) -- Bulls Eye -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_2_5") AddPath(paths, "Mid_Row_3_5") AddSpawn(spawn,paths, 7801, 15.0, 20.0, false, 10.0, 15.0, 1.0, 5000, false, 0.0, 1.0, 1.0, true, true, 0.0) --************************************************************ -------------------------------------------------------------- -- Friendly 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_1_1") AddPath(paths, "Mid_Row_1_2") AddPath(paths, "Mid_Row_1_3") AddPath(paths, "Mid_Row_1_4") AddSpawn(spawn,paths, 7800, 1.0, 8.0, false, 2.0, 8.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly 2 ---------------------------------------------------------- paths = {} ---------------------------------------------------------- AddPath(paths, "Mid_Row_2_1") AddPath(paths, "Mid_Row_2_2") AddPath(paths, "Mid_Row_2_3") AddPath(paths, "Mid_Row_2_4") AddSpawn(spawn,paths, 7800, 5.0, 12.0, false, 2.0, 8.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_3_1") AddPath(paths, "Mid_Row_3_2") AddSpawn(spawn,paths, 7800, 10.0, 18.0, false, 2.0, 8.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly 4 ---------------------------------------------------------- paths = {} ---------------------------------------------------------- AddPath(paths, "Mid_Row_3_3") AddPath(paths, "Mid_Row_3_4") AddSpawn(spawn,paths, 7800, 15.0, 20.0, false, 2.0, 8.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 2 Spawns spawn = {} -------------------------------------------------------------- -- Ducks 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_1") AddPath(paths, "Row_2_Ducks_1") AddPath(paths, "Row_3_Ducks_1") AddSpawn(spawn,paths, 6918, 0.0, 1.0, true, 2.0, 8.0, 2.0, 1500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_2") AddPath(paths, "Row_2_Ducks_2") AddPath(paths, "Row_3_Ducks_2") AddSpawn(spawn,paths, 6920, 0.0, 1.0, true, 2.0, 8.0, 2.0, 500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_3") AddPath(paths, "Row_2_Ducks_3") AddPath(paths, "Row_3_Ducks_3") AddPath(paths, "Row_Switch_2_1") AddPath(paths, "Row_Switch_2_1") AddSpawn(spawn,paths, 6919, 0.0, 2.0, true, 2.0, 8.0, 10.0, 1000, true, 0.25, 1.0, 3.0, true, true, 0.0) -- Ducks 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_1") AddPath(paths, "Row_2_Ducks_1") AddPath(paths, "Row_3_Ducks_1") AddSpawn(spawn,paths, 6918, 0.0, 2.0, true, 2.0, 8.0, 2.0, 1500, true, 0.25, 1.0, 4.0, true, true, 0.0) -- Ducks 5 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_2") AddPath(paths, "Row_2_Ducks_2") AddPath(paths, "Row_3_Ducks_2") AddSpawn(spawn,paths, 6920, 1.0, 3.0, true, 2.0, 8.0, 2.0, 500, true, 0.5, 1.0, 3.0, true, true, 0.0) -- Ducks 6 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_3") AddPath(paths, "Row_2_Ducks_3") AddPath(paths, "Row_3_Ducks_3") AddPath(paths, "Row_Switch_2_2") AddPath(paths, "Row_Switch_2_2") AddSpawn(spawn,paths, 6919, 1.0, 4.0, true, 2.0, 8.0, 10.0, 1000, true, 0.75, 0.5, 4.0, true, true, 0.0) -- Bulls Eye -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_1_3") AddPath(paths, "Mid_Row_2_5") AddPath(paths, "Mid_Row_3_5") AddSpawn(spawn,paths, 7801, 1.0, 8.0, false, 10.0, 15.0, 1.0, 5000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Bulls Eye 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_2_7") AddPath(paths, "Mid_Row_3_7") AddPath(paths, "Mid_Row_1_7") AddPath(paths, "Mid_Row_2_6") AddPath(paths, "Mid_Row_3_6") AddPath(paths, "Mid_Row_1_6") AddSpawn(spawn,paths, 7801, 10.0, 15.0, false, 10.0, 15.0, 5.0, 5000, false, 0.0, 1.0, 1.0, true, true, 0.0) --************************************************************ -------------------------------------------------------------- -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_1_1") AddPath(paths, "Mid_Row_1_2") AddPath(paths, "Mid_Row_1_3") AddPath(paths, "Mid_Row_1_4") AddSpawn(spawn,paths, 7800, 10.0, 18.0, false, 10.0, 15.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_2_1") AddPath(paths, "Mid_Row_2_2") AddPath(paths, "Mid_Row_2_3") AddPath(paths, "Mid_Row_2_4") AddSpawn(spawn,paths, 7800, 21.0, 27.0, false, 10.0, 15.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_3_1") AddPath(paths, "Mid_Row_3_2") AddSpawn(spawn,paths, 7800, 1.0, 8.0, false, 2.0, 4.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly 4 ---------------------------------------------------------- paths = {} ---------------------------------------------------------- AddPath(paths, "Mid_Row_3_3") AddPath(paths, "Mid_Row_3_4") AddSpawn(spawn,paths, 7800, 5.0, 10.0, false, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 3 Spawns spawn = {} -------------------------------------------------------------- -- Ducks 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_1") AddPath(paths, "Row_2_Ducks_1") AddPath(paths, "Row_3_Ducks_1") AddSpawn(spawn,paths, 6919, 0.0, 2.0, true, 2.0, 8.0, 2.0, 1500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_2") AddPath(paths, "Row_2_Ducks_2") AddPath(paths, "Row_3_Ducks_2") AddSpawn(spawn,paths, 6918, 0.0, 2.0, true, 2.0, 8.0, 2.0, 500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_3") AddPath(paths, "Row_2_Ducks_3") AddPath(paths, "Row_3_Ducks_3") AddSpawn(spawn,paths, 6920, 0.0, 2.0, true, 2.0, 8.0, 10.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_4") AddPath(paths, "Row_2_Ducks_4") AddPath(paths, "Row_3_Ducks_4") AddSpawn(spawn,paths, 6919, 0.0, 2.0, true, 2.0, 8.0, 10.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Ducks 5 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_3") AddPath(paths, "Row_2_Ducks_3") AddPath(paths, "Row_3_Ducks_3") AddPath(paths, "Row_Switch_2_1") AddPath(paths, "Row_Switch_2_1") AddSpawn(spawn,paths, 6919, 0.0, 2.0, true, 2.0, 8.0, 10.0, 1000, true, 0.25, 1.0, 3.0, true, true, 0.0) -- Ducks 6 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_1") AddPath(paths, "Row_2_Ducks_1") AddPath(paths, "Row_3_Ducks_1") AddPath(paths, "Row_Switch_2_2") AddPath(paths, "Row_Switch_2_2") AddSpawn(spawn,paths, 6918, 0.0, 2.0, true, 2.0, 8.0, 5.0, 1500, true, 0.25, 1.0, 4.0, true, true, 0.0) -- Ducks 7 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_2") AddPath(paths, "Row_2_Ducks_2") AddPath(paths, "Row_3_Ducks_2") AddPath(paths, "Row_Switch_1_1") AddPath(paths, "Row_Switch_1_1") AddSpawn(spawn,paths, 6920, 1.0, 3.0, true, 2.0, 8.0, 5.0, 500, true, 0.5, 1.0, 3.0, true, true, 0.0) -- Ducks 8 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Row_1_Ducks_3") AddPath(paths, "Row_2_Ducks_3") AddPath(paths, "Row_3_Ducks_3") AddPath(paths, "Row_Switch_1_2") AddPath(paths, "Row_Switch_1_2") AddSpawn(spawn,paths, 6919, 1.0, 4.0, true, 2.0, 8.0, 10.0, 1000, true, 0.75, 0.5, 4.0, true, true, 0.0) -- Bulls Eye -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_2_5") AddPath(paths, "Mid_Row_1_5") AddSpawn(spawn,paths, 7801, 5.0, 10.0, false, 10.0, 15.0, 1.0, 5000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Bulls Eye 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_2_7") AddPath(paths, "Mid_Row_1_7") AddSpawn(spawn,paths, 7801, 10.0, 15.0, false, 10.0, 15.0, 5.0, 5000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Bulls Eye 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_2_6") AddPath(paths, "Mid_Row_1_6") AddSpawn(spawn,paths, 7801, 15.0, 20.0, false, 10.0, 15.0, 5.0, 5000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Bonus ---------------------------------------------------------- paths = {} ---------------------------------------------------------- AddPath(paths, "Upper_1_1") AddPath(paths, "Upper_1_2") AddSpawn(spawn,paths, 5877, 18.0, 20.0, false, 0, 2, 2.0, 10000, false, 0.0, 1.0, 1.0, true, true, 0.0) --************************************************************ -------------------------------------------------------------- -- Friendly 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_1_1") AddPath(paths, "Mid_Row_1_2") AddSpawn(spawn,paths, 7800, 0.0, 5.0, false, 10.0, 15.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -------------------------------------------------------------- -- Friendly 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_1_3") AddPath(paths, "Mid_Row_1_4") AddSpawn(spawn,paths, 7800, 10.0, 15.0, false, 10.0, 15.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -------------------------------------------------------------- -- Friendly 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_2_1") AddPath(paths, "Mid_Row_2_2") AddSpawn(spawn,paths, 7800, 20.0, 25.0, false, 10.0, 15.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -------------------------------------------------------------- -- Friendly 4 -------------------------------------------------------------- paths = {} ---------------------------------------------------------- AddPath(paths, "Mid_Row_2_3") AddPath(paths, "Mid_Row_2_4") AddSpawn(spawn,paths, 7800, 5.0, 12.0, false, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -------------------------------------------------------------- -- Friendly 5 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Mid_Row_3_1") AddPath(paths, "Mid_Row_3_2") AddSpawn(spawn,paths, 7800, 12.0, 18.0, false, 2.0, 4.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -------------------------------------------------------------- -- Friendly 6 ---------------------------------------------------------- paths = {} ---------------------------------------------------------- AddPath(paths, "Mid_Row_3_3") AddPath(paths, "Mid_Row_3_4") AddSpawn(spawn,paths, 7800, 18.0, 22.0, false, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) end ---------------------------------------------------------------------------------------------------------------------------- -- Do not Chage -- ---------------------------------------------------------------------------------------------------------------------------- function targetEscaped(self) self:NotifyClientZoneObject{ name= "targetEscaped"} local tempScore = m_totalscore + targetEscapedValue -- if the current score + the modifier is less than 0 then we aren't going to reduce the score if tempScore < 0 then return end m_totalscore = tempScore local cannon = getObjectByName("cannonObject") cannon:NotifyClientObject{ name = "updateScore", param1 = m_totalscore } self:NotifyClientZoneObject{ name= "updatescore", param1= tonumber(m_totalscore)} end function setReticule(self) local cannon = getObjectByName("cannonObject") --print('setReticule') cannon:SetShootingGalleryReticuleEffect{inRangeType = "inRange3", cooldownType = "sgCoolDownSmall"} self:SetVar("ReticuleSet", true) end function onFireEventServerSide(self, msg) if msg.args == "CannonStored" and not self:GetVar("ReticuleSet") then setReticule(self) end end function onPlayerLoaded(self, msg) if (msg) then mainPlayerLoaded(self, msg) end end function onObjectLoaded(self, msg) if (msg) then mainObjectLoaded(self, msg) end end function onNotifyObject(self, msg) if( msg) then if (msg.name == "FinishedPath") and self:GetVar("WaveStatus") then if self:GetVar("lastEscapeID") ~= msg.ObjIDSender:GetID() then local checkPoints = msg.ObjIDSender:GetActivityPoints{}.points self:SetVar("lastEscapeID", msg.ObjIDSender:GetID()) -- check to see if this is not a friendly and remove points from your score if (checkPoints > 0) then targetEscaped(self) end end end mainNotifyObject(self, msg) end end function onPlayerExit( self, msg) if (msg) then mainPlayerExit( self, msg) end end function onShootingGalleryFire(self, msg) if (msg) then mainShootingGalleryFire( self, msg) end end function onStartup(self) end function onNotifyClientObject(self, msg) if msg.name == "RoundTime" then UI:SendMessage("SiegeText", {{"Text", "Preparation Time "}} ) UI:SendMessage("SiegeUI", {{"sgtime", tostring(msg.parama1) }} ) local mySeconds = string.format("%2f", secs-(Math.Floor(secs/60)*60);msg.param1); print(mySeconds) end if msg.name == "ShowHUD" then print("ShowHUD *******************************") UI:SendMessage("SiegeText", {{"UI", "hide" }} ) UI:SendMessage("SiegeUI", {{"UI", "show"}} ) end end function onNotifyClientObject(self, msg) if msg.name == "JoinTime" then if msg.param1 ~= 0 then local time = SecondsToClock(msg.param1 ) UI:SendMessage("SiegeJoin", {{"startTimer", time }} ) else UI:SendMessage("SiegeJoin", {{"startTimer", " " }} ) end end if (msg.name == "RoundTime" and msg.paramStr == "Gate") then local time = SecondsToClock(msg.param1) if (msg.param1 ~= 0) then if msg.param1 < 6 and msg.param1 > 0 then UI:SendMessage("SiegeText", {{"Text", tostring(msg.param1) }} ) else UI:SendMessage("SiegeText", {{"Text", "Preparation Time "..time }} ) end elseif msg.param1 == 0 then UI:SendMessage("SiegeUI_Attack", {{"siege_showhide", "hide" }}) UI:SendMessage("SiegeUI_Defend", {{"siege_showhide", "hide" }}) UI:SendMessage("SiegeText", {{"Text", "reset" }} ) end end if msg.name == "RoundTime" and msg.paramStr == "round" then local time = SecondsToClock(msg.param1) if msg.param1 ~= 0 then UI:SendMessage("SiegeUI", {{"sgtime", time }} ) else UI:SendMessage("SiegeUI", {{"sgtime", " " }} ) end end if msg.name == "ShowHUD" then UI:SendMessage("SiegeText", {{"UI", "hide" }} ) UI:SendMessage("SiegeUI", {{"UI", "show"}} ) end end function SecondsToClock(sSeconds) local nSeconds = sSeconds if nSeconds == 0 then return "00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs end end require('o_mis') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_EVENTS') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_STATES') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_PLAYERLOADED') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_PLAYERDIED') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_SWAPTEAMS') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_NOTIFYOBJECT') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_REWARDS') function onStartup(self) Set = {} -- Basic Game Settings -- --(((((((((((( 1. Enter Level: wait for other players ))))))))))))) Set['GameState'] = "Starting" -- Do Not Change -- Set['Number_Of_Teams'] = 2 -- INT ( Set the number of teams ) Set['Number_Of_PlayersPerTeam'] = 4 -- INT ( Set the number of players on each team ) Set['Rounds_To_Play'] = 2 -- INT ( Set the number of rounds to play ) Set['Minimum_Players_to_Start'] = 2 -- INT ( The min number of players to start game ) Set['Score_To_Complete'] = 3 -- INT ( Set Score to complete a round ) Set['RespawnTime'] = 5 -- INT ( Player Respawn Time after being smashed ) Set['Game_Type'] = "SIEGE" -- INT ( Game Type ) Set['Team_A_Name'] = "Ninjas" Set['Team_B_Name'] = "Pirates" Set['Join_Timer'] = 500 -- Siege Timers Repeats before each round -- Set['Notify_Team_Objectives'] = 1 -- INT(Duration of Help Screen at start of game & between each round) Set['GameStart_CountDown'] = 10 -- INT(Duration of the countdown at the beginning of the game) Set['DefendTime'] = 300 -- INT(Duration of the round) -- End of Round Timers -- Set['State_Results_Timer'] = 15 -- INT(Duration of the Scoreboard at the end of each round) Set['Barrel_Reset'] = 10 -- INT(Time that the barrel takes to return to its spawn after being dropped) Set['Barrel_Speed'] = 350 -- Siege Objects Settings -- Set['QB_Object_Group'] = "qb_objects" -- STRING ( Group name of the QB objects ) Set['QB_Oject_Time'] = 10 -- INT ( Build time of rebuild objects ) Set['QB_Oject_Health'] = 5 -- INT ( Heath of the QB ) Set['QB_Object_LOT'] = 6620 -- LOT ( LOT # of the Main object the attackers are building ) Set['QB_Loot_Object'] = 6600 Set['Gate_Object'] = 6484 -- LOT ( LOT # of Gate) -- Siege Points Set['Info_Text_1'] = " smashed " Set['Info_Text_2'] = " joined the siege!" Set['Info_Text_3'] = " left the siege." Set['Info_Text_4'] = " picked up a barrel!" Set['Info_Text_5'] = " dropped a barrel!" Set['Info_Text_6'] = " returned a barrel!" Set['Info_Text_7'] = " captured a barrel!" -- Round End Messages <<<------Trent add support for these messages Set['Info_Text_8'] = "Your team lost the Round" Set['Info_Text_9'] = "Your team won the Round" Set['Info_Text_10'] = "Your team lost the Match" Set['Info_Text_11'] = "Your team won the Match" -- All Vars are * 1 Set['CapturObj'] = 10 Set['PickUpObj'] = 5 Set['Deaths'] = 0 Set['Kills'] = 1 Set['Build'] = 1 Set['DestroyQB'] = 1 Set['KillObjCarrier'] = 1 Set['RetrunObj'] = 5 Set['WonMatchMultiplier'] = 100 -- End Game Timers Set['WonLoastMatchTimer'] = 5 -- Show Txt Won Lost timer Set['ScoreBoardTimer'] = 5 -- Show Score Board Timer Set['LeaderBoardTimer'] = 5 --(((((((((((( 2. Notify Team Objectives: ))))))))))))) -- Set['Notify_Txt_Team_1'] = "Defend the rebuilds." Set['Notify_Txt_Team_2'] = "Attack and return" --(((((((((((( 4.Prestart Game timer for the Defenders. ))))))))))))) -- Set['Prestart_Time'] = 30 Set['Prestart_Txt_Team_1'] = "You have "..tostring(Set['Prestart_Time']).." seconds to set up defense" Set['Prestart_Txt_Team_2'] = "You have "..tostring(Set['Prestart_Time']).." seconds before attacking" -- SEIGE Object Groups -- Set['Gate_Group'] = "grp_gate" Set['Wall_Group'] = "grp_walls" Set['Mine_Group'] = "grp_mines" -- Player Settings -- Set['CustomPlayer'] = false -- BOOL Set['Health'] = 4 -- INT Set['Armor'] = 2 -- INT Set['Imagination'] = 8 -- INT -- Team Settings -- -- Custom Team Settings color and skills -- Colors are in the database ( dbo_BrickColors ) Set['Use_Themes'] = true -- Bool Set['Use_Skills'] = false -- Bool --- Team 1 --- Set['Team_Color_1'] = 1 -- --- ATK Skills --- Set['Team_Skill_A_1'] = nil -- Set['Team_Skill_B_1'] = nil -- Set['Team_Skill_C_1'] = nil -- Set['Team_Skill_D_1'] = nil -- Set['Team_Skill_E_1'] = nil -- --- Team 2 --- Set['Team_Color_2'] = 0 -- --- ATK Skills --- Set['Team_Skill_A_2'] = nil -- Set['Team_Skill_B_2'] = nil -- Set['Team_Skill_C_2'] = nil -- Set['Team_Skill_D_2'] = nil -- Set['Team_Skill_E_2'] = nil -- --- Game Object Lots --- Set['Number_of_Spawn_Groups'] = 1 --INT Set['Red_Spawners'] = 4847 Set['Blue_Spawners'] = 4848 Set['Blue_Flag'] = 4850 Set['Red_Flag'] = 4851 Set['Red_Point'] = 4846 Set['Blue_Point'] = 4845 Set['Red_Mark'] = 4844 Set['Blue_Mark'] = 4843 Set['WhatTeam'] = "A" ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) self:SetNetworkVar("Set",Set) oStart(self) end function onNotifyObject(self, msg) if( msg) then mainNotifyObject(self, msg) end end function onObjectLoaded(self, msg) if (msg) then mainObjectLoaded(self, msg) end end function onChildLoaded(self, msg) if (msg) then mainChildLoaded(self, msg) end end -------------------------------------------------------------------------------- require('o_mis') function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetColor{iLEGOColorID =192} end CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" require('o_mis') function onStartup(self) -- GAMEOBJ:GetZoneControlID():NotifyObject{ name="Barrel_Loaded", ObjIDSender = self } self:SetVar("PickUpReady", false) GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "ReadyToBePickedUp", self ) -- print( tostring(self:GetVar("taken_name")) ) if self:GetVar("AtHomePoint") == false then GAMEOBJ:GetTimer():AddTimerWithCancel( GAMEOBJ:GetZoneControlID():GetVar("Set.Barrel_Reset") , "ReturnToHomePoint" , self ) end end function checkBrick(player) for i =0, player:GetInventorySize{inventoryType = 4 }.size do if player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i, inventoryType = 4 }.itemID:GetLOT{}.objtemplate == GAMEOBJ:GetZoneControlID():GetVar("Set.QB_Loot_Object") then return true end end end end function onCollisionPhantom(self, msg) local lootID = GAMEOBJ:GetZoneControlID():GetVar("Set.QB_Loot_Object") local target = msg.objectID local faction = target:GetFaction() local team = GAMEOBJ:GetZoneControlID():MiniGameGetTeam{playerID = target }.teamID if self:GetVar("PickUpReady") and team == 2 then local brickcheck = checkBrick(target) if not brickcheck then GAMEOBJ:GetTimer():CancelAllTimers( self ) target:HideEquipedWeapon() self:Die{ killerID = msg.playerID, killType = "SILENT" } self:SetVar("bIsDead", true) itemMsg = target:AddNewItemToInventory{ invType = 4, iObjTemplate = lootID } target:EquipInventory{ itemtoequip = itemMsg.newObjID } target:SetSkillRunSpeed{Modifier = GAMEOBJ:GetZoneControlID():GetVar("Set.Barrel_Speed") } DoObjectAction(target, "effect", "godlight") for i = 1, 3 do if self:GetVar("taken_name") == "Blue_Point_"..i then itemMsg.newObjID:SetVar("taken_name","Blue_Point_"..i) end end itemMsg.newObjID:NotifyObject{name= "EQ"} GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SetAnimationSet" , paramStr = "carry" , paramObj = target } GAMEOBJ:GetZoneControlID():NotifyObject{ name = "removeBarrel" , ObjIDSender = self} -- Show UI Button GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "ShowDropButton" , rerouteID = target } local str = target:GetName().name..GAMEOBJ:GetZoneControlID():GetVar("Set.Info_Text_4") GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = str } end end if self:GetVar("PickUpReady") and team == 1 and not self:GetVar("AtHomePoint") then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = msg.playerID, killType = "SILENT" } local obj = getObjectByName( GAMEOBJ:GetZoneControlID(), self:GetVar("taken_name") ) local bluepos = obj:GetPosition().pos local config = { {"AtHomePoint", true }, {"taken_name",self:GetVar("taken_name")} } RESMGR:LoadObject { owner = GAMEOBJ:GetZoneControlID(), objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.QB_Object_LOT") , x= bluepos.x, y= bluepos.y , z= bluepos.z, configData = config } GAMEOBJ:GetZoneControlID():MiniGameAddPlayerScore{playerID = target, scoreType = 4, score = 1 } -- retrun GAMEOBJ:GetZoneControlID():NotifyObject{name = "UpdateScore" } local str = target:GetName().name..GAMEOBJ:GetZoneControlID():GetVar("Set.Info_Text_6") GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = str } end end -------------------------------------------------------------- -- object notification -------------------------------------------------------------- function onNotifyObject( self, msg ) if ( msg.name == "unequip" ) then self:UnEquipItem{ bImmediate = true } end if ( msg.name == "killself" ) then self:Die{ killerID = msg.playerID, killType = "SILENT" } end GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "ReturnToHomePoint" , self ) end function onTimerDone(self,msg) if msg.name == "ReadyToBePickedUp" then self:SetVar("PickUpReady", true) end if msg.name == "ReturnToHomePoint" then self:Die{ killerID = msg.playerID, killType = "SILENT" } local obj = getObjectByName( GAMEOBJ:GetZoneControlID(), self:GetVar("taken_name") ) local bluepos = obj:GetPosition().pos local config = { {"AtHomePoint", true }, {"taken_name",self:GetVar("taken_name")} } RESMGR:LoadObject { owner = GAMEOBJ:GetZoneControlID(), objectTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.QB_Object_LOT") , x= bluepos.x, y= bluepos.y , z= bluepos.z, configData = config } end endfunction onBouncePlayer(self, msg) if (msg) then end end function onBouncerTriggered(self, msg) if (msg) then end end function onBounceNotification(self, msg) if (msg) then end end function onBounceSucceeded(self, msg) if (msg) then end end function onStartup(self) print(" Bouncer Startup") if foo == foo then end endrequire('o_mis') function onStartup(self) self:ModifyHealth{amount = 10} self:SetRebuildState{iState = 2 } end function onRebuildNotifyState(self, msg) if (msg.iState == 4 ) then local loc = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = 6601 , x= loc.x , y= loc.y , z= loc.z , owner = self } local faction = self:GetFaction{}.faction end end ------------------------------------------------------ --Script for the defending team's gates ------------------------------------------------------ local interactRadius = 10 function onStartup(self) --print("gate starting up") self:SetVar("RebuildComplete", false) self:SetProximityRadius { radius = interactRadius } end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then --print("Rebuild complete") self:SetVar("RebuildComplete", true) end end function onProximityUpdate(self, msg) --print("proximity updated") local target = msg.objId local isHuman = msg.objId:IsCharacter().isChar if (msg.status == "ENTER") and (isHuman) and (self:GetVar("RebuildComplete") == true) and (target:CheckPrecondition{PreconditionID = 28}.bPass == true) then --print("raising the gate!") self:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} elseif (msg.status == "LEAVE") and (isHuman) and (self:GetVar("RebuildComplete") == true) and (target:CheckPrecondition{PreconditionID = 28}.bPass == true) then --print("lowering the gate!") self:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end------------------------------------------------------ --Script for the mines ------------------------------------------------------ local interactRadius = 20 function onStartup(self) --print("mine starting up") self:SetVar("RebuildComplete", false) self:SetProximityRadius { radius = interactRadius } end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then --print("Rebuild complete") self:SetVar("RebuildComplete", true) end end function onProximityUpdate(self, msg) local target = msg.objId local isHuman = msg.objId:IsCharacter().isChar if (msg.status == "ENTER") and (isHuman) and (self:GetVar("RebuildComplete") == true) and (target:CheckPrecondition{PreconditionID = 29}.bPass == true) then --print("Mine exploded!") self:CastSkill{skillID = 163, optionalTargetID = msg.objId} self:PlayFXEffect{name = "cannonbig", effectID = 71, effectType = "onfire_large"} self:Die() else --print("Wrong team!") end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) self:AddObjectToGroup{group = "SpiderDen"} Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then --print("*******AI ENABLED*******") self:SetFaction{faction = 106} setState("AiEnable",self) ProximityPuls(self) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) or (object:GetLOT().objtemplate == 6539) then object:NotifyObject{name = "killQBTurret1", ObjIDSender = self} end end end end function onDie(self, msg) print("turret down!") local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) or (object:GetLOT().objtemplate == 6539) then object:NotifyObject{name = "dontShootQBTurret1", ObjIDSender = self} end end end -------------------------------------------------------------- -- Render Ready -------------------------------------------------------------- function onRenderComponentReady( self, msg ) self:EquipItem{ bImmediate = true } print("sssssssssssssssssssssssssssssssssssssssssssssss"") end -------------------------------------------------------------- -- object notification -------------------------------------------------------------- function onNotifyClientObject( self, msg ) if ( msg.name == "equip" ) then self:EquipItem{ bImmediate = true } print("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"") -- GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkForDone", self ) end end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "checkForDone" ) then if ( self:IsItemEquipped{}.isequipped == true ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkForDone", self ) else UnEquip( self ) end end end -------------------------------------------------------------- -- make sure this equippable never shows up on the player again -------------------------------------------------------------- function UnEquip( self ) self:ClearItemsOwner{} end function onUnEquipItem(self, msg) local player = self:GetItemOwner{}.ownerID if (msg) then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "reSetAnimationSet" , paramObj = player } end end function onNotifyObject(self,msg) local player = self:GetItemOwner{}.ownerID GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SetAnimationSet" , paramStr = "carry" , paramObj = player } end function onStartup(self) print( tostring(self:GetVar("taken_name")) ) end -- REBUILD NOTIFY function onRebuildNotifyState(self, msg) if (msg.iState) == 3 then print("State Competed by "..msg.player:GetName().name) GAMEOBJ:GetZoneControlID():NotifyObject{name = "reBuild" , ObjIDSender = msg.player } end end function onDie(self,msg) if msg.killerID ~= nil then print("I was killed by "..msg.killerID:GetName().name) GAMEOBJ:GetZoneControlID():NotifyObject{name = "SmashQB" , ObjIDSender = msg.killerID } end end require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function onCollisionPhantom(self, msg) local player = msg.senderID if (msg and removeBrick( player) ) then print("Brick Removed") end end function removeBrick( player) for i =0, player:GetInventorySize{inventoryType = 4 }.size do if player:GetInventoryItemInSlot{slot = i, inventoryType = 4 }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i ,inventoryType = 4 }.itemID:GetLOT{}.objtemplate == GAMEOBJ:GetZoneControlID():GetVar("Set.QB_Loot_Object") then local item = player:GetInventoryItemInSlot{slot = 1 ,inventoryType = 4 }.itemID player:GetInventoryItemInSlot{slot = i ,inventoryType = 4 }.itemID:UnEquipItem{bImmediate = true} player:RemoveItemFromInventory{eInvType = 4 , iObjTemplate = GAMEOBJ:GetZoneControlID():GetVar("Set.QB_Loot_Object") } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "reSetAnimationSet" , paramObj = player } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "HideDropButton" , rerouteID = player } GAMEOBJ:GetZoneControlID():NotifyObject{name = "Captured_Object" , paramObj = target } GAMEOBJ:GetZoneControlID():MiniGameAddPlayerScore{playerID = player, scoreType = 3, score = 1} -- Capts GAMEOBJ:GetZoneControlID():NotifyObject{name = "UpdateScore" } DoObjectAction(player, "stopeffects", "godlight") local str = player:GetName().name..GAMEOBJ:GetZoneControlID():GetVar("Set.Info_Text_7") GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = str } player:SetSkillRunSpeed{Modifier = 500 } return true end end end end CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function oStart(self) GAMEOBJ:GetZoneControlID():SetActivityParams{activityID = 37, activityActive = true , modifyMaxUsers = true, maxUsers = 8, } Con = {} Con["GameStarted"] = false Con["Red_Spawners"] = 1 Con["Blue_Spawners"] = 1 Con["Red_Flag"] = 1 Con["Blue_Flag"] = 1 Con["Red_Point"] = 1 Con["Blue_Point"] = 1 Con["Red_Mark"] = 1 Con["Blue_Mark"] = 1 Con["Players_loaded"] = 0 Con["Blue_Flag_Home"] = 0 Con["Red_Flag_Home"] = 0 Con["Pre_Counter"] = 0 Con["TeamRoll_1"] = "Defend" Con["TeamRoll_2"] = "Attack" Con["numofcaps"] = 0 Con["TimeToBeat"] = 0 Con["Round"] = 0 Con["Round_1_Time"] = 0 Con["Round_2_Time"] = 0 Con['swapTeams'] = false Con["Round_1_Win"] = false Con["Round_2_Win"] = false Con["Color_Timer"] = false Con["TimerStart"] = false Con["ReadyButton"] = false Con["GameStoredtime"] = self:GetVar("Set.DefendTime") for x = 1, 2 do for i = 1, 4 do Con["Slot_"..i.."_Team_"..x] = "open" end end for i = 1, 2 do for x = 1, 4 do Con["PlayerReady_p"..x.."_t"..i] = false Con["PlayerNotReady_p"..x.."_t"..i] = false Con["PlayerName_p"..x.."_t"..i] = nil end end self:SetVar("Con",Con) self:NotifyClientZoneObject{name = "SetRespawnTime" , param1 = self:GetVar("Set.RespawnTime") } self:SetVar("isMiniGame", "Server") -- Set Game Parameters self:MiniGameSetParameters{numTeams = self:GetVar("Set.Number_Of_Teams") ,playersPerTeam = self:GetVar("Set.Number_Of_PlayersPerTeam") } end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- Won Lost Timer if (msg.name == "WonLostTimer") then -- Hide Won Lost Txt self:NotifyClientZoneObject{ name = "ShowTxt" ,paramStr = " " } -- Show Score Board self:NotifyClientZoneObject{ name = "ShowScoreBoardUI" } -- Start Score Board Timer GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.ScoreBoardTimer") , "ShowRewards", self ) end if (msg.name == "ShowRewards") then self:NotifyClientZoneObject{ name = "SiegeRewards" } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.LeaderBoardTimer") , "ShowLeaderBoard", self ) end -- Start Leader Board -- if (msg.name == "ShowLeaderBoard") then sendLeaderBoardData(self) end -- Timer Player Resurrect Timer Created From the player Name for i = 1, self:GetVar("Set.Number_Of_Teams") do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] if msg.name == player:GetName().name then player:Resurrect() end end end -- (2) -- if (msg.name == "GateTime") then self:NotifyClientZoneObject{name = "unFreezAllPlayers", param1 = self:GetVar("Set.Number_Of_Teams") } self:NotifyClientZoneObject{name = "HidePlayerStats" } self:NotifyClientZoneObject{name = "ShowText" } self:NotifyClientZoneObject{name = "ShowText"} -- self:NotifyClientZoneObject{name = "Show_HelpScreen"} -- Spawn Rebuild SpawnRebuilds(self) -- Start Gate Timer getObjectByName(self,"ZoneMark"):NotifyObject{name = "StartGateTimer", } end if msg.name == "EndRound" then self:NotifyObject{ name="EndRound", ObjIDSender = self } end if (msg.name == "StartRound2" ) then self:MiniGameSwapTeams() -- teleport players to spawn points ----------------------------- TeleportAllPlayers(self) ----------------------------------------------------------------- removeBarrels(self) self:NotifyClientZoneObject{name = "ShowText"} self:NotifyClientZoneObject{name = "Send_State", paramStr = "Round2"} self:SetVar("Con.Pre_Counter" , self:GetVar("Set.Notify_Team_Objectives")) self:NotifyClientZoneObject{name = "HidePlayerStats" } self:NotifyClientZoneObject{name = "Hide_HelpScreen" } self:NotifyClientZoneObject{name = "HideDropButton" } self:NotifyClientZoneObject{name = "SwapTeamtxt" } self:SetVar("Con.swapTeams", true) local rebuilds = self:GetObjectsInGroup{ group = "reset" }.objects for i = 1, #rebuilds do rebuilds[i]:RebuildReset{bFail = false} end for i = 1, self:GetVar("Set.Number_Of_Teams") do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local ghealth = player:GetMaxHealth{}.health local gArmor = player:GetMaxArmor{}.armor local gImagein = player:GetMaxImagination{}.imagination player:SetImagination{imagination = gImagein} player:SetHealth{health = ghealth } player:SetArmor{armor = gArmor} if self:MiniGameGetTeam{ playerID = player}.teamID == 1 then removeflags(self,player) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "reSetAnimationSet" , paramObj = player } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetObjective" , param1 = 1 ,paramStr = self:GetVar("Con.TeamRoll_1") , rerouteID = player} SetPlayerRespawnLocPlayer(self, player ,1) else removeflags(self,player) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "reSetAnimationSet" , paramObj = player } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetObjective" , param1 = 2, paramStr = self:GetVar("Con.TeamRoll_2") , rerouteID = player} SetPlayerRespawnLocPlayer(self, player ,2) end end end GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "HideUI" } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "Show_HelpScreen" } if self:GetVar("Con.GameStarted") then self:NotifyClientZoneObject{name = "Hide_HelpScreen"} end GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Notify_Team_Objectives") , "StartRound2.1", self ) -- prep time here for i = 0, 4 do local playerOBJ = self:MiniGameGetTeamPlayers{teamID = self:MiniGameGetTeam{playerID = player }.teamID}.objects[i] if playerOBJ then if playerOBJ:GetName().name == player:GetName().name then local TID = self:MiniGameGetTeam{playerID = player }.teamID self:NotifyClientZoneObject{name = "SetPlayerName" ,paramStr = player:GetName().name, param1 =TID , param2 = i } self:NotifyClientZoneObject{name = "SetClientColor" ,paramStr = player:GetName().name, param1 =TID , param2 = i } end end end UpdateScore(self) end if ( msg.name == "StartRound2.1" ) then self:NotifyClientZoneObject{name = "Send_State", paramStr = "StartRound2.1"} -- clear Objectives and Stats -- self:NotifyClientZoneObject{name = "unFreezAllPlayers", param1 = self:GetVar("Set.Number_Of_Teams") } self:NotifyClientZoneObject{name = "HidePlayerStats" } self:NotifyClientZoneObject{name = "Hide_HelpScreen" } -- Start Round 2 Gate timer getObjectByName(self,"ZoneMark"):NotifyObject{name = "StartGateTimer" } end if (msg.name == "start_count") then self:NotifyClientZoneObject{name = "Send_State", paramStr = "StartGame"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "StartGame", self ) end -- (6) -- if (msg.name == "StartGame") then -- Set State self:NotifyClientZoneObject{name = "SendTxt_TeamMsgbox", paramStr = "Game Started"} self:NotifyClientZoneObject{name = "Send_State", paramStr = "StartGame"} self:NotifyClientZoneObject{name = "SendStartTimer", param1 = tonumber(0)} -- Start the RoundTimer --getObjectByName(self,"ZoneMark"):NotifyObject{name = "StartTimer"} -- teleport players to spawn points ----------------------------- TeleportAllPlayers(self) ------------------------------------------------------------------- self:SetVar("Con.GameStarted", true) SpawnTeams(self) self:NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Game Started"} self:NotifyClientZoneObject{name = "unFreezAllPlayers", param1 = self:GetVar("Set.Number_Of_Teams") } -- Add Rebuilds here self:SetVar("Con.GameStarted", true) end if (msg.name == "SetColor") then for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] if self:MiniGameGetTeam{ playerID = player}.teamID == 1 then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetBkGrndColor" , param1 = 1 , rerouteID = player} else GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetBkGrndColor" , param1 = 2 , rerouteID = player} end end end self:SetVar("Color_Timer", false) end if (msg.name == "EndGame") then end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) msg.playerID:Help{ iHelpID = 2 } self:MiniGameAddPlayer{playerID = msg.playerID} if self:GetVar("Con.TimerStart") == false then getObjectByName(self,"ZoneMark"):NotifyObject{ name = "StartJoinTimer" } self:SetVar("Con.TimerStart", true) end --msg.playerID:SetCollisionGroup{colGroup = 10} if not self:GetVar("Con.GameStarted") then self:NotifyClientZoneObject{name = "FreezPlayer", paramObj = msg.playerID } end msg.playerID:SetLoseCoinsOnDeath{bLoseCoinsOnDeath = false} self:NotifyClientZoneObject{name = "StoreClientPlayer" , paramObj = msg.playerID , rerouteID = msg.playerID } self:NotifyClientZoneObject{name = "nubOfPlayers" , paramStr = self:GetVar("Set.Minimum_Players_to_Start"), rerouteID = msg.playerID } -- update GUI with current Players for i = 1, 2 do for x = 1, 4 do if self:GetVar("Con.PlayerReady_p"..x.."_t"..i) then self:NotifyClientZoneObject{name = "PlayerReady" , paramStr = "name_p"..x.."_t"..i..","..self:GetVar("Con.PlayerName_p"..x.."_t"..i), paramObj = msg.playerID } self:NotifyClientZoneObject{name = "SetPlayerName" , paramStr = self:GetVar("Con.PlayerName_p"..x.."_t"..i) , param1 = i , param2 = x } self:NotifyClientZoneObject{name = "SetClientColor" ,paramStr = self:GetVar("Con.PlayerName_p"..x.."_t"..i) , param1 = i , param2 = x } end end end if msg.playerID:IsDead{}.bDead then msg.playerID:Resurrect() end -------------------------------------------- -- Add Player to Team -------------------------------------------- local TID1 = #self:MiniGameGetTeamPlayers{teamID = 1}.objects local TID2 = #self:MiniGameGetTeamPlayers{teamID = 2}.objects if TID1 > TID2 then self:MiniGameSetTeam{playerID = msg.playerID , teamID = 2} elseif TID1 < TID2 then self:MiniGameSetTeam{playerID = msg.playerID, teamID = 1} elseif TID1 == TID2 then self:MiniGameSetTeam{playerID = msg.playerID, teamID = 1} end team = self:MiniGameGetTeam{ playerID = msg.playerID}.teamID for i = 1, 4 do print("Slot_"..i.."_Team_"..team.." "..self:GetVar("Con.Slot_"..i.."_Team_"..team ) ) if self:GetVar("Con.Slot_"..i.."_Team_"..team ) == "open" then if team == 2 then self:SetVar("Con.Slot_"..i.."_Team_"..team, "closed") SetTeamSlot(self,i,2,msg.playerID) else self:SetVar("Con.Slot_"..i.."_Team_"..team, "closed") SetTeamSlot(self,i,1,msg.playerID) end break end end if self:GetVar("Con.GameStarted") then self:NotifyClientZoneObject{name = "HideQueUI" } self:NotifyClientZoneObject{name = "ShowHUDUI" } end self:AddActivityUser{ userID = msg.playerID } --self:RequestActivityEnter{bStart = true, userID = msg.playerID} GetLeaderboardData( self, msg.playerID, 37 ) end function SetTeamSlot(self,x,i,player) self:NotifyClientZoneObject{name = "JoinTeam" , paramStr = "name_p"..x.."_t"..i , paramObj = player } self:NotifyClientZoneObject{name = "EnableCheck" , paramStr = "name_p"..x.."_t"..i , paramObj = player , rerouteID = player} self:NotifyClientZoneObject{name = "ReadyTeam" , paramStr = "ready_p"..x.."_t"..i , paramObj = player } self:SetVar("Con.PlayerReady_p"..x.."_t"..i, true) self:SetVar("Con.PlayerName_p"..x.."_t"..i, player:GetName().name) -------------------------------------------- -- Sets Player Respan Locations -------------------------------------------- SetPlayerRespawnLoc(self, player) setPlayerScores(self, player) -- Send MSG CLIENT self:NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = player:GetName().name..self:GetVar("Set.Info_Text_2") } -- Set Gui Color GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetBkGrndColor" , param1 = i , rerouteID = player } self:SetVar("Con.Players_loaded" ,self:GetVar("Con.Players_loaded") + 1) TeleportPlayer(self,player) self:NotifyClientZoneObject{name = "FreezPlayer", paramObj = player } player:SetPVPStatus{ bOn = true } if not self:GetVar("Con.ReadyButton") then RoutToPlayer{msg, name = "ShowPlayButton", paramObj = player, playerID = player } self:SetVar("Con.ReadyButton" , true) end self:NotifyClientZoneObject{name = "SetPlayerName" ,paramStr = player:GetName().name, param1 = i , param2 = x } end function onPlayerExit( self, msg) local player = msg.playerID GAMEOBJ:GetZoneControlID():RemoveActivityUser{ userID = player } --- Refresh GUI self:SetVar("Con.Players_loaded", self:GetVar("Con.Players_loaded") - 1) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "ClearUI", rerouteID = player} self:MiniGameRemovePlayer{ playerID= player} GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = player:GetName().name..self:GetVar("Set.Info_Text_3")} for i = 1, 2 do for x = 1, 4 do if self:GetVar("Con.PlayerName_p"..x.."_t"..i) == player:GetName().name then self:NotifyClientZoneObject{name = "removeplayer" , paramStr = "p"..x.."_t"..i , paramObj = player } self:SetVar("Con.PlayerReady_p"..x.."_t"..i, nil) self:SetVar("Con.PlayerNotReady_p"..x.."_t"..i, nil) self:SetVar("Con.PlayerName_p"..x.."_t"..i, nil) self:SetVar("Con.Slot_"..x.."_Team_"..i,"open" ) break end end end end function onActivityStateChangeRequest(self,msg) if (msg.wsStringValue == "gamestate" ) then self:NotifyClientZoneObject{name = "SetGameState" , paramStr = "Siege" } end end function mainChildLoaded(self, msg) local obj = msg.childID if msg.templateID == self:GetVar("Set.QB_Object_LOT") then for i = 1, 3 do if self:GetVar("Barrel_"..i) == nil then storeObjectByName(self, "Barrel_"..i, obj) break end end end end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) local player = msg.sender if (msg.iButton == 1 and msg.identifier == "Drop") then if self:MiniGameGetTeam{ playerID = player}.teamID == 2 then local FlagFound = removeflags(self, player) if FlagFound then player:SetSkillRunSpeed{Modifier = 500 } DoObjectAction(player, "stopeffects", "godlight") self:NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = player:GetName().name..self:GetVar("Set.Info_Text_5") } local bluepos = player:GetPosition().pos local config = { {"AtHomePoint", false }, {"taken_name", FlagFound} } RESMGR:LoadObject { owner = self, objectTemplate = self:GetVar("Set.QB_Object_LOT") , x= bluepos.x, y= bluepos.y , z= bluepos.z, configData = config } end end end if (msg.iButton == 2469) then local newString = string.sub(msg.identifier, 7) self:SetVar("Con.PlayerReady_p"..newString, nil) self:SetVar("Con.PlayerNotReady_p"..newString, nil) self:SetVar("Con.PlayerName_p"..newString, nil) end if ( msg.identifier == "playSiege") then self:ActivityStart{} self:SetVar("Con.GameStarted",true) self:NotifyClientZoneObject{name = "unFreezAllPlayers", param1 = self:GetVar("Set.Number_Of_Teams") } -------------------------------------------- -- Start Game if we have our players -------------------------------------------- if self:GetVar("Con.Players_loaded") >= self:GetVar("Set.Minimum_Players_to_Start") or player:GetGMLevel{}.bIsGM then GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Notify_Team_Objectives") , "GateTime", self ) self:NotifyClientZoneObject{name = "resetCaptured"} self:SetVar("Con.Pre_Counter",self:GetVar("Set.Notify_Team_Objectives") ) self:SetVar("TimeToBeat" , self:GetVar("Set.DefendTime") ) self:NotifyClientZoneObject{name = "TimeToBeat" ,paramStr = self:GetVar("TimeToBeat") } self:NotifyClientZoneObject{name = "Send_State", paramStr = "Game Pre Start"} for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] print(player:GetName().name.." "..self:GetVar("Con.TeamRoll_"..i) ) if self:MiniGameGetTeam{ playerID = player}.teamID == 1 then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetObjective" , paramStr = self:GetVar("Con.TeamRoll_1") , rerouteID = player} GAMEOBJ:GetZoneControlID():RequestActivityStartStop{bStart = true, userID = player} else GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetObjective" , paramStr = self:GetVar("Con.TeamRoll_2") , rerouteID = player} GAMEOBJ:GetZoneControlID():RequestActivityStartStop{bStart = true, userID = player} end end end self:NotifyClientZoneObject{name = "HideQueUI" } self:NotifyClientZoneObject{name = "Show_HelpScreen" } end end end -- Notify messages from Activity Manager ---------------------------------------------------------------- -- notify from activity mng: When activity is stopped this is -- needed to update the leaderboard. ---------------------------------------------------------------- function onDoCalculateActivityRating(self,other,msg) msg.outActivityRating = msg.fValue1 return msg end -------------------------------------------------------------- -- User Exits Activity -------------------------------------------------------------- function onRequestActivityExit(self, msg) if (msg.bUserCancel) == true then -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityExit{bUserCancel = msg.bUserCancel, userID = msg.userID} end end------------------------------------------------------------- function mainNotifyObject(self, msg) -- up Keep var Barrels if msg.name == "removeBarrel" then for i = 1, 3 do if getObjectByName(self, "Barrel_"..i ) then if (msg.ObjIDSender:GetID() == getObjectByName(self, "Barrel_"..i ):GetID()) then self:SetVar("Barrel_"..i, nil) end end end end if msg.name == "UpdateScore" then UpdateScore(self) end -- player Smashed A Smashable if msg.name == "reBuild" then print("reBuild "..msg.ObjIDSender:GetName().name) self:MiniGameAddPlayerScore{playerID = msg.ObjIDSender, scoreType = 7, score = 1 } -- rebuilds UpdateScore(self) end if msg.name == "SmashQB" then print("SmashQB "..msg.ObjIDSender:GetName().name) self:MiniGameAddPlayerScore{playerID = msg.ObjIDSender , scoreType = 8, score = 1 } -- rebuilds UpdateScore(self) end ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- GAME TIMMER ROUNDS ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- if msg.name == "timeExpired" then self:SetVar("Con.Round", self:GetVar("Con.Round") + 1) timetobeat = self:GetVar("Set.DefendTime") getObjectByName(self,"ZoneMark"):NotifyObject{name = "StopTimer"} if self:GetVar("Con.Round") == 1 then removeBarrels(self) ---------------------------------------------------------------------------- -- Round 1 timer expire ---------------------------------------------------------------------------- --self:NotifyClientZoneObject{name = "EndRoundTxt" , paramStr = "Timer is Out 1" } RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = "Time to Beat set to "..SecondsToClock(timetobeat) ,paramObj = nil, team = 1 } if self:GetVar("Con.Round_1_Win") == true then RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = "Captured in "..SecondsToClock(timetobeat) ,paramObj = nil, team = 2 } else RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = "Time remains "..SecondsToClock(timetobeat) ,paramObj = nil, team = 2 } end GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "EndRound", self ) end if self:GetVar("Con.Round") == 2 then ---------------------------------------------------------------------------- -- Timer expire Round 2 ---------------------------------------------------------------------------- --self:NotifyClientZoneObject{name = "EndRoundTxt" , paramStr = "Timer expire Round 2 " } if self:GetVar("Con.Round_1_Time") < self:GetVar("Con.Round_2_Time") then RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_11") ,paramObj = nil, team = 2 } RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_10") ,paramObj = nil, team = 1 } elseif self:GetVar("Con.Round_1_Time") > self:GetVar("Con.Round_2_Time") then RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_10") ,paramObj = nil, team = 2 } RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_11") ,paramObj = nil, team = 1 } elseif self:GetVar("Con.Round_1_Time") == self:GetVar("Con.Round_2_Time") then self:NotifyClientZoneObject{ name = "EndRoundTxt" ,paramStr = "TIE! "..self:GetVar("Con.Round_1_Time").." To "..self:GetVar("Con.Round_2_Time") } end --Start timer Won Lost self:NotifyClientZoneObject{name = "FreezAllPlayers" , param1 = self:GetVar("Set.Number_Of_Teams") } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.WonLoastMatchTimer") , "WonLostTimer", self ) end end ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- GAME BARREL CAPTS ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- if msg.name == "Captured_Object" then self:SetVar("Con.numofcaps", self:GetVar("Con.numofcaps" ) + 1) local numOfCaps = self:GetVar("Con.numofcaps") if numOfCaps <= 3 then self:NotifyClientZoneObject{name = "SendCaptured", param1 = numOfCaps} end if numOfCaps == 3 then self:SetVar("Con.Round", self:GetVar("Con.Round") + 1) local timetobeat = self:GetVar("CurrentTime") local timetobeatIn = self:GetVar("Con.GameStoredtime") - self:GetVar("CurrentTime") if self:GetVar("Con.Round") == 1 then self:SetVar("Con.Round_1_Time", timetobeat) self:SetVar("Con.Round_1_Win", true) else self:SetVar("Con.Round_2_Time", timetobeat + self:GetVar("Con.Round_1_Time") ) self:SetVar("Con.Round_2_Win", true) end self:SetVar("Con.numofcaps",0) getObjectByName(self,"ZoneMark"):NotifyObject{name = "StopTimer"} GAMEOBJ:GetZoneControlID():SetVar("Set.DefendTime", timetobeatIn ) if self:GetVar("Con.Round") == 1 then ---------------------------------------------------------------------------- -- Capted 3 Barrels Round 1 ---------------------------------------------------------------------------- --self:NotifyClientZoneObject{name = "EndRoundTxt" , paramStr = "Capted All Three Barrels Round 1" } self:NotifyClientZoneObject{ name = "EndRoundTxt" ,paramStr = "Attacking Team Captured All Barrels in: "..SecondsToClock(timetobeatIn) } self:NotifyClientZoneObject{name = "TimeToBeat" ,paramStr = timetobeatIn } GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "EndRound", self ) elseif self:GetVar("Con.Round") == 2 then ---------------------------------------------------------------------------- -- Capted 3 Barrels Round 2 ---------------------------------------------------------------------------- -- self:NotifyClientZoneObject{name = "EndRoundTxt", paramStr = "Capted All Three Round 2" } if self:GetVar("Con.Round_1_Time") < self:GetVar("Con.Round_2_Time") then --self:NotifyClientZoneObject{ name = "EndRoundTxt" ,paramStr = self:GetVar("Set.Info_Text_9") } RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_8") ,paramObj = nil, team = 1 } RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_9") ,paramObj = nil, team = 2 } elseif self:GetVar("Con.Round_1_Time") > self:GetVar("Con.Round_2_Time") then --self:NotifyClientZoneObject{ name = "EndRoundTxt" ,paramStr = self:GetVar("Set.Info_Text_8") } RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_8") ,paramObj = nil, team = 2 } RoutToTeam{ name = "EndRoundTxt" , param1 = nil, param2 = nil ,paramStr = self:GetVar("Set.Info_Text_9") ,paramObj = nil, team = 1 } elseif self:GetVar("Con.Round_1_Time") == self:GetVar("Con.Round_2_Time") then self:NotifyClientZoneObject{ name = "EndRoundTxt" ,paramStr = "TIE! "..self:GetVar("Con.Round_1_Time").." To "..self:GetVar("Con.Round_2_Time") } end self:NotifyClientZoneObject{name = "FreezAllPlayers" , param1 = self:GetVar("Set.Number_Of_Teams") } --Start timer Won Lost GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.WonLoastMatchTimer") , "WonLostTimer", self ) end end end if msg.name == "GameOver" then --self:NotifyClientZoneObject{name = "FreezAllPlayers" , param1 = self:GetVar("Set.Number_Of_Teams") } self:NotifyClientZoneObject{name = "Send_State", paramStr = "GameOver"} end -- (4) -- if msg.name == "EndGateTime" then self:NotifyClientZoneObject{name = "Send_State", paramStr = "Gate Opend"} getObjectByName(self,"ZoneMark"):NotifyObject{name = "StartTimer"} end if msg.name == "EndRound" then -- Respawn Cap Objects -- Lock Players self:NotifyClientZoneObject{name = "Send_State", paramStr = "RoundEnd"} self:NotifyClientZoneObject{name = "FreezAllPlayers" , param1 = self:GetVar("Set.Number_Of_Teams") } -- Open All Player Stats self:NotifyClientZoneObject{name = "ShowPlayerStats" } -- Timer Before unlocking GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.State_Results_Timer") , "StartRound2", self ) -- Close Gate for i = 1, #self:GetObjectsInGroup{ group = "gate"}.objects do local gate = self:GetObjectsInGroup{ group = "gate"}.objects[i] gate:GoToWaypoint{iPathIndex = 0} end end if ( msg.name == "Blue_Spawn" ) then storeObjectByName(self, "Blue_Spawn_"..self:GetVar("Con.Blue_Spawners"), msg.ObjIDSender) local i = self:GetVar("Con.Blue_Spawners") + 1 self:SetVar("Con.Blue_Spawners", i ) msg.ObjIDSender:SetVar("TeamID", 1) end if ( msg.name == "Red_Spawn" ) then storeObjectByName(self, "Red_Spawn_"..self:GetVar("Con.Red_Spawners"), msg.ObjIDSender) local i = self:GetVar("Con.Red_Spawners") + 1 self:SetVar("Con.Red_Spawners", i ) msg.ObjIDSender:SetVar("TeamID", 2) end if ( msg.name == "Blue_Flag" ) then storeObjectByName(self, "Blue_Flag_"..self:GetVar("Con.Blue_Flag"), msg.ObjIDSender) local i = self:GetVar("Con.Blue_Flag") + 1 self:SetVar("Con.Blue_Flag", i ) end if ( msg.name == "Red_Flag" ) then storeObjectByName(self, "Red_Flag_"..self:GetVar("Con.Red_Flag"), msg.ObjIDSender) local i = self:GetVar("Con.Red_Flag") + 1 self:SetVar("Con.Red_Flag", i ) end if ( msg.name == "Red_Point" ) then storeObjectByName(self, "Red_Point_"..self:GetVar("Con.Red_Point"), msg.ObjIDSender) local i = self:GetVar("Con.Red_Point") + 1 self:SetVar("Con.Red_Point", i ) end if ( msg.name == "Red_Mark" ) then storeObjectByName(self, "Red_Mark_"..self:GetVar("Con.Red_Mark"), msg.ObjIDSender) local i = self:GetVar("Con.Red_Mark") + 1 self:SetVar("Con.Red_Mark", i ) end if ( msg.name == "Blue_Point" ) then storeObjectByName(self, "Blue_Point_"..self:GetVar("Con.Blue_Point"), msg.ObjIDSender) local i = self:GetVar("Con.Blue_Point") + 1 self:SetVar("Con.Blue_Point", i ) end if ( msg.name == "Blue_Mark" ) then storeObjectByName(self, "Blue_Mark_"..self:GetVar("Con.Blue_Mark"), msg.ObjIDSender) local i = self:GetVar("Con.Blue_Mark") + 1 self:SetVar("Con.Blue_Mark", i ) end -- Seige timer is set on this object if ( msg.name == "Zone_Mark" ) then storeObjectByName(self, "ZoneMark", msg.ObjIDSender) end end function onPlayerDied( self, msg) --[[ kills = 1 deaths = 2 Capts = 3 Returns = 4 points = 5 rebuilds = 6 --]] local player = msg.playerID local killer = msg.killerID GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "HideDropButton" ,rerouteID = player } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "ReSpawnTimer" , param1 = self:GetVar("Set.RespawnTime"), rerouteID = player } self:NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = killer:GetName().name..self:GetVar("Set.Info_Text_1")..player:GetName().name.."!" } player:UnEquipItem{bImmediate = true} self:MiniGameAddPlayerScore{playerID = killer, scoreType = 1, score = 1 } -- kills self:MiniGameAddPlayerScore{playerID = player, scoreType = 2, score = 1 } -- deaths -- self:NotifyClientZoneObject{name = "Update_Player_Scores"} GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "reSetAnimationSet" , paramObj = player } if self:MiniGameGetTeam{ playerID = player}.teamID == 2 then local FlagFound = removeflags(self, player) if FlagFound then self:MiniGameAddPlayerScore{playerID = msg.killerID, scoreType = 9, score = 1 } -- kill flag carry self:NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = player:GetName().name..self:GetVar("Set.Info_Text_5") } local bluepos = player:GetPosition().pos local config = { {"AtHomePoint", false }, {"taken_name", FlagFound} } RESMGR:LoadObject { owner = self, objectTemplate = self:GetVar("Set.QB_Object_LOT") , x= bluepos.x, y= bluepos.y , z= bluepos.z, configData = config } end end UpdateScore(self) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.RespawnTime") , player:GetName().name , self ) end function AddPlayerToTeam(self,msg) local player = msg.playerID if foo ~= nil then local player = msg.playerID -------------------------------------------- -- Add Player to MiniGame -------------------------------------------- self:MiniGameAddPlayer{playerID = player} -------------------------------------------- -- Add Player to Team -------------------------------------------- local TID1 = #self:MiniGameGetTeamPlayers{teamID = 1}.objects local TID2 = #self:MiniGameGetTeamPlayers{teamID = 2}.objects if TID1 > TID2 then self:MiniGameSetTeam{playerID = player , teamID = 2} elseif TID1 < TID2 then self:MiniGameSetTeam{playerID = player, teamID = 1} elseif TID1 == TID2 then self:MiniGameSetTeam{playerID = player, teamID = 1} end -------------------------------------------- -- Sets Player Respan Locations -------------------------------------------- SetPlayerRespawnLoc(self, msg) -------------------------------------------- -- Gets TeamID -------------------------------------------- local TID = self:MiniGameGetTeam{ playerID = player}.teamID -------------------------------------------- -- Gets TeamID -------------------------------------------- player:SetPVPStatus{ bOn = true } -- Set Teams and Factions if TID == 1 then setPlayerScores(self, player) -- Send MSG CLIENT self:NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = player:GetName().name..self:GetVar("Set.Info_Text_2") } -- Set Gui Color GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetBkGrndColor" , param1 = 1 , rerouteID = player } RoutToPlayer{msg, name = "UISetObjective" , param1 = nil , param2 = nil , paramStr = self:GetVar("Con.TeamRoll_1") , paramObj = player, playerID = player } elseif TID == 2 then setPlayerScores(self, player) -- Send MSG CLIENT self:NotifyClientZoneObject{name = "SendTxt_TeamMsgbox" , paramStr = player:GetName().name..self:GetVar("Set.Info_Text_2") } RoutToPlayer{msg, name = "UISetObjective" , param1 = nil , param2 = nil , paramStr = self:GetVar("Con.TeamRoll_2") , paramObj = player, playerID = player } -- Set Gui Color GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "UISetBkGrndColor" , param1 = 2 , rerouteID = player } end -------------------------------------------- -- Set the players Attr -------------------------------------------- if self:GetVar("Set.CustomPlayer") then player:SetMaxImagination{imagination = self:GetVar("Set.Imagination")} player:SetMaxHealth{health = self:GetVar("Set.Health")} player:SetMaxArmor{armor = self:GetVar("Set.Armor")} player:SetImagination{imagination = self:GetVar("Set.Imagination")} player:SetHealth{health = self:GetVar("Set.Health")} player:SetArmor{armor = self:GetVar("Set.Armor")} end TeleportPlayer(self,msg) if self:GetVar("Con.GameStarted") then self:NotifyClientZoneObject{name = "FreezPlayer", paramObj = player } end -------------------------------------------- -- Start Game if we have our players -------------------------------------------- if self:GetVar("Con.Players_loaded") == self:GetVar("Set.Minimum_Players_to_Start") then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "resetCaptured"} self:SetVar("Con.Pre_Counter",self:GetVar("Set.Notify_Team_Objectives") ) self:SetVar("TimeToBeat" , self:GetVar("Set.DefendTime") ) self:NotifyClientZoneObject{name = "TimeToBeat" ,paramStr = self:GetVar("TimeToBeat") } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Notify_Team_Objectives") , "GateTime", self ) self:NotifyClientZoneObject{name = "Send_State", paramStr = "Game Pre Start"} end if not self:MiniGameGetTeam{playerID = player }.teamID then print("!! PLAYER "..player:GetName().name.." FAILD TO JOIN A TEAM WTF !!") else for i = 1, 4 do local playerOBJ = self:MiniGameGetTeamPlayers{teamID = self:MiniGameGetTeam{playerID = player }.teamID}.objects[i] if playerOBJ then if playerOBJ:GetName().name == player:GetName().name then local TID = self:MiniGameGetTeam{playerID = player }.teamID self:NotifyClientZoneObject{name = "SetPlayerName" ,paramStr = player:GetName().name, param1 =TID , param2 = i } self:NotifyClientZoneObject{name = "SetClientColor" ,paramStr = player:GetName().name, param1 =TID , param2 = i } break end end end end end end -- Set Player Attributes function SetPlayerAttributes(player) player:SetMaxImagination{imagination = self:GetVar("Set.Imagination")} player:SetMaxHealth{health = self:GetVar("Set.Health")} player:SetMaxArmor{armor = self:GetVar("Set.Armor")} player:SetImagination{imagination = self:GetVar("Set.Imagination")} player:SetHealth{health = self:GetVar("Set.Health")} player:SetArmor{armor = self:GetVar("Set.Armor")} end function SetPlayerRespawnLoc(self, player) local TID = self:MiniGameGetTeam{playerID = player }.teamID player:SetPlayerAllowedRespawn{dontPromptForRespawn = true} if TID == 1 then player:SetRespawnGroup{findClosest=true, respawnGroup='RespawnTeamA'} elseif TID == 2 then player:SetRespawnGroup{findClosest=true, respawnGroup='RespawnTeamb'} else print("!! PLAYER "..player:GetName().name.." IS NOT ON A TEAM !!") end end function SetPlayerRespawnLocPlayer(self, player , team) player:SetPlayerAllowedRespawn{dontPromptForRespawn = true} if team == 1 then player:SetRespawnGroup{findClosest=true, respawnGroup='RespawnTeamA'} elseif team == 2 then player:SetRespawnGroup{findClosest=true, respawnGroup='RespawnTeamb'} else print("!! PLAYER "..player:GetName().name.." IS NOT ON A TEAM !!") end endrequire('State') function SpawnTeams(self) if self:GetVar("Set.Game_Type") == "CTF" then -- spawn Blue Team for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local Mark = getObjectByName(self, "Blue_Spawn_"..i) local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] if Mark ~= nil and player:Exists() then local Markpos = Mark:GetPosition().pos local Markrot = Mark:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } SetPlayerRespawnLoc(self,player) end end -- spawn Red Team for i = 1, #self:MiniGameGetTeamPlayers{teamID = 2}.objects do local Mark = getObjectByName(self, "Red_Spawn_"..i) local player = self:MiniGameGetTeamPlayers{teamID = 2}.objects[i] if Mark ~= nil and player:Exists() then local Markpos = Mark:GetPosition().pos local Markrot = Mark:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } SetPlayerRespawnLoc(self,player) end end end end function removeBarrels(self) for i = 1, 3 do if getObjectByName(self, "Barrel_"..i ) then getObjectByName(self,"Barrel_"..i ):NotifyObject{name = "killself"} self:SetVar( "Barrel_"..i , nil) end end SpawnRebuilds(self) end function RoutToPlayer(msg, name , param1 , param2 , paramStr , paramObj , playerID ) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = msg.name , paramStr = msg.paramStr ,param1 = msg.param1 ,param2 = msg.param2, paramObj = msg.paramObj , rerouteID = msg.playerID } end function RoutToTeam(msg, name , param1 , param2 , paramStr , paramObj , team ) for x = 1, #GAMEOBJ:GetZoneControlID():MiniGameGetTeamPlayers{teamID = msg.team}.objects do local player = GAMEOBJ:GetZoneControlID():MiniGameGetTeamPlayers{teamID = msg.team}.objects[x] GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = msg.name , paramStr = msg.paramStr ,param1 = msg.param1 ,param2 = msg.param2, paramObj = player , rerouteID = player } end end -------------------------------------------------------------- -- Gets the current activity user or returns nil ------------- -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Send Message to All Clients ( Bubble ) -------------------- -------------------------------------------------------------- function sendchatbubble(self, msg) end -------------------------------------------------------------- -- remove player from game -------------------------------------------------------------- function RemovePlayerFromGame(self, player) if (player) then local playerNum = GetPlayerNum(self, player) -- reset data PLAYERS[playerNum] = -1 local NoData = {} self:SetVar(player:GetID(), NoData) -- remove all boards RemoveBoardsFromPlayer(self, player) player:Teleport{pos = CONSTANTS["PLAYER_ZONEIN_POS"], bSetRotation = false} end end -------------------------------------------------------------- -- parses time to a string -------------------------------------------------------------- function ParseTime(numTime) local newTime = tonumber(numTime) local min = math.floor(newTime / 1000 / 60) newTime = newTime - (min * 1000 * 60) local sec = math.floor(newTime / 1000) newTime = newTime - (sec * 1000) local msec = math.floor(newTime) local strTime = "" if (min > 0) then strTime = ZeroPad(min,2) .. ":" .. ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) else strTime = ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) end return strTime end -- Removes Any Flags from the player Inventory function removeflags(self, player) for i =0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:GetLOT{}.objtemplate == self:GetVar("Set.QB_Loot_Object") then local item = player:GetInventoryItemInSlot{slot = 1,inventoryType = 4 }.itemID player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:UnEquipItem{bImmediate = true} player:UnEquipInventory{ itemtounequip = item} taken = player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:GetVar("taken_name") print("taken = "..taken) player:RemoveItemFromInventory{ eInvType = 4 ,iObjTemplate = self:GetVar("Set.QB_Loot_Object") } DoObjectAction(player, "stopeffects", "godlight") player:SetSkillRunSpeed{Modifier = 500 } return taken end end end end function setPlayerScores(self, player) self:MiniGameSetPlayerScore{playerID = player, scoreType = 0, score = 0 } self:MiniGameSetPlayerScore{playerID = player, scoreType = 1, score = 0 } self:MiniGameSetPlayerScore{playerID = player, scoreType = 2, score = 1 } -- Lap Number self:MiniGameSetPlayerScore{playerID = player, scoreType = 3, score = 0 } self:MiniGameSetPlayerScore{playerID = player, scoreType = 4, score = 0 } end function setTeamUI(self, team) local num = #self:MiniGameGetTeamPlayers{teamID = 1}.objects if num > 1 then for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] player:TeamAddPlayerMsg{name = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i+1]} player:RequestTeamUIUpdate{} end end end function TeleportAllPlayers(self) for i = 1, self:GetVar("Set.Number_Of_Teams") do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local team = self:MiniGameGetTeam{ playerID = player}.teamID if team == 1 then local blueMax = GAMEOBJ:GetZoneControlID():GetVar("Con.Blue_Spawners") - 1 local ran = math.random(1,blueMax) local spawn = getObjectByName(self, "Blue_Spawn_"..ran) local Markpos = spawn:GetPosition().pos local Markrot = spawn:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } else local redMax = self:GetVar("Con.Red_Spawners") - 1 local ran = math.random(1,redMax) local spawn = getObjectByName(self, "Red_Spawn_"..ran) local Markpos = spawn:GetPosition().pos local Markrot = spawn:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } end end end end function TeleportPlayer(self,player) local TID = self:MiniGameGetTeam{ playerID = player}.teamID if TID == 1 then local blueMax = GAMEOBJ:GetZoneControlID():GetVar("Con.Blue_Spawners") - 1 local ran = math.random(1,blueMax) local spawn = getObjectByName(self, "Blue_Spawn_"..ran) local Markpos = spawn:GetPosition().pos local Markrot = spawn:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } else local redMax = self:GetVar("Con.Red_Spawners") - 1 local ran = math.random(1,redMax) local spawn = getObjectByName(self, "Red_Spawn_"..ran) local Markpos = spawn:GetPosition().pos local Markrot = spawn:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } end end function SpawnRebuilds(self) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "resetCaptured"} for i = 1, 3 do self:SetVar("Barrel_"..i, nil) end for i = 1, self:GetVar("Con.Blue_Point") - 1 do local config = { {"AtHomePoint", true} , {"taken_name", "Blue_Point_"..i} } local loc = getObjectByName(self, "Blue_Point_"..i ):GetPosition().pos getObjectByName(self, "Blue_Point_"..i ):SetVar("taken", true) RESMGR:LoadObject { owner = self ,objectTemplate = self:GetVar("Set.QB_Object_LOT") , x= loc.x , y= loc.y , z= loc.z , configData = config } end end -- Checks for any Seige Objects and removes them function RemoveSiegeObjects(self, player) for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] for i = 0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:GetLOT{}.objtemplate == self:GetVar("Set.QB_Loot_Object") then local item = player:GetInventoryItemInSlot{slot = 1,inventoryType = 4 }.itemID player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:UnEquipItem{bImmediate = true} taken = player:GetInventoryItemInSlot{slot = i ,inventoryType = 4}.itemID:GetVar("taken_name") print("taken = "..taken) player:RemoveItemFromInventory{ eInvType = 4 ,iObjTemplate = self:GetVar("Set.QB_Loot_Object") } end end end end end end function UpdateScore(self,swap) for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local kills = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 1}.score) local deaths = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 2}.score) local Capts = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 3}.score) local Returns = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 4}.score) local FlagCarry = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 9}.score) local Build = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 7}.score) local DestroyQB =tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 8}.score) local name = player:GetName().name print(tostring(FlagCarry)) local addPoints = ((kills * self:GetVar("Set.Kills")) + (FlagCarry * self:GetVar("Set.KillObjCarrier")) + (Capts * self:GetVar("Set.CapturObj")) + (Returns * self:GetVar("Set.RetrunObj")) + (Build * self:GetVar("Set.Build")) + (DestroyQB * self:GetVar("Set.DestroyQB")) - (deaths * self:GetVar("Set.Deaths")) ) self:MiniGameSetPlayerScore{playerID = player, scoreType = 5, score = addPoints } local points = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 5}.score) local txt = ""..kills..","..deaths..","..Capts..","..Returns..","..points..","..name.."" if self:GetVar("Con.swapTeams") == true then if i == 1 then i = 2 else i = 1 end end GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "SetPlayerPoints" , paramStr = txt , param1 = i ,param2 = x } end end end function sendLeaderBoardData(self) for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local kills = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 1}.score) local deaths = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 2}.score) local value1Var = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 3}.score) local Returns = tostring(self:MiniGameGetPlayerScore{playerID= player, scoreType = 4}.score) scoreVar = ((kills * self:GetVar("Set.Kills") ) + (value1Var * self:GetVar("Set.CapturObj")) + (Returns * self:GetVar("Set.RetrunObj")) - (deaths * self:GetVar("Set.Deaths")) ) if i ==1 and self:GetVar("Con.Round_1_Win") == true then value2Var = 1 lost = 0 scoreVar = scoreVar * self:GetVar("Set.WonMatchMultiplier") else value2Var = 0 lost = 1 end if i == 2 and self:GetVar("Con.Round_2_Win") == true then scoreVar = scoreVar * self:GetVar("Set.WonMatchMultiplier") value2Var = 1 lost = 0 else value2Var = 0 lost = 1 end StopActivity(self,player, scoreVar, value1Var, value2Var ) self:NotifyClientZoneObject{name = "SiegeRewardsHide", paramObj = player, rerouteID = player} end end end ---------------------------------------------------------------- function StopActivity(self,player, scoreVar, value1Var, value2Var ) -- local mgr = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1] -- store the time as activity rating [1] GAMEOBJ:GetZoneControlID():SetActivityUserData{ userID = player, typeIndex = 0, value = scoreVar } print("SetActivityUserData0 Data ="..scoreVar) GAMEOBJ:GetZoneControlID():SetActivityUserData{ userID = player, typeIndex = 1, value = value1Var } print("SetActivityUserData1 Data ="..value1Var) GAMEOBJ:GetZoneControlID():SetActivityUserData{ userID = player, typeIndex = 2, value = value2Var } print("SetActivityUserData2 Data ="..value2Var) ---GAMEOBJ:GetZoneControlID():UpdateActivityLeaderboard{ userID = player } -- distribute rewards GAMEOBJ:GetZoneControlID():DistributeActivityRewards{ userID = player, bAutoAddCurrency = true, bAutoAddItems = true } -- Update Leaderboards for this user GAMEOBJ:GetZoneControlID():UpdateActivityLeaderboard{ userID = player } -- get the leaderboard data for the user and update summary screen if it exists GAMEOBJ:GetZoneControlID():RequestActivitySummaryLeaderboardData{ user = player, queryType = 7 } -- remove the user from activity GAMEOBJ:GetZoneControlID():RemoveActivityUser{ userID = player } end ---------------------------------------------------------------- -- GetLeaderboard Data message ---------------------------------------------------------------- function GetLeaderboardData( self, player, activityID ) -- get the leaderboard data for the user and update summary screen if it exists self:RequestActivitySummaryLeaderboardData{ user = player, target = self, queryType = 7, gameID = activityID } end function onStartup(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="Zone_Mark", ObjIDSender = self } self:SetVar("TimesGateOpened", 0 ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if msg.name == "Start_Join" then self:SetVar("JTime", self:GetVar("JTime") - 1) if self:GetVar("JTime") >= 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Start_Join", self ) self:NotifyClientObject{name = "JoinTime" , param1 = self:GetVar("JTime") } else self:NotifyClientObject{name = "JoinTime" , param1 = self:GetVar("JTime") } end end if msg.name == "Stop_Join" then end if msg.name == "GameRoundTime" then self:SetVar("TotalRoundTime", self:GetVar("TotalRoundTime") - 1) if self:GetVar("TotalRoundTime") >= 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "GameRoundTime", self ) self:NotifyClientObject{name = "RoundTime" , param1 = self:GetVar("TotalRoundTime") , paramStr = "round" } GAMEOBJ:GetZoneControlID():SetVar("CurrentTime",self:GetVar("TotalRoundTime") ) else if self:GetVar("TimesGateOpened") == 2 then GAMEOBJ:GetZoneControlID():NotifyObject{ name="timeExpired", ObjIDSender = self } else local RoundTime = GAMEOBJ:GetZoneControlID():GetVar("Set.Pre_Game_Start") self:SetVar("TotalRoundTime" , RoundTime) self:NotifyClientObject{name = "RoundTime" , param1 = 0 } GAMEOBJ:GetZoneControlID():SetVar("CurrentTime",self:GetVar("TotalRoundTime") ) --GAMEOBJ:GetZoneControlID():NotifyObject{ name="EndRound", ObjIDSender = self } GAMEOBJ:GetZoneControlID():NotifyObject{ name="timeExpired", ObjIDSender = self } end end end if msg.name == "GateRoundTime" then self:SetVar("TotalGateTime", self:GetVar("TotalGateTime") - 1) if self:GetVar("TotalGateTime") >= 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "GateRoundTime", self ) self:NotifyClientObject{name = "RoundTime" , param1 = self:GetVar("TotalGateTime") , paramStr = "Gate"} else -- Gate time is expired -- Open Game -- self:NotifyClientObject{ name = "ShowHUD" } self:NotifyClientObject{name = "RoundTime" , param1 = 0 } GAMEOBJ:GetZoneControlID():NotifyObject{ name="EndGateTime", ObjIDSender = self } for i = 1, #self:GetObjectsInGroup{ group = "gate"}.objects do local gate = self:GetObjectsInGroup{ group = "gate"}.objects[i] gate:GoToWaypoint{iPathIndex = 1} end end end end function onNotifyObject(self, msg) if msg.name == "StopTimer" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("TimesGateOpened", 0 ) end if msg.name == "StartTimer" then local Defend = GAMEOBJ:GetZoneControlID():GetVar("Set.DefendTime") self:SetVar("TotalRoundTime" , Defend) self:SetVar("Round_Time", parama1 ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "GameRoundTime", self ) end -- (3) -- if msg.name == "StartGateTimer" then local GateTimer = GAMEOBJ:GetZoneControlID():GetVar("Set.Prestart_Time") self:SetVar("TotalGateTime" , GateTimer) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "GateRoundTime", self ) self:NotifyClientObject{name = "RoundTime" , param1 = GateTimer } self:SetVar("TimesGateOpened", self:GetVar("TimesGateOpened") + 1 ) end if msg.name == "StartJoinTimer" then --local time = GAMEOBJ:GetZoneControlID():GetVar("Set.Join_Timer") --self:SetVar("JTime" , time) --self:NotifyClientObject{name = "JoinTime" , param1 = time } --GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Start_Join", self ) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') function onStartup(self) Con = {} Con["Red_Spawners"] = 1 Con["Blue_Spawners"] = 1 Con["rSpawn"] = 0 self:SetVar("Con",Con) UI:SendMessage( "pushGameState", {{"state", "Siege" }} ) UI:SendMessage("ShowUI", { {"show", true } }) PHYSICS:SetCanCollide(10, 10, true) end function onNotifyClientZoneObject(self,msg) --these pushes are questionable, is this a workaround from the old system? UI:SendMessage( "pushGameState", {{"state", "Siege" }} ) if msg.name == "ShowText" then UI:SendMessage("SiegeBigTxt", {{"bigtxtVisible", "hide" }} ) UI:SendMessage("SiegeText", {{"Text", " " }} ) UI:SendMessage("SiegeText", {{"UI", "show" }} ) elseif msg.name == "SetGameState" then UI:SendMessage( "pushGameState", {{"state", "Siege" }} ) elseif msg.name == "nubOfPlayers" then UI:SendMessage("SiegeJoin", {{"nubOfPlayers", msg.paramStr} }) elseif msg.name == "HideUI" then UI:SendMessage("SiegeUI", { {"UI", "hide"} }) elseif msg.name == "HideText" then UI:SendMessage("SiegeText", {{"UI", "hide" }} ) elseif msg.name == "OverHeadText" then UI:SendMessage("SiegeText", {{"Text", msg.paramStr }} ) elseif msg.name == "ShowPlayButton" then UI:SendMessage("SiegeJoin", {{"sgPlayShow", true }} ) elseif msg.name == "PlayerReady" then UI:SendMessage("SiegeJoin", {{"playerready", msg.paramStr }} ) elseif msg.name == "removeplayer" then UI:SendMessage("SiegeJoin", {{"removeplayer", msg.paramStr }} ) elseif msg.name == "EnableCheck" then for i = 1, 2 do for x = 1, 4 do if msg.paramStr == "name_p"..x.."_t"..i then UI:SendMessage("SiegeJoin", {{"EnableCheck", msg.paramStr }} ) end end end elseif msg.name == "JoinTeam" then for i = 1, 2 do for x = 1, 4 do if msg.paramStr == "name_p"..x.."_t"..i then UI:SendMessage("SiegeJoin", {{"join_name", msg.paramStr },{ "playername", msg.paramObj:GetName().name }} ) end end end elseif msg.name == "ReadyTeam" then for i = 1, 2 do for x = 1, 4 do if msg.paramStr == "ready_p"..x.."_t"..i then UI:SendMessage("SiegeJoin", {{"join_ready", msg.paramStr }} ) end end end elseif msg.name == "PlayerLoaded" then for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local TeamColor = self:MiniGameGetTeamColor{teamID = i}.color if GAMEOBJ:GetZoneControlID():MiniGameGetTeam{ playerID = player}.teamID == 1 then colors = 1 else colors = 0 end player:SwapColor{ bodyPiece = 1 , color = colors } -- Set Chest Color player:SwapColor{ bodyPiece = 2 , color = colors } -- Set Legs Color end end elseif msg.name == "ClearUI" then --UI:SendMessage("ToggleActivityCloseButton", {{"Toggle", true }} ) UI:SendMessage("SiegeRewards", {{"rewardsVisible", "hide" }} ) UI:SendMessage("SiegeBigTxt", {{"bigtxtVisible", "hide" }} ) UI:SendMessage("SiegeUI", {{"clearNames", true}} ) UI:SendMessage("SiegeJoin", {{"clearGUI", true }} ) UI:SendMessage("SiegeJoin", {{"UI", "show" }} ) UI:SendMessage("SiegeUI", {{"UI", "hide"}} ) elseif msg.name == "SetPlayerPoints" then UI:SendMessage("SiegeUI", {{"PlayerPoints_t"..msg.param1.."_p"..msg.param2, msg.paramStr }} ) elseif msg.name == "SetPlayerName" then UI:SendMessage("SiegeUI", {{"PlayerName_t"..msg.param1.."_p"..msg.param2, msg.paramStr }} ) UI:SendMessage("SiegeDrop", {{"user", msg.paramObj }} ) UI:SendMessage("SiegeJoin", {{"user", msg.paramObj }} ) elseif msg.name == "StoreClientPlayer" then UI:SendMessage("SiegeBigTxt", {{"bigtxtVisible", "hide" }} ) UI:SendMessage("SiegeJoin", {{"clearGUI", true }} ) UI:SendMessage("SiegeUI", {{"clearNames", true}} ) UI:SendMessage("SiegeText", {{"UI", "hide" }} ) UI:SendMessage("SiegeJoin", {{"UI", "show" }} ) UI:SendMessage("SiegeUI", {{"UI", "hide"}} ) UI:SendMessage("SiegeUI_Attack", {{"siege_showhide", "hide" }}) UI:SendMessage("SiegeUI_Defend", {{"siege_showhide", "hide" }}) UI:SendMessage("SiegeDrop", {{"user", msg.paramObj }} ) UI:SendMessage("SiegeJoin", {{"user", msg.paramObj }} ) elseif msg.name == "FRespawn" then msg.paramObj:Resurrect() elseif msg.name == "ShowDropButton" then UI:SendMessage("SiegeDrop", {{"sgVisible", "show" }} ) elseif msg.name == "HideDropButton" then UI:SendMessage("SiegeDrop", {{"sgVisible", "hide" }} ) elseif msg.name == "SetAnimationSet" then msg.paramObj:SetAnimationSet{strSet = "carry", bPush=true } local eChangeType = "PUSH" msg.paramObj:SetStunned{ StateChangeType = eChangeType, bCantMove = false, bCantTurn = false, bCantAttack = true, bCantEquip = true, bCantInteract = true } elseif msg.name == "ReSpawnTimer" then respawnTime = msg.param1 self:SetVar("Con.rSpawn",respawnTime ) UI:SendMessage("SiegeUI", {{"sgRespawn", "show"}} ) UI:SendMessage("SiegeUI", {{"sgRespawnTime", tostring(respawnTime) }} ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "SpawnTimer" , self ) elseif msg.name == "reSetAnimationSet" then msg.paramObj:SetAnimationSet{strSet = ""} local eChangeType = "POP" msg.paramObj:SetStunned{ StateChangeType = eChangeType, bCantMove = false, bCantTurn = false, bCantAttack = true, bCantEquip = true, bCantInteract = true } elseif msg.name == "SetPlayerColors" then for i = 1, msg.param1 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local TeamColor = self:MiniGameGetTeamColor{teamID = i}.color if GAMEOBJ:GetZoneControlID():MiniGameGetTeam{ playerID = player}.teamID == 1 then colors = 1 else colors = 0 end player:SwapColor{ bodyPiece = 1 , color = colors } -- Set Chest Color player:SwapColor{ bodyPiece = 2 , color = colors } -- Set Legs Color end end elseif msg.name == "SendStartTimer" then if msg.param1 == 0 then UI:SendMessage("SiegeUI", {{"sgtime", " " }} ) else UI:SendMessage("SiegeUI", {{"sgtime", tostring(msg.param1) }} ) end elseif msg.name == "FreezPlayer" then local eChangeType = "PUSH" msg.paramObj:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = false, bCantAttack = true, bCantEquip = true, bCantInteract = true } elseif msg.name == "unFreezPlayer" then local eChangeType = "POP" msg.paramObj:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = false, bCantAttack = true, bCantEquip = true, bCantInteract = true } elseif msg.name == "unFreezAllPlayers" then for i = 1, msg.param1 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local eChangeType = "POP" player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = false, bCantAttack = true, bCantEquip = true, bCantInteract = true } end end elseif msg.name == "FreezAllPlayers" then for i = 1, msg.param1 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local eChangeType = "PUSH" player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = false, bCantAttack = true, bCantEquip = true, bCantInteract = true } end end elseif ( msg.name == "equip" ) then local config = { { "equip", true }, { "owner", "|" .. msg.paramObj:GetID() } ,{"custom_script_server", "scripts/ai/MINIGAME/SIEGE/OBJECTS/LOOT_CAPTURE_OBJECT_SERVER.lua" } } RESMGR:LoadObject { objectTemplate = msg.param1, owner = self, rw = 1.0, bIsLocalPlayer = false, bDroppedLoot = false, configData = config } elseif ( msg.name == "unquip" ) then player:UnEquipItem{ bImmediate = true } player:ResetPrimaryAnimation{} player:ResetSecondaryAnimation{} elseif msg.name == "SendCaptured" then UI:SendMessage("SiegeUI", {{"sgcap"..msg.param1, true }}) elseif msg.name == "resetCaptured" then UI:SendMessage("SiegeUI", {{"sgcapreset", true }}) elseif msg.name == "ShowPlayerStats" then UI:SendMessage("SiegeUI", {{"sgopenchart", "Show" }}) elseif msg.name == "HidePlayerStats" then UI:SendMessage("SiegeUI", {{"sgopenchart", "Hide" }}) elseif msg.name == "Show_HelpScreen" then UI:SendMessage("SiegeUI_Attack", {{"siege_showhide", "show" }}) UI:SendMessage("SiegeUI_Defend", {{"siege_showhide", "show" }}) elseif msg.name == "Hide_HelpScreen" then UI:SendMessage("SiegeUI_Attack", {{"siege_showhide", "hide" }}) UI:SendMessage("SiegeUI_Defend", {{"siege_showhide", "hide" }}) elseif msg.name == "SendTxt_TeamMsgbox" then UI:SendMessage("SiegeUI", {{"sgmsg", msg.paramStr }}) print(msg.paramStr ) elseif msg.name == "Send_State" then UI:SendMessage("SiegeUI", {{"sgstate", msg.paramStr }}) elseif msg.name == "UISetBkGrndColor" then if (msg.param1 == 1) then UI:SendMessage("SiegeUI", {{"sgbckgrnd", true },{"sgteamID", "1"}} ) elseif (msg.param1 == 2) then UI:SendMessage("SiegeUI", {{"sgbckgrnd", true },{"sgteamID", "2"}} ) end elseif msg.name == "SwapTeamtxt" then UI:SendMessage("SiegeUI", {{"swapteamtxt", true }} ) elseif msg.name == "HideQueUI" then UI:SendMessage("SiegeJoin", {{"UI", "hide" }} ) UI:SendMessage("SiegeUI", {{"UI", "show"}} ) elseif msg.name == "ShowHUDUI" then UI:SendMessage("SiegeUI", {{"UI", "show"}} ) elseif msg.name == "ShowScoreBoardUI" then UI:SendMessage("SiegeBigTxt", {{"bigtxtVisible", "hide" }} ) UI:SendMessage("SiegeUI", {{"UI", "show"}} ) UI:SendMessage("SiegeUI", {{"sgopenchart", "Show" }}) UI:SendMessage("SiegeUI", {{"hideHud", true}}) elseif msg.name == "TimeToBeat" then local time = tonumber(msg.paramStr) UI:SendMessage("SiegeUI", {{"sgtimetobeat",SecondsToClock(time) }} ) elseif msg.name == "UISetObjective" then if (msg.param1 == 1) then UI:SendMessage("SiegeUI", {{"sgbckgrnd", true },{"sgteamID", "1"}} ) elseif (msg.param1 == 2) then UI:SendMessage("SiegeUI", {{"sgbckgrnd", true },{"sgteamID", "2"}} ) end UI:SendMessage("SiegeUI", {{"siegeObjective", msg.paramStr }} ) UI:SendMessage("SiegeUI_Attack", {{"siegeObjective", msg.paramStr }} ) UI:SendMessage("SiegeUI_Defend", {{"siegeObjective", msg.paramStr }} ) elseif msg.name == "SetUserObj" then UI:SendMessage("SiegeUI", {{"setUserObj", msg.paramStr }} ) elseif msg.name == "sendTo_Team_1" then for x = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[x] local text = msg.paramStr -- print(text) player:DisplayTooltip { bShow = true, strText = text, iTime = 2000 } end elseif msg.name == "sendTo_Team_2" then for x = 1, #self:MiniGameGetTeamPlayers{teamID = 2}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 2}.objects[x] local text = msg.paramStr -- print(text) player:DisplayTooltip { bShow = true, strText = text, iTime = 2000 } end elseif msg.name == "respawn" then GAMEOBJ:GetTimer():AddTimerWithCancel( msg.param1 , "smashed", self ) elseif msg.name == "SetRespawnTime" then self:SetVar("RespawnTime", msg.param1 ) elseif ( msg.name == "Red_Spawn" ) then storeObjectByName(self, "Red_Spawn_"..self:GetVar("Con.Red_Spawners"), msg.paramObj) local i = self:GetVar("Con.Red_Spawners") + 1 self:SetVar("Con.Red_Spawners", i ) elseif ( msg.name == "Blue_Spawn" ) then storeObjectByName(self, "Blue_Spawn_"..self:GetVar("Con.Blue_Spawners"), msg.paramObj) local i = self:GetVar("Con.Blue_Spawners") + 1 self:SetVar("Con.Blue_Spawners", i ) elseif ( msg.name == "EndRoundTxt" ) then UI:SendMessage("SiegeText", {{"UI", "hide" }} ) UI:SendMessage("SiegeUI", {{"UI", "hide" }} ) UI:SendMessage("SiegeBigTxt", {{"bigtxtVisible", "show" }} ) UI:SendMessage("SiegeBigTxt", {{"bigtxt", msg.paramStr }} ) elseif ( msg.name == "SiegeRewards" ) then UI:SendMessage("SiegeUI", {{"UI", "hide" }} ) UI:SendMessage("SiegeRewards", {{"rewardsVisible", "show" }} ) elseif (msg.name == "SiegeRewardsHide") then UI:SendMessage("SiegeRewards", {{"rewardsVisible", "hide" }} ) --UI:SendMessage("ToggleLeaderboard", {{"displayData",true}} ) end end function onChildLoaded(self,msg) if msg.templateID == 6600 then storeObjectByName(self, "MyLoodOBJ", msg.childID) end end onTimerDone = function(self, msg) if msg.name == "SpawnTimer" then self:SetVar("Con.rSpawn", self:GetVar("Con.rSpawn") - 1) local rtime = self:GetVar("Con.rSpawn") if rtime <= 0 then UI:SendMessage("SiegeUI", {{"sgRespawn", "hide"}} ) self:SetVar("Con.rSpawn", 0 ) else UI:SendMessage("SiegeUI", {{"sgRespawnTime", tostring(rtime) }} ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "SpawnTimer" , self ) end end end function onPlayerReady(self,msg) for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local TeamColor = self:MiniGameGetTeamColor{teamID = i}.color if GAMEOBJ:GetZoneControlID():MiniGameGetTeam{ playerID = player}.teamID == 1 then colors = 1 else colors = 0 end player:SwapColor{ bodyPiece = 1 , color = colors } -- Set Chest Color player:SwapColor{ bodyPiece = 2 , color = colors } -- Set Legs Color end end end ---------------------------------------------------------------- -- StopActivity message -- scoreVar = ( total Score ) -- value1Var = (capts) -- value2Var = (won) -- value3Var = (lost) ---------------------------------------------------------------- function onSendActivitySummaryLeaderboardData(self, msg) end require('o_mis') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_EVENTS') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_STATES') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_PLAYERLOADED') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_PLAYERDIED') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_SWAPTEAMS') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_NOTIFYOBJECT') require('/ai/MINIGAME/SIEGE/SERVER/SIEGE_REWARDS') function onStartup(self) Set = {} -- Basic Game Settings -- --(((((((((((( 1. Enter Level: wait for other players ))))))))))))) Set['GameState'] = "Starting" -- Do Not Change -- Set['Number_Of_Teams'] = 2 -- INT ( Set the number of teams ) Set['Number_Of_PlayersPerTeam'] = 4 -- INT ( Set the number of players on each team ) Set['Rounds_To_Play'] = 3 -- INT ( Set the number of rounds to play ) Set['Minimum_Players_to_Start'] = 2 -- INT ( The min number of players to start game ) Set['Score_To_Complete'] = 3 -- INT ( Set Score to complete a round ) Set['RespawnTime'] = 8 -- INT ( Player Respawn Time after being smashed ) Set['Game_Type'] = "SIEGE" -- INT ( Game Type ) Set['Team_A_Name'] = "Team Chuckles" Set['Team_B_Name'] = "Team BlockHead" --(((((((((((( 4.Prestart Game timer for the Defenders. ))))))))))))) -- Set['Prestart_Time'] = 5 -- Siege Timers Repeats before each round -- Set['Notify_Team_Objectives'] = 3 Set['GameStart_CountDown'] = 5 Set['DefendTime'] = 333 -- End of Round Timers -- Set['State_Results_Timer'] = 5 Set['Barrel_Reset'] = 60 Set['Barrel_Speed'] = 350 -- End Game Timers Set['WonLoastMatchTimer'] = 5 -- Show Txt Won Lost timer Set['ScoreBoardTimer'] = 5 -- Show Score Board Timer Set['LeaderBoardTimer'] = 5 -- Siege Objects Settings -- Set['QB_Object_Group'] = "qb_objects" -- STRING ( Group name of the QB objects ) Set['QB_Oject_Time'] = 10 -- INT ( Build time of rebuild objects ) Set['QB_Oject_Health'] = 5 -- INT ( Heath of the QB ) Set['QB_Object_LOT'] = 6620 -- LOT ( LOT # of the Main object the attackers are building ) Set['QB_Loot_Object'] = 6600 Set['Gate_Object'] = 6484 -- LOT ( LOT # of Gate) -- Siege Points -- All Vars are * 1 Set['CapturObj'] = 10 Set['PickUpObj'] = 5 Set['Deaths'] = 0 Set['Kills'] = 1 Set['Build'] = 1 Set['DestroyQB'] = 1 Set['KillObjCarrier'] = 2 Set['RetrunObj'] = 5 Set['WonMatchMultiplier'] = 100 --(((((((((((( 2. Notify Team Objectives: ))))))))))))) -- Set['Notify_Txt_Team_1'] = "Defend the rebuilds." Set['Notify_Txt_Team_2'] = "Attack and return" Set['Info_Text_1'] = " smashed " Set['Info_Text_2'] = " joined the siege!" Set['Info_Text_3'] = " left the siege." Set['Info_Text_4'] = " picked up a barrel!" Set['Info_Text_5'] = " dropped a barrel!" Set['Info_Text_6'] = " returned a barrel!" Set['Info_Text_7'] = " captured a barrel!" Set['Info_Text_8'] = "Your team lost the Match" Set['Info_Text_9'] = "Your team won the Match" Set['Info_Text_10'] = "Your team lost the Match" Set['Info_Text_11'] = "Your team won the Match" -- SEIGE Object Groups -- Set['Gate_Group'] = "grp_gate" Set['Wall_Group'] = "grp_walls" Set['Mine_Group'] = "grp_mines" -- Player Settings -- Set['CustomPlayer'] = false -- BOOL Set['Health'] = 1 -- INT Set['Armor'] = 1 -- INT Set['Imagination'] = 1 -- INT -- Team Settings -- -- Custom Team Settings color and skills -- Colors are in the database ( dbo_BrickColors ) Set['Use_Themes'] = true -- Bool Set['Use_Skills'] = false -- Bool --- Team 1 --- Set['Team_Color_1'] = 1 -- --- ATK Skills --- Set['Team_Skill_A_1'] = nil -- Set['Team_Skill_B_1'] = nil -- Set['Team_Skill_C_1'] = nil -- Set['Team_Skill_D_1'] = nil -- Set['Team_Skill_E_1'] = nil -- --- Team 2 --- Set['Team_Color_2'] = 0 -- --- ATK Skills --- Set['Team_Skill_A_2'] = nil -- Set['Team_Skill_B_2'] = nil -- Set['Team_Skill_C_2'] = nil -- Set['Team_Skill_D_2'] = nil -- Set['Team_Skill_E_2'] = nil -- --- Game Object Lots --- Set['Number_of_Spawn_Groups'] = 1 --INT Set['Red_Spawners'] = 4847 Set['Blue_Spawners'] = 4848 Set['Blue_Flag'] = 4850 Set['Red_Flag'] = 4851 Set['Red_Point'] = 4846 Set['Blue_Point'] = 4845 Set['Red_Mark'] = 4844 Set['Blue_Mark'] = 4843 Set['WhatTeam'] = "A" ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) self:SetNetworkVar("Set",Set) oStart(self) end function onNotifyObject(self, msg) if( msg) then mainNotifyObject(self, msg) end end function onObjectLoaded(self, msg) if (msg) then mainObjectLoaded(self, msg) end end function onChildLoaded(self, msg) if (msg) then mainChildLoaded(self, msg) end end --------------------------------------------------------------------------------CONSTANTS = {} CONSTANTS["TRAP_IS_SET"] = false local interactRadius = 20 function onStartup(self) self:SetProximityRadius{radius = interactRadius} end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then CONSTANTS["TRAP_IS_SET"] = true end if (CONSTANTS["TRAP_IS_SET"]) then print("the trap is set!") end end function onDie(self, msg) CONSTANTS["TRAP_IS_SET"] = false end function onProximityUpdate(self, msg) if (CONSTANTS["TRAP_IS_SET"] == true) then print("the trap went off!") end end-------------------------------------------------- --quick build to notify switch that it's ready -------------------------------------------------- function onStartup (self) self:AddObjectToGroup{group = "cannonWall"} --print("starting up the qb wall!") end function onRebuildNotifyState (self, msg) --print(tostring(msg.iState)) if (msg.iState == 2) then local friends = self:GetObjectsInGroup{group = "cannonWall", ignoreSpawners = true}.objects --print("wall ready!") for i, wall in pairs(friends) do if wall:GetLOT().objtemplate == 4956 then wall:NotifyObject{name = "wallIsBuilt", ObjIDSender = self} --print("notifying switch") end end end end function onDie (self, msg) local friends = self:GetObjectsInGroup{group = "cannonWall", ignoreSpawners = true}.objects --print("wall down!") for i, wall in pairs(friends) do if wall:GetLOT().objtemplate == 4956 then wall:NotifyObject{name = "wallDown", ObjIDSender = self} end end end ------------------------------------------------- --script to roll the boulder down the hill and smash the spider ------------------------------------------------- function onStartup(self) self:AddObjectToGroup{group = "spiderBoulder"} --self:SetVar("shortPath", false) self:SetVar("longPath", false) print("starting up the boulder") end function onArrived(self, msg) if (msg.wayPoint == 2) then --self:StopPathing() --print("CRASH!") local friends = self:GetObjectsInGroup{group = "spiderBoulder", ignoreSpawners = true}.objects for i, spider in pairs(friends) do if spider:GetLOT().objtemplate == 6457 then spider:Die{killerID = self, killType = "VIOLENT"} end end self:Die() end end function onNotifyObject(self, msg) print("boulder got a message") if (msg.name == "rampDown") then self:SetVar("longPath", true) elseif (msg.name == "rampUp") then self:SetVar("longPath", false) end end function onRebuildNotifyState(self, msg) print("notifying rebuild state for the boulder") if (msg.iState == 2) and (self:GetVar("longPath") == true) then self:StartPathing() elseif (msg.iState == 2) then print("setting boulder to short path") self:Die() end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) self:AddObjectToGroup{group = "SpiderDen"} self:SetVar("turret1", false) self:SetVar("turret2", false) self:SetVar("platformBuilt", false) self:SetVar("TickTime", 2) end function onNotifyObject(self, msg) print("platform got a message") if (msg.name == "killQBTurret1") or (msg.name == "killQBTurret2") then if (msg.name == "killQBTurret1") then self:SetVar("turret1", true) print("setting turret1 to true") else self:SetVar("turret2", true) end elseif (msg.name == "dontShootQBTurret1") or (msg.name == "dontShootQBTurret2") then if (msg.name == "dontShootQBTurret1") then self:SetVar("turret1", false) print("setting turret1 to false") else self:SetVar("turret2", false) end end if (self:GetVar("turret1") == false) and (self:GetVar("platformBuilt") == true) or (self:GetVar("turret2") == false) and (self:GetVar("platformBuilt") == true) then GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then --self:SetFaction{faction = 108} --print("platform set to faction 108") self:SetVar("platformBuilt", true) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) then object:NotifyObject{name = "killPlatform", ObjIDSender = self} end end if (self:GetVar("turret1") == false) and (self:GetVar("turret2") == false) then GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end end end function onTimerDone(self, msg) self:Die() print("spider destroyed the platform!") end function onDie(self, msg) print("platform down!") self:SetVar("platformBuilt", false) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) then object:NotifyObject{name = "platformDead", ObjIDSender = self} end end endfunction onStartup(self) self:AddObjectToGroup{group = "DenSwitch"} --print("starting up switch 1") self:SetVar("switch1", false) self:SetVar("switch2", false) self:SetVar("TickTime", 30) end function onFireEvent(self, msg) print("switch 1 activated") self:SetVar("switch1", true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) local friends = self:GetObjectsInGroup{group = "DenSwitch", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6541) then print("telling switch 2") object:NotifyObject{name = "switch1Activated", ObjIDSender = self} end end if (self:GetVar("switch1") == true) and (self:GetVar("switch2") == true) then print("both switches activated") local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) then object:NotifyObject{name = "superTurretFired", ObjIDSender = self} end end end end function onNotifyObject(self, msg) print("switch 1 got a message") if (msg.name == "switch2Activated") then self:SetVar("switch2", true) elseif (msg.name == "switch2Deactivated") then self:SetVar("switch2", false) end end function onTimerDone(self, msg) print("switch 1 deactivated") self:SetVar("switch1", false) local friends = self:GetObjectsInGroup{group = "DenSwitch", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6541) then object:NotifyObject{name = "switch1Deactivated", ObjIDSender = self} end end endfunction onStartup(self) self:AddObjectToGroup{group = "DenSwitch"} --print("starting up switch 2") self:SetVar("switch1", false) self:SetVar("switch2", false) self:SetVar("TickTime", 30) end function onFireEvent(self, msg) print("switch 2 activated") self:SetVar("switch2", true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) local friends = self:GetObjectsInGroup{group = "DenSwitch", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6540) then object:NotifyObject{name = "switch2Activated", ObjIDSender = self} end end if (self:GetVar("switch1") == true) and (self:GetVar("switch2") == true) then print("both switches activated") local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) then object:NotifyObject{name = "superTurretFired", ObjIDSender = self} end end end end function onNotifyObject(self, msg) print("switch 2 got a message") if (msg.name == "switch1Activated") then self:SetVar("switch1", true) elseif (msg.name == "switch1Deactivated") then self:SetVar("switch1", false) end end function onTimerDone(self, msg) print("switch 2 deactivated") self:SetVar("switch2", false) local friends = self:GetObjectsInGroup{group = "DenSwitch", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6540) then object:NotifyObject{name = "switch2Deactivated", ObjIDSender = self} end end endfunction onStartup(self) self:AddObjectToGroup{group = "spiderDrill"} --self:SetVar("killSpider", false) print("starting up the drill") end function onArrived(self, msg) if (msg.wayPoint == 1) then print("on waypoint " .. msg.wayPoint) local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 4956) then object:NotifyObject{name = "drillDown", ObjIDSender = self} end end elseif (msg.wayPoint == 0) then print("on waypoint " .. msg.wayPoint) local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 4956) then object:NotifyObject{name = "drillUp", ObjIDSender = self} end end --[[elseif (msg.wayPoint == 3) then self:Die() print("on waypoint " .. msg.wayPoint) local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6457) then print("killing the spider") object:Die{killerID = self, killType = "VIOLENT"} elseif (object:GetLOT().objtemplate == 5651) then print("toggling the trigger") object:ToggleTrigger{enable = false} end end--]] end end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 4956) then object:NotifyObject{name = "readyToMove", ObjIDSender = self} end end elseif (msg.iState == 0) then local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 4956) then object:NotifyObject{name = "notReadyToMove", ObjIDSender = self} end end end end --[[function onNotifyObject(self, msg) print("drill got a message") if msg.name == "killTheSpider" then print("got message to kill the spider") self:GoToWaypoint{iPathIndex = 3} elseif msg.name == "missTheSpider" then print("got message to miss the spider") self:GoToWaypoint{iPathIndex = 0} end end--]]require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) self:AddObjectToGroup{group = "SpiderDen"} Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then --print("*******AI ENABLED*******") self:SetFaction{faction = 106} setState("AiEnable",self) ProximityPuls(self) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) or (object:GetLOT().objtemplate == 6539) then object:NotifyObject{name = "killQBTurret1", ObjIDSender = self} end end end end function onDie(self, msg) print("turret down!") local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) or (object:GetLOT().objtemplate == 6539) then object:NotifyObject{name = "dontShootQBTurret1", ObjIDSender = self} end end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 function onStartup(self) self:AddObjectToGroup{group = "SpiderDen"} Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 40 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then --print("*******AI ENABLED*******") self:SetFaction{faction = 106} setState("AiEnable",self) ProximityPuls(self) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) or (object:GetLOT().objtemplate == 6539) then object:NotifyObject{name = "killQBTurret2", ObjIDSender = self} end end end end function onDie(self, msg) print("turret down!") local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6537) or (object:GetLOT().objtemplate == 6539) then object:NotifyObject{name = "dontShootQBTurret2", ObjIDSender = self} end end endfunction onStartup(self) --print("rail A starting up") end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then --print("rail A finished!") local friends = self:GetObjectsInGroup{group = "SpiderRailTurret", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6528) then object:NotifyObject{name = "firstPoint", ObjIDSender = self} end end end endfunction onStartup(self) --print("rail B starting up") end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then local friends = self:GetObjectsInGroup{group = "SpiderRailTurret", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6528) then object:NotifyObject{name = "lastPoint", ObjIDSender = self} end end end endfunction onStartup(self) --print("starting up the rail turret") self:SetVar("finalDestination", false) self:SetVar("firstDestination", false) self:SetVar("isBuilt", false) self:SetVar("effectTime", 2) end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then self:SetVar("isBuilt", true) --print("the rail turret is built") --[[else self:SetVar("isBuilt", false) print("the rail turret is not built")--]] end end function onNotifyObject(self, msg) --print("the turret got a message") if (msg.name == "fire") and (self:GetVar("isBuilt") == true) then --print("firing") self:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("effectTime") , "effectTime", self ) end if (msg.name == "firstPoint") and (self:GetVar("finalDestination") == true) then --self:SetVar("firstDestination", true) self:GoToWaypoint{iPathIndex = 2, bAllowPathingDirectionChange = false} elseif (msg.name == "firstPoint") then self:SetVar("firstDestination", true) self:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = false} elseif (msg.name == "lastPoint") and (self:GetVar("firstDestination") == true) then self:SetVar("finalDestination", true) self:GoToWaypoint{iPathIndex = 2, bAllowPathingDirectionChange = false} elseif (msg.name == "lastPoint") then self:SetVar("finalDestination", true) --print("final destination set to true") end end function onTimerDone(self, msg) self:StopFXEffect{name = "moviespotlight"} end function onArrived(self, msg) --print("at a waypoint" .. msg.wayPoint) if (msg.wayPoint == 2) then --print("at waypoint three") local friends = self:GetObjectsInGroup{group = "SpiderRailTurret", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 4956) then object:NotifyObject{name = "arrivedAtFinalWayPoint", ObjIDSender = self} end end end endfunction onStartup(self) --print("starting up the switch") self:SetVar("finalDestination", false) --self:SetVar("firstDestination", false) end function onNotifyObject(self, msg) --print("the switch got a message") if (msg.name == "arrivedAtFinalWayPoint") then self:SetVar("finalDestination", true) end end function onFireEvent(self, msg) --print("switch activated") local friends = self:GetObjectsInGroup{group = "SpiderRailTurret", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6528) then object:NotifyObject{name = "fire", ObjIDSender = self} end end if (self:GetVar("finalDestination") == true) then --local friends = self:GetObjectsInGroup{group = "SpiderRailTurret", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 5652) then object:ToggleTrigger{enable = false} elseif (object:GetLOT().objtemplate == 6457) then object:NotifyObject{name = "shocked", ObjIDSender = self} end end end endfunction onStartup(self) print("ramp starting up") end function onArrived(self, msg) if (msg.wayPoint == 0) then --self:StopPathing() print("at waypoint 1") local friends = self:GetObjectsInGroup{group = "spiderBoulder", ignoreSpawners = true}.objects for i, object in pairs(friends) do if object:GetLOT().objtemplate == 6514 then object:NotifyObject{name = "rampDown", ObjIDSender = self} print("sending message to ramp") end end elseif (msg.wayPoint == 1) then local friends = self:GetObjectsInGroup{group = "spiderBoulder", ignoreSpawners = true}.objects for i, object in pairs(friends) do if object:GetLOT().objtemplate == 6514 then object:NotifyObject{name = "rampUp", ObjIDSender = self} print("sending second message to ramp") end end end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) self:SetVar("HitTime", 3) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 135 -- Aggro Radius Set['conductRadius'] = 100 -- Conduct Radius Set['tetherRadius'] = 150 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 135 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 999 -- Min Wander Delay Set['WanderDelayMax'] = 999 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onNotifyObject(self, msg) print("spider got a message!") if msg.name == "shocked" then self:PlayAnimation{animationID = "spider-electrocute"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("HitTime") , "HitTime", self ) end end function onTimerDone(self, msg) self:Die() endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) -------------------------------------- --add the spider to a group -------------------------------------- self:AddObjectToGroup{group = "SpiderDen"} self:SetVar("TickTime", 5) self:SetVar("killTurret1", false) self:SetVar("killTurret2", false) self:SetVar("killMovingPlatform", false) self:SetVar("amStunned", false) self:SetVar("StunTime", 15) self:SetVar("amHit", false) self:SetVar("HitTime", 1.8) --print("spider boss 2 starting up!") Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 135 -- Aggro Radius Set['conductRadius'] = 135 -- Conduct Radius Set['tetherRadius'] = 135 -- Tether Radius Set['tetherSpeed'] = 0 -- Tether Speed Set['wanderRadius'] = 0 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 135 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onNotifyObject(self, msg) if (msg.name == "killQBTurret1") or (msg.name == "killQBTurret2") then self:SetFaction{faction = 107} --print("faction set to 107 for spider") GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) if (msg.name == "killQBTurret1") then self:SetVar("killTurret1", true) else self:SetVar("killTurret2", true) end elseif (msg.name == "dontShootQBTurret1") and (self:GetVar("killMovingPlatform" == true)) or (msg.name == "dontShootQBTurret2") and (self:GetVar("killMovingPlatform" == true)) then if (msg.name == "dontShootQBTurret1") then self:SetVar("killTurret1", false) else self:SetVar("killTurret2", false) end if (self:GetVar("killTurret1") == false) and (self:GetVar("killTurret2") == false) then --self:SetFaction{faction = 109} --print("***spider faction set to 109***") GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end elseif (msg.name == "dontShootQBTurret1") or (msg.name == "dontShootQBTurret2")then if (msg.name == "dontShootQBTurret1") then self:SetVar("killTurret1", false) else self:SetVar("killTurret2", false) end if(self:GetVar("killTurret1") == false) and (self:GetVar("killTurret2") == false) then self:SetFaction{faction = 38} print("spider faction set to 38") GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end elseif (msg.name == "killPlatform") then self:SetVar("killMovingPlatform", true) --self:SetFaction{faction = 109} --print("*_*spider faction set to 109*_*") GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) elseif (msg.name == "platformDead") and (self:GetVar("killTurret1") == false) and (self:GetVar("killTurret2") == false) then self:SetVar("killMovingPlatform", false) self:SetFaction{faction = 38} --print("spider faction set to 38!") GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) elseif (msg.name == "superTurretFired") then print("super turret fired!") self:SetFaction{faction = 110} self:SetVar("amStunned", true) self:SetVar("amHit", true) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6626) then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end end self:PlayAnimation{animationID = "spider-laser"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("HitTime") , "HitTime", self ) end end function onTimerDone(self, msg) print("spider boss timer finished") if (self:GetVar("amHit") == true) and (self:GetVar("amStunned") == true) then print("spider getting hit!") self:SetVar("amHit", false) local friends = self:GetObjectsInGroup{group = "SpiderDen", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6626) then object:StopFXEffect{name = "moviespotlight"} end end self:PlayAnimation{animationID = "spider-stun"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("StunTime") , "StunTime", self ) elseif (self:GetVar("amHit") == false) and (self:GetVar("amStunned") == true) then print("spider no longer stunned") self:SetVar("amStunned", false) self:SetFaction{faction = 38} self:PlayAnimation{animationID = "idle"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) elseif (self:GetVar("amStunned") == false) and (self:GetVar("amHit") == false) then print("pPulse, spider not stunned!") ProximityPuls(self) end end function onOnHit(self, msg) print("spider got hit!") endfunction onStartup(self) self:AddObjectToGroup{group = "spiderBoulder"} --self:SetVar("killself", false) end -------------------------------------------------------------------------------- --tells the leg to get trapped inside the bear trap if built -------------------------------------------------------------------------------- function onNotifyObject(self, msg) if msg.name == "crash" then --self:SetVar("killself", true) self:Die() end end------------------------------------------------ --switch to fire the cannon in the second room ------------------------------------------------ --local INTERACT_RADIUS = 1.5 function onStartup(self) self:AddObjectToGroup{group = "spiderDrill"} --self:SetProximityRadius{radius = INTERACT_RADIUS} self:SetVar("drillInPlace", false) self:SetVar("rebuildComplete", false) self:SetVar("FireTime", 3) --print("starting up the cannon switch!") end function onNotifyObject(self, msg) --print("switch got a message ") if msg.name == "drillDown" then self:SetVar("drillInPlace", true) --print("drill in place") elseif msg.name == "drillUp" then self:SetVar("drillInPlace", false) --print("drill up") elseif msg.name == "readyToMove" then self:SetVar("rebuildComplete", true) --print("ready to move the drill") elseif msg.name == "notReadyToMove" then self:SetVar("rebuildComplete", false) end end function onFireEvent(self, msg) --print("switch activated!!") --local isHuman = msg.objId:GetIsHumanPlayer().bIsHuman --print(tostring(isHuman)) local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawner = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6528) then --print("telling drill to kill the spider") object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end end GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("FireTime") , "FireTime", self ) if (self:GetVar("rebuildComplete") == true) and (self:GetVar("drillInPlace") == true) then self:NotifyClientObject{name = "playCine"} --print("ready to fire, searching for trigger") local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawner = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6457) then --print("telling drill to kill the spider") object:NotifyObject{name = "shocked", ObjIDSender = self} elseif (object:GetLOT().objtemplate == 5651) then object:ToggleTrigger{enable = false} end --[[elseif (self:GetVar("rebuildComplete") == true) and (self:GetVar("drillInPlace") == false) then local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawner = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6528) then object:NotifyObject{name = "missTheSpider", ObjIDSender = self} end--]] end end end function onTimerDone(self, msg) local friends = self:GetObjectsInGroup{group = "spiderDrill", ignoreSpawner = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6528) then object:StopFXEffect{name = "moviespotlight"} end end endrequire('o_mis') ------------------------------------------------------------------------------------------------ --client side script to play a cinematic when the cannon and quick build are both activated ------------------------------------------------------------------------------------------------ function onStartup(self) --print("ready!") end function onNotifyClientObject(self, msg) if (msg.name == "playCine") then local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) playerID:PlayCinematic{pathName = "SpiderRetreat1"} end end --[[function onFireEvent(self, msg) print("event fired!") local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then local player =msg.objectID player:PlayCinematic{pathName = "SpiderRetreat1"} end end--]]------------------------------------------------ --switch to fire the cannon in the first room ------------------------------------------------ function onStartup(self) print("starting up the laser switch!") self:SetVar("TickTime", 3) end function onFireEvent(self, msg) print("switch activated!!") local friends = self:GetObjectsInGroup{group = "laser1", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6626) then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end end GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "HitTime", self ) local friends = self:GetObjectsInGroup{group = "Crate2", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6452) then object:Die{killerID = self, killType = "VIOLENT"} end end end function onTimerDone(self, msg) local friends = self:GetObjectsInGroup{group = "laser1", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6626) then object:StopFXEffect{name = "moviespotlight"} end end endfunction onStartup(self) self:AddObjectToGroup{group = "spiderTrap"} self:SetVar("trapSet", false) --print("Trap A ready!") end function onNotifyObject(self, msg) if (msg.name == "trapBIsSet") then self:SetVar("trapSet", true) --print("got message from trap B!") end end function onRebuildNotifyState(self, msg) if (msg.iState == 2) and (self:GetVar("trapSet") == true) then local friends = self:GetObjectsInGroup{group = "spiderTrap", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6457) then object:Die{killerID = self, killType = "VIOLENT"} --print("Spider Dead!") elseif (object:GetLOT().objtemplate == 5651) then object:ToggleTrigger{enable = false} end end elseif (msg.iState == 2) then local friends = self:GetObjectsInGroup{group = "spiderTrap", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6517) then object:NotifyObject{name = "trapAIsSet"} end end end endfunction onStartup(self) self:AddObjectToGroup{group = "spiderTrap"} self:SetVar("trapSet", false) --print("Trap B ready!") end function onNotifyObject(self, msg) if (msg.name == "trapAIsSet") then self:SetVar("trapSet", true) --print("got message from trap A!") end end function onRebuildNotifyState(self, msg) if (msg.iState == 2) and (self:GetVar("trapSet") == true) then local friends = self:GetObjectsInGroup{group = "spiderTrap", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6457) then object:Die{killerID = self, killType = "VIOLENT"} --print("Spider Dead!") elseif (object:GetLOT().objtemplate == 5651) then object:ToggleTrigger{enable = false} end end elseif (msg.iState == 2) then --print("getting ready to send message to object!") local friends = self:GetObjectsInGroup{group = "spiderTrap", ignoreSpawners = true}.objects for i, object in pairs(friends) do if (object:GetLOT().objtemplate == 6516) then --print("sending message to object!") object:NotifyObject{name = "trapBIsSet", ObjectIDSender = self} end end end end------------------------------------------------------ --Spider Egg script ------------------------------------------------------ local interactRadius = 15 local hatchTime = 1.0 function onStartup(self) self:SetProximityRadius { radius = interactRadius } --print("Egg Startup!") end function onProximityUpdate(self, msg) local isHuman = msg.objId:IsCharacter().isChar local hatchSpider = 1 local chanceToHatch = math.random(3) if (msg.status == "ENTER") and (isHuman) and (chanceToHatch == hatchSpider) then --print("Look out!") self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) --local pos = self:GetPosition().pos --self:Die() --RESMGR:LoadObject { objectTemplate = 6444 , x = pos.x , y = pos.y , z = pos.z , owner = self } --elseif (chanceToHatch ~= hatchSpider) then --print("I'm a dud!") end end function onTimerDone(self, msg) --print("timer done!") self:PlayFXEffect{name = "bubbleSprayAttack", effectID = 212, effectType = "cast"} local pos = self:GetPosition().pos self:Die() RESMGR:LoadObject { objectTemplate = 6444 , x = pos.x , y = pos.y , z = pos.z , owner = self } endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:AddObjectToGroup{group = "spiderGroup"} self:SetVar("legTrap", false) end -------------------------------------------------------------------------------- --tells the leg to get trapped inside the bear trap if built -------------------------------------------------------------------------------- function onNotifyObject(self, msg) if msg.name == "trapIsSet" then self:SetVar("legTrap", true) elseif msg.name == "trapDisarmed" then self:SetVar("legTrap", false) self:FollowWaypoints{bPaused = false} end end function onArrived(self, msg) if (msg.wayPoint == 1) and self:GetVar("legTrap") == true then self:StopPathing() print("Awesome!" .. tostring(self:GetVar("legTrap"))) end end-------------------------------------------------- --script to attach to the spider wall that spawns a quick build when destroyed -------------------------------------------------- function onStartup (self) --print("starting up the spider wall!") end --[[function onRebuildNotifyState (self, msg) --print(tostring(msg.iState)) if (msg.iState == 2) then local friends = self:GetObjectsInGroup{group = "cannonWall", ignoreSpawners = true}.objects --print("wall ready!") for i, wall in pairs(friends) do if wall:GetLOT().objtemplate == 4956 then wall:NotifyObject{name = "wallIsBuilt", ObjIDSender = self} --print("notifying switch") end end end end function onDie (self, msg) local friends = self:GetObjectsInGroup{group = "cannonWall", ignoreSpawners = true}.objects --print("wall down!") for i, wall in pairs(friends) do if wall:GetLOT().objtemplate == 4956 then wall:NotifyObject{name = "wallDown", ObjIDSender = self} end end end--]] function onDie(self, msg) print("spider wall down!") local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x - 10, y = mypos.y, z = mypos.z - 20 }.string local myRot = self:GetRotation() local parent = msg.killerID; local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", 5}, {"no_timed_spawn", false}, {"CheckPrecondition" , "0:21"} } RESMGR:LoadObject { objectTemplate = 6483, x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config, owner = parent } end-------------------------------------------------- --script on the QB wall that spawns another quick build when destroyed and resets it's faction -------------------------------------------------- function onStartup (self, msg) --print("QB wall starting up!") self:SetFaction{faction = 6} --print("wall faction set to 6!") end function onRebuildNotifyState(self, msg) --print("notifying state") if (msg.iState == 2) then self:SetFaction{faction = 37} --print("faction set to 37") elseif (msg.iState == 0) then self:SetFaction{faction = 6} --print("faction set to 6") end end function onDie (self, msg) if msg.killerID:GetID() ~= "0" then --print("QB wall down!") local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x - 10, y = mypos.y, z = mypos.z - 20 }.string local myRot = self:GetRotation() local parent = msg.killerID; local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true}, {"CheckPrecondition" , "0:21"} } --print("spawning QB") RESMGR:LoadObject { objectTemplate = 6483, x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config, owner = parent } end end-------------------------------------------------- --script to attach to the spider wall that spawns a quick build when destroyed -------------------------------------------------- function onStartup (self, msg) --print("QB wall starting up!") --self:SetFaction{faction = 6} end function onDie (self, msg) if msg.killerID:GetID() ~= "0" then --print("QB wall down!") local mypos = self:GetPosition().pos local posString = self:CreatePositionString{ x = mypos.x - 15, y = mypos.y, z = mypos.z - 10}.string local myRot = self:GetRotation() local parent = msg.killerID; local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", false}--[[, {"CheckPrecondition" , "0:21"}--]] } --print("spawning QB") RESMGR:LoadObject { objectTemplate = 6483, x= mypos.x, y= mypos.y , z= mypos.z, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config, owner = parent } end end-------------------------------------------------------------- -- Generic Survival Instance Server Zone Script: requiring this -- file gives the custom functions for the Survival game. -- updated mrb... 8/4/10 -- fixed UI exit bugs -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') --////////////////////////////////////////////////////////////////////////////////// local gConstants = {} local tMobSets = {} local tSpawnerNetworks = {} --============================================================ -- Script only local variables local gGamestate = { tPlayers = {}, -- players who have entered the game tWaitingPlayers = {}, -- players who haven't accepted yet iTotalSpawned = 0, -- total number of spawned mobs iWaveNum = 1, -- current wave number iRewardTick = 1, -- number of rewards given iNumberOfPlayers = 0, -- number of players given from ZoneLoadedInfo } --////////////////////////////////////////////////////////////////////////////////// -- helper function that prints out a variable to the log function dumpVar(name,var,indent) if( indent == nil ) then indent = "" end if( type(var) == "table" ) then print( indent .. name .. " is a table with " .. #var .. " entries:" ) local i,v = next(var) while i do dumpVar(i,v,indent .. " ") i, v = next(var, i) end else local startOfLine = indent .. name .. " is " if( type(var) == "userdata" ) then if( type(var.GetID) == "function" ) then print( startOfLine .. "an object proxy with ID = " .. var:GetID() ) else print( startOfLine .. "unknown userdata" ) end elseif( var == nil ) then print( startOfLine .. "nil" ) elseif( var == true ) then print( startOfLine .. "true" ) elseif( var == false ) then print( startOfLine .. "false" ) else print( startOfLine .. "a(n) " .. type(var) .. " with value = " .. var ) end end end function onZoneLoadedInfo(self, msg) gGamestate.iNumberOfPlayers = msg.maxPlayersSoft end function basePlayerReady(self, msg, newMsg) if not self:GetVar('SurvivalStartupComplete') then self:SetVar('SurvivalStartupComplete', true) --SurvivalStartup() end --SetPlayerSpawnPoints(self) end ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function baseStartup(self, newMsg) -- Initialize the pseudo random number generator and return math.randomseed( os.time() ) self:SetVar('playersAccepted', 0) self:SetVar('playersReady', false) self:MiniGameSetParameters{numTeams = 1, playersPerTeam = 4} -- print('*****************************************************') -- dumpVar('tSpawnerNetworks', tSpawnerNetworks, ' ') -- print('*****************************************************') end ---------------------------------------------------------------- -- Player has loaded into the map ---------------------------------------------------------------- function basePlayerLoaded(self, msg, newMsg) -- adding the players to the gGamestate tables table.insert(gGamestate.tPlayers, msg.playerID:GetID()) table.insert(gGamestate.tWaitingPlayers, msg.playerID:GetID()) -- adding player to mini game team self:MiniGameAddPlayer{playerID = msg.playerID} self:MiniGameSetTeam{playerID = msg.playerID, teamID = 1} --print('my team is ' .. self:MiniGameGetTeam{ playerID = msg.playerID}.teamID) -- setting up player ui self:NotifyClientZoneObject{name = 'Define_Player_To_UI', paramObj = msg.playerID, rerouteID = msg.playerID,param1 = gGamestate.iNumberOfPlayers} -- freeze the player movement/controls --msg.playerID:SetUserCtrlCompPause{bPaused = true} if not self:GetVar('wavesStarted') then -- updating the scoreboard for the new players for k,v in ipairs(gGamestate.tPlayers) do self:NotifyClientZoneObject{name = 'Update_ScoreBoard', paramObj = GAMEOBJ:GetObjectByID(v), paramStr = "0", param1 = 0, param2 = 0} end self:NotifyClientZoneObject{name = 'Show_ScoreBoard', paramStr = msg.playerID:GetID()} end -- move players to correct spawn locations SetPlayerSpawnPoints(self) if not self:GetVar('wavesStarted') then for k,v in ipairs(gGamestate.tPlayers) do local bPass = false for key,value in ipairs(gGamestate.tWaitingPlayers) do if value == v then bPass = true end end if not bPass then self:NotifyClientZoneObject{name = 'PlayerConfirm_ScoreBoard', paramObj = GAMEOBJ:GetObjectByID(v)} end end -- removed so timer wont auto start --if table.maxn(gGamestate.tWaitingPlayers) == 0 then -- --print('All players have accepted') -- ActivityTimerStopAllTimers(self) -- ActivityTimerStart(self, 'AllAcceptedDelay', 1, gConstants.startDelay) --(timerName, updateTime, stopTime) --elseif #gGamestate.tPlayers > #gGamestate.tWaitingPlayers then -- if not self:GetVar('AcceptedDelayStarted') then -- self:SetVar('AcceptedDelayStarted', true) -- ActivityTimerStart(self, 'AcceptedDelay', 1, gConstants.acceptedDelay ) --(timerName, updateTime, stopTime) -- else -- ActivityTimerReset(self, 'AcceptedDelay') -- end --elseif #gGamestate.tPlayers >= gGamestate.iNumberOfPlayers then -- --self:SetVar('AcceptedDelayStarted', true) -- ActivityTimerStart(self, 'AcceptedDelay', 1, gConstants.acceptedDelay ) --(timerName, updateTime, stopTime) --end else local playerID = msg.playerID if not playerID then return end table.insert(gGamestate.tWaitingPlayers, v) UpdatePlayer(self, playerID) --playerID:SetUserCtrlCompPause{bPaused = false} GetLeaderboardData(self, playerID, 5) --set player stats to max playerID:SetHealth{health = playerID:GetMaxHealth{}.health} --print('max health = ' .. playerID:GetMaxHealth{}.health) playerID:SetArmor{armor = playerID:GetMaxArmor{}.armor} playerID:SetImagination{imagination = playerID:GetMaxImagination{}.imagination} end end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function basePlayerExit(self, msg, newMsg) local playerNum = 0 --print('player ' .. msg.playerID:GetName().name .. ' has exited') for i = 1, table.maxn(gGamestate.tPlayers) do if gGamestate.tPlayers[i] == msg.playerID:GetID() then playerNum = i end end if playerNum ~= 0 then table.remove(gGamestate.tPlayers, playerNum) -- set player to not auto-respawn msg.playerID:SetPlayerAllowedRespawn{dontPromptForRespawn=false} end playerNum = 0 for k,v in ipairs(gGamestate.tWaitingPlayers) do if msg.playerID:GetID() == v then playerNum = k end end if playerNum ~= 0 then table.remove(gGamestate.tWaitingPlayers, playerNum) end if not self:GetVar('wavesStarted') then for k,v in ipairs(gGamestate.tPlayers) do local bPass = false for key,value in ipairs(gGamestate.tWaitingPlayers) do if value == v then bPass = true end end if not bPass then self:NotifyClientZoneObject{name = 'PlayerConfirm_ScoreBoard', paramObj = GAMEOBJ:GetObjectByID(v)} end end --print('num of players left waiting: ' .. #gGamestate.tWaitingPlayers) if #gGamestate.tPlayers == 0 then return end if table.maxn(gGamestate.tWaitingPlayers) == 0 then --print('All players have accepted') ActivityTimerStopAllTimers(self) ActivityTimerStart(self, 'AllAcceptedDelay', 1, gConstants.startDelay) --(timerName, updateTime, stopTime) elseif #gGamestate.tPlayers > #gGamestate.tWaitingPlayers then if not self:GetVar('AcceptedDelayStarted') then self:SetVar('AcceptedDelayStarted', true) ActivityTimerStart(self, 'AcceptedDelay', 1, gConstants.acceptedDelay ) --(timerName, updateTime, stopTime) --else -- removed so timer wont auto start -- ActivityTimerReset(self, 'AcceptedDelay') end end else UpdatePlayer(self, msg.playerID, true) if checkAllPlayersDead() then GameOver(self, msg.playerID) end end SetActivityValue(self, msg.playerID, 1, 0) gGamestate.iNumberOfPlayers = gGamestate.iNumberOfPlayers - 1 end ---------------------------------------------------------------- -- Received a fire event messaged from someplace on the server ---------------------------------------------------------------- function baseFireEvent(self,msg, newMsg) if msg.args == 'start' then StartWaves(self) elseif msg.args == 'DeactivateRewards' then --print('fireevent DeactivateRewards') spawnerResetT(tSpawnerNetworks.rewardNetworks) end end ---------------------------------------------------------------- -- A player had died ---------------------------------------------------------------- function basePlayerDied(self, msg, newMsg) local finalTime = ActivityTimerGetCurrentTime(self, 'ClockTick') SetActivityValue(self, msg.playerID, 1, finalTime) self:NotifyClientZoneObject{name = 'Player_Died', paramObj = msg.playerID, rerouteID = msg.playerID, param1 = finalTime, paramStr = tostring(checkAllPlayersDead())} -- GameOver(self, msg.playerID) end ---------------------------------------------------------------- -- Received a notify object message ---------------------------------------------------------------- function baseNotifyObject(self, msg, newMsg) local player = msg.ObjIDSender -- check to make sure the player is in the activity if not IsPlayerInActivity(self, player) then return end -- update kill score UpdateActivityValue(self, player, 0, msg.param1) end ---------------------------------------------------------------- -- This is called when players hit the UI to exit or stop the game. ---------------------------------------------------------------- function baseMessageBoxRespond(self, msg, newMsg) if (msg.identifier == "RePlay" ) then --print("************* RePlay *************"..msg.sender:GetName().name) self:NotifyClientZoneObject{name = 'PlayerConfirm_ScoreBoard', paramObj = msg.sender} PlayerAccepted(self, msg.sender) elseif (msg.identifier == "Exit_Question" ) and msg.iButton == 1 then --print("************* Exit *************"..msg.sender:GetName().name) ResetStats(msg.sender) self:NotifyClientZoneObject{name = 'Exit_Waves', paramObj = msg.sender, paramStr = '0', param1 = 0, param2 = 0} -- send player to a specific location msg.sender:TransferToLastNonInstance{ playerID = msg.sender, bUseLastPosition = false, pos_x = 131.83, pos_y = 376, pos_z = -180.31, rot_x = 0, rot_y = -0.268720, rot_z = 0, rot_w = 0.963218} --msg.sender:TransferToLastNonInstance{ playerID = msg.sender, bUseLastPosition = true } end end -- Custom Functions function setGameVariables(passedConstants, passedMobSets, passedSpawnerNetworks) --print('updated') gConstants = passedConstants tMobSets = passedMobSets tSpawnerNetworks = passedSpawnerNetworks end ---------------------------------------------------------------- -- Custom function: Checks to see if all players have accepted, -- if they have then the game is started. ---------------------------------------------------------------- function PlayerAccepted(self, playerID) local playerNum = 0 for k,v in ipairs(gGamestate.tWaitingPlayers) do if playerID:GetID() == v then playerNum = k end end if playerNum == 0 then return end table.remove(gGamestate.tWaitingPlayers, playerNum) --print('num of players left waiting: ' .. #gGamestate.tWaitingPlayers) if table.maxn(gGamestate.tWaitingPlayers) == 0 and #gGamestate.tPlayers >= gGamestate.iNumberOfPlayers then --print('All players have accepted') ActivityTimerStopAllTimers(self) ActivityTimerStart(self, 'AllAcceptedDelay', 1, gConstants.startDelay) --(timerName, updateTime, stopTime) else if not self:GetVar('AcceptedDelayStarted') then self:SetVar('AcceptedDelayStarted', true) ActivityTimerStart(self, 'AcceptedDelay', 1, gConstants.acceptedDelay) --(timerName, updateTime, stopTime) --else -- removed so timer wont auto start -- ActivityTimerReset(self, 'AcceptedDelay') end end end function ResetStats(playerID) -- set the player's imag, health and armor to full if playerID:Exists() then --set player stats to max --print('health = ' .. playerID:GetHealth{}.health) --print('armor = ' .. playerID:GetArmor{}.armor) --print('imagination = ' .. playerID:GetImagination{}.imagination) playerID:SetHealth{health = playerID:GetMaxHealth{}.health} playerID:SetArmor{armor = playerID:GetMaxArmor{}.armor} playerID:SetImagination{imagination = playerID:GetMaxImagination{}.imagination} --print('new health = ' .. playerID:GetHealth{}.health) --print('new armor = ' .. playerID:GetArmor{}.armor) --print('new imagination = ' .. playerID:GetImagination{}.imagination) --print('new imagination = ' .. playerID:GetImagination{}.imagination) end end ---------------------------------------------------------------- -- Custom function: Starts the game. ---------------------------------------------------------------- function StartWaves(self) SetupActivity(self, 4) self:SetVar('playersReady', true) self:SetVar('baseMobSetNum', 1) self:SetVar('randMobSetNum', 1) self:SetVar('AcceptedDelayStarted', false) gGamestate.tWaitingPlayers = {} for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end table.insert(gGamestate.tWaitingPlayers, v) UpdatePlayer(self, playerID) GetLeaderboardData(self, playerID, 5) ResetStats(playerID) end -- needed to get rewards -- taskType = DB name for series of achievments, target = activityID, value1 = what it will evaluate local sTaskType = 'survival_time_team' if #gGamestate.tPlayers == 1 then sTaskType = 'survival_time_solo' end self:SetVar('missionType', sTaskType) --print('start smashables') activateSpawnerNetwork(tSpawnerNetworks.smashNetworks) self:SetVar('wavesStarted', true) self:NotifyClientZoneObject{name = 'Start_Wave_Message', paramStr = "Start!"} end ---------------------------------------------------------------- -- Custom function: Checks to see if all the players are dead, -- then stops the game. ---------------------------------------------------------------- function checkAllPlayersDead() local deadPlayers = 0 for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end if playerID:IsDead().bDead then deadPlayers = deadPlayers + 1 end end if deadPlayers == table.maxn(gGamestate.tPlayers) then return true end return false end function SetPlayerSpawnPoints(self) for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end local spawnObj = self:GetObjectsInGroup{ group = 'P' .. k .. '_Spawn', ignoreSpawners = true }.objects[1] if spawnObj then local pos = spawnObj:GetPosition().pos local rot = spawnObj:GetRotation() playerID:Teleport{pos = pos, x = rot.x, y = rot.y, z = rot.z, w = rot.w, bSetRotation = true} end end end ---------------------------------------------------------------- -- Custom function: Happens when all players have died, this -- stops all running processes and resets gGamestate variables ---------------------------------------------------------------- function GameOver(self, player) if not checkAllPlayersDead() then return end local finalTime = ActivityTimerGetCurrentTime(self, 'ClockTick') ActivityTimerStopAllTimers(self) --print('Kill Mobs ***') spawnerResetT(tSpawnerNetworks.baseNetworks) spawnerResetT(tSpawnerNetworks.randNetworks) spawnerResetT(tSpawnerNetworks.rewardNetworks) for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end local timeVar = GetActivityValue(self, playerID, 1) local scoreVar = GetActivityValue(self, playerID, 0) self:NotifyClientZoneObject{name = 'Update_ScoreBoard', paramObj = playerID, paramStr = tostring(scoreVar), param1 = timeVar} playerID:Resurrect() --print('smashed = ' .. smashVar .. ' out of ' .. gGamestate.iTotalSpawned .. ' for ' .. ' score = ' .. scoreVar .. ' @ %' .. math.floor((smashVar/gGamestate.iTotalSpawned)*100) ) local sTaskType = self:GetVar('missionType') or 'survival_time_team' playerID:UpdateMissionTask{ taskType = sTaskType, value = timeVar, value2 = self:GetActivityID().activityID} -- target = self, -- update mission 479 if the player is on it and has lasted 60 seconds local misState = playerID:GetMissionState{missionID = 479}.missionState if misState > 1 and misState < 4 and timeVar >= 60 then playerID:UpdateMissionTask{taskType = "complete", value = 479, value2 = 1, target = self} end -- this is to have everyone get their own time at the end of the match StopActivity(self, playerID, scoreVar, timeVar) --print('***************************') --print('send update mission task') --print(playerID:GetName().name .. ' ' .. self:GetName().name) --print(sTaskType) --print(self:GetLOT().objtemplate) --print(timeVar) --print('***************************') end -- this is to have everyone get the same time at the end of the match --for k,v in ipairs(gGamestate.tPlayers) do -- local playerID = GAMEOBJ:GetObjectByID(v) -- if not playerID then return end -- StopActivity(self, playerID, scoreVar, finalTime) --end --print('smashed = ' .. GetActivityValue(self, player, 2) .. ' score = ' .. GetActivityValue(self, player, 1)) -- reset ticks gGamestate.iWaveNum = 1 -- current wave number gGamestate.iRewardTick = 1 -- number of rewards given gGamestate.iTotalSpawned = 0 -- number of mobs smashed self:SetVar('wavesStarted', false) -- set the spawner networks back to the origional LOT's if gConstants.bUseMobLots then gConstants.iLotPhase = 1 -- put LotPhase back to 1 updateMobLots(self, tSpawnerNetworks.baseNetworks) updateMobLots(self, tSpawnerNetworks.randNetworks) end SetPlayerSpawnPoints(self) end function basePlayerResurrected(self, msg, newMsg) self:NotifyClientZoneObject{name = 'Show_ScoreBoard', paramStr = msg.playerID:GetID()} --ActivityTimerStart(self, 'AcceptedDelay', 1, gConstants.acceptedDelay ) --(timerName, updateTime, stopTime) -- removed so timer wont auto start end ---------------------------------------------------------------- -- Custom function: Gets a random number that is not the old number ---------------------------------------------------------------- function newRand(oldNum, maxRand) if maxRand == 1 then return '01', '01' end local randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end while randNum == oldNum do --print('found same') randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end end return randNum end ---------------------------------------------------------------- -- Custom function: Starts a spawner network ---------------------------------------------------------------- function activateSpawnerNetwork(spawnNetwork) for k,v in ipairs(spawnNetwork) do for i = 1, v.spawnerNum do --print('activateSpawnerNetwork: ' .. v.spawnerName .. '0' .. i) local spawner = LEVEL:GetSpawnerByName(v.spawnerName[i] .. v.spawnerNum) if spawner then --print('activateSpawnerNetwork --> ' .. v.spawnerName .. '0' .. i) if not spawner:SpawnerIsActive().bActive then --print('activate now') spawner:SpawnerActivate() end --print('reset now') spawner:SpawnerReset() end end end end ---------------------------------------------------------------- -- Custom function: Resets a spawner network ---------------------------------------------------------------- function spawnerResetT(spawnNetwork, bMaintainSpawnNum, iNumToMaintain) local TotalSpawned = 0 --dumpVar('resetTable', spawnNetwork, ' ') for k,v in ipairs(spawnNetwork) do for i = 1, table.maxn(v.spawnerName) do local spawner = LEVEL:GetSpawnerByName(v.spawnerName[i] .. v.spawnerNum) if spawner then --print('reset: ' .. v.spawnerName[i] .. v.spawnerNum) local numSpawned = spawner:SpawnerGetTotalSpawned() if numSpawned then --track total mobs spawned TotalSpawned = TotalSpawned + numSpawned.iSpawned end v.bIsActive = false if not bMaintainSpawnNum then spawner:SpawnerDestroyObjects() end if iNumToMaintain then spawner:SpawnerSetNumToMaintain{uiNum = iNumToMaintain} --print('set spawn number to ' .. iNumToMaintain) end spawner:SpawnerDeactivate() end end end if TotalSpawned > gGamestate.iTotalSpawned then gGamestate.iTotalSpawned = TotalSpawned end end ---------------------------------------------------------------- -- Custom function: Spawns mobs on a spawner network, Now... ---------------------------------------------------------------- function spawnNow(spawner, spawnNum) if spawner then --print('*** Spawn Now!!') if not spawner:SpawnerIsActive().bActive then spawner:SpawnerSetNumToMaintain{uiNum = spawnNum} spawner:SpawnerActivate() else spawner:SpawnerSetNumToMaintain{uiNum = spawnNum} spawner:SpawnerReset() end end end ---------------------------------------------------------------- -- Custom function: Returns a random spawn set from tMobSets or false ---------------------------------------------------------------- function getRandomSet(setName, setNum) local randNum = math.random(1, #tMobSets[setName]['tier' .. setNum]) local randSet = tMobSets[setName]['tier' .. setNum][randNum] --dumpVar('** ' .. setName .. ' using: ' .. randNum, randSet) if randSet then return randSet end return false end ---------------------------------------------------------------- -- Custom function: Returns a random spawner number from the given -- spawner table or false ---------------------------------------------------------------- function getRandomSpawnerNum(tSpawner) local randNum = 0 local bValid = false while not bValid do randNum = 0 for k,v in ipairs(tSpawner) do if v.bIsLocked == false then randNum = randNum + 1 end end randNum = math.random(1, randNum) if randNum == 1 then bValid = true elseif not tSpawner[randNum].bIsActive then bValid = true tSpawner[randNum].bIsActive = true end end if randNum ~= 0 then return randNum end return false end ---------------------------------------------------------------- -- Custom function: Update the spawner in the specified way ---------------------------------------------------------------- function updateSpawner(self, tSpawner, spawnNum) if not tSpawner then return end if spawnNum then --print('Spawner: ' .. tSpawner.spawnerName[1] .. tSpawner.spawnerNum .. ' spawn: ' .. spawnNum) local spawner = LEVEL:GetSpawnerByName(tSpawner.spawnerName[1] .. tSpawner.spawnerNum) spawnNow(spawner, spawnNum) return end local newSet = getRandomSet(tSpawner.set, self:GetVar(tSpawner.set .. 'Num')) if newSet then local newSpawner = getRandomSpawnerNum(tSpawner) for k,v in ipairs(newSet) do if v ~= 0 then --print('Spawner: ' .. tSpawner[newSpawner].spawnerName[k] .. tSpawner[newSpawner].spawnerNum .. ' spawn: ' .. tSpawner[newSpawner].spawnerNum) local spawner = LEVEL:GetSpawnerByName(tSpawner[newSpawner].spawnerName[k] .. tSpawner[newSpawner].spawnerNum) spawnNow(spawner, v) end end end end ---------------------------------------------------------------- -- Custom function: Update the objects that are being spawned on -- a spawner network based on the LotPhase of the game. ---------------------------------------------------------------- function updateMobLots(self, tSpawner) local iPhase = gConstants.iLotPhase -- search through the given table to find the spanwer network for k,v in ipairs(tSpawner) do for i,name in ipairs(v.spawnerName) do if name ~= nil then local spawner = LEVEL:GetSpawnerByName(name .. v.spawnerNum) local tempName = split(name, "_") local lotName = tempName[2] if not lotName then lotName = tempName[1] end if spawner then -- Update the spawn set template ID based on the new LOT spawner:SpawnerSetSpawnTemplateID{iObjTemplate = tMobSets.mobLots[lotName][iPhase]} --print('swapped ' .. name .. v.spawnerNum .. ' for: ' .. tMobSets.mobLots[lotName][iPhase]) end end end end end ---------------------------------------------------------------- -- Custom function: splits a string based on patern and returns a table ---------------------------------------------------------------- function split(str, pat) local t = {} -- NOTE: use {n = 0} in Lua-5.0 local fpat = "(.-)" .. pat local last_end = 1 local s, e, cap = str:find(fpat, 1) while s do if s ~= 1 or cap ~= "" then table.insert(t,cap) end last_end = e+1 s, e, cap = str:find(fpat, last_end) end if last_end <= #str then cap = str:sub(last_end) table.insert(t, cap) end return t end ---------------------------------------------------------------- -- Custom function: Decides how to spawne mobs ---------------------------------------------------------------- function spawnMobs(self) if not self:GetVar('wavesStarted') then return end gGamestate.iWaveNum = gGamestate.iWaveNum + 1 local spawnNum = gGamestate.iWaveNum if spawnNum > gConstants.rewardInterval then spawnNum = spawnNum - (gGamestate.iRewardTick-1) end for k,v in ipairs(gConstants.baseMobsStartTierAt) do if spawnNum == v then --print('************** Base Tier ' .. v .. ' **************') self:SetVar('baseMobSetNum', k) end end for k,v in ipairs(gConstants.randMobsStartTierAt) do if spawnNum == v then self:SetVar('randMobSetNum', k) --print('************** Random Tier ' .. v .. ' **************') end end if gGamestate.iWaveNum == gConstants.unlockNetwork3 then tSpawnerNetworks.randNetworks[3].bIsLocked = false end spawnerResetT(tSpawnerNetworks.baseNetworks, true, 0) spawnerResetT(tSpawnerNetworks.randNetworks, true, 0) updateSpawner(self, tSpawnerNetworks.baseNetworks) --print('**** Spawn Tier' .. self:GetVar('baseMobSetNum') .. ' BaseMobs @ ' .. spawnNum .. '****') if spawnNum >= gConstants.startMobSet2 then -- gGamestate.iWaveNum >= gConstants.startMobSet2 and if spawnNum == gConstants.startMobSet2 then --print('************** Start Random Mobs Set 2 **************') self:NotifyClientZoneObject{name = "Spawn_Mob", paramStr = "2"} end --print('**** Spawn Tier' .. self:GetVar('randMobSetNum') .. ' RandMobs1 @ ' .. spawnNum .. '****') updateSpawner(self, tSpawnerNetworks.randNetworks) end if spawnNum >= gConstants.startMobSet3 then --gGamestate.iWaveNum >= gConstants.startMobSet3 and if spawnNum == gConstants.startMobSet3 then --print('************** Start Random Mobs Set 3 **************') self:NotifyClientZoneObject{name = "Spawn_Mob", paramStr = "3"} end --print('**** Spawn Tier' .. self:GetVar('randMobSetNum') .. ' RandMobs2 ' .. spawnNum .. '****') updateSpawner(self, tSpawnerNetworks.randNetworks) end -- check if we need to update the spawner network template ID, if we have reached the end of our spawn pattern and we want to use lots if gConstants.bUseMobLots and gConstants.iLotPhase < #tSpawnerNetworks.baseNetworks[1].spawnerName then if spawnNum >= gConstants.baseMobsStartTierAt[#gConstants.baseMobsStartTierAt] then gConstants.iLotPhase = gConstants.iLotPhase + 1 gGamestate.iWaveNum = 1 updateMobLots(self, tSpawnerNetworks.baseNetworks) updateMobLots(self, tSpawnerNetworks.randNetworks) --print('updating to next phase ' .. gConstants.iLotPhase) end end end ---------------------------------------------------------------- -- When activity is stopped this is needed to update the leaderboard. ---------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- get the time for the player --print('Score = ' .. msg.fValue1) --print('Time = ' .. msg.fValue2) msg.outActivityRating = msg.fValue2 return msg end -- activity timers ---------------------------------------------------------------- -- When ActivityTimerUpdate is sent, basically when a timer hits it updateInterval. ---------------------------------------------------------------- function onActivityTimerUpdate(self, msg) if msg.name == "AcceptedDelay" then --print('update delay timer to ' .. math.ceil(msg.timeRemaining)) self:NotifyClientZoneObject{name = 'Update_Default_Start_Timer', param1 = math.ceil(msg.timeRemaining)} elseif msg.name == "ClockTick" then self:NotifyClientZoneObject{name = 'Update_Timer', param1 = msg.timeElapsed} elseif msg.name == "SpawnTick" and not self:GetVar('isCoolDown') then spawnMobs(self) end end ---------------------------------------------------------------- -- When ActivityTimerDone is sent, basically when the activity timer has reached it's duration. ---------------------------------------------------------------- function onActivityTimerDone(self, msg) if msg.name == "AcceptedDelay" then --or msg.name == "AllAcceptedDelay" --print('update delay timer to 0') self:NotifyClientZoneObject{name = 'Update_Default_Start_Timer', param1 = 0} ActivityTimerStart(self, 'AllAcceptedDelay', 1, 1) elseif msg.name == "AllAcceptedDelay" then --or msg.name == "AllAcceptedDelay" --print('accepted delay *******************************') self:NotifyClientZoneObject{name = 'Kill_Default_Start_Timer'} self:NotifyClientZoneObject{name = 'Kill_ScoreBoard'} self:NotifyClientZoneObject{name = 'Reset_Timer'} ActivityTimerStart(self, 'StartDelay', 3, 3) --(timerName, updateTime, stopTime) StartWaves(self) elseif msg.name == "StartDelay" then --print('adding in timers *******************************') ActivityTimerStart(self, 'ClockTick', 1) --(timerName, updateTime, stopTime) ActivityTimerStart(self, 'SpawnTick', gConstants.waveTime) --(timerName, updateTime, stopTime) spawnMobs(self) ActivityTimerStart(self, 'CoolDownStart', (gConstants.rewardInterval*gConstants.waveTime), (gConstants.rewardInterval*gConstants.waveTime)) --(timerName, updateTime, stopTime) ActivityTimerStart(self, 'PlaySpawnSound', 3, 3) --(timerName, updateTime, stopTime) elseif msg.name == "CoolDownStart" then --print('cool down start timer *******************************') self:SetVar('isCoolDown', true) ActivityTimerStop(self, 'SpawnTick') ActivityTimerStart(self, 'CoolDownStop', gConstants.coolDownTime, gConstants.coolDownTime) --print('**** Reward ****') updateSpawner(self, tSpawnerNetworks.rewardNetworks[1], 1) gGamestate.iRewardTick = gGamestate.iRewardTick + 1 --print('stopping clock tick') ActivityTimerStart(self, 'CoolDownTick', 1, gConstants.coolDownTime) --(timerName, updateTime, stopTime) spawnerResetT(tSpawnerNetworks.baseNetworks, true, 0) spawnerResetT(tSpawnerNetworks.randNetworks, true, 0) elseif msg.name == "CoolDownStop" then --print('cool down stop timer *******************************') self:SetVar('isCoolDown', false) ActivityTimerStart(self, 'SpawnTick', gConstants.waveTime) --(timerName, updateTime, stopTime) ActivityTimerStart(self, 'CoolDownStart', (gConstants.rewardInterval*gConstants.waveTime), (gConstants.rewardInterval*gConstants.waveTime)) --(timerName, updateTime, stopTime) spawnMobs(self) ActivityTimerStart(self, 'PlaySpawnSound', 3, 3) --(timerName, updateTime, stopTime) elseif msg.name == "PlaySpawnSound" then -- play war horn sound for k,v in ipairs(gGamestate.tPlayers) do GAMEOBJ:GetObjectByID(v):PlayNDAudioEmitter{m_NDAudioEventGUID = '{ca36045d-89df-4e96-a317-1e152d226b69}'} end end end function baseActivityStateChangeRequest(self, msg, newMsg) if (msg.wsStringValue == "gamestate" ) then self:NotifyClientZoneObject{name = "SetGameState"} end end -------------------------------------------------------------- -- Generic Survival Instance Client Zone Script: Including this -- file gives the custom functions for the Survival game. -- Updated stc... 5/19/10 - changed UI message structure to work with the game state system -- updated mrb... 8/4/10 -- fixed UI exit bugs -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('ai/L_ACTIVITY_MANAGER') --////////////////////////////////////////////////////////////////////////////////// -- local variables local teamScoreBoard = {} local tMedalsSolo = { {name = Localize("Missions_467_name"), score = 300}, -- 467; Survivor {name = Localize("Missions_468_name"), score = 600} } -- 468; Ultimate Survivor local tMedals = { {name = Localize("Missions_392_name"), score = 60}, -- 392; Outwit {name = Localize("Missions_393_name"), score = 180}, -- 393; Outplay {name = Localize("Missions_394_name"), score = 300}, -- 394; Outlast {name = Localize("Missions_395_name"), score = 420}, -- 395; Survivalist {name = Localize("Missions_396_name"), score = 480}, -- 396; Be Prepared! {name = Localize("Missions_397_name"), score = 540}, -- 397; Paramedics! {name = Localize("Missions_398_name"), score = 600}, } -- 398; Unstoppable! local bFirstTime = true local iNumberOfPlayers = 0 --------------------------------------------------------------- -- Startup of the object ----------------------------------------------------------------. function onCharacterUnserialized(self, msg) UI:SendMessage( "pushGameState", {{"state", "Survival"}}) end function checkScoreBoardTable(self, tScoreBoard, bRemoveTable) local t = teamScoreBoard local tTemp = {} local isUsed = false for k,v in ipairs(teamScoreBoard) do if v.nameVar ~= Localize("SURVIVAL_NO_PLAYER") and v.nameVar ~= tScoreBoard.nameVar and v.nameVar ~= '' then table.insert(tTemp,v) --print('add old player to used table ' .. v.nameVar) end if v.nameVar == tScoreBoard.nameVar and bRemoveTable then isUsed = true end end if not isUsed then table.insert(tTemp,tScoreBoard) --print('add new player to used table ' .. tScoreBoard.nameVar) end table.sort(tTemp, function(a,b) return a.nameVarb.timeVar end) self:SetVar("playerNum", table.maxn(tTemp)) while table.maxn(tTemp) < 4 do local tempName = "" if table.maxn(tTemp) < iNumberOfPlayers then tempName = Localize("SURVIVAL_NO_PLAYER") end table.insert(tTemp, { nameVar = "", timeVar = 0, scoreVar = 0}) end --print('***************') --for k,v in ipairs(tTemp) do -- print('*** player ' .. k .. ' ***') -- print(tTemp[k].nameVar .. ' time: ' .. tTemp[k].timeVar .. ' score: ' .. tTemp[k].scoreVar) -- print('***************') --end return tTemp end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 or nSeconds == nil then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function numToString(iNum) if bFirstTime and (iNum == 0 or iNum == nil) then return "--" end return tostring(iNum) end function showScoreBoard(self) p = teamScoreBoard if not p then print('missing scoreboard data') return end --for k,v in ipairs(p) do print("**"..p[k].nameVar) end -- Hide timer ui UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }}) -- Show UI UI:SendMessage("ToggleSurvivalSummary", { { "visible", true }, { "p1_check", false }, -- checkmarks { "p2_check", false }, { "p3_check", false }, { "p4_check", false }, { "p1_name", p[1].nameVar }, -- names { "p2_name", p[2].nameVar }, { "p3_name", p[3].nameVar }, { "p4_name", p[4].nameVar }, { "p1_time", SecondsToClock(p[1].timeVar) }, -- times { "p2_time", SecondsToClock(p[2].timeVar) }, { "p3_time", SecondsToClock(p[3].timeVar) }, { "p4_time", SecondsToClock(p[4].timeVar) }, { "p5_time", SecondsToClock(p[1].timeVar) }, { "p1_score", numToString(p[1].scoreVar) }, -- score { "p2_score", numToString(p[2].scoreVar) }, { "p3_score", numToString(p[3].scoreVar) }, { "p4_score", numToString(p[4].scoreVar) }, { "p5_score", numToString(p[1].scoreVar + p[3].scoreVar + p[2].scoreVar + p[4].scoreVar) }} ) end function PlayerConfirm(self, playerID) local playerNum = "" for k,v in ipairs(teamScoreBoard) do --print('my name is ' .. teamScoreBoard[k].nameVar) if playerID:GetName().name == teamScoreBoard[k].nameVar then playerNum = tostring(k) end end UI:SendMessage("UpdateSurvivalSummary", {{"p" .. playerNum .. "_check", true }} ) end function setTeamUI(self) local num = #self:MiniGameGetTeamPlayers{teamID = 1}.objects --print('set team ui') if num > 1 then for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] if i == 1 then player:TeamAddPlayerMsg{name = self:MiniGameGetTeamPlayers{teamID = 1}.objects[1], bIsLeader = true} end player:TeamAddPlayerMsg{name = self:MiniGameGetTeamPlayers{teamID = 1}.objects[1]} player:RequestTeamUIUpdate{} end end end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local eChangeType = "POP" if bFreeze then if playerID:IsDead().bDead then --print('frozen') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Freeze_Again", self ) return end eChangeType = "PUSH" end playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } --print('Player ' .. playerID:GetName().name .. ' ' .. eChangeType .. ' is frozen: ' .. tostring(self:GetVar('frozen')) .. ' ' .. tostring(playerID:GetStunned().bCanMove)) if playerID:GetStunned().bCanMove and eChangeType == "PUSH" then --print(playerID:GetName().name .. ' is still able to move') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Try_Freeze_Again", self ) end end function onNotifyClientObject(self, msg) if msg.name == "ToggleLeaderBoard" and msg.paramObj:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true}, {"nextOnly", true} } ) end end function onNotifyClientZoneObject(self, msg) --if msg.name ~= "Update_Default_Start_Timer" then print('notify ' .. msg.name) end if msg.name == "Start_Timer" then -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) elseif msg.name == "Player_Died" then -- add ui timer UI:SendMessage( "UpdateSurvivalScoreboard", {{"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( msg.param1 ) }, {"inextbesttime", SecondsToClock(msg.param1) }, {"inextbestname", Localize("SURVIVAL_DEAD_RIGHT_SIDE_NAME_PLATE") } } ) self:SetVar("displayDeath", true) if msg.paramStr == "false" then UI:SendMessage( "UpdateSurvivalScoreboard", { {"survivalNote", Localize("SURVIVAL_DEAD_TOOL_TIP_MESSAGE")} } ) end UI:SendMessage("pushGameState", { {"state", "SurvivalLeaderboard" } }) elseif msg.name == "Update_Timer" then if self:GetVar("displayDeath") then UI:SendMessage( "UpdateSurvivalScoreboard", {{"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( msg.param1 )} } ) else if self:GetVar("HoldingTopScore") then UI:SendMessage( "UpdateSurvivalScoreboard", {{"itime", SecondsToClock( msg.param1 ) }, {"inextbesttime", SecondsToClock(msg.param1) }, {"inextbestname", msg.paramObj:GetName().name } } ) else UI:SendMessage( "UpdateSurvivalScoreboard", {{"itime", SecondsToClock( msg.param1 ) } }) checkNextHighScore(self, msg.param1) end end elseif msg.name == "Update_Default_Start_Timer" then if self:GetVar("displayDeath") then UI:SendMessage( "UpdateSurvivalScoreboard", {{"iplayerName", "Next Round In"}, {"itime", SecondsToClock( msg.param1 )} } ) end UI:SendMessage( "UpdateSurvivalSummary", {{"visible", true}, {"countdownTime", msg.param1 }} ) elseif msg.name == "Kill_Default_Start_Timer" then --print('Kill Default Start Timer') UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) elseif msg.name == "Kill_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) elseif msg.name == "Reset_Timer" then -- remove ui timer UI:SendMessage( "UpdateSurvivalSummary", { {"countdownTime", " " }, {"p1_check", false }, {"p2_check", false }, {"p3_check", false }, {"p4_check", false }} ) elseif msg.name == "Wave_Message" then UI:SendMessage( "ToggleGenericTextField", {{"visible", true }, {"text", "Wave: " .. msg.paramStr } }) elseif msg.name == "Spawn_Mob" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.paramStr == "2" then player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_1"} player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_2"} elseif msg.paramStr == "3" then player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_2"} player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_3"} end elseif msg.name == "Start_Wave_Message" then self:SetVar("displayDeath", false) UI:SendMessage("ToggleLeaderboard", { {"id", msg.paramStr},{"visible", false} } ) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ShowActivityCountdown() UI:SendMessage( "UpdateSurvivalScoreboard", {{"itime", "00:00"}} ) bFirstTime = false setTeamUI(self) freezePlayer(self) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Post-Game"} GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Pre-Game"} GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_1"} elseif msg.name == "Define_Player_To_UI" then local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- add player to the ui UI:SendMessage( "UpdateSurvivalSummary", {{"user", msg.paramObj }} ) -- set player to auto-respawn playerID:SetPlayerAllowedRespawn{dontPromptForRespawn=true} iNumberOfPlayers = msg.param1 local tempTable = { nameVar = playerID:GetName().name, timeVar = 0, scoreVar = 0 } teamScoreBoard = checkScoreBoardTable(self, tempTable) showScoreBoard(self) UI:SendMessage( "ToggleActivityCloseButton", { {"bShow", true}, {"GameObject", self}, {"MessageName", "toLua"}, {"senderID", playerID} } ) elseif msg.name == "Update_ScoreBoard" then --print('update player ' .. msg.paramObj:GetName().name) local tempTable = { nameVar = msg.paramObj:GetName().name, timeVar = msg.param1, scoreVar = tonumber(msg.paramStr) } teamScoreBoard = checkScoreBoardTable(self, tempTable) elseif msg.name == "Show_ScoreBoard" then local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --print("Show_ScoreBoard " .. playerID:GetName().name) if bFirstTime then showScoreBoard(self) playerID:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Pre-Game"} else playerID:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_2"} playerID:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_3"} playerID:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Post-Game"} end playerID:RequestTeamUIUpdate{} if msg.paramStr == playerID:GetID() then freezePlayer(self, true) end -- clear game vars self:SetVar("HoldingTopScore", false) self:SetVar("NextBest", false ) self:SetVar("NextBestName", false) self:SetVar("bShowedPlayer", false) self:SetVar("FoundPlayer", false ) elseif msg.name == "PlayerConfirm_ScoreBoard" then PlayerConfirm(self, msg.paramObj) elseif msg.name == "Kill_ScoreBoard" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage("ToggleSurvivalSummary", {{"visible", false }}) -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) teamScoreBoard = {} elseif msg.name == "Exit_Waves" then local tempTable = { nameVar = msg.paramObj:GetName().name, timeVar = msg.param1, scoreVar = tonumber(msg.paramStr)} if GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetName().name == tempTable.nameVar then return end --print('remove player ' .. tempTable.nameVar) UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) msg.paramObj:TeamRemovePlayerMsg{name = 'SurvivalTeam'} teamScoreBoard = checkScoreBoardTable(self, tempTable, true) end end function ExitBox(self, player) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then -- display exit box player:DisplayMessageBox{bShow = true, imageID = 1, text = Localize("SURVIVAL_EXIT_QUESTION"), callbackClient = self, identifier = "Exit_Question"} end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) if msg.identifier == "LeaderboardNext" then -- when the player hits the next button on the survival leaderboard UI:SendMessage( "popGameState", {{"state", "SurvivalLeaderboard"}}) self:SetVar("displayDeath", false) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Post-Game"} GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Pre-Game"} showScoreBoard(self) elseif msg.identifier == "ActivityCloseButtonPressed" and msg.iButton == -1 then -- when the player hits the activity close button, the x in the top right ExitBox(self, player) elseif msg.identifier == "Exit" and msg.iButton == 1 then -- when the player hits the exit button on the survival summary UI ExitBox(self, player) elseif msg.identifier == "Exit_Question" and msg.iButton == 1 then -- when the player hit's the check box on the exit question message box clear all the survival UI elements UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) UI:SendMessage("ToggleSurvivalSummary", {{"visible", false }}) UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) UI:SendMessage("ToggleLeaderboard", { {"id", msg.identifier},{"visible", false} } ) UI:SendMessage( "popGameState", {{"state", "Survival"}} ) UI:SendMessage( "popGameState", {{"state", "SurvivalLeaderboard"}}) end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] local n = 1 local tableValues = {} for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Time"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("bShowedPlayer", false) self:SetVar("NextBest", false) self:SetVar("NextBestName", false) self:SetVar("LeaderTable", tableValues) setNextHighScore(self, iScore) end end function setNextHighScore(self, iScore) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local name_value = 0 local score_value = 0 local name = 0 local score = 0 local tableValues = self:GetVar("LeaderTable") or {} local curName = self:GetVar("NextBestName") local playerScore = 0 if not curName then curName = player:GetName().name end for testName = 1, #tableValues do if tableValues[testName] == curName then name = testName score = (testName + 1) if name ~= 1 then name_value = (testName - 2) score_value = (testName - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif name_value == 1 then name_value = 1 score_value = 2 end end if tableValues[testName] == player:GetName().name then self:SetVar("FoundPlayer", true ) playerScore = tableValues[(testName + 1)] end end local uiName = tableValues[name] or player:GetName().name local uiScore = tableValues[score] or playerScore local uiNextName = tableValues[name_value] or player:GetName().name local uiNextScore = tableValues[score_value] or playerScore if not self:GetVar("bShowedPlayer") then uiNextName = uiName uiNextScore = uiScore end if not iScore then iScore = 0 end local tempMedals = tMedals if self:GetVar("playerNum") == 1 then tempMedals = tMedalsSolo end local highestScore = tableValues[2] or 0 if iScore >= math.floor(highestScore) or not self:GetVar("FoundPlayer") then local pass = false for k,v in ipairs(tempMedals) do if iScore < v.score then uiNextName = v.name uiNextScore = v.score pass = true break end end if not pass then self:SetVar("HoldingTopScore", true) uiNextName = player:GetName().name uiNextScore = iScore end end if not self:GetVar("displayDeath") then UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", player:GetName().name}, {"inextbesttime", SecondsToClock(uiNextScore) }, {"inextbestname", tostring(uiNextName) } } ) end self:SetVar("NextBest", math.floor(uiNextScore) ) self:SetVar("NextBestName", uiNextName ) self:SetVar("bShowedPlayer", true) end function checkNextHighScore(self, iScore) if not iScore or not self:GetVar('NextBest') then return end if iScore >= self:GetVar('NextBest') then setNextHighScore(self, iScore) end end function onTimerDone(self, msg) if msg.name == "Try_Freeze_Again" then freezePlayer(self, true) end end-------------------------------------------------------------- -- (SERVER SIDE) Script for monkey in minigame -- -- Reports proximity events to the parent -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) if msg.status == "ENTER" then -- forward the event to the parent getParent(self):FireEvent{args = "monkey_prox", senderID = msg.objId} end end -------------------------------------------------------------- -- continue doign waypoints -- @TODO: modify speed/path/etc -------------------------------------------------------------- function onArrived(self, msg) -- forward the event to the parent getParent(self):FireEvent{args = "monkey_arrived", senderID = self} end -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) end function onTimerDone(self, msg) if (msg.name == "PlayWinAnimation") then self:PlayAnimation{animationID = "interact"} elseif (msg.name == "PlayLoseAnimation") then self:PlayAnimation{animationID = "death"} end end -------------------------------------------------------------- -- (SERVER SIDE) Script for the Lead the Monkey Minigame Button -- -- :: "TargetGroup" config data needs to be set to the group of the game board -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- Called when object is used on the server -------------------------------------------------------------- function onUse(self, msg) -- get the target group config data local targetGroup = self:GetVar("TargetGroup") if (targetGroup) then -- store who pressed me for a query later storeObjectByName(self, "myUser", msg.user) -- send a notify to everyone (should only be a single object) local objects = self:GetObjectsInGroup{ group = targetGroup }.objects for i = 1, table.maxn (objects) do objects[i]:FireEvent{ args = "button_activate", senderID = self } end end end -------------------------------------------------------------- -- (SERVER SIDE) Script for the Lead the Monkey Minigame -- -- :: "spawn_path" config data needs to be set for the grid path per puzzle -- :: assumes triggers are setup for 4 distinct buttons to send fire events -- to the board. event name is "button_activate". sender's LOT is used -- :: assumes spawn_path is setup correctly with points going left to right -- then top to bottom. ex: 1 2 3 4 || 5 6 7 8 || 9 10 11 12 || 13 14 15 16 -- -- Is setup as an activity to give rewards to a single user. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Locals and Constants -------------------------------------------------------------- CONSTANTS = {} CONSTANTS["MONKEYMINI_PROX_RADIUS"] = 1.0 CONSTANTS["MONKEYMINI_LEVEL_CLEAR_DELAY"] = 5.0 CONSTANTS["MONKEYMINI_BUTTON_LOTS"] = {3704, 3705, 3706, 3707} -- order dictates buttons number 1/2/3/4 CONSTANTS["MONKEYMINI_FLOOR_LOTS"] = {3747, 3748, 3749, 3750} -- order dictates item floors 1/2/3/4 CONSTANTS["MONKEYMINI_NUM_BUTTONS"] = #CONSTANTS["MONKEYMINI_BUTTON_LOTS"] CONSTANTS["MONKEYMINI_FLOOR_OFFSET"] = -0.2 CONSTANTS["MONKEYMINI_MAX_OBSTACLES"] = 4 CONSTANTS["MONKEYMINI_GOAL_LOT"] = 3708 CONSTANTS["MONKEYMINI_ITEM_LOT"] = 3709 CONSTANTS["MONKEYMINI_MONKEY_LOT"] = 3710 CONSTANTS["MONKEYMINI_OBSTACLE_LOT"] = 3737 CONSTANTS["MONKEYMINI_TIMEOUT"] = 30.0 -- value for timing out the user LEVEL_DATA = {} ------------------- --B1| 01 02 03 04 | --B2| 05 06 07 08 | --B3| 09 10 11 12 | --B4| 13 14 15 16 | ------------------- LEVEL_DATA[1] = { start = 2, goal = 15, b1 = 5, b2 = 7, b3 = 14, b4 = 16, o1 = 6, o2 = 12, o3 = 0, o4 = 0 } LEVEL_DATA[2] = { start = 12, goal = 4, b1 = 4, b2 = 5, b3 = 13, b4 = 15, o1 = 8, o2 = 11, o3 = 6, o4 = 14 } LEVEL_DATA[3] = { start = 9, goal = 7, b1 = 4, b2 = 13, b3 = 14, b4 = 16, o1 = 10, o2 = 3, o3 = 11, o4 = 0 } LEVEL_DATA[4] = { start = 9, goal = 7, b1 = 4, b2 = 13, b3 = 14, b4 = 12, o1 = 2, o2 = 6, o3 = 10, o4 = 0 } LEVEL_DATA[5] = { start = 1, goal = 11, b1 = 1, b2 = 4, b3 = 13, b4 = 16, o1 = 7, o2 = 10, o3 = 6, o4 = 0 } CONSTANTS["MONKEYMINI_LEVEL_DATA"] = LEVEL_DATA -- debug settings local show_debug = false local load_test_level = false local test_level = 5 -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- Display debug output -------------------------------------------------------------- function DebugOutput(strVal) if (show_debug and show_debug == true) then print(strVal) end end -------------------------------------------------------------- -- Checks the LOT of an object against valid buttons -- and returns the button number 1,2,3,4 in the list -- returns nil otherwise -------------------------------------------------------------- function GetButtonNumber(self, objID) if (CONSTANTS["MONKEYMINI_BUTTON_LOTS"] == nil) then return nil end -- look for a valid button for button = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do if (objID:GetLOT().objtemplate == CONSTANTS["MONKEYMINI_BUTTON_LOTS"][button]) then return button end end return nil end -------------------------------------------------------------- -- Returns true if template is a floor object -------------------------------------------------------------- function IsFloorObject(self, templateID) -- look for a valid floor for floor = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do if (templateID == CONSTANTS["MONKEYMINI_FLOOR_LOTS"][floor]) then return true end end return false end -------------------------------------------------------------- -- Gets a path from config data and tests it -------------------------------------------------------------- function HasValidPath(self) local bPathFound = false local pathName = self:GetVar("spawn_path") if (pathName) then local pathMsg = LEVEL:GetPathWaypoints(pathName) if (tostring(type(pathMsg)) == "table") then -- @TODO: get max waypoints and store for validity? bPathFound = true end end return bPathFound end -------------------------------------------------------------- -- Get the state of a button -------------------------------------------------------------- function GetButtonState(self, buttonNum) local button_states = self:GetVar("ButtonStates") return button_states[buttonNum] end -------------------------------------------------------------- -- Set the state of a button -------------------------------------------------------------- function SetButtonState(self, buttonNum, state) local button_states = self:GetVar("ButtonStates") button_states[buttonNum] = state self:SetVar("ButtonStates", button_states) end -------------------------------------------------------------- -- Adds an object to the board at the specified waypoint pos -------------------------------------------------------------- function AddObject(self, templateID, wpPos) -- get waypoint position local pathName = self:GetVar("spawn_path") local objectPos = GAMEOBJ:GetWaypointPos( pathName, tonumber(wpPos) ) -- special processing for floors if (IsFloorObject(self, templateID) == true) then objectPos.y = objectPos.y + CONSTANTS["MONKEYMINI_FLOOR_OFFSET"] end -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, x = objectPos.x, y = objectPos.y, z = objectPos.z, owner = self } end -------------------------------------------------------------- -- Randomizes the level buttons and returns levelData -------------------------------------------------------------- function RandomizeLevelButtons(self, levelData) -- randomize the button locations before storing the data -- fill the temp table with values from the level local tempTable = {} for button = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do local buttonStr = "b" .. button tempTable[button] = tonumber(levelData[buttonStr]) end -- shuffle the values into a new table local count = 1 local newTable = {} while (#tempTable) and (#tempTable > 0) do local ranVal = math.random(1, #tempTable) newTable[count] = tempTable[ranVal] table.remove(tempTable, ranVal) count = count + 1 end -- store the new table back in level data for button = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do local buttonStr = "b" .. button levelData[buttonStr] = tonumber(newTable[button]) end return levelData end -------------------------------------------------------------- -- Clears the board of objects -------------------------------------------------------------- function ClearLevel(self) RemoveObject(self, "GoalObject") RemoveObject(self, "MonkeyObject") -- remove obstacles for obstacle = 1, CONSTANTS["MONKEYMINI_MAX_OBSTACLES"] do RemoveObject(self, "Obstacle" .. obstacle) end -- remove floors for floor = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do RemoveObject(self, "Floors" .. floor) end -- remove items for button = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do RemoveObject(self, "Item" .. button) SetButtonState(self, button, false) end end -------------------------------------------------------------- -- Returns the number of the button that spawned an item -- based on the waypoint position of that item -------------------------------------------------------------- function FindButtonNumByPos(self, wpPos) -- get level data local levelData = self:GetVar("LevelData") -- find the item based on the waypoint pos for button = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do local bstring = "b" .. button if (tonumber(levelData[bstring]) == tonumber(wpPos)) then return button end end -- not found return nil end -------------------------------------------------------------- -- Removes a stored object by name -------------------------------------------------------------- function RemoveObject(self, objName) local oldChild = getObjectByName(self, objName) if (oldChild ~= nil and oldChild:Exists()) then GAMEOBJ:DeleteObject(oldChild) end end -------------------------------------------------------------- -- Selects a random level and loads it on the board -------------------------------------------------------------- function LoadLevel(self, bReset) -- clear old objects off the board ClearLevel(self) InitVars(self) -- get the last level local lastLevel = tonumber(self:GetVar("LastLevel")) local thisLevel = lastLevel -- select another level while ( (load_test_level == false) and (bReset == false) and (lastLevel == thisLevel) ) do thisLevel = math.random(1, #CONSTANTS["MONKEYMINI_LEVEL_DATA"]) end if (load_test_level == true) then thisLevel = test_level end DebugOutput("Setting monkey minigame to level " .. thisLevel) local levelData = CONSTANTS["MONKEYMINI_LEVEL_DATA"][thisLevel] -- if we are making a new level, randomize button locations if (bReset == false) then levelData = RandomizeLevelButtons(self, levelData) end -- store the level data self:SetVar("LevelData", levelData) self:SetVar("LastLevel", thisLevel) -- spawn objects AddObject(self, CONSTANTS["MONKEYMINI_GOAL_LOT"], levelData.goal) AddObject(self, CONSTANTS["MONKEYMINI_MONKEY_LOT"], levelData.start) -- spawn obstacles for obstacle = 1, CONSTANTS["MONKEYMINI_MAX_OBSTACLES"] do local obsStr = "o" .. obstacle if (levelData[obsStr] and tonumber(levelData[obsStr]) > 0) then AddObject(self, CONSTANTS["MONKEYMINI_OBSTACLE_LOT"], levelData[obsStr]) end end -- spawn floors for button = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do local bstring = "b" .. button AddObject(self, CONSTANTS["MONKEYMINI_FLOOR_LOTS"][button], levelData[bstring]) end end -------------------------------------------------------------- -- Records the waypoint for the button pressed. Used to -- make the monkey move once the waypoint list is full -------------------------------------------------------------- function AddOrderWaypoint(self, itemPos) local wpOrder = self:GetVar("WaypointOrder") local wpSize = self:GetVar("WaypointSize") wpSize = wpSize + 1 -- store waypoints wpOrder[wpSize] = itemPos self:SetVar("WaypointOrder", wpOrder) self:SetVar("WaypointSize", wpSize) -- if our waypoints are full, start the action if (wpSize == CONSTANTS["MONKEYMINI_NUM_BUTTONS"]) then StartAction(self) end end -------------------------------------------------------------- -- Gets a waypoint out of the list for the monkey -------------------------------------------------------------- function GetOrderWaypoint(self, wpNum) -- get the waypoints local wpOrder = self:GetVar("WaypointOrder") local wpSize = self:GetVar("WaypointSize") if (tonumber(wpNum) <= 0 or tonumber(wpNum) > tonumber(wpSize)) then print("ERROR: invalid waypoint number for ordered list on monkey") return nil end -- get the exact waypoint pos return wpOrder[wpNum] end -------------------------------------------------------------- -- Tells the monkey to goto a waypoint -------------------------------------------------------------- function MoveMonkeyToOrderWaypoint(self, curWaypoint) DebugOutput("MOVING MONKEY TO order point " .. curWaypoint) -- are we done with waypoints? if (tonumber(curWaypoint) > CONSTANTS["MONKEYMINI_NUM_BUTTONS"]) then -- then we fail FailLevel(self) else self:SetVar("CurWP", curWaypoint) -- get the position from this order waypoint local wpPos = GetOrderWaypoint(self, curWaypoint) -- get waypoint position local pathName = self:GetVar("spawn_path") local objectPos = GAMEOBJ:GetWaypointPos( pathName, tonumber(wpPos) ) -- get the monkey local monkey = getObjectByName(self, "MonkeyObject") -- move the monkey monkey:GoTo{target = objectPos} end end -------------------------------------------------------------- -- Start moving the monkey through waypoints -------------------------------------------------------------- function StartAction(self) DebugOutput("STARTING THE MOVE") -- cancel the user timeout GAMEOBJ:GetTimer():CancelTimer("UserTimeout", self) self:SetVar("InAction", true) -- start on the first waypoint MoveMonkeyToOrderWaypoint(self, 1) end -------------------------------------------------------------- -- Monkey touched the goal -------------------------------------------------------------- function CompleteLevel(self) DebugOutput("LEVEL COMPLETE") self:SetVar("InAction", false) -- stop the monkey and animate local monkey = getObjectByName(self, "MonkeyObject") monkey:StopPathing() GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PlayWinAnimation", monkey ) -- reward user self:DistributeActivityRewards() -- call activity complete self:CompleteActivity() -- @TODO: add timer to reset level GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["MONKEYMINI_LEVEL_CLEAR_DELAY"], "StartNewLevel",self ) end -------------------------------------------------------------- -- Monkey failed to touch the goal -------------------------------------------------------------- function FailLevel(self) DebugOutput("LEVEL FAILED") self:SetVar("InAction", false) -- stop the monkey and animate local monkey = getObjectByName(self, "MonkeyObject") monkey:StopPathing() GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PlayLoseAnimation", monkey ) -- @TODO: add timer to reset level GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["MONKEYMINI_LEVEL_CLEAR_DELAY"], "RestartLevel",self ) end -------------------------------------------------------------- -- Initialize vars for each use -------------------------------------------------------------- function InitVars(self) -- clear all users self:RemoveActivityUser() -- stores the state of buttons, true means it has been pressed local button_states = {} local wp_order = {} for button = 1, CONSTANTS["MONKEYMINI_NUM_BUTTONS"] do button_states[button] = false wp_order[button] = 0 end self:SetVar("ButtonStates", button_states) -- stores the order of waypoints to travel for the monkey self:SetVar("WaypointOrder", wp_order) self:SetVar("WaypointSize", 0) -- num obstacles loaded self:SetVar("NumObstaclesLoaded", 0) -- num floors loaded self:SetVar("NumFloorsLoaded", 0) -- stores if the activity is in use by a player self:SetVar("InUse", false) -- stores if the monkey is in action self:SetVar("InAction", false) -- time since user started self:SetVar("StartTime", 0) end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- init vars InitVars(self) -- stores the last level loaded, so we init it here to 0 (only time) self:SetVar("LastLevel", 0) -- @TODO: need a Ready var? -- test for valid path if (HasValidPath(self) == false) then print("ERROR: spawn_path config data not contain a valid path for monkey minigame.") else -- startup the game by loading a random level LoadLevel(self, false) end end -------------------------------------------------------------- -- checks to see if the param user is the current correct user for the -- activity. If it is not, will try to add the user as the current user -- for the activity. Returns true if the user was added or is correct -------------------------------------------------------------- function IsCorrectUser(self, user) -- if we have no users, add this user as our user if (tonumber(self:GetNumActivityUsers().numUsers) == 0) then self:AddActivityUser{ userID = user } -- start a timer to time-out for the user? GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["MONKEYMINI_TIMEOUT"], "UserTimeout",self ) -- Store the start time for the user local startTime = GAMEOBJ:GetSystemTime() self:SetVar("StartTime", startTime) return true -- if this is not the right user, quit out elseif (self:ActivityUserExists{ userID = user }.bExists == false) then return false end return true end -------------------------------------------------------------- -- Called when an event is fired onto the object -------------------------------------------------------------- function onFireEvent(self, msg) if (msg.args == "button_activate") then -- validate the user pressing the button local buttonUser = getObjectByName(msg.senderID, "myUser") if (not buttonUser) then return end -- check to see if this is the correct user, or a new user -- will add user if new if (IsCorrectUser(self, buttonUser) == false) then return end -- find out what button was pressed, and if that button has not been pressed yet local buttonNumber = GetButtonNumber(self, msg.senderID) if ( (buttonNumber) and (GetButtonState(self, buttonNumber) == false) ) then -- set button as pressed (to disable further pressing) SetButtonState(self, buttonNumber, true) DebugOutput("pressed button " .. buttonNumber) -- store this as the last button pressed storeObjectByName(self, "LastButton", msg.senderID) -- get the level data and add an item to the board local levelData = self:GetVar("LevelData") local itemPos = levelData["b" .. buttonNumber] AddObject(self, CONSTANTS["MONKEYMINI_ITEM_LOT"], tonumber(itemPos)) -- press the button msg.senderID:PlayFXEffect{effectType = "press"} -- add this position to the order of waypoints to travel -- also starts the action process if the waypoints are full AddOrderWaypoint(self, itemPos) end elseif (msg.args == "monkey_prox") then -- did the monkey run into the goal? if ( (self:GetVar("InAction") == true) and (msg.senderID:GetLOT().objtemplate == CONSTANTS["MONKEYMINI_GOAL_LOT"]) ) then CompleteLevel(self) -- did the monkey run into an obstacle elseif ( (self:GetVar("InAction") == true) and (msg.senderID:GetLOT().objtemplate == CONSTANTS["MONKEYMINI_OBSTACLE_LOT"]) ) then FailLevel(self) end elseif (msg.args == "monkey_arrived") then if (self:GetVar("InAction") == true) then -- get the waypoint and remove the item local curWp = self:GetVar("CurWP") local wpPos = GetOrderWaypoint(self, curWp) local itemNum = FindButtonNumByPos(self, wpPos) RemoveObject(self, "Item" .. itemNum) -- goto next waypoint curWp = curWp + 1 MoveMonkeyToOrderWaypoint(self, curWp) end end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- is this a goal object if msg.templateID == CONSTANTS["MONKEYMINI_GOAL_LOT"] then -- remove old object, add new RemoveObject(self, "GoalObject") storeObjectByName(self, "GoalObject", msg.childID) -- is this the monkey object elseif msg.templateID == CONSTANTS["MONKEYMINI_MONKEY_LOT"] then -- remove old object, add new RemoveObject(self, "MonkeyObject") storeObjectByName(self, "MonkeyObject", msg.childID) msg.childID:SetProximityRadius{ radius = CONSTANTS["MONKEYMINI_PROX_RADIUS"] } -- store who the parent is storeParent(self, msg.childID) -- is this an item object created from a button elseif msg.templateID == CONSTANTS["MONKEYMINI_ITEM_LOT"] then -- get the last button local lastButton = getObjectByName(self, "LastButton") if (lastButton ~= nil) then -- store this item based on the button that created it local buttonNumber = GetButtonNumber(self, lastButton) if (buttonNumber) then local itemStr = "Item" .. buttonNumber RemoveObject(self, itemStr) storeObjectByName(self, itemStr, msg.childID) end end -- is this an obstacle elseif msg.templateID == CONSTANTS["MONKEYMINI_OBSTACLE_LOT"] then -- get the last obstacle local lastObstacle = tonumber(self:GetVar("NumObstaclesLoaded")) if (lastObstacle ~= nil) then -- increase obstacles loaded lastObstacle = lastObstacle + 1 self:SetVar("NumObstaclesLoaded", lastObstacle) -- store this one local itemStr = "Obstacle" .. lastObstacle RemoveObject(self, itemStr) storeObjectByName(self, itemStr, msg.childID) msg.childID:SetProximityRadius{ radius = 4 } -- store who the parent is storeParent(self, msg.childID) end -- is this a floor elseif IsFloorObject(self, msg.templateID) then -- get the last floor local lastFloor = tonumber(self:GetVar("NumFloorsLoaded")) if (lastFloor ~= nil) then -- increase floors loaded lastFloor = lastFloor + 1 self:SetVar("NumFloorsLoaded", lastFloor) -- store this one local itemStr = "Floor" .. lastFloor RemoveObject(self, itemStr) storeObjectByName(self, itemStr, msg.childID) end end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "StartNewLevel") then LoadLevel(self, false) elseif (msg.name == "RestartLevel") then LoadLevel(self, true) elseif (msg.name == "UserTimeout") then FailLevel(self) end end -------------------------------------------------------------- -- Called when the activity is trying to calculate final rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- calculate total time spent for user as the rating local endTime = GAMEOBJ:GetSystemTime() local startTime = self:GetVar("StartTime") local totalTime = tonumber(endTime) - tonumber(startTime) msg.outActivityRating = totalTime return msg end -------------------------------------------------------------- -- Called when the activity is trying completed -------------------------------------------------------------- function onDoCompleteActivityEvents(self, msg) -- @TODO: add any completion events here msg.userID:DisplayTooltip{ bShow = true, strText = "You completed the monkey game!", iTime = 5000 } end require('o_mis') function onStartup(self) end function onUse(self, msg) local bouncer = getParent(self) if bouncer and bouncer:GetID() ~= "0" then bouncer:NotifyObject{name = "switchPressed"} else print("Bouncer object has no parent!") end end--require('ai/ACT/L_BOUNCER_BASIC') require('o_mis') CONSTANTS = {} CONSTANTS["radius"] = 6 CONSTANTS["switchTemplate"] = {} CONSTANTS["switchTemplate"][3353] = 3354 CONSTANTS["switchTemplate"][3427] = 3430 CONSTANTS["switchTemplate"][3428] = 3431 CONSTANTS["offsetMagnitude"] = 20 function onStartup(self) self:SetProximityRadius { radius = CONSTANTS["radius"] } --end --function AddedToWorld(self, msg) print("bouncer added to world") local newPos = calcPos(self:GetPosition().pos, getHeading(self), CONSTANTS["offsetMagnitude"]) local myRot = self:GetRotation() RESMGR:LoadObject { objectTemplate = CONSTANTS["switchTemplate"][self:GetLOT().objtemplate], bIsSmashable = false, x = newPos.x, y = newPos.y, z = newPos.z, rw = myRot.w, rx = myRot.x, ry = myRot.y, rz = myRot.z, owner = self } end function onShutdown(self) GAMEOBJ:DeleteObject(GetObjectByName(self, "switchObject")) end function onNotifyObject(self, msg) if msg.name == "switchPressed" then local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then self:BouncerTriggered{triggerObj = target} end index = index + 1 end end end function onChildLoaded(self, msg) if msg.templateID == CONSTANTS["switchTemplate"][self:GetLOT().objtemplate] then storeObjectByName(self, "switchObject", msg.childID) print (self:GetID()) storeParent(self, msg.childID) end end function calcPos(pos, heading, magnitude) local newPos = {} newPos.x = pos.x + (heading.x * magnitude) newPos.y = pos.y + (heading.y * magnitude) newPos.z = pos.z + (heading.z * magnitude) return newPos end -------------------------------------------------------------- -- (SERVER SIDE) Ant Hill Spawner -- -------------------------------------------------------------- require('o_mis') require('ai/NP/L_NP_SERVER_CONSTANTS') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ANT_SPAWN_TIMER"] , "SpawnAnt", self ) end onTimerDone = function(self, msg) -- check for the local character if (msg.name == "SpawnAnt") then local mypos = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = CONSTANTS["ANT_LOT"], x = (mypos.x +3), y = mypos.y, z = (mypos.z +3), owner = self } GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ANT_SPAWN_TIMER"] , "SpawnAnt", self ) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) msg.childID:SetVar("attached_path","combatant1") msg.childID:SetVar("attached_path_start",0) -- start child on path msg.childID:FollowWaypoints() end -------------------------------------------------------------- -- (SERVER SIDE) Ant Hill Spawner -- -------------------------------------------------------------- require('o_mis') require('ai/NP/L_NP_SERVER_CONSTANTS') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ANT_SPAWN_TIMER"] , "SpawnAnt", self ) end onTimerDone = function(self, msg) -- check for the local character if (msg.name == "SpawnAnt") then local mypos = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = CONSTANTS["ANT_LOT"], x = (mypos.x +3), y = mypos.y, z = (mypos.z +3), owner = self } GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ANT_SPAWN_TIMER"] , "SpawnAnt", self ) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) msg.childID:SetVar("attached_path","combatant2") msg.childID:SetVar("attached_path_start",0) -- start child on path msg.childID:FollowWaypoints() end -------------------------------------------------------------- -- (SERVER SIDE) Ant Hill Spawner -- -------------------------------------------------------------- require('o_mis') require('ai/NP/L_NP_SERVER_CONSTANTS') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ANT_SPAWN_TIMER"] , "SpawnAnt", self ) end onTimerDone = function(self, msg) -- check for the local character if (msg.name == "SpawnAnt") then local mypos = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = CONSTANTS["ANT_LOT"], x = mypos.x, y = mypos.y, z = mypos.z, owner = self } GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ANT_SPAWN_TIMER"] , "SpawnAnt", self ) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) msg.childID:SetVar("attached_path","combatant3") msg.childID:SetVar("attached_path_start",0) -- start child on path msg.childID:FollowWaypoints() end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 30 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end -------------------------------------------------------------- -- (SERVER SIDE) Passive Ants -- -------------------------------------------------------------- require('o_mis') require('ai/NP/L_NP_SERVER_CONSTANTS') function onStartup(self) end onTimerDone = function(self, msg) if msg.name == "Despawn" then GAMEOBJ:GetTimer():CancelAllTimers( self ) --self:Die{ killerID = self, killType = "SILENT" } GAMEOBJ:DeleteObject(self) end end -------------------------------------------------------------- -- continue doign waypoints ------------------------------------------------------------- function onArrived(self, msg) if (msg.wayPoint == CONSTANTS["ANT_FOOD_WAYPOINT"]) then -- get random food LOT local foodLOT = CONSTANTS["ANT_FOOD_LOTS"][math.random(1,#CONSTANTS["ANT_FOOD_LOTS"])] -- add the item local itemMsg = self:AddNewItemToInventory{ iObjTemplate = foodLOT } -- equip item self:EquipInventory{ itemtoequip = itemMsg.newObjID } end if (msg.isLastPoint == true) then Despawn(self) end end -------------------------------------------------------------- -- Try to despawn the target -------------------------------------------------------------- function Despawn(self) -- should we try to despawn? GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "Despawn", self ) end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Cam Bot" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 15 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 60 -- Tether Radius Set['tetherSpeed'] = 10 -- Tether Speed Set['wanderRadius'] = 3 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight'] = 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "interact" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "interact" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end -------------------------------------------------------------- -- Description: -- -- Server script for Felix 7. Ports player to next zone -------------------------------------------------------------- -------------------------------------------------------------- -- Sent from a player when trying to use this object -------------------------------------------------------------- function onUse(self, msg) local strText = "Would you like to travel to Youreeka?" -- show a dialog box msg.user:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = self, text = strText, identifier = "Travel_To_Youreeka"} end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- User wants to start shooting gallery, send him there if (msg.iButton == 1 and msg.identifier == "Travel_To_Youreeka") then msg.sender:TransferToZone{ zoneID = 312 } end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Juggler" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 15 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 70 -- Tether Radius Set['tetherSpeed'] = .75 -- Tether Speed Set['wanderRadius'] = 30 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 0 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ---------------------------------------------------3----------------------------- end function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "jug1" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3213 then -- Mim friends[i]:NotifyObject{ name="Start22" } end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onNotifyObject(self, msg) if msg.name == "Start22" then if self:GetVar("resetme") == nil then self:SetVar("resetme", "on") end if self:GetVar("resetme") == "on" then self:SetVar("resetme", "off") self:SetVar("WPEvent_NUM", 1) self:SetVar("attached_path", "mimepath") self:SetVar("attached_path_start", 0) self:FollowWaypoints() end end end -------------------------------------------------------------- -- (SERVER SIDE) Script for animated dwarf/troll in scene 1 -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) self:FollowWaypoints() end -------------------------------------------------------------- -- Equips item and plays carry animation -------------------------------------------------------------- function CarryItem(self) -- equip an item local meItem = self:GetInventoryItemInSlot().itemID self:EquipInventory{ itemtoequip = meItem} -- play carry animation self:PlayAnimation{animationID = "carry"} end -------------------------------------------------------------- -- UnEquips item and plays no carry animation -------------------------------------------------------------- function DropItem(self) -- unequip item local meItem = self:GetInventoryItemInSlot().itemID self:UnEquipInventory{ itemtounequip = meItem} self:PlayAnimation{animationID = "nocarry"} end -------------------------------------------------------------- -- When object arrives at a waypoint -------------------------------------------------------------- function onArrived(self, msg) -- are we here because of a path? if (msg.pathType == "Waypoint") then if (msg.isLastPoint == true) then CarryItem(self) elseif (msg.wayPoint == 0) then DropItem(self) end end self:ContinueWaypoints() end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- keep moving if (msg.name == "Continue") then DropItem(self) self:FollowWaypoints() end end-------------------------------------------------------------- -- (SERVER SIDE) Script for animated dwarf/troll in scene 1 -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) self:FollowWaypoints() end -------------------------------------------------------------- -- When object arrives at a waypoint -------------------------------------------------------------- function onArrived(self, msg) if msg.actions and msg.actions[1].name == "animate" then GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "DoClean",self ) else self:ContinueWaypoints() end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- keep moving if (msg.name == "StartMoving") then self:ContinueWaypoints() elseif (msg.name == "DoClean") then local animTime = self:GetAnimationTime{animationID = "clean"} GAMEOBJ:GetTimer():AddTimerWithCancel( animTime.time + 1.0, "StartMoving",self ) self:PlayAnimation{animationID = "clean"} end endrequire('o_mis') function onStartup(self) end function onUse(self, msg) self:PlayFXEffect{effectType = "launch"} end-------------------------------------------------------------- -- (SERVER SIDE) Script for old man sherland -- scene 3 -- -- Interacts with players in proximity and animates. -- [proxDistance] : set in config data for proximity distance -------------------------------------------------------------- -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- local defaultProx = 10.0 -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) if msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 then self:StopPathing() GAMEOBJ:GetTimer():CancelAllTimers( self ) self:FaceTarget{target = msg.objId, degreesOff = 25, keepFacingTarget = true, bInstant = true} self:PlayAnimation{animationID = "missionState1"} elseif msg.status == "LEAVE" and msg.objId:GetFaction().faction == 1 then GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "ProxCheck",self ) end end -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) local myProx = self:GetVar("proxDistance") if not (myProx) then myProx = defaultProx end self:SetProximityRadius{radius = myProx} self:FollowWaypoints() end -------------------------------------------------------------- -- Determines if any players are currently in proximity -------------------------------------------------------------- function ArePlayersInProximity(self) local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then return true; end index = index + 1 end return false; end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- check for players in proximity if (msg.name == "ProxCheck") then if (ArePlayersInProximity(self) == false) then self:FollowWaypoints() end end endrequire('o_mis') function onStartup(self) end function onUse(self, msg) self:PlayFXEffect{effectType = "interact"} end--require('o_mis') onMissionDialogueOK = function(self, msg) if (msg.bIsComplete == true) then msg.responder:SetImagination{ imagination = 6 } msg.responder:UpdateMissionTask{taskType = "complete", value = 664, value2 = 1, target = self} end end -------------------------------------------------------------- -- (SERVER SIDE) Script for trigger to spawn bricks on a waypoint -- -- Set the following config data: -- markedAsPhantom 7:1 -- renderDisabled 7:1 -- spawn_path 0:pathname where pathname is the name of the path -- waypoint 1:x where x is the waypoint number in the path -- spawn_lot 0:LOT where LOT is the LOT ID of the object to spawn -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end -------------------------------------------------------------- -- Get current number of player collisions -------------------------------------------------------------- function GetCols(self) return tonumber(self:GetVar("NumCols")) end -------------------------------------------------------------- -- Add to current number of player collisions -------------------------------------------------------------- function IncCols(self) local cols = self:GetVar("NumCols") cols = cols + 1 self:SetVar("NumCols", cols) end -------------------------------------------------------------- -- Decrease current number of player collisions -------------------------------------------------------------- function DecCols(self) local cols = self:GetVar("NumCols") cols = cols - 1 if (cols < 0) then cols = 0 end self:SetVar("NumCols", cols) end -------------------------------------------------------------- -- Get the Spawn LOT Config data -------------------------------------------------------------- function GetSpawnLOT(self) local lotID = self:GetVar("spawn_lot") return lotID end -------------------------------------------------------------- -- Do the work to spawn/remove bricks -------------------------------------------------------------- function DoBrickWork(self) if (GetCols(self) > 0) then print("spawn brick") -- if brick already exists, we are done local oldChild = getObjectByName(self, "ChildBrick") if (oldChild) and (oldChild:Exists()) then return end -- get waypoint from config data local wpNum = self:GetVar("waypoint") local pathName = self:GetVar("spawn_path") local lotID = GetSpawnLOT(self) if (wpNum) and (pathName) and (lotID) then print ("waypoint: " .. wpNum) -- spawn brick at waypoint on path --local objectPos = GAMEOBJ:GetWaypointPos( pathName, tonumber(wpNum) ) local pathMsg = LEVEL:GetPathWaypoints(pathName) local trans if (tostring(type(pathMsg)) == "table") then trans = pathMsg[tonumber(wpNum)] -- load the object in the world RESMGR:LoadObject { objectTemplate = lotID, x = trans.pos.x, y = trans.pos.y, z = trans.pos.z, rw = trans.rot.w, rx = trans.rot.x, ry = trans.rot.y, rz = trans.rot.z, owner = self } end end else -- if we have a child brick, remove it RemoveObject(self, "ChildBrick") print("remove brick") end end function RemoveObject(self, objName) local oldChild = getObjectByName(self, objName) if (oldChild ~= nil and oldChild:Exists()) then GAMEOBJ:DeleteObject(oldChild) end end -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) self:SetVar("NumCols", 0) end function onCollisionPhantom(self, msg) print("collision phantom") local faction = msg.objectID:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then IncCols(self) end DoBrickWork(self) end function onOffCollisionPhantom(self, msg) print ("collision off phantom") local faction = msg.senderID:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then DecCols(self) end DoBrickWork(self) end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- is this a goal object if tostring(msg.templateID) == GetSpawnLOT(self) then -- remove old object, add new RemoveObject(self, "ChildBrick") storeObjectByName(self, "ChildBrick", msg.childID) storeParent(self, msg.childID) end end -------------------------------------------------------------- -- (SERVER SIDE) Script for dirt drop volume -- -- Set the following config data: -- markedAsPhantom 7:1 -- renderDisabled 7:1 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- local defaultProx = 8.0 local cooldown = 5.0 local stopDuration = 4.0 local brickDropDuration = 1.0 -------------------------------------------------------------- -- event fired -------------------------------------------------------------- function onFireEvent(self, msg) if (msg.args == "dirtDrop") then -- if the cooldown isn't up, quit out if (self:GetVar("Usable") == false) then return else -- otherwise set us as not usable (because we are using now) self:SetVar("Usable", false) GAMEOBJ:GetTimer():AddTimerWithCancel( cooldown, "Cooldown",self ) end -- play embedded effects msg.senderID:PlayFXEffect{effectType = "press"} -- if its smashable, smash it local smashMsg = self:IsObjectSmashable() if (smashMsg) and (smashMsg.smashable == true) then self:Die() end -- start a timer to stop targets under the brick drop area when the bricks fall GAMEOBJ:GetTimer():AddTimerWithCancel( brickDropDuration, "StopTargets",self ) end end -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) self:SetVar("Usable", true) self:SetProximityRadius{radius = defaultProx} end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- set our state as usable if (msg.name == "Cooldown") then self:SetVar("Usable", true) elseif (msg.name == "StopTargets") then -- execute stuff on objects in proximity local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] if (target) and (target:Exists()) then GAMEOBJ:GetTimer():CancelAllTimers( target ) -- stop pathing target:StopPathing() -- unequip item local meItem = target:GetInventoryItemInSlot().itemID target:UnEquipInventory{ itemtounequip = meItem} -- play effect/anim target:PlayAnimation{animationID = "dirtDrop"} -- start timer to resume pathing (based on time of animation?) GAMEOBJ:GetTimer():AddTimerWithCancel( stopDuration, "Continue",target ) end index = index + 1 end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Cam-Bot" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 15 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetProximityRadius{radius = 20} end function onEmoteReceived(self, msg) if (msg.emoteID == "pose") then self:CastSkill{skillID = 119} end end function onProximityUpdate(self, msg) if msg.status == "ENTER" then self:FaceTarget{ target = msg.objId, degreesOff = 5, keepFacingTarget = true } end end function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "setvelocity", self ) self:SetUpdatable{bUpdatable = true} end function onTimerDone(self, msg) if "setvelocity" == msg.name then local rotation = {x = self:GetVar("rotX"), y = self:GetVar("rotY"), z = self:GetVar("rotZ")} self:SetAngularVelocity{angVelocity = rotation, bIgnoreDirtyFlags = false} end end-------------------------------------------------------------- -- Server Constants/Settings for Nimbus Park Scripts -- -- We need this because the server cannot use the other -- constants file due to "Localize" calls -------------------------------------------------------------- CONSTANTS = {} -------------------------------------------------------------- -- Scene 6 -------------------------------------------------------------- CONSTANTS["ANT_LOT"] = 3260 CONSTANTS["ANT_FOOD_WAYPOINT"] = 0 CONSTANTS["SCENE_6_MISSION_1_ID"] = 121 CONSTANTS["SCENE_6_MISSION_2_ID"] = 122 CONSTANTS["ANT_FOOD_LOTS"] = { 3390, 3391, 3392 } CONSTANTS["ANT_SPAWN_TIMER"] = 2.0------------------------------------------------------------------- -- script for Lego Club space. Jump through a ring, smash the ring -- -- created brandi 5/24/10 -- made it an single object, updated the script -ba 5/28/10 ------------------------------------------------------------------- -- player jumpted through the ring function onCollisionPhantom(self,msg) -- kill the ring self:RequestDie{ killType = "VIOLENT" , killerID = msg.senderID } end --------------------------------------------------------------------------------------- --This script is on the car module build area in Race Place of Nimbus Station -- it checks to see if the player has built a car. Since this is the first time a player can -- build a car, it assumes that the car in the player's inventory is the car they just built --------------------------------------------------------------------------------------- function onModularBuildExit(self, msg) -- the player completed a modular build if(msg.bCompleted == true) then -- the modular build is a car if msg.modularBuildID == 8092 then local player = msg.playerID -- if the player is on the mission, update the mission if player:GetMissionState{missionID = 623}.missionState == 2 then player:UpdateMissionTask{taskType = "complete", value = 623, value2 = 1, target = self} end end end end -------------------------------------------------------------- -- Server script for the new Concert smash choicebuild, changes -- the boxes the boxes that are spawned. -- -- updated mrb... 7/20/10 -- refactored -------------------------------------------------------------- -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- names of spawner networks from hf and the time each box will take to switch local spawnerNetworks ={ {name = "Concert_Choicebuild_Spotlight_", time = 5.0}, {name = "Concert_Choicebuild_Speaker_", time = 3.0}, {name = "Concert_Choicebuild_Rocket_", time = 5.0}, {name = "Concert_Choicebuild_Laser_", time = 5.0}} function onStartup(self) -- get the spawner name, save out the spawner number and the shared spawner network name local spawner_name = self:GetVar("spawner_name") local spawnNum = tonumber(string.sub(spawner_name, -1)) local spawnName = string.sub(spawner_name, 1, -2) self:SetVar("spawnNum", spawnNum) -- add the correct time from the table for when to switch to the next box for k,v in ipairs(spawnerNetworks) do if v.name == spawnName then GAMEOBJ:GetTimer():AddTimerWithCancel( v.time , "SwitchToNextBox", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( v.time - 0.2 , "NoSmash", self ) break end end end function onSmash(self, msg) -- clear the timers GAMEOBJ:GetTimer():CancelAllTimers( self ) end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone(self, msg) if msg.name == "NoSmash" then -- dont allow the object to be smashed right before the switch --print('*** NoSmash ***') self:SetFaction{faction = -1} elseif msg.name == "SwitchToNextBox" then -- get the current spawner name and the next spawner name local curSpawnerName = self:GetVar("spawner_name") local newSpawnerName = "" local spawnNum = self:GetVar("spawnNum") -- find the next spawner, if at the end of the table use # 1 for k,v in ipairs(spawnerNetworks) do if (v.name .. spawnNum) == curSpawnerName then local nextNum = k+1 if nextNum > #spawnerNetworks then nextNum = 1 end -- found the right spawner so break out newSpawnerName = spawnerNetworks[nextNum].name .. spawnNum break end end -- get the actual spawner objects local curSpawner = LEVEL:GetSpawnerByName(curSpawnerName) local newSpawner = LEVEL:GetSpawnerByName(newSpawnerName) -- start the next spawner newSpawner:SpawnerActivate() newSpawner:SpawnerReset() -- clear out the current spawner curSpawner:SpawnerDeactivate() curSpawner:SpawnerDestroyObjects() --print('switch box from: ' .. curSpawnerName .. ' ## to: ' .. newSpawnerName) end end --------------------------------------------------------------------------------------------------------- -- Server-side script for Concert instrument Quick Builds. --------------------------------------------------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- constants for the musical instruments quickbuilds -------------------------------------------------------------- local CONSTANTS = {} -- the object template for each instrument CONSTANTS["INSTRUMENT_LOT_GUITAR"] = 4039 CONSTANTS["INSTRUMENT_LOT_BASS"] = 4040 CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] = 4041 CONSTANTS["INSTRUMENT_LOT_DRUM"] = 4042 -- the anim used to show the player playing each instrument CONSTANTS["INSTRUMENT_ANIM"] = {} CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "drums" -- the anim used to show the player smashing each instrument CONSTANTS["INSTRUMENT_SMASH_ANIM"] = {} CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = -1 -- has no smashing anim -- the music used for each instrument CONSTANTS["INSTRUMENT_MUSIC"] = {} CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Guitar" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Bass" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Keys" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Drums" -- path set up through Happy Flower for the cinematic for each instrument CONSTANTS["INSTRUMENT_CINEMATIC"] = {} CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Cam_G" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Cam_B" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Cam_K" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Cam_D" -- the LOT for the left hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 4991 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 4992 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- no equippable used CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4995 -- the LOT for the right hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4996 -- whether or not to hide the completed quickbuild while the player is playing the instrument CONSTANTS["INSTRUMENT_HIDE"] = {} CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = false CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = false -- once the smash anim starts playing, how long to wait before unequipping the instrument CONSTANTS["INSTRUMENT_UNEQUIP_TIME"] = {} CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 1.033 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 0.94 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- has no equippables CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 0 -- has no smash anim, unequip immediately -- how much imagination is repeatedly drained while the instrument is being played CONSTANTS["INSTRUMENT_IMAGINATION_COST"] = 2 -- how often imagination is drained while playing the instrument CONSTANTS["INSTRUMENT_COST_FREQUENCY"] = 4.0 -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- copied from enum ERebuildChallengeState in lwoGame \ include \ LWORebuild.h CONSTANTS["REBUILD_STATE_OPEN"] = 0 CONSTANTS["REBUILD_STATE_COMPLETED"] = 2 CONSTANTS["REBUILD_STATE_RESETTING"] = 4 -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup( self, msg ) -- needs to register with the server-side zone script -- in case the player exits, logs out, etc. while playing an instrument. -- the server-side zone script receives a PlayerExit msg, which it can then pass on to the instruments local zControl = GAMEOBJ:GetZoneControlID() self:SendLuaNotificationRequest{requestTarget = zControl, messageName = "PlayerExit"} end -------------------------------------------------------------- -- called anytime the rebuild object's state changes -------------------------------------------------------------- function onRebuildNotifyState( self, msg ) local playerID = msg.player:GetID() if ( msg.iState == CONSTANTS["REBUILD_STATE_RESETTING"] or msg.iState == CONSTANTS["REBUILD_STATE_OPEN"] ) then -- clear the active player if the quickbuild state is being reset or not even started yet self:SetVar( "activePlayer", nil ) --print("Clearing active player, state="..msg.iState) else -- set the active player in all other states self:SetVar( "activePlayer", playerID ) --print("Setting active player: "..playerID..", state="..msg.iState) end end -------------------------------------------------------------- -- Event from client-side -------------------------------------------------------------- function onFireEventServerSide( self, msg ) if ( msg.args == "UpdateImagination" ) then if msg.senderID and msg.param1 then msg.senderID:SetImagination{ imagination = msg.param1 } end elseif ( msg.args == "reset" ) then self:RebuildReset{} elseif ( msg.args == "playInstrumentAnim" ) then msg.senderID:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_ANIM"][msg.param1], fPriority = 4.0 } self:NotifyClientObject{ name = "checkInstrumentAnim" } elseif ( msg.args == "playSmashAnim" ) then msg.senderID:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_SMASH_ANIM"][msg.param1], fPriority = 4.0 } elseif ( msg.args == "startMusic" ) then AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][msg.param1], true ) storeObjectByName( self, "musicPlayer", msg.senderID ) elseif ( msg.args == "stopMusic" ) then AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][msg.param1], false ) self:SetVar( "musicPlayer", nil ) elseif ( msg.args == "stopPlaying" ) then -- If player is on mission 176 "complete it local player = getObjectByName(self, "activePlayer" ) if player:GetMissionState{missionID = 176}.missionState == 2 then player:UpdateMissionTask{taskType = "complete", value = 176, value2 = 1, target = self} end self:NotifyClientObject{ name = "stopPlaying", paramObj = msg.senderID } elseif ( msg.args == "loadEquippables" ) then self:NotifyClientObject{ name = "loadEquippables", paramObj = msg.senderID } elseif ( msg.args == "reequipItem" ) then ReequipInventoryItem( msg.senderID, msg.param1 ) elseif ( msg.args == "DoAchievement" ) then msg.senderID:UpdateMissionTask{taskType = "complete", value = 602, value2 = 1, target = self} elseif ( msg.args == "DoAchievement_20sec" ) then msg.senderID:UpdateMissionTask{taskType = "complete", value = 302, value2 = 1, target = self} end end -------------------------------------------------------------- -- Start or stop the given the music -------------------------------------------------------------- function AlterMusic( self, szMusicName, bActivate ) local soundRepeaters = self:GetObjectsInGroup{ group = "ConcertSoundRepeater", ignoreSpawners = true }.objects for i = 1, table.maxn (soundRepeaters) do if ( bActivate ) then soundRepeaters[i]:ActivateNDAudioMusicCue{ m_NDAudioMusicCueName = szMusicName } else soundRepeaters[i]:DeactivateNDAudioMusicCue{ m_NDAudioMusicCueName = szMusicName } end end end -------------------------------------------------------------- -- object notification from server-side zone script -------------------------------------------------------------- function notifyPlayerExit(self, other, msg) if ( msg.playerID ) then StopPlayingIfPlayerLeft( self, msg.playerID ) CancelMusicIfPlayerLeft( self, msg.playerID ) local activePlayerID = self:GetVar( "activePlayer" ) -- if there is an active player, check if it is the player who just exited if ( activePlayerID ) then --print("Player exited: "..msg.playerID:GetID()..", active="..activePlayerID) if ( msg.playerID:GetID() == activePlayerID ) then -- If the build is complete, kill it when the active player exits. The logic behind -- this decision is that if the player has exited and the QB is complete, they bailed -- while building (or animating post-build) and the server has finally finished building -- and determined the player is gone on the server side. Now the build needs to be -- smashed so a new one will spawn. if ( self:GetRebuildState().iState == CONSTANTS["REBUILD_STATE_COMPLETED"] ) then self:RequestDie{killerID = self, killType = "VIOLENT"} end end end end end -------------------------------------------------------------- -- a player left the zone -- they could have exited via the x, the menu, or slash command -- or logged out via the menu or slash command -- or gone back to Character Select via the menu -- or had a client crash -- or the map could have been reloaded -- check if the player that left was the one playing this instrument -- if so, stop the music -------------------------------------------------------------- function CancelMusicIfPlayerLeft( self, exitPlayer ) local musicPlayer = getObjectByName( self, "musicPlayer" ) if ( musicPlayer == nil ) then return end -- if the player that left was the one playing this instrument, stop the music if ( self:GetVar( "musicPlayer" ) == exitPlayer:GetID() ) then local myLOT = self:GetLOT{}.objtemplate AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][myLOT], false ) -- also, make sure that if the player who left logs back in, -- other clients don't see it come in doing the instrument animation musicPlayer:PlayAnimation{ animationID = "ben_is_king", fPriority = 4.0 } self:SetVar( "musicPlayer", nil ) end end -------------------------------------------------------------- -- a player left the zone -- they could have exited via the x, the menu, or slash command -- or logged out via the menu or slash command -- or gone back to Character Select via the menu -- or had a client crash -- or the map could have been reloaded -- tell the client-side script to check if the player that left was the one playing this instrument -- and if so, forget about them -------------------------------------------------------------- function StopPlayingIfPlayerLeft( self, exitPlayer ) self:NotifyClientObject{ name = "playerLeft", paramObj = exitPlayer } end -------------------------------------------------------------- -- before playing the instrument, any inventory items the player had in-hand were unequipped -- re-equip the one with the given LOT now -------------------------------------------------------------- function ReequipInventoryItem( player, LOT ) -- go through the player's inventory and find the slot that holds this LOT -- once we find it, re-equip that item local numInventoryItems = player:GetInventorySize{ inventoryType = 1 }.size -- 1 is INVENTORY_DEFAULT in lwoCommon / include / InventoryTypes.h for i = 0, numInventoryItems do local checkItem = player:GetInventoryItemInSlot{ slot = i }.itemID if ( checkItem:Exists() ) then if ( checkItem:GetLOT().objtemplate == LOT ) then local invItem = player:GetInventoryItemInSlot{ slot = i }.itemID player:EquipInventory{ itemtoequip = invItem } end end -- end Exists() end -- end for loop end -------------------------------------------------------------- -- Server script for the new Concert smash choicebuild, QB's -- are spawned in when the box is smashed. -- -- updated mrb... 7/20/10 -- refactored -------------------------------------------------------------- -------------------------------------------------------------- -- constants for the concert prop choicebuilds -------------------------------------------------------------- local resetTime = 20.0 local gVars = { tFX = { { name = 'discoball', group = 'effectsDiscoball' }, { name = 'speaker', group = 'effectsShell' }, { name = 'speakerHill', group = 'effectsHill' }, { name = 'spotlight', group = 'effectsHill' }, { name = 'discofloor', group = 'effectsShell' }, { name = 'flamethrower', group = 'effectsShell' }, { name = 'stagelights', group = 'effectsShell' }, }, tSets = { { name = 'laser', fx = {'discoball', 'discofloor', 'stagelights', 'spotlight',} }, { name = 'spotlight', fx = {'spotlight', 'stagelights',} }, { name = 'rocket', fx = {'flamethrower',} }, { name = 'speaker', fx = {'speaker', 'speakerHill', 'stagelights', 'spotlight',} }, }, } function onStartup(self) self:AddObjectToGroup{ group = "QB_" .. self:GetLOT().objtemplate } end function getSet(self) local iLOT = self:GetLOT().objtemplate local index = -1 if iLOT == 5846 then index = 1 elseif iLOT == 5847 then index = 2 elseif iLOT == 5848 then index = 3 elseif iLOT == 5845 then index = 4 end return index end function onRebuildComplete(self, msg) local myGroup = "QB_" .. self:GetLOT().objtemplate local groupObjs = self:GetObjectsInGroup{ group = myGroup, ignoreSpawners = true }.objects local indexCount = 0 local playerNum = string.sub(string.gsub(self:GetVar("groupID"),"%;",""), -1) self:SetVar("Player_" .. playerNum, "|" .. msg.userID:GetID()) for k,v in ipairs(groupObjs) do if v:GetRebuildState().iState == 2 then indexCount = indexCount + 1 end end msg.userID:UpdateMissionTask{taskType = "complete", value = 283, value2 = 1, target = self} GAMEOBJ:GetTimer():AddTimerWithCancel( resetTime , "qbResetTime", self ) if indexCount >= 3 then local pathObjs = self:GetObjectsInGroup{ group = 'ConcertPlatforms', ignoreSpawners = true }.objects for k,v in ipairs(pathObjs) do v:StartPathing{} end for k,v in ipairs(groupObjs) do GAMEOBJ:GetTimer():CancelAllTimers( v ) v:SetFaction{faction = -1} end for i = 1, 4 do local player = GAMEOBJ:GetObjectByID(self:GetVar("Player_" .. i)) if player:Exists() then player:UpdateMissionTask{taskType = "complete", value = 598, value2 = 1, target = self} end end RewardBonus( self, getSet(self)) end end function onRebuildNotifyState( self, msg) --print (msg.iState) if ( msg.iState == 4 ) then -- the choice build is smashed --print("******************* CB SMASHED ************************!!!!!!!!!!!!!") GAMEOBJ:GetTimer():CancelAllTimers( self ) end end -------------------------------------------------------------- -- reset the choicebuilds -------------------------------------------------------------- function resetQBs(self) -- cancel any bonus particle effects received from having the choicebuilds match UpdateParticleEffects( self, -1 ) local myGroup = "QB_" .. self:GetLOT().objtemplate local qbObjs = self:GetObjectsInGroup{ group = myGroup, ignoreSpawners = true }.objects for k,v in ipairs(qbObjs) do v:Die() end end -------------------------------------------------------------- -- update the particle effects due to the current state of the 4 choicebuilds -- if one of the choicebuild option indices is passed in, play the corresponding effect and cancel any existing ones -- if -1 is passed in, then cancel any existing effects -------------------------------------------------------------- function UpdateParticleEffects( self, index ) if ( index == -1 ) then --print('CancelAllEffects') CancelAllEffects( self ) else --print('UpdateEffects ' .. index) UpdateEffects(self, index) end end -------------------------------------------------------------- -- update the particle effects because all 4 props have the given LOT -------------------------------------------------------------- function UpdateEffects( self, index ) CancelAllEffects( self ) --print('*********** Play Effects ***********') local tSet = gVars.tSets[index] --print('play effect group ' .. tSet.name) for k,v in ipairs(tSet.fx) do local iFX = 1 for i = 1, #gVars.tFX do if gVars.tFX[i].name == v then iFX = i break end end local desiredEffectName = gVars.tFX[iFX].name local desiredEffectSave = gVars.tFX[iFX].name .. 'Effect' local fxObj = self:GetObjectsInGroup{ group = gVars.tFX[iFX].group, ignoreSpawners = true }.objects[1] --print('play effect ' .. desiredEffectSave .. ' - ' .. desiredEffectName .. ' - ' .. gVars.tFX[iFX].group) fxObj:PlayFXEffect{ name = desiredEffectSave, effectType = desiredEffectName } end end -------------------------------------------------------------- -- cancel any effects on the concert hill -------------------------------------------------------------- function CancelAllEffects( self ) local tFX = gVars.tFX --print('*********** CancelAllEffects ***********') --print('*****************************************************') --dumpVar('tFX', tFX, ' ') --print('*****************************************************') for k,v in ipairs(tFX) do local cancelEffectName = v.name .. 'Effect' local fxObj = self:GetObjectsInGroup{ group = v.group, ignoreSpawners = true }.objects[1] --print('stop effect ' .. cancelEffectName .. ' - ' .. v.group) fxObj:StopFXEffect{ name = cancelEffectName } end end -------------------------------------------------------------- -- called by the bonus script when we just set the index on one of the choicebuilds -- and now they all match -------------------------------------------------------------- function RewardBonus( self, index ) GAMEOBJ:GetTimer():AddTimerWithCancel( 30.0 , "StageResetTime", self ) UpdateParticleEffects( self, index ) end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "qbResetTime") then self:Die() elseif (msg.name == "StageResetTime") then resetQBs(self) end end -- helper function dumpVar(name,var,indent) if( indent == nil ) then indent = "" end if( type(var) == "table" ) then print( indent .. name .. " is a table with " .. #var .. " entries:" ) local i,v = next(var) while i do dumpVar(i,v,indent .. " ") i, v = next(var, i) end else local startOfLine = indent .. name .. " is " if( type(var) == "userdata" ) then if( type(var.GetID) == "function" ) then print( startOfLine .. "an object proxy with ID = " .. var:GetID() ) else print( startOfLine .. "unknown userdata" ) end elseif( var == nil ) then print( startOfLine .. "nil" ) elseif( var == true ) then print( startOfLine .. "true" ) elseif( var == false ) then print( startOfLine .. "false" ) else print( startOfLine .. "a(n) " .. type(var) .. " with value = " .. var ) end end endfunction onFireEventServerSide(self, msg) if msg.args == "removeBricks" then msg.senderID:ClearInventory{which = "brick"} end end --**************************************************************** -- THIS SCRIPT IS NO LONGER IN USE. KEPT ONLY FOR REFERENCE -- PLEASE DELETE BEFORE GOLD MASTER --****************************************************************** local misID = 482 function onHasBeenCollected(self, msg) local iFlag = tonumber(self:GetVar('flagNum')) --print(iFlag) if iFlag then msg.playerID:SetFlag{iFlagID = iFlag, bFlag = true} else print('missing flagNum configData') end --print(msg.playerID:GetMissionState{missionID = misID}.missionState) if msg.playerID:GetMissionState{missionID = misID}.missionState == 2 then --print('updateMission now ' .. msg.playerID:GetName().name) msg.playerID:UpdateMissionTask{taskType = "complete", value = misID, value2 = 1, target = self} end end local misID = 474 -- Join a faction mission function onRespondToMission(self, msg) if msg.missionID ~= misID then return end local player = msg.playerID -- if the player is not on the mission or not completed the mission then set the icons on the faction npc's if msg.rewardItem and msg.rewardItem ~= -1 then local tUpdateMissions = {} -- set the players new Faction if msg.rewardItem == 6980 then -- Venture <-> 7090 ************************************************ player:SetPlayerKitFaction{iFactionNum = 1} tUpdateMissions = { 555, 556, 778 } -- setup the Venture Achievements that need to be completed elseif msg.rewardItem == 6979 then -- Assembly <-> 7091 *********************************************** player:SetPlayerKitFaction{iFactionNum = 2} tUpdateMissions = { 544, 545, 778 } -- setup the Assembly Achievements that need to be completed elseif msg.rewardItem == 6981 then -- Paradox <-> 7092 ************************************************ player:SetPlayerKitFaction{iFactionNum = 3} tUpdateMissions = { 577, 578, 778 } -- setup the Paradox Achievements that need to be completed elseif msg.rewardItem == 6978 then -- Sentinel <-> 7093 *********************************************** player:SetPlayerKitFaction{iFactionNum = 4} tUpdateMissions = { 566, 567, 778 } -- setup the Sentinel Achievements that need to be completed end for k,v in ipairs(tUpdateMissions) do player:AddMission{missionID = v} player:CompleteMission{missionID = v} end end end -------------------------------------------------------------- -- Script on Johnny Thunder, script adds missions for concert flyer from concert audience -- -- updated Brandi... 3/29/10 -------------------------------------------------------------- function onMissionDialogueOK(self,msg) local player = msg.responder if msg.missionID == 773 and msg.iMissionState <= 2 then player:AddMission{ missionID = 774} player:AddMission{ missionID = 775} player:AddMission{ missionID = 776} player:AddMission{ missionID = 777} end end-------------------------------------------------------------- -- LEGO Club door Script to transfer the player -- updated mrb... 6/10/10 -- sends player to zones based on transferZoneID -------------------------------------------------------------- function onFireEventServerSide(self, msg) local mapID = self:GetVar("transferZoneID") or "1700" -- if we have a map to send the player if mapID then if mapID == "1200" then -- if we're going to NS then send them to the correct respawn point GAMEOBJ:GetObjectByID(msg.args):TransferToZone{ zoneID = mapID, spawnPoint = "NS_LEGO_Club" } else GAMEOBJ:GetObjectByID(msg.args):TransferToZone{ zoneID = mapID } end else local pos = self:GetPosition().pos print(self:GetName() .. " is missing transferZoneID in config data @ x: " .. pos.x .. " y: " .. pos.y .. " z: " .. pos.z) end end -------------------------------------------------------------- -- Transfers player to Lup world or transferZoneID -- -- updated mrb... 8/9/10 -------------------------------------------------------------- function onUse(self, msg) local player = msg.user local newMap = self:GetVar("transferZoneID") or 1600 player:TransferToZone{zoneID = newMap} end--------------------------------------------------------------------------------------- --This script is on the rocket module build area in Brick annex of Nimbus Station -- It checks the rocket the player build in the modular build area for certain rocket part -- if the player builds a rocket and it contains the defined modules, update the mission --------------------------------------------------------------------------------------- local iTemplateID = {9516,9517,9518} -- the LOT of the module within the iAssemblyTemplate you are searching for. local missionNum = 809 -- mission on mardolf to build a rocket with a certain rocket part -- The player exits the modular build function onModularBuildExit(self, msg) -- has the player completed a rocket? if(msg.bCompleted == true) then local player = msg.playerID -- is the player on the mission to build a rocket if player:GetMissionState{missionID = missionNum}.missionState == 2 then if msg.vLOTsUsed then for i,v in ipairs(msg.vLOTsUsed) do --see if any of the LOTs used are for our mission for j,t in ipairs(iTemplateID) do if v == t then player:UpdateMissionTask{taskType = "complete", value = missionNum, value2 = 1, target = self} return nil end end end end for k,v in ipairs(iTemplateID) do -- send a check to the character database to see if the rocket contains a certain player:CheckPlayerAssemblyForUniqueModuleByLOT{iObjTemplate = v, iAssemblyTemplate = msg.modularBuildID, i64modelSubkey = msg.i64modelSubkey:GetID(), callbackTarget = self, playerID = player} end end end end -- check return from the character database check function onModuleAssemblyDBDataToLua(self, msg) -- if msg.bDataReady == false then msg.playerID:DisplayTooltip{ bShow = true, strText = Localize("MODULAR_ROCKET_DB_FAIL")} --"Internal Database Error. Please build your rocket again"} -- does the rocket contain one of the define modules? elseif msg.bModuleFound == true then local player = msg.playerID -- if the player is on the mission, update the mission if player:GetMissionState{missionID = missionNum}.missionState == 2 then player:UpdateMissionTask{taskType = "complete", value = missionNum, value2 = 1, target = self} end end end-------------------------------------------------------------- -- scripts on the faction rep to update a mission when the player choices a speciality kit for the first time -- -- updated Brandi... 3/19/10 -------------------------------------------------------------- local Missions = {LOT_7095 = 812,LOT_7094 = 814,LOT_7097 = 813,LOT_7096 = 815} function onMissionDialogueOK(self,msg) local player = msg.responder if msg.iMissionState == 4 then -- check to see if the mission the player is completing is a feed me mission, if it is, hide their icons and skip the rest if msg.missionID == Missions["LOT_"..self:GetLOT().objtemplate] then player:UpdateMissionTask{taskType = "complete", value = 780, value2 = 1, target = self} end end endlocal lootLOT = 935 -- LOT of the loot object to spawn local numToSpawn = 2 -- number of loot objects to spawn local spawnTime = 1.5 -- how long to wait before spawning another one local stopLoot = 10 -- length of time the imagination spawns for function spawnLoot(self) local player = GAMEOBJ:GetObjectByID(self:GetVar('playerID')) for i = 1, numToSpawn do local newSpawner = GAMEOBJ:GenerateSpawnedID() self:DropLoot{owner = player, lootID = newSpawner, itemTemplate = lootLOT, rerouteID = player, sourceObj = self} end GAMEOBJ:GetTimer():AddTimerWithCancel( spawnTime , "SpawnDelay", self ) end function onRebuildComplete(self, msg) msg.userID:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} if self:GetVar("bActive") then return end local playerID = "|" .. msg.userID:GetID() self:SetVar("playerID", playerID) spawnLoot(self) GAMEOBJ:GetTimer():AddTimerWithCancel( stopLoot , "StopSpawning", self ) end function onTimerDone(self, msg) if msg.name == "SpawnDelay" then spawnLoot(self) elseif msg.name == "StopSpawning" then GAMEOBJ:GetTimer():CancelTimer("SpawnDelay", self) end end -------------------------------------------------------------- -- Server side script on the console behind the paradox rep. -- this script takes infected bricks and give the player faction tokens -- the use conditions are all handled in the client script -- client script is located scripts\client\ai\NS\L_NS_TOKEN_CONSOLE_CLIENT.lua -- updated brandi 6/23/10 added update misson to complete the misson from the paradox rep to use the console -------------------------------------------------------------- -- Variables pulled out to make tweaking the numbers easier for systems local bricksToTake = 20 -- the maelstrom infected bricks this interaction cost -- MAKE SURE THIS MATCHES THE CLIENT SIDE SCRIPT local maxTokens = 5 -- for the randomizer, this is the max number of tokens the console will give out -- when the player interact with the console function onUse(self,msg) -- to make sure the player isn't interacting with the object just to quickbuild it -- state 2 means the quickbuild is complete if self:GetRebuildState{}.iState == 2 then local player = msg.user local missionState = player:GetMissionState{missionID = 863}.missionState local number = math.random(1,maxTokens) -- the number of token the player will get -- player is on the mission to interact with the console, or has completed it if missionState > 1 then -- makes sure the player has the required amount of infected bricks, they shouldnt get past -- the CheckUseRequirements, but just in case if player:GetInvItemCount{ iObjTemplate = 6194}.itemCount >= bricksToTake then --remove the bricks from the players inventory player:RemoveItemFromInventory{iObjTemplate = 6194, iStackCount = bricksToTake } -- checks to see which faction the player is a part of, then gives them the correct tokens if player:GetFlag{iFlagID = 46}.bFlag then -- venture player:AddItemToInventory{iObjTemplate = 8321, itemCount = number} elseif player:GetFlag{iFlagID = 47}.bFlag then -- Assembly player:AddItemToInventory{iObjTemplate = 8318, itemCount = number} elseif player:GetFlag{iFlagID = 48}.bFlag then -- Paradox player:AddItemToInventory{iObjTemplate = 8320, itemCount = number} elseif player:GetFlag{iFlagID = 49}.bFlag then -- Sentinel player:AddItemToInventory{iObjTemplate = 8319, itemCount = number} end end --if the player is on the mission to use the console, complete their mission if missionState == 2 then player:UpdateMissionTask{taskType = "complete", value = 863, value2 = 1, target = self} end end -- be sure to ternimate the interaction so the shift icon comes up again. player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end end-------------------------------------------------------------------------------------- --teleports the player above and to the center of the nimbus property map -- and kill enemies -------------------------------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetFaction().faction == 1 then local object = self:GetObjectsInGroup{group = "Teleport", ignoreSpawners = true}.objects[1] if object then local tele = object:GetPosition().pos local player = msg.objectID player:Teleport {pos = {x = tele.x, y = tele.y, z = tele.z}, bIgnoreY = false} end else msg.objectID:RequestDie{killerID = self, killType = VIOLENT} end end-- This script is used by the modular build "ghost" pieces, to make them start modular build when they're clicked -- It also forwards object drop messages to the parent modular build so you can drag parts into place from your inventory local myPriority = 0.8 function onClientUse(self, msg) local propertyPlaques = self:GetObjectsInGroup{ group = "PropertyPlaque", ignoreSpawners = true }.objects --local propertyPlaques = GAMEOBJ:GetObjectsByLOT(3315) for i = 1, table.maxn(propertyPlaques) do propertyPlaques[i]:PropertyEditIconInteraction{} end end require('o_mis') con = {} con["null_Object_to_spawn"] = 9283 con["null_Object_group_name"] = "emp" function onStartup(self) if not self:GetVar("GroupName") and not self:GetVar("nullID") then local config = { {"groupID", con["null_Object_group_name"] } } local Markpos = self:GetPosition().pos local Markrot = self:GetRotation() RESMGR:LoadObject { objectTemplate = con["null_Object_to_spawn"] , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self, configData = config} else local config = { {"groupID", self:GetVar("GroupName") } } local Markpos = self:GetPosition().pos local Markrot = self:GetRotation() RESMGR:LoadObject { objectTemplate = self:GetVar("nullID") , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self, configData = config} end end require('o_mis') --########################################################### --### ON START UP ### --########################################################### function onStartup(self) end --########################################################### --#### ON CLICKED --########################################################### onCheckUseRequirements = function (self, msg) local itemType = msg.objIDObjectForUse:GetItemType{}.iItemType if (itemType == 16) then -- If item is an Egg of some sort local itemLOT = msg.objIDObjectForUse:GetLOT{}.objtemplate local HatchMissionState = msg.objIDUser:GetMissionState{missionID = 110}.missionState -- CHECKING FOR INDIRECT USE, (Using an object or egg on the nest) print( "HatchMissionState ", HatchMissionState) if (HatchMissionState <= 1) then -- If the hatch mission hasn't been accepted yet -- Send response: "You cannot hatch egg until you've accepted that mission" self:UseRequirementsResponse{iUseResponseType = 4, objIDResponseSource = self ,bCanUse = false } msg.bCanUse = false elseif ( itemLOT < 3191 and itemLOT > 3193 ) then -- If the item being used on nest is NOT a TUTORIAL egg -- Send response: "Nests in pet ranch accept specific tutorial eggs only" self:UseRequirementsResponse{iUseResponseType = 3, objIDResponseSource = self ,bCanUse = false } msg.bCanUse = false end else msg.bCanUse = true end return msg end require('o_mis') require('State') --########################################################### --### ON START UP ### --########################################################### function onStartup(self) ------------------------------------ Saved Varibales Start self:SetVar("wanderRadius", 15) self:SetVar("WanderSpeed", 2) -- Follow min and max allows the pet too rubber band whild folloing the player self:SetVar("followDis_min", 5 ) self:SetVar("followDis_max", 10 ) -- Distance the pet will teleport to the palyer self:SetVar("teleport_dis", 50 ) -- Min Max Delay while wandering self:SetVar("WanderDelayMin", 5 ) self:SetVar("WanderDelayMax", 10 ) -- Store the Players ObjID storeParent(self, self:GetParentObj().objIDParent) -- System Timer Stored self:SetVar("StoredTimer_1", 0 ) self:SetVar("myState", nil ) self:UseStateMachine{} ------------------------------------- Saved Varialbes end --------------------------------------------------------- --- SET STATES --- --------------------------------------------------------- -- PetGame.start -- PetGame = State.create() PetGame.onEnter = function(self) end PetGame.onArrived = function(self) end -- Idle.end -- --------------------------------------------------------- -- Idle.start -- Idle = State.create() Idle.onEnter = function(self) -- Pulse every 5 sec storePlayerPOS(self) -- Stor Player Pos -- ########################################################################### -- Check Distance = if to far teleport --------------------------------- ------ if not checkDistance(self) then local ParentID = getParent(self) local ParentPos = ParentID:GetPosition().pos local xSplit= {x= ParentPos.x , y= ParentPos.y , z= ParentPos.z + 5 } self:Teleport{ pos = xSplit} local rot = ParentID:GetRotation() self:SetRotation{ y=rot.y, x=rot.x , w=rot.w , z=rot.z } end ----------------------------------------------------------------------------- -- ########################################################################### -- Player Movement ----------------------------------------------------------- if checkPlayerMovement(self) and self:GetVar("myState") ~= "wander" then -- if player not moving then Wander self:FollowTarget { targetID = getParent(self), radius = 3,speed = 3, keepFollowing = false } setState("wander", self) elseif self:GetVar("myState") ~= "petfollow" then setState("petfollow", self) end ------------------------------------------------------------------------------ -- Check Movement = if not moved wander local counter = self:GetInstructionCount(); print("Counter Count....."..counter.count); -- number of instructions in this call to lua print("Counter FrameCount........"..counter.frameCount); -- number of instructions this script has ran this frame GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "testTime", self ) end Idle.onArrived = function(self) end -- Idle.end -- -- Players Pet Follows the Player --------------------------------------------------------- -- petfollow.start -- petfollow = State.create() petfollow.onEnter = function(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) -- Cancle Meander timer self:SetVar("myState", "petfollow" ) self:FollowTarget { targetID = getParent(self), radius = 8, speed = 5, keepFollowing = true } end petfollow.onArrived = function(self) end -- petfollow.end -- --------------------------------------------------------- -- Players Pet Stays on the command of the player --------------------------------------------------------- -- petstay.start -- petstay = State.create() petstay.onEnter = function(self) end petstay.onArrived = function(self) end -- petstay.end -- --------------------------------------------------------- -- wander.start -- wander = State.create() wander.onEnter = function(self) self:SetVar("myState", "wander" ) radius = self:GetVar("wanderRadius") local mypos = getParent(self):GetPosition().pos local PoS = getRandomPos(self,mypos,radius) self:GoTo { speed = self:GetVar("WanderSpeed"), target = { x = PoS.x , z = PoS.z , y = PoS.y, }, } end wander.onArrived = function(self) if not checkPlayerMovement(self) then GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) setState("petfollow", self) else local ran = getRandomD(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( ran, "MeanderPause", self ) end end -- wander.end -- --------------------------------------------------------- --------------------------------------------------------- --- CREATE STATES --- --------------------------------------------------------- addState(Idle, "Idle", "Idle", self) addState(petfollow, "petfollow", "petfollow", self) addState(petstay, "petstay", "petstay", self) addState(wander, "wander", "wander", self) addState(PetGame, "PetGame", "PetGame", self) beginStateMachine("Idle", self) end function getPlayer(self, num) targetID = self:GetVar("PlayerTarget_"..num ) return GAMEOBJ:GetObjectByID(targetID) end function storePlayer(self, target, num) idString = target:GetID() finalID = "|" .. idString self:SetVar("PlayerTarget_"..num , finalID) end --########################################################### --#### TIMER --########################################################### onTimerDone = function(self, msg) if msg.name == "MeanderPause" then setState("wander", self) end if msg.name == "testTime" then setState("Idle", self ) end end --########################################################### --#### EMOTE RECEIVED --########################################################### onEmoteReceived = function(self,msg) local name = msg.emoteID local caster = msg.caster end --########################################################### --#### ON CLICKED --########################################################### onUse = function (self, msg) local targetID = msg.user -- Target OBJ ID local tpos = targetID:GetPosition().pos -- Target Position storeTarget(self, targetID) -- Store Target end --########################################################### --#### MIS FUNCTIONS --########################################################### -- Return Random # for wandering function getRandomD(self) Min = self:GetVar("WanderDelayMin") Max = self:GetVar("WanderDelayMax") ran = math.random(Min,Max) return ran end -- Saves Parent ObjID function storeParent(self, target) idString = target:GetID() finalID = "|" .. idString self:SetVar("My_ParentID", finalID) end -- Returns Parent ObjID function getParent(self) targetID = self:GetVar("My_ParentID") return GAMEOBJ:GetObjectByID(targetID) end -- Func Round number function round2(num, idp) return tonumber(string.format("%." .. (idp or 0) .. "f", num)) end function checkDistance(self) local myTarget = getParent(self) local range = self:GetVar("teleport_dis") local myPos = Vector.new(self:GetPosition().pos) local hisPos = Vector.new(myTarget:GetPosition().pos) local dist = hisPos - myPos if dist:sqrLength() <= range * range then return true end return false end -- end CanAttackTarget function checkPlayerMovement(self) mypos = getParent(self):GetPosition().pos if round2(self:GetVar("Parentx"), 1) ~= round2(mypos.x,1) or round2(self:GetVar("Parentx"),1) ~= round2(mypos.z,1) then return true end return false end function storePlayerPOS(self) mypos = getParent(self):GetPosition().pos self:SetVar("Parentx", mypos.x) self:SetVar("Parentz", mypos.z) end --require('ai/ACT/L_BOUNCER_BASIC') require('o_mis') CONSTANTS = {} CONSTANTS["radius"] = 6 CONSTANTS["switchTemplate"] = {} CONSTANTS["switchTemplate"][3353] = 3354 CONSTANTS["switchTemplate"][3427] = 3430 CONSTANTS["switchTemplate"][3428] = 3431 CONSTANTS["offsetMagnitude"] = 20 function onStartup(self) self:SetProximityRadius { radius = CONSTANTS["radius"] } --end --function AddedToWorld(self, msg) print("bouncer added to world") local newPos = calcPos(self:GetPosition().pos, getHeading(self), CONSTANTS["offsetMagnitude"]) local myRot = self:GetRotation() RESMGR:LoadObject { objectTemplate = CONSTANTS["switchTemplate"][self:GetLOT().objtemplate], bIsSmashable = false, x = newPos.x, y = newPos.y + 14.75, --trying to offset the new position to put it on a hill. z = newPos.z, rw = myRot.w, rx = myRot.x, ry = myRot.y, rz = myRot.z, owner = self } end function onShutdown(self) GAMEOBJ:DeleteObject(GetObjectByName(self, "switchObject")) end function onNotifyObject(self, msg) if msg.name == "switchPressed" then local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then self:BouncerTriggered{triggerObj = target} end index = index + 1 end end end function onChildLoaded(self, msg) if msg.templateID == CONSTANTS["switchTemplate"][self:GetLOT().objtemplate] then storeObjectByName(self, "switchObject", msg.childID) print (self:GetID()) storeParent(self, msg.childID) end end function calcPos(pos, heading, magnitude) local newPos = {} newPos.x = pos.x + (heading.x * magnitude) newPos.y = pos.y + (heading.y * magnitude) newPos.z = pos.z + (heading.z * magnitude) return newPos end require('o_mis') function onStartup(self) self:SetProximityRadius { radius = 4 , name = "Bouncees" } self:SetVar( "hydrantPos", self:GetPosition{}.pos ) self:PlayFXEffect{ name = "water", effectID = 384, effectType = "water" } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "bouncerOn",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 25, "KillBroken",self ) end function onTimerDone(self,msg) if (msg.name == "bouncerOn") then local hydrant = "hydrant0"..self:GetVar('hydrant') --print (hydrant) local bouncerObj = self:GetObjectsInGroup{ group = hydrant, ignoreSpawners = true}.objects bouncerObj[1]:NotifyObject{name = "bounceAllInProximity"}--BouncePlayer{niDestPt = vec, fSpeed = speed, ObjIDBouncer = bouncerObj[1]} --player:BouncePlayer{ ObjIDBouncer = bouncerObj[1] } GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "WaterOff",self ) end if (msg.name == "WaterOff") then self:StopFXEffect{ name = "water", effectID = 384, effectType = "water" } local myPos = self:GetVar( "hydrantPos" ) --RESMGR:LoadObject { objectTemplate = 3999, x = myPos.x, y = myPos.y, z = myPos.z, owner = self } --self:Die() end if (msg.name == "KillBroken") then --self:Die{ killerID = self, killType = "SILENT" } GAMEOBJ:DeleteObject(self) end end ----------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is smashed -------------------------------------------------------------- function onDie( self, msg ) ShowBroken( self, msg.attacker ) end -------------------------------------------------------------- -- spawn in the model of the hydrant all broken -------------------------------------------------------------- function ShowBroken( self, playerID ) -- get the hydrant's position local myPos = self:GetPosition{}.pos local hydrant = tostring(self:GetVar("hydrant")) print(" hydrant number "..hydrant) local config = { { "hydrant" , hydrant }} RESMGR:LoadObject { objectTemplate = 7328, x = myPos.x, y = myPos.y, z = myPos.z, owner = self, configData = config } end function onMissionDialogueOK(self, msg) print ("Mission Dialog accepted!") --local targetID = msg.objId --GGJ Define targetID as msg.objID (the thing that sent the message, which is hopefully the player) local player = msg.responder --GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetFlag{iFlagID = 1, bFlag = true} end --This script is unneeded now that the pet food container is a smashable. I will remove it soon. --Click this item and you will have 5 pet food items added to your inventory --This item is required to complete mission 111 --Petfood is 3227 --[[ local bCLICKONCE = false local PETFOODQUANTITY = 5 function onStartup(self) -- When the Object with this script attacthed (self) loads or "starts up," --print ("Pet Food started up!") end ---------------------------------------------------------------------- -- Player clicks on the item ---------------------------------------------------------------------- function onUse (self, msg) --Check to make sure the script only runs once print ("inside onUse function") for i = 1, PETFOODQUANTITY do msg.user:AddItemToInventory { iObjTemplate = 3227} --Give the player 5 petfood items (3227) print ("inside for loop") end if (bCLICKONCE == false) then --Check to make sure the script only runs once bCLICKONCE = true --Change the bool so the script won't run again print ("after click-once check") --msg.user:UpdateMissionTask{ target = self, value = 111, taskType= "complete" } --"complete" actually sets it to "ready to complete" go figure. self:Die{ killType = "SILENT" } --Destroy the petfood end end ]]--require('o_mis') function onStartup(self) self:SetProximityRadius { radius = 4 , name = "petBounce" } self:SetVar("active", false) self:SetVar("storedOnce", false) registerWithZoneControlObject(self) -- We delay storing of information for this bouncer in case the other objects in the -- group haven't fully loaded up yet. GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "DelayStore", self ) end function StoreOnce(self) self:SetVar("storedOnce", true) local switch = self:GetObjectsInGroup{ group = self:GetVar("grp_name") }.objects for i = 1, table.maxn (switch) do if ( switch[i]:GetLOT().objtemplate == 3463 ) then storeObjectByName(self, "pet_switch", switch[i]) storeObjectByName(switch[i], "pet_bouncer", self) end end self:SetVar("SaveObjests", "stored") end onNotifyObject = function(self, msg) if msg.name == "FXON" then GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="on" } end if ( msg.name == "SwitchPressed" ) then self:SetVar("active", true) bounceAllInProximity(self) end end function onCollisionPhantom(self, msg) if ( self:GetVar("storedOnce") == false ) then StoreOnce(self) end local target = msg.objectID local faction = target:GetFaction().faction local pet = target:GetPetID().objID -- If object colliding is a player, and they have a pet if ( faction == 1 ) then if ( self:GetVar("active") == false ) then if ( pet:Exists() ) then local petswitch = getObjectByName(self, "pet_switch") --print("BOUNCER STEPPED ON, SENDING " .. petswitch:GetID() .. " to pet") -- Have parent notify pet that it has arrived at a pet bouncer pet:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = petswitch, iPetNotificationType = 2} end else -- Bouncer is already active self:BouncerTriggered{triggerObj = target} end -- Pets can bounce as well! elseif ( (faction == 99) and self:GetVar("active") ) then if ( self:GetVar("active") == true ) then target:SetLinearVelocity{ x = 0, y = 0, z = 0 } -- We call this on the server. The only time we want to call a bounce message on the client -- is when we're bouncing client/player's. If we need to bounce anything else it should be server-side. bounceObj(self, target) -- Now that they've bounced, they're done with the ability state target:RemovePetState{ iStateType = 9 } -- Set them back to idling target:SetPetMovementState{ iStateType = 1 } end else if ( self:GetVar("active") == true ) then bounceObj(self, target) end end end function bounceAllInProximity(self) local objs = self:GetProximityObjects{ name = "petBounce"}.objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local pet = target:GetPetID().objID local faction = target:GetFaction() -- Bounce players client-side if ( faction.faction == 1 ) then self:BouncerTriggered{triggerObj = target} else -- Bounce NPCs server-side bounceObj(self, target) end index = index + 1 -- If player has a pet, let them know about the bounce if ( pet:Exists() ) then -- Let pet know player has used a bouncer pet:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 3} end end end function bounceObj(self, target) local vecString = self:GetVar("bouncer_destination") -- Parse the NiPoint3 from the level file into three floats local posX, posY, posZ = string.match(vecString, "(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)") local speed = self:GetVar("bouncer_speed") --Hackish fix for the 'bounce collision' local objPos = target:GetPosition().pos objPos.y = objPos.y + 1 target:SetPosition{pos = objPos} -- Create a vector in Lua to pass in message local vec = {x = posX, y = posY, z = posZ} target:BouncePlayer{niDestPt = vec, fSpeed = speed, ObjIDBouncer = self} end function onTimerDone(self, msg) if ( msg.name == "TurnOffBouncer" ) then self:SetVar("active", false) -------------------------------------------------------------------------------------------- -- remove effect for the bouncer -- -------------------------------------------------------------------------------------------- GAMEOBJ:GetZoneControlID():NotifyObject{ name = "off" } end if ( msg.name == "DelayStore" ) then StoreOnce(self) end end require('client/ai/L_BOUNCER_BASIC') --client-side bouncer script require('o_mis') --local bHasBeenUsed = false --local SWITCH_HINT_RADIUS = 6 --local bCINEMA_ONCE = false CONSTANTS = {} --CONSTANTS["NO_OBJECT"] = "0" CONSTANTS["effectNum"] = 291 CONSTANTS["effectName"] = "bouncer" ------------------------------------------------------------------------------------------ -- Note: Hint messages have been removed from this script. They will be handled in code. - ------------------------------------------------------------------------------------------ function onStartup(self) --print ("Cine Script Started!") --self:SetProximityRadius{ radius = SWITCH_HINT_RADIUS, name = "HINT_MESSAGE" } --Set radius to detect if player is close (for hint message) self:SetVar("storedOnce", false) end function onBouncerTriggered(self, msg) --Hackish fix for the 'bounce collision' local player = msg.triggerObj local objPos = player:GetPosition().pos objPos.y = objPos.y + 1 --player:DisplayChatBubble{wsText = (objPos.x .. " " .. objPos.y .. " " .. objPos.z)} player:SetPosition{pos = objPos} bounceObj(self, msg.triggerObj) bHasBeenUsed = true; end --Display hint message if player approaches button function onProximityUpdate(self, msg) -- Switch is approached if ( self:GetVar("storedOnce") == false) then StoreOnce(self) self:SetVar("storedOnce", true) end --[[ if bHasBeenUsed == true then -- Do not display message once the player has successfully used the Pet Bouncer return end local targetID = msg.objId if (msg.status == "ENTER" and msg.name == "HINT_MESSAGE" and targetID:GetFaction().faction == 1 and PetFoodMissionStatus ~= 2) then targetID:DisplayTooltip{ bShow = true, strText = "A pet can activate this bouncer.", iTime = 2000 } end --play a cinematic the first time the player approaches the switch with a pet local PetFoodMissionStatus = targetID:GetMissionState{missionID = 111}.missionState --define myMissionState as the current statess of mission 136, for the TargetID if (bCINEMA_ONCE == false and PetFoodMissionStatus == 2) then --if the Proximity Message was "Enter" and the message was sent by the player, then --local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --targetID:PlayCinematic { pathName = "Bouncer_Cine" } --print ("inside if statement") --targetID:DisplayTooltip{ bShow = true, strText = "CINEMATIC: Pet needs food. Pet Rancher gives food. Now try clicking your pet", iTime = 10000 } bCINEMA_ONCE = true end ]]-- end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect(self, name) -- return out if we already have an effect local myEffect = self:GetVar("Effect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = CONSTANTS["effectName"], effectID = CONSTANTS["effectNum"], type = name } -- save the effect self:SetVar("Effect", true); end -------------------------------------------------------------- -- Removes an effect on the spout -------------------------------------------------------------- function RemoveEffect(self) -- get current effect local myEffect = self:GetVar("Effect") -- remove the effect if( myEffect ) self:StopFXEffect{ name = CONSTANTS["effectName"] } self:SetVar("Effect", false) end function onNotifyObject(self, msg) if msg.name == "on" then EnableEffect(self, "bounce-fx") end if msg.name == "off" then RemoveEffect(self) end end function StoreOnce(self) self:SetVar("storedOnce", true) local switch = self:GetObjectsInGroup{ group = self:GetVar("grp_name") }.objects for i = 1, table.maxn (switch) do if ( switch[i]:GetLOT().objtemplate == 3463 ) then storeObjectByName(self, "pet_switch", switch[i]) storeObjectByName(switch[i], "pet_bouncer", self) end end self:SetVar("SaveObjests", "stored") end --- --- --- -------------------------------------------------------------- --[[ function onStartup(self) -- When the Object with this script attacthed (self) loads or "starts up," print ("Cine Script Started!") self:SetProximityRadius{ radius = CINE_RADIUS, name = "CINE_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" end function onProximityUpdate(self, msg) -- Bouncer is approached --print ("Proximity update!") local targetID = msg.objId --GGJ Define targetID as msg.objID (the thing that sent the message, which is hopefully the player) local PetFoodMissionStatus = targetID:GetMissionState{missionID = 111}.missionState --define myMissionState as the current statess of mission 136, for the TargetID --print ("PetFoodMission Status is ".. BrickMissionStatus) if (msg.status == "ENTER" and msg.name == "CINE_MESSAGE" and msg.objId:GetFaction().faction == 1 and bCINEMA_ONCE == 0) then --if the Proximity Message was "Enter" and the message was sent by the player, then --print (PetFoodMissionStatus) --Taming Mission Messages if (PetFoodMissionStatus ~= 2) then -- Mission is any state other than accepted return end --local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) targetID:PlayCinematic { pathName = "Bouncer_Cine" } --print ("inside if statement") targetID:DisplayChatBubble{wsText = "Cinematic joy!"} bCINEMA_ONCE = 1 end end ]]-- require('o_mis') function onStartup(self) self:SetVar("activator", 0) self:SetVar("switch", "up") end function onCollisionPhantom(self, msg) local target = msg.objectID -- If pet if ( target:GetFaction().faction == 99 ) then if (self:GetVar("switch") == "up") then local petAbilityMsg = target:GetPetAbilityObject() if petAbilityMsg.bHasAbilityObj == true and petAbilityMsg.ObjIDAbilityObj:GetID() == self:GetID() then self:PlayAnimation{animationID = "down"} self:SetVar("switch", "down") local petbouncer = getObjectByName(self, "pet_bouncer") petbouncer:NotifyObject{ name = "FXON" } end end -- Notify pet they're at a jump a ctivated object target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 4 } end end function onOffCollisionPhantom(self, msg) local target = msg.senderID -- Make sure this is a pet if ( target:GetFaction().faction == 99 ) then if self:GetVar("switch") == "down" then self:PlayAnimation{animationID = "up"} self:SetVar("switch", "up") end local bouncer = getObjectByName(self, "pet_bouncer") bouncer:NotifyObject{ name = "FXOFF" } -- Notify pet they've left the pet switch target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 5 } -- If the pet that activated the switch has left then turn off the bouncer in 3 seconds if ( target:GetID() == getObjectByName(self, "activator"):GetID() ) then self:SetVar("activator", 0) local petbouncer = getObjectByName(self, "pet_bouncer") GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "TurnOffBouncer", petbouncer ) end end end function onNotifyObject(self, msg) if ( msg.name == "petjumpedon" ) then local petbouncer = getObjectByName(self, "pet_bouncer") petbouncer:NotifyObject{ name="SwitchPressed" } -- Store the ID of the pet that jumped on the switch storeObjectByName(self, "activator", msg.ObjIDSender) end end require('o_mis') local bHasBeenUsed = false function onCollisionPhantom(self, msg) -- Someting touches the Pet Switch --print ("Message on collision") if ( self:GetVar("storedOnce") == false) then StoreOnce(self) self:SetVar("storedOnce", true) end local target = msg.objectID -- get the ID of the thing that sent the collision message if ( target:GetFaction().faction == 99 ) then -- Check to see if the thing that sent the collision message is a pet local petswitch = getObjectByName(self, "pet_bouncer") self:PlayAnimation{animationID = "down"} petswitch:NotifyObject{name = "on"} ------------------------------------------------------------------------------------------ -- Note: Hint messages have been removed from this script. They will be handled in code. - ------------------------------------------------------------------------------------------ --[[ if bHasBeenUsed == true then -- Do not display message more than once return end local player = target:GetParentObj().objIDParent --get the ID of the player if ( (player) and (player:Exists()) ) then player:DisplayTooltip{ bShow = true, strText = Localize("CLICK_YOUR_PET_-_IT_WILL_ACTIVATE_THE_SWITCH!"), iTime = 0 } --display hint message and leave it on until player turns it off bHasBeenUsed = true; --Don't ever display this tooltip again end end ]]-- end function onOffCollisionPhantom (self,msg) self:PlayAnimation{animationID = "up"} petswitch:NotifyObject{name = "off"} end local bHasBeenUsed = false -- GLOBALS -- local NEAR_RADIUS = 15 -------------------------------------------------------------- function onStartup(self) -- When the Object with this script attacthed (self) loads or "starts up," self:SetProximityRadius{ radius = NEAR_RADIUS, name = "NEAR_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" --print ("script started.") end function onProximityUpdate(self, msg) --print ("proximity update") local player = msg.objId-- get the ID of the thing that sent the proximity message if (msg.status == "ENTER" and msg.name == "NEAR_MESSAGE" and msg.objId:GetFaction().faction == 1) then --if the Proximity Message was "Enter" in the near radius and the message was sent by the player, then --print ("got past if") player:DisplayTooltip{ bShow = true, strText = "This is a Pet Blocker. To see Pet Blockers in action, come back next sprint.", iTime = 0 } --display hint message and leave it on until player turns it off bHasBeenUsed = true; --Don't ever display this tooltip again end end require('o_mis') function onStartup(self) self:SetVar("INUSE", false) end function onCollision(self, msg) local target = msg.objectID local pet = target:GetPetID().objID local faction = target:GetFaction() if faction and faction.faction == 1 and self:GetVar("INUSE") == false then local firstWP = GAMEOBJ:GetWaypointPos( "Bridge_Path", 1) pet:Teleport{ pos = firstWP } storeObjectByName(self, "pet", pet) pet:SetVar("AiDisabled", false) pet:AddPetState{iStateType = 10 } pet:SetVar("PathingActive", true ) pet:SetVar("WPEvent_NUM", 1) pet:SetVar("attached_path", "Bridge_Path" ) pet:SetVar("attached_path_start", 0 ) pet:FollowWaypoints() self:SetVar("INUSE", true) GAMEOBJ:GetTimer():AddTimerWithCancel( 20 , "reset", self ) end end onTimerDone = function (self, msg) if msg.name == "reset" then self:SetVar("INUSE", false) local pet = getObjectByName(self, "pet") pet:RemovePetState{ iStateType = 10 } end end onRebuildNotifyState = function(self, msg) if (msg.iState) == 1 then getObjectByName(self, "p1"):SetPosition {pos = {x=-399,y=-399,z=-399} } getObjectByName(self, "p2"):SetPosition {pos = {x=-399,y=-399,z=-399} } end if (msg.iState) == 4 then -- break print(msg.iState) local parts = self:GetObjectsInGroup{ group = "bridge" }.objects for i = 1, table.maxn (parts) do if ( parts[i]:GetLOT().objtemplate == 3915 ) then local pos = parts[i]:GetPosition().pos local rot = parts[i]:GetRotation() if self:GetVar("bridge_1") == nil then bridge_1 = {} bridge_1['x'] = pos.x bridge_1['y'] = pos.y bridge_1['z'] = pos.z self:SetVar("bridge_1",bridge_1) storeObjectByName(self, "p1", parts[i]) elseif self:GetVar("bridge_2") == nil then bridge_2 = {} bridge_2['x'] = pos.x bridge_2['y'] = pos.y bridge_2['z'] = pos.z storeObjectByName(self, "p2", parts[i]) self:SetVar("bridge_2",bridge_2) end end end end if (msg.iState) == 4 then getObjectByName(self, "p1"):SetPosition{pos = self:GetVar("bridge_1")} getObjectByName(self, "p2"):SetPosition{pos = self:GetVar("bridge_2")} end end require('o_mis') function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) local targetID = msg.user -- Target OBJ ID targetID:DisplayTooltip{ bShow = true, strText = "To the Nesting Grounds", iTime = 0 } end require('o_mis') function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) local targetID = msg.user -- Target OBJ ID targetID:DisplayTooltip{ bShow = true, strText = "Return to YouReeka", iTime = 0 } end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() --print("Hit Collision") -- If a player collided with me, then do our stuff if faction and faction.faction == 88 then local player = msg.objectID:GetParentObj().objIDParent --print(player:GetName().name) end end require('o_mis') require('State') --########################################################### --### ON START UP ### --########################################################### function onStartup(self) end function getPlayer(self, num) targetID = self:GetVar("PlayerTarget_"..num ) return GAMEOBJ:GetObjectByID(targetID) end function storePlayer(self, target, num) idString = target:GetID() finalID = "|" .. idString self:SetVar("PlayerTarget_"..num , finalID) end --########################################################### --#### EMOTE RECEIVED --########################################################### onEmoteReceived = function(self,msg) local name = msg.emoteID local caster = msg.caster end --########################################################### --#### ON CLICKED --########################################################### onUse = function (self, msg) local targetID = msg.user -- Target OBJ ID local tpos = targetID:GetPosition().pos -- Target Position storeTarget(self, targetID) -- Store Target self:SetVar("GameState", 1 ) self:FaceTarget{ target = targetID, degreesOff = 5, keepFacingTarget = true } -- Face Target GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) -- Cancel Timer setState( "PetGame", self ) end require('o_mis') onArrived = function(self, msg) if self:GetVar("PathingActive") == nil or self:GetVar("PathingActive") == true then if not msg.isLastPoint then self:SetVar("SavedWP", msg.wayPoint) self:SetVar("PathName", msg.pathName) else self:SetVar("SavedWP", 0) self:SetVar("PathName", msg.pathName) end if (msg.actions) then -- Clear Last Event Set if true if self:GetVar("Act_V") or self:GetVar("Act_N") then for c = 1, table.maxn(self:GetVar("Act_N")) do self:SetVar("Act_N."..c, nil) end for c = 1, table.maxn(self:GetVar("Act_V")) do self:SetVar("Act_V."..c, nil) end end -- Store Events local Act_N = {} local Act_V = {} for i = 1, table.maxn(msg.actions) do Act_N[i] = msg.actions[i].name Act_V[i] = msg.actions[i].value if msg.actions[i].value == nil then Act_V[i] = "noValue" end end self:SetVar("Act_V",Act_V) self:SetVar("Act_N",Act_N) UseWayPoints(self) else self:ContinueWaypoints() end end end -- Event Wp State --- function UseWayPoints(self) local o = self:GetVar("WPEvent_NUM") if self:GetVar("WPEvent_NUM") <= table.maxn(self:GetVar("Act_N")) then -- o = o + 1 if self:GetVar("Act_V") == "noValue" then WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")) else WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")[o]) end else self:SetVar("WPEvent_NUM", 1) self:ContinueWaypoints() end end function WayPointEventFunc(self,name,value) if name == "reset" then self:SetVar("PathingActive", false) self:RemovePetState{ iStateType = 10 } end if name == "stop" then self:StopMoving() end if name == "groupemote" then local s = value local t = split(s, ',') local friends = self:GetObjectsInGroup{ group = t[1] }.objects for i = 1, table.maxn (friends) do for b = 3, table.maxn(t) do if friends[i]:GetLOT().objtemplate == tonumber(t[b]) then -- Mim Emote.emote(friends[i], friends[i], t[2] ) end end end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end if name == "setvar" then local s = value local t = split(s, ',') self:SetVar(t[1],t[2]) self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end if name == "castskill" then if value ~= "noValue" then self:CastSkill{skillID = value } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) else self:CastSkill{skillID = self:GetSkills().skills[1] } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end end if name == "eqInvent" then local meItem = self:GetInventoryItemInSlot().itemID self:EquipInventory{ itemtoequip = meItem} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end if name == "unInvent" then local meItem = self:GetInventoryItemInSlot().itemID self:UnEquipInventory{ itemtounequip = meItem} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end ----------------------- delay if name == "delay" then self:StopMoving() GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DealyAction", self ) end ----------------------- emote if name == "femote" then Emote.emote(self, self , value ) self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end if name == "emote" then Emote.emote(self, self , value ) local time = self:GetAnimationTime{ animationID = value }.time if time < 1 then time = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( time , "DelayActionEmote", self ) end ----------------------- teleport if name == "teleport" then local s = value local t = split(s, ',') local xSplit= {x=t[1] , y=t[2] , z=t[3] } self:Teleport{ pos = xSplit} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end ----------------------- walkspeed if name == "pathspeed" then self:SetPathingSpeed{speed = value} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end ----------------------- removeOBJ if name == "removeNPC" then -- remove Objects in X local foundObj = self:GetProximityObjects { name = "KillOBJS"}.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetFaction().faction == value then foundObj[i]:MoveToDeleteQueue() end end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end ----------------------- - Change WP if name == "changeWP" then-- 1 if string.find (value, ",") then self:SetVar("isTable", true ) else self:SetVar("isTable", false ) end if (self:GetVar("isTable")) then local s = value local t = split(s, ',') self:SetVar("WPEvent_NUM", 1) self:SetVar("attached_path", t[1]) self:SetVar("attached_path_start", t[2] ) self:FollowWaypoints() else self:SetVar("WPEvent_NUM", 1) self:SetVar("attached_path", value) self:SetVar("attached_path_start", 0 ) self:FollowWaypoints() end end ----------------------- - killSelf if name == "killself" and value == "noValue" then -- 2 - Kill Self self:Die{ killerID = self, killType = "SILENT" } elseif name == "killself" and value >=1 then GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DealyKillSelf", self ) end ----------------------- - killSelf if name == "removeself" then-- 2 - Kill Self self:MoveToDeleteQueue() end ----------------------- - spawn Object if event == "spawnOBJ" then -- 3 - Spawn Object RESMGR:LoadObject { objectTemplate = value , x = self:GetPosition().pos.x , y = self:GetPosition().pos.y , z = self:GetPosition().pos.z ,owner = self } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) UseWayPoints(self) end end onTimerDone = function(self,msg) if msg.name == "DealyAction" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) UseWayPoints(self) end if msg.name == "DelayActionEmote" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) UseWayPoints(self) end if msg.name == "DealyKillSelf" then self:Die{ killerID = self, killType = "SILENT" } end end require('o_mis') require('State') --########################################################### --### ON START UP ### --########################################################### function onStartup(self) ------------------------------------ Saved Varibales Start self:SetVar("wanderRadius", 10) self:SetVar("WanderSpeed", 1) self:SetVar("WanderDelayMin", 2 ) self:SetVar("WanderDelayMax", 5 ) storeMeanderPoint(self) ------------------------------------- Saved Varialbes end --------------------------------------------------------- --- SET STATES --- --------------------------------------------------------- -- Idle.start -- Idle = State.create() Idle.onEnter = function(self) end Idle.onArrived = function(self) end -- Idle.end -- --------------------------------------------------------- -- Pet.start -- pet = State.create() pet.onEnter = function(self) end pet.onArrived = function(self) end -- Pet.end -- --------------------------------------------------------- -- wander.start -- wander = State.create() wander.onEnter = function(self) radius = self:GetVar("wanderRadius") myPos = getMeanderPoint(self) PoS = getRandomPos(self,myPos,radius) self:GoTo { speed = self:GetVar("WanderSpeed"), target = { x = PoS.x , z = PoS.z , y = PoS.y, }, } end wander.onArrived = function(self) local ran = getRandomD(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( ran, "MeanderPause", self ) end -- wander.end -- --------------------------------------------------------- --------------------------------------------------------- --- CREATE STATES --- --------------------------------------------------------- addState(Idle, "Idle", "Idle", self) addState(pet, "pet", "pet", self) addState(wander, "wander", "wander", self) beginStateMachine("wander", self) end function getPlayer(self, num) targetID = self:GetVar("PlayerTarget_"..num ) return GAMEOBJ:GetObjectByID(targetID) end function storePlayer(self, target, num) idString = target:GetID() finalID = "|" .. idString self:SetVar("PlayerTarget_"..num , finalID) end --########################################################### --########## PROXIMITY --########################################################### function onProximityUpdate(self, msg) -- ENTER if msg.objId:GetFaction().faction == 1 and msg.status == "ENTER" and msg.name == "petRadius" then end -- LEAVE if msg.objId:GetFaction().faction == 1 and msg.status == "ENTER" and msg.name == "petRadius" then end end --########################################################### --#### TIMER --########################################################### onTimerDone = function(self, msg) if msg.name == "MeanderPause" then setState("wander", self) end end --########################################################### --#### EMOTE RECEIVED --########################################################### onEmoteReceived = function(self,msg) local name = msg.emoteID local caster = msg.caster end --########################################################### --#### MIS FUNCTIONS --########################################################### function getRandomD(self) Min = self:GetVar("WanderDelayMin") Max = self:GetVar("WanderDelayMax") ran = math.random(Min,Max) return ran end -------------------------------------------------------------- -- Script on the skunks in Nimbus Station -- sets the pets as untamable, and allows them to be tamed after spraying them with the watergun -- -- created by Michael Edwards -- updated Brandi... 2/4/10 -- Updated Medwards 3/3/10 ----------------------------------------------------------- function onStartup(self,msg) if self:IsPetWild().bIsPetWild == true then MakeUntameable(self) else -- change faction self:SetFaction{faction = 99} -- clear threat list self:ClearThreatList{} end end -- When the player squirts the skunk with the water gun function onSkillEventFired( self, msg ) if msg.wsHandle == "waterspray" then -- Check if the pet has been tamed and, if so, don't do this if self:IsPetWild().bIsPetWild == false then return end -- Check if the skunk has been sprayed by seeing if it's on a non pet faction if self:GetFaction{}.faction ~= 99 then -- change faction self:SetFaction{faction = 99} -- clear threat list self:ClearThreatList{} -- start a timer that will turn the skunk untamable and aggro GAMEOBJ:GetTimer():AddTimerWithCancel( 30, "GoEvil", self ) -- turn off stink fx self:StopFXEffect{name = "burning"} -- Send a network valriable to the client script to change picktype. self:SetNetworkVar("bIAmTamable", true) end end end function onTimerDone(self, msg) --Did the timer to see if the skunk needs to go aggro again fire? if msg.name == "GoEvil" then MakeUntameable(self) end end --Checking the state of the pet taming minigame. If start, cancel timers. If quit, start short "go evil" timer function onNotifyPetTamingMinigame(self, msg) if msg.notifyType == "BEGIN" then GAMEOBJ:GetTimer():CancelAllTimers(self) elseif msg.notifyType == "FAILED" or msg.notifyType == "QUIT" then GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "GoEvil", self ) end end -- used to remove taming faction and send a variable to the client script to make unpickable function MakeUntameable(self) -- check the skunks taming state. 5 means the pet is currently being tamed. This checks if that is false if self:GetPetHasState{iStateType = 5}.bHasState == false then --make the pet non tamable -- change faction self:SetFaction{faction = 114} -- refill health self:SetHealth{health = 5} -- play the stink effect self:PlayFXEffect{name = "burning", effectID = 3170, effectType = "create"} self:SetNetworkVar("bIAmTamable", false) return end end--This script is 545 --SprayFleas (Mission 109) Pets have fleas. Player must spray 1 dog, 1 cat, 1 goat w/ spraygun. --DOG w/ fleas 3647 (terrier) (regular terrier 3264) --CAT w/ fleas 3648 (regular cat 3265) --GOAT w/ fleas 3649 (regular goat 3266) --FLEA EFFECT = BehaviorEffect ID 280 local ResetFleas_Time = 5.0 --WHEN STARTUP MESSAGE IS RECEIVED, CALL THE "SetFleas" FUNCTION, AND SET IT TO TRUE function onStartup(self) SetFleas(self, true) --Call the function that sets the state of the fleas, and set the function's boolean (bSetFleaBoolean) to true. end --A FUNCTION TO SET THE STATE OF FLEAS, TRUE OR FALSE. function SetFleas(self, bSetFleas) if (bSetFleas == true) then self:SetVar("HasFleas" , true) --Put the fleas back on the animal --self:AddSkill { skillID = 109 } --self:ToggleActiveSkill { iSkillID = 109, bOn = true } --BEHAVIOR_DESTINK else self:SetVar("HasFleas" , false) --self:RemoveSkill { skillID = 109 } --self:ToggleActiveSkill{ iSkillID = 32, bOn = true } --BEHAVIOR_DESTINK end end --When I'm squirted with the watergun function onSquirtWithWatergun( self, msg ) print ("Pet is wet.") --If I don't have fleas (skillBehavior 109 = Stink Skill) --if ( self:HasSkill { iSkillID = 109 }.bHas == false ) then if ( self:GetVar("HasFleas") == false) then print ("I don't have fleas.") return end --Otherwise, I must have fleas, and squirting feels good print ("Fleas are gone!") SetFleas(self, false) --Call the function that sets the state of the fleas, and set the function's boolean (bSetFleaBoolean) to false. local player = msg.shooterID --create a local variable called "player" and assign it to the shooterID from the onSquirtWithWatergun message player:UpdateMissionTask {target = self, value = 109, taskType = "complete"} -- update the mission task for mission 109 A value of 1 is sent to script owner, which increments the mission task by 1. --Start timer for fleas to return GAMEOBJ:GetTimer():AddTimerWithCancel( ResetFleas_Time , "Timer_ResetFleas", self ) -- Timer named Timer_ResetFleas is attached the script's "self" (the pet) end function onTimerDone (self , msg) if msg.name == "Timer_ResetFleas" then SetFleas(self, true) --Call the function that sets the state of the fleas, and set the function's boolean (bSetFleaBoolean) to true. end endrequire('o_mis') -------------------------------------------------------------- function onStartup(self) self:SetProximityRadius { radius = 20 , name = "conductRadius" } end function IsLocalCharacter(target) return GAMEOBJ:GetLocalCharID() == target:GetID() end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onProximityUpdate(self, msg) if msg.objType == "Enemies" or msg.objType == "NPC" then if msg.name == "conductRadius" and msg.status == "ENTER" and IsLocalCharacter(msg.objId) and msg.objId:GetFaction().faction == 1 then local myMissionState = msg.objId:GetMissionState{missionID = 109}.missionState local myMissionState2 = msg.objId:GetMissionState{missionID = 110}.missionState local myMissionState3 = msg.objId:GetMissionState{missionID = 111}.missionState local myMissionState4 = msg.objId:GetMissionState{missionID = 112}.missionState local myMissionState5 = msg.objId:GetMissionState{missionID = 113}.missionState if myMissionState == 1 or myMissionState == 9 then -- STATE_AV AILABLE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M1_AVAILABLE") } -- "Hi, Click me if you need any help!" end if myMissionState == 2 or myMissionState == 10 then-- STATE_ACTIVE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M1_ACTIVE") } -- "Need help finding a Pet?" end if myMissionState == 4 or myMissionState == 12 then -- READY_TO_COMPLETE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M1_READYTOCOMPLETE") } -- "You got your Egg!" end ---------------- Mission 2 if myMissionState2 == 2 or myMissionState2 == 10 then-- STATE_ACTIVE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M2_ACTIVE") } -- "Ah, you've got your egg!" end if myMissionState2 == 4 or myMissionState2 == 12 then -- READY_TO_COMPLETE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M2_READYTOCOMPLETE") } -- "You got your Pet!" end ---------------- Mission 3 if myMissionState3 == 2 or myMissionState3 == 10 then-- STATE_ACTIVE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M3_ACTIVE") } -- "Pets won't behave if ya don't feed'em." end if myMissionState3 == 4 or myMissionState3 == 12 then -- READY_TO_COMPLETE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M3_READYTOCOMPLETE") } -- "Great Job!, Pet Trainer." end ---------------- Mission 4 if myMissionState4 == 2 or myMissionState4 == 10 then-- STATE_ACTIVE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M4_ACTIVE") } -- "Give your Pet some rest." end if myMissionState4 == 4 or myMissionState4 == 12 then -- READY_TO_COMPLETE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M4_READYTOCOMPLETE") } -- "Great Job!" end ---------------- Mission 5 if myMissionState5 == 2 or myMissionState5 == 10 then-- STATE_ACTIVE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M5_ACTIVE") } -- "Where's is your Pet" end if myMissionState5 == 4 or myMissionState5 == 12 then -- READY_TO_COMPLETE self:DisplayChatBubble{wsText = Localize("NPC_PET_GEN_M5_READYTOCOMPLETE") } -- "Ah, Cute Pet!" end end end end function onClientUse(self, msg) local targetID = msg.user -- Target OBJ ID local myMissionState = targetID:GetMissionState{missionID = 109}.missionState local myMissionState2 = targetID:GetMissionState{missionID = 110}.missionState local myMissionState3 = targetID:GetMissionState{missionID = 111}.missionState local myMissionState4 = targetID:GetMissionState{missionID = 112}.missionState local myMissionState5 = targetID:GetMissionState{missionID = 113}.missionState if myMissionState == 1 or myMissionState == 9 then -- STATE_AV AILABLE targetID:DisplayTooltip{ bShow = true, strText = "Talk to the Pet Rancher", iTime = 0 } end if myMissionState == 2 or myMissionState == 10 then-- STATE_ACTIVE targetID:DisplayTooltip{ bShow = true, strText = "There are 3 types of pets to choose from. Take your pick; then give it a click!", iTime = 0 } end if myMissionState == 4 or myMissionState == 12 then -- READY_TO_COMPLETE targetID:DisplayTooltip{ bShow = true, strText = "Take your egg to the Pet Rancher!", iTime = 0 } end ---------------- Mission 2 if myMissionState2 == 2 or myMissionState2 == 10 then-- STATE_ACTIVE targetID:DisplayTooltip{ bShow = true, strText = "Now find a nest. Head for those rocky cliffs.", iTime = 0 } end if myMissionState2 == 4 or myMissionState2 == 12 then -- READY_TO_COMPLETE targetID:DisplayTooltip{ bShow = true, strText = "Now take your new friend back to the Pet Rancher.", iTime = 0 } end ---------------- Mission 3 if myMissionState3 == 2 or myMissionState3 == 10 then-- STATE_ACTIVE targetID:DisplayTooltip{ bShow = true, strText = "Drage pet food from your backpack onto the pet. Then Use the STAR Icon to choose a pet command. Tell if to perform an EMOTE action.", iTime = 0 } end if myMissionState3 == 4 or myMissionState3 == 12 then -- READY_TO_COMPLETE targetID:DisplayTooltip{ bShow = true, strText = "Return to the Pet Rancher", iTime = 0 } end ---------------- Mission 4 if myMissionState4 == 2 or myMissionState4 == 10 then-- STATE_ACTIVE targetID:DisplayTooltip{ bShow = true, strText = "Yer pet will follow ya everywhere. If you need a break, choose the GO HOME pet command. ", iTime = 0 } end if myMissionState4 == 4 or myMissionState4 == 12 then -- READY_TO_COMPLETE targetID:DisplayTooltip{ bShow = true, strText = "Return to the Pet Rancher", iTime = 0 } end ---------------- Mission 5 if myMissionState5 == 2 or myMissionState5 == 10 then-- STATE_ACTIVE targetID:DisplayTooltip{ bShow = true, strText = "Just click the STAR Icon to bring your pet back. ", iTime = 0 } end if myMissionState5 == 4 or myMissionState5 == 12 then -- READY_TO_COMPLETE targetID:DisplayTooltip{ bShow = true, strText = "Take your pet to the Pet Rancher.", iTime = 0 } end end --This is a dupe of (scripts\ai\MASTER_TEMPLATE.lua), intended to allow this character to follow waypoints. require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('o_mis') -- Script is attached to 3630:pr-pet paw -- When the player clicks on this "button" in the world, his pet will be sent to a path, and will perform any actions specified by that path. -- To implement, create Custom Config Data on the Pet Paw object with the following: NAME=pathname, VALUE=0: -- The final Waypoint of your path should include Custom Config Data: NAME=reset function onStartup(self) end onUse = function(self, msg ) local user = msg.user local pet = msg.user:GetPetID().objID if pet:GetVar("PathingActive") == nil or pet:GetVar("PetPathing") == false then pet:SetVar("PathingActive", true ) -- Notify Pet to "Stay" -- pet:SetTameness{fTameness = 5000 } pet:NotifyPet{ ObjIDSource = user,iPetNotificationType = 2} pet:SetVar("WPEvent_NUM", 1) pet:SetVar("attached_path", self:GetVar("pathname") ) pet:SetVar("attached_path_start", 1 ) pet:FollowWaypoints() end end require('o_mis') -------------------------------------------------------------- --Rescue Tourists Mission = 136 --Pet Rancher = 3257 --tourist = 3386 -------------------------------------------------------------- function onStartup(self) -- The object with this script component is defined as "self" when the script first starts up. (duplicated in PET_MISSION_NPCS_CLIENT.lua) local PID = {} PID[1] = "PlayerObjects" self:SetVar("PID", PID ) end function IsLocalCharacter(target) -- Check to see if the "local character" and the "target" which is triggering this are the same (duplicated in PET_MISSION_NPCS_CLIENT.lua) return GAMEOBJ:GetLocalCharID() == target:GetID() -- CLIENT ONLY Get the player object, check to see if it's the same as the ID of the target (duplicated in PET_MISSION_NPCS_CLIENT.lua) end function onGetOverridePickType(self, msg) -- Get the Pick Type (cursor clicking options) for the script object, in preparation of changing it. msg.ePickType = 14 -- Set the Pick Type to 14 (duplicated in PET_MISSION_NPCS_CLIENT.lua) return msg -- Send Pick Type 14 back to the script object (duplicated in PET_MISSION_NPCS_CLIENT.lua) end function onUse(self, msg) local targetID = msg.user -- Target OBJ ID --GGJ No idea what this section does. for i = 1, table.maxn(self:GetVar("PID")) do if self:GetVar("PID")[i] == msg.user:GetName().name then self:SetVar("PlayerFound" , true ) break else self:SetVar("PlayerFound" , false ) end end local myMissionState = targetID:GetMissionState{missionID = 136}.missionState --Find out what the mission state is for the Rescue Tourists Mission, and save it as "myMissionState" if myMissionState == 1 or myMissionState == 9 then -- STATE_AVAILABLE --GGJ Player has not talked to Pet Rancher yet to initiate Mission. Mission is "Available" (1) or "Completed & Available" (9) targetID:DisplayTooltip{ bShow = true, strText = "I'M LOST. HAVE YOU SEEN THE PET RANCHER?", iTime = 0 } --GGJ Test message end --GGJ Quit here. You can't rescue her yet. if myMissionState == 2 or myMissionState == 10 and not self:GetVar("PlayerFound") then -- STATE_ACTIVE --GGJ Mission is active. Mission is "Accepted" (2) or "Completed & Accepted" (10) targetID:DisplayTooltip{ bShow = true, strText = "YOU SAVED ME!", iTime = 0 } --GGJ Test message targetID:UpdateMissionTask{target = self, value = 1, taskType= "kill" } --GGJ Mission is set up as a "kill" mission; to "kill" 3 tourists (3386). This line sends "1 kill" to self (3386), which increments the mission task by 1. local num = table.maxn(self:GetVar("PID")) + 1 --GGJ No idea. self:SetVar("PID."..num, msg.user:GetName().name ) -- self:Teleport{ x= -167.09, y= 206.77, z= 327.38, w= 1.0, 0, -1 } -- GGJ - return tourist to camp. This doesn't work. It just makes her disappear. Should be done in client instead? end if myMissionState == 4 or myMissionState == 12 then -- READY_TO_COMPLETE --GGJ Player has just clicked on 3 tourists and is trying to save a 4th; Mission is "Ready to Complete" (4) or "Completed & Ready to Completed" (12) targetID:DisplayTooltip{ bShow = true, strText = "YOU SAVED 3. REPORT BACK BEFORE SAVING MORE.", iTime = 0 } --GGJ Test message end --GGJ Quit here. You can't rescue her until you have reported back to the Pet Rancher. end -- Script by Trent, Comments by Geoff (to help learn LUA)require('o_mis') -- GLOBALS -- local FAR_RADIUS = 65 local NEAR_RADIUS = 20 -------------------------------------------------------------- function onStartup(self) -- The object with this script component is defined as "self" when the script first starts up self:SetProximityRadius{ radius = FAR_RADIUS, name = "FAR_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" self:SetProximityRadius{ radius = NEAR_RADIUS, name = "NEAR_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" end function IsLocalCharacter(target) -- Check to see if the "local character" and the "target" which is triggering this are the same return GAMEOBJ:GetLocalCharID() == target:GetID() -- CLIENT ONLY Get the player object, check to see if it's the same as the ID of the target end function onGetOverridePickType(self, msg) -- Get the Pick Type (cursor clicking options) for the script object, in preparation of changing it. msg.ePickType = 14 -- Set the Pick Type to 14 return msg -- Send Pick Type 14 back to the script object end function onProximityUpdate(self, msg) local targetID = msg.objId --GGJ Define targetID as msg.objID, which comes from the player local myMissionState = targetID:GetMissionState{missionID = 136}.missionState --Find out what the mission state is for the Rescue Tourists Mission, and save it as "myMissionState" if msg.status == "ENTER" and msg.name == "FAR_MESSAGE" and msg.objId:GetFaction().faction == 1 then --if the Proximity Message was "Enter" in the far radius and the message was sent by the player, then --local targetID = msg.objId --GGJ Define targetID as msg.objID, which comes from the player --local myMissionState = targetID:GetMissionState{missionID = 136}.missionState --Find out what the mission state is for the Rescue Tourists Mission, and save it as "myMissionState" if myMissionState == 1 or myMissionState == 9 then --GGJ Mission is "Available" (1) or "Completed & Available" (9) self:DisplayChatBubble{wsText = Localize("NPC_PET_MIS_FAR_AVAILABLE") } -- "HELP ME! I'M LOST!" end if myMissionState == 2 or myMissionState == 10 and not self:GetVar("PlayerFound") then --GGJ Mission is "Accepted" (2) or "Completed & Accepted" (10) self:DisplayChatBubble{wsText = Localize("NPC_PET_MIS_FAR_ACTIVE") } -- "GET UP HERE AND RESCUE ME!" end --if myMissionState == 4 or myMissionState == 12 then -- GGJ Player has just clicked on 3 tourists and is trying to save a 4th; Mission is "Ready to Complete" (4) or "Completed & Ready to Completed" (12) --self:DisplayChatBubble{wsText = Localize("NPC_PET_MIS_FAR_READYTOCOMPLETE") } -- "BLAH" --end end if msg.status == "ENTER" and msg.name == "NEAR_MESSAGE" and msg.objId:GetFaction().faction == 1 then --if the Proximity Message was "Enter" in the near radius and the message was sent by the player, then --local targetID = msg.objId --GGJ Define targetID as msg.objID, which comes from the player --local myMissionState = targetID:GetMissionState{missionID = 136}.missionState --Find out what the mission state is for the Rescue Tourists Mission, and save it as "myMissionState" if myMissionState == 1 or myMissionState == 9 then --GGJ Mission is "Available" (1) or "Completed & Available" (9) self:DisplayChatBubble{wsText = Localize("NPC_PET_MIS_NEAR_AVAILABLE") } -- "Did the Pet Rancher send you? I don't talk to strangers." end if myMissionState == 2 or myMissionState == 10 and not self:GetVar("PlayerFound") then --GGJ Mission is "Accepted" (2) or "Completed & Accepted" (10) self:DisplayChatBubble{wsText = Localize("NPC_PET_MIS_NEAR_ACTIVE") } -- "Click me you fool!" end if myMissionState == 4 or myMissionState == 12 then -- GGJ Player has just clicked on 3 tourists and is trying to save a 4th; Mission is "Ready to Complete" (4) or "Completed & Ready to Completed" (12) self:DisplayChatBubble{wsText = Localize("NPC_PET_MIS_NEAR_READYTOCOMPLETE") } -- "You better check in with the Rancher. He can't handle too many rescues at once." end end end -- Script by Trent, Comments by Geoff (to help learn LUA) -- This script is duplicated in PET_MISSIONS_NPCS.lua, presumably to get the same info to happen on the client.-- When the player walks through a phantom physics box with this script attached, the pet will begen to follow a path. -- Based on PET_INTERACT_PAW.lua, sends the pet on a path when the player clicks on an object. -- TO SET THIS UP: In the phantom physics box's config data, type in "pathname" under NAME and "0: under VALUE. function onStartup(self) -- When the Object with this script attacthed (self) loads or "starts up," end function onCollisionPhantom(self, msg) --print ("collided with invisible box") local target = msg.objectID local pet = target:GetPetID().objID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then pet:SetVar("AiDisabled", false) pet:AddPetState{iStateType = 10 } -- pet:SetPetMovementState{iStateType = 7} --pet:SetPetState{iStateType = 9 } pet:SetVar("PathingActive", true ) -- Notify Pet to "Stay" -- -- pet:SetTameness{fTameness = 5000 } pet:SetVar("WPEvent_NUM", 1) pet:SetVar("attached_path", "Bridge_Path" ) pet:SetVar("attached_path_start", 0 ) pet:FollowWaypoints() end end require('o_mis') function onStartup(self) end function onCollision(self, msg) local target = msg.objectID local pet = target:GetPetID().objID local faction = target:GetFaction() if faction and faction.faction == 1 then pet:SetVar("AiDisabled", false) pet:AddPetState{iStateType = 10 } pet:SetVar("PathingActive", true ) pet:SetVar("WPEvent_NUM", 1) pet:SetVar("attached_path", "Bridge_Path" ) pet:SetVar("attached_path_start", 0 ) pet:FollowWaypoints() end end -------------------------------------------------------------- -- Script on the skunks in Nimbus Station -- sets the pets as untamable, and allows them to be tamed after spraying them with the watergun -- -- created by Michael Edwards -- updated Brandi... 2/4/10 -- Updated Medwards 3/3/10 ----------------------------------------------------------- function onStartup(self,msg) if self:IsPetWild().bIsPetWild == true then MakeUntameable(self) else -- change faction self:SetFaction{faction = 99} -- clear threat list self:ClearThreatList{} end end -- When the player squirts the skunk with the water gun function onSkillEventFired( self, msg ) if msg.wsHandle == "waterspray" then -- Check if the pet has been tamed and, if so, don't do this if self:IsPetWild().bIsPetWild == false then return end -- Check if the skunk has been sprayed by seeing if it's on a non pet faction if self:GetFaction{}.faction ~= 99 then -- change faction self:SetFaction{faction = 99} -- clear threat list self:ClearThreatList{} -- start a timer that will turn the skunk untamable and aggro GAMEOBJ:GetTimer():AddTimerWithCancel( 30, "GoEvil", self ) -- turn off stink fx self:StopFXEffect{name = "smelly"} -- Send a network valriable to the client script to change picktype. self:SetNetworkVar("bIAmTamable", true) end end end function onTimerDone(self, msg) --Did the timer to see if the skunk needs to go aggro again fire? if msg.name == "GoEvil" then MakeUntameable(self) end end --Checking the state of the pet taming minigame. If start, cancel timers. If quit, start short "go evil" timer function onNotifyPetTamingMinigame(self, msg) if msg.notifyType == "BEGIN" then GAMEOBJ:GetTimer():CancelAllTimers(self) elseif msg.notifyType == "FAILED" or msg.notifyType == "QUIT" then GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "GoEvil", self ) end end -- used to remove taming faction and send a variable to the client script to make unpickable function MakeUntameable(self) -- check the skunks taming state. 5 means the pet is currently being tamed. This checks if that is false if self:GetPetHasState{iStateType = 5}.bHasState == false then --make the pet non tamable -- change faction self:SetFaction{faction = 114} -- refill health self:SetHealth{health = 5} -- play the stink effect self:PlayFXEffect{name = "smelly", effectID = 1490, effectType = "create"} self:SetNetworkVar("bIAmTamable", false) return end end-------------------------------------------------------------- -- Client Script on the skunks in Nimbus Station -- sets the pets as untamable, and allows them to be tamed after spraying them with the watergun -- -- created by Michael Edwards -- Updated Medwards 3/3/10 ----------------------------------------------------------- -- Check if the pet is wild. function onStartup(self,msg) if self:IsPetWild{}.bIsPetWild == false then return end end -- Get the pick type of the skunk and change it to pickable/non pickable as needed function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then if self:GetVar("bIAmTamable") == true or (self:IsPetWild{}.bIsPetWild == false and self:GetIsPet{}.OwnerID ~= msg.GetID()) then msg.ePickType = 14 else msg.ePickType = -1 end end return msg end -- Intercept a network sent variable to adjust pick type function onScriptNetworkVarUpdate(self,msg) self:SetVar("bIAmTamable", msg.tableOfVars["bIAmTamable"]) self:RequestPickTypeUpdate() end -------------------------------------------------------------- -- Universal server script for all pet digs. -- -- created by brandi 3/2/10 -- updated by brandi 3/9/10 -------------------------------------------------------------- --require('o_mis') -- For faction checks -- each type of pet dig has a unique object ID local normalPDLOT = 3495 local PetCovePDLOT = 7612 local GFFlagPDLOT = 7410 local AGMisPDLOT = 9307 local GFCrabLot = 9308 local AGBouncePDLOT = 7559 function onStartup(self) -- NodeClaimed gets set to true when a pet claims the pet treasure node, and it check before another pet can claim it self:SetVar("NodeClaimed", false) local objLot = self:GetLOT().objtemplate -- if the treasure node is either of the ones spawned from the X build, then add a timer to kill it if objLot == GFFlagPDLOT or objLot == AGMisPDLOT then GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "KillChest", self ) else -- if the treause node is one that digs up a pet bouncer if objLot == AGBouncePDLOT then local bouncerNumber = self:GetVar("BouncerNumber") -- set in HF local petbouncer = LEVEL:GetSpawnerByName("PetBouncer"..bouncerNumber) local petbouncerswitch = LEVEL:GetSpawnerByName("PetBouncerSwitch"..bouncerNumber) -- on startup, deactivate and reset the spawner networks for the pet bouncer and pet switch petbouncer:SpawnerDeactivate() petbouncerswitch:SpawnerDeactivate() petbouncer:SpawnerReset() petbouncerswitch:SpawnerReset() end end end function onCollisionPhantom(self, msg) -- when something enters the collision of the node, see if the node has already been claimed and that it is actually alive if ( self:GetVar("NodeClaimed") == false) and self:IsDead().bDead ~= true then -- target is the pet or player or npc that collided with the node volume local target = msg.senderID if not target then return end -- check to see if target Is a player, if so notify pet to go to switch if (target:IsCharacter().isChar == true) then -- see if player has a pet local Pet = target:GetPetID().objID -- check if pet is currently using an ability if ( Pet:GetPetAbilityObject{}.bHasAbilityObj == false ) then -- send message to owner's pet Pet:NotifyPet{ ObjIDSource = target , ObjToNotifyPetAbout = self , iPetNotificationType = 12 } end else -- get if the target is a pet local isPet = target:GetIsPet() -- check to see if the target is a pet and if its is a wild pet if ( isPet.bIsPet == true and isPet.bIsWild == false) then -- i think this checks to see if the pet is already using an ability if ( target:GetPetAbilityObject{}.bHasAbilityObj == false ) then -- checks to see if this node was spawned by a X build if self:GetVar("builder") then -- set on load from the X build -- already made sure that target is a pet, so get the pets owner local petOwner = target:GetParentObj().objIDParent:GetID() -- this is the player that built the Xbuild that spawned the pet node local player = self:GetVar("builder") --print("petOwner is "..petOwner) --print("builder is "..player) -- if the pet owner isn't the player who built the X build, their pet can't dig the pet dig, and therefore cant claim the node if (petOwner ~= player) then return end end -- pet has claimed the node self:SetVar("NodeClaimed", true) -- notify pet that they can dig here target:NotifyPet{ ObjIDSource = target , ObjToNotifyPetAbout = self , iPetNotificationType = 6 } --set the pet ID as the pet who activated this node self:SetVar("activator", target:GetID()) end end end end end function onOffCollisionPhantom(self, msg) -- target is the pet or player or npc that un-collided with the node volume local target = msg.senderID -- get if the target is a pet local isPet = target:GetIsPet() -- check to see if the target is a pet and if its is a wild pet AND if the node was already claimed if (isPet.bIsPet == true and isPet.bIsWild == false) and ( self:GetVar("NodeClaimed") == true) then -- activator is the pet that claimed the node in onCollision local activator = self:GetVar("activator") -- check to see if a pet was set as activator and if that pet is the pet that just un- collided with the node if ( activator and ( target:GetID() == activator ) ) then -- if the pet that claimed the node is the pet that uncollided with the node, set node claimed to false self:SetVar("NodeClaimed", false) -- Notify pet they've left the pet node and set their state back to normal target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 7 } end end end function onNotifyObject(self, msg) -- If treasure node receives notification a pet is digging it up if ( msg.name == "petdughere" ) then -- check to see if the node was clamed first if ( self:GetVar("NodeClaimed") == true) then -- convoluted way of getting the pet owner based on the message sender local petOwner = msg.ObjIDSender:GetParentObj().objIDParent -- get the object LOT of the treasure node local lot = self:GetLOT().objtemplate -- if the lot is the crab dig lot, go to the crab dig function if lot == GFCrabLot then SpawnCrab(self,petOwner) -- if the lot is the pet cove pet dig node, go to the achievement function elseif self:GetVar("PetDig") then PetDigAchievement(self,petOwner) -- if the lot is the AG Xbuild elseif lot == AGMisPDLOT then -- get the ID of the player who built the X local player = self:GetVar("builder") -- if the player that tried to dig up the pet dig is not the player who built the X, skip the rest of the script if (petOwner:GetID() ~= player) then return end -- if the lot is the lot of the flag digs in GF, go to the X build function elseif lot == GFFlagPDLOT then Xbuild(self,petOwner) return -- skip the rest of this function -- if the lot is one of the pet bouncer digs, then go to the bouncer dig function elseif lot == AGBouncePDLOT then BouncerDig(self,petOwner) end -- check to see if the player has completed with pet dig acheivement local DigMissionState = petOwner:GetMissionState{ missionID = 843 }.missionState -- if the player has not completed with mission if (DigMissionState == 2) then petOwner:UpdateMissionTask{taskType = "complete", value = 843, value2 = 1, target = self} end --tells the client side script that the treasure was dub up self:SetNetworkVar("treasure_dug", true) -- killing the treasure node with violent is what spits out the loot, and the loot shows up for the pet owner self:RequestDie{ killType = "VIOLENT" , killerID = petOwner } -- Ability is done being used, remove using-ability state from pet msg.ObjIDSender:RemovePetState{iStateType = 9} -- check to see if their is a quick build X, and kills it too if self:GetVar("X") then GAMEOBJ:GetObjectByID(self:GetVar("X")):RequestDie{ killType = "VIOLENT" } end end end end -- function to spawn a crab on pet dig function SpawnCrab(self,petOwner) -- get the location of the pet dig to spawn the crab there local mypos = self:GetPosition().pos -- set the config data with the tamer as the pet Owner so only the person who dug the crab can tame it, and add it to a group -- with the pet tamer's ID built in to the name of the group so the crab can be found through script local config = { { "tamer", petOwner:GetID() } , { "groupID", "crab"..petOwner:GetID()} } -- spawn a crab RESMGR:LoadObject { objectTemplate = 7694 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, configData = config } end -- function to update achievements for doing all the pet digs in Pet Cove function PetDigAchievement(self,petOwner) -- check to see if the player has completed with pet dig acheivement local AchievementState = petOwner:GetMissionState{ missionID = 505 }.missionState -- if the player has not completed with mission if (AchievementState < 4) then local digNum = self:GetVar('PetDig') -- set in HF -- use the number of the pet dig to get the player flag number for that pet dig local flagNumber = tonumber("126"..digNum) -- check to see if the player has already dug that particular pet dig before if (petOwner:GetFlag{iFlagID = flagNumber}.bFlag == false ) then --set flag to true so we know the player has alread done this petOwner:SetFlag{iFlagID = flagNumber, bFlag = true} -- update the player's achievement for digging a new pet dig petOwner:UpdateMissionTask{taskType = "complete", value = 505, value2 = 1, target = self} end end end -- function for the flag pet digs in GF function Xbuild(self,petOwner) local player = GAMEOBJ:GetObjectByID(self:GetVar("builder")) -- check to make sure the pet owner is still the player who built the X, just another check if (petOwner:GetID() == player:GetID()) then -- set variable for player flag num local PlayerFlagNum = 0 local groupID = self:GetVar("groupID") -- set in HF --set the flag number to check/set on the player based on which flag in GF it is. --player flag number set in the database if (groupID == "Flag1") then PlayerFlagNum = 61 elseif (groupID == "Flag2") then PlayerFlagNum = 62 elseif (groupID == "Flag3") then PlayerFlagNum = 63 end --check to see if they player has dug the flag up before if not petOwner:GetFlag{iFlagID = PlayerFlagNum}.bFlag then -- Ability is done being used, remove using-ability state from pet player:GetPetID().objID:RemovePetState{iStateType = 9} --get the flag based on the group, to change the collision group and visiblity on those scripts --assume only one object in group local flag = self:GetObjectsInGroup{ group = groupID, ignoreSpawners = true }.objects[1] --notifies script on the flag L_GF_DUG_FLAG_CLIENT flag:NotifyClientObject{ name = "changePhysics" , paramObj = player , rerouteID = player }--NotifyObject{ name = "flagDugUp", paramObj = petOwner } --set the player flag for this collectible flag so next time the player digs it, he'll get generic pet loot instead petOwner:SetFlag{iFlagID = PlayerFlagNum, bFlag = true} -- it's ok to use Deleteobject because we know this node was spawned through script, and this is a server script GAMEOBJ:DeleteObject(self) -- if the player has already gotten this flag, then have the pet dig drop normal pet dig loot else --remove the dig state from the pet petOwner:GetPetID().objID:RemovePetState{iStateType = 9} -- killing the treasure node with violent is what spits out the loot, and the loot shows up for the pet owner self:RequestDie{ killType = "VIOLENT" , killerID = petOwner } end --cancel the timer to kill the treasure chest, and kill it early GAMEOBJ:GetTimer():CancelTimer("KillChest", self); --smash the built X if it is still built GAMEOBJ:GetObjectByID(self:GetVar("X")):RequestDie{ killType = "VIOLENT" } end end -- function for the pet dig that digs up a pet bouncer and switch function BouncerDig(self,petOwner) local bouncerNumber = self:GetVar("BouncerNumber") -- set in HF -- check so script doesnt crash because there's no config data set if bouncerNumber then -- spawner networks for the bouncer and switch must be set up like this to work local bouncerSpawner = LEVEL:GetSpawnerByName("PetBouncer"..bouncerNumber) local switchSpawner = LEVEL:GetSpawnerByName("PetBouncerSwitch"..bouncerNumber) -- check that there is a spawner network with that name before activating it if bouncerSpawner then -- activating the spawner network spawns the bouncer bouncerSpawner:SpawnerActivate() end -- check that there is a spawner network with that name before activating it if switchSpawner then -- activating the spawner network spawns the switch switchSpawner:SpawnerActivate() end end end function onTimerDone(self, msg) -- the timer is set on start up with the node is spawned from an X build if ( msg.name == "KillChest" ) then -- get the pet who claimed the treasure node local target = GAMEOBJ:GetObjectByID(self:GetVar("activator")) --check to make sure the pet actually existing, if no pet, then just kill the node if target then target:RemovePetState{iStateType = 9} target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 7 } end -- die silent so there is no loot self:RequestDie{ killType = "SILENT" } end end local pickPriority = 0.8 local pickType = 0 function onStartup(self, msg) --print("Treasure startup") pickType = 0 self:SetVar("isCharacterNearby", false) end function onDie(self, msg) --print("Treasure died") -- get the player's id local localCharacterID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- terminate the player's interaction (could be this treasure or the pet) localCharacterID:TerminateInteraction{ type="user", ObjIDTerminator=localCharacterID } pickType = -1 self:RequestPickTypeUpdate{} end function onCollisionPhantom(self, msg) --print("CollisionPhantom: sender=" .. msg.senderID:GetName().name) --print("CollisionPhantom: self=" .. self:GetName().name) if (msg.senderID:IsCharacter{}.isChar and msg.senderID:GetID() == GAMEOBJ:GetLocalCharID()) then self:SetVar("isCharacterNearby", true) -- start a timer to check if the player is in proximity with a pet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end function onOffCollisionPhantom(self, msg) --print("OffCollisionPhantom: sender=" .. msg.senderID:GetName().name) if (msg.senderID:GetID() == GAMEOBJ:GetLocalCharID()) then self:SetVar("isCharacterNearby", false) pickType = -1 self:RequestPickTypeUpdate{} GAMEOBJ:GetTimer():CancelTimer("UpdateIcons", self) end end function onTimerDone(self, msg) --print(self:GetName().name .. ".TimerDone: " .. msg.name) if ( msg.name == "UpdateIcons" ) then if ( self:GetVar("isCharacterNearby") == true) then local oldPickType = pickType pickType = -1 local localCharacterID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local pet = localCharacterID:GetPetID().objID if (self:IsDead{}.bDead == true) then -- chest is dead, hide the icon pickType = -1 elseif (pet:Exists() == false) then -- no pet, show the icon pickType = 14 elseif (pet:IsPetUsingAbility().bIsUsingAbility == false) then -- pet not signaling, show the icon pickType = 14 end --print("PickType=" .. tostring(pickType) .. ", oldPickType=" ..tostring(oldPickType)) if (pickType ~= oldPickType) then self:RequestPickTypeUpdate{} end -- start the timer again GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end end function onScriptNetworkVarUpdate(self,msg) --print("NetworkVarUpdate: " .. tostring(#msg.tableOfVars)) local treasure_dug = self:GetNetworkVar("treasure_dug") if treasure_dug == true then --print("treasure_dug is true!!!") self:PlayFXEffect{effectType = "dug_up"} self:SetTransparency{fAlphaValue = 0.0} end end function onGetPriorityPickListType(self, msg) if ( pickPriority >= msg.fCurrentPickTypePriority ) then if (pickType ~= 0) then --print("Set pickType=" .. tostring(pickType)) msg.ePickType = pickType end msg.fCurrentPickTypePriority = pickPriority end return msg end function onCheckUseRequirements( self, msg ) -- We don't need to report most of this information unless this check is coming from the UI if ( msg.isFromUI ) then -- This MUST be set to true, otherwise all requirements from this script will be ignored msg.HasReasonFromScript = true -- True if player has less than four imagination msg.Script_Failed_Requirement = true -- Pass the text we want to show, we only need to pass text if they fail the requirement msg.Script_Reason = Localize("PR_DIG_TUTORIAL_04") -- Pass an icon to show as well, we pass this whether or not they failed the requirement -- This iconID references the 'IconID' column in the 'Icons' DB table. msg.Script_IconID = 3118 --THIS NEEDS TO BE REPLACED!!!!!!!!!!!!!!!! end -- This is the bool we set to actually prevent interaction. This should NEVER -- get set to true under any circumstance. Only set it to false, and only when -- the player fails a requirement check. msg.bCanUse = false -- We have to return 'msg' so that the game will receive our changes to it. return msg end--[[ require('o_mis') -- stores all flowers FLOWERS = {} function onTimerDone(self, msg) if ( msg.name == "start" ) then --print("spawning Pet-Nodes") ReSpawnChild(self) end if ( msg.name == "die" ) then DeadChild(self) --print("Re----spawning Pet-Node") end end function onStartup(self) self:SetVar("NumberOfChildren", 0 ) -- Dont not change this Val <<< self:SetVar("WP_Num", 1) -- Dont not change this Val <<< --///////////////////////////////////////////// -- Settings (Alpha =a) " a_1 (Num = 1) a_1 = the WayPoint Set --///////////////////////////////////////////// self:SetVar("PetNames", "nodes") self:SetVar("WP_Alpha", "t") -- starting letter of the Way Point ( a_1 = a) or (anyName_1) self:SetVar("MaxPets", 9) -- Max Pets Spawn in the wrold self:SetVar("TotalPets", 9) -- Total Number of Pets self:SetVar("TreasureID", 3495) --///////////////////////////////////////////// --///////////////////////////////////////////// -- define total pet IDs for i = 1, self:GetVar("TotalPets") do self:SetVar("Pet_"..i, self:GetVar("TreasureID")) -- attach WP to NPC self:SetVar("slot_"..i, nil ) end for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) self:SetVar(FinalName, "NotSpawned") end GAMEOBJ:GetTimer():AddTimerWithCancel(15, "start",self ) end function DeadChild(self) -- Remove a child node from the number of nodes local NChildren = self:GetVar("NumberOfChildren") - 1 self:SetVar("NumberOfChildren", NChildren ) -- Spawn a new child in ReSpawnChild(self) end function ReSpawnChild(self) if self:GetVar("NumberOfChildren") < self:GetVar("MaxPets") then local ran = GetValidRandom(self) for i = 1, self:GetVar("TotalPets") do local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i) if ran == i and self:GetVar(FinalName) == "NotSpawned" then SpawnPet(self, i ) end end end end onChildLoaded = function(self,msg) if msg.childID:GetLOT().objtemplate == self:GetVar("TreasureID") then local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("SpawnedVar", FinalName ) local FreeSlot = GetValidRandom(self) msg.childID:SetVar("attached_path", self:GetVar("WP_Alpha").."_"..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("I_Have_A_Parent", true ) storeParent(self, msg.childID) end end --************************************************************************************ --** Functions --************************************************************************************ function SpawnPet(self, num ) for i = 1, self:GetVar("TotalPets") do if ( num == i ) then local firstWP = GAMEOBJ:GetWaypointPos( self:GetVar("WP_Alpha").."_"..i, 1) self:SetVar("ChildLoadNUM", i ) --local config = { {"markedAsPhantom", true} } RESMGR:LoadObject { objectTemplate = self:GetVar("TreasureID"), x= firstWP.x , y= firstWP.y , z= firstWP.z , owner = self, configData = config } -- A1 self:SetVar(self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..i, "Spawned" ) local NChildren = self:GetVar("NumberOfChildren") + 1 self:SetVar("NumberOfChildren", NChildren ) break end end if self:GetVar("NumberOfChildren") < self:GetVar("MaxPets") + 1 then ReSpawnChild(self) end end function GetValidRandom(self) while true do NUM = math.random(1,self:GetVar("TotalPets")) FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..NUM) if self:GetVar(FinalName) == "NotSpawned" then break end end return NUM end function onNotifyObject(self, msg) if (msg.name == "died") then GAMEOBJ:GetTimer():AddTimerWithCancel( 20, "die",self ) end end -------------------------------------------------------------- -- When objects are loaded via zone notification -------------------------------------------------------------- function onObjectLoaded(self, msg) if ( msg.templateID == 3646 ) then local nextFlower = #FLOWERS + 1 FLOWERS[nextFlower] = msg.objectID:GetID() end end -------------------------------------------------------------- -- called when a player is loaded and ready -------------------------------------------------------------- function onPlayerLoaded(self, msg) -- send the player's ID to the flowers so each of them can tell the newly-loaded client which anim to use for flowerID = 1, #FLOWERS do local flower = GAMEOBJ:GetObjectByID(FLOWERS[flowerID]) flower:NotifyObject{ ObjIDSender = msg.playerID, name = "playerLoaded" } end end ]]--require('o_mis') -- For faction checks function onStartup(self) self:SetVar("NodeClaimed", false) end function onCollisionPhantom(self, msg) local target = msg.senderID -- Make sure the target is a tame pet (wild pets don't care about treasure) local isPet = target:GetIsPet() if (self:IsDead().bDead ~= true and isPet.bIsPet == true and isPet.bIsWild == false) then --print("COLLISION: " .. target:GetName().name) -- Make sure the chest hasn't already been claimed by another pet local claimed = self:GetVar("NodeClaimed") --print("claimed=" .. tostring(claimed)) if (claimed == false or claimed == target) then -- If pet is not using an ability already if ( target:GetPetAbilityObject{}.bHasAbilityObj == false ) then --print("NODE CLAIMED by " .. target:GetName().name) -- Pet marks chest as claimed so another pet cannot grab it self:SetVar("NodeClaimed", target) -- Let pet know they're at a dig location target:NotifyPet{ ObjIDSource = target , ObjToNotifyPetAbout = self , iPetNotificationType = 6 } -- Store the ID of the pet that has found the treasure storeObjectByName(self, "activator", target) end end end end function onOffCollisionPhantom(self, msg) local target = msg.senderID -- Make sure the target is a tame pet (wild pets don't care about treasure) local isPet = target:GetIsPet() if (isPet.bIsPet == true and isPet.bIsWild == false) then --print("OFF COLLISION" .. target:GetName().name) local activator = getObjectByName(self, "activator") if ( activator and ( target:GetID() == getObjectByName(self, "activator"):GetID() ) ) then --print("NODE UNCLAIMED by " .. target:GetName().name) self:SetVar("NodeClaimed", false) -- Notify pet they've left the pet switch target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 7 } end end end function onNotifyObject(self, msg) -- If treasure node receives notification a pet is digging it up if ( msg.name == "petdughere" ) then self:SetNetworkVar("treasure_dug", true) local petOwnerID = msg.ObjIDSender:GetParentObj().objIDParent:GetID() local petOwner = GAMEOBJ:GetObjectByID(petOwnerID) local digNum = self:GetVar('PetDig') --print("petOwnerID=" .. petOwnerID) local AchievementState = petOwner:GetMissionState{ missionID = 505 }.missionState --print("AchievementState=" .. AchievementState) if (AchievementState < 4) then local digNum = self:GetVar('PetDig') local flagNumber = tonumber("126"..digNum) --print("flagNumber=" .. flagNumber) if (petOwner:GetFlag{iFlagID = flagNumber}.bFlag == false ) then --set flag to true so we know the player has alread done this petOwner:SetFlag{iFlagID = flagNumber, bFlag = true} petOwner:UpdateMissionTask{taskType = "complete", value = 505, value2 = 1, target = self} end end self:Die{ killType = "VIOLENT" , killerID = petOwner } -- Ability is done being used, remove using-ability state from pet msg.ObjIDSender:RemovePetState{iStateType = 9} end end --function onTimerDone(self, msg) -- -- if ( msg.name == "KillChest" ) then -- -- local activator = getObjectByName(self, "activator") -- local petOwner = activator:GetParentObj().objIDParent -- -- -- Pet 'kills' the treasure node, causing it to spawn a treasure chest -- self:Die{ killType = "VIOLENT" , killerID = petOwner } -- -- end -- --end function onDie(self,msg) local myParent = getParent(self) if ( self:GetVar("I_Have_A_Parent") ) then myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") end -- Let the scene's treasure node spawner know this treasure has died, so it can spawn another one later. getParent(self):NotifyObject{name = "died"} end local pickPriority = 0.8 local pickType = 0 function onStartup(self, msg) --print("Treasure startup") pickType = 0 self:SetVar("isCharacterNearby", false) end function onDie(self, msg) --print("Treasure died") -- get the player's id local localCharacterID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- terminate the player's interaction (could be this treasure or the pet) localCharacterID:TerminateInteraction{ ETerminateType="user", ObjIDTerminator=localCharacterID } pickType = -1 self:RequestPickTypeUpdate{} end function onCollisionPhantom(self, msg) --print("CollisionPhantom: sender=" .. msg.senderID:GetName().name) --print("CollisionPhantom: self=" .. self:GetName().name) if (msg.senderID:IsCharacter{}.isChar and msg.senderID:GetID() == GAMEOBJ:GetLocalCharID()) then self:SetVar("isCharacterNearby", true) -- start a timer to check if the player is in proximity with a pet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end function onOffCollisionPhantom(self, msg) --print("OffCollisionPhantom: sender=" .. msg.senderID:GetName().name) if (msg.senderID:IsCharacter{}.isChar and msg.senderID:GetID() == GAMEOBJ:GetLocalCharID()) then self:SetVar("isCharacterNearby", false) pickType = -1 self:RequestPickTypeUpdate{} GAMEOBJ:GetTimer():CancelTimer("UpdateIcons", self); end end function onTimerDone(self, msg) --print(self:GetName().name .. ".TimerDone: " .. msg.name) if ( msg.name == "UpdateIcons" ) then if ( self:GetVar("isCharacterNearby") == true) then local oldPickType = pickType pickType = -1 local localCharacterID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local pet = localCharacterID:GetPetID().objID if (self:IsDead{}.bDead == true) then -- chest is dead, hide the icon pickType = -1 elseif (pet:Exists() == false) then -- no pet, show the icon pickType = 14 elseif (pet:IsPetUsingAbility().bIsUsingAbility == false) then -- pet not signaling, show the icon pickType = 14 end --print("PickType=" .. tostring(pickType) .. ", oldPickType=" ..tostring(oldPickType)) if (pickType ~= oldPickType) then self:RequestPickTypeUpdate{} end -- start the timer again GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end end function onScriptNetworkVarUpdate(self,msg) --print("NetworkVarUpdate: " .. tostring(#msg.tableOfVars)) local treasure_dug = self:GetNetworkVar("treasure_dug") if treasure_dug == true then --print("treasure_dug is true!!!") self:PlayFXEffect{effectType = "dug_up"} self:SetTransparency{fAlphaValue = 0.0} end end function onGetPriorityPickListType(self, msg) if ( pickPriority >= msg.fCurrentPickTypePriority ) then if (pickType ~= 0) then --print("Set pickType=" .. tostring(pickType)) msg.ePickType = pickType end msg.fCurrentPickTypePriority = pickPriority end return msg end function onClientUse(self, msg) local user = msg.user -- the only way for a player to use this item is by hitting their interact button -- the only time the interact button is available here is when the pick type is 14 -- the only time the pick type is 14 is when the player doesn't have a pet or the digging ability -- therefore, show the tooltip indicating they need a pet user:DisplayTooltip{ bShow = true, strText = Localize("PR_DIG_TUTORIAL_04"), iTime = 3000 } endrequire('o_mis') --########################################################### --### ON START UP ### --########################################################### function onStartup(self) end --########################################################### --#### ON CLICKED --########################################################### onCheckUseRequirements = function (self, msg) local a = msg.objIDUser:GetInvItemCount{ itemID = 3191}.itemCount -- TUTORIAL Terrier Egg local b = msg.objIDUser:GetInvItemCount{ itemID = 3192}.itemCount -- TUTORIAL Cat Egg local c = msg.objIDUser:GetInvItemCount{ itemID = 3193}.itemCount -- TUTORIAL Reindeer Egg local BefriendMissionState = msg.objIDUser:GetMissionState{missionID = 109}.missionState local HatchMissionState = msg.objIDUser:GetMissionState{missionID = 110}.missionState -- If befriending mission is Complete or ( Complete + anything else ), OR they already have an egg. -- If they finished befriending mission, if (BefriendMissionState >= 4) then if ( a < 1 and b < 1 and c < 1 ) then -- If they do not have a TUTORIAL egg if (HatchMissionState < 4) then -- If they didn't hatch egg yet, and instead threw it away. msg.bCanUse = true end else -- If they have a TUTORIAL egg msg.objIDUser:UseRequirementsResponse{iUseResponseType = 1 , objIDResponseSource = self, bCanUse = false } --You can only tame one pet in the pet ranch msg.bCanUse = false end -- If they haven't started the taming mission yet, don't let them tame a pet elseif (BefriendMissionState == 1) then print("************* BefriendMissionState == 1 *************") msg.objIDUser:UseRequirementsResponse{iUseResponseType = 2 , objIDResponseSource = self ,bCanUse = false } --You cannot tame a pet until you've spoken to the ranch msg.bCanUse = false end print("************* Done pet check! *************") return msg end ----------------------------------------------------------- -- this script is on the property guard in the ag property -- he needs to go away after the player completes the last mission in this property -- THIS SCRIPT NEEDS COMMENTING -- brandi 6/3/10 -- updated brandi 6/18/10 added notify object for accpeting the last mission -- updated brandi 7/15/10 added player flag -------------------------------- local lastMission = 891 function onMissionDialogueOK(self,msg) local player = msg.responder -- the player accepts the mission to touch the orb, and hasnt touched the orb yet, so the mission cam if msg.missionID == 768 and msg.iMissionState == 1 then if player:GetFlag{iFlagID = 71}.bFlag == false then player:PlayCinematic{ pathName = "MissionCam" } end -- if the player accepts the last tutorial mission, let the zone control object know elseif msg.missionID == lastMission and msg.iMissionState == 1 then GAMEOBJ:GetZoneControlID():NotifyObject{ name = "LastMissionAccepted", param1 = player:GetID(), ObjIDSender = player } --if the player completes the last mission, the guard should teleport away elseif msg.missionID == lastMission and msg.iMissionState == 4 then -- player flag for being able to open the property up to visitors player:SetFlag{iFlagID = 113, bFlag = true} GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "GuardChat", paramObj = Guard } GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "SelfDie",self ) end end function onTimerDone(self,msg) if msg.name == "SelfDie" then self:RequestDie{ killerID = self, killtype = "VIOLENT" } LEVEL:GetSpawnerByName("PropertyGuard"):SpawnerDeactivate() end end----------------------------------------------------------- -- this script is on the cloud damaging fx in the property pushback maps -- -- THIS SCRIPT NEEDS COMMENTING -- brandi 6/3/10 -------------------------------- function onCollisionPhantom(self,msg) if msg.objectID:GetFaction().faction == 1 then self:CastSkill{skillID = 797, optionalTargetID = msg.objectID } end end----------------------------------------------------------- -- this script is on the property guard in the ag property -- he needs to go away after the player completes the last mission in this property -- THIS SCRIPT NEEDS COMMENTING -- brandi 6/3/10 -- updated brandi 6/18/10 added notify object for accpeting the last mission -------------------------------- local flag = { misID872 = 97, misID873 = 98, misID874 = 99 } function onMissionDialogueOK(self,msg) local player = msg.responder local missionID = msg.missionID local mission = "misID"..missionID -- the player accepts the mission to touch the orb, and hasnt touched the orb yet, so the mission cam if msg.iMissionState == 1 then if player:GetFlag{iFlagID = flag[mission]}.bFlag == false then player:PlayCinematic{ pathName = "MissionCam" } end --if the player completes the last mission, the guard should teleport away elseif msg.iMissionState == 4 then GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "GuardChat", paramObj = Guard } GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "SelfDie",self ) end end function onTimerDone(self,msg) if msg.name == "SelfDie" then self:RequestDie{ killerID = self, killtype = "VIOLENT" } LEVEL:GetSpawnerByName("Guard"):SpawnerDeactivate() end end--------------------------------------------- -- this script is for property pushback -- basically on interact the moving platform goes up, and when it reaches the top, it smashes itself -- brandi 6/25/10 -------------------------------------------- function onStartup(self) -- stop the platform from moving up the path until it is interacted with self:StopPathing() end function onUse(self,msg) -- check to make sure the rebuild is done if self:GetRebuildState{}.iState == 2 then -- go up the platform self:GoToWaypoint{iPathIndex = 1} end end function onArrivedAtDesiredWaypoint(self, msg) -- at the top of the path, wait then smash itself GAMEOBJ:GetTimer():AddTimerWithCancel(10, "killMe", self ) end function onTimerDone(self, msg) if msg.name == "killMe" then --smash the platform self:RequestDie{killerID = self, killType = "VIOLENT"} end end------------------------------------------------------------------- --Plays FX for the player when the cross the finish line on their last lap ------------------------------------------------------------------- function onCollisionPhantom(self, msg) local player = msg.objectID local lap = player:VehicleGetCurrentLap{}.uiCurLap if player:GetID() == GAMEOBJ:GetControlledID():GetID() then if lap == 3 then local object = self:GetObjectsInGroup{group = "Track", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "FinishFX", effectID = 3577, effectType = "create"} end end end end -------------------------------------------------------------- -- Adds or removes a boost action to the vehicle. -- created seraas... 2/3/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("onCollisionPhantom") local player = msg.objectID if player:GetID() == GAMEOBJ:GetControlledID():GetID() then --print("VehicleAddPassiveBoostAction") msg.objectID:VehicleAddPassiveBoostAction() end end function onOffCollisionPhantom(self, msg) --print("offCollisionPhantom") local player = msg.objectID if player:GetID() == GAMEOBJ:GetControlledID():GetID() then --print("VehicleRemovePassiveBoostAction") msg.objectID:VehicleRemovePassiveBoostAction() end end ----------------------------------------------------------- -- exploding crate smashable for racing ----------------------------------------------------------- function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end --print("Boom!") local target = msg.objectID if ( target:GetID() == GAMEOBJ:GetControlledID():GetID() ) then target:VehicleNotifyHitExploder{ objHit = self } self:SetVar("bIsDead", true) end end------------------------------------------------------------------- --Plays FX for the player when the cross the finish line on their last lap ------------------------------------------------------------------- function onCollisionPhantom(self, msg) local player = msg.objectID local lap = player:VehicleGetCurrentLap{}.uiCurLap if player:GetID() == GAMEOBJ:GetControlledID():GetID() then if lap == 3 then local object = self:GetObjectsInGroup{group = "Track", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "FinishFX", effectID = 3600, effectType = "create"} end end end end function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end local target = msg.objectID if ( target:GetID() == GAMEOBJ:GetControlledID():GetID() ) then self:PlayFXEffect{effectType = "pickup"} --target:PlayFXEffect{name = "bouncer", effectID = 194, effectType = "onbounce"} target:PlayFXEffect{name = "energy_orb", effectID = 1007, effectType = "cast"} target:VehicleNotifyHitSmashable{ objHit = self } self:SetVar("bIsDead", true) end end local localskillID = 586 function onStartup(self) self:SetVar("bIsDead", false) end function onDie(self, msg) if ( self:GetVar("bIsDead") == true ) then return end --print("onDie Imagination") local target = msg.killerID self:PlayFXEffect{effectType = "pickup"} -- tell the killer's car to add imagination target:CastSkill{skillID = localskillID, optionalTargetID = target} target:RacingPlayerEvent{ eventType="POWERUP_IMAGINATION", playerID=target, objectID=self } target:RacingPlayerEvent{ eventType="SMASHED_SOMETHING", playerID=target, objectID=self } local driver = target:GetPossessor().possessorID driver:UpdatePlayerStatistic{ updateID = 22 } self:SetVar("bIsDead", true) end local localskillID = 585 function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end local target = msg.objectID target:RacingPlayerEvent{ eventType="POWERUP_IMAGINATION", playerID=target, objectID=self } local driver = target:GetPossessor().possessorID driver:UpdatePlayerStatistic{ updateID = 21 } target:CastSkill{skillID = localskillID, optionalTargetID = target} self:Die{ killerID = msg.playerID, killType = "SILENT" } self:SetVar("bIsDead", true) end function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end --print("onCollision") local target = msg.objectID local controlledObject = GAMEOBJ:GetControlledID() if ( target:GetID() == controlledObject:GetID() ) then --print ("controlled object") controlledObject:PlayFXEffect{effectID = 1159, effectType = "pickup"} --target:PlayFXEffect{name = "bouncer", effectID = 194, effectType = "onbounce"} target:PlayFXEffect{name = "energy_orb", effectID = 1007, effectType = "cast"} -- assume they will collide on the server and delete this object, but just -- in case they don't, we need to turn visibility back on after a couple seconds self:SetVisible{visible = false, fadeTime = 0} GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "visible", self ) self:SetVar("bIsDead", true) end end function onTimerDone(self, msg) --print("timer done, going visible again") if msg.name == "visible" then self:SetVisible{visible = true, fadeTime = 0} end endfunction onStartup(self) local HeroShip = self:GetObjectsInGroup{ group = "BadShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9530 then HeroShip[i]:PreloadAnimation{animationID = "lap_01", respondObjID = self} break end end end function onCollisionPhantom(self, msg) local player = msg.objectID local HeroShip = self:GetObjectsInGroup{ group = "BadShip"}.objects if player:GetID() == GAMEOBJ:GetControlledID():GetID() then for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9530 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_01"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break end end GAMEOBJ:DeleteObject(self) end end function onStartup(self) local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then HeroShip[i]:PreloadAnimation{animationID = "lap_01", respondObjID = self} break elseif HeroShip[i]:GetLOT().objtemplate == 10002 then HeroShip[i]:PreloadAnimation{animationID = "lap_01", respondObjID = self} break end end end function onCollisionPhantom(self, msg) local player = msg.objectID local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects if player:GetID() == GAMEOBJ:GetControlledID():GetID() then for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_01"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break elseif HeroShip[i]:GetLOT().objtemplate == 10002 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_01"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break end end GAMEOBJ:DeleteObject(self) end end function onStartup(self) local HeroShip = self:GetObjectsInGroup{ group = "BadShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9530 then HeroShip[i]:PreloadAnimation{animationID = "lap_02", respondObjID = self} break end end end function onCollisionPhantom(self, msg) local player = msg.objectID local lap = player:VehicleGetCurrentLap{}.uiCurLap if player:GetID() == GAMEOBJ:GetControlledID():GetID() then if lap == 2 then local HeroShip = self:GetObjectsInGroup{ group = "BadShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9530 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_02"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break end end GAMEOBJ:DeleteObject(self) end end end function onStartup(self) self:SetVar("Collider", 0) local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then HeroShip[i]:PreloadAnimation{animationID = "lap_02", respondObjID = self} break elseif HeroShip[i]:GetLOT().objtemplate == 10002 then HeroShip[i]:PreloadAnimation{animationID = "lap_02", respondObjID = self} break end end end function onCollisionPhantom(self, msg) local player = msg.objectID local lap = player:VehicleGetCurrentLap{}.uiCurLap if player:GetID() == GAMEOBJ:GetControlledID():GetID() and self:GetVar("Collider") == 0 then if lap == 2 then self:SetVar("Collider", 1) local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_02"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break elseif HeroShip[i]:GetLOT().objtemplate == 10002 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_02"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} -- Adding timer to remove chevron at appropriate time during animation print "Start timer" GAMEOBJ:GetTimer():AddTimerWithCancel( 1.6, "DeleteChevron", self ) break end end end end end function onTimerDone(self, msg) if msg.name == "DeleteChevron" then print "Not finding chevron" local Chevron = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (Chevron) do if Chevron[i]:GetLOT().objtemplate == 10003 then local Chevy = Chevron[i] print "Deleting Chevron" GAMEOBJ:DeleteObject(Chevy) break end end end end function onStartup(self) local HeroShip = self:GetObjectsInGroup{ group = "BadShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9530 then HeroShip[i]:PreloadAnimation{animationID = "lap_03", respondObjID = self} break end end end function onCollisionPhantom(self, msg) local player = msg.objectID local lap = player:VehicleGetCurrentLap{}.uiCurLap if player:GetID() == GAMEOBJ:GetControlledID():GetID() then if lap == 3 then local HeroShip = self:GetObjectsInGroup{ group = "BadShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9530 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_03"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break end end GAMEOBJ:DeleteObject(self) end end end function onStartup(self) local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then HeroShip[i]:PreloadAnimation{animationID = "lap_03", respondObjID = self} break elseif HeroShip[i]:GetLOT().objtemplate == 10001 then HeroShip[i]:PreloadAnimation{animationID = "lap_03", respondObjID = self} break end end end function onCollisionPhantom(self, msg) local player = msg.objectID local lap = player:VehicleGetCurrentLap{}.uiCurLap if player:GetID() == GAMEOBJ:GetControlledID():GetID() then if lap == 3 then local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_03"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break elseif HeroShip[i]:GetLOT().objtemplate == 10001 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_03"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break end end GAMEOBJ:DeleteObject(self) end end end ----------------------------------------------------------- --smashables for racing ----------------------------------------------------------- function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end --print("I'm hit!") local target = msg.objectID if ( target:GetID() == GAMEOBJ:GetControlledID():GetID() ) then --print("sending hit message") target:VehicleNotifyHitSmashable{objHit = self} end end function onDie(self, msg) --print("dead") end----------------------------------------------------------- --smashables for racing ----------------------------------------------------------- function onStartup(self) self:SetVar("bIsDead", false) end function onDie(self, msg) if ( self:GetVar("bIsDead") == true ) then return end --print("onDie Crate") local target = msg.killerID -- update the killer's smashable achievement count target:RacingPlayerEvent{ eventType="SMASHED_SOMETHING", playerID=target, objectID=self } self:SetVar("bIsDead", true) endrequire('o_mis') function onStartup(self) end -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) local objID = msg.objectID local player = msg.senderID local isfaction = msg.senderID:GetFaction().faction if GAMEOBJ:GetTimer():GetTime(player:GetName().name,self ) == 0 and isfaction == 113 then -- --print("Vol Hit "..self:GetVar("num") ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , player:GetName().name , self ) GAMEOBJ:GetZoneControlID():NotifyObject{ name="DriverPosition", ObjIDSender = player, param1 = tonumber( self:GetVar("num")) } end end function onTimerDone(self,msg) end require('o_mis') function onStartup(self) myPriority = 0.8 self:SetVar("IconNumber", 1) -- ReRenderNameBillboard -- SetName ---self:SetIconAboveHead{overrideIconLOT = 7561, overrideIsClickable = false , bIconOff = false} end function onGetPriorityPickListType(self, msg) if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type else msg.ePickType = -1 --print("PickType set to -1") end return msg end function onClientUse(self,msg) myPriority = 0 self:RequestPickTypeUpdate{} end function onNotifyClientObject(self, msg) if (msg.name == "updateCarNumber" and msg.param1 > 0) then if self:GetVar("IconNumber") ~= msg.param1 then -- print("SetIcon OFF") self:SetIconAboveHead{iconType = 400 ,bIconOff = true , overrideIsClickable = false } self:SetIconAboveHead{iconType = 400 , overrideIconLOT = msg.param1 , overrideIsClickable = false } self:SetVar("IconNumber", msg.param1 ) end else --print("SetIcon ON") self:SetIconAboveHead{iconType = 400 ,bIconOff = true , overrideIsClickable = false } end end function onUse(self, msg) print "in onUse" if (msg.user ~= nil) then if msg.user:GetPossessedObject().possessedObject:GetID() ~= self:GetID() then print "Vroooom!" msg.user:PossessObject{ objToPossess = self } end else print "user is nil" end end function onChangePossessor(self,msg) if GAMEOBJ:GetZoneControlID():GetVar("Set.GameType") ~= nil then self:VehicleLockInput{bLockWheels = true} end end function onNotifyObject(self,msg) if msg.name == "updateCarNumber" then self:NotifyClientObject{ name = "updateCarNumber" , param1 = StartPos } end end-------------------------------------------------------------- -- Spawns in Imagination Spawner Networks based on player load. -- this file should be required by the server zone race script. -- require('ai/RACING/RACE_IMAGINATION_SPAWNER') -- created mrb... 2/2/10 -- modified Steve Y... 4/12/10 -- modified Devon... 6/14/10 -- corrected spawning based on ZoneLoadedInfo.maxPlayersSoft -------------------------------------------------------------- function onZoneLoadedInfo(self, msg) local playersNum = msg.maxPlayersSoft spawnImagination(self, playersNum) end function spawnImagination(self, playersNum) --print("playersnum = " .. playersNum) -- spawn minimum amount of imagination for 1-2 players --print("spawning MIN imagination") ActivateSpawner(LEVEL:GetSpawnerByName("ImaginationSpawn_Min")) if playersNum > 2 then -- spawn medium amount of imagination for 3-4 players --print("spawning MED imagination") ActivateSpawner(LEVEL:GetSpawnerByName("ImaginationSpawn_Med")) end if playersNum > 4 then -- spawn maximum amount of imagination for 5-6 players --print("spawning MAX imagination") ActivateSpawner(LEVEL:GetSpawnerByName("ImaginationSpawn_Max")) end end function ActivateSpawner(spawner) if spawner then spawner:SpawnerActivate() end end------------------------------------------- -- this entire file is a hack! -- it creates a car for the player ------------------------------------------- function oStart(self) -- do nothing... end require('o_mis') function onStartup(self) --print("RACING: onStartup") -- configure the racing control local racingParams = { { "IntroCinematic", "P1" }, { "ExitCinematic", "FinishLine" }, --{ "CountdownCinematic", "Countdown" }, { "NDAudioMusicCueName1", "GF_Race-Track"}, { "NDAudioMusicCueName2", "GF_Race-Track2"}, { "NDAudioMusicCueName3", "GF_Race-Track3"}, { "NDAudioMusicCueName4", "GF_Race-Track4"}, } --print("ConfigureRacingControl...") self:ConfigureRacingControlClient{ parameters = racingParams } --print("...Done") end require('ai/RACING/RACE_IMAGINATION_SPAWNER') require('o_mis') require('ai/RACING/SERVER/RACE_HACK_IN_CAR') function onStartup(self) --print("RACING: onStartup") -- configure the racing control local racingParams = { { "GameType", "Racing" }, { "GameState", "Starting" }, -- Do Not Change -- { "Number_Of_PlayersPerTeam", 6 }, -- INT ( Set the number of players on each team ) { "Minimum_Players_to_Start", 2 }, -- INT ( The min number of players to start game ) { "Minimum_Players_for_Group_Achievments", 3 }, -- INT ( the minimum number of players required to get "group" achievements ) --- Game Object Lots --- { "Car_Object", 7703 }, { "Race_PathName", "MainPath" }, { "Current_Lap", 1 }, { "Number_of_Laps", 3 }, -- Number of Laps to complete the Race { "activityID", 54 }, { "Place_1", 100 }, { "Place_2", 90 }, { "Place_3", 80 }, { "Place_4", 70 }, { "Place_5", 60 }, { "Place_6", 50 }, -- Reward % Rating -- { "Num_of_Players_1", 15 }, { "Num_of_Players_2", 25 }, { "Num_of_Players_3", 50 }, { "Num_of_Players_4", 85 }, { "Num_of_Players_5", 90 }, { "Num_of_Players_6", 100 }, { "Number_of_Spawn_Groups", 1 }, --INT { "Red_Spawners", 4847 }, { "Blue_Spawners", 4848 }, { "Blue_Flag", 4850 }, { "Red_Flag", 4851 }, { "Red_Point", 4846 }, { "Blue_Point", 4845 }, { "Red_Mark", 4844 }, { "Blue_Mark", 4843 }, } --print("ConfigureRacingControl...") self:ConfigureRacingControl{ parameters = racingParams } --print("...Done") -- Do not change ---------------------------------------------------------- --self:SetVar("Set",Set) --self:SetNetworkVar("Set",Set) oStart(self) end -------------------------------------------------------------------------------- require('o_mis') function onStartup(self) --print("RACING: onStartup") -- configure the racing control local racingParams = { { "IntroCinematic", "P1" }, { "ExitCinematic", "FinishLine" }, --{ "CountdownCinematic", "Countdown" }, { "NDAudioMusicCueName1", "GF_Race-Track"}, { "NDAudioMusicCueName2", "GF_Race-Track2"}, { "NDAudioMusicCueName3", "GF_Race-Track3"}, { "NDAudioMusicCueName4", "GF_Race-Track4"}, } --print("ConfigureRacingControl...") self:ConfigureRacingControlClient{ parameters = racingParams } --print("...Done") end ----------------------------------------------------------- -- client-side script for the Gnarled Forest death plane ----------------------------------------------------------- function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) --print("hit death phantom") local target = msg.objectID if ( target:GetID() == GAMEOBJ:GetControlledID():GetID() ) then --print("calling cinematic") local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "DeathVol1" } end end----------------------------------------------------------- -- client-side script for the Gnarled Forest death plane ----------------------------------------------------------- function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) --print("hit death phantom") local target = msg.objectID if ( target:GetID() == GAMEOBJ:GetControlledID():GetID() ) then --print("calling cinematic") local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "DeathVol2" } end end----------------------------------------------------------- -- client-side script for the Gnarled Forest death plane ----------------------------------------------------------- function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) --print("hit death phantom") local target = msg.objectID if ( target:GetID() == GAMEOBJ:GetControlledID():GetID() ) then --print("calling cinematic") local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "DeathVol3" } end end require('ai/RACING/RACE_IMAGINATION_SPAWNER') require('o_mis') require('ai/RACING/SERVER/RACE_HACK_IN_CAR') function onStartup(self) --print("RACING: onStartup") -- configure the racing control local racingParams = { { "GameType", "Racing" }, { "GameState", "Starting" }, -- Do Not Change -- { "Number_Of_PlayersPerTeam", 6 }, -- INT ( Set the number of players on each team ) { "Minimum_Players_to_Start", 2 }, -- INT ( The min number of players to start game ) { "Minimum_Players_for_Group_Achievments", 3 }, -- INT ( the minimum number of players required to get "group" achievements ) --- Game Object Lots --- { "Car_Object", 7703 }, { "Race_PathName", "MainPath" }, { "Current_Lap", 1 }, { "Number_of_Laps", 3 }, -- Number of Laps to complete the Race { "activityID", 39 }, { "Place_1", 100 }, { "Place_2", 90 }, { "Place_3", 80 }, { "Place_4", 70 }, { "Place_5", 60 }, { "Place_6", 50 }, -- Reward % Rating -- { "Num_of_Players_1", 15 }, { "Num_of_Players_2", 25 }, { "Num_of_Players_3", 50 }, { "Num_of_Players_4", 85 }, { "Num_of_Players_5", 90 }, { "Num_of_Players_6", 100 }, { "Number_of_Spawn_Groups", 1 }, --INT { "Red_Spawners", 4847 }, { "Blue_Spawners", 4848 }, { "Blue_Flag", 4850 }, { "Red_Flag", 4851 }, { "Red_Point", 4846 }, { "Blue_Point", 4845 }, { "Red_Mark", 4844 }, { "Blue_Mark", 4843 }, } --print("ConfigureRacingControl...") self:ConfigureRacingControl{ parameters = racingParams } --print("...Done") -- Do not change ---------------------------------------------------------- --self:SetVar("Set",Set) --self:SetNetworkVar("Set",Set) oStart(self) end -------------------------------------------------------------------------------- require('o_mis') function onStartup(self) --print("RACING: onStartup") -- configure the racing control local racingParams = { { "IntroCinematic", "P1" }, { "ExitCinematic", "FinishLine" }, --{ "CountdownCinematic", "Countdown" }, { "NDAudioMusicCueName1", "GF_Race-Track"}, { "NDAudioMusicCueName2", "GF_Race-Track2"}, { "NDAudioMusicCueName3", "GF_Race-Track3"}, { "NDAudioMusicCueName4", "GF_Race-Track4"}, } --print("ConfigureRacingControl...") self:ConfigureRacingControlClient{ parameters = racingParams } --print("...Done") end ----------------------------------------------------------- -- client-side script for the Nimbus Station death plane ----------------------------------------------------------- function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) --print("hit death phantom") local target = msg.objectID if ( target:GetID() == GAMEOBJ:GetControlledID():GetID() ) then --print("calling cinematic") local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "DeathVol1" } end endrequire('ai/RACING/RACE_IMAGINATION_SPAWNER') require('o_mis') require('ai/RACING/SERVER/RACE_HACK_IN_CAR') function onStartup(self) --print("RACING: onStartup") -- configure the racing control local racingParams = { { "GameType", "Racing" }, { "GameState", "Starting" }, -- Do Not Change -- { "Number_Of_PlayersPerTeam", 6 }, -- INT ( Set the number of players on each team ) { "Minimum_Players_to_Start", 2 }, -- INT ( The min number of players to start game ) { "Minimum_Players_for_Group_Achievments", 3 }, -- INT ( the minimum number of players required to get "group" achievements ) --- Game Object Lots --- { "Car_Object", 7703 }, { "Race_PathName", "MainPath" }, { "Current_Lap", 1 }, { "Number_of_Laps", 3 }, -- Number of Laps to complete the Race { "activityID", 42 }, { "Place_1", 100 }, { "Place_2", 90 }, { "Place_3", 80 }, { "Place_4", 70 }, { "Place_5", 60 }, { "Place_6", 50 }, -- Reward % Rating -- { "Num_of_Players_1", 15 }, { "Num_of_Players_2", 25 }, { "Num_of_Players_3", 50 }, { "Num_of_Players_4", 85 }, { "Num_of_Players_5", 90 }, { "Num_of_Players_6", 100 }, { "Number_of_Spawn_Groups", 1 }, --INT { "Red_Spawners", 4847 }, { "Blue_Spawners", 4848 }, { "Blue_Flag", 4850 }, { "Red_Flag", 4851 }, { "Red_Point", 4846 }, { "Blue_Point", 4845 }, { "Red_Mark", 4844 }, { "Blue_Mark", 4843 }, } --print("ConfigureRacingControl...") self:ConfigureRacingControl{ parameters = racingParams } --print("...Done") oStart(self) end -------------------------------------------------------------------------------- function onStartup (self) --print ("Lap trigger starting up") end function onFireEvent (self,msg) -- --print("received FireEvent from " .. msg.senderID:GetLOT().objtemplate) -- tell the RaceController that a player collided with it local GroupMsg = self:GetObjectsInGroup {group = "RaceController", ignoreSpawners = true} for index,object in pairs(GroupMsg.objects) do object:NotifyObject {name = "TriggerEntered"} end end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) --print("****************************** Collision *******************************") msg.ignoreCollision = true return msg end---------------------------------------------------------------- -- Sets up an activity of the object, only need to put in variable you want to change ---------------------------------------------------------------- function SetupActivity(self,nMaxUsers) -- set max users to something high self:SetActivityParams{ modifyMaxUsers = true, maxUsers = nMaxUsers, modifyActivityActive = true, activityActive = true} end ---------------------------------------------------------------- -- Returns true/false if a player is in the activity -- takes self and a PLAYER object ---------------------------------------------------------------- function IsPlayerInActivity(self,player) -- check if player is in activity local existMsg = self:ActivityUserExists{ userID = player } if (existMsg) then return existMsg.bExists end return false end ---------------------------------------------------------------- -- Add Player and Car to activity: Object ---------------------------------------------------------------- function AddPlayerAndCarToActivity(self,player, carID ) if (player) and (carID:GetType{}.objType == "Vehicle") and not IsPlayerInActivity(self,player) then self:AddActivityUser{ userID = player } self:SetActivityUserData{userID = player ,controlledID = carID, typeIndex = 0, value = 0 } end if (player) and (carID) then SetActivityValue(self, player, 0, 0 ) end end ---------------------------------------------------------------- -- adds the valueVar to the existing value of the index for the -- player in the activity ---------------------------------------------------------------- function UpdateActivityValue(self, player, valueIndex, valueVar , carID) local newValue = self:GetActivityUserData{ userID = player, typeIndex = valueIndex}.outValue + valueVar SetActivityValue(self, player, valueIndex, newValue ) end ---------------------------------------------------------------- -- Stores a vaariable for the player in the activity ---------------------------------------------------------------- function SetActivityValue(self, player, valueIndex, valueVar ) local carID = getObjectByName(self, player:GetName().name.."CarID") self:SetActivityUserData{ userID = player, controlledID = carID ,typeIndex = valueIndex, value = tonumber(valueVar) } end ---------------------------------------------------------------- -- Gets the value of the activity index for the player ---------------------------------------------------------------- function GetActivityValue(self, player, valueIndex) return self:GetActivityUserData{ userID = player, typeIndex = valueIndex}.outValue end ---------------------------------------------------------------- -- StopActivity message ---------------------------------------------------------------- function StopActivity(self,player, scoreVar, value1Var, value2Var, quit , carID) -- user is trying to cancel if quit then -- remove the user from activity self:RemoveActivityUser{ userID = player } else SetActivityValue(self, player, 0, scoreVar ) if value1Var ~= nil then SetActivityValue(self, player, 1, scoreVar ) elseif value2Var ~= nil then SetActivityValue(self, player, 2, scoreVar ) end if (self) then SetActivityValue(self, player, 0, scoreVar ) if value1Var ~= nil then SetActivityValue(self, player, 1, value1Var ) elseif value2Var ~= nil then SetActivityValue(self, player, 2, value2Var ) end end -------------------------------------------------------------------- -- distribute rewards -------------------------------------------------------------------- self:DistributeActivityRewards{ userID = player, bAutoAddCurrency = true, bAutoAddItems = true } -- debug in C++ -- Update Leaderboards for this user self:UpdateActivityLeaderboard{ userID = player } -- remove the user from activity --self:RemoveActivityUser{ userID = player } --- Update reward UI ( send vars to client ) local reward = self:GetActivityReward{playerID = player} local rewardItem1Image = reward.rewardItem1Image local rewardItem1Name = reward.rewardItem1Name local rewardItem1StackSize = reward.rewardItem1StackSize local rewardItem2Image = reward.rewardItem2Image local rewardItem2Name = reward.rewardItem2Name local rewardItem2StackSize = reward.rewardItem2StackSize local rewardMoney = reward.rewardMoney local rewardString = rewardMoney..","..rewardItem1Name..","..rewardItem1Image..","..rewardItem1StackSize..","..rewardItem2Name..","..rewardItem2Image..","..rewardItem1StackSize self:NotifyClientZoneObject{ name = "RewardPlayer" , paramStr = rewardString, rerouteID = player } end end ---------------------------------------------------------------- -- GetLeaderboard Data message ---------------------------------------------------------------- function GetLeaderboardData( self, player, activityID ) -- get the leaderboard data for the user and update summary screen if it exists self:RequestActivitySummaryLeaderboardData{ user = player, target = self, queryType = 7, gameID = activityID } end -------------------------------------------------------------- -- Calculate the activity rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) msg.outActivityRating = 84 return msg end --------------------------------------------------------------------------------------- -- Sent to the racing control object when a player's rank in the race has changed. --------------------------------------------------------------------------------------- function onRacingPlayerRankChanged(self, msg) local player = msg.playerID local oldRank = msg.oldRank local newRank = msg.newRank local carID = getObjectByName(self, player:GetName().name.."CarID") self:SetActivityUserData{ userID = player, typeIndex = 0,controlledID = carID, value = oldRank } end --------------------------------------------------------------------------------------- -- player crosses the finish line. --------------------------------------------------------------------------------------- function onRacingPlayerCrossedFinishLine(self, msg) local player = msg.playerID local oldlap = msg.oldLap local newLap = msg.newLap local PlayerPos = self:GetActivityUserData{ userID = player, typeIndex = 0}.outValue local LapScore = self:GetActivityUserData{ userID = player, typeIndex = 3}.outValue SetActivityValue(self, player, 3, LapScore + 1 ) if (self:GetActivityUserData{ userID = player, typeIndex = 3}.outValue == self:GetVar("Set.Number_of_Laps") + 1)then --------------------------------------------------------------------------------------- -- Driver Completed the Race -- Lock Brake -- Flag to Completed --------------------------------------------------------------------------------------- local car = getObjectByName(self, player:GetName().name.."CarID" ) car:VehicleLockInput{bLockWheels = true} local pos = self:GetActivityUserData{ userID = player, typeIndex = 0}.outValue ServerActivityTimers(self, player, "StartNewLapTime" ,true , pos ) self:NotifyClientZoneObject{name = "ActivityTimers" , paramObj = player , paramStr = "StartNewLapTime,true", param2 = oldlap, rerouteID = player } else --------------------------------------------------------------------------------------- -- Driver Crossed Finish Line Race not yet Completed --------------------------------------------------------------------------------------- ServerActivityTimers(self, player, "StartNewLapTime" ,false , PlayerPos) self:NotifyClientZoneObject{name = "ActivityTimers" , paramObj = player , paramStr = "StartNewLapTime,false", param2 = oldlap, rerouteID = player } end end --------------------------------------------------------------------------------------- -- Lets racing control object know when a player has left the track's --------------------------------------------------------------------------------------- --function onRacingPlayerOutOfTrackBounds(self, msg) -- local player = msg.playerID -- local carID = getObjectByName(self, player:GetName().name.."CarID") -- if (carID:VehicleCanWreck().bCanWreck == true) then -- carID:Die{ killType = "VIOLENT" } -- end --end --------------------------------------------------------------------------------------- -- Message to script Player is heading the wrong way --------------------------------------------------------------------------------------- function onRacingPlayerWrongWayStatusChanged(self, msg) local player = msg.playerID local way = msg.bGoingWrongWay if (way) then self:NotifyClientZoneObject{name = "WrongWayTrue" , rerouteID = player } else self:NotifyClientZoneObject{name = "WrongWayFalse" , rerouteID = player } end end --------------------------------------------------------------------------------------- -- Sent to the racing control object when a player's rank in the race has changed. --------------------------------------------------------------------------------------- function onRacingPlayerRankChanged(self, msg) local playerName = msg.playerID:GetName().name local player = msg.playerID local oldRank = msg.oldRank local newRank = msg.newRank if self:GetVar("RaceStarted") then --print("onRacingPlayerRankChanged "..oldRank.." "..playerName) UI:SendMessage("RaceStat", {{"racePos_"..oldRank, playerName }} ) end end --------------------------------------------------------------------------------------- -- Sent to the racing control object when a player's 'wrong-way' status changes. --------------------------------------------------------------------------------------- function onRacingPlayerWrongWayStatusChanged(self, msg) local player = msg.playerID local way = msg.bGoingWrongWay if (way) then UI:SendMessage("RaceWW", {{"UI","show" }} ) else UI:SendMessage("RaceWW", {{"UI","hide" }} ) end end --------------------------------------------------------------------------------------- -- Lets racing control object know when a player has left the track's --------------------------------------------------------------------------------------- function onRacingPlayerOutOfTrackBounds(self, msg) local player = msg.playerID local carID = getObjectByName(self, player:GetName().name.."CarID") if (carID:VehicleCanWreck().bCanWreck == true) then carID:RequestDie{ killType = "VIOLENT" } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') --carID:NotifyZoneObject{ name = "updateCarNumber" , ObjIDSender = player, param1 = oldlap , param2 = newLap } --require('/ai/RACING/SERVER/RACE_ACTIVITY_CLIENT') --require('/ai/RACING/SERVER/RACE_TIMER_EVENTS_CLIENT') function not_onStartup(self) Con = {} Con["Current_Lap"] = 1 self:SetVar("Con",Con) UI:SendMessage("ShowUI", { {"show", true } }) UI:SendMessage("ChatBoxVisible", { {"chatvisible", "show" } }) for i = 1, 8 do self:SetVar("racePos_"..i, 0) end end function not_onChildLoaded(self, msg) if (msg.childID:GetType().objType == "Vehicle" ) then local Child = msg.childID local objects = self:GetAllActivityUsers{}.objects for i = 1, #objects do local player = objects[i] if Child:GetID() == getObjectByName(self, player:GetName().name.."CarID"):GetID() then -- print("Child added ****************** "..player:GetName().name) self:AddActivityUser{ userID = player } self:SetActivityUserData{userID = player ,controlledID = Child, typeIndex = 0, value = 0 } player:PlayCinematic { pathName = "P1" } break end end end end function not_onNotifyClientZoneObject(self,msg) if msg.name == "ShowPlayButton" then GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "showReadyButton", self ) elseif msg.name == "RewardPlayer" then UI:SendMessage("Race_Reward", {{"RewardPlayer", msg.paramStr }} ) --print("Rewards to GUI ".. msg.paramStr) elseif msg.name == "exit" then UI:SendMessage("Leaderboard", {{"leaderboardUI", "hide" }} ) elseif msg.name == "replay" then UI:SendMessage("Leaderboard", {{"leaderboardUI", "hide" }} ) elseif msg.name == "StartRace" then UI:SendMessage("RaceJoin", {{"UI", "hide" }} ) elseif msg.name == "pushStateRace" then UI:SendMessage( "pushGameState", {{"state", "Race" }} ) elseif msg.name == "pushStateGamePlay" then UI:SendMessage( "pushGameState", {{"state", "gameplay" }} ) elseif msg.name == "PlayerReady" then UI:SendMessage("RaceJoin", {{"playerready", msg.paramStr }} ) elseif msg.name == "removeplayer" then UI:SendMessage("RaceJoin", {{"removeplayer", msg.paramStr }} ) elseif msg.name == "EnableCheck" then for x = 1, #self:GetAllActivityUsers{}.objects do if msg.paramStr == "name_p"..x.."_t1" then UI:SendMessage("RaceJoin", {{"EnableCheck", msg.paramStr }} ) --print("EnableCheck") end end elseif msg.name == "JoinTeam" then for x = 1,# self:GetAllActivityUsers{}.objects do if msg.paramStr == "name_p"..x.."_t1" then UI:SendMessage("RaceJoin", {{"join_name", msg.paramStr },{ "playername", msg.paramObj:GetName().name }} ) --print("JoinTeam") end end elseif msg.name == "ClearUI" then UI:SendMessage("RaceJoin", {{"clearGUI", true }} ) UI:SendMessage("RaceJoin", {{"UI", "show" }} ) elseif msg.name == "SetPlayerName" then UI:SendMessage("RaceJoin", {{"user", msg.paramObj }} ) elseif msg.name == "StoreClientPlayer" then UI:SendMessage("RaceJoin", {{"clearGUI", true }} ) UI:SendMessage("RaceJoin", {{"UI", "show" }} ) elseif msg.name == "sendTo_Team_1" then local objects = #self:GetAllActivityUsers{}.objects for x = 1, objects do local player = objects[x] local text = msg.paramStr -- --print(text) player:DisplayTooltip { bShow = true, strText = text, iTime = 2000 } end -- Set Race HUD GUI elseif msg.name == "reSetRaceGUI" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- Leader Board UI:SendMessage("Leaderboard", {{"leaderboardUI", "hide"}} ) UI:SendMessage("Leaderboard", {{"leaderboardUI", "hidebutton"}} ) -- Reward UI:SendMessage("Race_Reward", {{"RewardUI", "hide"}} ) -- Stat UI:SendMessage("RaceStat", {{"raceStatUI", "show"}} ) -- boost UI:SendMessage("RaceBoost", {{"boostUI", "show"}} ) -- Standings UI:SendMessage("RaceStanding", {{"StandingUI", "hide" }} ) UI:SendMessage("RaceStanding", {{"LockUI", "unlock" }} ) -- Hud UI:SendMessage("RaceHud", {{"UI", "show" }} ) UI:SendMessage("RaceHud", {{"race_current_lap", "1" }} ) UI:SendMessage("RaceHud", {{"race_remaining_lap", msg.paramStr }} ) UI:SendMessage("RaceHud", {{"resetUI", true } }) -- Gage UI:SendMessage("RaceGage", {{"raceGageUI", "show"}} ) UI:SendMessage("RaceGage", {{"resetmph", true }} ) elseif msg.name == "SetDriverPos" then UI:SendMessage("RaceStat", {{"racePos_"..msg.param1, msg.paramStr }} ) self:SetVar("racePos_"..msg.param1, msg.paramStr) elseif msg.name == "StartCountDown" then UI:SendMessage("RaceCount", {{"Count",true }} ) elseif msg.name == "FreezPlayer" then local eChangeType = "PUSH" msg.paramObj:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = false, bCantAttack = true, bCantEquip = true, bCantInteract = true } elseif msg.name == "ActivityTimers" then local t = split(msg.paramStr, ',') ActivityTimers(self, msg.paramObj, t[1] , t[2] , msg.param2 ) self:SetVar(msg.paramObj:GetName().name,"running") elseif msg.name == "ActivityStart" then self:ActivityStart() self:SetVar("RaceStarted", true ) elseif msg.name == "SetPath" then self:SetCurrentPath{pathName = msg.paramStr} elseif msg.name == "WrongWayTrue" then UI:SendMessage("RaceWW", {{"UI","show" }} ) elseif msg.name == "WrongWayFalse" then UI:SendMessage("RaceWW", {{"UI","hide" }} ) elseif msg.name == "SetActivityParams" then self:SetActivityParams { activityID = msg.param1 , modifyMaxUsers = true, maxUsers = 8, modifyActivityActive = true, activityActive = true } elseif msg.name == "LapNumber" then UI:SendMessage("RaceHud", {{"race_current_lap", tostring(msg.param1) }} ) elseif msg.name == "rewardGUI" then UI:SendMessage("RaceStanding", {{"LockUI", "lock" }} ) UI:SendMessage("Race_Reward", {{"RewardUI", "show"}} ) elseif msg.name == "Driver_Finished" then local player = msg.paramObj self:SetVar(player:GetName().name.."_Stats", "Finished") elseif msg.name == "LockUI" then UI:SendMessage("RaceStanding", {{"LockUI", "lock" }} ) elseif msg.name == "unLockUI" then UI:SendMessage("RaceStanding", {{"LockUI", "unlock" }} ) elseif msg.name == ("RaceFinishHideUI") then UI:SendMessage("RaceGage", {{"raceGagetUI", "hide"}} ) UI:SendMessage("RaceBoost", {{"boostUI", "hide"}} ) UI:SendMessage("RaceStat", {{"raceStatUI", "hide"}} ) elseif msg.name == "storePlayersCarID" then storeObjectByName(self, msg.paramStr, msg.paramObj ) end local objects = #self:GetAllActivityUsers{}.objects for i = 1, objects do if msg.name == "place_"..i then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local s = msg.paramStr local t = split(s, ',') if self:GetVar(player:GetName().name.."_Stats") == "Finished" then UI:SendMessage("RaceHud", {{ "UI" ,"hide" }} ) UI:SendMessage("RaceStanding", {{ "place_"..i ,true },{"placeName",t[1] },{"bestlaptime", t[3] },{"totaltime",t[2] }} ) end end end end not_onTimerDone = function(self, msg) -- delay before show Ready button for the player Temp -- if msg.name == "showReadyButton" then UI:SendMessage("RaceJoin", {{"sgPlayShow", true }} ) end end function not_onPlayerExit( self, msg) local player = msg.playerID UI:SendMessage( "pushGameState", {{"state", "gameplay" }} ) end CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function oStart(self) --------------------------------------------------------------------------------------- -- Set Activity Params ( activityID, max Players ) --------------------------------------------------------------------------------------- self:SetActivityParams{ activityID = self:GetVar("Set.activityID") , modifyMaxUsers = true, maxUsers = self:GetVar("Set.Number_Of_PlayersPerTeam"), modifyActivityActive = true, activityActive = true}; --------------------------------------------------------------------------------------- -- Global Vars onStart --------------------------------------------------------------------------------------- Con = {} Con["GameStarted"] = false Con["Blue_Mark"] = 1 Con["Players_loaded"] = 0 for i = 1, 6 do Con["Slot_"..i.."_Team_1"] = "open" Con["Start_Pos_"..i] = "open" -- *Temp Loading GUI Start* -- Con["PlayerReady_p"..i.."_t1"] = false Con["PlayerNotReady_p"..i.."_t1"] = false Con["PlayerName_p"..i.."_t1"] = nil -- *Temp Loading GUI End* -- end self:SetVar("Con",Con) end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) -------------------------------------------------------------- -- Set GUI State to Racing *Client* -------------------------------------------------------------- self:NotifyClientZoneObject{ name = "pushStateRace" , rerouteID = msg.playerID } -------------------------------------------------------------- -- Sets Client Activity Params for the Player loading -------------------------------------------------------------- self:NotifyClientZoneObject{name = "SetActivityParams" , param1 = self:GetVar("Set.activityID") , rerouteID = msg.playerID } -------------------------------------------------------------- -- Create Global Values Related to the Player -------------------------------------------------------------- self:SetVar(msg.playerID:GetName().name,nil) self:SetVar("LastNode_"..msg.playerID:GetName().name , 0 ) self:SetVar("ValidLap_"..msg.playerID:GetName().name, false) -------------------------------------------------------------- -- Sets Flag to show the minimap -------------------------------------------------------------- msg.playerID:Help{ iHelpID = 2 } GAMEOBJ:AddObjectToAlwaysInScopeList( msg.playerID ) -------------------------------------------------------------- -- Create / Set Varables to the GUI and Client Zone Script -------------------------------------------------------------- -- Store Player on the Client Needed for GUI self:NotifyClientZoneObject{name = "StoreClientPlayer" , paramObj = msg.playerID , rerouteID = msg.playerID } -- Set The minimum number of player to start *Client* self:NotifyClientZoneObject{name = "nubOfPlayers" , paramStr = self:GetVar("Set.Minimum_Players_to_Start"), rerouteID = msg.playerID } -- FreezePlayer *Client* self:NotifyClientZoneObject{name = "FreezPlayer" , paramObj = msg.playerID , rerouteID = msg.playerID } -------------------------------------------------------------- -- Check to see if Player is Alive if not Resurrect -------------------------------------------------------------- if msg.playerID:IsDead{}.bDead then msg.playerID:Resurrect() end -------------------------------------------------------------- -- Finds an Open Slot to Teleport Player -------------------------------------------------------------- -- *Temp Loading GUI Start* -- for i = 1, 6 do if self:GetVar("Con.Slot_"..i.."_Team_1" ) == "open" then self:SetVar("Con.Slot_"..i.."_Team_1", "closed") SetTeamSlot(self,i,1,msg.playerID) break end end -- *Temp Loading GUI End* -- -------------------------------------------------------------- -- Teleport Player to His/Her Car Pos -------------------------------------------------------------- TeleportPlayer(self,msg.playerID) -------------------------------------------------------------- -- get the leaderboard data for the user -------------------------------------------------------------- GetLeaderboardData( self, msg.playerID, self:GetVar("Set.activityID") ) -- *Temp Loading GUI Start* -- -------------------------------------------------------------- -- Start 3 second timer ( show the Place holder Matching GUI ) -------------------------------------------------------------- GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , msg.playerID:GetName().name.."bePlayerReady", self ) -- *Temp Loading GUI End* -- -- Set Path name on the *Client* self:NotifyClientZoneObject{name = "SetPath", paramStr = self:GetVar("Set.Race_PathName"), rerouteID = msg.playerID } -------------------------------------------------------------- -- 1st Player to enter Sets the Path Name on the Server -------------------------------------------------------------- if self:GetVar("Set.PathName") == nil then self:SetCurrentPath{pathName = self:GetVar("Set.Race_PathName") } self:SetVar("SetPathName", true) end end -- *Temp Loading GUI Start* -- function SetTeamSlot(self,x,i,player) self:NotifyClientZoneObject{name = "JoinTeam" , paramStr = "name_p"..x.."_t"..i , paramObj = player } self:NotifyClientZoneObject{name = "EnableCheck" , paramStr = "name_p"..x.."_t"..i , paramObj = player , rerouteID = player} self:SetVar("Con.PlayerReady_p"..x.."_t"..i, true) self:SetVar("Con.PlayerName_p"..x.."_t"..i, player:GetName().name) self:SetVar("Con.Players_loaded" ,self:GetVar("Con.Players_loaded") + 1) if not self:GetVar("Con.ReadyButton") then RoutToPlayer{msg, name = "ShowPlayButton", paramObj = player, playerID = player } self:SetVar("Con.ReadyButton" , true) end self:NotifyClientZoneObject{name = "SetPlayerName" ,paramStr = player:GetName().name, param1 = i , param2 = x } end -- *Temp Loading GUI End* -- function onPlayerExit( self, msg) local player = msg.playerID GAMEOBJ:RemoveObjectFromAlwaysInScopeList( player ) GAMEOBJ:GetZoneControlID():RemoveActivityUser{ userID = player } --- Clear GUI on Player Exit self:SetVar("Con.Players_loaded", self:GetVar("Con.Players_loaded") - 1) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = "ClearUI", rerouteID = player} -- *Temp Loading GUI Start* -- for i = 1, 2 do for x = 1, 6 do if self:GetVar("Con.PlayerName_p"..x.."_t"..i) == player:GetName().name then self:NotifyClientZoneObject{name = "removeplayer" , paramStr = "p"..x.."_t"..i , paramObj = player } self:SetVar("Con.PlayerReady_p"..x.."_t"..i, nil) self:SetVar("Con.PlayerNotReady_p"..x.."_t"..i, nil) self:SetVar("Con.PlayerName_p"..x.."_t"..i, nil) self:SetVar("Con.Slot_"..x.."_Team_"..i,"open" ) break end end end -- *Temp Loading GUI End* -- end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) local player = msg.sender ---------------------------------------------------------- -- Reward Exit Button ---------------------------------------------------------- if ( msg.identifier == "buttonExit" ) then self:NotifyClientZoneObject{name = "exit" , rerouteID = player } end ---------------------------------------------------------- -- Reward Replay Button ---------------------------------------------------------- if ( msg.identifier == "buttonReplay") then self:NotifyClientZoneObject{name = "replay" , rerouteID = player } end ---------------------------------------------------------- -- Reward Button ---------------------------------------------------------- if ( msg.identifier == "rewardButton" ) then --// Show LeaderBoard GUI //-- self:RequestActivitySummaryLeaderboardData{ user = player, queryType = 7 } --// Show Reward GUI //-- self:NotifyClientZoneObject{name = "rewardGUI" , rerouteID = player } end ---------------------------------------------------------- -- Play Race Button -- *Temp* GUI ---------------------------------------------------------- if ( msg.identifier == "playRace") then -- Tell Client To Start Race self:NotifyClientZoneObject{name = "StartRace" } ------------------------------------------------------ -- Players Posses Cars -- Start Count Down -- Notify Client to Start Activity -- Notify Server to Start Activity -- Notify Players client of the Path Name -- Start Count Down ------------------------------------------------- ----- local objects = self:GetAllActivityUsers{}.objects for i = 1, #objects do local player = objects[i] local Child = getObjectByName(self, player:GetName().name.."CarID") player:PrepareForPossession{ objToPossess = Child } self:NotifyClientZoneObject{ name = "StartCountDown" } self:NotifyClientZoneObject{name = "ActivityStart" , rerouteID = player } self:ActivityStart{rerouteID = player} end -- Start Race Timer here GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "Start_Race", self ) end end -------------------------------------------------------------- -- User Exits Activity -------------------------------------------------------------- function onRequestActivityExit(self, msg) if (msg.bUserCancel) == true then -- forward this request on to the zone control object GAMEOBJ:GetZoneControlID():RequestActivityExit{bUserCancel = msg.bUserCancel, userID = msg.userID} end end function onChildLoaded(self, msg) if (msg.childID:GetType().objType == "Vehicle") then local Child = msg.childID local Driver = getObjectByName(Child, "RaceDriver") local SpawnMark = Child:GetVar("SpawnMark") local StartPos = Child:GetVar("StartPos") local CarColor = Child:GetVar("CarColor") -- Store Players Car on the Server storeObjectByName(self, Driver:GetName().name.."CarID", Child) -- Store Car object on the Client self:NotifyClientZoneObject{ name = "storePlayersCarID" , paramObj = Child , paramStr = Driver:GetName().name.."CarID" } --------------------------------------------------------------- -- Add Player to Activity --------------------------------------------------------------- AddPlayerAndCarToActivity(self,Driver,Child ) setPlayerScores(self, Driver) self:NotifyVehicleOfRacingObject{racingObjectID = Child } self:NotifyClientZoneObject{ name = "SetDriverPos" , param1 = StartPos, paramObj = Child , paramStr = Driver:GetName().name } self:RacingPlayerRankChanged{playerID = Driver, oldRank = Child:GetVar("StartPos") - 1, newRank = Child:GetVar("StartPos") } end end --------------------------------------------------------------- -- Main Server Zone Script onTimer Functions --------------------------------------------------------------- onTimerDone = function(self, msg) local objects = self:GetAllActivityUsers{}.objects for x = 1, #objects do local player = objects[x] if (player) then if msg.name == player:GetName().name.."bePlayerReady" then self:NotifyClientZoneObject{name = "reSetRaceGUI" , paramStr = tostring(self:GetVar("Set.Number_of_Laps")), rerouteID = player } bePlayerReady(self) end end end --- unlock player cars if msg.name == "Start_Race" then for i = 1, #objects do local player = objects[i] local Child = getObjectByName(self, player:GetName().name.."CarID") Child:VehicleUnlockInput{bLockWheels = true} ServerActivityTimers(self, player ,"StartTotalTime" , false) self:NotifyClientZoneObject{name = "ActivityTimers" , paramObj = player , paramStr = "StartTotalTime,false", rerouteID = player } self:SetVar(player:GetName().name,"running") end end -- update other Driver that have finished if msg.name == "Fline" then for i = 1, #objects do local player = objects[i] if self:GetVar(player:GetName().name.."_Stats") == "Finished" then local playerName = player:GetName().name local pos = self:GetVar( playerName.."_finalPos") local BTime = self:GetVar( playerName.."_BestTime") local TTime = self:GetVar( playerName.."_TotalTimer") self:NotifyClientZoneObject{ name = "place_"..pos , paramStr = ""..playerName..","..BTime..","..TTime.."" , paramObj = player } end end end end -- *Temp Loading GUI Start* -- function bePlayerReady(self) local objects = self:GetAllActivityUsers{}.objects for x = 1, #objects do local player = objects[x] if self:GetVar("Con.PlayerReady_p"..x.."_t1") then if ( self:GetVar("Con.PlayerName_p"..x.."_t1") == player:GetName().name ) then self:NotifyClientZoneObject{name = "ShowPlayButton" , paramObj = player, playerID = player, rerouteID = player } end self:NotifyClientZoneObject{name = "PlayerReady" , paramStr = "name_p"..x.."_t1"..","..self:GetVar("Con.PlayerName_p"..x.."_t1"), paramObj = player } self:NotifyClientZoneObject{name = "SetPlayerName" , paramStr = self:GetVar("Con.PlayerName_p"..x.."_t1") , param1 = i , param2 = x } end updateAllStartPos(self) end end -- *Temp Loading GUI End* -- -------------------------------------------------------------- -- Updates all Starting Driver Pos/Flags -------------------------------------------------------------- function updateAllStartPos(self) local objects = self:GetAllActivityUsers{}.objects for x = 1, #objects do local player = objects[x] local carID = getObjectByName(self, player:GetName().name.."CarID") -- update top left hud with Pos local StartPos = carID:GetVar("StartPos") self:NotifyClientZoneObject{ name = "SetDriverPos" , param1 = StartPos, paramObj = player , paramStr = player:GetName().name } carID:NotifyObject{ name = "updateCarNumber" , param1 = StartPos } end end -------------------------------------------------------------- -- Zone on Notify Objects -------------------------------------------------------------- function onNotifyObject(self, msg) if msg.name == "UpdateScore" then UpdateScore(self) -- Store Start pos IDs elseif ( msg.name == "Blue_Mark" ) then storeObjectByName(self, "Blue_Mark_"..msg.ObjIDSender:GetVar("placement"), msg.ObjIDSender) end endlocal localskillID = 13 local ImaginationPickup = 20 function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end local target = msg.objectID local faction = target:GetFaction() local isfaction = msg.senderID:GetFaction().faction if isfaction == 0 then if ( (target:VehicleImaginationGetCurrent{}.iImagination) < 1000 ) then self:PlayFXEffect{effectType = "pickup"} self:CastSkill{skillID = localskillID, optionalTargetID = target} target:VehicleImaginationSetCurrent{bIgnoreMax = false, iImagination = target:VehicleImaginationGetCurrent{}.iImagination + ImaginationPickup } self:Die{ killerID = msg.playerID, killType = "SILENT" } self:SetVar("bIsDead", true) end end endrequire('o_mis') require('/ai/RACING/SERVER/RACE_EVENTS') require('/ai/RACING/SERVER/RACE_NOTIFYOBJECT') require('/ai/RACING/SERVER/RACE_STATES') require('/ai/RACING/SERVER/RACE_TIMER_EVENTS') require('/ai/RACING/SERVER/RACE_ACTIVITY') require('/ai/RACING/SERVER/RACE_ACTIVITY_SERVER') function onStartup(self) Set = {} -- Basic Game Settings -- Set['GameType'] = "Racing" Set['GameState'] = "Starting" -- Do Not Change -- Set['Number_Of_PlayersPerTeam'] = 8 -- INT ( Set the number of players on each team ) Set['Minimum_Players_to_Start'] = 2 -- INT ( The min number of players to start game ) --- Game Object Lots --- Set['Car_Object'] = 6990 Set['Race_PathName'] = "MainPath" Set['Current_Lap'] = 1 Set['Number_of_Laps'] = 1 -- Number of Laps to complete the Race Set['activityID'] = 39 Set['Place_1'] = 100 Set['Place_2'] = 90 Set['Place_3'] = 80 Set['Place_4'] = 70 Set['Place_5'] = 60 Set['Place_6'] = 50 Set['Place_7'] = 40 Set['Place_8'] = 20 -- Reward % Rating -- Set['Num_of_Players_1'] = 15 Set['Num_of_Players_2'] = 25 Set['Num_of_Players_3'] = 50 Set['Num_of_Players_4'] = 75 Set['Num_of_Players_5'] = 80 Set['Num_of_Players_6'] = 90 Set['Num_of_Players_7'] = 95 Set['Num_of_Players_8'] = 100 Set['Number_of_Spawn_Groups'] = 1 --INT Set['Red_Spawners'] = 4847 Set['Blue_Spawners'] = 4848 Set['Blue_Flag'] = 4850 Set['Red_Flag'] = 4851 Set['Red_Point'] = 4846 Set['Blue_Point'] = 4845 Set['Red_Mark'] = 4844 Set['Blue_Mark'] = 4843 Set['CarColor_1'] = 21 -- Bright Red Set['CarColor_2'] = 23 -- Bright Blue Set['CarColor_3'] = 24 -- Bright Yellow Set['CarColor_4'] = 28 -- Dark Green Set['CarColor_5'] = 268 -- Medium lilac Set['CarColor_6'] = 106 -- Bright Orange Set['CarColor_7'] = 308 -- Dark Brown Set['CarColor_8'] = 26 -- Black -- Do not change ---------------------------------------------------------- self:SetVar("Set",Set) self:SetNetworkVar("Set",Set) oStart(self) end function onNotifyObject(self, msg) if( msg) then mainNotifyObject(self, msg) end end function onObjectLoaded(self, msg) if (msg) then mainObjectLoaded(self, msg) end end function onChildLoaded(self, msg) if (msg) then mainChildLoaded(self, msg) end end -------------------------------------------------------------------------------- -------------------------------------------------------------- -- reroute client message to a player ------------- -------------------------------------------------------------- function RoutToPlayer(msg, name , param1 , param2 , paramStr , paramObj , playerID ) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = msg.name , paramStr = msg.paramStr ,param1 = msg.param1 ,param2 = msg.param2, paramObj = msg.paramObj , rerouteID = msg.playerID } end -------------------------------------------------------------- -- reroute client message to a Team ------------- -------------------------------------------------------------- function RoutToTeam(msg, name , param1 , param2 , paramStr , paramObj , team ) for x = 1, #GAMEOBJ:GetZoneControlID():GetAllActivityUsers{}.objects do local player = GAMEOBJ:GetZoneControlID():GetAllActivityUsers{}.objects[x] GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{name = msg.name , paramStr = msg.paramStr ,param1 = msg.param1 ,param2 = msg.param2, paramObj = player , rerouteID = player } end end -------------------------------------------------------------- -- Gets the current activity user or returns nil ------------- -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- remove player from game -------------------------------------------------------------- function RemovePlayerFromGame(self, player) if (player) then local playerNum = GetPlayerNum(self, player) -- reset data PLAYERS[playerNum] = -1 local NoData = {} self:SetVar(player:GetID(), NoData) -- remove all boards RemoveBoardsFromPlayer(self, player) player:Teleport{pos = CONSTANTS["PLAYER_ZONEIN_POS"], bSetRotation = false} end end -------------------------------------------------------------- -- parses time to a string -------------------------------------------------------------- function ParseTime(numTime) local newTime = tonumber(numTime) local min = math.floor(newTime / 1000 / 60) newTime = newTime - (min * 1000 * 60) local sec = math.floor(newTime / 1000) newTime = newTime - (sec * 1000) local msec = math.floor(newTime) local strTime = "" if (min > 0) then strTime = ZeroPad(min,2) .. ":" .. ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) else strTime = ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) end return strTime end -------------------------------------------------------------- -- Teleport Player to there start Pos -------------------------------------------------------------- function TeleportPlayer(self,player) print("Player "..player:GetName().name) for i = 1, 6 do if self:GetVar("Con.Start_Pos_"..i) == "open" then self:SetVar("Con.Start_Pos_"..i , "closed") local spawn = getObjectByName(self, "Blue_Mark_"..i) -- Set Player Pos on the Line Up. -- SetActivityValue(self, player, 4, i ) -- Set Starting Pos local Markpos = spawn:GetPosition().pos local Markrot = spawn:GetRotation() local post = {x=Markpos.x ,y=Markpos.y ,z=Markpos.z } player:Teleport{pos = post, bIgnoreY = false} CreateVehicle(self, player, i, Markpos, Markrot) break end end end function CreateVehicle(self, player,pos, Markpos, Markrot) if 0==1 then -------------------------------------------------- -- Move this into the race instance script local storeddata = player:GetStoredConfigData{optionalKey="matching.droppedItem"}.configData["matching.droppedItem"] if storeddata ~= nil then print ("Activate player vehicle:"..storeddata) else print "No dropped item found!" end else local idString = player:GetID() local finalID = "|" .. idString local config = { {"RaceDriver", finalID }, {"SpawnMark", "Blue_Mark_"..pos } , {"StartPos", pos } } RESMGR:LoadObject { objectTemplate = self:GetVar("Set.Car_Object") , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self , configData = config}; end end ---------------------------------------------------------------- -- GetLeaderboard Data message ---------------------------------------------------------------- function GetLeaderboardData( self, player, activityID ) -- get the leaderboard data for the user and update summary screen if it exists self:RequestActivitySummaryLeaderboardData{ user = player, target = self, queryType = 7, gameID = activityID } end ---------------------------------------------------------------- -- Reset Activity Vars ---------------------------------------------------------------- function setPlayerScores(self, player) SetActivityValue(self, player, 0, 0 ) SetActivityValue(self, player, 1, 0 ) SetActivityValue(self, player, 2, 0 ) SetActivityValue(self, player, 3, 1 ) -- Lab Number SetActivityValue(self, player, 4, 0 ) end ----------------------------------------------------------- --smashables for racing ----------------------------------------------------------- --local localskillID = 13 local ImaginationPickup = 10 function onCollisionPhantom(self, msg) --print("I'm dead!") local target = msg.objectID local faction = target:GetFaction() local isfaction = msg.senderID:GetFaction().faction local im = target:VehicleImaginationGetCurrent{}.iImagination if isfaction == 113 then local speed = target:GetCurrentSpeed{}.fSpeed --print("the speed was :" .. speed) self:Die{ killerID = target, directionRelative_Force = speed * 1.3 } if ( (target:VehicleImaginationGetCurrent{}.iImagination) < (target:VehicleImaginationGetMax{}.iMaxImagination) ) then target:PlayFXEffect{name = "bouncer", effectID = 194, effectType = "onbounce"} target:PlayFXEffect{name = "energy_orb", effectID = 1007, effectType = "cast"} --target:PlayFXEffect{name = "energy_orb", effectID = 1028, effectType = "on-anim"} --self:CastSkill{skillID = localskillID, optionalTargetID = target} target:VehicleImaginationSetCurrent{bIgnoreMax = false, iImagination = im + ImaginationPickup } end end endfunction ServerActivityTimers(self, player, name , endRace , place ) local playerName = player:GetName().name if name == "StartTotalTime" then -- Start Timers self:ActivityTimerSet{name = playerName.."_TotalTime",updateInterval = 0.1 } self:ActivityTimerSet{name = playerName.."_LapTime" ,updateInterval = 0.1 } --------------------------------------------------------------------------------------- -- Start a new Lap with timers -- Get time Vars -- Saves Lap time in a Table with best Lap -- Start a new lap time -- Update Clients GUI with times --------------------------------------------------------------------------------------- elseif name == "StartNewLapTime" then local Ltime = string.format("%g",self:ActivityTimerGet{name = playerName.."_LapTime"}.timeElapsed) local Laptime = self:ActivityTimerGet{name = playerName.."_LapTime"}.timeElapsed local MiliSec = string.sub(string.gsub(string.format("%f",Laptime), ".", "|",1),3, 3) local LapNumber = self:GetActivityUserData{ userID = player, typeIndex = 3}.outValue if not (MiliSec) then MiliSec = tostring(5) end -- Store Lap Time self:SetVar("LapTime_"..self:GetVar("Set.Current_Lap"), Laptime ) -- Store Table Lap Time for Best Time -- if self:GetVar(playerName.."_LastTime") == nil then --print("Lap Time Set too ".. Laptime ) self:SetVar(playerName.."_LastTime", Laptime) self:SetVar(playerName.."_LastMili", MiliSec) self:SetVar(playerName.."_float_BestLap", Laptime ) end if self:GetVar(playerName.."_LastTime") > Laptime then self:SetVar(playerName.."_LastTime", Laptime) self:SetVar(playerName.."_LastMili", MiliSec) --print("New Best Time ".. Laptime ) end -- Show Lap Time to Driver self:NotifyClientZoneObject{ name = "ShowLapTime", param1 = Laptime , paramObj = player, param2 = tonumber(MiliSec) , rerouteID = player} -- Stop Timer self:ActivityTimerStop{name = playerName.."_LapTime"} -- Update Lap Number self:NotifyClientZoneObject{ name = "LapNumber", param1 = LapNumber, rerouteID = player} if (endRace == false) then -- ReStart Timer self:ActivityTimerSet{name = playerName.."_LapTime" ,updateInterval = 0.1} end --------------------------------------------------------------------------------------- -- Completed Race --------------------------------------------------------------------------------------- if (endRace == true) then self:SetVar(playerName.."_TotalTime", self:ActivityTimerGet{name = playerName.."_TotalTime"}.timeElapsed ) self:SetVar(playerName.."_float_TotalTime", self:ActivityTimerGet{name = playerName.."_TotalTime"}.timeElapsed ) local finalPos = self:GetActivityUserData{ userID = player, typeIndex = 0}.outValue local BestTime = SecondsToClock(self:GetVar(player:GetName().name.."_LastTime"))..":0"..self:GetVar(player:GetName().name.."_LastMili") local TotalTimer = ""..SecondsToClock(self:GetVar(player:GetName().name.."_TotalTime"))..":0"..self:GetVar(player:GetName().name.."_LastMili").."" -- if one player mark a 1st place -- if (#self:GetAllActivityUsers{}.objects == 1) then SetActivityValue(self, player, 0, 1 ) finalPos = 1 end self:ActivityTimerStop{name = playerName.."_TotalTime"} -- Set Player Pos playerFinished(self , player , ""..playerName..","..BestTime..","..TotalTimer..","..finalPos.."") -- notify the racing control component - this player has finished the race self:RacingPlayerEvent{ eventType="FINISHED_RACE", playerID=player } end elseif name == "EndRace" then end end --------------------------------------------------------------------------------------- -- Driver Finished Save Stats to Server and Client --------------------------------------------------------------------------------------- function playerFinished(self, player , dTimes ) local playerName = player:GetName().name local final = split(dTimes,",") -- Save Player Race Stats self:SetVar( playerName.."_Stats", "Finished" ) self:SetVar( playerName.."_Name", final[1]) self:SetVar( playerName.."_BestTime", final[2] ) self:SetVar( playerName.."_TotalTimer", final[3] ) self:SetVar( playerName.."_finalPos", final[4] ) -- Notify Client Player Finished -- self:NotifyClientZoneObject{ name = "Driver_Finished" , paramObj = player } -- Hide Boost -- Hide Gage -- Hide Stats -- *GUI* self:NotifyClientZoneObject{ name = "RaceFinishHideUI" , rerouteID = player} self:NotifyClientZoneObject{ name = "place_"..final[4] , paramStr = dTimes , paramObj = player } -- Set Timer to Update other Drivers GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "Fline", self ) rewardPlayer(self, player, pos ) end --------------------------------------------------------------------------------------- -- Reward Player --------------------------------------------------------------------------------------- function rewardPlayer(self, player ) local playerName = player:GetName().name local bestLap = self:GetVar(playerName.."_float_BestLap") local TotalTime = self:GetVar(playerName.."_float_TotalTime") local CarID = getObjectByName(self, player:GetName().name.."CarID") local pos = self:GetActivityUserData{ userID = player, typeIndex = 3}.outValue - 1 UpdateActivityValue(self,player, 1, TotalTime , CarID) UpdateActivityValue(self,player, 2, pos , CarID) --UpdateActivityValue(self,player, 3, pos , CarID) StopActivity(self,player, TotalTime,0,0, false ,CarID) end function ActivityTimers(self, player, name , endRace , place ) local playerName = player:GetName().name if name == "StartTotalTime" then -- Start Timers self:ActivityTimerSet{name = playerName.."_TotalTime",updateInterval = 0.1 } self:ActivityTimerSet{name = playerName.."_LapTime" ,updateInterval = 0.1 } GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "test" , self ) elseif name == "StartNewLapTime" then local Ltime = string.format("%g",self:ActivityTimerGet{name = playerName.."_LapTime"}.timeElapsed) local Laptime = self:ActivityTimerGet{name = playerName.."_LapTime"}.timeElapsed local MiliSec = string.sub(string.gsub(string.format("%f",Laptime), ".", "|",1),3, 3) local LapNumber = self:GetActivityUserData{ userID = player, typeIndex = 3}.outValue if not (MiliSec) then MiliSec = tostring(5) end -- Store Lap Time self:SetVar("LapTime_"..self:GetVar("Con.Current_Lap"), Laptime ) -- Store Table Lap Time for Best Time -- if self:GetVar(playerName.."_LastTime") == nil then --print("Lap Time Set too ".. Laptime ) self:SetVar(playerName.."_LastTime", Laptime) self:SetVar(playerName.."_LastMili", MiliSec) self:SetVar(playerName.."_float_BestLap", Laptime ) end if self:GetVar(playerName.."_LastTime") > Laptime then self:SetVar(playerName.."_LastTime", Laptime) self:SetVar(playerName.."_LastMili", MiliSec) --print("New Best Time ".. Laptime ) end ----------------------------------------------------------- -- Show Lap Time to Driver ----------------------------------------------------------- local RTime = SecondsToClock(Laptime) local Mili = tostring(tonumber(MiliSec)) UI:SendMessage("RaceHud", {{"showtext", true } ,{"stColor", "0xFFFFFF" } ,{"stSize", "36" } ,{"sttext", RTime..":0"..Mili },{"sttime", "10" } } ) ----------------------------------------------------------- -- Stop Timer ----------------------------------------------------------- self:ActivityTimerStop{name = playerName.."_LapTime"} ----------------------------------------------------------- -- Update Lap Number ----------------------------------------------------------- UI:SendMessage("RaceHud", {{"race_current_lap", tostring(LapNumber) }} ) self:SetVar("Con.Current_Lap", LapNumber ) if (endRace == "false") then ----------------------------------------------------------- -- ReStart Timer ----------------------------------------------------------- self:ActivityTimerSet{name = playerName.."_LapTime" ,updateInterval = 0.1 } else self:ActivityTimerStop{name = playerName.."_TotalTime"} self:ActivityTimerStop{name = playerName.."_LapTime"} end end end function onActivityTimerUpdate(self, msg) local objects = self:GetAllActivityUsers{}.objects for i = 1, #objects do local player = objects[i] if (player) then local time = msg.timeElapsed local playerName = player:GetName().name if msg.name == playerName.."_TotalTime" then UI:SendMessage("RaceHud", {{"totallaptime", SecondsToClock(time) }} ) end if msg.name == playerName.."_LapTime" then UI:SendMessage("RaceHud", {{"laptime", SecondsToClock(time) }} ) end end end end local Laps = 0 function onStartup (self) print ("Racing Manager started up") self:ActivityTimerSet {name = "LapTimer"} end function onNotifyObject (self,msg) if msg.name == "TriggerEntered" then if Laps <= 3 then Laps = Laps + 1 print ("Lap: " .. Laps) print ("Received event from trigger") local LapTimeElapsed = self:ActivityTimerGet {name = "LapTimer"}.timeElapsed print ("Lap time elapsed: " .. tostring(LapTimeElapsed)) self:ActivityTimerStop {name = "LapTimer"} if Laps < 3 then self:ActivityTimerSet {name = "LapTimer"} end end end end function onActivityTimerUpdate (self,msg) print ("ActivityTimerUpdate received. " .. msg.timeElapsed) end --/////////////////////////////////////////////////////////////////////////////////////// --// Secret Level --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- local BOW_LOT_NUM = 5628 local GUN_LOT_NUM = 5841 local MAX_HEALTH = 12 local NEW_HEALTH = 12 -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print("ON PLAYER LOADED") local player = msg.playerID -- Turn on PVP player:SetPVPStatus{ bOn = true } -- Add whatever items additem(self, player, GUN_LOT_NUM) additem(self, player, BOW_LOT_NUM) -- Set their new health player:SetAttr{ string = "maxlife", value = MAX_HEALTH, ID = msg.playerID} player:SetAttr{ string = "life", value = NEW_HEALTH, ID = msg.playerID} end -------------------------------------------------------------- -- Add an item to the inventory if they don't already have it -------------------------------------------------------------- function additem(self, player, lotnum) foundItem = false for i = 1, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate == lotnum then foundItem = true end end end if not foundItem then local itemMsg = player:AddNewItemToInventory{ iObjTemplate = lotnum } -- player:EquipInventory{ itemtoequip = itemMsg.newObjID } end end require('o_mis') require('ai/SND/L_AUDIO_SERVER') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional AddInteraction(self, "interactionEffect", "plysnd") end require('o_mis') -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetMouseOverDistance(self, dist) if (self and self:Exists()) then self:SetVar("interactDistance", dist) end end -------------------------------------------------------------- -- sets the proximity for the object -------------------------------------------------------------- function SetProximityDistance(self, dist) if (self and self:Exists()) then self:SetVar("proxDistance", dist) self:SetProximityRadius{radius = self:GetVar("proxDistance")} end end -------------------------------------------------------------- -- check for valid type -------------------------------------------------------------- function IsValidType(type) if (type == "mouseOverEffect" or type == "mouseOverAnim" or type == "mouseOverText" or type == "interactionPlayerAnim" or type == "interactionEffect" or type == "interactionAnim" or type == "interactionText" or type == "proximityEffect" or type == "proximityAnim" or type == "proximityText") then return true; end return false end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction(self, type, action) if (self and self:Exists()) then -- check type if (IsValidType(type) == false) then print("Bad Type of Interaction") return end local table = self:GetVar(type) -- init table if need to if (table == nil) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- override pick type to be interactive -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --interactive type return msg end -------------------------------------------------------------- -- handle cursor over object -------------------------------------------------------------- function onCursorOn(self, msg) -- do effects local effects = self:GetVar("mouseOverEffect") if effects and #effects > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("mouseOverAnim") if anims and #anims > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("mouseOverText") if texts and #texts > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle hit use -------------------------------------------------------------- function onOnHit(self, msg) -- do effects local effects = self:GetVar("interactionEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("interactionAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("interactionText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end require('o_mis') require('ai/SND/L_AUDIO_SERVER') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional AddInteraction(self, "onOnHit", "plysnd") end require('o_mis') require('ai/SND/L_AUDIO_SERVER') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional AddInteraction(self, "interactionEffect", "plysnd") end require('o_mis') require('ai/SND/L_AUDIO_SERVER') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional AddInteraction(self, "interactionEffect", "plysnd") end function onStartup (self) print "whatever" end function onCollision (self, msg) print "i collided" local song = self: GetVar ("music") if song then SOUND: PlaySequence (song) print song end end require('o_mis') require('ai/SND/L_AUDIO_SERVER') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional AddInteraction(self, "interactionEffect", "plysnd") print "poop" end require('o_mis') require('ai/SND/L_AUDIO_SERVER') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional AddInteraction(self, "interactionEffect", "plysnd") end function onGetOverridePickType(self, msg) -- Get the Pick Type (cursor clicking options) for the script object, in preparation of changing it. msg.ePickType = 14 -- Set the Pick Type to 14 return msg -- Send Pick Type 14 back to the script object end require('o_mis') --------------------------------------------------------- -- ON START UP --------------------------------------------------------- function onStartup(self) Set = {} Set['CoinCost'] = 99 Set['UseObject'] = true Set['ObjectID'] = 3040 self:SetVar("Set",Set) self:SetActivityParams{ modifyMaxUsers = true, maxUsers = 20 , modifyActivityActive = true, activityActive = true} end function onCheckUseRequirements(self,msg) local player = msg.objIDUser local playerID = tostring(player:GetID()) local orgcurrency = player:GetCurrency().currency -- currency is a 64bit int must be compared as a string local hasMoney = orgcurrency < tostring(self:GetVar("Set.CoinCost")) and not self:GetVar("Set.UseObject") local hasCrayon = checkForObject(self, player) local failsRequirement = hasMoney or hasCrayon if failsRequirement then msg.bCanUse=false end return msg end function onUse(self,msg) local player = msg.user if not self:GetVar("Set.UseObject") then local orgcurrency = player:GetCurrency().currency local newcurrency = orgcurrency - self:GetVar("Set.CoinCost") if newcurrency >= 0 then if not self:ActivityUserExists{userID = player}.bExists then self:AddActivityUser{ userID = player } end player:AdjustCurrency {currency = newcurrency} randomReward(self, player) player:TerminateInteraction{ObjIDTerminator=player, type=user} end else local count = player:GetInvItemCount{iObjTemplate = self:GetVar("Set.ObjectID")}.itemCount if count >= 1 then if not self:ActivityUserExists{userID = player}.bExists then self:AddActivityUser{ userID = player } end player:RemoveItemFromInventory{ iObjTemplate = self:GetVar("Set.ObjectID") } randomReward(self, player) player:TerminateInteraction{ObjIDTerminator=player, type=user} end end end --------------------------------------------------------- -- Random Reward --------------------------------------------------------- function randomReward(self, player) if (player) then self:DistributeActivityRewards{userID = player, bAutoAddCurrency = false, bAutoAddItems = false} self:RemoveActivityUser{userID = player} end end -------------------------------------------------------------- -- Calculate an activity rating for this object -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- calculate total time spent for user as the rating local random = math.random(1,999) -- print ("Random roll: "..random) msg.outActivityRating = random return msg end function checkForObject(self, player) local count = player:GetInvItemCount{iObjTemplate = object}.itemCount if count < 1 then return false end return true end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Boombox Script --// - Causes boombox to delete itself after the timer expires --/////////////////////////////////////////////////////////////////////////////////////// -- amount of time in seconds til boombox deletes itself local selfDestructTime = 10.0 function onStartup(self) -- start a timer GAMEOBJ:GetTimer():AddTimerWithCancel( selfDestructTime, "boomboxTimer",self ) end onTimerDone = function(self, msg) -- Kill yourself self:Die{ killType = "SILENT" } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 1 -- Aggro Radius Set['conductRadius'] = 1 -- Conduct Radius Set['tetherRadius'] = 100 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_onEvent') require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// OUTHOUSE -- Script --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:SetVar("OutHouseParent",true) self:SetVar("Spawn_ID",1875) self:SetVar("OutHouse", 12) self:SetVar("RudPeer", 12) storeHomePoint(self) self:SetImmunity{ immunity = true } self:UseStateMachine{} -- ////////////////////////////////////////////////////////////////////////////////// -- Idle State -- ////////////////////////////////////////////////////////////////////////////////// ParentIdle = State.create() ParentIdle.onEnter = function(self) Emote.emote(self,self, "idle") end ParentIdle.onArrived = function(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Load Childern State -- ////////////////////////////////////////////////////////////////////////////////// LoadChildren = State.create() LoadChildren.onEnter = function(self) RESMGR:LoadObject { objectTemplate = 1875 , x= self:GetPosition().pos.x + 4 , y=self:GetPosition().pos.y , z=self:GetPosition().pos.z + 9 , owner = self } RESMGR:LoadObject { objectTemplate = 1810 , x= self:GetPosition().pos.x - 2 , y=self:GetPosition().pos.y , z=self:GetPosition().pos.z - 9 , owner = self } end LoadChildren.onArrived = function(self) end -------------------------------------------------------------------------------------- addState(ParentIdle, "ParentIdle", "ParentIdle", self) addState(LoadChildren,"LoadChildren","LoadChildren",self) beginStateMachine("LoadChildren", self) LoadChildren.onEnter(self) end require('State') require('o_onEvent') require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// OUTHOUSE -- Script --/////////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:SetName { name = "RudePeer" } self:SetVar("Enter_WP",1) self:SetImmunity{ immunity = true } self:UseStateMachine{} -- ////////////////////////////////////////////////////////////////////////////////// -- Idle State -- ////////////////////////////////////////////////////////////////////////////////// RudeIdle = State.create() RudeIdle.onEnter = function(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Enter Out House -- ////////////////////////////////////////////////////////////////////////////////// OutHouse = State.create() OutHouse.onEnter = function(self) storeHomePoint(self) WayPoint = {} ParPos = getParentHomePoint(self) WayPoint[1] = { x = ParPos.x - 3.1 ,y = ParPos.y ,z = ParPos.z + 5} WayPoint[2] = { x = ParPos.x + 10 ,y = ParPos.y ,z = ParPos.z + 8 } WayPoint[3] = { x = ParPos.x + 10, y = ParPos.y ,z = ParPos.z + 10 } if self:GetVar("Enter_WP") == 1 then self:GoTo { speed = 1, target = { x = WayPoint[1].x, z = WayPoint[1].z, y = WayPoint[1].y, } } end end OutHouse.onArrived = function(self) if self:GetVar("Enter_WP") == 1 then self:RotateByDegrees{ speed = 100, degrees = -25 } Emote.emote(self,self, "outhouse-start") OutHouse2 = getOutHouse(self) Emote.emote(OutHouse2 ,OutHouse2 , "start") GAMEOBJ:GetTimer():AddTimerWithCancel( 6, "OutHouseEnter",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "CallSmoke",self ) setState("RudeIdle",self) end end -- ////////////////////////////////////////////////////////////////////////////////// -- Exit Out House -- ////////////////////////////////////////////////////////////////////////////////// exitOutHouse = State.create() exitOutHouse.onEnter = function(self) local target = getMyTarget(self) self:FollowTarget { targetID = target,radius = 1, speed = 1 } self:GoTo { speed = 1, target = { x = getHomePoint(self).x, z = getHomePoint(self).z, y = getHomePoint(self).y, } } end exitOutHouse.onArrived = function(self) self:RotateByDegrees{ speed = 100, degrees = 180 } self:SetVar("Enter_WP",1) setState("RudeIdle",self) end -------------------------------------------------------------------------------------- addState(OutHouse,"OutHouse","OutHouse",self) addState(exitOutHouse,"exitOutHouse","exitOutHouse",self) addState(RudeIdle, "RudeIdle", "RudeIdle", self) beginStateMachine("RudeIdle", self) RudeIdle.onEnter(self) end function test(self) setState("enterOutHouse",self) end --L_SPECIAL_BRONZE-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 10 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 10 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_SILVER-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 100000 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 100000 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_SILVER-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 1000 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 1000 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_BRONZE-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 1 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 1 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_SILVER-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 10000 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 10000 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_SILVER-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 100 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 100 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_BRONZE-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 25 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 25 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_SILVER-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 250000 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 250000 target:SetCurrency {currency = newcurrency} end return msg end--L_SPECIAL_SILVER-COIN-SPAWNER.lua local newcurrency = 0 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 2500 target:SetCurrency {currency = newcurrency} self:Die{ killerID = msg.playerID, killType = "SILENT" } end return msg end function onHasBeenCollected(self, msg) local target = msg.playerID local faction = target:GetFaction() if faction and faction.faction == 1 then local newcurrency = target:GetCurrency().currency newcurrency = newcurrency + 2500 target:SetCurrency {currency = newcurrency} end return msg endlocal localskillID = 80 function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then cast the skill on him if faction and (faction.faction == 1 or faction.faction == 101) then if ( (target:GetArmor().armor) < (target:GetMaxArmor().armor) ) then self:PlayFXEffect{effectType = "pickup"} self:CastSkill{skillID = localskillID, optionalTargetID = target} self:Die{ killerID = msg.playerID, killType = "SILENT" } self:SetVar("bIsDead", true) end end endlocal skillid = 43 local ProxRadius = 4 local FIRE_COOLDOWN = 2 function onStartup(self) self:SetVar("counter", 0) self:SetProximityRadius{radius = ProxRadius} isBurning = true self:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} end function onProximityUpdate(self, msg) if msg.status == "ENTER" then local target = msg.objId local faction = target:GetFaction() if faction.faction == 1 then local counter = self:GetVar("counter") counter = counter + 1 self:SetVar("counter", counter) if counter == 1 then self:CastSkill{skillID = skillid } msg.objId:UpdateMissionTask{taskType = "complete", value = 440, value2 = 1, target = self} GAMEOBJ:GetTimer():AddTimerWithCancel(FIRE_COOLDOWN, "TimeBetweenCast", self ) print "Set the timer" end -- end if counter == 1 end -- end if faction = 1 else local counter = self:GetVar("counter") if counter > 0 then counter = counter - 1 self:SetVar("counter", counter) if counter == 0 then -- cancelling the timer GAMEOBJ:GetTimer():CancelAllTimers( self ) end end end -- end if msg.status == "ENTER" end function onSquirtWithWatergun( self, msg ) if isBurning then self:StopFXEffect{ name = "Burn" } --obj:PlayFXEffect{ name = "Off", effectID = 295, effectType = "end"} -- could be a transitional effect self:PlayFXEffect{ name = "Off", effectID = 295, effectType = "idle"} GAMEOBJ:GetTimer():AddTimerWithCancel( 28, "FireRestart", self ) isBurning = false player = msg.shooterID end end -- turns fire on/off based on burn variable, needs: obj = LWOOBJID, burn = bool function onTimerDone(self, msg) if (msg.name == "TimeBetweenCast") then GAMEOBJ:GetTimer():AddTimerWithCancel(FIRE_COOLDOWN, "TimeBetweenCast", self ) self:CastSkill{skillID = skillid} end if msg.name == "FireRestart" then if not isBurning then isBurning = true self:StopFXEffect{ name = "Off" } self:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} end end end local localskillID = 129 function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then cast the skill on him if faction and (faction.faction == 1 or faction.faction == 101) then self:PlayFXEffect{effectType = "pickup"} self:CastSkill{skillID = localskillID, optionalTargetID = target} self:Die{ killerID = msg.playerID, killType = "SILENT" } self:SetVar("bIsDead", true) end endlocal localskillID = 13 function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then cast the skill on him if faction and (faction.faction == 1 or faction.faction == 101) then self:PlayFXEffect{effectType = "pickup"} self:CastSkill{skillID = localskillID, optionalTargetID = target} self:Die{ killerID = msg.playerID, killType = "SILENT" } self:SetVar("bIsDead", true) end endlocal ProxRadius = 6 CONSTANTS = {} CONSTANTS["ZERO"] = {x = 0, y = 0, z = 0} function onStartup(self) self:SetVar("ExitPoint", CONSTANTS["ZERO"]) self:SetVar("ExitPointExist", 0) self:SetProximityRadius{radius = ProxRadius} end function onProximityUpdate(self, msg) print("asdfasdfasgadfhsdghsfgjsdfgsdhaglkjasdfhg") local b = self:GetVar("ExitPointExist") if msg.status == "ENTER" and b == 1 then local target = msg.objId local faction = target:GetFaction() local vec = self:GetVar("ExitPoint") print("Portal " .. vec.x .. " " .. vec.y .. " " .. vec.z) target:Teleport{pos = vec} end -- end if msg.status == "ENTER" end function onSetPortalExit(self, msg) local target = msg.objectID self:SetVar("ExitPoint", msg.ExitPortal) self:SetVar("ExitPointExist", 1) end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} end msg.ignoreCollision = true return msg endlocal localskillID = 5 function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then cast the skill on him if faction and (faction.faction == 1 or faction.faction == 101) then if ( (target:GetHealth().health) < (target:GetMaxHealth().health) ) then self:PlayFXEffect{effectType = "pickup"} self:CastSkill{skillID = localskillID, optionalTargetID = target} self:Die{ killerID = msg.playerID, killType = "SILENT" } self:SetVar("bIsDead", true) end end endrequire('o_mis') function onStartup(self, msg) self:SetVar("isTable_spawn", false ) self:SetVar("RareSpawned", false) end function onFireEvent(self, msg) if msg.args == "spawn" then if self:GetVar("rarespawn") ~= nil then local s = self:GetVar("rarespawn") local t = split(s, '-') local percent = t[2] local ran = math.random(1,100) if tonumber(percent) <= ran and tonumber(percent) >= ran then self:SetVar("RareSpawned", true) local mypos = self:GetPosition().pos local myRot = self:GetRotation() RESMGR:LoadObject { objectTemplate = t[1], x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end end end if not self:GetVar("RareSpawned") then if string.find (self:GetVar("spawn"), "-") then self:SetVar("isTable_spawn", true ) local s = self:GetVar("spawn") local t = split(s, '-') local ran = math.random(1,#t) local mypos = self:GetPosition().pos local myRot = self:GetRotation() RESMGR:LoadObject { objectTemplate = t[ran], x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end end end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() local position = {} position.x = 440 position.y = 100 position.z = -35 if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} target:Teleport{pos=position} end msg.ignoreCollision = true return msg end function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() local position = {} position.x = 337 position.y = 100 position.z = -35 if faction and faction.faction == 1 then self:PlayFXEffect{effectType = "pickup"} target:Teleport{pos=position} end msg.ignoreCollision = true return msg end local localskillID = 500 function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and (faction.faction == 1 or faction.faction == 101 or faction.faction == 100 or faction.faction == 2) then self:PlayFXEffect{effectType = "pickup"} target:CastSkill{skillID = localskillID, optionalTargetID = target} self:Die{ killerID = msg.playerID, killType = "SILENT" } end -- ONly do this once return msg end function onStartup(self) local aggroRadius = 2 self:SetProximityRadius { radius = aggroRadius } end function onProximityUpdate(self, msg) if msg.status == "ENTER" then if msg.objId:GetFaction().faction == 8 then self:CastSkill{skillID = self:GetSkills().skills[1] } end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Passive Target Dummy" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 40 -- Tether Radius Set['tetherSpeed'] = 3 -- Tether Speed Set['wanderRadius'] = 3 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 4 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight'] = 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "interact" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "interact" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('o_mis') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "killself", self ) self:ShowEmbeddedEffect{type = "trail"} local obj = self:GetObjectsInGroup{ group = "grp_mission" }.objects for i = 1, #obj do if obj[i]:GetLOT().objtemplate == 4870 then storeObjectByName(self, "minigame", obj[i]) self:SetVar("Stored_Minigame", true) end end end function onTimerDone(self,msg) if (msg.name == "killself") then self:Die{ killerID = self } end end function onCollision(self, msg) local minigame = getObjectByName(self, "minigame") local target = msg.objectID local mstate = target:GetMissionState{missionID = 239}.missionState local faction = target:GetFaction() if faction and faction.faction == 1 and mstate == 2 and minigame:GetVar("running") then self:CastSkill{skillID = 13, optionalTargetID = target} local count = target:GetInvItemCount{itemID = 4985}.itemCount if count <= 14 then target:AddNewItemToInventory{ iObjTemplate = 4985 } end self:Die{ killerID = msg.playerID} local count = target:GetInvItemCount{itemID = 4985}.itemCount minigame:NotifyClientZoneObject{name = "sendToclient_bubble" , paramStr = tostring(count), paramObj = target } end msg.ignoreCollision = true return msg end require('o_mis') function onStartup(self) end -- minigame obj 4870 function onCollisionPhantom(self, msg) local minigame = getObjectByName(self, "minigame") if self:GetVar("Stored_Minigame") == nil then local obj = self:GetObjectsInGroup{ group = "grp_mission" }.objects for i = 1, #obj do if obj[i]:GetLOT().objtemplate == 4870 then storeObjectByName(self, "minigame", obj[i]) self:SetVar("Stored_Minigame", true) end end end local minigame = getObjectByName(self, "minigame") local faction = msg.senderID:GetFaction() local mstate = msg.senderID:GetMissionState{missionID = 239}.missionState if faction and faction.faction == 1 and self:GetVar("Stored_Minigame") and mstate == 2 and not minigame:GetVar("running") then if self:GetLOT().objtemplate == 3706 then -- blue self:ShowEmbeddedEffect{type = "press"} local idString = msg.senderID:GetID() minigame:NotifyObject{ name = idString, param1 = 1 } end if self:GetLOT().objtemplate == 3704 then -- red self:ShowEmbeddedEffect{type = "press"} local idString = msg.senderID:GetID() minigame:NotifyObject{ name = idString, param1 = 1 } end end end function onOffCollisionPhantom(self, msg) local minigame = getObjectByName(self, "minigame") local mstate = msg.senderID:GetMissionState{missionID = 239}.missionState local faction = msg.senderID:GetFaction() if faction and faction.faction == 1 and mstate == 2 and not minigame:GetVar("running") then if self:GetLOT().objtemplate == 3706 then -- blue self:ShowEmbeddedEffect{type = "stop"} local idString = msg.senderID:GetID() minigame:NotifyObject{ name = idString, param1 = 2 } end if self:GetLOT().objtemplate == 3704 then -- red self:ShowEmbeddedEffect{type = "stop"} local idString = msg.senderID:GetID() minigame:NotifyObject{ name = idString, param1 = 2 } end end end require('o_mis') function onNotifyClientZoneObject(self,msg) if msg.name == "sendToAllclients_bubble" then for i = 1, 2 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] local text = msg.paramStr --player:DisplayChatBubble{wsText = text} -- print(text) --player:DisplayTooltip{ bShow = false, strText = text, iTime = } player:DisplayTooltip { bShow = true, strText = text, iTime = 3000 } end end end if msg.name == "unFreezAllPlayers" then for i = 1, msg.param1 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] player:SetUserCtrlCompPause{bPaused = false} end end end if msg.name == "FreezAllPlayers" then for i = 1, msg.param1 do for x = 1, #self:MiniGameGetTeamPlayers{teamID = i}.objects do local player = self:MiniGameGetTeamPlayers{teamID = i}.objects[x] player:SetUserCtrlCompPause{bPaused = true} end end end if msg.name == "sendToclient_bubble" then local player = msg.paramObj player:DisplayChatBubble{wsText = msg.paramStr} end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') function onStartup(self) --self:RebuildReset{ bFail = true } --GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "startup", self ) self:SetVar("Built", false) end function onRebuildComplete(self, msg) self:SetVar("Built", true) end onTimerDone = function (self, msg) end function onRebuildNotifyState(self, msg) if msg.iState == 4 then self:SetVar("Built", false) end end require('o_mis') function onStartup(self) self:SetVar("Total_players", 0 ) self:SetVar("running", false) self:MiniGameSetParameters{numTeams = 1 ,playersPerTeam = 2 } GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "storeObj", self ) end --[[ --]] function onNotifyObject(self, msg) if (msg.param1 == 1) then -- Add Player local player = GAMEOBJ:GetObjectByID(msg.name) self:MiniGameAddPlayer{playerID = player, teamID = 1} self:SetVar("Total_players", self:GetVar("Total_players") + 1) self:NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = player:GetName().name.." Joined!! Total Players = "..self:GetVar("Total_players") } if self:GetVar("Total_players") == 2 and not self:GetVar("running") then self:NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr ="Starting in 5 Seconds" } self:NotifyClientZoneObject{name = "FreezAllPlayers" , param1 = 1 } self:SetVar("running", true) GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "Start", self ) -- teport -69 200 277 (( -70 200 335 )) end end if (msg.param1 == 2) then -- Remove Player local player = GAMEOBJ:GetObjectByID(msg.name) self:MiniGameRemovePlayer{playerID= player} self:SetVar("Total_players", self:GetVar("Total_players") - 1) self:NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = player:GetName().name.." Left!! Total Players = "..self:GetVar("Total_players") } local spawnerl = getObjectByName(self, "spawnloc") spawnerl:NotifyObject{ name="stop" } end if (msg.param1 == 3) then end if (msg.param1 == 4) then end if (msg.param1 == 5) then end end function onTimerDone(self, msg) if (msg.name == "Start") then for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] self:NotifyClientZoneObject{name = "unFreezAllPlayers" , param1 = 1 } if i == 1 then local poss = { x=-69 , y=200 , z =277} player:Teleport{pos = poss } else local poss = { x=-70 , y=200 , z =335} player:Teleport{pos = poss } end self:NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "You have 45 Seconds to complete Mission!!" } GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "missionTime", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "missionTime2", self ) end local spawnerl = getObjectByName(self, "spawnloc") spawnerl:NotifyObject{ name="spawn" } end if (msg.name == "missionTime2") then self:NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Collect 15 energy crystal and rebuild your half of the portal." } end if (msg.name == "missionTime") then local spawnerl = getObjectByName(self, "spawnloc") spawnerl:NotifyObject{ name="stop" } self:NotifyClientZoneObject{name = "sendToAllclients_bubble" , paramStr = "Timer has Expired!!" } for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] local count = player:GetInvItemCount{itemID = 4985}.itemCount if count ~= nil then for x = 1, count do player:RemoveItemFromInventory{iObjTemplate =4985 } if player ~= nil then self:MiniGameRemovePlayer{playerID= player} end end end self:SetVar("running", false) end for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] local count = player:GetInvItemCount{itemID = 4985}.itemCount if count ~= nil then for x = 1, count do player:RemoveItemFromInventory{iObjTemplate =4985 } if player ~= nil then self:MiniGameRemovePlayer{playerID= player} end end end self:SetVar("running", false) end self:SetVar("Total_players", 0) end if (msg.name == "storeObj") then local obj = self:GetObjectsInGroup{ group = "grp_mission" }.objects for i = 1, #obj do if obj[i]:GetLOT().objtemplate == 3706 then -- blue button storeObjectByName(self, "blue_button", obj[i]) storeObjectByName(obj[i], "minigame",self ) end if obj[i]:GetLOT().objtemplate == 3704 then -- red button storeObjectByName(self, "red_button", obj[i]) storeObjectByName(obj[i], "minigame",self ) end if obj[i]:GetLOT().objtemplate == 3554 then -- Cylinder storeObjectByName(self, "Cylinder", obj[i]) storeObjectByName(obj[i], "minigame", self) end if obj[i]:GetLOT().objtemplate == 4064 then -- rebuild two if self:GetVar("rebuild1") == nil then storeObjectByName(self, "rebuild1", obj[i]) storeObjectByName(obj[i], "minigame",self ) else storeObjectByName(self, "rebuild2", obj[i]) storeObjectByName(obj[i], "minigame",self ) end end if obj[i]:GetLOT().objtemplate == 4934 then if self:GetVar("spawnloc") == nil then storeObjectByName(self, "spawnloc", obj[i]) storeObjectByName(obj[i], "minigame",self ) else storeObjectByName(self, "spawnloc", obj[i]) storeObjectByName(obj[i], "minigame",self ) end end end end end require('o_mis') require('State') function onStartup(self) self:UseStateMachine{} Idle = State.create() Idle.onEnter = function(self) self:SetVar("StopAll", true) end Idle.onArrived = function(self) end stop = State.create() stop.onEnter = function(self) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("StopAll", true) end stop.onArrived = function(self) end spawn = State.create() spawn.onEnter = function(self) self:SetVar("StopAll", false) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "spawnfloater", self ) end spawn.onArrived = function(self) end addState(spawn, "spawn", "spawn", self) addState(stop, "stop", "stop", self) addState(Idle, "Idle", "Idle", self) beginStateMachine("Idle", self) Idle.onEnter(self) end function onTimerDone(self,msg) if (msg.name == "spawnfloater") then if self:GetVar("StopAll") == false then local mypos = self:GetPosition().pos local PoS = getRandomPos(self,mypos,40) RESMGR:LoadObject { objectTemplate = 4975, x= PoS.x, y= PoS.y , z= PoS.z, owner = self} local mypos = self:GetPosition().pos local PoS = getRandomPos(self,mypos,40) RESMGR:LoadObject { objectTemplate = 4975, x= PoS.x, y= PoS.y , z= PoS.z, owner = self} GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "spawnfloater", self ) end end end function onNotifyObject(self, msg) if msg.name == "spawn" then setState("spawn",self) end if msg.name == "stop" then setState("stop",self) end end require('o_mis') require('State') function onStartup(self) self:UseStateMachine{} Idle = State.create() Idle.onEnter = function(self) self:SetVar("StopAll", true) end Idle.onArrived = function(self) end stop = State.create() stop.onEnter = function(self) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("StopAll", true) end stop.onArrived = function(self) end spawn = State.create() spawn.onEnter = function(self) self:SetVar("StopAll", false) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "spawnfloater", self ) end spawn.onArrived = function(self) end addState(spawn, "spawn", "spawn", self) addState(stop, "stop", "stop", self) addState(Idle, "Idle", "Idle", self) beginStateMachine("Idle", self) Idle.onEnter(self) end function onTimerDone(self,msg) if (msg.name == "spawnfloater") then if self:GetVar("StopAll") == false then local mypos = self:GetPosition().pos local PoS = getRandomPos(self,mypos,40) RESMGR:LoadObject { objectTemplate = 4975, x= PoS.x, y= PoS.y , z= PoS.z, owner = self} local mypos = self:GetPosition().pos local PoS = getRandomPos(self,mypos,40) RESMGR:LoadObject { objectTemplate = 4975, x= PoS.x, y= PoS.y , z= PoS.z, owner = self} GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "spawnfloater", self ) end end end function onNotifyObject(self, msg) if msg.name == "spawn" then setState("spawn",self) end if msg.name == "stop" then setState("stop",self) end end require('o_mis') function onStartup(self) self:SetVar("found", 0) end function onCollisionPhantom(self, msg) local player = msg.senderID local faction = player:GetFaction() local mstate = player:GetMissionState{missionID = 239}.missionState if faction and faction.faction == 1 and mstate == 2 then player:UpdateMissionTask{ value = 239, value2 = 1, taskType = "complete" } end end require('o_mis') function onStartup(self) end function onCollisionPhantom(self, msg) local target = msg.senderID local lot = target:GetLOT{}.objtemplate if (lot == 4975) then target:Die{ killerID = target, killType = "SILENT" } end end require('o_mis') function onStartup(self) if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end -- set current skill to max entry in table (default behavior) local attackSkillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] self:CastSkill{skillID = 57, optionalTargetID = self } self:CastSkill{skillID = attackSkillID } end require('o_mis') function onStartup(self) self:SetVar("found", 0) self:SetVar("ready", false) end function onCollisionPhantom(self, msg) local target = msg.senderID if not self:GetVar("ready") then local obj = self:GetObjectsInGroup{ group = "rb" }.objects for i = 1, #obj do if obj[i]:GetLOT().objtemplate == 4984 then if obj[i]:GetVar("Built") then self:SetVar("found", self:GetVar("found") + 1) end end if obj[i]:GetLOT().objtemplate == 4846 then storeObjectByName(self, "telespot", obj[i]) end end if self:GetVar("found") >= 2 then self:SetVar("ready", true) self:SetVar("found", 0) end end local faction = target:GetFaction() local mstate = target:GetMissionState{missionID = 239}.missionState if faction and faction.faction == 1 and mstate == 2 and self:GetVar("ready") then local spawn = getObjectByName(self, "telespot") local Markpos = spawn:GetPosition().pos local Markrot = spawn:GetRotation() target:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } self:SetVar("ready", false) end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end ----------------------------------------------------------- --script telling the effects to play on the first "cable" in the spider cave and turn on the gate switch -- Updated 3/15 Darren McKinsey ----------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "ModuleIntro", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end local object2 = self:GetObjectsInGroup{group = "SwitchIntro", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object2:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end end----------------------------------------------------------------- --script which activates switch for "explosive" moving platform -- Updated Darren McKinsey 3/15 ----------------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "turret_switch_01", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end end function onArrived(self, msg) if msg.wayPoint == 1 then local object = self:GetObjectsInGroup{group = "turret_switch_02", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "AtWaypoint", ObjIDSender = self} object:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end end ----------------------------------------------------------- -- Physics volume script, knocks player back. Can be turned off with other object scripts -- Updated 3/15 Darren McKinsey ----------------------------------------------------------- -- OnEnter in HF Trigger system function onStartup(self) self:SetVar("Active", true) end function onCollisionPhantom(self, msg) print("Collision") -- Gets the target id that has collided if msg.objectID then if self:GetVar("Active") == true then local dir = self:GetObjectDirectionVectors().forward -- push-back effect 1378 -- PlayFXEffect msg.objectID:PlayFXEffect{name = "pushBack", effectID = 1378, effectType = "create"}--effectID = 1378, effectType = "push-back"} msg.objectID:PlayAnimation{ animationID = "knockback-recovery" } dir.y = dir.y + 15 dir.x = dir.x * 20 dir.z = dir.z * 20 msg.objectID:Knockback { vector = dir } end end end ----------------------------------------------------------- --script killing enemy "turret" and turning of physics volume -- Updated 3/15 Darren McKinsey ----------------------------------------------------------- function onStartup(self) self:SetVar("BuildUp", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "physics_01", ignoreSpawners = true}.objects[1] if object then object:SetVar("Active", false) end local object2 = self:GetObjectsInGroup{group = "mech_01", ignoreSpawners = true}.objects[1] if object2 then object2:RequestDie() end end end ----------------------------------------------------------- --script turning of physics volume -- Updated 3/15 Darren McKinsey ----------------------------------------------------------- function onStartup(self) self:SetVar("BuildUp", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "physics_02", ignoreSpawners = true}.objects[1] if object then object:SetVar("Active", false) end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then self:SetVar("ModuleUp", true) end end function onFireEvent(self, msg) if self:GetVar("ModuleUp") == true then local object = self:GetObjectsInGroup{group = "SentinelGate", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = false} end end end----------------------------------------------------------- -- Script on switch which and moves to platform waypoint -- Updated 3/15 Darren McKinsey ----------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then self:SetVar("ModuleUp", true) end end function onFireEvent(self, msg) if self:GetVar("ModuleUp") == true then local object = self:GetObjectsInGroup{group = "moving_turret_01", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = false} end end end-------------------------------------------------------------------- --script on switch which explodes moving platform and destroys web -- Updated 3/15 Darren McKinsey -------------------------------------------------------------------- function onStartup(self) self:SetVar("Active", false) end function onNotifyObject(self, msg) if msg.name == "AtWaypoint" then self:SetVar("Active", true) end end function onFireEvent(self, msg) --print("got msg") if self:GetVar("Active") == true then local object2 = self:GetObjectsInGroup{group = "moving_turret_01", ignoreSpawners = true}.objects[1] if object2 then object2:PlayFXEffect{name = "bigboomsupercharge", effectID = 580, effectType = "create"} object2:PlayFXEffect{name = "imaginationexplosion", effectID = 1034, effectType = "cast"} end local object = self:GetObjectsInGroup{group = "GiantWeb", ignoreSpawners = true}.objects[1] if object then --print("got web") object:RequestDie() end end end require('o_mis') function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 and CheckSpanwPos(self) then local objs = GAMEOBJ:GetZoneControlID():GetVar("Con") if objs then for player in pairs(objs) do local playerID = GAMEOBJ:GetObjectByID(objs[player]) if playerID:Exists() then playerID:SetRespawnGroup{findClosest=true, respawnGroup= "spawn"..self:GetVar("tnum")} end end end end end function CheckSpanwPos(self) if GAMEOBJ:GetZoneControlID():GetVar("currentSpawn") < tonumber(self:GetVar("tnum")) then GAMEOBJ:GetZoneControlID():SetVar("currentSpawn", tonumber(self:GetVar("tnum")) ) return true end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') Minions = {} Eggs = {} static = {} -- Event Delays static['Button_to_EMP_Blast'] = 2 static['Boss_Stunned_Time_Phase_1'] = 10 static['Boss_Stunned_Time_Phase_2'] = 10 static['Boss_Stunned_Time_Phase_3'] = 10 CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" -------------------------------------------------- -- Spider Boss Start up -------------------------- -------------------------------------------------- function onStartup(self) con = {} -- Health By Phase con["Phase_1_health"] = 64 -- 80% Starting Phase One skill con["Phase_2_health"] = 48 -- 60% The Spider begins using one or more new attack skills con["Phase_3_health"] = 24 -- 30% Attacks begin to form out of the Maelstrom cloud, The Maelstrom occasionally break the quickbuild pipes -- Level Objects con["Spider_Minion"] = 9463 con["Spider_Egg"] = 9313 con["Spider_Boss"] = 8445 con["Exit_Bridge"] = 0000 -- to be replaced with instance matching con["numberOfplayers"] = 4 con["numberOfrebuilds"] = 2 con["currentRebuilds"] = 0 -- Number of Buttons to activate EMP con["ButtonToBePressed"] = 2 -- Current Buttons Pressed con["ButtonPressed"] = 0 con["RebuildsComplete"] = false con["Eggs_Spawned"] = 0 con["Eggs_Total"] = 0 con["Spiders_Spawned"] = 0 con["Spiders_Total"] = 0 con["Egg_Markers"] = 0 con["totalnumOfminios"] = 0 self:SetVar("con",con) self:SetVar("Phase", 1 ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "SpawnBoss", self ) self:SetActivityParams{ modifyMaxUsers = true, maxUsers = con["numberOfplayers"] , modifyActivityActive = true, activityActive = true} end function onChildLoaded(self,msg) -- Store Spider Boss Obj if (msg.templateID == self:GetVar("con.Spider_Boss")) then storeObjectByName(self, "bossObj", msg.childID) SendNetWorkVar( self , "StoreBossObj", msg.childID:GetID() , "", "", "", "", "" ) -- Store Spider Eggs elseif (msg.templateID == self:GetVar("con.Spider_Egg") ) then if not Eggs[msg.childID:GetID()] then Eggs[msg.childID:GetID()] = msg.childID:GetID() end -- Store Spider Minions elseif (msg.templateID == self:GetVar("con.Spider_Minion")) then if not Minions[msg.childID:GetID()] then Minions[msg.childID:GetID()] = msg.childID:GetID() end end end function PhaseIntro(self,msg) if msg.name == "SpawnBoss" then -- Get Boss Spawn Point local spawn = self:GetObjectsInGroup{ group = "bossSpawn1" ,ignoreSpawners = true }.objects local Markpos = spawn[1]:GetPosition().pos local Markrot = spawn[1]:GetRotation() -- Spawn Spider Boss Start Pos local config = { {"attached_path", "bosspath0"}, {"attached_path_start", 0 } } RESMGR:LoadObject { objectTemplate = 8445 , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self , configData = config}; end end function Reset(self) -- remove Eggs removeEggs(self) fxOffButtons(self) -- remove Minions removeMinions(self) -- tele players local objects = self:GetAllActivityUsers{}.objects local spawnPos = self:GetObjectsInGroup{ignoreSpawners=true, group = "spawn1" }.objects for i = 1, #objects do local player = objects[i] local Markpos = spawnPos[1]:GetPosition().pos local Markrot = spawnPos[1]:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } -- Temp Start player:SetMaxImagination{imagination = 10} player:SetMaxArmor{armor = 10} player:SetMaxHealth{health = 10} player:SetHealth{health = 10} player:SetArmor{armor = 10} player:SetImagination{imagination = 10} -- Temp End -- remove player from Activity self:RemoveActivityUser{ userID = player } end -- reset Vars self:SetVar("con.currentRebuilds" , 0 ) self:SetVar("con.Eggs_Spawned" , 0 ) self:SetVar("con.Eggs_Total" , 0 ) self:SetVar("con.Spiders_Spawned" , 0 ) self:SetVar("con.Spiders_Total" , 0 ) self:SetVar("con.totalnumOfminios" , 0 ) self:SetVar("con.ButtonPressed" , 0 ) self:SetVar("con.RebuildsComplete" , false ) self:SetVar("Stage", 1 ) -- reset Intro Trigger local introTrig = getObjectByName(self, "IntroTrigger") introTrig:NotifyObject{name = "reset"} -- Teleport and Reset Spider Boss local spider = getObjectByName(self, "bossObj") local spawn = self:GetObjectsInGroup{ group = "bossSpawn1" ,ignoreSpawners = true }.objects local Markpos = spawn[1]:GetPosition().pos local Markrot = spawn[1]:GetRotation() -- Reset Health and Armor local h = spider:GetMaxHealth().health local a = spider:GetMaxArmor().armor spider:SetHealth{health = h} spider:SetArmor{armor = a } spider:NotifyObject{name = "SetShield" } spider:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } -- Pop Animation State spider:SetVar("Phase", 1 ) spider:ChangeIdleFlags{off = 13} -- timer kill clouds local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "shooters" }.objects for i = 1, #obj do obj[i]:NotifyObject{name = "OFF"} end -- kill rebuilds local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "rebuilds" }.objects for i = 1, #obj do obj[i]:RebuildReset() end self:SetVar("con.currentRebuilds", 0 ) -- Start Timer to respawn Eggs GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "respawnEggs", self ) local gate = self:GetObjectsInGroup{ group = "gate" ,ignoreSpawners = true }.objects gate[1]:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end function hatchEggs(self) for k,v in pairs(Eggs) do local Obj = GAMEOBJ:GetObjectByID(v) if (Obj:Exists()) then Obj:NotifyObject{name = "hatch"} end end end function removeMinions(self) for k,v in pairs(Minions) do local Obj = GAMEOBJ:GetObjectByID(v) if (Obj:Exists()) then GAMEOBJ:DeleteObject(Obj) Minions[v] = nil table.remove(Minions,v) end end end function removeEggs(self) for k,v in pairs(Eggs) do local Obj = GAMEOBJ:GetObjectByID(v) if (Obj:Exists()) then GAMEOBJ:DeleteObject(Obj) Eggs[v] = nil table.remove(Eggs,v) end end end function spawnEggs(self) print("spawn Eggs "..self:GetVar("con.Egg_Markers")) for i = 1 , self:GetVar("con.Egg_Markers") do local Marker = getObjectByName(self, "Marker_"..i) if (Marker) then local Markpos = Marker:GetPosition().pos local Markrot = Marker:GetRotation() RESMGR:LoadObject { objectTemplate = 9313 , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self}; end end end function removeObjects(self,msg) if msg.name == "removeEgg" then for k,v in pairs(Eggs) do local Obj = GAMEOBJ:GetObjectByID(v) local EggSearch = msg.ObjIDSender if (Obj:GetID() == EggSearch:GetID()) then GAMEOBJ:DeleteObject(Obj) Eggs[v] = nil table.remove(Eggs,v) end end end end function onNotifyObject(self,msg) if msg.name == "addplayer" then local player = msg.ObjIDSender self:AddActivityUser{userID = player} local objects = self:GetAllActivityUsers{}.objects if self:GetVar("con.numberOfplayers") == #objects then StartBossIntro(self,objects) end elseif msg.name == "BossReset" then Reset(self) elseif msg.name == "BossDead" then self:SetVar("BossDead", true) local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "rebuilds" }.objects for i = 1, #obj do obj[i]:RebuildReset() end elseif msg.name == "intbossGUI" then local spider = getObjectByName(self, "bossObj") SendNetWorkVar( spider , "intGUI" , "", "", "", "", "", "" ) elseif msg.name == "EndRebuildReady" then self:SetVar("BossDead" , true ) self:SetVar("BossRebuld", true ) elseif msg.name == "butttonDown" then local pressed = self:GetVar("con.ButtonPressed") + 1 self:SetVar("con.ButtonPressed" , pressed ) if pressed >= self:GetVar("con.ButtonToBePressed") and self:GetVar("con.RebuildsComplete" )then if not self:GetVar("BossDead") then -- Turn on Pre EMP FX's fxOffButtons(self) local empSpawns = self:GetObjectsInGroup{ group = "preEMP" ,ignoreSpawners = true }.objects for i = 1, #empSpawns do DoObjectAction(empSpawns[i], "effect", "beam") end -- Reset Button Vars self:SetVar("con.ButtonPressed" , 0 ) self:SetVar("con.RebuildsComplete" , false ) -- Start Phase 1 Timer GAMEOBJ:GetTimer():AddTimerWithCancel( static['Button_to_EMP_Blast'] , "Button_to_EMP_Blast", self ) elseif self:GetVar("BossRebuld") then fxOffButtons(self) SendNetWorkVar( self , "Exit" , "", "", "", "", "", "" ) -- timer kill clouds local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "shooters" }.objects for i = 1, #obj do obj[i]:NotifyObject{name = "OFF"} end -- timer spawn bridge GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "RemoveClouds", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 4, "TrunonBeams", self ) self:SetVar("con.ButtonPressed", - 100) self:SetVar("BossRebuld", false) end end elseif msg.name == "removeMinion" then local sender = msg.ObjIDSender for k,v in pairs(Minions) do local Obj = GAMEOBJ:GetObjectByID(v) if ( Obj:GetID() == sender:GetID() ) then Minions[v] = nil table.remove(Minions,v) break end end elseif msg.name == "butttonUp" then self:SetVar("con.ButtonPressed" , self:GetVar("con.ButtonPressed") - 1 ) if self:GetVar("con.ButtonPressed") < 0 then self:SetVar("con.ButtonPressed" , 0 ) end elseif msg.name == "removeEgg" then removeObjects(self,msg) elseif msg.name == "storeIntroTrigger" then storeObjectByName(self, "IntroTrigger", msg.ObjIDSender) elseif msg.name == "PhaseOneComplete" then CompletedPhase(self, 1) print "PhaseOneComplete" elseif msg.name == "PhaseTwoComplete" then CompletedPhase(self, 2) print "PhaseTwoComplete" elseif msg.name == "PhaseThreeComplete" then CompletedPhase(self, 3) print "PhaseThreeComplete" elseif msg.name == "PhaseOneRepeat" then RepeatPhase(self, 1) print "PhaseOneRepeat" elseif msg.name == "PhaseTwoRepeat" then RepeatPhase(self, 2) print "PhaseTwoRepeat" elseif msg.name == "PhaseThreeRepeat" then RepeatPhase(self, 3) print "PhaseThreeRepeat" elseif msg.name == "RebuildCompleted" then self:SetVar("con.RebuildsComplete" , true ) -- Set all FX on Rebuilds local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "bossButtons" }.objects for i = 1, #obj do DoObjectAction(obj[i], "effect", "cast") print "play FX" end ------------------------------------------------------- -- Spawn Egg on Load ---------------------------------- ------------------------------------------------------- elseif msg.name == "Egg_Spawner" then self:SetVar("con.Egg_Markers", self:GetVar("con.Egg_Markers") + 1 ) local num = self:GetVar("con.Egg_Markers") if not self:GetVar("Marker_"..num) then storeObjectByName(self, "Marker_"..num, msg.ObjIDSender) end local Markpos = msg.ObjIDSender:GetPosition().pos local Markrot = msg.ObjIDSender:GetRotation() RESMGR:LoadObject { objectTemplate = 9313 , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self}; elseif msg.name == "reset" then Reset(self) elseif msg.name == "removeplayer" then end end function StartBossIntro(self,objects) SendNetWorkVar( self , "StartIntro" , "", "", "", "", "", "" ) -- Spider Path local spider = getObjectByName(self, "bossObj") spider:SetVar("attached_path", "bosspath1") spider:SetVar("attached_path_start", 0 ) spider:FollowWaypoints{ bUseNewPath = true, newPathName = "bosspath1", newStartingPoint = 0 } --SendNetWorkVar( spider , "intGUI" , "", "", "", "", "", "" ) local gate = self:GetObjectsInGroup{ group = "gate" ,ignoreSpawners = true }.objects gate[1]:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end function onTimerDone(self,msg) if msg.name == "SpawnBoss" then PhaseIntro(self,msg) -- Start MaelStormClouds local clouds = self:GetObjectsInGroup{ group = "mcloud" ,ignoreSpawners = true }.objects for i = 1, #clouds do DoObjectAction(clouds[i], "effect", "cloud") end -- Debug Update Phase UI -- SendNetWorkVar( self , "UIPhase" , "", "", "1", "", "", "" ) elseif msg.name == "bosskilled" then local spider = getObjectByName(self, "bossObj") spider:Die{ killerID = self, killType = "VIOLENT" } elseif msg.name == "AudioBossLand" then SendNetWorkVar( self , "AudioBossLand" , "", "", "", "", "", "" ) elseif msg.name == "respawnEggs" then spawnEggs(self) elseif msg.name == "RemoveClouds" then local clouds = self:GetObjectsInGroup{ group = "mcloud" ,ignoreSpawners = true }.objects for i = 1, #clouds do DoObjectAction(clouds[i], "stopeffects", "cloud") end elseif msg.name == "TrunonBeams" then local empSpawns = self:GetObjectsInGroup{ group = "endEMP" ,ignoreSpawners = true }.objects for i = 1, #empSpawns do DoObjectAction(empSpawns[i], "effect", "beam") end local bridge = self:GetObjectsInGroup{ group = "bridge" ,ignoreSpawners = true }.objects for i = 1, #bridge do local Markpos = bridge[i]:GetPosition().pos local Markrot = bridge[i]:GetRotation() RESMGR:LoadObject { objectTemplate = 3286 , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = bridge[i] } end elseif msg.name == "Button_to_EMP_Blast" then -- Play EMP FX local spawn = self:GetObjectsInGroup{ group = "emp" ,ignoreSpawners = true }.objects spawn[1]:PlayFXEffect{effectType = "boom"} hatchEggs(self) local spider = getObjectByName(self, "bossObj") spider:NotifyObject{name = "Stunned"} -- Stop pre EMP FX local empSpawns = self:GetObjectsInGroup{ group = "preEMP" ,ignoreSpawners = true }.objects for i = 1, #empSpawns do DoObjectAction(empSpawns[i], "stopeffects", "beam") end if spider:GetVar("Phase") == 1 then ActivityTimers(self, "StartPhase_1" ) elseif spider:GetVar("Phase") == 2 then ActivityTimers(self, "StartPhase_2" ) elseif spider:GetVar("Phase") == 3 then ActivityTimers(self, "StartPhase_3" ) end end end function ActivityTimers(self, name ) if name == "StartPhase_1" then -- Start Timers self:ActivityTimerSet{name = "Phase_1",duration = static['Boss_Stunned_Time_Phase_1'], updateInterval = 1 } elseif name == "StartPhase_2" then self:ActivityTimerSet{name = "Phase_2",duration = static['Boss_Stunned_Time_Phase_2'], updateInterval = 1 } elseif name == "StartPhase_3" then self:ActivityTimerSet{name = "Phase_3",duration = static['Boss_Stunned_Time_Phase_3'], updateInterval = 1 } end end function onActivityTimerUpdate(self, msg) if msg.name == "Phase_1" then local time = round(static['Boss_Stunned_Time_Phase_1'] - msg.timeElapsed, 0) SendNetWorkVar( self , "UITimer", "", "", tostring(time), "", "", "" ) elseif msg.name == "Phase_2" then local time = round(static['Boss_Stunned_Time_Phase_2'] - msg.timeElapsed, 0) SendNetWorkVar( self , "UITimer", "", "", tostring(time), "", "", "" ) elseif msg.name == "Phase_3" then local time = round(static['Boss_Stunned_Time_Phase_3'] - msg.timeElapsed, 0) SendNetWorkVar( self , "UITimer", "", "", tostring(time), "", "", "" ) end end function onActivityTimerDone(self,msg) if msg.name == "Phase_1" then self:NotifyObject{name = "PhaseOneRepeat" } elseif msg.name == "Phase_2" then self:NotifyObject{name = "PhaseTwoRepeat" } elseif msg.name == "Phase_3" then self:NotifyObject{name = "PhaseThreeRepeat" } end end function CompletedPhase(self, phase) SendNetWorkVar( self , "UITimer", "", "", "done", "", "", "" ) local spider = getObjectByName(self, "bossObj") spider:ChangeIdleFlags{off = 13} spider:SetArmor{armor = 40 } SendNetWorkVar( spider , "UITimer", "", "", "", "", "", "" ) -- kill rebuilds local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "rebuilds" }.objects for i = 1, #obj do obj[i]:RebuildReset() end self:SetVar("con.currentRebuilds", 0 ) self:SetVar("con.RebuildsComplete", false ) -- Respawn Eggs spawnEggs(self) spider:NotifyObject{name = "SetShield" } if phase == 1 then spider:SetVar("Phase", 2 ) SendNetWorkVar( self , "UIPhase", "", "", "2", "", "", "" ) elseif phase == 2 then spider:SetVar("Phase", 3 ) SendNetWorkVar( self , "UIPhase", "", "", "3", "", "", "" ) local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "shooters" }.objects for i = 1, #obj do obj[i]:NotifyObject{name = "ON"} end elseif phase == 3 then spider:SetVar("Phase", 4 ) SendNetWorkVar( self , "UIPhase", "", "", "4", "", "", "" ) end end function RepeatPhase(self, phase) SendNetWorkVar( self , "UITimer", "", "", "done", "", "", "" ) local spider = getObjectByName(self, "bossObj") spider:ChangeIdleFlags{off = 13} spider:SetArmor{armor = 40 } SendNetWorkVar( spider , "resetArmore", "", "", "", "", "", "" ) -- kill rebuilds local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "rebuilds" }.objects for i = 1, #obj do obj[i]:RebuildReset() end self:SetVar("con.currentRebuilds", 0 ) self:SetVar("con.RebuildsComplete", false ) -- Respawn Eggs spawnEggs(self) spider:NotifyObject{name = "SetShield" } if phase == 1 then spider:SetVar("Phase", 1 ) SendNetWorkVar( self , "UIPhase", "", "", "Repeat_1", "", "", "" ) elseif phase == 2 then spider:SetVar("Phase", 2 ) SendNetWorkVar( self , "UIPhase", "", "", "Repeat_2", "", "", "" ) elseif phase == 3 then spider:SetVar("Phase", 3 ) SendNetWorkVar( self , "UIPhase", "", "", "Repeat_3", "", "", "" ) end end function fxOffButtons(self) local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "bossButtons" }.objects for i = 1, #obj do DoObjectAction(obj[i], "stopeffects", "cast") end endrequire('o_mis') function onStartup(self) end function onScriptNetworkVarUpdate(self,msg) --local tableOfVars.con = msg if msg.tableOfVars.name == "StartIntro" then PhaseIntro(self, msg.tableOfVars.name) elseif msg.tableOfVars.name == "bossKilled" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "bossKill" } player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Monument_3"} elseif msg.tableOfVars.name == "AudioBossLand" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayNDAudioEmitter{m_NDAudioEventGUID = "{00cdd107-e09b-4276-93ab-b13c3c37d1fa}"} elseif msg.tableOfVars.name == "StoreBossObj" then local obj = GAMEOBJ:GetObjectByID(msg.tableOfVars.object1) storeObjectByName(self, "bossObj", obj) -- Debug GUI elseif msg.tableOfVars.name == "UIPhase" then if msg.tableOfVars.String1 then UI:SendMessage("SetBossVars", {{"phase", msg.tableOfVars.String1}} ) end elseif msg.tableOfVars.name == "UITimer" then if msg.tableOfVars.String1 then UI:SendMessage("SetBossVars", {{"timer", msg.tableOfVars.String1}} ) end elseif msg.tableOfVars.name == "Exit" then PhaseExit(self,msg.tableOfVars.name) end end ------------------------------------------------------------------------------------------------ --- Phase Intro Activity Start ----------------------------------------------------------------- ------------------------------------------------------------------------------------------------ function PhaseIntro(self,name) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local bossObj = getObjectByName(self, "bossObj") if name == "StartIntro" then -- Play Cinematic player:PlayCinematic { pathName = "intro" } -- Push game State to boss UI:SendMessage( "pushGameState", {{"state", "boss" }} ) -- Start Timer Cue GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "bossAngry1", self ) elseif name == "bossAngry1" then bossObj:PlayNDAudioEmitter{m_NDAudioEventGUID = "{18c88db5-d20f-47e4-a026-b83132e35bf2}"} GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "bossAngry2", self ) elseif name == "bossAngry2" then bossObj:PlayNDAudioEmitter{m_NDAudioEventGUID = "{6fd720fc-e8ed-43a8-8f88-e4d0f4b6df93}"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "bossIntroMusic", self ) elseif name == "bossAngry3" then bossObj:PlayNDAudioEmitter{m_NDAudioEventGUID = "{00cdd107-e09b-4276-93ab-b13c3c37d1fa}"} elseif name == "bossIntroMusic" then player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Monument_3"} GAMEOBJ:GetTimer():AddTimerWithCancel( 7, "bossAngry3", self ) end end ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ --- Phase Exit Activity end ----------------------------------------------------------------- ------------------------------------------------------------------------------------------------ function PhaseExit(self,name) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if name == "Exit" then -- Play Cinematic player:PlayCinematic { pathName = "exit" } -- Push game State to boss UI:SendMessage( "popGameState", {{"state", "boss" }} ) -- Start Timer Cue end end function PhaseReset(self,msg) end function onTimerDone(self,msg) if msg.name == "bossIntroMusic" then PhaseIntro(self,msg) elseif msg.name == "bossAngry1" then PhaseIntro(self,msg) elseif msg.name == "bossAngry2" then PhaseIntro(self,msg) elseif msg.name == "bossAngry3" then PhaseIntro(self,msg) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------- -- Spider Boss Start up -------------------------- -------------------------------------------------- function onStartup(self) rebuilds = {} static = {} -- Event Delays static['Chance_ToHit_Player'] = 40 static['Chance_ToHit_ReBuild'] = 10 self:SetVar("ON", false) --GAMEOBJ:GetTimer():AddTimerWithCancel( 20 , "fire", self ) --GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "StoreActivity", self ) end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -------------------------------------- -- Store Activity Object if nil -- -------------------------------------- if not self:GetVar("ActivityObj") then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects storeObjectByName(self, "ActivityObj", ActivityObj[1]) rebuilds = self:GetObjectsInGroup{ignoreSpawners=true, group = "rebuilds" }.objects end local Activity = getObjectByName(self, "ActivityObj") -- Random Player or QB local num = math.random(1, 100) if num > 1 and num < 60 then HitPlayer = true HitQB = false else HitPlayer = false HitQB = true end if HitPlayer then local objects = Activity:GetAllActivityUsers{}.objects if objects then local ranP = math.random(1, #objects) local nump = math.random(1, 100) if nump > 1 and num < static['Chance_ToHit_Player'] then if objects[ranP] then self:CastSkill{skillID = 355 , optionalTargetID = objects[ranP] } end else local Markpos = objects[ranP]:GetPosition().pos local Markrot = objects[ranP]:GetRotation() local pos = {x = Markpos.x + 5, y = Markpos.y + 5, z = Markpos.z + 5} if objects[ranP] then self:CastSkill{skillID = 355 , lastClickedPosit = pos } end end else local numq = math.random(1, 100) local ranp = math.random(1, #rebuilds) local rebuildState = rebuilds[ranp]:GetRebuildState() -- if the state is idle we are active if (rebuildState and tonumber(rebuildState.iState) == 3) then if numq > 1 and num < static['Chance_ToHit_ReBuild'] then if rebuilds[ranp] then self:CastSkill{skillID = 355 , optionalTargetID = rebuilds[ranp] } end else local Markpos = rebuilds[ranp]:GetPosition().pos local Markrot = rebuilds[ranp]:GetRotation() local pos = {x = Markpos.x + 5, y = Markpos.y + 5, z = Markpos.z + 5} if rebuilds[ranp] then self:CastSkill{skillID = 355 , lastClickedPosit = pos } end end end end end end function onTimerDone(self,msg) if msg.name == "fire" then self:ShootingGalleryFire() if self:GetVar("ON") then local num = math.random(4, 8) GAMEOBJ:GetTimer():AddTimerWithCancel( num , "fire", self ) end end end function onNotifyObject(self,msg) if msg.name == "ON" then self:SetVar("ON", true) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "fire", self ) elseif msg.name == "OFF" then self:SetVar("ON", false) GAMEOBJ:GetTimer():CancelAllTimers( self ) end end------------------------------------------------------ --Spider Egg script ------------------------------------------------------ local interactRadius = 15 local hatchTime = 2.0 function onStartup(self) self:SetVar("hatching", false) self:SetProximityRadius { radius = interactRadius } end function onProximityUpdate(self, msg) local isHuman = msg.objId:IsCharacter().isChar if (msg.status == "ENTER") and (isHuman) and not self:GetVar("hatching") --[[and (chanceToHatch == hatchSpider)--]] then self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} self:CastSkill{skillID = 305} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) end end function onOnHit(self, msg) if self:GetVar("hatching") == false then self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) if msg.attacker:IsCharacter().isChar then self:CastSkill{skillID = 305} end end end function onTimerDone(self, msg) if msg.name == "hatchTime" then local ActivityObj = self:GetParentObj().objIDParent self:PlayFXEffect{name = "egg_puff_b", effectID = 644, effectType = "create"} local pos = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = 9463 , x = pos.x , y = pos.y , z = pos.z , owner = ActivityObj } GAMEOBJ:GetTimer():AddTimerWithCancel(0.2, "die", self) elseif msg.name == "die" then GAMEOBJ:DeleteObject(self) --self:RequestDie() end end function onNotifyObject(self,msg) if msg.name == "hatch" and self:GetVar("hatching") == false then self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) end end function onDie(self,msg) local ActivityObj = self:GetParentObj().objIDParent ActivityObj:NotifyObject{name = "removeEgg" ,ObjIDSender = self } endrequire('o_mis') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 10 , "notifiyActivityObj", self ) end function onTimerDone(self,msg) if msg.name == "notifiyActivityObj" then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects if ActivityObj[1] then ActivityObj[1]:NotifyObject{ name="Egg_Spawner", ObjIDSender = self } end end end function onStartup(self) self:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end require('o_mis') function onStartup(self) print "Item Script Started" end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then print "hit Chest" local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "rebuildP" }.objects obj[1]:SetModelToBuild{templateID=6783} obj[1]:SpawnModelBricks{amount=0.1, pos= self:GetPosition().pos } end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = false -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 25 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 101 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 10} local ActivityObj = self:GetParentObj().objIDParent local boss = getObjectByName(ActivityObj, "bossObj") local Markpos = boss:GetPosition().pos self:GoTo { speed = 20, target = { x =Markpos.x ,z =Markpos.z ,y =Markpos.y } } end function onTemplateDie(self,msg) local ActivityObj = self:GetParentObj().objIDParent ActivityObj:NotifyObject{name = "removeMinion" ,ObjIDSender = self } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} -- use native code AI? Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['wanderRadius'] = 50 -- Wander Radius -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onTemplateDie (self, msg ) local ActivityObj = self:GetParentObj().objIDParent local pos = self:GetPosition().pos local pos1 = ""..pos.x..","..pos.y..","..pos.z.."" ActivityObj:NotifyObject{param1 = 2469 , paramObj = self, name = pos1 } ActivityObj:NotifyObject{name = "MinionDied" , paramObj = self } end require('State') require('o_StateCreate') require('o_mis') require('ai/SPIDERCAVE/SPIDER_BOSS_BATTLE/SPIDER_Main') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function onStartup(self) Set = {} self:SetVar("Shielded" , true ) -- use native code AI? Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = false -- a state suspending scripted movement AI --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 300 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings ---------------------------------------------w------------ Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['wanderRadius'] = 50 -- Wander Radius -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) self:SetVar("Phase", 1 ) -------------------------------------------------------------------------------- Phase = {} local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects Phase[1] = ActivityObj[1]:GetVar("con.Phase_1_health") Phase[2] = ActivityObj[1]:GetVar("con.Phase_2_health") Phase[3] = ActivityObj[1]:GetVar("con.Phase_3_health") Phase[4] = ActivityObj[1]:GetVar("con.Phase_Death") end function onTemplateNotifyObject(self,msg) if msg.name == "Stunned" then self:SetVar("BossStage", 1) self:SetVar("Shielded" , false ) self:SetArmor{armor = 0 } SendNetWorkVar( self , "removeArmor" , "", "", "", "", "", "" ) local meItem = self:GetInventoryItemInSlot().itemID self:UnEquipInventory{ itemtounequip = meItem} self:ChangeIdleFlags{on = 13} local eChangeType = "PUSH" self:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } elseif msg.name == "SetShield" then self:SetVar("Shielded" , true ) local eChangeType = "POP" self:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } local meItem = self:GetInventoryItemInSlot().itemID self:EquipInventory{ itemtoequip = meItem} self:ChangeIdleFlags{off = 13} end end function onTemplateHit (self, msg ) --self:PlayFXEffect{ effectID = 975, effectType = "onhit"} SendNetWorkVar( self , "SetHealth" , "", "", "", "", "", "" ) local health = self:GetHealth{}.health local armor = self:GetArmor{}.armor if self:GetVar("Shielded") and armor < 35 then self:SetArmor{armor = 40 } local meItem = self:GetInventoryItemInSlot().itemID if not meItem:IsItemEquipped{}.bIsEquipped then self:EquipInventory{ itemtoequip = meItem} end else if health <= Phase[1] and not self:GetVar("Shielded") and self:GetVar("Phase") == 1 then local ActivityObj = self:GetParentObj().objIDParent ActivityObj:NotifyObject{name = "PhaseOneComplete" } ActivityObj:ActivityTimerStopAllTimers() elseif health <= Phase[2] and not self:GetVar("Shielded") and self:GetVar("Phase") == 2 then local ActivityObj = self:GetParentObj().objIDParent ActivityObj:NotifyObject{name = "PhaseTwoComplete" } ActivityObj:ActivityTimerStopAllTimers() elseif health <= Phase[3] and not self:GetVar("Shielded") and self:GetVar("Phase") == 3 then local ActivityObj = self:GetParentObj().objIDParent ActivityObj:ActivityTimerStopAllTimers() end end end function onTemplateDie (self, msg ) local ActivityObj = self:GetParentObj().objIDParent ActivityObj:ActivityTimerStop{name = "Phase_3"} ActivityObj:NotifyObject{name = "BossDead" } local Markpos = self:GetPosition().pos local Markrot = self:GetRotation() local posString = self:CreatePositionString{ x = Markpos.x, y = Markpos.y, z = Markpos.z }.string local config = { {"rebuild_activators", posString }, {"respawn", 10000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true}, {"currentTime", 0} } RESMGR:LoadObject { objectTemplate = 9501 , x = Markpos.x , y = Markpos.y , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self ,configData = config} end function onNotifyCombatAIStateChange(self,msg) local State = msg.currentState if State == "TETHER" then local ActivityObj = self:GetParentObj().objIDParent ActivityObj:NotifyObject{name = "BossReset" } end endrequire('o_mis') function onRenderComponentReady(self) self:SetNameBillboardState{bState = false } end function onScriptNetworkVarUpdate(self,msg) if msg.tableOfVars.name == "SetHealth" then local health = self:GetHealth().health local armor = self:GetArmor().armor UI:SendMessage("SetBossVars", {{"health", tostring(health)} ,{"healthmax", "100"}} ) UI:SendMessage("SetBossVars", {{"armor", tostring(armor)} ,{"armormax", "100"}} ) end if msg.tableOfVars.name == "intGUI" then ---- Temp button GAMEOBJ:GetTimer():AddTimerWithCancel( 4 , "int", self ) end if msg.tableOfVars.name == "removeArmor" then UI:SendMessage("SetBossVars", {{"armor", "none"} ,{"armormax", "100"}} ) self:ResetSecondaryAnimation() self:ResetPrimaryAnimation() end if msg.tableOfVars.name == "resetArmore" then UI:SendMessage("SetBossVars", {{"armor", "40"} ,{"armormax", "100"}} ) self:ResetSecondaryAnimation() self:ResetPrimaryAnimation() end if msg.tableOfVars.name == "resetAnim" then end end function onTimerDone(self,msg) if msg.name == "int" then local health = self:GetHealth().health local armor = self:GetArmor().armor UI:SendMessage("SetBossVars", {{"health", tostring(health)} ,{"healthmax", "100"}} ) UI:SendMessage("SetBossVars", {{"armor", tostring(armor)} ,{"armormax", "100"}} ) UI:SendMessage("SetBossVars", {{"bossname", self:GetName().name}} ) end endrequire('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function onNotifyObject(self,msg) if msg.name == "reset" then self:RebuildReset() end end function onRebuildComplete(self, msg) -------------------------------------- -- Store Activity Object if nil -- -------------------------------------- if not self:GetVar("ActivityObj") then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects storeObjectByName(self, "ActivityObj", ActivityObj[1]) end local ActivityObj = getObjectByName(self, "ActivityObj") ActivityObj:NotifyObject{ name = "EndRebuildReady" } end require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function onNotifyObject(self,msg) if msg.name == "reset" then self:RebuildReset() end end function onRebuildComplete(self, msg) -------------------------------------- -- Store Activity Object if nil -- -------------------------------------- if not self:GetVar("ActivityObj") then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects storeObjectByName(self, "ActivityObj", ActivityObj[1]) end local ActivityObj = getObjectByName(self, "ActivityObj") ActivityObj:SetVar("con.currentRebuilds", ActivityObj:GetVar("con.currentRebuilds") + 1 ) if ActivityObj:GetVar("con.currentRebuilds") >= ActivityObj:GetVar("con.numberOfrebuilds") then ActivityObj:NotifyObject{ name="RebuildCompleted" } end end require('o_mis') function onStartup(self) self:GetVar("trigger_build", 0 ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onScriptNetworkVarUpdate(self,msg) if msg.tableOfVars.name == "lockPlayer" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local eChangeType = "PUSH" player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } elseif msg.tableOfVars.name == "Rebuild" then if not self:GetVar("rebuildP") then local rebuildP = self:GetObjectsInGroup{ group = "rebuildP" ,ignoreSpawners = true }.objects storeObjectByName(self, "rebuildP", rebuildP[1]) end local rebuildP = getObjectByName(self, "rebuildP") rebuildP:SpawnModelBricks{amount=0.5 ,pos= rebuildP:GetPosition().pos} end end------------------------------------------------ --switch to fire EMP ------------------------------------------------ require('o_mis') function onStartup(self) self:AddObjectToGroup{group = "bossButtons"} end function onObjectActivated(self,msg) -------------------------------------- -- Store Activity Object if nil -- -------------------------------------- --SendNetWorkVar( self , "Green" , "", "", "", "", "", "" ) if not self:GetVar("ActivityObj") then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects if ActivityObj[1] then ActivityObj[1]:NotifyObject{name = "storeIntroTrigger", ObjIDSender = self } storeObjectByName(self, "Activity", ActivityObj[1]) end end if msg.activatorID:IsCharacter().isChar then local ActivityObj = getObjectByName(self, "Activity") ActivityObj:NotifyObject{name = "butttonDown"} end end function onObjectDeactivated(self,msg) --SendNetWorkVar( self , "Red" , "", "", "", "", "", "" ) if msg.deactivatorID:IsCharacter().isChar then local ActivityObj = getObjectByName(self, "Activity") ActivityObj:NotifyObject{name = "butttonUp"} end endrequire('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function onStartup(self) --self:SetCollisionGroup{colGroup = 7 } self:SetProximityRadius { radius = 5 } end function onProximityUpdate(self, msg) local target = msg.objId local template = target:GetLOT{}.objtemplate if (msg.status == "ENTER") and (template == 8445) and (self:GetRebuildState{}.iState == 2) then -------------------------------------- -- Store Activity Object if nil -- -------------------------------------- if not self:GetVar("bossObj") then storeObjectByName(self, "bossObj", target) end local eChangeType = "PUSH" target:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } DoObjectAction(self, "effect", "cast") DoObjectAction(target, "anim", "spider-electrocute") GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "unStun", self ) end end function onTimerDone(self,msg) if msg.name == "unStun" then local target = getObjectByName(self,"bossObj") local eChangeType = "POP" target:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } self:RebuildReset() end end function onTeamPickupItem(self,msg) print "onTeamPickupItem ****************" endrequire('o_mis') function onStartup(self) self:SetVar("currentSpawn", 1) self:SetVar("Debug", false) end function onPlayerLoaded(self,msg) local player = msg.playerID for i = 1, 4 do if self:GetVar("Con.player_"..i) == nil then self:SetVar("Con.player_"..i, player:GetID() ) player:SetRespawnGroup{findClosest=true, respawnGroup= "spawn1"} ------------------------------------------------------------------------------- -- Temp local obj = self:GetObjectsInGroup{ignoreSpawners=true, group = "spawn1" }.objects local Markpos = obj[1]:GetPosition().pos local Markrot = obj[1]:GetRotation() player:Teleport{pos = Markpos, y = Markrot.y, w = Markrot.w, bSetRotation = true } if self:GetVar("Debug") then player:SetMaxImagination{imagination = 20} player:SetMaxArmor{armor = 2000 } player:SetMaxHealth{health = 20} player:SetHealth{health = 20} player:SetArmor{armor = 2000} player:SetImagination{imagination = 20} end --------------------------------------------------------------------------------- break end end end function onPlayerExit( self, msg) local player = msg.playerID for i = 1, 4 do if self:GetVar("Con.player_"..i) == player:GetID() then self:SetVar("Con.player_"..i, nil ) break end end end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) local player = msg.sender if msg.identifier == "reset" then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects ActivityObj[1]:NotifyObject{name = "reset" } elseif msg.identifier == "intbosshearts" then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects ActivityObj[1]:NotifyObject{name = "intbossGUI" } end end require('o_mis') function onStartup(self) Con = {} for i = 1, 4 do Con["inActivity_"..i] = nil end self:SetVar("Con",Con) end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then ActivityAdd(self, target) end end function ActivityAdd(self, player) -------------------------------------- -- Store Activity Object if nil -- -------------------------------------- if not self:GetVar("ActivityObj") then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects ActivityObj[1]:NotifyObject{name = "storeIntroTrigger", ObjIDSender = self } storeObjectByName(self, "ActivityObj", ActivityObj[1]) end local ActivityObj = getObjectByName(self, "ActivityObj") if not ActivityObj:ActivityUserExists{userID = player}.bExists then ActivityObj:NotifyObject{name = "addplayer", ObjIDSender = player } -- setStunned(self, player) local objects = self:GetAllActivityUsers{}.objects for i = 1, #objects do if self:GetVar("Con.inActivity_"..i) == nil then self:SetVar("Con.inActivity_"..i, objects[i]:GetID() ) break end end end end function ActivityRemove(self, player) if getObjectByName(self, "ActivityObj") then local ActivityObj = getObjectByName(self, "ActivityObj") ActivityObj:NotifyObject{name = "removeplayer", ObjIDSender = player } end end function onNotifyObject(self,msg) if msg.name == "reset" then Con = {} for i = 1, 4 do Con["inActivity_"..i] = nil end self:SetVar("Con",Con) local gate = self:GetObjectsInGroup{ group = "gate" ,ignoreSpawners = true }.objects gate[1]:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end require('State') require('ai/SPIDERCAVE/SPIDER_BOSS_BATTLE/SPIDER_WayPointEvents') require('o_onEvent') require('o_mis') require("o_Movement") function CreateStates(self) Timers = {} Timers[1] = "blank" self:SetVar("Timers",Timers) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CombatState(self) -- ////////////////////////////////////////////////////////////////////////////////// -- if Way Points if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then UseWayPoints(self) end -- if PetCalss if self:GetVar("Set.Pet_Active") then SetPetClass(self) end -- if Frozen if self:GetVar("Set.MovementType") == "Frozen" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Guard if self:GetVar("Set.MovementType") == "Guard" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Wander if self:GetVar("Set.MovementType") == "Wander" then MeanderState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if follow if self:GetVar("Set.FollowActive") then FollowState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Helper if self:GetVar("Set.Helper") then SetHelper(self) end customState = State.create() customState.onEnter = function(self) if (onTemplateCustomStateEnter) and (onTemplateCustomStateEnter(self, msg) == true ) then return end end customState.onArrived = function(self, msg) if (onTemplateCustomStateArrived) and (onTemplateCustomStateArrived(self, msg) == true ) then return end end -- ////////////////////////////////////////////////////////////////////////////////// -- Idle Idle = State.create() Idle.onEnter = function(self) if self:GetVar("Set.Pet_Active") and not self:GetVar("PetLoaded") then self:SetVar("PetLoaded", true) setState("PetClass",self) end if self:GetVar("RebuildStart") then storeHomePoint(self) self:SetVar("inpursuit",true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Emote_EventDelay") , "rebuildBreak", self ) end end AiDisable = State.create() AiDisable.onEnter = function(self) self:SetVar("myTarget", nil) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CancelTemplateTimers(self) self:SetVar("AiDisabled", true) self:StopPathing() end AiEnable = State.create() AiEnable.onEnter = function(self) self:SetVar("AiDisabled", false) SetResetState(self) end --setState("Dead", self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Death Dead = State.create() Dead.onEnter = function(self) self:SetVar("CurrentState", "Dead") if self:GetVar("I_Have_A_Parent") then local WpSetName = self:GetVar("attached_path") local myParent = getParent(self) local sSplit = split(WpSetName,"_") local xSplit = {} local xSplit= {alpa=sSplit[1] , num=sSplit[2] } myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") setState("DeadChild", myParent) end if self:GetVar("Im_A_Child") then myParent = getParent(self) for i = 1, getParent(self):GetVar("MaxPet") do local myidString = self:GetID() local myfinalID = "|" .. myidString local Pet = getPetID(myParent,i):GetID() if Pet == self:GetID() then myParent:SetVar("StoredPet."..i, "none") myParent:SetVar("Child_Timer."..i, myfinalID ) GAMEOBJ:GetTimer():AddTimerWithCancel( myParent:GetVar("Set.Pet_Respawn") , myfinalID, myParent ) end end end getVarables(self) CancelTemplateTimers(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Tether tether = State.create() tether.onEnter = function(self) self:SetVar("aggrotarget",2) self:SetImmunity{ immunity = true } self:SetVar("myTarget", nil) if self:GetVar("Set.tetherSpeed") ~= nil then local Tspeed = self:GetVar("Set.tetherSpeed") else local Tspeed = 1 end --print("I am tethering") local myPos = getHomePoint(self) self:GoTo { speed = self:GetVar("Set.tetherSpeed"), target = { x = myPos.x, z = myPos.z, y = myPos.y, } } end tether.onArrived = function(self,msg) self:SetVar("CurrentState", "tether") -- print("I have arrived at my home tether point.") self:SetVar("aggrotarget",0) self:SetHealth{ health = self:GetMaxHealth{}.health } self:SetImmunity{ immunity = false } getVarables(self) SetResetState(self) -- Find what state i should reset too end GoHome = State.create() GoHome.onEnter = function(self) self:SetVar("CurrentState", "GoHome") local hpos = getHomePoint(self) --if self:GetVar("Set.FearHP") then -- self:SetVar("FleeStatus",0) -- self:SetVar("FleeDone",true) -- self:SetVar("FleeRetrun",true) -- setState("aggro", self) --else self:GoTo { speed = 1, target = { x =hpos.x ,z =hpos.z ,y =hpos.y } } -- end end GoHome.onArrived = function(self) -- print("I have Arrived at my Home Point") self:SetRotation(self:GetVar("rot")) SetResetState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Aggro function dist(a ,b) local dx = math.abs(b.x - a.x) local dy = math.abs(b.y - a.y) local dz = math.abs(b.z - a.z) local d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) return d end function Distance(point1, point2) local distance = { } distance.x = (point2.x - point1.x) distance.y = (point2.y - point1.y) return distance end --[[ Aggro:: Right away, turn on the heartbeat timer and follow the target. The FollowTarget method will continually follow, face the target, and keep a good attacking distance. When the heartbeat comes back, decide what to do. For now, we just say that we are ready to attack. If you are a given distance from the target and you are facing him, attack. If you cannot attack, wait until onArrived and then attack. --]] function AggroState(self) aggro = State.create() ----------------------------------------------------------------------------- -- Aggro onEnter ----------------------------------------------------------------------------- aggro.onEnter = function(self) self:SetVar("CurrentState", "aggro") local INITIAL_ATTACK_TIME = 1 -- Start the heartbeat self:SetVar("readyToAttack", false) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) local myPos = getHomePoint(self) local target = getObjectByName(self, "AttackingTarget") if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } -- print("Setting Tether Point ") if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end -- end if frozen end -- end else is not dead end -- end function aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = self:GetVar("SkillTime") if (castTime < 1) then print("castTime", castTime) end GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) else onTimerDone(self, msg) end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end -- This will be called if FollowTarget fails. That would only fail because the target has died or logged out. In any case, the target was lost aggro.onCancelled = function(self, msg) self:SetVar("Aggroed", false) --setState("tether",self) ProximityPuls(self) end function DoAttack(self) if (self:GetVar("readyToAttack") == false) then -- print("Not Ready to Attack") return end if CanAttackTarget(self) then -- print("Can Attack") self:SetVar("readyToAttack", false) if self:GetVar("Set.Aggression") == "PassiveAggres" and self:GetVar("AggroOnce") == 0 then self:SetVar("AggroOnce",1) end if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end -- set current skill to max entry in table (default behavior) local attackSkillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] -- look for an attack override skill and use it local bOverrideSkill = self:GetVar("Set.OverRideAttackSkill") local overrideSkillID = self:GetVar("Set.AttackSkill") if (bOverrideSkill and overrideSkillID and bOverrideSkill == true) then attackSkillID = overrideSkillID end -- use an optional target if needed local bUseOptTarget = self:GetVar("Set.UseOptionalTargetOnAttack") if (bUseOptTarget and bUseOptTarget == true) then self:CastSkill{skillID = attackSkillID, optionalTargetID = getObjectByName(self, "AttackingTarget") } else self:CastSkill{skillID = attackSkillID } end end end end -- end create aggro state ----------------------------------------------------------------------------- -- Combat state - native code handling it ----------------------------------------------------------------------------- function CombatState(self) combat = State.create() combat.onEnter = function(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) self:SetVar("CurrentState", "combat") end -- function combat.onEnter end ----------------------------------------------------------------------------- -- CanAttackTarget ----------------------------------------------------------------------------- function CanAttackTarget(self) local myTarget = getObjectByName(self, "AttackingTarget") --local range = self:GetVar("Set.AggroDist") --local myPos = Vector.new(self:GetPosition().pos) --local hisPos = Vector.new(myTarget:GetPosition().pos) --local dist = hisPos - myPos if not myTarget:Exists() or myTarget:IsDead().bDead or not self:IsEnemy{ targetID = myTarget }.enemy then self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) ProximityPuls(self) return false end -- If we are close enough and if the object is in the FOV, then attack --if dist:sqrLength() - range <= range * range then --and (self:IsObjectInFOV { target = myTarget, radius = 5 , minRange = 0, maxRange = 100 }.result) then return true --end --self:SetVar("Aggroed", false) --return false end -- end CanAttackTarget -- Start timer funciton function SetStoreTimmer(intTime, Name, self) -- Start Timer if (intTime) and (Name) and (self) then GAMEOBJ:GetTimer():AddTimerWithCancel( intTime, Name, self ) end -- Store Timer for i = 1, table.maxn(self:GetVar("Timers")) + 1 do if self:GetVar("Timers."..i) == Name then break end if self:GetVar("Timers."..i) == nil then self:SetVar("Timers."..i, Name) end end end function CancelTemplateTimers(self) if self:GetVar("Timers") then for i = 2,table.maxn(self:GetVar("Timers")) do GAMEOBJ:GetTimer():CancelTimer( self:GetVar("Timers."..i), self ) end end end onDie = function(self,msg) if (onTemplateDie) and (onTemplateDie(self, msg) == true ) then return end end require('o_mis') function onStartup(self) self:SetVar("currentModel", 6783) self:SetVar("childObject", "0") end function onSetModelToBuild(self, msg) print("spider model ???") if self:GetVar("currentModel") ~= -1 and msg.templateID ~= -1 then local myPos = self:GetPosition{}.pos local myRot = self:GetRotation{} RESMGR:LoadObject{objectTemplate = msg.templateID), x = myPos.x, y = myPos.y, z = myPos.z, rw = myRot.w, rx = myRot.x, ry = myRot.y, rz = myRot.z, owner = self} end self:SetVar("currentModel", msg.templateID) end require('o_mis') -- Called anytime the rebuild object's state changes function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 2 ) then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects local spider = getObjectByName(ActivityObj[1], "bossObj") spider:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} -- ActivityObj[1]:NotifyObject{name = "RebuildTrigger" } end end function onArrived(self, msg) if self:GetVar("Set.SuspendLuaMovementAI") == true then return end if not self:GetVar("AiDisabled") then if not msg.isLastPoint then self:SetVar("SavedWP", msg.wayPoint) self:SetVar("PathName", msg.pathName) else self:SetVar("SavedWP", nil) self:SetVar("PathName", nil) self:SetVar("attached_path", nil) end if (msg.actions) and not self:GetVar("AiDisabled") then -- Clear Last Event Set if true if self:GetVar("Act_V") or self:GetVar("Act_N") then for c = 1, table.maxn(self:GetVar("Act_N")) do self:SetVar("Act_N."..c, nil) end for c = 1, table.maxn(self:GetVar("Act_V")) do self:SetVar("Act_V."..c, nil) end end -- Store Events local Act_N = {} local Act_V = {} for i = 1, table.maxn(msg.actions) do Act_N[i] = msg.actions[i].name Act_V[i] = msg.actions[i].value if msg.actions[i].value == nil then Act_V[i] = "noValue" end end self:SetVar("Act_V",Act_V) self:SetVar("Act_N",Act_N) setState("WayPointEvent", self) else self:ContinueWaypoints() end end end -- Event Wp State --- function UseWayPoints(self) if self:GetVar("Set.SuspendLuaMovementAI") == true then return end WayPointEvent = State.create() WayPointEvent.onEnter = function(self) self:SetVar("CurrentState", "WayPointEvent") local o = self:GetVar("WPEvent_NUM") if self:GetVar("WPEvent_NUM") <= table.maxn(self:GetVar("Act_N")) then -- o = o + 1 if self:GetVar("Act_V") == "noValue" then WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")) else WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")[o]) end else self:SetVar("WPEvent_NUM", 1) self:ContinueWaypoints() end end end function WayPointEventFunc(self,name,value) if self:GetVar("Set.SuspendLuaMovementAI") == true then return end if name == "spawnSpiders" then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects ActivityObj[1]:NotifyObject{name = "spawnMinions" } end if name == "spawnSpiders2" then local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects ActivityObj[1]:NotifyObject{name = "spawnMinions2" } end if name == "bounce" then local tpos = LEVEL:GetPathWaypoints(self:GetVar("attached_path"))[(self:GetVar("WPEvent_NUM") + 1)].pos self:BouncePlayer{ niDestPt = tpos , fSpeed = value , disableMovement = true, bStickLanding = true , ObjIDBouncer = self } -- Update Boss GUI SendNetWorkVar( self , "intGUI" , "", "", "", "", "", "" ) self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "stop" then self:StopMoving() end if name == "groupemote" then local s = value local t = split(s, ',') local friends = self:GetObjectsInGroup{ group = t[1] }.objects for i = 1, table.maxn (friends) do for b = 3, table.maxn(t) do if friends[i]:GetLOT().objtemplate == tonumber(t[b]) then -- Mim Emote.emote(friends[i], friends[i], t[2] ) end end end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "setvar" then local s = value local t = split(s, ',') self:SetVar(t[1],t[2]) self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "castskill" then if value ~= "noValue" then self:CastSkill{skillID = value } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) else self:CastSkill{skillID = self:GetSkills().skills[1] } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end end if name == "eqInvent" then local meItem = self:GetInventoryItemInSlot().itemID self:EquipInventory{ itemtoequip = meItem} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "unInvent" then local meItem = self:GetInventoryItemInSlot().itemID self:UnEquipInventory{ itemtounequip = meItem} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- delay if name == "delay" then self:StopMoving() --GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DealyAction", self ) SetStoreTimmer(value,"DealyAction",self) end ----------------------- emote if name == "femote" then Emote.emote(self, self , value ) self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "emote" then Emote.emote(self, self , value ) local time = self:GetAnimationTime{ animationID = value }.time if time < 1 then time = 1 end -- GAMEOBJ:GetTimer():AddTimerWithCancel( time , "DelayActionEmote", self ) SetStoreTimmer(time,"DelayActionEmote",self) end ----------------------- teleport if name == "teleport" then local s = value local t = split(s, ',') local xSplit= {x=t[1] , y=t[2] , z=t[3] } self:Teleport{ pos = xSplit} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- walkspeed if name == "pathspeed" then self:SetPathingSpeed{speed = value} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- removeOBJ if name == "removeNPC" then -- remove Objects in X local foundObj = self:GetProximityObjects { name = "KillOBJS"}.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetFaction().faction == value then foundObj[i]:MoveToDeleteQueue() end end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- - Change WP if name == "changeWP" then-- 1 -- trigger a callback for waypoint changing if (onTemplateChangeWaypoints) and (onTemplateChangeWaypoints(self, msg) == true ) then return end if string.find (value, ",") then self:SetVar("isTable", true ) else self:SetVar("isTable", false ) end if (self:GetVar("isTable")) then local s = value local t = split(s, ',') self:SetVar("WPEvent_NUM", 1) self:SetVar("attached_path", t[1]) self:SetVar("attached_path_start", t[2] ) self:FollowWaypoints{ bUseNewPath = true, newPathName = t[1], newStartingPoint = t[2] } else self:SetVar("WPEvent_NUM", 1) self:SetVar("attached_path", value) self:SetVar("attached_path_start", 0 ) self:FollowWaypoints{ bUseNewPath = true, newPathName = value, newStartingPoint = 0 } end end if name == "DeleteSelf" then GAMEOBJ:DeleteObject(self) end ----------------------- - killSelf if name == "killself" and value == "noValue" then -- 2 - Kill Self self:Die{ killerID = self, killType = "SILENT" } elseif name == "killself" and value >=1 then --GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DealyKillSelf", self ) SetStoreTimmer(value,"DealyKillSelf",self) end ----------------------- - killSelf if name == "removeself" then-- 2 - Kill Self self:MoveToDeleteQueue() end ----------------------- - spawn Object if name == "spawnOBJ" then -- 3 - Spawn Object --RESMGR:LoadObject { objectTemplate = value , x = self:GetPosition().pos.x , y = self:GetPosition().pos.y , z = self:GetPosition().pos.z ,owner = self } local mypos = self:GetPosition().pos local myRot = self:GetRotation() self:Die{killType = "SILENT"} if self:GetVar("pathset") ~= nil then local config = { {"pathset", self:GetVar("pathset") } ,{"SpawnedVar", self:GetVar("SpawnedVar") } } RESMGR:LoadObject { objectTemplate = value, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config } else RESMGR:LoadObject { objectTemplate = value, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end end function onStartup(self) print "Zone Script Started *************************************" end function onPickupItem(self,msg) print "onPickupItem ****************" end ----------------------------------------------------------------------- --script letting the survival switch know when the rebuild is complete ----------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "SurSwitch", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "BarrelBuilt", ObjIDSender = self} end end end----------------------------------------------------------------- --Spider Boss 1 script ----------------------------------------------------------------- function onStartup(self) self:AddObjectToGroup{group = "SpiderBossPhase1"} self:PlayFXEffect{name = "imaginationexplosion", effectID = 1034, effectType = "cast"} self:SetVar("HitTime", 1.8) self:SetVar("StunTime", 15) self:SetVar("AttackModDelay", 20) self:SetVar("AttackModTime", 5) --self:SetVar("AttackingModules", false) local group = self:GetObjectsInGroup{group = "BossInteracts", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then --spider doesn't hate the coils here-- self:AddThreatRating{newThreatObjID = object, ThreatToAdd = -1000} end end GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("AttackModDelay"), "AttackDelay", self) end function onNotifyObject(self, msg) if msg.name == "Boom" then --print("Spider BOOM!") self:PlayAnimation{animationID = "spider-laser"} self:ActivityTimerStopAllTimers() self:TimerCancelled{name = "AttackDelay"} self:TimerCancelled{name = "AttackTime"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("HitTime") , "HitTime", self ) end end function onTimerDone(self, msg) if msg.name == "AttackDelay" then --self:SetVar("AttackingModules", true) --print("spider attacking the modules!") local group = self:GetObjectsInGroup{group = "BossInteracts", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then --spider HATES the coils here-- self:AddThreatRating{newThreatObjID = object, ThreatToAdd = 2000} end end GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("AttackModTime"), "AttackTime", self) elseif msg.name == "AttackTime" then --self:SetVar("AttackingModules", false) --print("spider attacking the player!") local group = self:GetObjectsInGroup{group = "BossInteracts", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then --spider doesn't hate the coils here-- self:AddThreatRating{newThreatObjID = object, ThreatToAdd = -2000} end end GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("AttackModDelay"), "AttackDelay", self) elseif msg.name == "HitTime" then --print("the spider is stunned... ATTACK!") self:SetFaction{faction = 110} self:PlayAnimation{animationID = "spider-stun"} GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("StunTime"), "StunFinished", self) self:ClearThreatList() elseif msg.name == "StunFinished" then --print("the spider isn't stunned... RUN!") self:SetFaction{faction = 38} self:PlayAnimation{animationID = "idle"} local group = self:GetObjectsInGroup{group = "BossInteracts", ignoreSpawners = true}.objects self:ClearThreatList() for i, object in pairs(group) do if object then --spider doesn't hate the coils here-- self:AddThreatRating{newThreatObjID = object, ThreatToAdd = -1000} end end GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("AttackModDelay"), "AttackDelay", self) --[[if self:GetVar("AttackingModules") == true then GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("AttackModTime"), "AttackTime", self) else GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("AttackModDelay"), "AttackDelay", self) end--]] end end function onOnHit(self, msg) self:PlayAnimation{animationID = "spider-stun"} end function onDie(self, msg) local object = self:GetObjectsInGroup{group = "Coil", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "bigboomsupercharge", effecdID = 580, effectType = "create"} object:Die() print("destroying the coil") end local group = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects for i, object in pairs(group) do object:NotifyObject{name = "CoilDestroyed", ObjIDSender = self} print("telling the switch that the coil is dead") end local group = self:GetObjectsInGroup{group = "BossPipes", ignoreSpawners = true}.objects for i, object in pairs(group) do object:Die() end local spawnerObj = LEVEL:GetSpawnerByName("BossTurBase") if spawnerObj then spawnerObj:SpawnerActivate() end local spawnerObj = LEVEL:GetSpawnerByName("BossTurret") if spawnerObj then spawnerObj:SpawnerActivate() end local spawnerObj = LEVEL:GetSpawnerByName("SpiderBoss3") if spawnerObj then spawnerObj:SpawnerActivate() end end----------------------------------------------------------------- --Spider Boss 2 script ----------------------------------------------------------------- function onStartup(self) local group = self:GetObjectsInGroup{group = "BossInteracts", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then --spider doesn't hate the coils here-- self:AddThreatRating{newThreatObjID = object, ThreatToAdd = -1000} end end end------------------------------------------------------------------------------- --script for first boss rebuild module ------------------------------------------------------------------------------- function onStartup(self) self:SetVar("SpiderSpawned", false) self:SetVar("CoilSmashDown", false) --self:SetVar("Mod2SmashDown", false) end function onRebuildNotifyState(self, msg) --print("the rebuild state is: "..msg.iState) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "FinalModule", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end if self:GetVar("CoilSmashDown") == true then print("module 1 talking to coil module QB") local object2 = self:GetObjectsInGroup{group = "CoilModule", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "ModuleOneUp", ObjIDSender = self} end elseif self:GetVar("CoilSmashDown") == false then print("module 1 talking to coil module smashable") local object2 = self:GetObjectsInGroup{group = "CoilModSmash", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "ModuleOneUp", ObjIDSender = self} end end if self:GetVar("SpiderSpawned") == false then self:SetVar("SpiderSpawned", true) local spawnerObj = LEVEL:GetSpawnerByName("SpiderBoss2") if spawnerObj then print("spawning spider boss!") spawnerObj:SpawnerActivate() --spawnerObj:SpawnerDeactivate() end end elseif msg.iState == 4 then print("module 1 destroyed!") if self:GetVar("CoilSmashDown") == true then local object = self:GetObjectsInGroup{group = "CoilModule", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleOneDown", ObjIDSender = self} end else local object = self:GetObjectsInGroup{group = "CoilModSmash", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleOneDown", ObjIDSender = self} end end local object = self:GetObjectsInGroup{group = "FinalModule", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "moviespotlight"} end end end function onNotifyObject(self, msg) if msg.name == "ModuleCoilSmashDown" then print("module 1 knows that the coil module was smashed") self:SetVar("CoilSmashDown", true) end end---------------------------------------------------------- --script for one of the spider den modules ---------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 4 then local object = self:GetObjectsInGroup{group = "BossQBMod1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleTwoDown", ObjIDSender = self} end elseif msg.iState == 2 then local object2 = self:GetObjectsInGroup{group = "BossQBMod1", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "ModuleTwoUp", ObjIDSender = self} end end end---------------------------------------------------------------------- --Script for the coil module to power the coil/turret and the switches ---------------------------------------------------------------------- function onRebuildNotifyState(self, msg) ------------------------------------------------------ --if the module is destroyed then turn off the effects and disable the switches-- ------------------------------------------------------ if msg.iState == 4 then local object = self:GetObjectsInGroup{group = "BossQBMod1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleCoilDown", ObjIDSender = self} end elseif msg.iState == 2 then local object = self:GetObjectsInGroup{group = "BossQBMod1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleCoilUp", ObjIDSender = self} end end end------------------------------------------------------------------------ --script for the spider cave QB boss module 1 ------------------------------------------------------------------------ function onStartup(self) self:SetVar("IAmBuilt", false) self:SetVar("SpiderSpawned", false) self:SetVar("CoilSmashDown", false) self:SetVar("Mod2SmashDown", false) self:SetVar("ModuleTwoIsBuilt", true) self:SetVar("CoilModIsBuilt", true) --print("qb module 1 starting up!") end function onRebuildNotifyState(self, msg) --print("updating rebuild state!") if msg.iState == 2 then self:SetVar("IAmBuilt", true) local object = self:GetObjectsInGroup{group = "FinalModule", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end if self:GetVar("SpiderSpawned") == false then --print("spawning the spider!") self:SetVar("SpiderSpawned", true) local spawnerObj = LEVEL:GetSpawnerByName("SpiderBoss2") if spawnerObj then --print("spawning spider boss!") spawnerObj:SpawnerActivate() --spawnerObj:SpawnerDeactivate() end end if self:GetVar("ModuleTwoIsBuilt") == true and self:GetVar("CoilModIsBuilt") == true then -------------------------------------------------------------------------------- --telling the switches to enable their effects and that they are ready to fire-- -------------------------------------------------------------------------------- print("everything is up!") local group = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "AllUp", ObjIDSender = self} object:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end if self:GetVar("Mod2SmashDown") == false then ----------------------------------------------------------------- --tell the 2nd smashable module that it is ready for the effect-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModSmash2", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end elseif self:GetVar("Mod2SmashDown") == true then ----------------------------------------------------------------- --tell the 2nd module QB that it is ready for the effect-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModule2", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end end end elseif msg.iState == 4 then ------------------------------------------------------------------ --tell all modules and switches that the main power is destroyed-- ------------------------------------------------------------------ print("module 1 destroyed!") self:SetVar("IAmBuilt", false) -------------------------------------------------------------------------------- --telling the switches to enable their effects and that they are ready to fire-- -------------------------------------------------------------------------------- local group = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "AllDown", ObjIDSender = self} object:StopFXEffect{name = "sirenlight_B"} end end ----------------------------------------------------------------- --tell the module that it is stopping the effect-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModule", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "moviespotlight"} end if self:GetVar("Mod2SmashDown") == false then ----------------------------------------------------------------- --tell the 2nd smashable module that it is stopping the effect-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModSmash2", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "moviespotlight"} end elseif self:GetVar("Mod2SmashDown") == true then ----------------------------------------------------------------- --tell the 2nd module QB that it is stopping the effect if the 2nd --smashable hasn't been smashed yet-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModule2", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "moviespotlight"} end end end end function onNotifyObject(self, msg) if msg.name == "ModuleTwoSmashDown" then self:SetVar("Mod2SmashDown", true) self:SetVar("ModuleTwoIsBuilt", false) print("module 2 smashable down") elseif msg.name == "ModuleTwoDown" then self:SetVar("ModuleTwoIsBuilt", false) print("module 2 down") elseif msg.name == "ModuleTwoUp" then self:SetVar("ModuleTwoIsBuilt", true) print("module 2 up") elseif msg.name == "ModuleCoilSmashDown" then self:SetVar("CoilSmashDown", true) self:SetVar("CoilModIsBuilt", false) print("coil module smashable is down") elseif msg.name == "ModuleCoilDown" then self:SetVar("CoilModIsBuilt", false) print("coil module is down") elseif msg.name == "ModuleCoilUp" then self:SetVar("CoilModIsBuilt", true) print("coil module is up") end if self:GetVar("IAmBuilt") == true and self:GetVar("ModuleTwoIsBuilt") == true and self:GetVar("CoilModIsBuilt") == true then -------------------------------------------------------------------------------- --telling the switches to enable their effects and that they are ready to fire-- -------------------------------------------------------------------------------- print("everything is up!") local group = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "AllUp", ObjIDSender = self} object:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end if self:GetVar("Mod2SmashDown") == false then ----------------------------------------------------------------- --tell the 2nd smashable module that it is ready for the effect-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModSmash2", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end elseif self:GetVar("Mod2SmashDown") == true then ----------------------------------------------------------------- --tell the 2nd module QB that it is ready for the effect-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModule2", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end end elseif self:GetVar("ModuleTwoIsBuilt") == false or self:GetVar("CoilModIsBuilt") == false then -------------------------------------------------------------------------------- --telling the switches to enable their effects and that they are ready to fire-- -------------------------------------------------------------------------------- local group = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "AllDown", ObjIDSender = self} object:StopFXEffect{name = "sirenlight_B"} end end if self:GetVar("Mod2SmashDown") == false then ----------------------------------------------------------------- --tell the 2nd smashable module that it is stopping the effect-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModSmash2", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "moviespotlight"} end elseif self:GetVar("Mod2SmashDown") == true then ----------------------------------------------------------------- --tell the 2nd module QB that it is stopping the effect if the 2nd --smashable hasn't been smashed yet-- ----------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "FinalModule2", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "moviespotlight"} end end end end---------------------------------------------------------------- --script for the sentinel module to spawn a quick build once destroyed ---------------------------------------------------------------- function onDie(self) local spawnerObj = LEVEL:GetSpawnerByName("BossMod2") if spawnerObj then print("spawning QB module 2!") spawnerObj:SpawnerActivate() --spawnerObj:SpawnerDeactivate() end local object = self:GetObjectsInGroup{group = "BossQBMod1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleTwoSmashDown", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleTwoSmashDown", ObjIDSender = self} end end---------------------------------------------------------------- --script for the sentinel module to spawn a quick build once destroyed ---------------------------------------------------------------- function onDie(self) local spawnerObj = LEVEL:GetSpawnerByName("BossCoilMod") if spawnerObj then print("spawning QB module COIL!") spawnerObj:SpawnerActivate() --spawnerObj:SpawnerDeactivate() end local object = self:GetObjectsInGroup{group = "BossQBMod1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleCoilSmashDown", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleCoilSmashDown", ObjIDSender = self} end end---------------------------------------------------- --switch that fires the coil/turret once all the modules are built ---------------------------------------------------- local HitTime = 1.8 function onStartup(self) self:SetVar("AmActive", false) self:SetVar("Switch2Active", false) self:SetVar("AmPowered", false) self:SetVar("CoilSmashDown", false) self:SetVar("Mod2SmashDown", false) self:SetVar("CoilDown", false) self:SetVar("TurretUp", false) self:SetVar("TurretBaseUp", false) self:SetVar("FiredOnce", false) end function onFireEvent(self, msg) if msg.args == "down" then --print("pressed down") if self:GetVar("CoilDown") == true and self:GetVar("TurretUp") == true and self:GetVar("TurretBaseUp") == true and self:GetVar("AmPowered") == true and self:GetVar("FiredOnce") == false then print("everything activated") self:SetVar("FiredOnce", true) --------------------------------------------------------------------------- --fire the super turret-- --------------------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "Turret", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end --------------------------------------------------------------------------- --play spider "stunned" animation-- --------------------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "SpiderBossPhase2", ignoreSpawners = true}.objects[1] if object then object:PlayAnimation{animationID = "spider-laser"} object:PlayFXEffect{name = "imaginationexplosion", effectID = 1034, effectType = "cast"} GAMEOBJ:GetTimer():AddTimerWithCancel(HitTime, "HitTime", self ) end elseif self:GetVar("AmPowered") == true and self:GetVar("CoilDown") == false then --------------------------------------------------------------------------- --pick a random module to smash-- --------------------------------------------------------------------------- local BreakThisModule = math.random(3) local Module1 = 1 local Module2 = 2 local Module3 = 3 print("smashing module: " .. BreakThisModule) --------------------------------------------------------------------------- --play the effect on the coil-- --------------------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "Coil", ignoreSpawners = true}.objects[1] if object then --print("playing effect on the coil") object:PlayFXEffect{name = "imaginationexplosion", effectID = 1034, effectType = "cast"} end --------------------------------------------------------------------------- --figure out which module to smash-- --------------------------------------------------------------------------- if BreakThisModule == Module1 then local object = self:GetObjectsInGroup{group = "BossQBMod1", ignoreSpawners = true}.objects[1] if object then object:Die() end elseif BreakThisModule == Module2 then if self:GetVar("Mod2SmashDown") == false then local object = self:GetObjectsInGroup{group = "FinalModSmash2", ignoreSpawners = true}.objects[1] if object then object:Die() end elseif self:GetVar("Mod2SmashDown") == true then local object = self:GetObjectsInGroup{group = "FinalModule2", ignoreSpawners = true}.objects[1] if object then object:Die() end end elseif BreakThisModule == Module3 then if self:GetVar("CoilSmashDown") == false then local object = self:GetObjectsInGroup{group = "CoilModSmash", ignoreSpawners = true}.objects[1] if object then object:Die() end elseif self:GetVar("CoilSmashDown") == true then local object = self:GetObjectsInGroup{group = "CoilModule", ignoreSpawners = true}.objects[1] if object then object:Die() end end end --------------------------------------------------------------------------- --telling the spider boss that it should be stunned-- --------------------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "SpiderBossPhase1", ignoreSpawners = true}.objects[1] if object then print("boom!") object:NotifyObject{name = "Boom"} end end end end function onTimerDone(self, msg) ---------------------------------------------------------------------- --kill the spider!-- ---------------------------------------------------------------------- local object = self:GetObjectsInGroup{group = "SpiderBossPhase2", ignoreSpawners = true}.objects[1] if object then object:Die() end local object = self:GetObjectsInGroup{group = "Turret", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "moviespotlight"} end local posString = self:CreatePositionString{ x = -612.46, y = -481.69, z = 110.97 }.string local config = { {"rebuild_activators", posString }, {"respawn", 100000 }, {"rebuild_reset_time", -1}, {"no_timed_spawn", true} } --print("spawning QB") RESMGR:LoadObject { objectTemplate = 6447, x= -599.35, y= -481.8 , z= 76.62, ry= 17.00, configData = config } end function onNotifyObject(self, msg) if msg.name == "AllUp" then self:SetVar("AmPowered", true) --print("the switch is powered!") elseif msg.name == "AllDown" then self:SetVar("AmPowered", false) elseif msg.name == "ModuleTwoSmashDown" then self:SetVar("Mod2SmashDown", true) elseif msg.name == "ModuleCoilSmashDown" then self:SetVar("CoilSmashDown", true) elseif msg.name == "CoilDestroyed" then self:SetVar("CoilDown", true) print("the coil is destroyed") elseif msg.name == "TurretBuilt" then self:SetVar("TurretUp", true) print("turret is built") elseif msg.name == "TurretBaseBuilt" then self:SetVar("TurretBaseUp", true) print("turret base is built") end end--------------------------------------------------------------- --script for the turret telling the switches when it is built --------------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local group = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "TurretBuilt", ObjIDSender = self} end end end end--------------------------------------------------------------- --script for the turret base telling the switches when it is built --------------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local group = self:GetObjectsInGroup{group = "FinalSwitch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "TurretBaseBuilt", ObjIDSender = self} end end end end------------------------------------------------------------ --script for the first broken paradox pipe ------------------------------------------------------------ function onStartup(self) self:PlayFXEffect{name = "maelstromobject", effectID = 549, effectType = "create"} end----------------------------------------------------------------- --script telling the fuse/platform to blow up the barrel when it reaches the final waypoint ----------------------------------------------------------------- function onArrived(self, msg) if msg.wayPoint == 1 then local object = self:GetObjectsInGroup{group = "Barrel", ignoreSpawners = true}.objects[1] if object then --object:PlayFXEffect{name = "bigboomsupercharge", effectID = 580, effectType = "create"} object:Die() end local object2 = self:GetObjectsInGroup{group = "SurBoulder", ignoreSpawners = true}.objects[1] if object2 then object2:Die() end local spawnerObj = LEVEL:GetSpawnerByName("SurSpiders") if spawnerObj then spawnerObj:SpawnerDeactivate() spawnerObj:SpawnerDestroyObjects() end --[[local object3 = self:GetObjectsInGroup{group = "SurRock", ignoreSpawners = true}.objects[1] if object3 then object3:Die() end--]] self:StopFXEffect{name = "firebrick"} self:PlayFXEffect{name = "bigboomsupercharge", effectID = 580, effectType = "create"} self:PlayFXEffect{name = "imaginationexplosion", effectID = 1034, effectType = "cast"} end end-------------------------------------------------------------------- --script for switch telling the horizontal moving platforms to stop pathing -------------------------------------------------------------------- function onStartup(self) self:SetVar("SentinelModuleBuilt", false) end function onNotifyObject(self, msg) if msg.name == "IAmBuilt" then self:SetVar("SentinelModuleBuilt", true) self:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end function onFireEvent(self, msg) if self:GetVar("SentinelModuleBuilt") == true then if msg.args == "down" then local group = self:GetObjectsInGroup{group = "Pit1Platforms", ignoreSpawners = true}.objects for i, object in pairs(group) do object:StopPathing() end elseif msg.args == "up" then local group = self:GetObjectsInGroup{group = "Pit1Platforms", ignoreSpawners = true}.objects for i, object in pairs(group) do object:StartPathing() end end end end----------------------------------------------------------- --script to fire the laser at the maelstrom infected rocks ----------------------------------------------------------- function onStartup(self) self:SetVar("effectTime", 2) self:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end function onNotifyObject(self, msg) if msg.name == "StopLaser" then self:StopFXEffect{name = "moviespotlight"} end end function onArrived(self, msg) print("arrived at waypoint: " .. msg.wayPoint) if msg.wayPoint == 1 then self:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("effectTime") , "effectTime", self ) end end function onTimerDone(self, msg) local object = self:GetObjectsInGroup{group = "MaelstromRock", ignoreSpawners = true}.objects[1] if object then object:Die() end self:StopFXEffect{name = "moviespotlight"} end-------------------------------------------------------------------- --switch that tells the mining laser to stop firing while it's in motion -------------------------------------------------------------------- function onFireEvent(self, msg) local object = self:GetObjectsInGroup{group = "MLaser", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = false} object:NotifyObject{name = "StopLaser", ObjIDSender = self} end end----------------------------------------------------------- --script telling the effects to play on the first "cable" in the spider cave ----------------------------------------------------------- function onStartup(self) self:SetVar("PipeUp", false) self:SetVar("IAmBuilt", false) end function onNotifyObject(self, msg) if msg.name == "PipeFixed" then --print("I know the pipe is fixed!") self:SetVar("PipeUp", true) if self:GetVar("IAmBuilt") == true then self:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} --[[local object2 = self:GetObjectsInGroup{group = "Teleporter", ignoreSpawners = true}.objects[1] if object2 then object2:PlayFXEffect{name = "starkglow", effectID = 935, effectType = "create"} object2:PlayFXEffect{name = "blueglowbrick", effectID = 252, effectType = "create"} object2:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} end--]] local group = self:GetObjectsInGroup{group = "Switch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end --[[local object4 = self:GetObjectsInGroup{group = "teleportSwitch1", ignoreSpawners = true}.objects[1] if object4 then object4:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end local object5 = self:GetObjectsInGroup{group = "teleportSwitch2", ignoreSpawners = true}.objects[1] if object5 then object5:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end--]] end end end function onRebuildNotifyState(self, msg) if msg.iState == 2 then self:SetVar("IAmBuilt", true) if self:GetVar("PipeUp") == true then self:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} --[[local object2 = self:GetObjectsInGroup{group = "Teleporter", ignoreSpawners = true}.objects[1] if object2 then object2:PlayFXEffect{name = "starkglow", effectID = 935, effectType = "create"} object2:PlayFXEffect{name = "blueglowbrick", effectID = 252, effectType = "create"} object2:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} end--]] local group = self:GetObjectsInGroup{group = "Switch", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end --[[local object4 = self:GetObjectsInGroup{group = "teleportSwitch1", ignoreSpawners = true}.objects[1] if object4 then object4:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end local object5 = self:GetObjectsInGroup{group = "teleportSwitch2", ignoreSpawners = true}.objects[1] if object5 then object5:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end--]] end end end-------------------------------------------------------- --Script on the module to tell the switch that it is built -------------------------------------------------------- function onStartup(self) --print("starting up module 1") end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then --[[local object = self:GetObjectsInGroup{group = "PlatformSwitch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end local object3 = self:GetObjectsInGroup{group = "PlatformSwitch2", ignoreSpawners = true}.objects[1] if object3 then object3:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object3:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end local object2 = self:GetObjectsInGroup{group = "Module2", ignoreSpawners = true}.objects[1] if object2 then --print("playing effect") object2:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end--]] local object = self:GetObjectsInGroup{group = "platform2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} end end end----------------------------------------------------------- --script telling the effects to play on the first "cable" in the spider cave ----------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then self:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} --[[local group = self:GetObjectsInGroup{group = "Switch3", ignoreSpawners = true}.objects for i, object2 in pairs(group) do if object2 then object2:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object2:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end--]] local group = self:GetObjectsInGroup{group = "Switch4", ignoreSpawners = true}.objects for i, object3 in pairs(group) do if object3 then object3:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object3:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end local object4 = self:GetObjectsInGroup{group = "SpiderPlatform", ignoreSpawners = true}.objects[1] if object4 then print("found object") object4:StartPathing() end end end----------------------------------------------------------- --script telling the effects to play on the first "cable" in the spider cave ----------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local group = self:GetObjectsInGroup{group = "Module4", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end end local object3 = self:GetObjectsInGroup{group = "SpiderBoss1", ignoreSpawners = true}.objects[1] if object3 then object3:NotifyObject{name = "shocked", ObjIDSender = self} end local group2 = self:GetObjectsInGroup{group = "Switch5", ignoreSpawners = true}.objects for i, object2 in pairs(group2) do if object2 then object2:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object2:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end end end----------------------------------------------------------- --script telling the effects to play on the first "cable" in the spider cave ----------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "ModuleIntro", ignoreSpawners = true}.objects[1] if object then object:PlayFXEffect{name = "moviespotlight", effectID = 503, effectType = "create"} end local object2 = self:GetObjectsInGroup{group = "SwitchIntro", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "ModuleBuilt", ObjIDSender = self} object2:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} end end end------------------------------------------------------ --script telling the module when when the pipe is repaired ------------------------------------------------------ function onRebuildNotifyState(self, msg) if msg.iState == 2 then --print("pipe fixed") local object = self:GetObjectsInGroup{group = "QBModule1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "PipeFixed", ObjIDSender = self} end --[[local object = self:GetObjectsInGroup{group = "brokenPipe1", ignoreSpawners = true}.objects[1] if object then object:StopFXEffect{name = "maelstromobject"} end--]] end end----------------------------------------------------------------- --once the qb is built it notifies the switches that they will function on the platforms ----------------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local group = self:GetObjectsInGroup{group = "Pit1Switches", ignoreSpawners = true}.objects for i, object in pairs(group) do object:NotifyObject{ name = "IAmBuilt" } end end end------------------------------------------------------------------- --script to have the switches all play nice with each other when multiple people are stepping on them (they activate the same platforms ------------------------------------------------------------------- function onStartup(self) self:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} --self:SetVar("IAMengaged", false) self:SetVar("Switch2IsEngaged", false) end function onNotifyObject(self, msg) if msg.name == "Switch2Pressed" then self:SetVar("Switch2IsEngaged", true) elseif msg.name == "Switch2Depressed" then self:SetVar("Switch2IsEngaged", false) end end function onFireEvent(self, msg) if msg.args == "down" then --self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch1Pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "PitPlatform1", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then --self:SetVar("IAMengaged", false) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch1Depressed", ObjIDSender = self} end if self:GetVar("Switch2IsEngaged") == false then local object = self:GetObjectsInGroup{group = "PitPlatform1", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end------------------------------------------------------------------- --script to have the switches all play nice with each other when multiple people are stepping on them (they activate the same platforms) ------------------------------------------------------------------- function onStartup(self) self:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} --self:SetVar("IAMengaged", false) self:SetVar("Switch1IsEngaged", false) self:SetVar("Switch3IsEngaged", false) end function onNotifyObject(self, msg) if msg.name == "Switch1Pressed" then self:SetVar("Switch1IsEngaged", true) elseif msg.name == "Switch1Depressed" then self:SetVar("Switch1IsEngaged", false) elseif msg.name == "Switch3Pressed" then self:SetVar("Switch3IsEngaged", true) elseif msg.name == "Switch3Depressed" then self:SetVar("Switch3IsEngaged", false) end end function onFireEvent(self, msg) if msg.args == "down" then --self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch2Pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPitSwitch3", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch2Pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "PitPlatform1", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end local object = self:GetObjectsInGroup{group = "PitPlatform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then --self:SetVar("IAMengaged", false) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch2Depressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPitSwitch3", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch2Depressed", ObjIDSender = self} end if self:GetVar("Switch1IsEngaged") == false then local object = self:GetObjectsInGroup{group = "PitPlatform1", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end if self:GetVar("Switch3IsEngaged") == false then local object = self:GetObjectsInGroup{group = "PitPlatform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end------------------------------------------------------------------- --script to have the switches all play nice with each other when multiple people are stepping on them (they activate the same platforms) ------------------------------------------------------------------- function onStartup(self) self:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} --self:SetVar("IAMengaged", false) self:SetVar("Switch2IsEngaged", false) self:SetVar("Switch4IsEngaged", false) end function onNotifyObject(self, msg) if msg.name == "Switch2Pressed" then self:SetVar("Switch2IsEngaged", true) elseif msg.name == "Switch2Depressed" then self:SetVar("Switch2IsEngaged", false) elseif msg.name == "Switch4Pressed" then self:SetVar("Switch4IsEngaged", true) elseif msg.name == "Switch4Depressed" then self:SetVar("Switch4IsEngaged", false) end end function onFireEvent(self, msg) if msg.args == "down" then --self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch3Pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPitSwitch4", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch3Pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "PitPlatform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end local object = self:GetObjectsInGroup{group = "PitPlatform3", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then --self:SetVar("IAMengaged", false) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch3Depressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPitSwitch4", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch3Depressed", ObjIDSender = self} end if self:GetVar("Switch2IsEngaged") == false then local object = self:GetObjectsInGroup{group = "PitPlatform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end if self:GetVar("Switch4IsEngaged") == false then local object = self:GetObjectsInGroup{group = "PitPlatform3", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end------------------------------------------------------------------- --script to have the switches all play nice with each other when multiple people are stepping on them (they activate the same platforms ------------------------------------------------------------------- function onStartup(self) self:PlayFXEffect{name = "sirenlight_B", effectID = 242, effectType = "orange"} --self:SetVar("IAMengaged", false) self:SetVar("Switch3IsEngaged", false) end function onNotifyObject(self, msg) if msg.name == "Switch3Pressed" then self:SetVar("Switch3IsEngaged", true) elseif msg.name == "Switch3Depressed" then self:SetVar("Switch3IsEngaged", false) end end function onFireEvent(self, msg) if msg.args == "down" then --self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch3", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch4Pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "PitPlatform3", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then --self:SetVar("IAMengaged", false) local object = self:GetObjectsInGroup{group = "SpiderPitSwitch3", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "Switch4Depressed", ObjIDSender = self} end if self:GetVar("Switch3IsEngaged") == false then local object = self:GetObjectsInGroup{group = "PitPlatform3", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end-------------------------------------------------------- --Script on the module to tell the switch that it is built -------------------------------------------------------- function onStartup(self) --print("starting up platform 2") self:SetVar("ModuleUp", false) self:SetVar("IAMbuilt", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then self:SetVar("ModuleUp", true) if self:GetVar("IAMbuilt") == true then self:StartPathing() end end end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then self:SetVar("IAMbuilt", true) if self:GetVar("ModuleUp") == true then self:StartPathing() end --[[local object = self:GetObjectsInGroup{group = "PlatformSwitch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "PlatformBuilt", ObjIDSender = self} end local object2 = self:GetObjectsInGroup{group = "PlatformSwitch2", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "PlatformBuilt", ObjIDSender = self} end--]] end end----------------------------------------------------------------------- --script to change the camera when the player enters a volume in the first spider encounter area ----------------------------------------------------------------------- function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then --local playerAsID = GAMEOBJ:GetLocalCharID() --local player = GAMEOBJ:GetObjectByID(playerAsID) CAMERA:ActivateCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetRenderCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetCameraLookAtPoint("CAMERA_SIDE_SCROLLER", -1, -0.25, -0.3) CAMERA:SetCameraZoom("CAMERA_SIDE_SCROLLER", 90) end end----------------------------------------------------------------------- --script to change the camera when the player enters a volume in the first spider encounter area ----------------------------------------------------------------------- function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then --local playerAsID = GAMEOBJ:GetLocalCharID() --local player = GAMEOBJ:GetObjectByID(playerAsID) CAMERA:ActivateCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetRenderCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetCameraLookAtPoint("CAMERA_SIDE_SCROLLER", -1, -0.3, 0) CAMERA:SetCameraZoom("CAMERA_SIDE_SCROLLER", 50) end end----------------------------------------------------------------------- --script ending the side scrolling camera ----------------------------------------------------------------------- function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then CAMERA:SetToPrevGameCam() end endfunction onStartup(self) self:SetVar("HitTime", 3) local group = self:GetObjectsInGroup{group = "SpiderWall", ignoreSpawners = true}.objects for i, object in pairs(group) do if (object:GetLOT().objtemplate == 6463) then print("setting wall") self:AddThreatRating{newThreatObjID = object, ThreatToAdd = -1000} end end end function onNotifyObject(self, msg) --print("spider got a message!") if msg.name == "shocked" then self:PlayAnimation{animationID = "spider-electrocute"} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("HitTime") , "HitTime", self ) end end function onTimerDone(self, msg) self:Die() end--------------------------------------------------------------------------- --tells the client to play a cinematic --------------------------------------------------------------------------- function onCollisionPhantom(self, msg) self:NotifyClientObject{name = "playCine"} end--------------------------------------------------------------------------- --tells the client to play a cinematic --------------------------------------------------------------------------- function onStartup(self) self:SetVar("haveplayedCine", false) end function onCollisionPhantom(self, msg) if msg.objectID:IsCharacter().isChar and self:GetVar("haveplayedCine") == false then self:SetVar("haveplayedCine", true) local playerAsID = GAMEOBJ:GetLocalCharID() local player = GAMEOBJ:GetObjectByID(playerAsID) player:PlayCinematic{pathName = "SpiderCine1"} end end-------------------------------------------------------------- --script telling the switch to start the moving platform/fuse -------------------------------------------------------------- function onStartup(self) --print("survival switch starting up") self:SetVar("BarrelUp", false) self:SetVar("HavePlayedOnce", false) end function onNotifyObject(self, msg) --print("switch got a message") if msg.name == "BarrelBuilt" then self:SetVar("BarrelUp", true) end end function onFireEvent(self, msg) --print("event fired") if self:GetVar("BarrelUp") == true and self:GetVar("HavePlayedOnce") == false then self:SetVar("HavePlayedOnce", true) local object = self:GetObjectsInGroup{group = "Fuse", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = false} object:PlayFXEffect{name = "firebrick", effectID = 270, effectType = "create"} end --[[local object2 = self:GetObjectsInGroup{group = "SurRock", ignoreSpawners = true}.objects[1] if object2 then object2:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = false} end--]] local spawnerObj = LEVEL:GetSpawnerByName("SurSpiders") if spawnerObj then spawnerObj:SpawnerActivate() spawnerObj:SpawnerReset() end end end------------------------------------------------------------ --script telling the switch to only activate once the module is complete ------------------------------------------------------------ function onStartup(self) self:SetVar("ModuleUp", false) end function onNotifyObject(self, msg) --print(" switch notified") if msg.name == "ModuleBuilt" then self:SetVar("ModuleUp", true) end end function onFireEvent(self, msg) --print("event fired") if --[[msg.name == "switchDown" and--]] self:GetVar("ModuleUp") == true then print("switch down") local object = self:GetObjectsInGroup{group = "platform", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end --[[elseif msg.name == "switchUp" then local object = self:GetObjectsInGroup{group = "platform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end--]] end end------------------------------------------------------------ --script telling the switch to only activate once the module is complete ------------------------------------------------------------ function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("PlatformUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) --print(" switch notified") if msg.name == "ModuleBuilt" then self:SetVar("ModuleUp", true) elseif msg.name == "PlatformBuilt" then self:SetVar("PlatformUp", true) elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) print("switch activated") if msg.args == "down" and self:GetVar("ModuleUp") == true and self:GetVar("PlatformUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "PlatformSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "platform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "PlatformSwitch2", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "platform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end------------------------------------------------------------ --script telling the switch to only activate once the module is complete ------------------------------------------------------------ function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("PlatformUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) --print(" switch notified") if msg.name == "ModuleBuilt" then self:SetVar("ModuleUp", true) print("module built") elseif msg.name == "PlatformBuilt" then self:SetVar("PlatformUp", true) print("platform built") elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" and self:GetVar("ModuleUp") == true and self:GetVar("PlatformUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "PlatformSwitch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "platform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "PlatformSwitch1", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "platform2", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then --print("module built") self:SetVar("ModuleUp", true) end end function onFireEvent(self, msg) if self:GetVar("ModuleUp") == true then local object = self:GetObjectsInGroup{group = "SentinelGate", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 2, bAllowPathingDirectionChange = false} end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then --print("module built") self:SetVar("ModuleUp", true) elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" and self:GetVar("ModuleUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPlatform", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "SpiderPSwitch2", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "SpiderPlatform", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then --print("module built") self:SetVar("ModuleUp", true) elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" and self:GetVar("ModuleUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPlatform", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "SpiderPSwitch2", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "SpiderPlatform", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then --print("module built") self:SetVar("ModuleUp", true) elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" and self:GetVar("ModuleUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderP2Switch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPlatformFinal", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "SpiderP2Switch2", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "SpiderPlatformFinal", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then --print("module built") self:SetVar("ModuleUp", true) elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" and self:GetVar("ModuleUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderP2Switch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "SpiderPlatformFinal", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "SpiderP2Switch1", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "SpiderPlatformFinal", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then --print("module built") self:SetVar("ModuleUp", true) elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" and self:GetVar("ModuleUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPsSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local group = self:GetObjectsInGroup{group = "SpiderPlatforms", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "SpiderPsSwitch2", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local group = self:GetObjectsInGroup{group = "SpiderPlatforms", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end end-------------------------------------------------------------------- --script that tells the door to open once the switch is pressed and the module is built -------------------------------------------------------------------- function onStartup(self) self:SetVar("ModuleUp", false) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then --print("module built") self:SetVar("ModuleUp", true) elseif msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" and self:GetVar("ModuleUp") == true then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "SpiderPsSwitch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local group = self:GetObjectsInGroup{group = "SpiderPlatforms", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "SpiderPsSwitch1", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local group = self:GetObjectsInGroup{group = "SpiderPlatforms", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end end---------------------------------------------------------- --This script teleports the player to a moving platform ---------------------------------------------------------- function onStartup(self) --print("teleporter starting up") self:SetVar("ModuleUp", false) self:SetVar("TeleportUp", false) end function onNotifyObject(self, msg) if msg.name == "ModuleBuilt" then self:SetVar("ModuleUp", true) elseif msg.name == "TeleportBuilt" then self:SetVar("TeleportUp", true) end end function onCollisionPhantom(self, msg) --print("teleporting player") if self:GetVar("ModuleUp") == true and self:GetVar("TeleportUp") == true then local object = self:GetObjectsInGroup{group = "teleport", ignoreSpawners = true}.objects[1] if object then local tele = object:GetPosition().pos local player = msg.objectID --local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --player:SetPosition {pos = tele} --print("setting position " .. tele.x .. " " .. tele.y .. " " .. tele.z) --print("player ID" .. GAMEOBJ:GetLocalCharID()) player:Teleport {pos = {x = tele.x + 4, y = tele.y - 10, z = tele.z + 4}, bIgnoreY = false} object:PlayFXEffect{name = "febuildpop", effectID = 105, effectType = "create"} end --self:PlayFXEffect{name = "febuildpop", effectID = 105, effectType = "create"} self:PlayFXEffect{name = "ninjasmoke", effectID = 98, effectType = "create"} end end --player:Teleport {pos = x = tele.x , y = tele.y - 10 , z = tele.z --local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID())------------------------------------------------------------- --script telling the other switch to not send the teleport back when depressed ------------------------------------------------------------- function onStartup(self) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "teleportSwitch2", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "teleport", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "teleportSwitch2", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "teleport", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end------------------------------------------------------------- --script telling the other switch to not send the teleport back when depressed ------------------------------------------------------------- function onStartup(self) self:SetVar("IAMengaged", false) self:SetVar("HEISengaged", false) end function onNotifyObject(self, msg) if msg.name == "pressed" then self:SetVar("HEISengaged", true) elseif msg.name == "depressed" then self:SetVar("HEISengaged", false) end end function onFireEvent(self, msg) if msg.args == "down" then self:SetVar("IAMengaged", true) local object = self:GetObjectsInGroup{group = "teleportSwitch1", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "pressed", ObjIDSender = self} end local object = self:GetObjectsInGroup{group = "teleport", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 1, bAllowPathingDirectionChange = true} end elseif msg.args == "up" then self:SetVar("IAMengaged", false) local object2 = self:GetObjectsInGroup{group = "teleportSwitch1", ignoreSpawners = true}.objects[1] if object2 then object2:NotifyObject{name = "depressed", ObjIDSender = self} end if self:GetVar("HEISengaged") == false then local object = self:GetObjectsInGroup{group = "teleport", ignoreSpawners = true}.objects[1] if object then object:GoToWaypoint{iPathIndex = 0, bAllowPathingDirectionChange = true} end end end end----------------------------------------------------------------------- --script letting the teleporter pad know when the rebuild is complete ----------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if msg.iState == 2 then local object = self:GetObjectsInGroup{group = "Teleporter", ignoreSpawners = true}.objects[1] if object then object:NotifyObject{name = "TeleportBuilt", ObjIDSender = self} end end end------------------------------------------------------ --Spider Egg script ------------------------------------------------------ local interactRadius = 15 local hatchTime = 2.0 function onStartup(self) self:SetVar("hatching", false) self:SetProximityRadius { radius = interactRadius } --print("Egg Startup!") end function onProximityUpdate(self, msg) --print("proximity update!") local isHuman = msg.objId:IsCharacter().isChar --local hatchSpider = 1 --local chanceToHatch = math.random(2) if (msg.status == "ENTER") and (isHuman) and self:GetVar("hatching") == false --[[and (chanceToHatch == hatchSpider)--]] then --print("Look out!") self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} self:CastSkill{skillID = 305} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) --local pos = self:GetPosition().pos --self:Die() --RESMGR:LoadObject { objectTemplate = 6444 , x = pos.x , y = pos.y , z = pos.z , owner = self } --elseif (chanceToHatch ~= hatchSpider) then --print("I'm a dud!") end end function onOnHit(self, msg) print("egg hit!") if self:GetVar("hatching") == false then self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) if msg.attacker:GetLOT().objtemplate ~= 6598 then self:CastSkill{skillID = 305} end end end function onTimerDone(self, msg) --print("timer done!") self:PlayFXEffect{name = "egg_puff_b", effectID = 644, effectType = "create"} local pos = self:GetPosition().pos self:Die() RESMGR:LoadObject { objectTemplate = 6444 , x = pos.x , y = pos.y , z = pos.z , owner = self } end function onNotifyObject(self,msg) if msg.name == "hatch" and self:GetVar("hatching") == false then self:SetVar("hatching", true) self:PlayFXEffect{name = "dropdustmedium", effectID = 52, effectType = "rebuild_medium"} self:CastSkill{skillID = 305} GAMEOBJ:GetTimer():AddTimerWithCancel(hatchTime, "hatchTime", self) end end function onDie(self,msg) local ActivityObj = self:GetObjectsInGroup{ group = "ActivityObj" ,ignoreSpawners = true }.objects ActivityObj:NotifyObject{name = "removeEgg" ,ObjIDSender = self } endfunction onStartup(self) self:SetProximityRadius { radius = 40, name = "far", iconID = 1 } self:SetProximityRadius { radius = 30, name = "mid", iconID = 3 } self:SetProximityRadius { radius = 20, name = "near", iconID = 4 } end function onGetInteractionDetails(self, msg) --msg.IconID = 3417 msg.TextDetails = "Drop your car here, or be punished." local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:DisplayTooltip{bShow=true, strText=""} return msg end -- This function is called when the object starts up or someone requests a pick type update -- Handling this to set pick type on an object, which makes it able to be interactive function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type (Setting to -1 makes something non-interactive) end return msg end --When a player clicks on me, send an update mission task message to the mission system --This is attached to object 6944 --This triggers mission 446, the "eaten by sharks" mission function onUse(self, msg) --msg.user:UpdateMissionTask{taskType = "complete", value = [MISSION_ID], value2 = [how many], target = [lot from DB] } --note that "complete" in this context just means "script task", it doesn't actually mean to complete the entire mission msg.user:UpdateMissionTask{taskType = "complete", value = 445, value2 = 1, target = self} msg.user:UpdateMissionTask{taskType = "complete", value = 446, value2 = 1, target = self} msg.user:UpdateMissionTask{taskType = "complete", value = 447, value2 = 1, target = self} end--When a player clicks on me, send an update mission task message to the mission system --This is attached to object 6944 --This triggers mission 446, the "eaten by sharks" mission function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} -- use native code AI? Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['wanderRadius'] = 50 -- Wander Radius -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 10 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onProximityUpdate(self, msg) if msg.status == "ENTER" and msg.objId:GetPossessedObject().possessedObject:GetID() ~= self:GetID() then print "TIME TO FLY!" msg.objId:PossessObject{ objToPossess = self } end end function onStartup(self) self:SetProximityRadius{ radius = 10 } end local soundID function onOnHit(self, msg) --self:DisplayChatBubble{wsText = "Punches to the face! My one weakness!"}; --soundID = SOUND:StopSequence3D(soundID); --SOUND:StopSequence(soundID); end function onStartup(self) --print("on startup") -- print("should be tacos") -- print(self:GetNetworkVar("tableVar1")) -- print("should be nil") --self.PlayAnimation{ animationID = "idle" } --self:PlayAnimation{ animationID = "idle" } print("I'm alive!") end function onScriptNetworkVarUpdate(self,msg) print("Variables changed!") --print (type(msg.tableOfVars[1][1])) --print (tablemsg.tableOfVars[1]) --print type(msg.tableOfVars[1][1]) local i = 1 while i <= #msg.tableOfVars do print(msg.tableOfVars[i][1]) print(msg.tableOfVars[i][2]) i = i + 1 end if(msg.tableOfVars[1][2] == true ) then print("first var was true!") end end function onStartup(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 4.2, "KillRooster",self ) end function onTimerDone(self, msg) if msg.name == "KillRooster" then self:Die{ killerID = self, killType = "SILENT" } end endrequire('o_mis') function onCollisionPhantom(self, msg) local target = msg.objectID local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z msg.objectID:Knockback{vector={x=playerVelx, y=30,z=playerVelz}} end require('o_mis') function onStartup(self, msg) local BounceControlObject = self:GetObjectsInGroup{ group = "GP_Bounce"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "BounceNotify",self ) storeObjectByName(self, "BounceControlObject", BounceControlObject) end function onTimerDone(self, msg) if msg.name == "BounceNotify" then getObjectByName(self,"BounceControlObject"):NotifyObject{name = "bounceloaded", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local target = msg.objectID local playerVelx = target:GetLinearVelocity().linVelocity.x / 1.5 local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z / 1.5 -- target:PlayAnimation{animationID = "floatpad"} msg.objectID:Knockback{vector={x=playerVelx, y=25,z=playerVelz}} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main')require('o_mis') function onStartup(self, msg) local ControlAllObject = self:GetObjectsInGroup{ group = "GP_ALL"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "AllNotify",self ) storeObjectByName(self, "ControlAllObject", ControlAllObject) end function onTimerDone(self, msg) if msg.name == "AllNotify" then getObjectByName(self,"ControlAllObject"):NotifyObject{name = "totalloaded", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local target = msg.objectID local playerVelx = target:GetLinearVelocity().linVelocity.x / 2 local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z / 2 --target:PlayAnimation{animationID = "floatpad"} msg.objectID:Knockback{vector={x=0, y=40,z=0}} end function onOffCollisionPhantom(self, msg) local target = msg.objectID local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z msg.objectID:Knockback{vector={x=playerVelx, y=20,z=playerVelz}} endrequire('o_mis') function onStartup(self, msg) local ControlBlockerObject = self:GetObjectsInGroup{ group = "GP_ALL"}.objects[1] if ControlBlockerObject then storeObjectByName(self, "ControlBlockerObject", ControlBlockerObject) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "BlockerNotify",self ) else print "Yegge rules" end end function onTimerDone(self, msg) if msg.name == "BlockerNotify" then getObjectByName(self,"ControlBlockerObject"):NotifyObject{name = "totalloaded", ObjIDSender = self} end end require('o_mis') function onStartup(self, msg) local ControlAllObject = self:GetObjectsInGroup{ group = "GP_ALL"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "AllNotify",self ) storeObjectByName(self, "ControlAllObject", ControlAllObject) end function onTimerDone(self, msg) if msg.name == "AllNotify" then getObjectByName(self,"ControlAllObject"):NotifyObject{name = "totalloaded", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local target = msg.objectID local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z msg.objectID:Knockback{vector={x=playerVelx, y=30,z=playerVelz}} end require('o_mis') function onStartup(self, msg) local ControlAllObject = self:GetObjectsInGroup{ group = "GP_ALL"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "AllNotify",self ) storeObjectByName(self, "ControlAllObject", ControlAllObject) end function onTimerDone(self, msg) if msg.name == "AllNotify" then getObjectByName(self,"ControlAllObject"):NotifyObject{name = "totalloaded", ObjIDSender = self} end end require('o_mis') function onStartup(self, msg) local ControlBlockerObject = self:GetObjectsInGroup{ group = "GP_Blocker"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "BlockerNotify",self ) storeObjectByName(self, "ControlBlockerObject", ControlBlockerObject) end function onTimerDone(self, msg) if msg.name == "BlockerNotify" then getObjectByName(self,"ControlBlockerObject"):NotifyObject{name = "blockerloaded", ObjIDSender = self} end end require('o_mis') function onStartup(self, msg) local ControlMiscObject = self:GetObjectsInGroup{ group = "GP_Misc"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "MiscNotify",self ) storeObjectByName(self, "ControlMiscObject", ControlMiscObject) end function onTimerDone(self, msg) if msg.name == "MiscNotify" then getObjectByName(self,"ControlMiscObject"):NotifyObject{name = "miscloaded", ObjIDSender = self} end end require('o_mis') function onStartup(self) endrequire('o_mis') function onStartup(self, msg) local ControlClimberObject = self:GetObjectsInGroup{ group = "GP_Climb"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "ClimberNotify",self ) storeObjectByName(self, "ControlClimberObject", ControlClimberObject) end function onTimerDone(self, msg) if msg.name == "ClimberNotify" then getObjectByName(self,"ControlClimberObject"):NotifyObject{name = "climberloaded", ObjIDSender = self} end endrequire('o_mis') local blockersections = {} local currentBlockerPlaceIndex = 1 local blockerspawns = {5913,5913,5913,5913,5913,5928,5928,5928,5928,5928} local blockeroffset = 0 local currentBlockerLoadIndex = 1 function onUse(self, msg) currentBlockerPlaceIndex = 1 currentBlockerLoadIndex = 1 Deleteblockerspawns() Loadnextblockerspawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "padcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "bouncecancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5901 then friends[i]:NotifyObject{name = "climbercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "misccancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "trapcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "allcancel", ObjIDSender = self} end end end function Loadnextblockerspawn() if currentBlockerLoadIndex <= #blockerspawns then RESMGR:LoadObject {objectTemplate = blockerspawns[currentBlockerLoadIndex], x = -118.31, y = 185.83, z = -470 + blockeroffset, owner = self} blockeroffset = blockeroffset + 5 currentBlockerLoadIndex = currentBlockerLoadIndex + 1 end end function Deleteblockerspawns() for i = 1, #blockersections do GAMEOBJ:DeleteObject(blockersections[i]) end blockersections = {} blockeroffset = 0 currentBlockerPlaceIndex = 1 currentBlockerLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "blockerloaded" then blockersections[#blockersections + 1] = msg.ObjIDSender Loadnextblockerspawn() elseif msg.name == "Selected" then if #blockersections >= currentBlockerPlaceIndex then blockersections[currentBlockerPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} currentBlockerPlaceIndex = currentBlockerPlaceIndex + 1 end elseif msg.name == "Trashed" then if #blockersections >= currentBlockerPlaceIndex then blockersections[currentBlockerPlaceIndex]:SetPosition{pos={x=msg.ObjIDSender:GetPosition{}.pos.x - 200, y=msg.ObjIDSender:GetPosition{}.pos.y, z=msg.ObjIDSender:GetPosition{}.pos.z}} currentBlockerPlaceIndex = currentBlockerPlaceIndex + 1 end elseif msg.name == "blockercancel" then currentBlockerPlaceIndex = 11 currentBlockerLoadIndex = 11 elseif msg.name == "reset" then Deleteblockerspawns() end end require('o_mis') local bouncesections = {} local currentBouncePlaceIndex = 1 local bouncespawns = {5852,5852,5861,5861,5875,5875} local bounceoffset = 0 local currentBounceLoadIndex = 1 function onUse(self, msg) currentBouncePlaceIndex = 1 currentBounceLoadIndex = 1 Deletebouncespawns() Loadnextbouncespawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "padcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5901 then friends[i]:NotifyObject{name = "climbercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "misccancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "trapcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5927 then friends[i]:NotifyObject{name = "blockercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "allcancel", ObjIDSender = self} end end end function Loadnextbouncespawn() if currentBounceLoadIndex <= #bouncespawns then RESMGR:LoadObject {objectTemplate = bouncespawns[currentBounceLoadIndex], x = -111.31, y = 185.23, z = -470 + bounceoffset, owner = self} bounceoffset = bounceoffset + 10 currentBounceLoadIndex = currentBounceLoadIndex + 1 end end function Deletebouncespawns() for i = 1, #bouncesections do GAMEOBJ:DeleteObject(bouncesections[i]) end bouncesections = {} bounceoffset = 0 currentBouncePlaceIndex = 1 currentBounceLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "bounceloaded" then bouncesections[#bouncesections + 1] = msg.ObjIDSender Loadnextbouncespawn() elseif msg.name == "Selected" then if #bouncesections >= currentBouncePlaceIndex then bouncesections[currentBouncePlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} -- bouncesections[currentBouncePlaceIndex]:StopFXEffect{name = "hot"} currentBouncePlaceIndex = currentBouncePlaceIndex + 1 -- if currentBouncePlaceIndex <= #bouncesections then -- bouncesections[currentBouncePlaceIndex]:PlayFXEffect{name = "hot", effectType = "select"} -- end end elseif msg.name == "Trashed" then if #bouncesections >= currentBouncePlaceIndex then bouncesections[currentBouncePlaceIndex]:SetPosition{pos={x=msg.ObjIDSender:GetPosition{}.pos.x - 200, y=msg.ObjIDSender:GetPosition{}.pos.y, z=msg.ObjIDSender:GetPosition{}.pos.z}} currentBouncePlaceIndex = currentBouncePlaceIndex + 1 end elseif msg.name == "bouncecancel" then currentBouncePlaceIndex = 7 currentBounceLoadIndex = 7 elseif msg.name == "reset" then Deletebouncespawns() end end require('o_mis') CONSTANTS = {} CONSTANTS["ClimbSide"] = 5915 CONSTANTS["ClimbTop"] = 5914 CONSTANTS["ClimbWall"] = 5916 local climbsections = {} local currentClimberPlaceIndex = 1 local climberspawns = {5915,5915,5915,5915,5915,5915,5916,5916,5916,5916,5916,5916,5914,5914,5914,5914} local climberoffset = 0 local currentClimberLoadIndex = 1 function onUse(self, msg) currentClimberPlaceIndex = 1 currentClimberLoadIndex = 1 Deleteclimberspawns() Loadnextclimberspawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "padcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "bouncecancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "misccancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "trapcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5927 then friends[i]:NotifyObject{name = "blockercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "allcancel", ObjIDSender = self} end end end function Loadnextclimberspawn() if currentClimberLoadIndex <= #climberspawns then if climberspawns[currentClimberLoadIndex] == CONSTANTS["ClimbSide"] then local config = { {"climbable", "ladder"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["ClimbSide"], x = -90.31, y = 185.94, z = -470 + climberoffset, configData = config } elseif climberspawns[currentClimberLoadIndex] == CONSTANTS["ClimbTop"] then local config = { {"climbable", "wall"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["ClimbTop"], x = -90.31, y = 185.94, z = -470 + climberoffset, configData = config } elseif climberspawns[currentClimberLoadIndex] == CONSTANTS["ClimbWall"] then local config = { {"climbable", "wall"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["ClimbWall"], x = -90.31, y = 185.94, z = -470 + climberoffset, configData = config } end climberoffset = climberoffset + 5 currentClimberLoadIndex = currentClimberLoadIndex + 1 end end function Deleteclimberspawns() for i = 1, #climbsections do GAMEOBJ:DeleteObject(climbsections[i]) end climbsections = {} climberoffset = 0 currentClimberPlaceIndex = 1 currentClimberLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "climberloaded" then climbsections[#climbsections + 1] = msg.ObjIDSender Loadnextclimberspawn() elseif msg.name == "Selected" then if #climbsections >= currentClimberPlaceIndex then climbsections[currentClimberPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} -- climbsections[currentClimberPlaceIndex]:StopFXEffect{name = "hot"} currentClimberPlaceIndex = currentClimberPlaceIndex + 1 -- if currentClimberPlaceIndex <= #climbsections then -- climbsections[currentClimberPlaceIndex]:PlayFXEffect{name = "hot", effectType = "select"} -- end end elseif msg.name == "Trashed" then if #climbsections >= currentClimberPlaceIndex then climbsections[currentClimberPlaceIndex]:SetPosition{pos={x=msg.ObjIDSender:GetPosition{}.pos.x - 200, y=msg.ObjIDSender:GetPosition{}.pos.y, z=msg.ObjIDSender:GetPosition{}.pos.z}} currentClimberPlaceIndex = currentClimberPlaceIndex + 1 end elseif msg.name == "climbercancel" then currentClimberPlaceIndex = 17 currentClimberLoadIndex = 17 elseif msg.name == "reset" then Deleteclimberspawns() end end require('o_mis') local allsections = {} local currentAllPlaceIndex = 1 local allspawns = {5942,5942,5943,5943,5944,5945,5942,5942} local alloffset = 0 local currentAllLoadIndex = 1 function onStartup(self, msg) self:AddObjectToGroup{ group = "GP_Control" } self:AddObjectToGroup{ group = "GP_ALL" } end function onUse(self, msg) currentAllPlaceIndex = 1 currentAllLoadIndex = 1 Deleteallspawns() LoadAllnextspawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "padcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "bouncecancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5901 then friends[i]:NotifyObject{name = "climbercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "misccancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "trapcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "blockercancel", ObjIDSender = self} end end end function LoadAllnextspawn() if currentAllLoadIndex <= #allspawns then RESMGR:LoadObject {objectTemplate = allspawns[currentAllLoadIndex], x = -177 + alloffset, y = 184, z = -482, owner = self} alloffset = alloffset + 5 currentAllLoadIndex = currentAllLoadIndex + 1 end end function Deleteallspawns() for i = 1, #allsections do GAMEOBJ:DeleteObject(allsections[i]) end allsections = {} alloffset = 0 currentAllPlaceIndex = 1 currentAllLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "totalloaded" then allsections[#allsections + 1] = msg.ObjIDSender LoadAllnextspawn() elseif msg.name == "Selected" then if #allsections >= currentAllPlaceIndex then allsections[currentAllPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} currentAllPlaceIndex = currentAllPlaceIndex + 1 end elseif msg.name == "Trashed" then if #allsections >= currentAllPlaceIndex then allsections[currentAllPlaceIndex]:SetPosition{pos={x=msg.ObjIDSender:GetPosition{}.pos.x - 200, y=msg.ObjIDSender:GetPosition{}.pos.y, z=msg.ObjIDSender:GetPosition{}.pos.z}} currentAllPlaceIndex = currentAllPlaceIndex + 1 end elseif msg.name == "allcancel" then currentAllPlaceIndex = 9 currentAllLoadIndex = 9 elseif msg.name == "reset" then Deleteallspawns() end end require('o_mis') CONSTANTS = {} CONSTANTS["BlueTele"] = 5895 CONSTANTS["OrangeTele"] = 5896 local miscsections = {} local currentMiscPlaceIndex = 1 local miscspawns = {5884,5884,5884,5895,5896} local miscoffset = 0 local currentMiscLoadIndex = 1 function onUse(self, msg) currentMiscPlaceIndex = 1 currentMiscLoadIndex = 1 Deletemiscspawns() Loadnextmiscspawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "padcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "bouncecancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5901 then friends[i]:NotifyObject{name = "climbercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "trapcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5927 then friends[i]:NotifyObject{name = "blockercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "allcancel", ObjIDSender = self} end end end function Loadnextmiscspawn() if currentMiscLoadIndex <= #miscspawns then RESMGR:LoadObject {objectTemplate = miscspawns[currentMiscLoadIndex], x = -97.31, y = 185.38, z = -470 + miscoffset, owner = self} miscoffset = miscoffset + 15 currentMiscLoadIndex = currentMiscLoadIndex + 1 end end function Deletemiscspawns() for i = 1, #miscsections do GAMEOBJ:DeleteObject(miscsections[i]) end miscsections = {} miscoffset = 0 currentMiscPlaceIndex = 1 currentMiscLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "miscloaded" then miscsections[#miscsections + 1] = msg.ObjIDSender Loadnextmiscspawn() elseif msg.name == "Selected" then if #miscsections >= currentMiscPlaceIndex then miscsections[currentMiscPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} -- miscsections[currentMiscPlaceIndex]:StopFXEffect{name = "hot"} currentMiscPlaceIndex = currentMiscPlaceIndex + 1 -- if currentMiscPlaceIndex <= #miscsections then -- miscsections[currentMiscPlaceIndex]:PlayFXEffect{name = "hot", effectType = "select"} -- end end elseif msg.name == "Trashed" then if #miscsections >= currentMiscPlaceIndex then miscsections[currentMiscPlaceIndex]:SetPosition{pos={x=msg.ObjIDSender:GetPosition{}.pos.x - 200, y=msg.ObjIDSender:GetPosition{}.pos.y, z=msg.ObjIDSender:GetPosition{}.pos.z}} currentMiscPlaceIndex = currentMiscPlaceIndex + 1 end elseif msg.name == "misccancel" then currentMiscPlaceIndex = 6 currentMiscLoadIndex = 6 elseif msg.name == "reset" then Deletemiscspawns() end end require('o_mis') local sections = {} local currentPlaceIndex = 1 local spawns = {5851,5851,5851,5851,5851,5851,5851,5851,5851,5851,5851} local offset = 0 local currentLoadIndex = 1 function onUse(self, msg) currentPlaceIndex = 1 currentLoadIndex = 1 Deletespawns() Loadnextspawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "bouncecancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5901 then friends[i]:NotifyObject{name = "climbercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "misccancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "trapcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5927 then friends[i]:NotifyObject{name = "blockercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "allcancel", ObjIDSender = self} end end end function Loadnextspawn() if currentLoadIndex <= #spawns then RESMGR:LoadObject {objectTemplate = spawns[currentLoadIndex], x = -125.31, y = 185.51, z = -470 + offset, owner = self} offset = offset + 5 currentLoadIndex = currentLoadIndex + 1 end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} offset = 0 currentPlaceIndex = 1 currentLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "padloaded" then sections[#sections + 1] = msg.ObjIDSender Loadnextspawn() elseif msg.name == "Selected" then if #sections >= currentPlaceIndex then sections[currentPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} -- sections[currentPlaceIndex]:StopFXEffect{name = "hot"} currentPlaceIndex = currentPlaceIndex + 1 -- if currentPlaceIndex <= #sections then -- sections[currentPlaceIndex]:PlayFXEffect{name = "hot", effectType = "select"} -- end end elseif msg.name == "Trashed" then if #sections >= currentPlaceIndex then sections[currentPlaceIndex]:SetPosition{pos={x=msg.ObjIDSender:GetPosition{}.pos.x - 200, y=msg.ObjIDSender:GetPosition{}.pos.y, z=msg.ObjIDSender:GetPosition{}.pos.z}} currentPlaceIndex = currentPlaceIndex + 1 end elseif msg.name == "padcancel" then currentPlaceIndex = 12 currentLoadIndex = 12 elseif msg.name == "reset" then Deletespawns() end end require('o_mis') local trapsections = {} local currentTrapPlaceIndex = 1 local trapspawns = {5917,5917,5918,5918} local trapoffset = 0 local currentTrapLoadIndex = 1 function onUse(self, msg) currentTrapPlaceIndex = 1 currentTrapLoadIndex = 1 Deletetrapspawns() Loadnexttrapspawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "padcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "bouncecancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5901 then friends[i]:NotifyObject{name = "climbercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "misccancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5927 then friends[i]:NotifyObject{name = "blockercancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "allcancel", ObjIDSender = self} end end end function Loadnexttrapspawn() if currentTrapLoadIndex <= #trapspawns then RESMGR:LoadObject {objectTemplate = trapspawns[currentTrapLoadIndex], x = -104.31, y = 185.53, z = -470 + trapoffset, owner = self} trapoffset = trapoffset + 15 currentTrapLoadIndex = currentTrapLoadIndex + 1 end end function Deletetrapspawns() for i = 1, #trapsections do GAMEOBJ:DeleteObject(trapsections[i]) end trapsections = {} trapoffset = 0 currentTrapPlaceIndex = 1 currentTrapLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "traploaded" then trapsections[#trapsections + 1] = msg.ObjIDSender Loadnexttrapspawn() elseif msg.name == "Selected" then if #trapsections >= currentTrapPlaceIndex then trapsections[currentTrapPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} -- trapsections[currentTrapPlaceIndex]:StopFXEffect{name = "hot"} currentTrapPlaceIndex = currentTrapPlaceIndex + 1 -- if currentTrapPlaceIndex <= #trapsections then -- trapsections[currentTrapPlaceIndex]:PlayFXEffect{name = "hot", effectType = "select"} -- end end elseif msg.name == "Trashed" then if #trapsections >= currentTrapPlaceIndex then trapsections[currentTrapPlaceIndex]:SetPosition{pos={x=msg.ObjIDSender:GetPosition{}.pos.x - 200, y=msg.ObjIDSender:GetPosition{}.pos.y, z=msg.ObjIDSender:GetPosition{}.pos.z}} currentTrapPlaceIndex = currentTrapPlaceIndex + 1 end elseif msg.name == "trapcancel" then currentTrapPlaceIndex = 5 currentTrapLoadIndex = 5 elseif msg.name == "reset" then Deletetrapspawns() end end require('o_mis') --CONSTANTS = {} --CONSTANTS["Springy"] = 5852 local platformsections = {} local currentPlaceIndex = 1 local spawns = {5852,5852} local offset = 0 local currentLoadIndex = 1 function onUse(self, msg) --print "Click a green section to move pieces, click again to reset" Deletespawns() Loadnextspawn() end function Loadnextspawn() if currentLoadIndex <= #spawns then RESMGR:LoadObject {objectTemplate = spawns[currentLoadIndex], x = -161 + offset, y = 186.32, -- 184 z = -483, owner = self} end offset = offset + 5 currentLoadIndex = currentLoadIndex + 1 end end function Deletespawns() for i = 1, #platformsections do GAMEOBJ:DeleteObject(platformsections[i]) end platformsections = {} offset = 0 currentPlaceIndex = 1 currentLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "padloaded" then platformsections[#platformsections + 1] = msg.ObjIDSender Loadnextspawn() elseif msg.name == "Selected" then if #platformsections >= currentPlaceIndex then -- print "Turn off FX on Object" -- Remove effect from platformsections[currentPlaceIndex] platformsections[currentPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} platformsections[currentPlaceIndex]:StopFXEffect{name = "hot"} currentPlaceIndex = currentPlaceIndex + 1 -- print "Turn on FX on Object" -- Add effect from platformsections[currentPlaceIndex] if currentPlaceIndex <= #platformsections then platformsections[currentPlaceIndex]:PlayFXEffect{name = "hot", effectType = "select"} end end end end require('o_mis') function onStartup(self, msg) local ControlMiscObject = self:GetObjectsInGroup{ group = "GP_Misc"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "MiscNotify",self ) storeObjectByName(self, "ControlMiscObject", ControlMiscObject) end function onTimerDone(self, msg) if msg.name == "MiscNotify" then getObjectByName(self,"ControlMiscObject"):NotifyObject{name = "miscloaded", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local target = msg.senderID local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z local cratepos = self:GetPosition{}.pos local crateposx = cratepos.x + playerVelx / 10 local crateposy = cratepos.y local crateposz = cratepos.z + playerVelz / 10 target:PlayAnimation{animationID = "push-crate"} self:SetPosition{pos = {x = crateposx, y = crateposy, z = crateposz}} end require('o_mis') function onTimerDone(self, msg) if msg.name == "LeftDeathTeleport" then getObjectByName(self,"WaterLeftPlayer"):SetPosition {pos = {x=-186,y=184.28,z=-551}} getObjectByName(self,"WaterLeftPlayer"):SetUserCtrlCompPause{bPaused = false} end end function onCollisionPhantom(self, msg) local target = msg.senderID storeObjectByName(self, "WaterLeftPlayer", target) target:SetUserCtrlCompPause{bPaused = true} target:PlayAnimation{animationID = "chicken"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "LeftDeathTeleport",self ) endrequire('o_mis') function onTimerDone(self, msg) if msg.name == "RightDeathTeleport" then getObjectByName(self,"WaterRightPlayer"):SetPosition{pos = {x=106.02, y=189.99, z=-561.75}} getObjectByName(self,"WaterRightPlayer"):SetUserCtrlCompPause{bPaused = false} end end function onCollisionPhantom(self, msg) local target = msg.senderID storeObjectByName(self, "WaterRightPlayer", target) target:SetUserCtrlCompPause{bPaused = true} target:PlayAnimation{animationID = "chicken"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "RightDeathTeleport",self ) endrequire('o_mis') function onStartup(self, msg) local BounceControlObject = self:GetObjectsInGroup{ group = "GP_Bounce"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "BounceNotify",self ) storeObjectByName(self, "BounceControlObject", BounceControlObject) end function onTimerDone(self, msg) if msg.name == "BounceNotify" then getObjectByName(self,"BounceControlObject"):NotifyObject{name = "bounceloaded", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local target = msg.objectID local playerVelx = target:GetLinearVelocity().linVelocity.x / 1.5 local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z / 1.5 -- target:PlayAnimation{animationID = "floatpad"} msg.objectID:Knockback{vector={x=playerVelx, y=30,z=playerVelz}} endrequire('o_mis') function onStartup(self, msg) local ControlTrapObject = self:GetObjectsInGroup{ group = "GP_Trap"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "TrapNotify",self ) storeObjectByName(self, "ControlTrapObject", ControlTrapObject) end function onTimerDone(self, msg) if msg.name == "TrapNotify" then getObjectByName(self,"ControlTrapObject"):NotifyObject{name = "traploaded", ObjIDSender = self} end end --[[require('o_mis') function onStartup(self, msg) print "pad starting up" local ControlObject = self:GetObjectsInGroup{ group = "GP_Control"}.objects[1] print (tostring(ControlObject:GetLOT().objtemplate)) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "Notify",self ) storeObjectByName(self, "ControlObject", ControlObject) end function onTimerDone(self, msg) if msg.name == "Notify" then getObjectByName(self,"ControlObject"):NotifyObject{name = "padloaded", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local player = msg.objectID local bouncepos = self:GetPosition().pos local mypos = player:GetPosition().pos print "Collide" if mypos.x > bouncepos.x then msg.objectID:Knockback{vector={x=-10,y=40,z=0}} elseif mypos.x < bouncepos.x then msg.objectID:Knockback{vector={x=10,y=40,z=0}} end end --]] function onCollisionPhantom(self, msg) print "hit" local target = msg.objectID local elast = 200.0 local maximumSpeed = 300.0 local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} print("Direction:" .. self:GetVar("vec")) return msg end function onStartup(self) self:AddObjectToGroup{ group = "Level" } endrequire('o_mis') function onStartup(self, msg) local ControlMiscObject = self:GetObjectsInGroup{ group = "GP_Misc"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "MiscNotify",self ) storeObjectByName(self, "ControlMiscObject", ControlMiscObject) end function onTimerDone(self, msg) if msg.name == "MiscNotify" then getObjectByName(self,"ControlMiscObject"):NotifyObject{name = "miscloaded", ObjIDSender = self} end end require('o_mis') function onStartup(self, msg) local ControlObject = self:GetObjectsInGroup{ group = "GP_Pad"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "PadNotify",self ) storeObjectByName(self, "ControlObject", ControlObject) end function onTimerDone(self, msg) if msg.name == "PadNotify" then getObjectByName(self,"ControlObject"):NotifyObject{name = "padloaded", ObjIDSender = self} end end require('o_mis') function onStartup(self) end function onUse(self) local PadObject = self:GetObjectsInGroup{ group = "GP_Pad"}.objects[1] PadObject:NotifyObject{ObjIDSender=self, name = "Selected"} local BounceObject = self:GetObjectsInGroup{ group = "GP_Bounce"}.objects[1] BounceObject:NotifyObject{ObjIDSender=self, name = "Selected"} local ClimberObject = self:GetObjectsInGroup{ group = "GP_Climb"}.objects[1] ClimberObject:NotifyObject{ObjIDSender=self, name = "Selected"} local MiscObject = self:GetObjectsInGroup{ group = "GP_Misc"}.objects[1] MiscObject:NotifyObject{ObjIDSender=self, name = "Selected"} local TrapObject = self:GetObjectsInGroup{ group = "GP_Trap"}.objects[1] TrapObject:NotifyObject{ObjIDSender=self, name = "Selected"} local BlockerObject = self:GetObjectsInGroup{ group = "GP_Blocker"}.objects[1] BlockerObject:NotifyObject{ObjIDSender=self, name = "Selected"} local AllObject = self:GetObjectsInGroup{ group = "GP_ALL"}.objects[1] AllObject:NotifyObject{ObjIDSender=self, name = "Selected"} end require('o_mis') function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "reset", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "reset", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5901 then friends[i]:NotifyObject{name = "reset", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "reset", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "reset", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5927 then friends[i]:NotifyObject{name = "reset", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5855 then friends[i]:NotifyObject{name = "reset", ObjIDSender = self} end end end require('o_mis') function onStartup(self, msg) local ControlTrapObject = self:GetObjectsInGroup{ group = "GP_Trap"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "TrapNotify",self ) storeObjectByName(self, "ControlTrapObject", ControlTrapObject) end function onTimerDone(self, msg) if msg.name == "TrapNotify" then getObjectByName(self,"ControlTrapObject"):NotifyObject{name = "traploaded", ObjIDSender = self} end end require('o_mis') function onStartup(self, msg) local BounceControlObject = self:GetObjectsInGroup{ group = "GP_Bounce"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "BounceNotify",self ) storeObjectByName(self, "BounceControlObject", BounceControlObject) end function onTimerDone(self, msg) if msg.name == "BounceNotify" then getObjectByName(self,"BounceControlObject"):NotifyObject{name = "bounceloaded", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local target = msg.objectID local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z msg.objectID:Knockback{vector={x=playerVelx, y=30,z=playerVelz}} end require('o_mis') function onStartup(self) end function onUse(self) local PadObject = self:GetObjectsInGroup{ group = "GP_Pad"}.objects[1] PadObject:NotifyObject{ObjIDSender=self, name = "Trashed"} local BounceObject = self:GetObjectsInGroup{ group = "GP_Bounce"}.objects[1] BounceObject:NotifyObject{ObjIDSender=self, name = "Trashed"} local ClimberObject = self:GetObjectsInGroup{ group = "GP_Climb"}.objects[1] ClimberObject:NotifyObject{ObjIDSender=self, name = "Trashed"} local MiscObject = self:GetObjectsInGroup{ group = "GP_Misc"}.objects[1] MiscObject:NotifyObject{ObjIDSender=self, name = "Trashed"} local TrapObject = self:GetObjectsInGroup{ group = "GP_Trap"}.objects[1] TrapObject:NotifyObject{ObjIDSender=self, name = "Trashed"} local BlockerObject = self:GetObjectsInGroup{ group = "GP_Blocker"}.objects[1] BlockerObject:NotifyObject{ObjIDSender=self, name = "Trashed"} local AllObject = self:GetObjectsInGroup{ group = "GP_ALL"}.objects[1] AllObject:NotifyObject{ObjIDSender=self, name = "Trashed"} end require('o_mis') function onStartup(self, msg) local BounceControlObject = self:GetObjectsInGroup{ group = "GP_Bounce"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "BounceNotify",self ) storeObjectByName(self, "BounceControlObject", BounceControlObject) end function onTimerDone(self, msg) if msg.name == "BounceNotify" then getObjectByName(self,"BounceControlObject"):NotifyObject{name = "bounceloaded", ObjIDSender = self} end end require('o_mis') function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then target:SetAnimationSet{strSet = "swim"} print ("Swim "..target:GetName().name ) end end function onOffCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then target:SetAnimationSet{strSet = ""} print ("Walk "..target:GetName().name ) end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = .75 -- Tether Speed Set['wanderRadius'] = 10 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 15 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onUse(self, msg) self:PlayAnimation{ animationID = "interact" } endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6098 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6102 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "placed" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = sections[#sections]:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "ThreeWay", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "label" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6099 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6103 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "placed" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = sections[#sections]:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "FourWay", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "label" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6285 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6286 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6271 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6274 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "cancel" then if LoadIndex > PlaceIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6272 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6275 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6273 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6276 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') function onUse(self, msg) print "Camera!" endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6281 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6282 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') function onUse(self) local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "counterrotate", ObjIDSender = self} end end require('o_mis') function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_FinishLine" } print "Added to group" local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "traplabel", ObjIDSender = self} end end function onUse(self) print "Delete" GAMEOBJ:DeleteObject(self) endrequire('o_mis') CONSTANTS = {} CONSTANTS["GOAL_LINE_LOT"] = 6283 CONSTANTS["CHECKPOINT_LOT"] = 6281 function onStartup(self) local templateID = self:GetLOT().objtemplate local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "traplabel", ObjIDSender = self} end -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end function onCollisionPhantom(self, msg) local faction = msg.objectID:GetFaction() if faction and faction.faction == 1 then local templateID = self:GetLOT().objtemplate local strType = "" if (templateID == CONSTANTS["GOAL_LINE_LOT"]) then GAMEOBJ:GetZoneControlID():OffCollisionPhantom{objectID = msg.objectID, senderID = self} elseif (templateID == CONSTANTS["CHECKPOINT_LOT"]) then GAMEOBJ:GetZoneControlID():CollisionPhantom{objectID = msg.objectID, senderID = self} end end return msg end function onUse(self) GAMEOBJ:DeleteObject(self) end function onNotifyObject(self, msg) local templateID = self:GetLOT().objtemplate if msg.name == "Change" then if (templateID == CONSTANTS["GOAL_LINE_LOT"]) then GAMEOBJ:GetZoneControlID():SetVar("Finishpos_x", self:GetPosition().pos.x) GAMEOBJ:GetZoneControlID():SetVar("Finishpos_y", self:GetPosition().pos.y) GAMEOBJ:GetZoneControlID():SetVar("Finishpos_z", self:GetPosition().pos.z) GAMEOBJ:GetZoneControlID():SetVar("Finishrot_x", self:GetRotation().x) GAMEOBJ:GetZoneControlID():SetVar("Finishrot_y", self:GetRotation().y) GAMEOBJ:GetZoneControlID():SetVar("Finishrot_z", self:GetRotation().z) GAMEOBJ:GetZoneControlID():SetVar("Finishrot_w", self:GetRotation().w) GAMEOBJ:GetZoneControlID():SetVar("FinishThere", 1) end end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6243 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6244 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "placed" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = sections[#sections]:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "Grass", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "label" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6235 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6240 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "placed" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = sections[#sections]:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "NoPlace", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "label" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6238 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6241 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') function onStartup(self, msg) local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "traplabel", ObjIDSender = self} end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.25, "OilStunOver",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "OilDone",self ) target:AddSkill{ skillID = 170 } target:CastSkill{ optionalTargetID = self, skillID = 170 } target:SetUserCtrlCompPause{bPaused = true} target:PlayAnimation{animationID = "hit-racecar"} storeObjectByName(self, "Slicker", target) end end function onTimerDone(self, msg) if msg.name == "OilStunOver" then getObjectByName(self,"Slicker"):SetUserCtrlCompPause{bPaused = false} elseif msg.name == "OilDone" then getObjectByName(self,"Slicker"):RemoveSkill{ skillID = 170 } getObjectByName(self,"Slicker"):AddSkill{ skillID = 66 } getObjectByName(self,"Slicker"):CastSkill{ optionalTargetID = self, skillID = 66 } end end function onUse(self) GAMEOBJ:DeleteObject(self) endrequire('o_mis') function onStartup(self, msg) local ControlObject = self:GetObjectsInGroup{ group = "MR_Control"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "PadNotify",self ) storeObjectByName(self, "ControlObject", ControlObject) end function onTimerDone(self, msg) if msg.name == "PadNotify" then getObjectByName(self,"ControlObject"):NotifyObject{name = "roadloaded", ObjIDSender = self} end end function onUse(self) local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "placed", ObjIDSender = self} end end require('o_mis') function onUse(self, msg) local placers = self:GetObjectsInGroup{ group = "MR_TrapPlace" }.objects for i = 1, table.maxn (placers) do placers[i]:NotifyObject{name = "delete", ObjIDSender = self} end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6269 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6270 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') function onStartup(self, msg) local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "traplabel", ObjIDSender = self} end end function onUse(self) GAMEOBJ:DeleteObject(self) end function onCollisionPhantom(self, msg) if self:GetRotation{}.y == 1 then msg.objectID:Knockback{vector={x = 0, y = 30, z = 30}} elseif self:GetRotation{}.y > 0.7 and msg.objectID:GetRotation{}.y < 0.8 then msg.objectID:Knockback{vector={x = -30, y = 30, z = 0}} elseif self:GetRotation{}.y == 0 then msg.objectID:Knockback{vector={x = 0, y = 30, z = -30}} elseif self:GetRotation{}.y < -0.7 and msg.objectID:GetRotation{}.y > -0.8 then msg.objectID:Knockback{vector={x = 30, y = 30, z = 0}} end msg.objectID:PlayAnimation{animationID = "jumpflip-racecar"} endrequire('o_mis') function onUse(self) local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "buttonreset", ObjIDSender = self} end endrequire('o_mis') local roadsections = {} local currentRoadPlaceIndex = 1 local roadspawns = {} local offsetx = 0 local LoadIndex = 1 local placeposx = "" local placeposy = "" local placeposz = "" local spacing = 25.6 local gridsize = 10 local gridBool = true local vertTick = 1 function onStartup(self, msg) placeposx = self:GetPosition{}.pos.x placeposy = self:GetPosition{}.pos.y placeposz = self:GetPosition{}.pos.z self:AddObjectToGroup{ group = "MR_Control" } for i=1, gridsize * gridsize do roadspawns[i] = 6087 end end function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "reset", ObjIDSender = self} end local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "delete", ObjIDSender = self} end Deleteroadspawns() currentRoadPlaceIndex = 1 LoadIndex = 1 gridBool = true gridsize = 10 vertTick = 1 offsetx = 0 gridBool = false LoadRoadnextspawn() end function LoadRoadnextspawn() if LoadIndex <= #roadspawns then if gridBool then RESMGR:LoadObject {objectTemplate = roadspawns[LoadIndex], x = placeposx + offsetx, y = placeposy, z = placeposz + vertTick * spacing, owner = self} offsetx = offsetx + spacing else RESMGR:LoadObject {objectTemplate = roadspawns[LoadIndex], x = placeposx + offsetx, y = placeposy, z = placeposz + vertTick * spacing, owner = self} offsetx = offsetx - spacing end if LoadIndex == gridsize * vertTick then vertTick = vertTick + 1 if gridBool then gridBool = false else gridBoll = true end offsetx = 0 end LoadIndex = LoadIndex + 1 end end function Deleteroadspawns() for i = 1, #roadsections do GAMEOBJ:DeleteObject(roadsections[i]) end roadsections = {} roadoffset = 0 currentRoadPlaceIndex = 1 LoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "roadloaded" then roadsections[#roadsections + 1] = msg.ObjIDSender LoadRoadnextspawn() elseif msg.name == "buttonreset" then local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "reset", ObjIDSender = self} end local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "delete", ObjIDSender = self} end Deleteroadspawns() currentRoadPlaceIndex = 1 LoadIndex = 1 gridBool = true gridsize = 10 vertTick = 1 offsetx = 0 gridBool = false LoadRoadnextspawn() end end require('o_mis') local straight = 0 local turn = 0 local grass = 0 local threeway = 0 local fourway = 0 local straighttick = 0 local turntick = 0 local grasstick = 0 local threetick = 0 local fourtick = 0 local UpIncrement = 3.04 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Roads" } local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "label", ObjIDSender = self} end end function onUse(self) local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "removed", ObjIDSender = self} end for i = 0, (straighttick) do if getObjectByName(self, "Placer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "Placer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "Placer" .. i)) end end end for i = 0, (turntick) do if getObjectByName(self, "TurnPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "TurnPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "TurnPlacer" .. i)) end end end for i = 0, (grasstick) do if getObjectByName(self, "GrassPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "GrassPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "GrassPlacer" .. i)) end end end for i = 0, (threetick) do if getObjectByName(self, "ThreePlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "ThreePlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "ThreePlacer" .. i)) end end end for i = 0, (fourtick) do if getObjectByName(self, "FourPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "FourPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "FourPlacer" .. i)) end end end GAMEOBJ:DeleteObject(self) end function onNotifyObject(self, msg) if msg.name == "Straight" then RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, owner = self} straight = 1 turn = 0 grass = 0 threeway = 0 fourway = 0 elseif msg.name == "Turn" then RESMGR:LoadObject {objectTemplate = 6249, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} straight = 0 turn = 1 grass = 0 threeway = 0 fourway = 0 elseif msg.name == "Grass" then RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, owner = self} straight = 0 turn = 0 grass = 1 threeway = 0 fourway = 0 elseif msg.name == "ThreeWay" then RESMGR:LoadObject {objectTemplate = 6309, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} straight = 0 turn = 0 grass = 0 threeway = 1 fourway = 0 elseif msg.name == "FourWay" then RESMGR:LoadObject {objectTemplate = 6310, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} straight = 0 turn = 0 grass = 0 threeway = 0 fourway = 1 elseif msg.name == "NoPlace" then straight = 0 turn = 0 grass = 0 threeway = 0 fourway = 0 elseif msg.name == "delete" then for i = 0, (straighttick) do if getObjectByName(self, "Placer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "Placer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "Placer" .. i)) end end end for i = 0, (turntick) do if getObjectByName(self, "TurnPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "TurnPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "TurnPlacer" .. i)) end end end for i = 0, (grasstick) do if getObjectByName(self, "GrassPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "GrassPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "GrassPlacer" .. i)) end end end for i = 0, (threetick) do if getObjectByName(self, "ThreePlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "ThreePlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "ThreePlacer" .. i)) end end end for i = 0, (fourtick) do if getObjectByName(self, "FourPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "FourPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "FourPlacer" .. i)) end end end straighttick = 0 turntick = 0 grasstick = 0 threetick = 0 fourtick = 0 elseif msg.name == "up" then if straight > turn and straight > grass and straight > threeway and straight > fourway then for i = (straighttick - 5), (straighttick) do if getObjectByName(self, "Placer" .. i) then if getObjectByName(self, "Placer" .. i):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "Placer" .. i):SetPosition{pos = {x = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.x, y = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.z}} elseif getObjectByName(self, "Placer" .. i):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "Placer" .. i):SetPosition{pos = {x = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.z}} end end end end if turn > straight and turn > grass and turn > threeway and turn > fourway then if getObjectByName(self, "TurnPlacer" .. turntick - 1) then if getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "TurnPlacer" .. turntick - 1):SetPosition{pos = {x = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.x, y = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.z}} elseif getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "TurnPlacer" .. turntick - 1):SetPosition{pos = {x = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.z}} end end end if grass > straight and grass > turn and grass > threeway and grass > fourway then for i = (grasstick - 5), (grasstick) do if getObjectByName(self, "GrassPlacer" .. i) then if getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "GrassPlacer" .. i):SetPosition{pos = {x = getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.x, y = getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.z}} elseif getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "GrassPlacer" .. i):SetPosition{pos = {x = getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.z}} end end end end if threeway > straight and threeway > turn and threeway > grass and threeway > fourway then if getObjectByName(self, "ThreePlacer" .. threetick - 1) then print "Double BOOOYA!" if getObjectByName(self, "ThreePlacer" .. threetick - 1):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "ThreePlacer" .. threetick - 1):SetPosition{pos = {x = getObjectByName(self, "ThreePlacer" .. threetick - 1):GetPosition{}.pos.x, y = getObjectByName(self, "ThreePlacer" .. threetick - 1):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "ThreePlacer" .. threetick - 1):GetPosition{}.pos.z}} elseif getObjectByName(self, "ThreePlacer" .. threetick - 1):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then print "Down" getObjectByName(self, "ThreePlacer" .. threetick - 1):SetPosition{pos = {x = getObjectByName(self, "ThreePlacer" .. threetick - 1):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "ThreePlacer" .. threetick - 1):GetPosition{}.pos.z}} end end end if fourway > straight and fourway > turn and fourway > grass and fourway > threeway then if getObjectByName(self, "FourPlacer" .. fourtick - 1) then if getObjectByName(self, "FourPlacer" .. fourtick - 1):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "FourPlacer" .. fourtick - 1):SetPosition{pos = {x = getObjectByName(self, "FourPlacer" .. fourtick - 1):GetPosition{}.pos.x, y = getObjectByName(self, "FourPlacer" .. fourtick - 1):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "FourPlacer" .. fourtick - 1):GetPosition{}.pos.z}} elseif getObjectByName(self, "FourPlacer" .. fourtick - 1):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "FourPlacer" .. fourtick - 1):SetPosition{pos = {x = getObjectByName(self, "FourPlacer" .. fourtick - 1):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "FourPlacer" .. fourtick - 1):GetPosition{}.pos.z}} end end end end end function onChildLoaded(self, msg) if (msg.templateID == 6220) then storeObjectByName(self, "Placer" .. straighttick, msg.childID) straighttick = straighttick + 1 end if (msg.templateID == 6249) then storeObjectByName(self, "TurnPlacer" .. turntick, msg.childID) turntick = turntick + 1 end if (msg.templateID == 6250) then storeObjectByName(self, "GrassPlacer" .. grasstick, msg.childID) grasstick = grasstick + 1 end if (msg.templateID == 6309) then storeObjectByName(self, "ThreePlacer" .. threetick, msg.childID) threetick = threetick + 1 end if (msg.templateID == 6310) then storeObjectByName(self, "FourPlacer" .. fourtick, msg.childID) fourtick = fourtick + 1 end endrequire('o_mis') local straight = 0 local turn = 0 local grass = 0 local straighttick = 0 local turntick = 0 local grasstick = 0 local stuff = 0 local UpIncrement = 3.04 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Roads" } local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "label", ObjIDSender = self} end end function onUse(self) local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "removed", ObjIDSender = self} end for i = 0, (straighttick) do if getObjectByName(self, "Placer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "Placer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "Placer" .. i)) end end end for i = 0, (turntick) do if getObjectByName(self, "TurnPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "TurnPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "TurnPlacer" .. i)) end end end for i = 0, (grasstick) do if getObjectByName(self, "GrassPlacer" .. i) then if GAMEOBJ:DeleteObject(getObjectByName(self, "GrassPlacer" .. i)) then GAMEOBJ:DeleteObject(getObjectByName(self, "GrassPlacer" .. i)) end end end GAMEOBJ:DeleteObject(self) end function onNotifyObject(self, msg) if msg.name == "NorthStraight" then RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} straight = 1 turn = 0 grass = 0 elseif msg.name == "EastStraight" then RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} straight = 1 turn = 0 grass = 0 elseif msg.name == "SouthStraight" then RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} straight = 1 turn = 0 grass = 0 elseif msg.name == "WestStraight" then RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6220, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} straight = 1 turn = 0 grass = 0 elseif msg.name == "NorthTurn" then RESMGR:LoadObject {objectTemplate = 6249, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} straight = 0 turn = 1 grass = 0 elseif msg.name == "EastTurn" then RESMGR:LoadObject {objectTemplate = 6249, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} straight = 0 turn = 1 grass = 0 elseif msg.name == "SouthTurn" then RESMGR:LoadObject {objectTemplate = 6249, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} straight = 0 turn = 1 grass = 0 elseif msg.name == "WestTurn" then RESMGR:LoadObject {objectTemplate = 6249, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} straight = 0 turn = 1 grass = 0 elseif msg.name == "NorthGrass" then RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} straight = 0 turn = 0 grass = 1 elseif msg.name == "EastGrass" then RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} straight = 0 turn = 0 grass = 1 elseif msg.name == "SouthGrass" then RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0, rx = 0, ry = 1, rz = 0, owner = self} straight = 0 turn = 0 grass = 1 elseif msg.name == "WestGrass" then RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x + 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z - 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = 6250, x = self:GetPosition{}.pos.x - 5, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z + 5, rw = 0.707, rx = 0, ry = 0.707, rz = 0, owner = self} straight = 0 turn = 0 grass = 1 elseif msg.name == "NoPlace" then straight = 0 turn = 0 grass = 0 elseif msg.name == "delete" then for i = 0, (straighttick) do if getObjectByName(self, "Placer" .. i) then GAMEOBJ:DeleteObject(getObjectByName(self, "Placer" .. i)) end end for i = 0, (turntick) do if getObjectByName(self, "TurnPlacer" .. i) then GAMEOBJ:DeleteObject(getObjectByName(self, "TurnPlacer" .. i)) end end for i = 0, (grasstick) do if getObjectByName(self, "GrassPlacer" .. i) then GAMEOBJ:DeleteObject(getObjectByName(self, "GrassPlacer" .. i)) end end elseif msg.name == "up" then if straight > turn and straight > grass then for i = (straighttick - 5), (straighttick) do if getObjectByName(self, "Placer" .. i) then if getObjectByName(self, "Placer" .. i):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "Placer" .. i):SetPosition{pos = {x = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.x, y = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.z}} elseif getObjectByName(self, "Placer" .. i):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "Placer" .. i):SetPosition{pos = {x = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "Placer" .. i):GetPosition{}.pos.z}} end end end end if turn > straight and turn > grass then if getObjectByName(self, "TurnPlacer" .. turntick - 1) then if getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "TurnPlacer" .. turntick - 1):SetPosition{pos = {x = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.x, y = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.z}} elseif getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "TurnPlacer" .. turntick - 1):SetPosition{pos = {x = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "TurnPlacer" .. turntick - 1):GetPosition{}.pos.z}} end end end if grass > straight and grass > turn then if getObjectByName(self, "GrassPlacer" .. grasstick - 1) then if getObjectByName(self, "GrassPlacer" .. grasstick - 1):GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "GrassPlacer" .. grasstick - 1):SetPosition{pos = {x = getObjectByName(self, "GrassPlacer" .. grasstick - 1):GetPosition{}.pos.x, y = getObjectByName(self, "GrassPlacer" .. grasstick - 1):GetPosition{}.pos.y + UpIncrement, z = getObjectByName(self, "GrassPlacer" .. grasstick - 1):GetPosition{}.pos.z}} elseif getObjectByName(self, "GrassPlacer" .. i):GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 4 then getObjectByName(self, "GrassPlacer" .. i):SetPosition{pos = {x = getObjectByName(self, "GrassPlacer" .. grasstick - 1):GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = getObjectByName(self, "GrassPlacer" .. grasstick - 1):GetPosition{}.pos.z}} end end end end end function onChildLoaded(self, msg) if (msg.templateID == 6220) then storeObjectByName(self, "Placer" .. straighttick, msg.childID) straighttick = straighttick + 1 end if (msg.templateID == 6249) then storeObjectByName(self, "TurnPlacer" .. turntick, msg.childID) turntick = turntick + 1 end if (msg.templateID == 6250) then storeObjectByName(self, "GrassPlacer" .. grasstick, msg.childID) grasstick = grasstick + 1 end end require('o_mis') function onUse(self) local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "rotate", ObjIDSender = self} end end require('o_mis') function onStartup(self, msg) local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "traplabel", ObjIDSender = self} end end function onUse(self) GAMEOBJ:DeleteObject(self) end function onCollisionPhantom(self, msg) if self:GetRotation{}.y == 1 then msg.objectID:Knockback{vector={x = 0, y = 0, z = -100}} elseif self:GetRotation{}.y > 0.7 and msg.objectID:GetRotation{}.y < 0.8 then msg.objectID:Knockback{vector={x = 100, y = 0, z = 0}} elseif self:GetRotation{}.y == 0 then msg.objectID:Knockback{vector={x = 0, y = 0, z = 100}} elseif self:GetRotation{}.y < -0.7 and msg.objectID:GetRotation{}.y > -0.8 then msg.objectID:Knockback{vector={x = -100, y = 0, z = 0}} end msg.objectID:PlayAnimation{animationID = "turbo-racecar"} endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6279 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6280 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6283 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6284 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} sections[#sections]:NotifyObject{name = "Change", ObjIDSender = self} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} -- Creating empty group to name objects local spawns = {} -- Our road spawn table local LoadIndex = 1 -- Updates to show where in the table we are local PlaceIndex = 1 -- Updates to show when an object in the table has been moved local UpIndex = 0 -- Updates to show when an object can no longer be raised local UpIncrement = 2.885 -- How high an object gets raised function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } -- We need to add this to a group to send messages to it for i=1, 500 do -- Easier than typing 6100 x amount of times spawns[i] = 6100 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex -- So the object can't be raised end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6104 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "placed" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = sections[#sections]:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "Straight", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "label" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') function onStartup(self, msg) local friends = self:GetObjectsInGroup{ group = "MR_Control"}.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "traplabel", ObjIDSender = self} end end function onUse(self) GAMEOBJ:DeleteObject(self) endrequire('o_mis') function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_TrapPlace" } end function onUse(self,msg) local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "trapplaced", ObjIDSender = self} end end function onNotifyObject(self, msg) if msg.name == "delete" then GAMEOBJ:DeleteObject(self) end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6277 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6278 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "trapplaced" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = msg.ObjIDSender:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "traplabel" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6239 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 if LoadIndex <= UpIndex then UpIndex = LoadIndex end RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6242 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "placed" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = sections[#sections]:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "NoPlace", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "label" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') local sections = {} local spawns = {} local LoadIndex = 1 local PlaceIndex = 1 local UpIndex = 0 local UpIncrement = 2.885 function onStartup(self, msg) self:AddObjectToGroup{ group = "MR_Control" } for i=1, 500 do spawns[i] = 6101 end end function onUse(self, msg) local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "NoPlace", ObjIDSender = self} end if LoadIndex <= #spawns and LoadIndex <= PlaceIndex then LoadIndex = LoadIndex + 1 --[[if LoadIndex <= UpIndex then UpIndex = LoadIndex end--]] RESMGR:LoadObject {objectTemplate = spawns[LoadIndex], x = self:GetPosition{}.pos.x, y = self:GetPosition{}.pos.y, z = self:GetPosition{}.pos.z, owner = self} end local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 6105 then friends[i]:NotifyObject{name = "cancel", ObjIDSender = self} end end end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} PlaceIndex = 1 LoadIndex = 1 UpIndex = 0 end function onNotifyObject(self, msg) if msg.name == "placed" then if #spawns >= LoadIndex and LoadIndex > PlaceIndex then sections[#sections]:SetPosition{pos={x = msg.ObjIDSender:GetPosition{}.pos.x, y = sections[#sections]:GetPosition{}.pos.y, z = msg.ObjIDSender:GetPosition{}.pos.z}} PlaceIndex = PlaceIndex + 1 sections[#sections]:NotifyObject{name = "Turn", ObjIDSender = self} end elseif msg.name == "rotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} end end elseif msg.name == "counterrotate" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetRotation{}.y == 1 then sections[#sections]:SetRotation{x=0, y=-0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y > 0.7 and sections[#sections]:GetRotation{}.y < 0.8 then sections[#sections]:SetRotation{x=0, y=1, z=0, w=0} elseif sections[#sections]:GetRotation{}.y == 0 then sections[#sections]:SetRotation{x=0, y=0.707, z=0, w=0.707} elseif sections[#sections]:GetRotation{}.y < -0.7 and sections[#sections]:GetRotation{}.y > -0.8 then sections[#sections]:SetRotation{x=0, y=0, z=0, w=1} end end elseif msg.name == "up" then if #spawns >= LoadIndex and LoadIndex > UpIndex and sections[#sections] then if sections[#sections]:GetPosition{}.pos.y < msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=sections[#sections]:GetPosition{}.pos.y + UpIncrement, z=sections[#sections]:GetPosition{}.pos.z}} end if sections[#sections]:GetPosition{}.pos.y > msg.ObjIDSender:GetPosition{}.pos.y + UpIncrement * 5 then sections[#sections]:SetPosition{pos = {x=sections[#sections]:GetPosition{}.pos.x, y=msg.ObjIDSender:GetPosition{}.pos.y, z=sections[#sections]:GetPosition{}.pos.z}} end end elseif msg.name == "label" then if LoadIndex > PlaceIndex then sections[#sections + 1] = msg.ObjIDSender end elseif msg.name == "cancel" then if PlaceIndex < LoadIndex then for i=LoadIndex - 1, #sections do if sections[i] then GAMEOBJ:DeleteObject(sections[i]) end end LoadIndex = LoadIndex - 1 end if LoadIndex > UpIndex then UpIndex = LoadIndex end elseif msg.name == "reset" then Deletespawns() end endrequire('o_mis') function onUse(self) local friends = self:GetObjectsInGroup{ group = "MR_Control" }.objects for i = 1, table.maxn (friends) do friends[i]:NotifyObject{name = "up", ObjIDSender = self} end local roads = self:GetObjectsInGroup{ group = "MR_Roads" }.objects for i = 1, table.maxn (roads) do roads[i]:NotifyObject{name = "up", ObjIDSender = self} end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['wanderRadius'] = 16 -- Wander Radius --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetVar("petclick", 1) end function onUse(self, msg) if self:GetVar("petclick") == 1 then self:SetVar("petclick", 0) self:PlayAnimation{ animationID = "scared" } self:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "UnStunPet", self ) end end function onTimerDone(self, msg) if ( msg.name == "UnStunPet" ) then self:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} self:SetVar("petclick", 1) end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} local friends = self:GetObjectsInGroup{ group = "Panto" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6558 then self:FollowTarget { targetID = friends[i], radius = 5, speed = 0.75, keepFollowing = true } end end --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 9999 -- Min Wander Delay Set['WanderDelayMax'] = 9999 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) self:AddObjectToGroup{ group = "Panto" } Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 15 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 3 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0.75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.25 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetProximityRadius{radius = 20} end function onProximityUpdate(self, msg) if msg.status == "ENTER" then self:PlayFXEffect{effectType = "greet"} end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end--]] require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onCollision (self,msg) self:PlayFXEffect{effectType = "down_a"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_asharp"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_b"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_c"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_c2"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_c2sharp"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_csharp"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_d"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_dsharp"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_e"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_f"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_fsharp"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_g"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollision (self,msg) self:PlayFXEffect{effectType = "down_gsharp"} end function onOffCollision (self,msg) self:PlayFXEffect{effectType = "up"} end function onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_01"} end function onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_02"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_03"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_04"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_05"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_06"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_07"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_08"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_09"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_10"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_11"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_12"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_13"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_14"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_15"} endfunction onCollisionPhantom(self, msg) self:PlayFXEffect{effectType = "bounce_16"} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 25 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 1 -- Tether Speed Set['wanderRadius'] = 1 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end--function onStartup(self) --end require('o_mis') function onStartup(self) local Points = {} local MainPos = self:GetPosition().pos Points[1] = { x = MainPos.x , y = MainPos.y, z = MainPos.z } Points[2] = { x = MainPos.x + 10 , y = MainPos.y, z = MainPos.z} Points[3] = { x = MainPos.x + 10 , y = MainPos.y, z = MainPos.z + 10} Points[4] = { x = MainPos.x + 10 , y = MainPos.y, z = MainPos.z - 10} Points[5] = { x = MainPos.x - 10 , y = MainPos.y, z = MainPos.z} Points[6] = { x = MainPos.x - 10 , y = MainPos.y, z = MainPos.z + 10} Points[7] = { x = MainPos.x, y = MainPos.y, z = MainPos.z + 10} Points[8] = { x = MainPos.x, y = MainPos.y, z = MainPos.z - 10} for i = 1, 8 do self:SetVar("Points_"..i, Points[i] ) end local ran = math.random(1,8) local ranTime = math.random(1,6) self:Teleport{ pos = self:GetVar("Points_"..ran ) } GAMEOBJ:GetTimer():AddTimerWithCancel( ranTime , "bricktimer", self ) end onTimerDone = function(self, msg) if msg.name == "bricktimer" then local ran = math.random(1,8) local ranTime = math.random(1,6) local pos_tele = {} local pos_tele = self:GetVar("Points_"..ran ) self:Teleport{ pos = pos_tele } GAMEOBJ:GetTimer():AddTimerWithCancel( ranTime, "emote", self ) end if msg.name == "emote" then Emote.emote(self, self, "down" ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "bricktimer", self ) end end function onUse(self, msg) self:PlayAnimation{ animationID = "interact" } end function onStartup(self, msg) self:SetVar("flipped", 1) self:PlayAnimation{ animationID = "idle" } end function onUse(self, msg) if self:GetVar("flipped") == 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.6, "Flipping",self ) self:PlayAnimation{ animationID = "flip-over" } self:SetVar("flipped", 0) elseif self:GetVar("flipped") == 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.8, "Flipback",self ) self:PlayAnimation{ animationID = "flip-back" } self:SetVar("flipped", 1) end end function onTimerDone(self, msg) if msg.name == "Flipping" then self:PlayAnimation{ animationID = "over-idle" } elseif msg.name == "Flipback" then self:PlayAnimation{ animationID = "idle" } end end require('State') require('o_StateCreate') require('o_mis') require('o_Main_New_Combat') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 1 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} end function onOnHit(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 4.5, "BeetleFlip",self ) self:PlayAnimation{animationID = "onhit"} self:AddSkill{ skillID = 217 } self:CastSkill{ skillID = 217 } self:RemoveSkill{ skillID = 217 } self:RemoveSkill{ skillID = 134 } endfunction onStartup(self) self:SetVar("isCoughing",1) self:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} self:SetProximityRadius{radius = 10} end function onFireEventServerSide(self, msg) if msg.args == 'physicsReady' then self:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} end end function onCollisionPhantom(self, msg) local target = msg.senderID local faction = target:GetFaction() if self:GetVar("isCoughing") == 1 and faction.faction == 1 then target:PlayAnimation{animationID = "cough"} self:SetVar("isCoughing",0) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "CoughAgain", self ) end end function onTimerDone(self, msg) if (msg.name == "CoughAgain") then self:SetVar("isCoughing",1) end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetFaction { faction = 5 } -- so the skunk knows it can stink this NPC endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 15 -- Aggro Radius Set['conductRadius'] = 30 -- Conduct Radius Set['tetherRadius'] = 35 -- Tether Radius Set['tetherSpeed'] = 2 -- Tether Speed Set['wanderRadius'] = 10 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "wptest" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Patrol Events ------------------------------------------------------ Set['WayPointEvent'] = false -- Bool Active -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 4 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight'] = 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "interact" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "interact" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = .5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) self:SetVar("switch", 1) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 4 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onFireEventServerSide(self, msg) if msg.args == 'physicsReady' then self:PlayFXEffect{name = "glowlight", effectType = "light"} end end function onUse(self, msg) if self:GetVar("switch") == 1 then self:StopFXEffect{name = "glowlight"} self:SetVar("switch", 0) elseif self:GetVar("switch") == 0 then self:PlayFXEffect{name = "glowlight", effectType = "light"} self:SetVar("switch", 1) end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onUse(self, msg) self:PlayAnimation{ animationID = "scared" } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1.2 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onUse(self, msg) self:PlayAnimation{ animationID = "scared" } endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "HitboxStartup",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.3, "HitboxFollow",self ) end function onOnHit(self, msg) local snakes = self:GetObjectsInGroup{ group = "hitboxes" }.objects for i = 1, table.maxn (snakes) do snakes[i]:NotifyObject{name = "hit", ObjIDSender = self} end end function onTimerDone(self, msg) if msg.name == "HitboxStartup" then self:AddObjectToGroup{ group = "hitboxes" } self:OverrideFriction{bEnableOverride = true, fFriction = 40} elseif msg.name == "HitboxFollow" then local friends = self:GetObjectsInGroup{ group = "hitboxes" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6623 then self:FollowTarget { targetID = friends[i], radius = 3, speed = 6, keepFollowing = true } end end end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main_Bull') function onStartup(self) self:SetVar("Stunned", 1 ) self:OverrideFriction{bEnableOverride = true, fFriction = 400} --self:AddObjectToGroup{ group = "hitboxes" } local placeposx = self:GetPosition{}.pos.x local placeposy = self:GetPosition{}.pos.y local placeposz = self:GetPosition{}.pos.z --RESMGR:LoadObject {objectTemplate = 6625, x = placeposx, y = placeposy, z = placeposz - 5, owner = self} Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 50 -- Conduct Radius Set['tetherRadius'] = 100 -- Tether Radius Set['tetherSpeed'] = 5 -- Tether Speed Set['wanderRadius'] = 15 -- Wander Radius -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 360 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive] [Neutral] [Passive] [PassiveAggres] Set['AggroNPC'] = false Set['AggroDist'] = 6 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = true -- Plays Emote on Aggro Set['AggroE_Type'] = "charge" -- String Name of Emote Set['AggroE_Delay'] = 2 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" -- ["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 1 -- Min Wander Delay Set['WanderDelayMax'] = 1 -- Max Wander Delay Set['WanderSpeed'] = 0.65 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetImmunity{ immunity = true } end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() local BullVelx = self:GetLinearVelocity().linVelocity.x local BullVelz = self:GetLinearVelocity().linVelocity.z if faction and faction.faction == 1 then if self:GetVar("CurrentState") == "aggro" and self:GetVar("Stunned") == 1 then self:FollowTarget { targetID = target,radius = 3, speed = 0, keepFollowing = false } self:SetVar("Stunned", 0 ) self:SetImmunity{ immunity = false } GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0 , "Bullimmune", self ) self:Knockback{vector={ x = BullVelx, y = 15, z = BullVelz }} self:CastSkill{ skillID = 217 } self:PlayAnimation{animationID = "slip"} end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "HitboxStartup",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.3, "HitboxFollow",self ) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings -------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 9999 -- Min Wander Delay Set['WanderDelayMax'] = 9999 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ---------------------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onOnHit(self, msg) local snakes = self:GetObjectsInGroup{ group = "hitboxes" }.objects for i = 1, table.maxn (snakes) do snakes[i]:NotifyObject{name = "hit", ObjIDSender = self} end end function onTimerDone(self, msg) if msg.name == "HitboxStartup" then self:AddObjectToGroup{ group = "hitboxes" } self:OverrideFriction{bEnableOverride = true, fFriction = 10} elseif msg.name == "HitboxFollow" then local friends = self:GetObjectsInGroup{ group = "hitboxes" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6623 then self:FollowTarget { targetID = friends[i], radius = 3, speed = 2, keepFollowing = true } end end end endfunction onStartup(self,msg) self:SetVar("horse", 0) end function onUse(self, msg) local player = msg.user local item = player:AddNewItemToInventory{ iObjTemplate = 7089 } if self:GetVar("horse") == 0 then player:EquipInventory{ itemtoequip = item.newObjID } self:SetVar("horse", 1) else player:RemoveItemFromInventory{ iObjTemplate = 7089 } self:SetVar("horse", 0) end end --require('State') --require('o_StateCreate') --require('o_mis') --require('o_Main') function onStartup(self) self:AddObjectToGroup{ group = "jug1" } end function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "jug1" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 7318 then friends[i]:NotifyObject{ name="Mimey" } end end end function onNotifyObject(self, msg) if msg.name == "Juggly" then self:PlayAnimation{ animationID = "cast" } print "Juggle time!" end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 30 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = .5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onUse(self, msg) local clicker = msg.user self:FaceTarget{target = clicker, degreesOff = 0, keepFacingTarget = true, bInstant = true} self:PlayAnimation{ animationID = "wave" } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') Set = {} Set['SuspendLuaAI'] = true function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "SnakeStartup",self ) self:AddObjectToGroup{ group = "snakesonaplane" } self:OverrideFriction{bEnableOverride = true, fFriction = 10} -- Spawn snake pieces local placeposx = self:GetPosition{}.pos.x local placeposy = self:GetPosition{}.pos.y local placeposz = self:GetPosition{}.pos.z RESMGR:LoadObject {objectTemplate = 6564, x = placeposx, y = placeposy, z = placeposz + 5, owner = self} RESMGR:LoadObject {objectTemplate = 6565, x = placeposx, y = placeposy, z = placeposz - 5, owner = self} RESMGR:LoadObject {objectTemplate = 6566, x = placeposx + 5, y = placeposy, z = placeposz, owner = self} RESMGR:LoadObject {objectTemplate = 6567, x = placeposx - 5, y = placeposy, z = placeposz, owner = self} RESMGR:LoadObject {objectTemplate = 6568, x = placeposx + 5, y = placeposy, z = placeposz - 5, owner = self} Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 15 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 1 -- Tether Speed Set['wanderRadius'] = 25 -- Wander Radius -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive] [Neutral] [Passive] [PassiveAggres] Set['AggroNPC'] = false Set['AggroDist'] = 8 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 1 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0.65 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onNotifyObject(self, msg) if msg.name == "next5" then self:SetFaction{faction = 4} self:PlayFXEffect{effectType = "medusa"} end end--require('State') --require('o_StateCreate') --require('o_mis') --require('o_Main') function onStartup(self) self:SetVar("resetme", "on") self:SetVar("home", self:GetPosition().pos ) self:AddObjectToGroup{ group = "jug1" } end function onArrived(self, msg) if (msg.isLastPoint == true) then GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "Juggle",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 16.2, "RestorePath",self ) end end function onNotifyObject(self, msg) if msg.name == "Mimey" then if self:GetVar("resetme") == "on" then self:SetVar("resetme", "off") self:SetVar("attached_path", "Mime_Path") self:FollowWaypoints() self:SetPathingSpeed{ speed = 0.6 } end end end function onTimerDone(self, msg) if msg.name == "Juggle" then print "Juggle" self:SetRotation{x=0, y=1, z=0, w=0} self:PlayAnimation{ animationID = "cast" } local friends = self:GetObjectsInGroup{ group = "jug1" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate ~= 7318 then friends[i]:NotifyObject{ name="Juggly" } end end elseif msg.name == "RestorePath" then print "Go home" self:SetVar("resetme", "on") self:GoTo{speed = 0.6, target = self:GetVar("home")} end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main_Motion_Tracker') function onStartup(self) self:OverrideFriction{bEnableOverride = true, fFriction = 40} self:AddObjectToGroup{ group = "motiontracker" } local placeposx = self:GetPosition{}.pos.x local placeposy = self:GetPosition{}.pos.y local placeposz = self:GetPosition{}.pos.z -- RESMGR:LoadObject {objectTemplate = 6625, x = placeposx, y = placeposy, z = placeposz - 5, owner = self} Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 50 -- Conduct Radius Set['tetherRadius'] = 100 -- Tether Radius Set['tetherSpeed'] = 1 -- Tether Speed Set['wanderRadius'] = 15 -- Wander Radius -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 10 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive] [Neutral] [Passive] [PassiveAggres] Set['AggroNPC'] = false Set['AggroDist'] = 6 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false -- Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" -- ["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 1 -- Main Weight Set['WanderDelayMin'] = 1 -- Min Wander Delay Set['WanderDelayMax'] = 1 -- Max Wander Delay Set['WanderSpeed'] = 2 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetVar("collideswitch", 1) self:SetVar("pauseswitch", 1) end function onNotifyObject(self, msg) if msg.name == "hit" then print "HIT!" end endfunction onStartup(self, msg) self:AddObjectToGroup{ group = "Ninjastuff" } end function onNotifyObject(self, msg) if msg.name == "Crane" then self:PlayAnimation{animationID = "crane"} elseif msg.name == "Tiger" then self:PlayAnimation{animationID = "tiger"} elseif msg.name == "Mantis" then self:PlayAnimation{animationID = "mantis"} end endfunction onStartup(self, msg) self:PlayAnimation{ animationID = "bow" } GAMEOBJ:GetTimer():AddTimerWithCancel( 6.5, "CraneStart",self ) end function onTimerDone(self, msg) if msg.name == "CraneStart" then local Ninjas = self:GetObjectsInGroup{ group = "Ninjastuff"}.objects for i = 1, table.maxn (Ninjas) do Ninjas[i]:NotifyObject{ name="Crane" } end GAMEOBJ:GetTimer():AddTimerWithCancel( 15.5, "Bow",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 25.0, "TigerStart",self ) self:PlayAnimation{ animationID = "crane" } elseif msg.name == "TigerStart" then local Ninjas = self:GetObjectsInGroup{ group = "Ninjastuff"}.objects for i = 1, table.maxn (Ninjas) do Ninjas[i]:NotifyObject{ name="Tiger" } end GAMEOBJ:GetTimer():AddTimerWithCancel( 15.5, "Bow",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 25.0, "MantisStart",self ) self:PlayAnimation{ animationID = "tiger" } elseif msg.name == "MantisStart" then local Ninjas = self:GetObjectsInGroup{ group = "Ninjastuff"}.objects for i = 1, table.maxn (Ninjas) do Ninjas[i]:NotifyObject{ name="Mantis" } end GAMEOBJ:GetTimer():AddTimerWithCancel( 16.5, "Bow",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 25.0, "CraneStart",self ) self:PlayAnimation{ animationID = "mantis" } elseif msg.name == "Bow" then local Ninjas = self:GetObjectsInGroup{ group = "Ninjastuff"}.objects for i = 1, table.maxn (Ninjas) do Ninjas[i]:NotifyObject{ name="Bow" } end self:PlayAnimation{ animationID = "bow" } end endfunction onStartup(self, msg) self:AddObjectToGroup{ group = "Ninjastuff" } self:PlayAnimation{ animationID = "bow" } end function onNotifyObject(self, msg) if msg.name == "Crane" then self:PlayAnimation{animationID = "crane"} elseif msg.name == "Tiger" then self:PlayAnimation{animationID = "tiger"} elseif msg.name == "Mantis" then self:PlayAnimation{animationID = "mantis"} elseif msg.name == "Bow" then self:PlayAnimation{animationID = "bow"} end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Cat" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 10 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 15 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = .75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "scared" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "EmoteFlee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 10 -- Flee Distance Set['FearTime'] = 5 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 360 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "scared" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Cam-Bot" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 25 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 2 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetProximityRadius{radius = 20} end function onUse(self, msg) self:CastSkill{skillID = 119} end function onProximityUpdate(self, msg) if msg.status == "ENTER" then end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onUse(self, msg) self:PlayAnimation{ animationID = "scared" } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Robotonist" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 10 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 10 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 0 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "scared" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "EmoteFlee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 10 -- Flee Distance Set['FearTime'] = 5 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 360 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "scared" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('o_mis') local currentKeyPlaceIndex = 1 local keyspawns = {7903,7904,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915} local currentKeyLoadIndex = 1 local CONSTANTS = {} -- how much imagination is repeatedly drained while the organ is being played CONSTANTS["ORGAN_IMAGINATION_COST"] = 2 -- how often imagination is drained while playing the organ CONSTANTS["ORGAN_COST_FREQUENCY"] = 4.0 function onStartup(self) -- set max users to 1 self:SetActivityParams{ modifyActivityActive=true, activityActive = true, maxUsers = 1, modifyMaxUsers = true } -- Add organ to group so keys can be ennumerated for deletion self:AddObjectToGroup{ group = "Organ" } -- Make sure organ is playing its idle animation self:PlayAnimation{ animationID = "key-up" } --Make sure key spawns are reset currentKeyLoadIndex = 1 --Relative position/rotation data local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() oPos.pos = self:GetPosition().pos oPos.rot = self:GetRotation() -- Spawn keys on client in front of organ for individual clickability; didn't do the math work needed to make this relative; organ needs a rotation of 20.4 on the y for this to work -- Key G RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -2.369, y= oPos.pos.y + 2.424, z= oPos.pos.z - 0.692, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key GS RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -1.845, y= oPos.pos.y + 2.736 , z= oPos.pos.z - 1.243, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key A RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -1.795, y= oPos.pos.y + 2.424 , z= oPos.pos.z - 0.478, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key AS RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -1.267, y= oPos.pos.y + 2.736 , z= oPos.pos.z - 1.028, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key B RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -1.219, y= oPos.pos.y + 2.424 , z= oPos.pos.z - 0.264, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key C RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -0.642, y= oPos.pos.y + 2.424 , z= oPos.pos.z - 0.049, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key CS RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -0.116, y= oPos.pos.y + 2.736 , z= oPos.pos.z - 0.6, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key D RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + -0.064, y= oPos.pos.y + 2.424 , z= oPos.pos.z - -0.166, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key DS RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + 0.462, y= oPos.pos.y + 2.736, z= oPos.pos.z - 0.385, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key E RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + 0.508, y= oPos.pos.y + 2.424 , z= oPos.pos.z - -0.378, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key F RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + 1.086, y= oPos.pos.y + 2.424 , z= oPos.pos.z - -0.594, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key FS RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + 1.61, y= oPos.pos.y + 2.736 , z= oPos.pos.z - -0.042, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } currentKeyLoadIndex = currentKeyLoadIndex + 1 -- Key G2 RESMGR:LoadObject { objectTemplate = keyspawns[currentKeyLoadIndex], x= oPos.pos.x + 1.66, y= oPos.pos.y + 2.424 , z= oPos.pos.z - -0.807, rw= oPos.rot.w, rx= oPos.rot.x, ry= oPos.rot.y, rz = oPos.rot.z, owner = self } end function onUse(self, msg) local player = msg.user local imagination = player:GetImagination{}.imagination if IsPlayerInActivity(self, player) == false and imagination > 0 then -- Add player to activity self:AddActivityUser{ userID = player } -- Notify keys that they should made clickable even in camera mode local friends = self:GetObjectsInGroup{ group = "KeysForOrgan" }.objects for i = 1, table.maxn (friends) do if friends[i] then friends[i]:NotifyObject{name = "Clickable"} end end -- Check to see if anyone else is using the organ if self:ActivityUserExists{userID = player}.bExists then -- Make sure no one else can use organ if you do self:EnableActivity{bEnable = true, rerouteID = player} -- Store player storeObjectByName(self, "OrganUser", player) -- Start timers to drain imagination GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ORGAN_COST_FREQUENCY"], "DecreaseImagination", self ) end end end function DecreasePlayersImagination( self ) -- Define player local player = getObjectByName(self,"OrganUser") -- Get how much imagination the player has now local OldAmount = player:GetImagination{}.imagination -- Subtract the cost of using the organ local NewAmount = OldAmount - 2 if ( NewAmount <= 0 ) then -- If Imagination is less than 0, set to 0 NewAmount = 0 -- Stop timer to decrease imagination and reset organ GAMEOBJ:GetTimer():CancelTimer("DecreaseImagination", self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "organcomplete", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5, "organreset", self ) else -- If imagination is greater than 0, then start a new timer to drain imagination GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["ORGAN_COST_FREQUENCY"], "DecreaseImagination", self ) end -- Update their imagination if ( player ~= nil ) then player:SetImagination{ imagination = NewAmount } end end function onFireEventServerSide( self, msg ) -- If the client detects a movement, cancel imagination drain and reset organ if ( msg.args == "PlayerMoved" ) then GAMEOBJ:GetTimer():CancelTimer("DecreaseImagination", self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "organreset", self ) end end function onTimerDone(self, msg) if ( msg.name == "DecreaseImagination" ) then DecreasePlayersImagination( self ) elseif msg.name == "organreset" then -- Notify keys that they should made clickable even in camera mode local friends = self:GetObjectsInGroup{ group = "KeysForOrgan" }.objects for i = 1, table.maxn (friends) do if friends[i] then friends[i]:NotifyObject{name = "Unclickable"} end end -- Defining user player and removing them from activity local users = self:GetAllActivityUsers().objects for index,user in ipairs(users) do self:RemoveActivityUser{ userID = user } self:EnableActivity{bEnable = false, rerouteID = user} end end end ---------------------------------------------------------------- -- Returns true/false if a player is in the activity -- takes SELF and a PLAYER object ---------------------------------------------------------------- function IsPlayerInActivity(self, player) -- check if player is in activity local existMsg = self:ActivityUserExists{ userID = player } if (existMsg) then return existMsg.bExists end return false endfunction onStartup(self) self:AddObjectToGroup{group = "KeysForOrgan"} end function onUse(self, msg) local parentObj = self:GetParentObj().objIDParent local player = msg.user if parentObj:ActivityUserExists{userID = player}.bExists then local keyname = self:GetName().name -- Play key and minifig animation player:PlayAnimation{ animationID = keyname } self:PlayAnimation{ animationID = "interact" } end end function onNotifyObject(self, msg) if msg.name == "Clickable" then self:NotifyClientObject{name = "Click"} elseif msg.name == "Unclickable" then self:NotifyClientObject{name = "NoClick"} end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 5 -- Aggro Radius Set['conductRadius'] = 5 -- Conduct Radius Set['tetherRadius'] = 20 -- Tether Radius Set['tetherSpeed'] = 2 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 4 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = .25 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onProximityUpdate(self, msg) if msg.status == "ENTER" then self:PlayFXEffect{effectType = "scared"} end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "SnakeStartup",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.3, "SnakeFollow",self ) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 9999 -- Min Wander Delay Set['WanderDelayMax'] = 9999 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onDie(self, msg) local snakes = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (snakes) do snakes[i]:NotifyObject{name = "next5", ObjIDSender = self} end end function onNotifyObject(self, msg) if msg.name == "next4" then self:SetFaction{faction = 4} self:PlayFXEffect{effectType = "purple"} end end function onTimerDone(self, msg) if msg.name == "SnakeStartup" then self:AddObjectToGroup{ group = "snakesonaplane" } self:OverrideFriction{bEnableOverride = true, fFriction = 10} elseif msg.name == "SnakeFollow" then local friends = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6602 then self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } end end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "SnakeStartup",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.3, "SnakeFollow",self ) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 9999 -- Min Wander Delay Set['WanderDelayMax'] = 9999 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onDie(self, msg) local snakes = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (snakes) do snakes[i]:NotifyObject{name = "next4", ObjIDSender = self} end end function onNotifyObject(self, msg) if msg.name == "next3" then self:SetFaction{faction = 4} self:PlayFXEffect{effectType = "blue"} end end function onTimerDone(self, msg) if msg.name == "SnakeStartup" then self:AddObjectToGroup{ group = "snakesonaplane" } self:OverrideFriction{bEnableOverride = true, fFriction = 10} elseif msg.name == "SnakeFollow" then local friends = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6564 then self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } end end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "SnakeStartup",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.3, "SnakeFollow",self ) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 9999 -- Min Wander Delay Set['WanderDelayMax'] = 9999 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onDie(self, msg) local snakes = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (snakes) do snakes[i]:NotifyObject{name = "next3", ObjIDSender = self} end end function onNotifyObject(self, msg) if msg.name == "next2" then self:SetFaction{faction = 4} self:PlayFXEffect{effectType = "green"} end end function onTimerDone(self, msg) if msg.name == "SnakeStartup" then self:AddObjectToGroup{ group = "snakesonaplane" } self:OverrideFriction{bEnableOverride = true, fFriction = 10} elseif msg.name == "SnakeFollow" then local friends = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6565 then self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } end end end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "SnakeStartup",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.3, "SnakeFollow",self ) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 9999 -- Min Wander Delay Set['WanderDelayMax'] = 9999 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onDie(self, msg) local snakes = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (snakes) do snakes[i]:NotifyObject{name = "next2", ObjIDSender = self} end end function onNotifyObject(self, msg) if msg.name == "next1" then self:SetFaction{faction = 4} self:PlayFXEffect{effectType = "yellow"} end end function onTimerDone(self, msg) if msg.name == "SnakeStartup" then self:AddObjectToGroup{ group = "snakesonaplane" } self:OverrideFriction{bEnableOverride = true, fFriction = 10} elseif msg.name == "SnakeFollow" then local friends = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6566 then self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } end end end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "SnakeStartup",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.3, "SnakeFollow",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "SnakeGlow",self ) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 50 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = true Set['AggroDist'] = 7 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 0 -- Main Weight Set['WanderDelayMin'] = 9999 -- Min Wander Delay Set['WanderDelayMax'] = 9999 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onDie(self, msg) local snakes = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (snakes) do snakes[i]:NotifyObject{name = "next1", ObjIDSender = self} end end function onTimerDone(self, msg) if msg.name == "SnakeStartup" then self:AddObjectToGroup{ group = "snakesonaplane" } self:OverrideFriction{bEnableOverride = true, fFriction = 10} self:SetFaction{faction = 4} elseif msg.name == "SnakeFollow" then local friends = self:GetObjectsInGroup{ group = "snakesonaplane" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 6567 then self:FollowTarget { targetID = friends[i], radius = 4.5, speed = 1, keepFollowing = true } end end elseif msg.name == "SnakeGlow" then self:PlayFXEffect{effectType = "red"} end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = .75 -- Tether Speed Set['wanderRadius'] = 30 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0.75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 1 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0.65 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 10 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 1 -- Tether Speed Set['wanderRadius'] = 30 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 3 -- Min Wander Delay Set['WanderDelayMax'] = 6 -- Max Wander Delay Set['WanderSpeed'] = 0.75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) self:FollowWaypoints() -- make this a constant somewhere self:SetProximityRadius { radius = 15 } self:SetVar("IsFollowing", 0) self:SetVar("LinePosit", 0) self:SetVar("ReturningHome", 0) local pos = getHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos, radius = 100 } end --########################################################### --########## PROXIMITY --########################################################### function onProximityUpdate(self, msg) if(self:GetVar("IsFollowing") == 1) then return end if(self:GetVar("ReturningHome") == 1) then return end -- Stop evading on leave if msg.status == "ENTER" then -- get the local character local player = msg.objId -- only follow players if(player:IsCharacter().isChar == true) then local MissionState = player:GetMissionState{missionID = 133}.missionState if(MissionState == 2) then -- REQUEST FOLLOW, GET BACK POSITION, AND YES/NO local FollowMsg = GAMEOBJ:GetZoneControlID():RequestFollow{ targetID = msg.objId, requestorID = self } -- can we follow? if(FollowMsg.bCanFollow == true) then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("LinePosit", FollowMsg.iPosit) -- follow the player local mySpeed = self:GetSpeed().speed self:FollowTarget { targetID = player, radius = FollowMsg.iPosit * 5, speed = mySpeed, -- speed = math.random(2, 5), keepFollowing = true } self:SetVar("IsFollowing", 1) self:SetTetherPoint { tetherPt = self:GetPosition().pos, radius = 0 } -- Start despawn timer GAMEOBJ:GetTimer():AddTimerWithCancel(140, "despawnTimer", self) -- dont hardcode despawn time else print("CAN'T FOLLOW") end -- Evade them. It is a character without the mission. else GAMEOBJ:GetTimer():CancelAllTimers( self ) -- Should we call this multiple times? -- Prolly no need to call this until we get a stopped evading message or tether return local mySpeed = self:GetSpeed().speed self:EvadeTarget { targetID = player, radius = 20, speed = 7, keepEvading = true } end end -- store the player in felix object to face on arrival -- storeObjectByName(self, "playerTarget", player) end end --########################################################### --########## ON TIMER DONE --########################################################### onTimerDone = function(self, msg) if msg.name == "despawnTimer" then -- Despawn self self:Die{killType = "SILENT"} end if msg.name == "ReturnHome" then self:SetVar("ReturningHome", 1) self:FollowWaypoints() self:SetPathingSpeed{speed = 10} end end function onArrived(self, msg) -- Ick hack self:SetPathingSpeed{speed = 1} self:SetVar("ReturningHome", 0) self:ContinueWaypoints() end function onStoppedEvading(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "ReturnHome", self ) end onLeftTetherRadius = function(self, msg) if(self:GetVar("IsFollowing") == 1) then return end self:SetVar("ReturningHome", 1) self:FollowWaypoints() self:SetPathingSpeed{speed = 10} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onUse(self, msg) self:PlayAnimation{ animationID = "scared" } end require('o_mis') require('c_Zorillo') CONSTANTS["SUFFICIENT_STINK"] = 2 -- how much stink it takes to launch the balloon. Usually, each spot with a stinky player counts as 1. CONSTANTS["SKUNK_STINK_SKILL"] = 33 -- if a player has this skill, they have skunk stink on them CONSTANTS["IMITATION_STINK_SKILL"] = 35 -- if a player has this skill, they have imitation stink on them ( from something like perfume ) CONSTANTS["RECHECK_TIME"] = 0.5 -- if there's anyone on the balloon, how often to check for launch -------------------------------------------------------------- -- On startup -------------------------------------------------------------- function onStartup( self ) self:StopPathing{} -- start out stationary on the ground ResetStink( self ) self:SetVar( "bBalloonInUse", false ) -- whether the balloon is currently moving self:SetVar( "bPlayerOnBalloon", false ) -- whether there is at least one player on the balloon ( stinky or not ) registerWithZoneControlObject(self) end -------------------------------------------------------------- -- the trigger was just stepped on -------------------------------------------------------------- function onFireEvent( self, msg ) --print ( "inventor balloon onFireEvent" ) -- remember each trigger's ID as we get it, so that when any trigger is touched, we can check all 4 if ( msg.args == "switchOn" ) then storeObjectByName( self, "triggerID", msg.senderID ) end -- we don't care who gets on or off the triggers while the balloon is up in the air if ( self:GetVar( "bBalloonInUse" ) == true ) then return end -- check the stink level at each of the 4 switches and see if we have enough total to launch the balloon CheckForLaunch( self ) end -------------------------------------------------------------- -- timer done -------------------------------------------------------------- function onTimerDone( self, msg ) if (msg.name == "recheckTimer") then --print( "recheckTimer" ) CheckForLaunch( self ) elseif (msg.name == "CreditCheckTimer") then GiveCreditForLaunching( self ) end end -------------------------------------------------------------- -- reset the currentStink variable -------------------------------------------------------------- function ResetStink( self ) self:SetVar( "currentStink", 0 ) end -------------------------------------------------------------- -- set the currentStink variable to the amount needed to launch the balloon -------------------------------------------------------------- function SetStinkToMax( self ) self:SetVar( "currentStink", CONSTANTS["SUFFICIENT_STINK"] ) end -------------------------------------------------------------- -- see if there are enough stinky players on the trigger to launch the balloon -------------------------------------------------------------- function CheckForLaunch( self ) --print( "CheckForLaunch" ) -- remember how much stink was fueling the balloon before in case we need to change the anim local previousStink = self:GetVar( "currentStink" ) ResetStink( self ) self:SetVar( "bPlayerOnBalloon", false ) -- check how much stink is on players at the switch and store that in "currentStink" UpdateStinkAtSwitch( self ) --print( "CheckForLaunch: stink amount is " .. self:GetVar( "currentStink" ) ) -- if the amount of stink changed, -- change the balloon's animation so it matches how much stink is fueling it local newStink = self:GetVar( "currentStink" ) if ( newStink ~= previousStink ) then UpdateAnimation( self, newStink ) end if ( newStink >= CONSTANTS["SUFFICIENT_STINK"] ) then LaunchBalloon( self ) else -- as long as there is even one player on the balloon, --we need to keep checking the amount of stink even if noone new gets on -- in case a player uses the skunk perfume while already on the ballon if ( self:GetVar( "bPlayerOnBalloon" ) == true ) then SetRecheckTimer( self ) end end end -------------------------------------------------------------- -- there is enough stink, so start moving the moving platform -------------------------------------------------------------- function LaunchBalloon( self ) --print ( "inventor balloon, LAUNCH BALLOON!" ) self:SetVar( "bBalloonInUse", true ) self:StartPathing{} -- send the balloon up -- give any stinky players on the balloon credit towards an achievement GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "CreditCheckTimer", self ) end -------------------------------------------------------------- -- check how much stink the player's on the switch have -------------------------------------------------------------- function UpdateStinkAtSwitch( self ) -- check how much stink is on players at the switch and store that in "currentStink" local triggerID = nil triggerID = getObjectByName( self, "triggerID" ) if ( triggerID == nil ) then return end -- look for the players near the trigger local objs = triggerID:GetProximityObjects().objects local stinkAmount = 0 local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() if ( faction and faction.faction == 1 ) then -- it's a player --print( "player on switch" ) -- remember there's someone on the balloon -- it doesn't matter if they're stinky or not. We'll need to keep checking in case they use stink perfume while on there self:SetVar( "bPlayerOnBalloon", true ) -- check if the player has imitation stink ( from something like perfume ) -- if any one player has perfume stink, they are considered stinky enough to launch the balloon alone if ( target:IsSkillActive{ iSkillID = CONSTANTS["IMITATION_STINK_SKILL"] }.bOn ) then --print( "found a player with perfume" ) SetStinkToMax( self ) return end -- check if the player has skunk stink -- skunk stink counts as one ration of stinkiness towards fueling the balloon if ( target:IsSkillActive{ iSkillID = CONSTANTS["SKUNK_STINK_SKILL"] }.bOn ) then --print( "found a player with skunk stink" ) stinkAmount = stinkAmount + 1 if ( stinkAmount >= CONSTANTS["SUFFICIENT_STINK"] ) then SetStinkToMax( self ) return end end end index = index + 1 end self:SetVar( "currentStink", stinkAmount ) end -------------------------------------------------------------- -- see the timer to check the stink amount again -------------------------------------------------------------- function SetRecheckTimer( self ) GAMEOBJ:GetTimer():CancelTimer("recheckTimer", self) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["RECHECK_TIME"], "recheckTimer", self ) end -------------------------------------------------------------- -- give achievement credit for every stinky player on the switch when the balloon launches -------------------------------------------------------------- function GiveCreditForLaunching( self ) -- anyone who's on the balloon and is stinky when it launches gets credit for helping -- this is towards an achievement triggerID = getObjectByName( self, "triggerID" ) -- look for the players near the trigger local objs = triggerID:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local skunkStink = false local imitationStink = false local target = objs[index] local faction = target:GetFaction() if ( faction and faction.faction == 1 ) then -- it's a player -- check if the player has skunk stink if ( target:IsSkillActive{ iSkillID = CONSTANTS["SKUNK_STINK_SKILL"] }.bOn ) then skunkStink = true end -- check if the player has imitation stink ( from something like perfume ) if ( target:IsSkillActive{ iSkillID = CONSTANTS["IMITATION_STINK_SKILL"] }.bOn ) then imitationStink = true end -- if the player has either type of stink, give them credit if ( skunkStink or imitationStink ) then --achievement info here --this is hacky and not the right way we should be doing this, but it works, non the less -- Using the "Kill" mission type in the DB, we are able to update the mission through the objects by calling --the "kill" tasktype with calues of one. The downfall is that this will only allow one mission on the designated objects that --use the kill type. The commented out updatemissiontask functions are the way we should be doing this but is broken. target:UpdateMissionTask {target = self, value = 1, value2 = 1, taskType = "kill"} --target:UpdateMissionTask{target = self, value = 161, value2 = 1, taskType = "complete" } --target:UpdateMissionTask{target = self, value = 162, value2 = 1, taskType = "complete" } --target:UpdateMissionTask{target = self, value = 163, value2 = 1, taskType = "complete" } --print( "balloon achievement updated" ) end end index = index + 1 end end -------------------------------------------------------------- -- change the animantion to reflect how much stink is currently feeding into it -------------------------------------------------------------- function UpdateAnimation( self, stinkAmount ) -- return early if render is not ready if ( self:GetVar( "bRenderReady" ) == false ) then return end if ( stinkAmount == 0 ) then self:PlayAnimation{ animationID = "balloon1" } elseif ( stinkAmount == 1 ) then self:PlayAnimation{ animationID = "balloon2" } elseif ( stinkAmount == CONSTANTS["SUFFICIENT_STINK"] ) then self:PlayAnimation{ animationID = "balloon3" } end end -------------------------------------------------------------- -- Notification to object -------------------------------------------------------------- function onNotifyObject( self, msg ) if ( msg.name == "playerLoaded" ) then -- tell the client-side script for the just-loaded player to use the appropriate anim based on how inflated the balloon is self:NotifyClientRebuildSectionState{ rerouteID = msg.ObjIDSender, iState = self:GetVar( "currentStink" ) } end end function onArrived( self, msg ) --print( "BALLOON onArrived" ) --print( "arrived at waypoint: ") --print( msg.wayPoint) if( msg.wayPoint == CONSTANTS["LAST_BALLOON_WAYPOINT"] ) then --print( "at last waypoint" ) self:StopPathing{} self:SetVar( "bBalloonInUse", false ) CheckForLaunch( self ) -- check whether enough stinky players stayed on the platform to launch it again end end CONSTANTS = {} CONSTANTS["radius"] = 5 function onStartup(self) self:SetProximityRadius { radius = CONSTANTS["radius"] } end function onStartup(self) self:SetProximityRadius { radius = 10, FOVradius = 90, name = "BubbleRadius" } self:SetVar("rebuildDone", false) end function onProximityUpdate(self, msg) if msg.status == "ENTER" and self:GetVar("rebuildDone") == true then self:CastSkill{optionalTargetID = msg.objId, skillID = 116} msg.objId:ActivateBubbleBuff{} end end function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then self:SetVar("rebuildDone", true) else self:SetVar("rebuildDone", false) end end function onStartup(self) self:SetProximityRadius { radius = 10, FOVradius = 90, name = "BubbleRadius" } GAMEOBJ:GetTimer():AddTimerWithCancel( 30.0, "RemoveBubbleBlower",self ) end function onProximityUpdate(self, msg) if msg.status == "ENTER" then self:CastSkill{optionalTargetID = msg.objId, skillID = 116} msg.objId:ActivateBubbleBuff{} end end onTimerDone = function(self, msg) if msg.name == "RemoveBubbleBlower" then self:Die{killType = "SILENT"} end end require('o_mis') local spawnDistance = 0.0 local entityTemplateID = 3363 -- Called anytime the rebuild object's state changes function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then --self:PlayFXEffect{effectType = "rebuild-complete"} self:SetRebuildState{iState = 0} -- get the heading and create a vector using spawn distance local heading = getHeading(self) heading.x = heading.x * spawnDistance heading.y = heading.y * spawnDistance heading.z = heading.z * spawnDistance -- add some offset local mypos = self:GetPosition().pos mypos.x = mypos.x + heading.x mypos.y = mypos.y + heading.y mypos.z = mypos.z + heading.z RESMGR:LoadObject { objectTemplate = entityTemplateID , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self } end end -- Store the parent in the child --function onChildLoaded(self, msg) --if msg.templateID == entityTemplateID then --storeParent(self, msg.childID) --end --end -------------------------------------------------------------- -- Server side script maintains the state of the bubble statue -- if statue is not enabled, we can bubble the player -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Get the enable state -------------------------------------------------------------- function GetEnableState(self) return self:GetVar("StatueEnabled") end -------------------------------------------------------------- -- Set the enable state -------------------------------------------------------------- function SetEnableState(self, state) -- calc new state and set local bIsEnabled = (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) self:SetVar("StatueEnabled", bIsEnabled) end -------------------------------------------------------------- -- On startup -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetProximityRadius{ radius = CONSTANTS["BUBBLE_STATUE_RADIUS"]} -- stores if the statue mode is currently enabled self:SetVar("StatueEnabled", true) end -------------------------------------------------------------- -- Called when proximity is updated -------------------------------------------------------------- function onProximityUpdate(self, msg) -- a player enters proximity and we are Not in statue mode if ( msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 and GetEnableState(self) == false) then -- if the player that just entered proximity had skunk stink, clean it off BubblePlayer( self, msg ) end end -------------------------------------------------------------- -- try to put player in bubble and destink -------------------------------------------------------------- function BubblePlayer( self, msg ) self:CastSkill{ optionalTargetID = msg.objId, skillID = CONSTANTS["DESTINK_SKILL"] } msg.objId:ActivateBubbleBuff{} end -------------------------------------------------------------- -- Notification to object -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetEnableState(self, msg.param1) end end -------------------------------------------------------------- -- Responsible for registering with the client side -- zone object to control actions and animations. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) end -------------------------------------------------------------- -- Generic notification message -------------------------------------------------------------- function onNotifyObject(self, msg) -- Update event state if (msg.name == "start_event") then -- get position local mypos = self:GetPosition().pos -- Turn on detectors RESMGR:LoadObject { objectTemplate = 3434, x= mypos.x, y= mypos.y - 1.2, z= mypos.z, owner = self, rw= 0.7071, rx= 0.0, ry= -0.7071, rz = 0.0 } elseif (msg.name == "stop_event") then -- Turn off detectors local childDetector = getObjectByName(self, "Detector") if(childDetector) then childDetector:Die{killerID = childDetector, killType = "SILENT"} end end end onChildLoaded = function(self,msg) if msg.templateID == 3434 then storeObjectByName(self, "Detector", msg.childID) storeParent(self, msg.childID) end end function onStartup(self) -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 20 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 1 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end function onStartup (self) --self:SetVar("blooming", false) self:SetNetworkVar("blooming", false) end function onSkillEventFired( self, msg ) if msg.wsHandle == "waterspray" or msg.wsHandle == "shovelgrow" then self:SetVar("caster", msg.casterID:GetID()) if self:GetNetworkVar("blooming") == false then self:SetNetworkVar("blooming", true) self:NotifyClientObject{ name = "sprout" } GAMEOBJ:GetTimer():AddTimerWithCancel( 16.0 , "FlowerDie", self ) self:AddActivityUser{userID = msg.casterID} self:DistributeActivityRewards{userID = msg.casterID, bAutoAddCurrency = false, bAutoAddItems = false} self:RemoveActivityUser{userID = msg.casterID} -- Update Missions msg.casterID:UpdateMissionTask {taskType = "complete", value = 195, value2 = 1, target = self} -- Update Achievements msg.casterID:UpdateMissionTask {taskType = "complete", value = 153, value2 = 1, target = self} msg.casterID:UpdateMissionTask {taskType = "complete", value = 152, value2 = 1, target = self} msg.casterID:UpdateMissionTask {taskType = "complete", value = 143, value2 = 1, target = self} end end end function onTimerDone (self, msg) if msg.name == "FlowerDie" then self:RequestDie{} end end -- REFACTORED SEPTEMBER 23, 2008. NO LONGER USED. --[[ -- Note in case we ever want to copy the Youreeka fountain and spout scripts to use in another level: -- The server-side zone script also does some of the work -- It watches for the fountain and all 3 spouts to load -- After any one of them loads, it checks to see if it has all 4 yet -- If so, then it calls the fountain's onObjectLoaded 3 times to send it each spout ID -- and calls each spout's onObjectLoaded to give it the fountain's ID -- See L_SKUNK_EVENT.lua functions onObjectLoaded, SendSpoutIDsToFountain, and AreAllFountainPiecesLoaded to see how it works require('o_mis') SPOUTS = {} CONSTANTS = {} CONSTANTS["SpoutLOT"] = 3283 -- the LOT for the spouts -- states for which spouts are plugged CONSTANTS["SPOUTS_PLUGGED_NONE"] = 0 CONSTANTS["SPOUTS_PLUGGED_1"] = 1 CONSTANTS["SPOUTS_PLUGGED_2"] = 2 CONSTANTS["SPOUTS_PLUGGED_3"] = 3 CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] = 4 CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] = 5 CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] = 6 CONSTANTS["SPOUTS_DEACTIVATED"] = 7 CONSTANTS["NUM_SPOUTS"] = 3 -- how many fountain spouts there are function onStartup(self) -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_NONE"] ) self:PlayAnimation{ animationID = "normal" } end function onObjectLoaded( self, msg ) if ( msg.templateID == CONSTANTS["SpoutLOT"] ) then -- store object in the spouts array local nextSpout = #SPOUTS + 1 SPOUTS[nextSpout] = msg.objectID:GetID() --print( "---------------------FOUNTAIN: found a spout" ) local spout = GAMEOBJ:GetObjectByID( SPOUTS[nextSpout] ) --spout:NotifyObject{ name="test_spout" } spout:SetVar( "spoutIndex", nextSpout ) spout:NotifyObject{ name = "storeIndex", param1 = nextSpout } end end function onNotifyObject( self, msg ) if ( msg.name == "test_fountain" ) then --print ( "----------------------------------------" ) --print ( "FOUNTAIN: OnNotifyObject test_fountain" ) --print ( "----------------------------------------" ) elseif( msg.name == "spout1Plugged" ) then Spout1Plugged( self ) elseif( msg.name == "spout2Plugged" ) then Spout2Plugged( self ) elseif( msg.name == "spout3Plugged" ) then Spout3Plugged( self ) elseif( msg.name == "spout1Unplugged" ) then Spout1Unplugged( self ) elseif( msg.name == "spout2Unplugged" ) then Spout2Unplugged( self ) elseif( msg.name == "spout3Unplugged" ) then Spout3Unplugged( self ) elseif( msg.name == "deactivateSpouts" ) then DeactivateSpouts( self ) elseif( msg.name == "reactivateSpouts" ) then ReactivateSpouts( self ) end end function Spout1Plugged( self ) -- if we already knew this spout was plugged, or if it has a bouncer already, we're allset local oldState = self:GetVar( "eSpoutsState" ) if ( oldState == CONSTANTS["SPOUTS_PLUGGED_1"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] or oldState == CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) then return end --print ( "-----------------------FOUNTAIN: Spout1Plugged" ) local spout1 = GAMEOBJ:GetObjectByID( SPOUTS[1] ) local spout2 = GAMEOBJ:GetObjectByID( SPOUTS[2] ) local spout3 = GAMEOBJ:GetObjectByID( SPOUTS[3] ) if ( spout1 == nil or spout2 == nil or spout3 == nil ) then return end if ( oldState == CONSTANTS["SPOUTS_PLUGGED_NONE"] ) then spout1:NotifyObject{ name="plugged" } spout2:NotifyObject{ name="increased" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_2"] ) then spout1:NotifyObject{ name="plugged" } spout3:NotifyObject{ name="launchable" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_3"] ) then spout1:NotifyObject{ name="plugged" } spout2:NotifyObject{ name="launchable" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) end end function Spout2Plugged( self ) -- if we already knew this spout was plugged, or if it has a bouncer already, we're allset local oldState = self:GetVar( "eSpoutsState" ) if ( oldState == CONSTANTS["SPOUTS_PLUGGED_2"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] or oldState == CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) then return end --print ( "-----------------------FOUNTAIN: Spout2Plugged" ) local spout1 = GAMEOBJ:GetObjectByID( SPOUTS[1] ) local spout2 = GAMEOBJ:GetObjectByID( SPOUTS[2] ) local spout3 = GAMEOBJ:GetObjectByID( SPOUTS[3] ) if ( spout1 == nil or spout2 == nil or spout3 == nil ) then return end if ( oldState == CONSTANTS["SPOUTS_PLUGGED_NONE"] ) then spout1:NotifyObject{ name="increased" } spout2:NotifyObject{ name="plugged" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_1"] ) then spout2:NotifyObject{ name="plugged" } spout3:NotifyObject{ name="launchable" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_3"] ) then spout1:NotifyObject{ name="launchable" } spout2:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) end end function Spout3Plugged( self ) -- if we already knew this spout was plugged, or if it has a bouncer already, we're allset local oldState = self:GetVar( "eSpoutsState" ) if ( oldState == CONSTANTS["SPOUTS_PLUGGED_3"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] or oldState == CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) then return end --print ( "-----------------------FOUNTAIN: Spout3Plugged" ) local spout1 = GAMEOBJ:GetObjectByID( SPOUTS[1] ) local spout2 = GAMEOBJ:GetObjectByID( SPOUTS[2] ) local spout3 = GAMEOBJ:GetObjectByID( SPOUTS[3] ) if ( spout1 == nil or spout2 == nil or spout3 == nil ) then return end if ( oldState == CONSTANTS["SPOUTS_PLUGGED_NONE"] ) then spout1:NotifyObject{ name="increased" } spout2:NotifyObject{ name="increased" } spout3:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_3"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_1"] ) then spout2:NotifyObject{ name="launchable" } spout3:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_2"] ) then spout1:NotifyObject{ name="launchable" } spout3:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) end end function Spout1Unplugged( self ) -- if we didn't think this spout was plugged, don't worry about it local oldState = self:GetVar( "eSpoutsState" ) if ( oldState == CONSTANTS["SPOUTS_PLUGGED_NONE"] or oldState == CONSTANTS["SPOUTS_PLUGGED_2"] or oldState == CONSTANTS["SPOUTS_PLUGGED_3"] or oldState == CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) then return end --print ( "-----------------------FOUNTAIN: Spout1Unplugged" ) local spout1 = GAMEOBJ:GetObjectByID( SPOUTS[1] ) local spout2 = GAMEOBJ:GetObjectByID( SPOUTS[2] ) local spout3 = GAMEOBJ:GetObjectByID( SPOUTS[3] ) if ( spout1 == nil or spout2 == nil or spout3 == nil ) then return end if ( oldState == CONSTANTS["SPOUTS_PLUGGED_1"] ) then spout1:NotifyObject{ name="normal" } spout2:NotifyObject{ name="normal" } spout3:NotifyObject{ name="normal" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_NONE"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) then spout1:NotifyObject{ name="increased" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) then spout1:NotifyObject{ name="increased" } spout2:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_3"] ) end end function Spout2Unplugged( self ) -- if we didn't think this spout was plugged, don't worry about it local oldState = self:GetVar( "eSpoutsState" ) if ( oldState == CONSTANTS["SPOUTS_PLUGGED_NONE"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1"] or oldState == CONSTANTS["SPOUTS_PLUGGED_3"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) then return end --print ( "-----------------------FOUNTAIN: Spout2Unplugged" ) local spout1 = GAMEOBJ:GetObjectByID( SPOUTS[1] ) local spout2 = GAMEOBJ:GetObjectByID( SPOUTS[2] ) local spout3 = GAMEOBJ:GetObjectByID( SPOUTS[3] ) if ( spout1 == nil or spout2 == nil or spout3 == nil ) then return end if ( oldState == CONSTANTS["SPOUTS_PLUGGED_2"] ) then spout1:NotifyObject{ name="normal" } spout2:NotifyObject{ name="normal" } spout3:NotifyObject{ name="normal" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_NONE"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) then spout2:NotifyObject{ name="increased" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) then spout1:NotifyObject{ name="increased" } spout2:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_3"] ) end end function Spout3Unplugged( self ) -- if we didn't think this spout was plugged, don't worry about it local oldState = self:GetVar( "eSpoutsState" ) if ( oldState == CONSTANTS["SPOUTS_PLUGGED_NONE"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1"] or oldState == CONSTANTS["SPOUTS_PLUGGED_2"] or oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) then return end --print ( "-----------------------FOUNTAIN: Spout3Unplugged" ) local spout1 = GAMEOBJ:GetObjectByID( SPOUTS[1] ) local spout2 = GAMEOBJ:GetObjectByID( SPOUTS[2] ) local spout3 = GAMEOBJ:GetObjectByID( SPOUTS[3] ) if ( spout1 == nil or spout2 == nil or spout3 == nil ) then return end if ( oldState == CONSTANTS["SPOUTS_PLUGGED_3"] ) then spout1:NotifyObject{ name="normal" } spout2:NotifyObject{ name="normal" } spout3:NotifyObject{ name="normal" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_NONE"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) then spout2:NotifyObject{ name="increased" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1"] ) elseif ( oldState == CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) then spout1:NotifyObject{ name="increased" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2"] ) end end function onFireEventServerSide( self, msg ) --print( "-------------FOUNTAIN: onFireEventServerSide" ) if ( msg.args == "slash" ) then DoSlashCommand( self, msg ) end end function DoSlashCommand( self, msg ) -- received a slash command to simulate a player getting on or off a spout -- param1 is which spout -- param2 is on or off if ( msg.param1 == 1 ) then if ( msg.param2 == 1 ) then --print( "-------------FOUNTAIN: DoSlashCommand, spout 1 on" ) Spout1Plugged( self ) else --print( "-------------FOUNTAIN: DoSlashCommand, spout 1 off" ) Spout1Unplugged( self ) end elseif ( msg.param1 == 2 ) then if ( msg.param2 == 1 ) then --print( "-------------FOUNTAIN: DoSlashCommand, spout 2 on" ) Spout2Plugged( self ) else --print( "-------------FOUNTAIN: DoSlashCommand, spout 2 off" ) Spout2Unplugged( self ) end else if ( msg.param2 == 1 ) then --print( "-------------FOUNTAIN: DoSlashCommand, spout 3 on" ) Spout3Plugged( self ) else --print( "-------------FOUNTAIN: DoSlashCommand, spout 3 off" ) Spout3Unplugged( self ) end end end function onFireEvent( self, msg ) if ( msg.args == "askSpout1State" ) then AnswerSpout1State( self, msg ) elseif ( msg.args == "askSpout2State" ) then AnswerSpout2State( self, msg ) elseif ( msg.args == "askSpout3State" ) then AnswerSpout3State( self, msg ) end end function AnswerSpout1State( self ) -- Spout 1's client-side script has just started up and wants to know what state the fountain is in -- so that it can set its water level accordinly. -- It sent a message to its server-side script, which has now asked the fountain. -- Tell it how high its water should be (via its server-side script). --print( "-------------FOUNTAIN: AnswerSpout1State" ) local spout = GAMEOBJ:GetObjectByID( SPOUTS[1] ) if ( spout == nil ) then return end local spoutsState = self:GetVar( "eSpoutsState" ) if ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_NONE"] ) then spout:NotifyObject{ name="normal" } elseif ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_2"] or spoutsState == CONSTANTS["SPOUTS_PLUGGED_3"] ) then spout:NotifyObject{ name="increased" } elseif ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) then spout:NotifyObject{ name="launchable" } else spout:NotifyObject{ name="plugged" } end end function AnswerSpout2State( self ) -- Spout 2's client-side script has just started up and wants to know what state the fountain is in -- so that it can set its water level accordinly. -- It sent a message to its server-side script, which has now asked the fountain. -- Tell it how high its water should be (via its server-side script). --print( "-------------FOUNTAIN: AnswerSpout2State" ) local spout = GAMEOBJ:GetObjectByID( SPOUTS[2] ) if ( spout == nil ) then return end local spoutsState = self:GetVar( "eSpoutsState" ) if ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_NONE"] ) then spout:NotifyObject{ name="normal" } elseif ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_1"] or spoutsState == CONSTANTS["SPOUTS_PLUGGED_3"] ) then spout:NotifyObject{ name="increased" } elseif ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) then spout:NotifyObject{ name="launchable" } else spout:NotifyObject{ name="plugged" } end end function AnswerSpout3State( self ) -- Spout 3's client-side script has just started up and wants to know what state the fountain is in -- so that it can set its water level accordinly. -- It sent a message to its server-side script, which has now asked the fountain. -- Tell it how high its water should be (via its server-side script). --print( "-------------FOUNTAIN: AnswerSpout3State" ) local spout = GAMEOBJ:GetObjectByID( SPOUTS[3] ) if ( spout == nil ) then return end local spoutsState = self:GetVar( "eSpoutsState" ) if ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_NONE"] ) then spout:NotifyObject{ name="normal" } elseif ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_1"] or spoutsState == CONSTANTS["SPOUTS_PLUGGED_2"] ) then spout:NotifyObject{ name="increased" } elseif ( spoutsState == CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) then spout:NotifyObject{ name="launchable" } else spout:NotifyObject{ name="plugged" } end end function DeactivateSpouts( self ) -- the skunk invasion is happening and the big base is coming up around the fountain -- turn off the effects and the functionality of the spouts --print( "-------------FOUNTAIN: DeactivateSpouts" ) self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_DEACTIVATED"] ) for spoutID = 1, CONSTANTS["NUM_SPOUTS"] do local spout = GAMEOBJ:GetObjectByID(SPOUTS[spoutID]) if ( spout ~= nil ) then spout:NotifyObject{ name = "deactivate" } end end end function ReactivateSpouts( self ) -- the skunk invasion just ended -- turn the effects and the functionality of the spouts back on --print( "-------------FOUNTAIN: ReactivateSpouts" ) local spout1 = GAMEOBJ:GetObjectByID(SPOUTS[1]) local spout2 = GAMEOBJ:GetObjectByID(SPOUTS[2]) local spout3 = GAMEOBJ:GetObjectByID(SPOUTS[3]) if ( spout1 == nil or spout2 == nil or spout3 == nil) then return end -- check the proximity objects of each spout to see if anyone is currently on it local bPlayerOn1 = DoesSpoutHaveAPlayer( self, 1 ) local bPlayerOn2 = DoesSpoutHaveAPlayer( self, 2 ) local bPlayerOn3 = DoesSpoutHaveAPlayer( self, 3 ) -- set the spouts state based on which of the spouts were occupied -- and tel the spouts to set their effects / bouncer accordingly DetermineSpoutsState( self, bPlayerOn1, bPlayerOn2, bPlayerOn3 ) -- tell the spouts to clear their deactivated flags for spoutID = 1, CONSTANTS["NUM_SPOUTS"] do local spout = GAMEOBJ:GetObjectByID(SPOUTS[spoutID]) if ( spout ~= nil ) then spout:NotifyObject{ name = "reactivate" } end end end function DoesSpoutHaveAPlayer( self, spoutIndex ) if ( spoutIndex <= 0 or spoutIndex > CONSTANTS["NUM_SPOUTS"] ) then return false end local spout = GAMEOBJ:GetObjectByID(SPOUTS[spoutIndex]) if ( spout == nil ) then return end -- check this spout's proximity objects to see if anyone is currently on it local objs = spout:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() if ( faction and faction.faction == 1 ) then -- it's a player --print( "-------------FOUNTAIN: found a player at spout " .. spoutIndex ) return true end index = index + 1 end return false end function DetermineSpoutsState( self, bPlayerOn1, bPlayerOn2, bPlayerOn3 ) -- we're turning the spouts back on because the skunk event ended -- we've already done a proximity check on each to see if there are any players on it -- set the spouts state accordingly, and tell each spout its water height local spout1 = GAMEOBJ:GetObjectByID(SPOUTS[1]) local spout2 = GAMEOBJ:GetObjectByID(SPOUTS[2]) local spout3 = GAMEOBJ:GetObjectByID(SPOUTS[3]) if ( spout1 == nil or spout2 == nil or spout3 == nil) then return end if ( bPlayerOn1 == false and bPlayerOn2 == false and bPlayerOn3 == false ) then spout1:NotifyObject{ name="normal" } spout2:NotifyObject{ name="normal" } spout3:NotifyObject{ name="normal" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_NONE"] ) elseif ( bPlayerOn1 == true and bPlayerOn2 == false and bPlayerOn3 == false ) then spout1:NotifyObject{ name="plugged" } spout2:NotifyObject{ name="increased" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1"] ) elseif ( bPlayerOn1 == false and bPlayerOn2 == true and bPlayerOn3 == false ) then spout1:NotifyObject{ name="increased" } spout2:NotifyObject{ name="plugged" } spout3:NotifyObject{ name="increased" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2"] ) elseif ( bPlayerOn1 == false and bPlayerOn2 == false and bPlayerOn3 == true ) then spout1:NotifyObject{ name="increased" } spout2:NotifyObject{ name="increased" } spout3:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_3"] ) elseif ( bPlayerOn1 == true and bPlayerOn2 == true and bPlayerOn3 == false ) then spout1:NotifyObject{ name="plugged" } spout2:NotifyObject{ name="plugged" } spout3:NotifyObject{ name="launchable" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1_AND_2"] ) elseif ( bPlayerOn1 == true and bPlayerOn2 == false and bPlayerOn3 == true ) then spout1:NotifyObject{ name="plugged" } spout2:NotifyObject{ name="launchable" } spout3:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_1_AND_3"] ) elseif ( bPlayerOn1 == false and bPlayerOn2 == true and bPlayerOn3 == true ) then spout1:NotifyObject{ name="launchable" } spout2:NotifyObject{ name="plugged" } spout3:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) -- make a special case here in case there are people on all 3 spouts when the skunk invasion ends -- immediately bounce the player off one of them elseif ( bPlayerOn1 == true and bPlayerOn2 == true and bPlayerOn3 == true ) then spout1:NotifyObject{ name="launchable" } spout2:NotifyObject{ name="plugged" } spout3:NotifyObject{ name="plugged" } self:SetVar( "eSpoutsState", CONSTANTS["SPOUTS_PLUGGED_2_AND_3"] ) end end --]] require('o_mis') CONSTANTS = {} CONSTANTS["radius"] = 4 CONSTANTS["switchFrequency"] = 1 -- once the switch is activated, how often to check and see if it's still activated function onStartup(self) self:SetProximityRadius { radius = CONSTANTS["radius"] } end onTimerDone = function(self, msg) if (msg.name == "checkSwitchTimer") then --print ( "------------------------------------" ) --print ( " hazmat bouncer onTimerDone: checkSwitchTimer" ) --print ( "------------------------------------" ) if ( IsSwitchActivated( self ) ) then BouncePlayers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["switchFrequency"], "checkSwitchTimer", self ) end end end function onFireEvent(self, msg) --print ( "------------------------------------" ) --print ( "hazmat bouncer onFireEvent" ) --print ( "------------------------------------" ) if ( msg.args == "switchPressed" ) then --print ( "------------------------------------" ) --print ( "hazmat bouncer switchPressed" ) --print ( "------------------------------------" ) -- remember the objID of the trigger (switch) so we can keep checking whether there's a player in its proximity -- that way you don't have to back off and touch it again in order to bounce somebody else storeObjectByName( self, "switchID", msg.senderID ) BouncePlayers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["switchFrequency"], "checkSwitchTimer", self ) end -- switchPressed end function BouncePlayers( self ) local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then --print ( "------------------------------------------------------------------" ) --print ( "hazmat bouncer BouncePlayers: found a player on the bouncepad" ) --print ( "------------------------------------------------------------------" ) self:BouncerTriggered{triggerObj = target} end index = index + 1 end end function IsSwitchActivated( self ) triggerID = getObjectByName( self, "switchID" ) if ( triggerID == nil ) then return false end -- check if there are any players near the switch local objs = triggerID:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() if ( faction and faction.faction == 1 ) then --print ( "------------------------------------------------------------------" ) --print ( "hazmat bouncer IsSwitchActivated: found a player on the switch" ) --print ( "------------------------------------------------------------------" ) return true end index = index + 1 end --print ( "------------------------------------------------------------------" ) --print ( "hazmat bouncer IsSwitchActivated: nobody on the switch" ) --print ( "------------------------------------------------------------------" ) return false end CONSTANTS = {} CONSTANTS["radius"] = 5 function onStartup(self) self:SetProximityRadius { radius = CONSTANTS["radius"] } end require('State') require('o_mis') CONSTANTS = {} CONSTANTS["FACTION"] = 5 function onStartup(self) self:SetFaction { faction = CONSTANTS["FACTION"] } end function onSquirtWithWatergun( self, msg ) --print( "------------------------------------------------" ) --print( "SQUIRT HAZMAT MISSION GIVER WITH WATERGUN" ) --print( "------------------------------------------------" ) --nothing to do here because the destink cast already takes care of it end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) registerWithZoneControlObject(self) end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState(self, msg) GAMEOBJ:GetTimer():CancelAllTimers( self ) -- if we just hit the idle state if (msg.iState == 3 and msg.iPrevState == 2) then -- start a timer to break ourself again GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["HAZMAT_REBUILD_RESET_TIME"] , "BreakTimer", self ) end end -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone(self, msg) -- timer for earthquake ending if (msg.name == "BreakTimer") then self:RebuildReset() end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 1 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0.35 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('o_mis') CONSTANTS = {} CONSTANTS["STINKY_SKILL"] = 33 CONSTANTS["DESTINK_SKILL_ID"] = 116 function onStartup( self ) self:AddSkill{ skillID = CONSTANTS["DESTINK_SKILL_ID"] } self:SetProximityRadius { radius = 10 } self:SetVar( "broken", false ) end function CleanNearbyPlayers( self ) --print( "HYDRANT CleanNearbyPlayers" ) -- look for stinky players near the hyrdrant and destink them local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() if ( faction and faction.faction == 1 ) then --print( "hydrant found player" ) if ( target:IsSkillActive{ iSkillID = CONSTANTS["STINKY_SKILL"] }.bOn ) then --print( "hydrant destinks player" ) self:CastSkill{ optionalTargetID = target, skillID = CONSTANTS["DESTINK_SKILL_ID"] } end end index = index + 1 end end function onFireEventServerSide( self, msg ) if ( msg.args == "cleanPlayers" ) then --print( "-------------HYDRANT: onFireEventServerSide cleanPlayers" ) CleanNearbyPlayers( self ) elseif ( msg.args == "breakHydrant" ) then --print( "-------------HYDRANT: onFireEventServerSide breakHydrant" ) self:SetVar( "broken", true ) elseif ( msg.args == "repairHydrant" ) then --print( "-------------HYDRANT: onFireEventServerSide repairHydrant" ) self:SetVar( "broken", false ) end end function onProximityUpdate( self, msg ) if ( msg.status == "ENTER" and self:GetVar("broken") == true ) then --print( "-------------HYDRANT: onProximityUpdate" ) if ( msg.objId:IsSkillActive{ iSkillID = CONSTANTS["STINKY_SKILL"] }.bOn ) then --print( "hydrant destinks player" ) self:CastSkill{ optionalTargetID = msg.objId, skillID = CONSTANTS["DESTINK_SKILL_ID"] } end end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS["HYDRANT_BOUNCER_LOT"] = 4008 CONSTANTS["REPAIRED_HYDRANT_LOT"] = 3997 CONSTANTS["HYDRANT_REPAIR_AFTER_SMASH_TIME"] = 10.0 CONSTANTS["HYDRANT_REPAIR_AFTER_USE_TIME"] = 2.0 -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) local originalHydrant = getParent(self) if( originalHydrant ~= nil and originalHydrant:Exists() ) then --print( "copying info from original" ) self:SetVar( "hydrantPos", originalHydrant:GetVar( "hydrantPos" ) ) local speed = originalHydrant:GetVar( "bouncer_speed" ) local destination = originalHydrant:GetVar( "bouncer_destination" ) self:SetVar( "bouncer_speed", speed ) self:SetVar( "bouncer_destination", destination ) --else --print( "don't know the original hydrant" ) end ForgetBouncer( self ) AddBouncer( self ) --self:AddSkill{ skillID = CONSTANTS["DESTINK_SKILL"] } -- done via ObjectSkills table -- if the player who smashed the hydrant doesn't use it soon enough, we'll replace it with a repaired hydrant again SetRepairTimer( self, CONSTANTS["HYDRANT_REPAIR_AFTER_SMASH_TIME"] ) end -------------------------------------------------------------- -- called when a child object is loaded up, in this case, the bouncer -------------------------------------------------------------- function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["HYDRANT_BOUNCER_LOT"] ) then --print( "bouncer loaded server-side" ) storeObjectByName( self, "bouncerID", msg.childID ) storeParent( self, msg.childID ) end end -------------------------------------------------------------- -- add the bouncer -------------------------------------------------------------- function AddBouncer( self ) -- return out if we already have a bouncer if ( self:GetVar( "bouncerID" ) ~= CONSTANTS["NO_OBJECT"] ) then return end -- get the hydrant's position local myPos = self:GetVar( "hydrantPos" ) local bounceSpeed = self:GetVar("bouncer_speed") -- set up bouncer config data local vecString = self:GetVar("bouncer_destination") local config = { {"bouncer_speed", bounceSpeed} , {"objtype", CONSTANTS["HF_NODE_BOUNCER"]}, {"bouncer_destination", vecString } } RESMGR:LoadObject { objectTemplate = CONSTANTS["HYDRANT_BOUNCER_LOT"], x = myPos.x, y = myPos.y, z = myPos.z, owner = self, objType = CONSTANTS["HF_NODE_BOUNCER"], configData = config } end -------------------------------------------------------------- -- clear out the bouncer variable -------------------------------------------------------------- function ForgetBouncer( self ) self:SetVar( "bouncerID", CONSTANTS["EMPTY_ID_NAME"] ) end -------------------------------------------------------------- -- got a fireEvent message from client-side -------------------------------------------------------------- function onFireEventServerSide( self, msg ) if ( msg.args == "cleanPlayer" ) then --print( "server-side broken hydrant got msg to clean player" ) --CleanPlayer( self, player) CleanPlayer( self, msg.senderID ) -- get rid of the bouncer RemoveBouncer( self ) -- set a timer to delete the broken hydrant itself SetRepairTimer( self, CONSTANTS["HYDRANT_REPAIR_AFTER_USE_TIME"] ) end end -------------------------------------------------------------- --cast the destink still on the given player -------------------------------------------------------------- function CleanPlayer( self, target ) if ( target and target:Exists() and target:GetFaction().faction == 1 ) then --print( "casting destink skill" ) self:CastSkill{ optionalTargetID = target, skillID = CONSTANTS["DESTINK_SKILL"] } end end -------------------------------------------------------------- -- remove the bouncer -------------------------------------------------------------- function RemoveBouncer( self ) local bouncerObj = getObjectByName( self, "bouncerID" ) if( bouncerObj ~= nil and bouncerObj:Exists() ) then GAMEOBJ:DeleteObject( bouncerObj ) ForgetBouncer( self ) end end -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone( self, msg ) if (msg.name == "repairTimer") then RevertToRepairedHydrant( self ) end end -------------------------------------------------------------- -- get rid of the bouncer and the broken hydrant and spawn in a regular, repaired hydrant instead -------------------------------------------------------------- function RevertToRepairedHydrant( self ) -- get the hydrant's position local myPos = self:GetVar( "hydrantPos" ) local bounceSpeed = self:GetVar( "bouncer_speed" ) local bounceDest = self:GetVar("bouncer_destination") local config = { {"bouncer_speed", bounceSpeed} , {"objtype", CONSTANTS["HF_NODE_BOUNCER"]}, {"bouncer_destination", bounceDest } } RESMGR:LoadObject { objectTemplate = CONSTANTS["REPAIRED_HYDRANT_LOT"], x = myPos.x, y = myPos.y, z = myPos.z, objType = CONSTANTS["HF_NODE_BOUNCER"], configData = config } -- get rid of the bouncer RemoveBouncer( self ) -- get rid of the broken hydrant GAMEOBJ:DeleteObject( self ) end -------------------------------------------------------------- -- set a timer for when to revert to the regular, repaired hydrant even if the bouncer is never used -------------------------------------------------------------- function SetRepairTimer( self, duration ) GAMEOBJ:GetTimer():CancelTimer("repairTimer", self) GAMEOBJ:GetTimer():AddTimerWithCancel( duration, "repairTimer", self ) end -------------------------------------------------------------- -- on startup -------------------------------------------------------------- function onStartup( self ) SendConfigInfoToClients( self ) end -------------------------------------------------------------- -- send the bouncer config info client-side -------------------------------------------------------------- function SendConfigInfoToClients( self ) -- let the client-side know the bouncer config data local speed = self:GetVar( "bouncer_speed" ) local destination = self:GetVar( "bouncer_destination" ) --self:SetNetworkVar( "bouncer_speed", speed ) --self:SetNetworkVar( "bouncer_destination", destination ) --print( "server-side broken hydrant passing along config data" ) -- Note: using network vars worked with only 1 client running, --but if 2 clients are running, then only 1 of them receives onScriptNetworkVarUpdate -- using this message instead, just as a way to get a float and a string to client-side self:PlayAnimation{ animationID = destination, fPriority = speed } -- set a timer to resend the info GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "resendConfigTimer", self ) end -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "resendConfigTimer") then SendConfigInfoToClients( self ) end end -------------------------------------------------------------- -- Server side script watches for rebuild state changes and resets the rebuild when clicked -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Returns true if the object is in the idle rebuild state -------------------------------------------------------------- function IsActive(self) -- get the rebuild state local rebuildState = self:GetRebuildState() -- if the state is idle we are active if (rebuildState and tonumber(rebuildState.iState) == 3) then return true else return false end end -------------------------------------------------------------- -- Handle client clicking on the object on server -------------------------------------------------------------- function onUse(self, msg) local rebuildState = self:GetRebuildState() -- if the state is idle we are active if (IsActive(self) == true) then self:RebuildReset() end end -------------------------------------------------------------- -- Called when a rebuild is reset -------------------------------------------------------------- function onRebuildReset(self, msg) GAMEOBJ:GetTimer():CancelAllTimers( self ) -- hydrant was just broken to turn the water on end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState(self, msg) GAMEOBJ:GetTimer():CancelAllTimers( self ) -- if we just hit the idle state --if (msg.iState == 3) then -- hydrant just got repaired to turn the water off again --end end -------------------------------------------------------------- -- called when a fire event msg is sent from client-side -------------------------------------------------------------- function onFireEventServerSide( self, msg ) if ( msg.args == "cleanPlayer" ) then CleanPlayer( self, msg.senderID ) end end function CleanPlayer( self, target ) -- the client-side script told us to clean off the player that's being bounced -- make sure it's a player if ( target:GetFaction().faction ~= 1 ) then return end self:CastSkill{ optionalTargetID = target, skillID = CONSTANTS["DESTINK_SKILL"] } end -------------------------------------------------------------- -- Includes require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS["BROKEN_HYDRANT_LOT"] = 3999 -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) --print( "smashable hydrant: onStartup" ) self:SetVar( "hydrantPos", self:GetPosition{}.pos ) self:SetPickType{ ePickType = 6 } -- PICK_LIST_SMASHABLE in enum PICK_LIST_TYPE in lwoCommonVars.h -- (smashables currently use the regular arrow cursor, but specify this in case that changes later.) ForgetBrokenHydrant( self ) end -------------------------------------------------------------- -- Called when object is smashed -------------------------------------------------------------- function onDie( self, msg ) ShowBroken( self ) end -------------------------------------------------------------- -- called when a child object is loaded up, in this case, the bouncer -------------------------------------------------------------- function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["BROKEN_HYDRANT_LOT"] ) then storeObjectByName( self, "brokenHydrantID", msg.childID ) storeParent( self, msg.childID ) end end -------------------------------------------------------------- -- clear out the broken hydrant variable -------------------------------------------------------------- function ForgetBrokenHydrant( self ) self:SetVar( "brokenHydrantID", CONSTANTS["EMPTY_ID_NAME"] ) end -------------------------------------------------------------- -- spawn in the model of the hydrant all broken -------------------------------------------------------------- function ShowBroken( self ) -- return out if we already have a broken hydrant if ( self:GetVar( "brokenHydrantID" ) ~= CONSTANTS["NO_OBJECT"] ) then return end -- get the hydrant's position local myPos = self:GetVar( "hydrantPos" ) RESMGR:LoadObject { objectTemplate = CONSTANTS["BROKEN_HYDRANT_LOT"], x = myPos.x, y = myPos.y, z = myPos.z, owner = self } end CONSTANTS = {} CONSTANTS["radius"] = 5 function onStartup(self) self:SetProximityRadius { radius = CONSTANTS["radius"] } end require('o_mis') CONSTANTS = {} CONSTANTS["NUM_ACTIVATED_SWITCHES_REQUIRED"] = 3 --TODO: should be 3 CONSTANTS["BROKEN_WALL_DURATION"] = 10 -- how long to hide the wall before bringing it back function onStartup( self ) --print ( "--------------------------------------------" ) --print ( "MATCHING PUZZLE onStartup" ) --print ( "--------------------------------------------" ) ResetFlags( self ) self:SetVar( "isHidden", false ) self:SetVar( "originalX", self:GetPosition{}.pos.x ) self:SetVar( "originalY", self:GetPosition{}.pos.y ) self:SetVar( "originalZ", self:GetPosition{}.pos.z ) self:SetVar( "hiddenX", self:GetPosition{}.pos.x ) self:SetVar( "hiddenY", ( self:GetPosition{}.pos.y ) - 20.0 ) self:SetVar( "hiddenZ", self:GetPosition{}.pos.z ) end function onFireEvent( self, msg ) --print ( "--------------------------------------------" ) --print ( "MATCHING PUZZLE onFireEvent" ) --print ( "--------------------------------------------" ) -- remember each trigger's ID as we get it, so that when any trigger is touched, we can check all 3 StoreTriggerID( self, msg ) CheckWhetherSolved( self ) end function onTimerDone( self, msg ) if (msg.name == "brokenWallTimer") then RestoreWall( self ) end end function StoreTriggerID( self, msg ) -- the msg contains the id of the trigger that just got a touch or unTouch and that fired the event if ( msg.args == "switch1On" ) then storeObjectByName( self, "trigger1ID", msg.senderID ) end if ( msg.args == "switch2On" ) then storeObjectByName( self, "trigger2ID", msg.senderID ) end if ( msg.args == "switch3On" ) then storeObjectByName( self, "trigger3ID", msg.senderID ) end end function ResetFlags( self ) self:SetVar( "switch1Activated", 0 ) self:SetVar( "switch2Activated", 0 ) self:SetVar( "switch3Activated", 0 ) end function CheckWhetherSolved( self ) if ( self:GetVar("isHidden") == true ) then return end UpdateAllSwitches( self ) -- count how many switches are activated local numActivated = 0 if ( self:GetVar( "switch1Activated" ) == 1 ) then numActivated = numActivated + 1 end if ( self:GetVar( "switch2Activated" ) == 1 ) then numActivated = numActivated + 1 end if ( self:GetVar( "switch3Activated" ) == 1 ) then numActivated = numActivated + 1 end if ( numActivated >= CONSTANTS["NUM_ACTIVATED_SWITCHES_REQUIRED"] ) then HideWall( self ) end end function UpdateSwitch( self, switch ) local triggerID = nil if ( switch == 1 ) then triggerID = getObjectByName( self, "trigger1ID" ) end if ( switch == 2 ) then triggerID = getObjectByName( self, "trigger2ID" ) end if ( switch == 3 ) then triggerID = getObjectByName( self, "trigger3ID" ) end if ( triggerID == nil ) then return end -- look for the players near the trigger local objs = triggerID:GetProximityObjects().objects SetSwitchFlag( self, switch, 0 ) local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() if ( faction and faction.faction == 1 ) then --print ( "--------------------------------------------" ) --print ( "MATCHING PUZZLE player at switch " .. switch ) --print ( "--------------------------------------------" ) SetSwitchFlag( self, switch, 1 ) return end index = index + 1 end end function SetSwitchFlag( self, switch, flag ) if ( flag == 1 ) then --print ( "--------------------------------------------" ) --print ( "MATCHING PUZZLE swtich " .. switch .. " set to " .. flag ) --print ( "--------------------------------------------" ) end if ( switch == 1 ) then self:SetVar( "switch1Activated", flag ) end if ( switch == 2 ) then self:SetVar( "switch2Activated", flag ) end if ( switch == 3 ) then self:SetVar( "switch3Activated", flag ) end end function UpdateAllSwitches( self ) ResetFlags( self ) local trigger1 = getObjectByName( self, "trigger1ID" ) local trigger2 = getObjectByName( self, "trigger2ID" ) local trigger3 = getObjectByName( self, "trigger3ID" ) -- there's no way the puzzle is solved if we haven't gotten an onTouch message from each of the 3 switches yet -- (unless we're cheating and allowing fewer than 3 to count as solved.) -- count how many triggerIDs we've gotten so far local numTriggerIDs = 0 if ( trigger1 ~= nil ) then numTriggerIDs = numTriggerIDs + 1 end if ( trigger2 ~= nil ) then numTriggerIDs = numTriggerIDs + 1 end if ( trigger3 ~= nil ) then numTriggerIDs = numTriggerIDs + 1 end --print ( "------------------------------------------------------" ) --print ( "MATCHING PUZZLE knows " .. numTriggerIDs .. " trigger IDs" ) --print ( "------------------------------------------------------" ) if ( numTriggerIDs < CONSTANTS["NUM_ACTIVATED_SWITCHES_REQUIRED"] ) then return end -- for each trigger whose ID we know, check whether there's a player there if ( trigger1 ~= nil ) then UpdateSwitch( self, 1 ) end if ( trigger2 ~= nil ) then UpdateSwitch( self, 2 ) end if ( trigger3 ~= nil ) then UpdateSwitch( self, 3 ) end end function HideWall( self ) if ( self:GetVar( "isHidden") == true ) then return end print ( "--------------------------------------------" ) print ( "MATCHING PUZZLE solved!" ) print ( "--------------------------------------------" ) self:SetVar( "isHidden", true ) -- move the wall down below ground local hidePos = self:GetPosition{}.pos hidePos.x = self:GetVar( "hiddenX" ) hidePos.y = self:GetVar( "hiddenY" ) hidePos.z = self:GetVar( "hiddenZ" ) self:SetPosition{ pos = hidePos } -- set a timer for when to put it back GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["BROKEN_WALL_DURATION"], "brokenWallTimer", self ) end function RestoreWall( self ) --print ( "--------------------------------------------" ) --print ( "MATCHING PUZZLE RestoreWall" ) --print ( "--------------------------------------------" ) -- put the wall back up where it belongs local showPos = self:GetPosition{}.pos showPos.x = self:GetVar( "originalX" ) showPos.y = self:GetVar( "originalY" ) showPos.z = self:GetVar( "originalZ" ) self:SetPosition{ pos = showPos } self:SetVar( "isHidden", false ) CheckWhetherSolved( self ) end require('o_mis') require('o_Main') function onStartup(self) end function onUse( self, msg ) --print( "-----------------------------------" ) --print( "Maze Rotating Piece: onUse" ) --print( "-----------------------------------" ) RotateByNinetyDegrees( self ) end function RotateByNinetyDegrees( self ) --print( "----------------------------------------" ) --print( "Maze Rotating Piece: RotateObject" ) --print( "----------------------------------------" ) local newRot = self:GetPosition{}.pos newRot.x = 0.0 newRot.y = 1.5708 newRot.z = 0.0 self:RotateObject{ rotation = newRot } end require('o_mis') function onStartup(self) end function onSquirtWithWatergun( self, msg ) --print( "------------------------------------------------" ) --print( "MAZE TROLL: onSquirtWithWatergun" ) --print( "------------------------------------------------" ) storeObjectByName( self, "shooter", msg.shooterID ) FaceShooter( self ) DrinkWater( self ) end function DrinkWater( self ) --print( "------------------------------------------------" ) --print( "MAZE TROLL: DrinkWater" ) --print( "------------------------------------------------" ) self:PlayAnimation{ animationID = "drink" } end function FaceShooter( self ) --print( "------------------------------------------------" ) --print( "MAZE TROLL: FaceShooter" ) --print( "------------------------------------------------" ) local shooter = getObjectByName( self, "shooter" ) self:FaceTarget{ target = shooter, keepFacingTarget = false, bInstant = false } end -------------------------------------------------------------- -- Server side script for Broombot -- -- Handles User interaction for cleaning or rebuilding -- Handles state during rebuild -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('State') require('o_StateCreate') require('o_mis') require('o_Main') require('c_Zorillo') -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- var for bot in use by player for cleaning self:SetVar("Bot_InUse", false ) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Broombot" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" Set['OverRideAttackSkill'] = true -- Bool Attack Skill Override Set['AttackSkill'] = 115 -- Skill to use when Attacking Set['UseOptionalTargetOnAttack'] = true -- Pass target for skill cast on attack --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 1 -- Conduct Radius Set['tetherRadius'] = 40 -- Tether Radius Set['tetherSpeed'] = 1 -- Tether Speed Set['wanderRadius'] = 1 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = .75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 8 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) end -------------------------------------------------------------- -- Returns true if the object is in the idle rebuild state -------------------------------------------------------------- function IsActive(self) -- get the rebuild state local rebuildState = self:GetRebuildState() -- if the state is idle we are active if (rebuildState and tonumber(rebuildState.iState) == 3) then return true else return false end end -------------------------------------------------------------- -- Sets ourself busy and cleans a target -------------------------------------------------------------- function CleanTarget(self, myTarget) -- disable us setState("AiDisable",self) -- set in use self:SetVar("Bot_InUse", true ) -- This replaces StopMoving, which wont work when an object is pathing. self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } self:CastSkill{optionalTargetID = myTarget, skillID = 115 } local anim_time = self:GetAnimationTime{animationID = "destink"}.time GAMEOBJ:GetTimer():AddTimerWithCancel( anim_time , "BackToWork", self ) end -------------------------------------------------------------- -- Handle client clicking on the object on server -------------------------------------------------------------- function onUse(self, msg) local rebuildState = self:GetRebuildState() -- if the state is idle we are active and not in use if (IsActive(self) == true and self:GetVar("Bot_InUse") == false) then -- clean the player CleanTarget(self,msg.user) --self:RebuildReset() end end -------------------------------------------------------------- -- Called when a rebuild is reset -------------------------------------------------------------- function onRebuildReset(self, msg) GAMEOBJ:GetTimer():CancelAllTimers( self ) -- disable us setState("AiDisable",self) end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState(self, msg) GAMEOBJ:GetTimer():CancelAllTimers( self ) -- if we hit the complete state we are now working for a player if (msg.iState == 2 and msg.player:GetID() ~= CONSTANTS["NO_OBJECT"]) then --print("i am now working for " .. msg.player:GetID()) -- record the player who built it storeObjectByName(self, "playerBuilder", msg.player) GAMEOBJ:GetZoneControlID():NotifyObject{ name="broombot_fixed", ObjIDSender = msg.player } -- if we just hit the idle state elseif (msg.iState == 3) then -- get back to work after after we are repaired GAMEOBJ:GetTimer():AddTimerWithCancel( 4.0 , "BackToWork", self ) end end -------------------------------------------------------------- -- Timer notifications -------------------------------------------------------------- function onTemplateTimerDone(self, msg) if (msg.name == "BackToWork") then GAMEOBJ:GetTimer():CancelAllTimers( self ) -- disable us setState("AiEnable",self) -- no longer in use self:SetVar("Bot_InUse", false ) elseif (msg.name == "Breakdown") then GAMEOBJ:GetTimer():CancelAllTimers( self ) -- break down setState("AiDisable",self) self:RebuildReset() end end -------------------------------------------------------------- -- Description: -- -- handles effects on the broombot and enables interaction -------------------------------------------------------------- require('o_mis') local effect_interval = 1.0 -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) self:SetPickType{ePickType = 14} end -------------------------------------------------------------- -- Returns true if the object is in the idle rebuild state -------------------------------------------------------------- function IsActive(self) -- get the rebuild state local rebuildState = self:GetRebuildState() -- if the state is idle we are active if (rebuildState and tonumber(rebuildState.iState) == 3) then return true else return false end end -------------------------------------------------------------- -- Handled when rendering is ready -------------------------------------------------------------- function onRenderComponentReady(self, msg) if (IsActive(self) == true) then -- start a timer that will play the effects if active -- and set the animation set to the right state self:SetAnimationSet{strSet = ""} GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) else -- show this as broken if it is supposed to be self:SetAnimationSet{strSet = "broken"} self:PlayFXEffect{effectType = "broken"} end end -------------------------------------------------------------- -- Handle timers -------------------------------------------------------------- function onTimerDone(self, msg) -- play the effect if (msg.name == "DoEffect" and IsActive(self) == true) then -- play the effect self:PlayFXEffect{effectType = "onmove"} -- start a timer that will play the effects GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) end end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then -- change animations to non-broken self:SetAnimationSet{strSet = ""} -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- find our rebuild animation time then start effects GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "DoEffect", self ) else -- cancel all timers to prevent effects GAMEOBJ:GetTimer():CancelAllTimers( self ) -- set animations to broken self:SetAnimationSet{strSet = "broken"} end end require('State') require('o_mis') SKUNKFOLLOW = {} --########################################################### --########## Startup --########################################################### function onStartup(self) registerWithZoneControlObject(self) self:SetProximityRadius { radius = 25 } self:SetVar("MaxSkunkFollow", 4) end --########################################################### --########## Proximity --########################################################### function onProximityUpdate(self, msg) if msg.status == "ENTER" then print("Mother proximity triggered") -- get the local character local player = msg.objId -- only follow players if(player:IsCharacter().isChar == true) then local MissionState = player:GetMissionState{missionID = 133}.missionState if(MissionState == 2) then if (SKUNKFOLLOW[player:GetID()] ~= nil) then if(SKUNKFOLLOW[player:GetID()]["num"] >= self:GetVar("MaxSkunkFollow")) then print("Completing mother skunk mission for player") player:UpdateMissionTask{target = self, value = 133, taskType= "complete" } for skunkNum = 1, SKUNKFOLLOW[player:GetID()]["num"] do if(SKUNKFOLLOW[player:GetID()][skunkNum] ~= nil) then local skunk = GAMEOBJ:GetObjectByID(SKUNKFOLLOW[player:GetID()][skunkNum]) if(skunk ~= nil) then skunk:Die{killType = "SILENT"} end end end SKUNKFOLLOW[player:GetID()] = nil else -- tooltip? to get max? -- self:Help{rerouteID = user, iHelpID = CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"]} print("NOT ENOUGH SKUNKS") end else print("player has no skunks") end end end end end --########################################################### --########## Spawn baby skunks --########################################################### function SpawnBabySkunks(self) end --########################################################### --########## Baby Skunk Loaded --########################################################### onChildLoaded = function(self,msg) end --########################################################### --########## Messages from Baby Skunks (awwwwwww) --########################################################### function onNotifyObject(self, msg) end --########################################################### --########## Ontimer done --########################################################### onTimerDone = function(self, msg) end function onUse(self, msg) end -- Request follow message from baby skunks function onRequestFollow(self, msg) print("IN ON MOTHER SKUNK REQUESTFOLLOW") -- Check to see if user has any skunks following -- See if this user has an entry if (SKUNKFOLLOW[msg.targetID:GetID()] ~= nil) then print("ENTRY FOUND") if(SKUNKFOLLOW[msg.targetID:GetID()]["num"] >= self:GetVar("MaxSkunkFollow")) then print("MAX SKUNKS") msg.bCanFollow = false else msg.bCanFollow = true msg.iPosit = SKUNKFOLLOW[msg.targetID:GetID()]["num"] + 1 SKUNKFOLLOW[msg.targetID:GetID()]["num"] = msg.iPosit SKUNKFOLLOW[msg.targetID:GetID()][msg.iPosit] = msg.requestorID:GetID() if(SKUNKFOLLOW[msg.targetID:GetID()]["num"] >= self:GetVar("MaxSkunkFollow")) then if(msg.targetID ~= nil) then msg.targetID:DisplayTooltip{ bShow = true, strText = "Return to the Mother Skunk. You only have 1 minute!", iTime = 0 } end end end else print("ENTRY NOT FOUND") msg.bCanFollow = true msg.iPosit = 1 SKUNKFOLLOW[msg.targetID:GetID()] = {} SKUNKFOLLOW[msg.targetID:GetID()]["num"] = 1 SKUNKFOLLOW[msg.targetID:GetID()][msg.iPosit] = msg.requestorID:GetID() end return msg endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) self:SetProximityRadius { radius = 5 } self:SetVar("IsFollowing", 0) self:SetVar("LinePosit", 0) self:SetVar("ReturningHome", 0) local pos = getHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos, radius = 500 } end function onProximityUpdate(self, msg) if(self:GetVar("IsFollowing") == 1) then return end if(self:GetVar("ReturningHome") == 1) then return end -- Stop evading on leave if msg.status == "ENTER" then local player = msg.objId if(player:IsCharacter().isChar == true) then GAMEOBJ:GetTimer():CancelAllTimers( self ) local mySpeed = self:GetSpeed().speed self:EvadeTarget { targetID = player, radius = 8, speed = 7, keepEvading = true } end end end onTimerDone = function(self, msg) if msg.name == "despawnTimer" then -- Despawn self self:Die{killType = "SILENT"} end if msg.name == "ReturnHome" then self:SetVar("ReturningHome", 1) --self:FollowWaypoints() self:SetPathingSpeed{speed = 10} end end function onArrived(self, msg) -- Ick hack self:SetPathingSpeed{speed = 1} self:SetVar("ReturningHome", 0) self:ContinueWaypoints() end function onStoppedEvading(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "ReturnHome", self ) end onLeftTetherRadius = function(self, msg) if(self:GetVar("IsFollowing") == 1) then return end self:SetVar("ReturningHome", 1) end-------------------------------------------------------------- -- Responsible for registering with the client side -- zone object to control actions and animations. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) end -------------------------------------------------------------- -- Generic notification message -------------------------------------------------------------- function onNotifyObject(self, msg) -- Update event state if (msg.name == "start_event") then -- get position local mypos = self:GetPosition().pos -- Turn on detectors RESMGR:LoadObject { objectTemplate = 3434, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= 0.7071, rx= 0.0, ry= -0.7071, rz = 0.0 } elseif (msg.name == "stop_event") then -- Turn off detectors local childDetector = getObjectByName(self, "Detector") if(childDetector) then childDetector:Die{killerID = childDetector, killType = "SILENT"} end end end onChildLoaded = function(self,msg) if msg.templateID == 3434 then storeObjectByName(self, "Detector", msg.childID) storeParent(self, msg.childID) end end -------------------------------------------------------------- -- server side script -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/ai/L_BOUNCER_BASIC') require('c_Zorillo') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS["BABY_SKUNK_LOT"] = 3476 CONSTANTS["STINKY_SKUNK_SKILL"] = 109 --CONSTANTS["BOUNCER_EFFECT_NUM"] = 337 -- don't need to specify this because we're using PlayFXEffect CONSTANTS["BOUNCER_EFFECT_NAME"] = "skunkBouncer" --CONSTANTS["TARGET_EFFECT_NUM"] = 338 -- don't need to specify this because we're using PlayFXEffect CONSTANTS["BABY_EFFECT_NAME"] = "skunkBouncerBaby" CONSTANTS["ADULT_EFFECT_NAME"] = "skunkBouncerAdult" -------------------------------------------------------------- -- check whatever just collided with the bouncer for stink -------------------------------------------------------------- function CheckForStink( self, target ) --print( "SKUNK BOUNCER: CheckForStink" ) -- if this is a a baby skunk, or a stinky adult skunk, then add a stink trail effect local bAddStinkTrail = false -- check if it's a baby skunk if ( IsTargetABabySkunk( target ) ) then --print( "SKUNK BOUNCER: CheckForStink found a baby skunk" ) bAddStinkTrail = true -- check if it's a stinky adult skunk elseif ( IsTargetAnAdultSkunk( target ) and target:HasSkill{ iSkillID = CONSTANTS["STINKY_SKUNK_SKILL"] }.bHas ) then --print( "SKUNK BOUNCER: CheckForStink found a stinky adult skunk" ) bAddStinkTrail = true end -- if we should add the stink trail effect to the bouncer and whoever collided with it, do so -- Note: we add the effects server-side. -- They time out so we don't have to worry about how to get rid of them from the server. if ( bAddStinkTrail == true ) then AddStinkEffectToBouncer( self ) AddStinkEffectToTarget( target ) end end ----------------------------------------------------------------- -- adds a stink effect to the bouncer ----------------------------------------------------------------- function AddStinkEffectToBouncer( self ) --print( "SKUNK BOUNCER: AddStinkEffectToBouncer" ) self:PlayFXEffect{ effectType = CONSTANTS["BOUNCER_EFFECT_NAME"], priority = 1.1 } -- we don't have to save off the effect number because it times out and we never need to cancel it end ----------------------------------------------------------------- -- adds a stink effect to whoever got bounced ----------------------------------------------------------------- function AddStinkEffectToTarget( target ) --print( "SKUNK BOUNCER: AddStinkEffectToTarget" ) if ( IsTargetABabySkunk( target ) == true ) then --print( "SKUNK BOUNCER: add stink effect to baby" ) target:PlayFXEffect{ effectType = CONSTANTS["BABY_EFFECT_NAME"], priority = 1.1 } elseif ( IsTargetAnAdultSkunk( target ) == true ) then --print( "SKUNK BOUNCER: add stink effect to adult" ) target:PlayFXEffect{ effectType = CONSTANTS["ADULT_EFFECT_NAME"], priority = 1.1 } end -- we don't have to save off the effect number because it times out and we never need to cancel it end -------------------------------------------------------------- -- on Collision functions -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print( "SKUNK BOUNCER: onCollisionPhantom" ) BounceNow( self, msg.objectID ) return msg end -------------------------------------------------------------- -- if it was a skunk that collided with the bouncer, bounce them and show the stink effects -------------------------------------------------------------- function BounceNow( self, target ) if ( IsTargetASkunk( target ) == true ) then bounceObj( self, target ) CheckForStink( self, target ) end end -------------------------------------------------------------- -- returns whether the given object is a skunk -------------------------------------------------------------- function IsTargetASkunk( target ) if ( IsTargetABabySkunk( target ) == true or IsTargetAnAdultSkunk( target ) ) then return true end return false end -------------------------------------------------------------- -- returns whether the given object is a baby skunk -------------------------------------------------------------- function IsTargetABabySkunk( target ) if ( target:GetLOT().objtemplate == CONSTANTS["BABY_SKUNK_LOT"] ) then return true end return false end -------------------------------------------------------------- -- returns whether the given object is an adult skunk -------------------------------------------------------------- function IsTargetAnAdultSkunk( target ) -- list of npcs does not exist if (CONSTANTS["INVASION_SKUNK_LOT"] == nil) then return false end -- look for a valid actor local templateID = target:GetLOT().objtemplate for actors = 1, #CONSTANTS["INVASION_SKUNK_LOT"] do if (templateID == CONSTANTS["INVASION_SKUNK_LOT"][actors]) then return true end end return false end --/////////////////////////////////////////////////////////////////////////////////////// --// YouReeka Skunk Event Zone Script --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -- stores NPCs that are modified during event SPAWNEDNPCS = {} -- stores Skunks spawned during the event INVASION_SKUNKS = {} -- stores Hazmat NPCs spawned during the event HAZMAT_NPCS = {} -- stores all loaded spouts SPOUTS = {} -- stores all bubble blowers BUBBLE_BLOWERS = {} -- stores Stink Clouds spawned during the event INVASION_STINK_CLOUDS = {} INVASION_STINK_CLOUD_WAYPOINTS = {} -- stores players involved in the invasion INVASION_PLAYERS = {} -- stores all flowers FLOWERS = {} -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end -------------------------------------------------------------- -- returns true if invasion is in active state -------------------------------------------------------------- function IsInvasionActive(self) -- these are Non Invasion states local state = GetZoneState(self) if (state == CONSTANTS["ZONE_STATE_NO_INFO"] or state == CONSTANTS["ZONE_STATE_NO_INVASION"] or state == CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) then return false else -- otherwise state means we are in the invasion return true end end -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) print("Setting Server Zone State to " .. state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- notify all clients about the state change if (prevState and prevState ~= state) then -- do our own actions if (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then DoNoInvasionStateActions(self) elseif (state == CONSTANTS["ZONE_STATE_TRANSITION"]) then DoTransitionStateActions(self) elseif (state == CONSTANTS["ZONE_STATE_HIGH_ALERT"]) then DoHighAlertStateActions(self) elseif (state == CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) then DoMediumAlertStateActions(self) elseif (state == CONSTANTS["ZONE_STATE_LOW_ALERT"]) then DoLowAlertStateActions(self) elseif (state == CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) then DoDoneTransitionActions(self) end -- inform clients about state GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="zone_state_change", param1 = state } end end -------------------------------------------------------------- -- do actions associated with No Invasion state -------------------------------------------------------------- function DoNoInvasionStateActions(self) ResetTotalCleanPoints(self) -- update spouts SendStateToSpouts(self) -- update bubble blowers SendStateToBubbleBlowers(self) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["PEACE_TIME_DURATION"], "startEventTimer", self ) end -------------------------------------------------------------- -- do actions associated with Transition state -------------------------------------------------------------- function DoTransitionStateActions(self) -- update spouts SendStateToSpouts(self) -- update bubble blowers SendStateToBubbleBlowers(self) ResetTotalCleanPoints(self) -- start a timer to panic the NPCs GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["EARTHQUAKE_DURATION"], "DoPanicNPCs", self ) -- start a timer to spawn skunks and change states GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["SKUNK_SPAWN_TIMING"], "SkunksSpawning", self ) -- start a timer to spawn skunks and change states GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["SKUNK_SPAWN_TIMING"], "StinkCloudsSpawning", self ) -- start a timer to trigger hazmat van GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["HAZMAT_VAN_TIMING"], "HazmatVanTimer", self ) -- start a timer to trigger window washer GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["POLE_SLIDE_TIMING"], "PoleSlideTimer", self ) -- start a timer to end the transition state GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["INVASION_TRANSITION_DURATION"], "EndInvasionTransition", self ) end -------------------------------------------------------------- -- do actions associated with High Alert state -------------------------------------------------------------- function DoHighAlertStateActions(self) GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["MAX_INVASION_DURATION"], "MaxInvasionTimer", self ) end -------------------------------------------------------------- -- do actions associated with Medium Alert state -------------------------------------------------------------- function DoMediumAlertStateActions(self) end -------------------------------------------------------------- -- do actions associated with Low Alert state -------------------------------------------------------------- function DoLowAlertStateActions(self) end -------------------------------------------------------------- -- do actions associated with done transition -------------------------------------------------------------- function DoDoneTransitionActions(self) GAMEOBJ:GetTimer():CancelTimer("MaxInvasionTimer", self) -- reward for total points RewardPlayers(self) ResetTotalCleanPoints(self) -- animate the van to end local anim_time = animateVan(self, "end") -- set a callback to trigger van rebuild spawn after animation is over if (anim_time and tonumber(anim_time) > 0 ) then GAMEOBJ:GetTimer():AddTimerWithCancel(anim_time, "HazmatVanEndDone", self ) end -- set npcs back to idle IdleNPCs(self) -- remove skunks killSkunks(self) -- remove stink Clouds killStinkClouds(self) -- remove the Hazmat NPCs killHazmatNPCs(self) -- start a timer to end the transition state GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["DONE_TRANSITION_DURATION"], "EndDoneTransition", self ) end -------------------------------------------------------------- -- send spout notifications based on state -------------------------------------------------------------- function SendStateToSpouts(self) -- notify lamps of state for spoutID = 1, #SPOUTS do local spout = GAMEOBJ:GetObjectByID(SPOUTS[spoutID]) spout:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- send bubble blower notifications based on state -------------------------------------------------------------- function SendStateToBubbleBlowers(self) -- notify lamps of state for bbID = 1, #BUBBLE_BLOWERS do local bb = GAMEOBJ:GetObjectByID(BUBBLE_BLOWERS[bbID]) bb:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- Get total clean points -------------------------------------------------------------- function GetTotalCleanPoints(self) return self:GetVar("TotalCleanPoints") end -------------------------------------------------------------- -- Add to the total clean points, check to see if a state -- change is needed and make it -- returns true if the event ends with the increment -------------------------------------------------------------- function IncrementTotalCleanPoints(self, inc) if (not IsInvasionActive(self)) then print ("No points added: event not active") return end local points = GetTotalCleanPoints(self) points = points + inc self:SetVar("TotalCleanPoints", points) print ("CleanPoints: " .. points) -- check states and see if we need to move on if (GetZoneState(self) == CONSTANTS["ZONE_STATE_HIGH_ALERT"] and points >= CONSTANTS["CLEANING_POINTS_MEDIUM"]) then SetZoneState(self, CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) elseif (GetZoneState(self) == CONSTANTS["ZONE_STATE_MEDIUM_ALERT"] and points >= CONSTANTS["CLEANING_POINTS_LOW"]) then SetZoneState(self, CONSTANTS["ZONE_STATE_LOW_ALERT"]) elseif (GetZoneState(self) == CONSTANTS["ZONE_STATE_LOW_ALERT"] and points >= CONSTANTS["CLEANING_POINTS_TOTAL"]) then SetZoneState(self, CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) return true end return false end -------------------------------------------------------------- -- Reset the total clean points -------------------------------------------------------------- function ResetTotalCleanPoints(self) self:SetVar("TotalCleanPoints", 0) end -------------------------------------------------------------- -- Init zone variables -------------------------------------------------------------- function InitZoneVars(self) -- store the number of waypoints in the Stink Cloud Path local pathMsg = LEVEL:GetPathWaypoints(CONSTANTS["STINK_CLOUD_PATH"]) if (tostring(type(pathMsg)) == "table") then self:SetVar("NumStinkCloudSpawnPoints", tonumber(#pathMsg)) end SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INVASION"]) ResetTotalCleanPoints(self) end -------------------------------------------------------------- -- Object starting up -------------------------------------------------------------- function onStartup(self) -- init the zone vars InitZoneVars(self) -- spawn in the garage van spawnGarageVan(self) -- start a timer to spawn in trip build animals GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "sporeTimer", self ) -- start the first timer for the event GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["PEACE_TIME_DURATION"], "startEventTimer", self ) --[[ self:SetVar("NumberOfChildren", 0 ) -- Dont not change this value <<< self:SetVar("WP_Num", 1) -- Dont not change this value <<< self:SetVar("Count", 1) -- On load Count self:SetVar("Count2", 1) -- On load Count self:SetVar("PetNames", "Skunk") -- Name as set in the NPC script self:SetVar("WP_Alpha", "skunkWP") -- Starting string of the Way Point name (waypoints in the map need to be named in the format skunkWP_1, skunkWP_2, etc.) self:SetVar("TotalPets", 10) -- Total number of pets to spawn self:SetVar("PetID", 3279) -- LOT of pet self:SetVar("CurrentDestink", 0) -- Number of skunks currently destunk -- self:SetVar("PetNames2", "Hazmat") -- Name as set in the NPC script self:SetVar("HazmatWPPrefix", "hazmatWP") -- Starting string of the Way Point name (waypoints in the map need to be named in the format skunkWP_1, skunkWP_2, etc.) self:SetVar("HazmatNumber", 1) -- Total number of hazmat guys to spawn self:SetVar("PetID2", 2628) -- LOT of pet self:SetVar("EventLifetime", 180.0) -- Amount of time in seconds that the skunks live for before despawning self:SetVar("PeaceTime", 120.0) -- Amount of time in seconds after skunks die that the next wave comes in (note: add lifetime and respawntime together to get the full time between events) --self:SetVar("HazmatLifetime", 60.0) -- Amount of time in seconds that the hazmat guys live for before despawning -- self:SetVar("HazmatRespawnTime", 220.0) -- Amount of time in seconds after hazmat guys die that the next wave comes in. this needs to be synched wtih the skunks spawning. -- Right now the hazmat guys come in 20 seconds after the skunks disappear and last for 60 seconds self:SetVar("earthquakeWarningTime", 5.0) -- Amount of time in seconds between the earthquake and the start of the skunk invasion self:SetVar("SirenTime", 2.5) -- Time from earthquake to siren self:SetVar("SirenToFountain", 1.5) -- Time from siren to fountain transformation self:SetVar("WindowShutterTime", 1.5) -- Time from fountain transformation to window shutter close. self:SetVar("ShuttersToSkunks", 5.0) -- Time from shutters closing to skunks self:SetVar("SkunksToTruck", 12.0) -- Time from skunks to trunk start self:SetVar("TruckToHazmatNPC", 5.7) -- Time from truck start to hazmat NPCs spawn -- self:SetVar("MaxSkunkFollow", 2) -- Number of skunks yu need to follow you for the mother skunk mission self:SetVar("HazmatInitialSpawnTime", 200.0) -- Amount of time to wait the very first time the event triggers before spawning hazmat guys --]] end -------------------------------------------------------------- -- When children are loaded by the object -------------------------------------------------------------- function onChildLoaded(self,msg) -- was a skunk loaded if (IsValidSkunk(msg.templateID) == true) then -- store the parent storeParent(self, msg.childID) -- store the skunk so we can access it later -- (so we can respawn it later) local num = msg.childID:GetVar("SkunkNum") INVASION_SKUNKS[num] = msg.childID:GetID() print("storing skunk " .. num) -- was a hazmat NPC loaded elseif (msg.templateID == CONSTANTS["SPAWNED_HAZMAT_NPC"]) then -- store the parent storeParent(self, msg.childID) -- store the hazmat npc so we can access it later local num = msg.childID:GetVar("HazmatNum") HAZMAT_NPCS[num] = msg.childID:GetID() print("storing hazmat NPC " .. num) -- was a stink cloud loaded elseif (msg.templateID == CONSTANTS["INVASION_STINK_CLOUD_LOT"]) then -- store the parent storeParent(self, msg.childID) -- store the stink cloud so we can access it later -- (so we can respawn it later) local num = msg.childID:GetVar("StinkCloudNum") INVASION_STINK_CLOUDS[num] = msg.childID:GetID() print("storing stink cloud " .. num .. " at waypoint " .. INVASION_STINK_CLOUD_WAYPOINTS[num]) -- hazmat rebuild van loaded elseif (msg.templateID == CONSTANTS["HAZMAT_REBUILD_VAN_LOT"]) then -- store the parent storeParent(self, msg.childID) -- get current van and remove local van = getObjectByName( self, "HazmatVanID" ) if (van) then GAMEOBJ:DeleteObject(van) end -- store the new van storeObjectByName( self, "HazmatVanID", msg.childID ) -- break the rebuild msg.childID:RebuildReset() -- start timer to spawn in hazmat NPCs GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["HAZMAT_NPC_SPAWN_TIMER"], "SpawnHazmatNPCTimer", self ) -- garage hazmat van elseif ( msg.templateID == CONSTANTS["HAZMAT_VAN_LOT"] ) then -- store the parent storeParent(self, msg.childID) -- get current van and remove local van = getObjectByName( self, "HazmatVanID" ) if (van) then GAMEOBJ:DeleteObject(van) end -- store the new van storeObjectByName( self, "HazmatVanID", msg.childID ) end --[[ if msg.childID:GetLOT().objtemplate == 3553 then -- hazmat guy --print("Loading Hazmat Truck NPC") msg.childID:SetVar("attached_path", "hazmatWP_1") msg.childID:SetVar("attached_path_start", 0) -- start child on path msg.childID:FollowWaypoints() -- msg.childID:PlayAnimation{ animationID = "spawn" } storeObjectByName( self, "HazmatTruckNPCID", msg.childID ) elseif msg.childID:GetLOT().objtemplate == 3279 then -- skunk print ("Loading Skunk") local FinalName = (self:GetVar("PetNames").."_"..self:GetVar("WP_Alpha")..self:GetVar("ChildLoadNUM")) local someName = (self:GetVar("PetNames").."_"..self:GetVar("Count")) msg.childID:SetVar("SpawnedVar", FinalName) msg.childID:SetVar("attached_path", self:GetVar("WP_Alpha").."_"..self:GetVar("ChildLoadNUM")) msg.childID:SetVar("I_Have_A_Parent", true ) storeParent(self, msg.childID) storeObjectByName(self, someName, msg.childID) self:SetVar("Count", self:GetVar("Count") + 1) end --]] end -------------------------------------------------------------- -- When objects are loaded via zone notification -------------------------------------------------------------- function onObjectLoaded(self, msg) if(IsValidNPC(msg.templateID) == true) then -- store the npc local nextActor = #SPAWNEDNPCS + 1 SPAWNEDNPCS[nextActor] = msg.objectID:GetID() -- spout loaded elseif ( msg.templateID == CONSTANTS["SPOUT_LOT"] ) then -- store object in the spout array local nextSpout = #SPOUTS + 1 SPOUTS[nextSpout] = msg.objectID:GetID() -- bubble statue loaded elseif ( msg.templateID == CONSTANTS["BUBBLE_BLOWER_LOT"] ) then -- store object in the bubble blower array local nextBB = #BUBBLE_BLOWERS + 1 BUBBLE_BLOWERS[nextBB] = msg.objectID:GetID() elseif (msg.templateID == CONSTANTS["POLE_SLIDE_NPC"]) then -- store the parent storeParent(self, msg.objectID) storeObjectByName( self, "PoleSlideNPC", msg.objectID ) elseif (msg.templateID == CONSTANTS["BALLOON_LOT"]) then -- store the parent storeParent(self, msg.objectID) storeObjectByName( self, "Balloon", msg.objectID ) elseif ( msg.templateID == CONSTANTS["FLOWER_LOT"] ) then -- store object in the flowers array local nextFlower = #FLOWERS + 1 FLOWERS[nextFlower] = msg.objectID:GetID() end end -------------------------------------------------------------- -- called when a player is loaded and ready -------------------------------------------------------------- function onPlayerLoaded(self, msg) --print("-------- Player Loaded on Server, sending State Info") -- send a message down to ourself on the client to set zone state self:NotifyClientRebuildSectionState{ rerouteID = msg.playerID, iState = GetZoneState(self) } -- send the player's ID to the balloon so it can tell the newly-loaded client which anim to use local balloon = getObjectByName( self, "Balloon" ) if (balloon ~= nil) then balloon:NotifyObject{ ObjIDSender = msg.playerID, name = "playerLoaded" } end -- send the player's ID to the flowers so each of them can tell the newly-loaded client which anim to use for flowerID = 1, #FLOWERS do local flower = GAMEOBJ:GetObjectByID(FLOWERS[flowerID]) flower:NotifyObject{ ObjIDSender = msg.playerID, name = "playerLoaded" } end end -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone(self, msg) print ("Timer name: "..msg.name) if (msg.name == "startEventTimer") then -- the event is starting so put us into the transition state SetZoneState(self, CONSTANTS["ZONE_STATE_TRANSITION"]) elseif (msg.name == "MaxInvasionTimer") then SetZoneState(self, CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) elseif (msg.name == "DoPanicNPCs") then -- tell NPCs to panic PanicNPCs(self) elseif (msg.name == "SkunksSpawning") then -- spawn the skunks spawnSkunks(self) elseif (msg.name == "StinkCloudsSpawning") then -- spawn the stink clouds spawnStinkClouds(self) elseif (msg.name == "EndInvasionTransition") then -- move to the next state SetZoneState(self, CONSTANTS["ZONE_STATE_HIGH_ALERT"]) elseif (msg.name == "EndDoneTransition") then -- move to the next state SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INVASION"]) elseif (msg.name == "HazmatVanTimer") then -- animate the van to start local anim_time = animateVan(self, "start") -- set a callback to trigger van rebuild spawn after animation is over if (anim_time and tonumber(anim_time) > 0 ) then GAMEOBJ:GetTimer():AddTimerWithCancel(anim_time, "HazmatVanStartDone", self ) end elseif (msg.name == "PoleSlideTimer") then -- animate the van to start local slider = getObjectByName( self, "PoleSlideNPC" ) if (slider ~= nil) then slider:PlayAnimation{ animationID = "slide" } end elseif (msg.name == "HazmatVanStartDone") then -- spawn in rebuild (replaces current van stored object name) spawnRebuildVan(self) elseif (msg.name == "HazmatVanEndDone") then -- spawn in real van (replaces current van stored object name) spawnGarageVan(self) elseif (msg.name == "SpawnHazmatNPCTimer") then -- spawn in the hazmat NPCs SpawnHazmatNPCs(self) elseif (string.starts(msg.name,"SpawnSingleHazmatNPCTimer") == true) then -- get spawn number local i = string.sub(msg.name,26) -- spawn a single hazmat NPC spawnSingleHazmatNPC(self, i) elseif (string.starts(msg.name,"RespawnSkunk") == true) then -- if the invasion is still active then respawn the skunk if (IsInvasionActive(self)) then -- get spawn number local i = string.sub(msg.name,13) spawnSingleSkunk(self,i, true) -- spawn a new skunk in this skunk's place end elseif (msg.name == "sporeTimer") then LoadSporeAnimals(self) end end -------------------------------------------------------------- -- Spawns the garage hazmat van from first point on path -------------------------------------------------------------- function spawnGarageVan(self) local pathMsg = LEVEL:GetPathWaypoints(CONSTANTS["HAZMAT_REBUILD_VAN_SPAWN_PATH"]) local trans if (tostring(type(pathMsg)) == "table") then trans = pathMsg[1] else return end -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["HAZMAT_VAN_LOT"], x = trans.pos.x, y = trans.pos.y, z = trans.pos.z, rw = trans.rot.w, rx = trans.rot.x, ry = trans.rot.y, rz = trans.rot.z, owner = self } end -------------------------------------------------------------- -- Spawns the rebuild hazmat van from second point on path -------------------------------------------------------------- function spawnRebuildVan(self) local pathMsg = LEVEL:GetPathWaypoints(CONSTANTS["HAZMAT_REBUILD_VAN_SPAWN_PATH"]) local trans if (tostring(type(pathMsg)) == "table") then trans = pathMsg[2] else return false end -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["HAZMAT_REBUILD_VAN_LOT"], x = trans.pos.x, y = trans.pos.y, z = trans.pos.z, rw = trans.rot.w, rx = trans.rot.x, ry = trans.rot.y, rz = trans.rot.z, owner = self } return true end -------------------------------------------------------------- -- Spawn Skunks -------------------------------------------------------------- function spawnSkunks(self) -- spawn skunks for i = 1, CONSTANTS["NUM_SKUNKS"] do spawnSingleSkunk(self, i, false) end end -------------------------------------------------------------- -- Spawns a single skunk by number, param to say if its -- a respawn or not -------------------------------------------------------------- function spawnSingleSkunk(self, num, bRespawn) -- construct path string, start at first waypoint local pathStr = CONSTANTS["SKUNK_PATH_PREFIX"] .. num local pathStart = 1 -- if this is a respawn, append the suffix to the string -- Note: This means WP path names in the map must be exact if (bRespawn == true) then -- construct the path pathStr = pathStr .. CONSTANTS["SKUNK_ROAM_PATH_SUFFIX"] -- pick a random waypoint on the path pathStart = GetRandomWaypoint(pathStr) end -- create the config data for the new object -- if first spawn, then they are immune local config = {{"SkunkNum", num}, {"attached_path", pathStr}, {"attached_path_start", pathStart - 1}, {"IsImmune", not bRespawn}} -- get first waypoint data for spawn position local firstWP = GAMEOBJ:GetWaypointPos( pathStr, pathStart) -- pick a random skunk template local skunkTemplate = CONSTANTS["INVASION_SKUNK_LOT"][math.random(1,#CONSTANTS["INVASION_SKUNK_LOT"])] -- add the object RESMGR:LoadObject { objectTemplate = skunkTemplate, x = firstWP.x, y = firstWP.y, z = firstWP.z, owner = self, configData = config } end -------------------------------------------------------------- -- returns a random waypoint on a path, or 1 if there is a -- problem -------------------------------------------------------------- function GetRandomWaypoint(path) -- find waypoint info and count for number of waypoints local pathMsg = LEVEL:GetPathWaypoints(path) if (tostring(type(pathMsg)) == "table") then return (math.random(1,tonumber(#pathMsg))) end return 1 end -------------------------------------------------------------- -- remove invasion skunks from the level -------------------------------------------------------------- function killSkunks(self) for i,skunkID in pairs(INVASION_SKUNKS) do local skunkObj = GAMEOBJ:GetObjectByID(skunkID) if (skunkObj and skunkObj:Exists()) then print("removing skunk " .. i) skunkObj:Die{killerID = skunkObj, killType = "SILENT"} end end INVASION_SKUNKS = {} end -------------------------------------------------------------- -- Checks to see if a waypoint is being used by another -- stink cloud -------------------------------------------------------------- function IsWaypointValid(self, waypoint) -- 0 or less is not a valid waypoint number if (tonumber(waypoint) <= 0) then return false end -- loop through waypoints for i,wpNum in pairs(INVASION_STINK_CLOUD_WAYPOINTS) do if ( tonumber(waypoint) == tonumber(wpNum) ) then return false end end return true end -------------------------------------------------------------- -- Spawn Stink Clouds -------------------------------------------------------------- function spawnStinkClouds(self) -- spawn skunks for i = 1, CONSTANTS["NUM_STINK_CLOUDS"] do spawnSingleStinkCloud(self, i) end end -------------------------------------------------------------- -- Spawns a single stink cloud by number in a random place -------------------------------------------------------------- function spawnSingleStinkCloud(self, num) -- construct path string local pathStr = CONSTANTS["STINK_CLOUD_PATH"] local maxPoints = self:GetVar("NumStinkCloudSpawnPoints") -- do nothing if the path has no points (doesn't exist) if (maxPoints == nil) then return end local maxTries = 20 -- get a random waypoint local waypoint = math.random(1, maxPoints) -- check for validity, reroll a waypoint local numTries = 0 while (IsWaypointValid(self,waypoint) == false) do -- roll a new waypoint waypoint = math.random(1, maxPoints) -- too many tries numTries = numTries + 1 if (numTries >= maxTries) then print("ERROR: too many tries to create a stink cloud, add more points...") return end end -- store waypoint used INVASION_STINK_CLOUD_WAYPOINTS[num] = waypoint -- create the config data for the new object local config = {{"StinkCloudNum", num}} -- get first waypoint data for spawn position local spawnLoc = GAMEOBJ:GetWaypointPos( pathStr, waypoint) -- add the object RESMGR:LoadObject { objectTemplate = CONSTANTS["INVASION_STINK_CLOUD_LOT"], x = spawnLoc.x, y = spawnLoc.y, z = spawnLoc.z, owner = self, configData = config } end -------------------------------------------------------------- -- remove invasion stinks from the level -------------------------------------------------------------- function killStinkClouds(self) for i,stinkID in pairs(INVASION_STINK_CLOUDS) do local stinkObj = GAMEOBJ:GetObjectByID(stinkID) if (stinkObj and stinkObj:Exists()) then print("removing stink cloud " .. i) stinkObj:Die{killerID = stinkObj, killType = "SILENT"} end end INVASION_STINK_CLOUDS = {} INVASION_STINK_CLOUD_WAYPOINTS = {} end -------------------------------------------------------------- -- add points for a player during the invasion -------------------------------------------------------------- function AddPlayerPoints(self, player, points) if (not IsInvasionActive(self)) then print ("No points added: event not active") return end -- non existent or dead players don't get points if (points <= 0 or not player:Exists() or player:IsDead().bDead) then return end -- get the player ID for checking local playerID = player:GetID() for i,playerData in pairs(INVASION_PLAYERS) do -- we found a player if (playerID == playerData.id) then -- add points for this player playerData.score = playerData.score + points print("adding " .. points .. " points for player " .. playerID) return end end -- if we get here the player was not found, add a new one local nextPlayer = #INVASION_PLAYERS + 1 -- add the data local PLAYER_DATA = {} PLAYER_DATA.id = playerID PLAYER_DATA.score = points INVASION_PLAYERS[nextPlayer] = PLAYER_DATA print("new player: adding " .. points .. " points for player " .. playerID) end -------------------------------------------------------------- -- reward players who participated in the invasion -------------------------------------------------------------- function RewardPlayers(self) for i,playerData in pairs(INVASION_PLAYERS) do local player = GAMEOBJ:GetObjectByID(playerData.id) if (player and player:Exists() and not player:IsDead().bDead) then local coins = playerData.score * CONSTANTS["REWARD_MULTIPLIER"] player:DropLoot{iCurrency = coins, owner = player, rerouteID = player, sourceObj = self} print("rewarding player " .. playerData.id .. " with a score of " .. playerData.score) -- player do some player reward end end INVASION_PLAYERS = {} end -------------------------------------------------------------- -- Zone script notified -------------------------------------------------------------- function onNotifyObject(self, msg) -- a skunk was cleaned by a player if (msg.name == "skunk_cleaned") then if (not IsInvasionActive(self)) then return end -- add the points for the player AddPlayerPoints(self, msg.ObjIDSender, CONSTANTS["POINT_VALUE_SKUNK"]) -- add clean points, spawn new skunk if event not over if (IncrementTotalCleanPoints(self, CONSTANTS["POINT_VALUE_SKUNK"]) == false) then if (msg.param1 and msg.param1 > 0) then -- find a random spawn time local spawnTime = math.random(CONSTANTS["SKUNK_RESPAWN_TIMER_MIN"], CONSTANTS["SKUNK_RESPAWN_TIMER_MAX"]) -- start a timer to respawn the skunk with his spawn number GAMEOBJ:GetTimer():AddTimerWithCancel(spawnTime, "RespawnSkunk" .. msg.param1, self ) end end -- a stink cloud was cleaned by a player elseif (msg.name == "stink_cloud_cleaned_by_player" or msg.name == "stink_cloud_cleaned_by_broombot") then if (not IsInvasionActive(self)) then return end -- add the points for the player if (msg.name == "stink_cloud_cleaned_by_player") then AddPlayerPoints(self, msg.ObjIDSender, CONSTANTS["POINT_VALUE_STINK_CLOUD"]) end -- add clean points, spawn new cloud if event not over if (IncrementTotalCleanPoints(self, CONSTANTS["POINT_VALUE_STINK_CLOUD"]) == false) then -- spawn a new stink in this stink's place (at a new spot) spawnSingleStinkCloud(self,msg.param1) end elseif (msg.name == "hazmat_cleaned") then if (not IsInvasionActive(self)) then return end -- add the points for the player AddPlayerPoints(self, msg.ObjIDSender, CONSTANTS["POINT_VALUE_HAZMAT"]) -- add clean points IncrementTotalCleanPoints(self, CONSTANTS["POINT_VALUE_HAZMAT"]) elseif (msg.name == "broombot_fixed") then if (not IsInvasionActive(self)) then return end -- add the points for the player AddPlayerPoints(self, msg.ObjIDSender, CONSTANTS["POINT_VALUE_BROOMBOT"]) -- add clean points IncrementTotalCleanPoints(self, CONSTANTS["POINT_VALUE_BROOMBOT"]) end --[[ --elseif(msg.name == "can_complete_follow") then -- SKUNKFOLLOW[msg.targetID:GetID()] = msg.iPosit -- return msg end --]] end --[[ function EndSkunkEvent(self) self:SetVar( "invasionInProgress", false ) killSkunks(self) openShutters(self) stopSkunkDetectors(self) IdleNPCs(self) self:SetVar("CurrentDestink", 0) EndTruck(self) KillHazmatNPCs(self) TransformFountainToNormal( self ) GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="normal_sky" } GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name="stop_lamp_detectors" } end --]] -------------------------------------------------------------- -- set NPCs into panic state -------------------------------------------------------------- function PanicNPCs(self) for actorNum = 1, #SPAWNEDNPCS do local actor = GAMEOBJ:GetObjectByID(SPAWNEDNPCS[actorNum]) actor:NotifyObject{ name="npc_panic" } end end -------------------------------------------------------------- -- set NPCs as idle -------------------------------------------------------------- function IdleNPCs(self) for actorNum = 1, #SPAWNEDNPCS do local actor = GAMEOBJ:GetObjectByID(SPAWNEDNPCS[actorNum]) actor:NotifyObject{ name="npc_idle" } end end -------------------------------------------------------------- -- return if template is a valid panic npc -------------------------------------------------------------- function IsValidNPC(templateID) -- list of npcs does not exist if (CONSTANTS["INVASION_PANIC_ACTORS"] == nil) then return false end -- look for a valid actor for actors = 1, #CONSTANTS["INVASION_PANIC_ACTORS"] do if (templateID == CONSTANTS["INVASION_PANIC_ACTORS"][actors]) then return true end end return false end -------------------------------------------------------------- -- return if template is a valid skunk npc -------------------------------------------------------------- function IsValidSkunk(templateID) -- list of npcs does not exist if (CONSTANTS["INVASION_SKUNK_LOT"] == nil) then return false end -- look for a valid actor for actors = 1, #CONSTANTS["INVASION_SKUNK_LOT"] do if (templateID == CONSTANTS["INVASION_SKUNK_LOT"][actors]) then return true end end return false end -------------------------------------------------------------- -- Triggers the van animations -- returns animation time -------------------------------------------------------------- function animateVan(self, name) local van = getObjectByName( self, "HazmatVanID" ) local anim_time = 0 if (van ~= nil) then -- clear timers on it because we are animating GAMEOBJ:GetTimer():CancelAllTimers( van ) anim_time = van:GetAnimationTime{ animationID = name }.time van:PlayAnimation{ animationID = name } end return anim_time end -------------------------------------------------------------- -- Spawn Hazmat NPCs -------------------------------------------------------------- function SpawnHazmatNPCs(self) -- spawn npcs for i = 1, CONSTANTS["NUM_HAZMAT_NPCS"] do GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["TIME_BETWEEN_HAZMAT_SPAWNS"] * i, "SpawnSingleHazmatNPCTimer" .. i, self ) end end -------------------------------------------------------------- -- Spawns a hazmat NPC for the event by number -------------------------------------------------------------- function spawnSingleHazmatNPC(self, num) -- construct path string local pathStr = CONSTANTS["HAZMAT_NPC_PATH_PREFIX"] .. num -- create the config data for the new object local config = {{"HazmatNum", num}, {"attached_path", pathStr}, {"attached_path_start", 0}} -- get first waypoint data for spawn position local firstWP = GAMEOBJ:GetWaypointPos( pathStr, 1) local spawnX = firstWP.x local spawnY = firstWP.y local spawnZ = firstWP.z local rotX = 0.0 local rotY = 0.0 local rotZ = 0.0 local rotW = 1.0 -- get the truck's rotation local van = getObjectByName( self, "HazmatVanID" ) if (van) then -- we want them to face the back of the truck, so 180 degrees from the way the truck faces rotX = 0.0 - van:GetRotation().z rotY = 0.0 - van:GetRotation().w rotZ = van:GetRotation().x rotW = van:GetRotation().y end -- add the object RESMGR:LoadObject { objectTemplate = CONSTANTS["SPAWNED_HAZMAT_NPC"], x = spawnX, y = spawnY, z = spawnZ, rx = rotX, ry = rotY, rz = rotZ, rw = rotW, owner = self, configData = config } end -------------------------------------------------------------- -- remove spawned hazmat NPCs from the level -------------------------------------------------------------- function killHazmatNPCs(self) for i,hazmatID in pairs(HAZMAT_NPCS) do local hazmatObj = GAMEOBJ:GetObjectByID(hazmatID) if (hazmatObj and hazmatObj:Exists()) then print("removing hazmat NPC " .. i) hazmatObj:Die{killerID = hazmatObj} --, killType = "SILENT"} end end HAZMAT_NPCS = {} end -- Request follow message from baby skunks function onRequestFollow(self, msg) print("IN ON REQUESTFOLLOW EVENT SCRIPT") -- Forward message on to the mother local mother = getObjectByName( self, "MotherSkunkID" ) if(mother ~= nil) then print("mother not null") local FollowMsg = mother:RequestFollow{ targetID = msg.targetID, requestorID = msg.requestorID } return FollowMsg end return msg end -------------------------------------------------------------- -- Event from client, right now we do slash commands -------------------------------------------------------------- function onFireEventServerSide( self, msg ) if ( msg.args == "toggleEvent" ) then -- cancel all timers we will do our own based on state GAMEOBJ:GetTimer():CancelAllTimers( self ) -- get our state local state = GetZoneState(self) -- modify state if (state == CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) then state = CONSTANTS["ZONE_STATE_NO_INVASION"] else state = state + 1 end -- set the state SetZoneState(self, state) end end function CancelAllTimers( self ) GAMEOBJ:GetTimer():CancelTimer("startEventTimer", self) GAMEOBJ:GetTimer():CancelTimer("skunkSpawnTimer", self) GAMEOBJ:GetTimer():CancelTimer("fountainTimer", self) GAMEOBJ:GetTimer():CancelTimer("shutterTimer", self) GAMEOBJ:GetTimer():CancelTimer("stopEventTimer", self) GAMEOBJ:GetTimer():CancelTimer("HazmatTruckTimer", self) GAMEOBJ:GetTimer():CancelTimer("HazmatNPCTimer", self) GAMEOBJ:GetTimer():CancelTimer("sirenTimer", self) end -- 3712, 3713, 3714 function LoadSporeAnimals(self) -- Chickens for i = 1, 3 do -- TODO move some constants out to c_zoorilla --print("Loading chicken: " .. i) local wp = GAMEOBJ:GetWaypointPos("spore1", i) --print("x y x: " .. wp.x .. " ".. wp.y .. " " .. wp.z) RESMGR:LoadObject {objectTemplate = 3712, x=wp.x, y=wp.y, z=wp.z, owner=self, rw=0.0, rx= 0.0, ry=0.0, rz=0.0} end -- Skunks for i = 1, 3 do --print("Loading skunk: " .. i) local wp = GAMEOBJ:GetWaypointPos("spore2", i) --print("x y x: " .. wp.x .. " ".. wp.y .. " " .. wp.z) RESMGR:LoadObject {objectTemplate = 3713, x=wp.x, y=wp.y, z=wp.z, owner=self, rw=0.0, rx= 0.0, ry=0.0, rz=0.0} end -- Sheep for i = 1, 3 do --print("Loading sheep: " .. i) local wp = GAMEOBJ:GetWaypointPos("spore3", i) --print("x y x: " .. wp.x .. " ".. wp.y .. " " .. wp.z) RESMGR:LoadObject {objectTemplate = 3714, x=wp.x, y=wp.y, z=wp.z, owner=self, rw=0.0, rx= 0.0, ry=0.0, rz=0.0} end end -------------------------------------------------------------- -- Server side script maintains the state of the spouts using -- player proximity -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Get the enable state -------------------------------------------------------------- function GetEnableState(self) return self:GetVar("SpoutEnabled") end -------------------------------------------------------------- -- Set the enable state -------------------------------------------------------------- function SetEnableState(self, state) -- calc new state and set local bIsEnabled = (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) self:SetVar("SpoutEnabled", bIsEnabled) end -------------------------------------------------------------- -- On startup -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetVar("PlayerOnMe", false ) -- @TODO: leaveprox does not work on logout self:SetProximityRadius{ radius = CONSTANTS["radius"]} -- stores if the spout is currently enabled self:SetVar("SpoutEnabled", true) end -------------------------------------------------------------- -- Called when proximity is updated -------------------------------------------------------------- function onProximityUpdate(self, msg) -- a player enters proximity while no players are on it if ( msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 and self:GetVar("PlayerOnMe") == false ) then -- if the player that just entered proximity had skunk stink, clean it off CleanPlayer( self, msg ) self:SetVar( "PlayerOnMe", true ) elseif ( msg.status == "LEAVE" and msg.objId:GetFaction().faction == 1 ) then GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "ProxCheck",self ) end end -------------------------------------------------------------- -- cleans skunk stink off the player that just entered proximity -------------------------------------------------------------- function CleanPlayer( self, msg ) if (GetEnableState(self) == true) then print( "SPOUT:CleanPlayer" ) self:CastSkill{ optionalTargetID = msg.objId, skillID = CONSTANTS["DESTINK_SKILL"] } end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) -- check for players in proximity if (msg.name == "ProxCheck") then -- no one left if (ArePlayersInProximity(self) == false) then self:SetVar( "PlayerOnMe", false ) end end end -------------------------------------------------------------- -- Determines if any players are currently in proximity -------------------------------------------------------------- function ArePlayersInProximity(self) local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() if faction and faction.faction == 1 then return true; end index = index + 1 end return false; end -------------------------------------------------------------- -- Notification to object -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetEnableState(self, msg.param1) end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') -- All the lot nums for the maze LOT_NUMS = {} LOT_NUMS[1] = { 3626, 3627, 3628, 3700 } function onStartup(self) print("TB Bench Startup") end function onTripleBuildSelect(self, msg) print("TripleBuildSelect") local canswap = 0 -- Make sure we are allowed to spawn the piece they are requesting for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(LOT_NUMS[i][a] == msg.lotnum) then canswap = 1 -- how do you break out of a loop in lua? end end end if(canswap == 0) then print("CANT SWAP") return end local mypos = self:GetPosition().pos local myRot = self:GetRotation() self:Die{killType = "SILENT"} RESMGR:LoadObject { objectTemplate = msg.lotnum, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') --LOT_NUMS = { 3663, 3664, 3665, 3667 } -- All the lot nums for the maze LOT_NUMS = {} LOT_NUMS[1] = { 3663, 3664, 3665, 3667 } LOT_NUMS[2] = { 3677, 3678, 3679, 3680 } LOT_NUMS[3] = { 3681, 3682, 3683, 3684 } LOT_NUMS[4] = { 3685, 3686, 3687, 3688 } function onStartup(self) print("TB Maze Piece Startup") end function onTripleBuildSelect(self, msg) print("TripleBuildSelect") local canswap = 0 -- Make sure we are allowed to spawn the piece they are requesting for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(LOT_NUMS[i][a] == msg.lotnum) then canswap = 1 -- how do you break out of a loop in lua? end end end if(canswap == 0) then print("CANT SWAP") return end local mypos = self:GetPosition().pos local myRot = self:GetRotation() self:Die{killType = "SILENT"} RESMGR:LoadObject { objectTemplate = msg.lotnum, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end require('State') require('o_StateCreate') require('o_mis') require('o_Main') --------- HORRIBLY UGLY TEST SCRIP. JUST A TRIPLE BUILD EXCERCISE AND NOT FOR PRODUCTION LEVEL -- All the lot nums for the maze LOT_NUMS = {} LOT_NUMS[1] = { 3712, 3713, 3714, 3712 } --3712 chicken 3713 skunk 3714 sheep function onStartup(self) -- 3 second timer on startup before we set all our params GAMEOBJ:GetTimer():AddTimerWithCancel(3, "startTimer", self) self:SetVar("HasStarted", 0 ) self:SetVar("dying", 0) storeHomePoint(self) end function DoWander(self) --print("DoWander") local mypos = self:GetPosition().pos local rpos = getRandomPos(self, mypos, 15) GAMEOBJ:GetTimer():CancelTimer("wanderTimer", self) GAMEOBJ:GetTimer():AddTimerWithCancel(12, "wanderTimer", self) --print("my: " .. mypos.x.. " ".. " " .. mypos.y .. " ".. mypos.z) --print("r: " .. rpos.x.. " ".. " " ..rpos.y .. " ".. rpos.z) -- Every once in a awhile we go back to the tether point local r = math.random(1, 8) if(r == 4) then --print("going to tether: " .. self:GetVar("ourlotnum")) self:GoTo { speed = 0.50, target = { x = tetherpos.x, z = tetherpos.z, y = tetherpos.y} } else self:GoTo { speed = 0.50, target = { x = rpos.x, z = rpos.z, y = rpos.y} } end end function onTripleBuildSelect(self, msg) local canswap = 0 -- Make sure we are allowed to spawn the piece they are requesting for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(LOT_NUMS[i][a] == msg.lotnum) then canswap = 1 -- how do you break out of a loop in lua? end end end if(canswap == 0) then print("CANT SWAP") return end local mypos = self:GetPosition().pos local myRot = self:GetRotation() self:SetVar("dying", 1) self:Die{killType = "SILENT"} RESMGR:LoadObject { objectTemplate = msg.lotnum, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end function onProximityUpdate(self, msg) -- If we havent started then dont do anything if(self:GetVar("HasStarted") == 0) then return end -- If we are dying then don't do anything if(self:GetVar("dying") == 1) then return end if msg.status == "ENTER" then -- get the target local newobj = msg.objId local newlot = newobj:GetLOT{}.objtemplate -- if it is not one of whatever we are .... if(newlot == self:GetVar("ourlotnum")) then return end -- CHICKEN -- If we are the chicken then chase skunks and run from sheep if(self:GetVar("ourlotnum") == 3712) then -- It this is our attack radius if(msg.name == "attack") then if(newlot == 3713) then -- skunk --print("KILLING OPPONENT SKUNK") newobj:NotifyObject{ name="swapobjects", param1 = self:GetVar("ourlotnum") } self:SetVar("NoWander", 0) DoWander(self) end else if(newlot == 3713) then -- skunk -- chase self:FollowTarget { targetID = newobj, radius = 0, speed = 3, keepFollowing = true } self:SetVar("NoWander", 1) --print("no wander is 1 chicken following skunk") elseif(newlot == 3714) then -- sheep -- evade --local mySpeed = self:GetSpeed().speed self:EvadeTarget { targetID = newobj, radius = 20, speed = 1, keepEvading = true } self:SetVar("NoWander", 1) --print("no wander is 1 chicken evading sheep") end end end -- SHEEP -- If we are the sheep then chase the chicken and evade the skunk if(self:GetVar("ourlotnum") == 3714) then if(msg.name == "attack") then if(newlot == 3712) then -- chicken --print("KILLING OPPONENT CHICKEN") newobj:NotifyObject{ name="swapobjects", param1 = self:GetVar("ourlotnum") } self:SetVar("NoWander", 0) DoWander(self) end else if(newlot == 3712) then -- chicken --print("FOLLOWING CHICKEN") -- chase self:FollowTarget { targetID = newobj, radius = 0, speed = 3, keepFollowing = true } self:SetVar("NoWander", 1) --print("no wander is 1 sheep following chicken") elseif(newlot == 3713) then -- skunk -- evade --local mySpeed = self:GetSpeed().speed self:EvadeTarget { targetID = newobj, radius = 20, speed = 1, keepEvading = true } self:SetVar("NoWander", 1) --print("no wander is 1 sheep evading skunk") end end end -- SKUNK -- If we are the skunk then chase the sheep and evade the chicken if(self:GetVar("ourlotnum") == 3713) then if(msg.name == "attack") then if(newlot == 3714) then -- sheep --print("KILLING OPPONENT SHEEP") newobj:NotifyObject{ name="swapobjects", param1 = self:GetVar("ourlotnum") } self:SetVar("NoWander", 0) DoWander(self) end else if(newlot == 3714) then -- sheep --print("FOLLOWING SHEEP") -- chase self:FollowTarget { targetID = newobj, radius = 0, speed = 3, keepFollowing = true } self:SetVar("NoWander", 1) --print("no wander is 1 skunk evading following sheep") elseif(newlot == 3712) then -- chicken -- evade local mySpeed = self:GetSpeed().speed self:EvadeTarget { targetID = newobj, radius = 20, speed = 1, keepEvading = true } self:SetVar("NoWander", 1) --print("no wander is 1 skunk evading chicken") end end end end end function onNotifyObject(self, msg) if(self:GetVar("dying") == 1) then return end -- TODO verify the object they want us to be is one we can be if (msg.name == "swapobjects") then local mypos = self:GetPosition().pos local myRot = self:GetRotation() self:SetVar("dying", 1) self:Die{killType = "SILENT"} RESMGR:LoadObject { objectTemplate = msg.param1, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end end function onArrived(self, msg) --print("On arrived") if(self:GetVar("NoWander") == 0) then DoWander(self) end end --onLeftTetherRadius = function(self, msg) -- print("LEFT TETHER: " .. self:GetVar("ourlotnum")) -- if(self:GetVar("NoWander") == 0) then -- print("what?") -- print("x y z: " .. self:GetVar("myx") .. " " .. self:GetVar("myy") " " .. self:GetVar("myz")) -- self:GoTo { speed = 4, target = { x = self:GetVar("myx"), z = self:GetVar("myz"), y = self:GetVar("myy")} } -- end --end onTimerDone = function(self, msg) if msg.name == "startTimer" then -- print("SPORE Startup") -- make this a constant somewhere -- Evade Follow radius self:SetProximityRadius { radius = 20 } self:SetProximityRadius { radius = 2, name = "attack" }; -- Save our LOT number self:SetVar("ourlotnum", self:GetLOT{}.objtemplate) -- Misc variables self:SetVar("NoWander", 0 ) self:SetVar("HasStarted", 1 ) -- Global tether position tetherpos = GAMEOBJ:GetWaypointPos("SporeTether", 2) --self:SetTetherPoint { tetherPt = pos, radius = 30 } -- Start wandering DoWander(self) end if msg.name == "wanderTimer" then --print("WANDER TIMER") if(self:GetVar("NoWander") == 0) then --print("WANDER TIMER IN") DoWander(self) end end end function onStoppedEvading(self, msg) --print("Stopped evading") self:SetVar("NoWander", 0 ) DoWander(self) endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Dog" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 10 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 25 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = .75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "scared" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "EmoteFlee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 10 -- Flee Distance Set['FearTime'] = 5 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 360 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "scared" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetProximityRadius{radius = 5} end function onProximityUpdate(self, msg) if msg.status == "ENTER" then self:PlayFXEffect{effectType = "emote"} end end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 2 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.25 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetProximityRadius{radius = 20} end function onProximityUpdate(self, msg) if msg.status == "ENTER" then self:PlayFXEffect{effectType = "greet"} end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') function onStartup(self) -- register ourself with the zone script registerWithZoneControlObject(self) endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 20 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 30 -- Tether Radius Set['tetherSpeed'] = .75 -- Tether Speed Set['wanderRadius'] = 30 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 10 -- Max Wander Delay Set['WanderSpeed'] = 0.75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- endrequire('State') ----------------------------------------------------------- -- Run state ----------------------------------------------------------- run=State.create() run.onArrived=function(self,message) self:ContinueWaypoints() --self:SetPathingSpeed{speed=5} end run.onEnter=function(self) print("run enter") self:SetPathingSpeed{speed=5} --self:PlayAnimation{animationID=9} end run.onProximityUpdate=function(self, message) if message.status=="EXIT" and haveStoredID(self, message.objId) then clearStoredID(self, message.objId) self:SetVar("skunkCount", self:GetVar("skunkCount")-1) if(self:GetVar("skunkCount") == 0) then setState("idle", self) end end end run.onExit=function(self) print("run exit") end ----------------------------------------------------------- -- Idle state ----------------------------------------------------------- idle = State.create() idle.onEnter = function(self) print("Idle enter") self:SetPathingSpeed{speed=.75} end idle.onProximityUpdate=function(self, message) if message.status == "ENTER" and message.objId:GetFaction().faction == 1 and message.name == "WaveRadius" then print("waving") self:PlayFXEffect{effectType = "emote"} else onProximityUpdate(self, message) end end function onStartup(self) self:SetProximityRadius{radius=950} --////////for NPC waving to player self:SetProximityRadius{radius = 10, name = "WaveRadius"} --FOVradius = 180, --//////// self:SetVar("skunkCount", 0) UseWayPoints(self) self:FollowWaypoints() addState(run, "run", "run", self) addState(WayPointEvent, "WayPointEvent", "WayPointEvent", self) addState(idle, "idle", "idle", self) self:SetVar("WPEvent_NUM", 1) beginStateMachine("idle", self) --/////////////////////////////////////// -- Setting states using timers for now. self:SetVar("IdleTime", 120) self:SetVar("PanicTime", 180) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("IdleTime"), "IdleTimer", self ) --///////////////////////////////////// end onTimerDone = function(self, msg) print ("Timer name: "..msg.name) if (msg.name == "IdleTimer") then setState("run", self) GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("PanicTime"), "PanicTimer", self ) print("NPCs should be running") elseif (msg.name == "PanicTimer") then setState("idle", self) GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("IdleTime"), "IdleTimer", self ) print("NPCs should be walking") end end ----------------------------------------------------------- -- Waypoints state ----------------------------------------------------------- function UseWayPoints(self) WayPointEvent = State.create() WayPointEvent.onEnter = function(self) local o = self:GetVar("WPEvent_NUM") if self:GetVar("WPEvent_NUM") <= table.maxn(self:GetVar("Act_N")) then -- o = o + 1 WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")[o]) else self:SetVar("WPEvent_NUM", 1) self:ContinueWaypoints(); -- Explained below end end WayPointEvent.onProximityUpdate=function(self, message) idle.onProximityUpdate(self, message) end end function WayPointEventFunc(self,name,value) ----------------------- delay if name == "delay" then self:StopMoving() GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DelayAction", self ) end ----------------------- emote if name == "emote" then self:PlayAnimation{ animationID = value} local time = self:GetAnimationTime{ animationID = value }.time if time < 1 then time = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( time , "DelayActionEmote", self ) end ----------------------- pathspeed if name == "pathspeed" then self:SetPathingSpeed{speed = value} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end end --------------------------- -- Skunk stuff --------------------------- function onProximityUpdate(self, message) if(not message.objId) then return end if IsValidSkunk(message.objId:GetLOT().objtemplate) == true then if message.status=="ENTER" then self:SetVar("skunkCount", self:GetVar("skunkCount")+1) storeObjectID(self, message.objId) setState("run", self) else if haveStoredID(self, message.objId) then clearStoredID(self, message.objId) self:SetVar("skunkCount", self:GetVar("skunkCount")-1) if(self:GetVar("skunkCount") == 0) then setState("idle", self) end end end end end -------------------------------------------------------------- -- return if template is a valid skunk npc -------------------------------------------------------------- function IsValidSkunk(templateID) -- list of npcs does not exist if (CONSTANTS["INVASION_SKUNK_LOT"] == nil) then return false end -- look for a valid actor for actors = 1, #CONSTANTS["INVASION_SKUNK_LOT"] do if (templateID == CONSTANTS["INVASION_SKUNK_LOT"][actors]) then return true end end return false end function onTimerDone(self, msg) if msg.name == "DelayAction" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) setState("WayPointEvent", self) end if msg.name == "DelayActionEmote" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) setState("WayPointEvent", self) end end function onArrived(self, msg) if (msg.actions) then Act_N = {} Act_V = {} for i = 1, table.maxn(msg.actions) do Act_N[i] = msg.actions[i].name Act_V[i] = msg.actions[i].value end self:SetVar("Act_N",Act_N) self:SetVar("Act_V",Act_V) setState("WayPointEvent", self) else self:ContinueWaypoints(); -- Explained below end end -------------------------------------------------------------- -- store an object ID -------------------------------------------------------------- function storeObjectID(self, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(final, finalID) end -------------------------------------------------------------- -- have stored ID -------------------------------------------------------------- function haveStoredID(self, object) targetID = self:GetVar(varName) if (targetID) then return true else return false end end -------------------------------------------------------------- -- get stored ID -------------------------------------------------------------- function clearStoredID(self, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(final, nil) end -------------------------------------------------------------- -- register with zone control object -------------------------------------------------------------- function registerWithZoneControlObject(self) -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{ objectID = self, templateID = self:GetLOT().objtemplate } end require('State') require('o_mis') ----------------------------------------------------------- -- Run state ----------------------------------------------------------- run=State.create() run.onArrived=function(self,message) self:ContinueWaypoints() self:SetPathingSpeed{speed=5} end run.onEnter=function(self) --print("run enter") self:SetPathingSpeed{speed=5} --self:PlayAnimation{animationID=9} end -- commenting this out so they will run all the time now during the skunk invasion --[[ run.onProximityUpdate=function(self, message) if message.status=="EXIT" and haveStoredID(self, message.objId) then clearStoredID(self, message.objId) self:SetVar("skunkCount", self:GetVar("skunkCount")-1) if(self:GetVar("skunkCount") == 0) then setState("idle", self) end end end ]]-- run.onExit=function(self) --print("run exit") end ----------------------------------------------------------- -- Idle state ----------------------------------------------------------- idle = State.create() idle.onEnter = function(self) --print("Idle enter") self:SetPathingSpeed{speed=.75} end idle.onProximityUpdate=function(self, message) if message.status == "ENTER" and message.objId:GetFaction().faction == 1 and message.name == "WaveRadius" then --print("waving") self:PlayFXEffect{effectType = "emote"} else --onProximityUpdate(self, message) end end function onStartup(self) self:SetVar( "bRunning", false ) UseWayPoints(self) self:FollowWaypoints() self:SetProximityRadius{radius = 20, name = "WaveRadius"} addState(run, "run", "run", self) addState(WayPointEvent, "WayPointEvent", "WayPointEvent", self) addState(idle, "idle", "idle", self) self:SetVar("WPEvent_NUM", 1) beginStateMachine("idle", self) -- register ourself to be instructed later registerWithZoneControlObject(self) --self:SetVar("IdleTime", 120) --self:SetVar("PanicTime", 180) -- GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("IdleTime"), "IdleTimer", self ) end onTimerDone = function(self, msg) --print ("Timer name: "..msg.name) --if (msg.name == "IdleTimer") then -- setState("run", self) -- GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("PanicTime"), "PanicTimer", self ) -- print("NPCs should be running") -- elseif (msg.name == "PanicTimer") then -- setState("idle", self) -- GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetVar("IdleTime"), "IdleTimer", self ) -- print("NPCs should be walking") if msg.name == "DelayAction" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) -- if the skunk invasion has started, make the npc run on his path if ( self:GetVar( "bRunning" ) == true ) then setState("run", self) self:ContinueWaypoints() else setState("WayPointEvent", self) end elseif msg.name == "DelayActionEmote" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) -- if the skunk invasion has started, make the npc run on his path if ( self:GetVar( "bRunning" ) == true ) then self:ContinueWaypoints() setState("run", self) else setState("WayPointEvent", self) end end end function onArrived(self, msg) if (msg.actions) then Act_N = {} Act_V = {} for i = 1, table.maxn(msg.actions) do Act_N[i] = msg.actions[i].name Act_V[i] = msg.actions[i].value end self:SetVar("Act_N",Act_N) self:SetVar("Act_V",Act_V) setState("WayPointEvent", self) else self:ContinueWaypoints(); -- Explained below end end function UseWayPoints(self) WayPointEvent = State.create() WayPointEvent.onEnter = function(self) local o = self:GetVar("WPEvent_NUM") if self:GetVar("WPEvent_NUM") <= table.maxn(self:GetVar("Act_N")) then -- o = o + 1 WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")[o]) else self:SetVar("WPEvent_NUM", 1) self:ContinueWaypoints(); -- Explained below end end WayPointEvent.onProximityUpdate=function(self, message) idle.onProximityUpdate(self, message) end end function WayPointEventFunc(self,name,value) ----------------------- delay if name == "delay" then self:StopMoving() GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DelayAction", self ) end ----------------------- emote if name == "emote" then self:PlayAnimation{ animationID = value} local time = self:GetAnimationTime{ animationID = value }.time if time < 1 then time = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( time , "DelayActionEmote", self ) end ----------------------- pathspeed if name == "pathspeed" then self:SetPathingSpeed{speed = value} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end end function onNotifyObject(self, msg) -- Update event state if (msg.name == "npc_panic") then --print("NPC Panic") self:SetVar( "bRunning", true ) setState("run", self) elseif (msg.name == "npc_idle") then --print("NPC Idle") self:SetVar( "bRunning", false ) setState("idle", self) end end-------------------------------------------------------------- -- (SERVER SIDE) Script for stink cloud NPCs -- -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Locals and Constants -------------------------------------------------------------- local CONSTANTS = {} CONSTANTS["DestinkDuration"] = 4.0 CONSTANTS["RolloverDuration"] = 0.2 CONSTANTS["BROOMBOT_LOT"] = 3247 CONSTANTS["bubbleradius"] = 2.0 function onStartup(self) self:SetProximityRadius{ radius = CONSTANTS["bubbleradius"]} end function onProximityUpdate(self, msg) -- if it's a player if msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 then -- check for player in bubble, clean stink cloud as a result local bPlayerInBubble = msg.objId:IsMiniFigInABubble().bBubble if ( bPlayerInBubble ) then local currencyMsg = self:RollCurrency{iTable = 1, iLevel = 1} self:DropLoot{iCurrency = currencyMsg.iCurrency, owner = msg.objId, rerouteID = msg.objId, sourceObj = self} self:Die() GAMEOBJ:GetZoneControlID():NotifyObject{ name="stink_cloud_cleaned_by_player", ObjIDSender = msg.objId, param1 = self:GetVar("StinkCloudNum") } end end end -------------------------------------------------------------- -- Called when this object is destinked -------------------------------------------------------------- function onSquirtWithWatergun(self, msg) -- if the shooter is a broom bot if (msg.shooterID:GetLOT().objtemplate == CONSTANTS["BROOMBOT_LOT"]) then -- delay to match animation GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["DestinkDuration"] , "RemoveSelf", self ) -- @TODO: forward player owned broombot info -- see if this broombot was built by a player local player = getObjectByName( msg.shooterID, "playerBuilder" ) if (player) then -- Tell the zone script a stink cloud was cleaned. Pass who cleaned it and the skunk number GAMEOBJ:GetZoneControlID():NotifyObject{ name="stink_cloud_cleaned_by_player", ObjIDSender = player, param1 = self:GetVar("StinkCloudNum") } else -- Tell the zone script a stink cloud was cleaned. Pass who cleaned it and the skunk number GAMEOBJ:GetZoneControlID():NotifyObject{ name="stink_cloud_cleaned_by_broombot", ObjIDSender = msg.shooterID, param1 = self:GetVar("StinkCloudNum") } end else -- @TODO: update player task for missions --this is hacky and not the right way we should be doing this, but it works, non the less -- Using the "Kill" mission type in the DB, we are able to update the mission through the objects by calling --the "kill" tasktype with calues of one. The downfall is that this will only allow one mission on the designated objects that --use the kill type. The commented out updatemissiontask functions are the way we should be doing this but is broken. msg.shooterID:UpdateMissionTask {target = self, value = 1, value2 = 1, taskType = "kill"} --msg.shooterID:UpdateMissionTask {target = self, value = 166, value2 = 1, taskType = "complete"} -- msg.shooterID:UpdateMissionTask {target = self, value = 167, value2 = 1, taskType = "complete"} --msg.shooterID:UpdateMissionTask {target = self, value = 168, value2 = 1, taskType = "complete"} local currencyMsg = self:RollCurrency{iTable = 1, iLevel = 1} self:DropLoot{iCurrency = currencyMsg.iCurrency, owner = msg.shooterID, rerouteID = msg.shooterID, sourceObj = self} -- Tell the zone script a stink cloud was cleaned. Pass who cleaned it and the skunk number GAMEOBJ:GetZoneControlID():NotifyObject{ name="stink_cloud_cleaned_by_player", ObjIDSender = msg.shooterID, param1 = self:GetVar("StinkCloudNum") } -- else this is the player so kill it instantly self:Die() end end -------------------------------------------------------------- -- called when timer complete -------------------------------------------------------------- function onTimerDone(self, msg) -- cleaned by a broombot if (msg.name == "RemoveSelf") then self:Die() end end -------------------------------------------------------------- -- Description: -- -- Server script for Shooting Gallery NPC in ZP area. -- This NPC will react to a user interaction and prompt -- the user to start the shooting gallery. If the user -- presses yes, the NPC will send him to the ZP SG instance. -- -------------------------------------------------------------- function onStartup(self) self:SetProximityRadius{radius = 15} end -------------------------------------------------------------- -- Sent from a player when trying to use this object -------------------------------------------------------------- function onUse(self, msg) local strText = "Start Shooting Gallery?" -- show a dialog box msg.user:DisplayMessageBox{bShow = true, imageID = 3, callbackClient = self, text = strText, identifier = "Shooting_Gallery_Start"} end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- User wants to start shooting gallery, send him there if (msg.iButton == 1 and msg.identifier == "Shooting_Gallery_Start") then msg.sender:TransferToZone{ zoneID = 335, ucInstanceType = 1 } end end function onProximityUpdate(self, msg) if msg.status == "LEAVE" then msg.objId:DisplayMessageBox{bShow = false, --imageID = 3, callbackClient = self, --text = strText, identifier = "Shooting_Gallery_Start"} end endrequire('State') require('o_mis') local CONSTANTS = {} CONSTANTS["STREAK_MOD"] = 5 CONSTANTS["STREAK_BONUS"] = {1,5,10} -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- pick a random explode factor --local ran = math.random(2,2) -- set explode factor --self:SetSmashableParams{fExplodeFactor = 2.5} --GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "ChangeSpeed",self ) self:SetVar( "bInABubble", false ) self:SetVar("FloatingVelocityUpdateTime", 0.1 ) self:SetVar("StinkyVelocityUpdateTime", 0.1 ) self:SetVar("BubblePopTime", 0.75 ) end -------------------------------------------------------------- -- Get the score for the target -------------------------------------------------------------- function onGetActivityPoints(self, msg) local SpawnData = self:GetVar("SpawnData") if (SpawnData) then local mod = math.floor(msg.optionalModifier / self:GetVar("streakmod") + 1) if mod > #self:GetVar("streakbonus") then mod = #self:GetVar("streakbonus") end msg.points = SpawnData.sdScore * self:GetVar("streakbonus")[mod] msg.addTime = SpawnData.sdTimeScore end return msg end function onNotifyObject(self, msg) if msg.name == "setpoints" then local SpawnData = self:GetVar("SpawnData") if (SpawnData) then SpawnData.sdScore = msg.param1 SpawnData.sdTimeScore = msg.param2 self:SetVar("SpawnData", SpawnData) end end end -------------------------------------------------------------- -- continue doign waypoints -- @TODO: modify speed/path/etc -------------------------------------------------------------- function onArrived(self, msg) -- do speed change ChangeSpeed(self) if (msg.isLastPoint == true) then --GAMEOBJ:GetZoneControlID():NotifyObject{ObjIDSender = self, name="escaped" } GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self, killType = "SILENT"} --GAMEOBJ:GetZoneControlID():UpdateMissionTask {target = self, taskType = "kill"} --elseif msg.wayPoint == 3 then -- add the item --local itemMsg = self:AddNewItemToInventory{ iObjTemplate = 3906 } --print("waypoint hit! equipping " .. tostring(itemMsg.newObjID)) -- equip item --self:EquipInventory{ itemtoequip = itemMsg.newObjID } end -- local i = 1 -- if(msg.actions) then -- while (msg.actions[i]) do -- print(msg.actions[i].name) -- print(msg.actions[i].value) -- i = i + 1 -- end -- end self:ContinueWaypoints() end -------------------------------------------------------------- -- when killed notify the parent to respawn -------------------------------------------------------------- function onDie(self, msg) -- notify zone object of the mission task update (temp msg to talk to it) -- note the killtype in taskType getParent(self):UpdateMissionTask{target = self, taskType = msg.killType} end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- Change the speed every 5 seconds if msg.name == "ChangeSpeed" then -- pick a random speed local ran = math.random(1,4) self:SetPathingSpeed{ speed = ran } GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "ChangeSpeed",self ) end if msg.name == "Despawn" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self, killType = "SILENT" } end if (msg.name == "floatVelocityTimer") then UpdateFloatingVelocity(self) end end -------------------------------------------------------------- -- Try to change the targets speed -------------------------------------------------------------- function ChangeSpeed(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to change speed? if ((SpawnData.sdChangeSpeed == true) and (math.random() <= SpawnData.sdSpeedChance)) then -- get a speed local newSpeed = (math.random() * (SpawnData.sdMaxSpeed - SpawnData.sdMinSpeed)) + SpawnData.sdMinSpeed -- set the new speed self:SetPathingSpeed{ speed = newSpeed } end end end -------------------------------------------------------------- -- Try to despawn the target -------------------------------------------------------------- function Despawn(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to despawn? if (SpawnData.sdDespawnTime == true) then GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "Despawn",self ) end end end function WayPointEvent(self) local o = self:GetVar("WPEvent_NUM") if self:GetVar("WPEvent_NUM") <= table.maxn(self:GetVar("Act_N")) then WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")[o]) else self:SetVar("WPEvent_NUM", 1) if ( self:GetVar( "bInABubble" ) == false ) then self:ContinueWaypoints(); -- Explained below end end end function UpdateFloatingVelocity(self) local position = self:GetPosition{}.pos if ( position.y < 300 ) then -- don't let the skunk float up out of the world bounds local velocity = self:GetLinearVelocity{}.linVelocity velocity.y = velocity.y + 15.0 self:SetLinearVelocity{ linVelocity = velocity } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar( "FloatingVelocityUpdateTime" ), "floatVelocityTimer", self ) else self:Die{ killType = "SILENT" } end end function PutCleanSkunkInABubble(self, player) AddBubbleEffect(self) player:UpdateMissionTask {target = self, taskType = "complete"} --update bubble the skunk achievement self:StopPathing{} -- stop following the waypoints self:ClearProximityRadius{} -- get rid of the skunk's agrro radius local position = self:GetPosition{}.pos position.y = position.y + 5.0 -- to help the skunk break free of gravity. Give him a headstart, and we will continually add to his velocity. self:SetPosition{ pos = position } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar( "FloatingVelocityUpdateTime" ), "floatVelocityTimer", self ) end function AddBubbleEffect(self) if ( self:GetVar( "bInABubble" ) == false ) then self:ActivateBubbleBuffFromServer{ wszType = "skunk", bSpecialAnims = false } self:SetVar( "bInABubble", true ) self:PlayAnimation{ animationID = "howl" } end end function onSquirtWithWatergun( self, msg ) if ( self:GetVar( "bInABubble" ) == false ) then msg.shooterID:UpdateMissionTask {target = self, taskType = "kill"} PutCleanSkunkInABubble(self, msg.shooterID) self:RemoveSkill{ skillID = 109 } self:StopFXEffect{ name = "stink" } self:ToggleActiveSkill{ iSkillID = 32, bOn = true } --BEHAVIOR_DESTINK end endrequire('State') require('o_mis') -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- pick a random explode factor --local ran = math.random(2,2) -- set explode factor --self:SetSmashableParams{fExplodeFactor = 2.5} --GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "ChangeSpeed",self ) self:SetVar( "bInABubble", false ) self:SetVar("FloatingVelocityUpdateTime", 0.1 ) self:SetVar("StinkyVelocityUpdateTime", 0.1 ) self:SetVar("BubblePopTime", 0.75 ) end -------------------------------------------------------------- -- Get the score for the target -------------------------------------------------------------- function onGetActivityPoints(self, msg) local SpawnData = self:GetVar("SpawnData") if (SpawnData) then local mod = math.floor(msg.optionalModifier / self:GetVar("streakmod") + 1) if mod > #self:GetVar("streakbonus") then mod = #self:GetVar("streakbonus") end msg.points = SpawnData.sdScore * self:GetVar("streakbonus")[mod] msg.addTime = SpawnData.sdTimeScore end return msg end function onNotifyObject(self, msg) if msg.name == "setpoints" then local SpawnData = self:GetVar("SpawnData") if (SpawnData) then SpawnData.sdScore = msg.param1 SpawnData.sdTimeScore = msg.param2 self:SetVar("SpawnData", SpawnData) end end end -------------------------------------------------------------- -- continue doign waypoints -- @TODO: modify speed/path/etc -------------------------------------------------------------- function onArrived(self, msg) -- do speed change ChangeSpeed(self) if (msg.isLastPoint == true) then --GAMEOBJ:GetZoneControlID():NotifyObject{ObjIDSender = self, name="escaped" } GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self, killType = "SILENT"} --GAMEOBJ:GetZoneControlID():UpdateMissionTask {target = self, taskType = "kill"} end -- local i = 1 -- if(msg.actions) then -- while (msg.actions[i]) do -- print(msg.actions[i].name) -- print(msg.actions[i].value) -- i = i + 1 -- end -- end self:ContinueWaypoints() end -------------------------------------------------------------- -- when killed notify the parent to respawn -------------------------------------------------------------- function onDie(self, msg) -- notify zone object of the mission task update (temp msg to talk to it) -- note the killtype in taskType getParent(self):UpdateMissionTask{target = self, taskType = msg.killType} end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- Change the speed every 5 seconds if msg.name == "ChangeSpeed" then -- pick a random speed local ran = math.random(1,4) self:SetPathingSpeed{ speed = ran } GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "ChangeSpeed",self ) end if msg.name == "Despawn" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:Die{ killerID = self, killType = "SILENT" } end if (msg.name == "floatVelocityTimer") then UpdateFloatingVelocity(self) end end -------------------------------------------------------------- -- Try to change the targets speed -------------------------------------------------------------- function ChangeSpeed(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to change speed? if ((SpawnData.sdChangeSpeed == true) and (math.random() <= SpawnData.sdSpeedChance)) then -- get a speed local newSpeed = (math.random() * (SpawnData.sdMaxSpeed - SpawnData.sdMinSpeed)) + SpawnData.sdMinSpeed -- set the new speed self:SetPathingSpeed{ speed = newSpeed } end end end -------------------------------------------------------------- -- Try to despawn the target -------------------------------------------------------------- function Despawn(self) -- get spawn data local SpawnData = self:GetVar("SpawnData") if (SpawnData) then -- should we try to despawn? if (SpawnData.sdDespawnTime == true) then GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "Despawn",self ) end end end function WayPointEvent(self) local o = self:GetVar("WPEvent_NUM") if self:GetVar("WPEvent_NUM") <= table.maxn(self:GetVar("Act_N")) then WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")[o]) else self:SetVar("WPEvent_NUM", 1) if ( self:GetVar( "bInABubble" ) == false ) then self:ContinueWaypoints(); -- Explained below end end end function UpdateFloatingVelocity(self) local position = self:GetPosition{}.pos if ( position.y < 300 ) then -- don't let the skunk float up out of the world bounds local velocity = self:GetLinearVelocity{}.linVelocity velocity.y = velocity.y + 15.0 self:SetLinearVelocity{ linVelocity = velocity } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar( "FloatingVelocityUpdateTime" ), "floatVelocityTimer", self ) else self:Die{ killType = "SILENT" } end end function PutCleanSkunkInABubble(self, player) AddBubbleEffect(self) player:UpdateMissionTask {target = self, taskType = "complete"} --update bubble the skunk achievement self:StopPathing{} -- stop following the waypoints self:ClearProximityRadius{} -- get rid of the skunk's agrro radius local position = self:GetPosition{}.pos position.y = position.y + 5.0 -- to help the skunk break free of gravity. Give him a headstart, and we will continually add to his velocity. self:SetPosition{ pos = position } GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar( "FloatingVelocityUpdateTime" ), "floatVelocityTimer", self ) end function AddBubbleEffect(self) if ( self:GetVar( "bInABubble" ) == false ) then self:ActivateBubbleBuffFromServer{ wszType = "skunk", bSpecialAnims = false } self:SetVar( "bInABubble", true ) self:PlayAnimation{ animationID = "howl" } end end function onSquirtWithWatergun( self, msg ) if ( self:GetVar( "bInABubble" ) == false ) then msg.shooterID:UpdateMissionTask {target = self, taskType = "kill"} PutCleanSkunkInABubble(self, msg.shooterID) self:RemoveSkill{ skillID = 109 } self:StopFXEffect{ name = "stink" } self:ToggleActiveSkill{ iSkillID = 32, bOn = true } --BEHAVIOR_DESTINK end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "22" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 5 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] --[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" Set['FollowActive'] = true ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Ninja Zoo Wander" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] --[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} Set['FollowActive'] = true --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 11 Set['OverRideHealth'] = false Set['Health'] = 3 Set['OverRideImag'] = false Set['Imagination'] = 10 Set['OverRideImmunity'] = false Set['Immunity'] = false Set['OverRideName'] = true Set['Name'] = "NINJA" Set['EmoteReact'] = true Set['Emote_EffectID'] = 4 Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] -- Aggro Set['OverRideAggro'] = true Set['aggroRadius'] = 10 -- Aggro FOV Set['UseAggroFOV'] = false Set['aggroFOVRadius'] = 20 Set['aggroFOV'] = 180 -- Conduct Set['OverRideConduct'] = true Set['conductRadius'] = 20 -- Conduct FOV Set['UseConductFOV'] = true Set['conductFOVRadius'] = 15 Set['conductFOV'] = 180 -- Tether Set['OverRideTether'] = true Set['tetherRadius'] = 45 -- Wander Set['OverRideWander'] = true Set['wanderRadius'] = 8 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"],[Frozen] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "small" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 Set['WayPointDMax'] = 0 Set['WayPointSpeed'] = 1 -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false Set['WanderChance'] = 100 Set['WanderDelayMin'] = 5 Set['WanderDelayMax'] = 5 -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" Set['WEmoteEffe_1'] = 4 -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true Set['WEmoteType_2'] = "breakdance" Set['WEmoteEffe_2'] = 4 --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]["Friendly"] Set['AggroNPC'] = false -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_ID'] = 3 -- effectID of Emmote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false Set['FearNPC'] = false Set['FearCombat'] = false Set['FearHP'] = false Set['FearHPamount'] = 1 -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee"-- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 20 -- Flee Distance Set['FearTime'] = 8 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 3 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = nil -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "salute" Set['FearEffectID'] = 4 -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_MainWeight']= 100 Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Conduct_CoolDown'] = 5 -- Cool down is start after the conduct has completed. -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "after" -- When Emote is played ['before']/['after']/['both']. Set['Con_1_Type'] = "flee" -- String name of type ['follow'],['face'] Set['Con_1_Distance'] = 3 -- Option Distance [ follow = distance to npc ] Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action ( Targets and Truns the NPC ) Set['Con_1_Delay'] = 2 -- Delay after the Acton is completed Set['Con_1_Speed'] = 5 -- move speed -- goto set Pos [ Optional ] Set['Con_1_Use_xyz'] = false Set['Con_1_gotoX'] = 0 -- x Set['Con_1_gotoY'] = 0 -- y Set['Con_1_gotoZ'] = 0 -- z -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_EffectID'] = 4 -- Effect ID Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EDelay'] = 0.5 -- Animation Delay Set['Con_1_ESkill'] = true Set['Con_1_ESkillID'] = 11 --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false Set['Con_2_AFaction'] = 3 -- Faction of the NPC/Player -------------------------------------------------------------------------------------- -- Actions -- ["follow"] : Follow the Set faction -- ["face"] : Face the set faction -- ["sneakto"] : Check to see if target can see him then follow -- ["flee"] : Use Fear setting for flee ( Due not use Emote ) -- ["goto"] : Goes to set Faction or [x,y,z] -- ["teleport"]: teleport to [x,y,z] pos -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "after" -- When Action is played before/after Set['Con_2_Type'] = "sneakto" -- String name of type ['follow'],['face'] Set['Con_2_Distance'] = 4 -- Option Distance [ follow = distance to npc ] Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_Speed'] = 2 -- move speed -- goto set Pos [ Optional ] Set['Con_2_Use_xyz'] = false Set['Con_2_gotoX'] = 0 -- x Set['Con_2_gotoY'] = 0 -- y Set['Con_2_gotoZ'] = 0 -- z -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_EffectID'] = 4 -- Effect ID Set['Con_2_EffectType'] = "chicken" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EDelay'] = 8.75 -- Delay (Min should be the animation time) Set['Con_2_ESkill'] = false Set['Con_2_ESkillID'] = 31 --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 170 -- Spawner ID [1802 = Pirate] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Raduis Min Distance Set['Pet_DisMax'] = 20 -- Raduis Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnEffectID'] = 4 Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" --[[ --///////////////////////////////////////////////////////////////////////// _ ____ _____ / \ / ___| |_ _| / _ \ | | | | / ___ \ | |___ | | /_/ \_\ \____| |_| --]] Set['Act_Active'] = false Set['Act_SpawnInMode'] = "emoteBreak" -- ["broken"], ["emoteBreak"], Set['Act_Spawn'] = 170 -- activitie to spawn Set['Act_Reset'] = 120 -- time in Idle state before reseting. ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 2 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Old Man" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 200 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 20 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Patroler" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "Yellow" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 0 -- Min Waypoint Delay Set['WayPointDMax'] = 0 -- Max Waypoint Delay Set['WayPointSpeed'] = 0.1 -- Waypoint Speed (Travle speed) -- Patrol Events ------------------------------------------------------ Set['WayPointEvent'] = true -- Bool Active -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = false -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = false -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Helper" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "wptest" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings --------------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Passive" -- [Aggressive]--[Neutral]--[Passive] --[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_MainWeight'] = 100 Set['Conduct_1_Active'] = true -- Conduct 1 Active true/false -------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "face" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "grab" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['skillID'] = 9 Set['OverRideHealth'] = true -- Bool Health Overide Set['Health'] = 7 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Freak Darkling" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 30 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Guard" --["Patroler"],["Guard"],["Wander"] --********************************************************************** -- Patrol Settings ---------------------------------------------------- Set['WayPointType'] = "linear" -- ["loop"],["linear"],["once"] Set['WayPointSet'] = "sq_walk" -- ["name of way point set"] Set['WayPointDelay'] = nil -- ["ends"],["all"],[nil] Set['WayPointDMin'] = 2 -- Min Waypoint Delay Set['WayPointDMax'] = 2 -- Max Waypoint Delay Set['WayPointSpeed'] = 1 -- Waypoint Speed (Travle speed) -- Wander Settings ---------------------------------------------------- Set['WanderEmote'] = false -- Enable bool Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay -- effect 1 Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type -- effect 2 -- If emote 1 Weight is 20 emote 2 Weight will be 80....ect Set['WEmote_2'] = true -- Enalble 2nd Emote bool Set['WEmoteType_2'] = "breakdance" -- Animation Type --[[ ///////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "PassiveAggres" -- [Aggressive]--[Neutral]--[Passive]-[PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 2 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 1 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ /////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "Flee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 60 -- Flee Distance Set['FearTime'] = 1 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 220 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "breakdance" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --///////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ _ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| / | | | | | | | | \| | | | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | | | \____| \___/ |_| \_| |____/ \___/ \____| |_| |_| --]] Set['Conduct_1_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_1_Action'] = true -- Active true/false Set['Con_1_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_1_AChance'] = 100 -- Chance to Play Set['Con_1_Order'] = "before" -- When Action is played before/after Set['Con_1_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_1_Distance'] = 20 -- Option Distance Set['Con_1_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_1_DelayMin'] = 1 -- Min Delay Set['Con_1_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_1_Emote'] = true -- Active true/false Set['Con_1_Weight'] = 100 -- Chance to play Set['Con_1_EffectType'] = "salute" -- The Effect Name Set['Con_1_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_1_EFaction'] = 100 -- Faction of the NPC/Player --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ ____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| |___ \ | | | | | | | \| | | | | | | | | | | | | | __) | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | / __/ \____| \___/ |_| \_| |____/ \___/ \____| |_| |_____| --]] Set['Conduct_2_Active'] = false -- Conduct 1 Active true/false -------------------------------------------------------------------------------------- -- Action Set['Con_2_Action'] = true -- Active true/false Set['Con_2_AFaction'] = 1 -- Faction of the NPC/Player Set['Con_2_AChance'] = 100 -- Chance to Play Set['Con_2_Order'] = "before" -- When Action is played before/after Set['Con_2_Type'] = "Ninja" -- String name of type ['Ninja'],['face'] Set['Con_2_Distance'] = 20 -- Option Distance Set['Con_2_ATarget'] = true -- Target NPC/Player before playing Action Set['Con_2_DelayMin'] = 1 -- Min Delay Set['Con_2_DelayMax'] = 2 -- Max Delay -- Emote Set['Con_2_Emote'] = true -- Active true/false Set['Con_2_Weight'] = 100 -- Chance to play Set['Con_2_EffectType'] = "salute" -- The Effect Name Set['Con_2_ETarget'] = true -- Turns the NPC to the Target Before Emoting Set['Con_2_EFaction'] = 100 -- Faction of the NPC/Player ------ Due not change -------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) ------------------------------------------------------------------------------- end require('o_mis') local oneTimeOnly = false; -- Something touches the phantom object function onCollisionPhantom(self, msg) targetID = msg.objectID local BobMissionStatus = targetID:GetMissionState{missionID = 173}.missionState --Check the Bob mission to see the status -- define player local playerID = GAMEOBJ:GetLocalCharID() if (BobMissionStatus > 1) then --If the player has not accepted the mission, print the hint text. if (msg.objectID:GetID() == playerID and oneTimeOnly == false) then local player = msg.objectID -- 28 is the camera controls tutorial player:Help{ iHelpID = 28 } oneTimeOnly = true end end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('c_AvantGardens') -------------------------------------------------------------- -- constants -------------------------------------------------------------- CONSTANTS["DISCO_RECHECK_DELAY"] = 1.0 CONSTANTS["DISCO_RADIUS"] = 30 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) self:SetProximityRadius{ radius = CONSTANTS["DISCO_RADIUS"] } SetTimerToCheckProximity( self ) end -------------------------------------------------------------- -- Set a timer to check whether the player is dancing nearby -------------------------------------------------------------- function SetTimerToCheckProximity( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["DISCO_RECHECK_DELAY"], "checkProximity", self ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "checkProximity" ) then CheckProximity( self ) SetTimerToCheckProximity( self ) end end -------------------------------------------------------------- -- check whether the local player is nearby doing a dance emote -- if so, make the crowd do the same dance -- for each item in this NPC's proximity: -- first check if it's the local player -- and is playing the corresponding anim -------------------------------------------------------------- function CheckProximity( self ) -- get a list of all the objects within proximity local proxObjs = self:GetProximityObjects().objects -- go through the list and check each one for i = 1 , table.maxn( proxObjs ) do local nearbyObj = proxObjs[i] -- check to see if it's the local player and doing a dance emote local emoteNum = GetLocalPlayersDanceEmote( nearbyObj ) if ( emoteNum ~= -1 ) then MakeCrowdDance( self, emoteNum ) return end end MakeCrowdStop( self ) end -------------------------------------------------------------- -- returns the name of the dance emote ID that the local player is playing -- or -1 if the local player isn't playing a dance emote nearby -------------------------------------------------------------- function GetLocalPlayersDanceEmote( obj ) -- check if the object is even a player if ( IsLocalPlayer( obj ) == false ) then return -1 end for emoteIndex = 1 , table.maxn( CONSTANTS["DISCO_ANIMS"] ) do if ( IsPlayingEmoteAnim( obj, CONSTANTS["DISCO_ANIMS"][emoteIndex] ) ) then return CONSTANTS["DISCO_ANIMS"][emoteIndex] end end return -1 end -------------------------------------------------------------- -- returns whether or not given the obj is the local character -------------------------------------------------------------- function IsLocalPlayer( obj ) return ( obj:GetID() == GAMEOBJ:GetLocalCharID() ) end -------------------------------------------------------------- -- returns whether or not the given player is playing the given anim -------------------------------------------------------------- function IsPlayingEmoteAnim( player, anim ) local emoteMsg = player:GetCurrentAnimation{} return ( emoteMsg.primaryAnimationID == anim or emoteMsg.secondaryAnimationID == anim ) end -------------------------------------------------------------- -- any NPC's in the group should play the given anim -------------------------------------------------------------- function MakeCrowdDance( self, anim ) local crowdObjects = self:GetObjectsInGroup{ group = CONSTANTS["CONCERT_FAN_GROUP"] }.objects for i = 1, table.maxn ( crowdObjects ) do crowdObjects[i]:PlayAnimation{ animationID = anim } end end -------------------------------------------------------------- -- any NPC's in the group should play their idles -------------------------------------------------------------- function MakeCrowdStop( self ) local crowdObjects = self:GetObjectsInGroup{ group = CONSTANTS["CONCERT_FAN_GROUP"] }.objects for i = 1, table.maxn ( crowdObjects ) do crowdObjects[i]:PlayAnimation{ animationID = "idle" } end end --require('o_mis') --------------------------------------------------------------------------------------------------------- -- Client-side script for Concert instrument Quick Builds. When the instruments are built, they send a message -- to the zone script, which will then lock the mini-fig into an imagination-draining "playing the instrument" -- animation until the player exits or runs out of imagination. The instrument's music track will be turned on -- for the duration. --------------------------------------------------------------------------------------------------------- local CONSTANTS={} CONSTANTS["GUITAR_LOT"]=4039 CONSTANTS["BASS_LOT"]=4040 CONSTANTS["KEYBOARD_LOT"]=4041 CONSTANTS["DRUM_LOT"]=4042 function onStartup(self) --print ("starting up") end -- When the Quick Build is completed, send a message to the zone script function onRebuildNotifyState(self, msg) --print (msg.iState) if (msg.iState == 2) then --self:GetObjectsInGroup{ group = "Stage_Group" }.objects:NotifyObject{objIDSender=self, name="RebuildComplete", param1=self:GetLOT().objtemplate} StunAndPlay(self, msg.player, self:GetLOT().objtemplate) print ("sending Stun & Play message") end end -- Remove player control and play the appropriate animation function StunAndPlay(self, player, instrumentLOT) --local player2 = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Concert_Cam" } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "ToolTipTimer",self ) local AnimationTime = "" local AnimationName = "" local SoundName = "" if instrumentLOT == CONSTANTS["GUITAR_LOT"] then AnimationName = "chicken" AnimationTime = player:GetAnimationTime{animationID=AnimationName}.time SoundName = "cow" elseif instrumentLOT == CONSTANTS["BASS_LOT"] then AnimationName = "headspin" AnimationTime = player:GetAnimationTime{animationID=AnimationName}.time SoundName = "digital_sign" elseif instrumentLOT == CONSTANTS["KEYBOARD_LOT"] then AnimationName = "wave" AnimationTime = player:GetAnimationTime{animationID=AnimationName}.time SoundName = "water_cooler_gubgub" elseif instrumentLOT == CONSTANTS["DRUM_LOT"] then AnimationName = "biglove" AnimationTime = player:GetAnimationTime{animationID=AnimationName}.time SoundName = "grumpyidle_01m" end player:SetUserCtrlCompPause{bPaused = true} player:PlayAnimation{animationID = AnimationName, fPriority = 2.0} --print (AnimationName) player:PlaySound{strSoundName = SoundName} GAMEOBJ:GetTimer():AddTimerWithCancel( AnimationTime, "UnPausePlayer",self ) end function onTimerDone(self, msg) if msg.name == "UnPausePlayer" then -- Get the player again (local variables aren't shared by different functions) and return player control local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic{leadOut = 1.0} player:SetUserCtrlCompPause{bPaused = false} --Tool Tip must play later because Rebuild Code automatically closes any tool tips. elseif msg.name == "ToolTipTimer" then local player2 = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player2:DisplayTooltip { bShow = true, strText = Localize("AG_TOOLTIP_CON_ROCKSTAR"), iTime = 5000 } --print ("ToolTip Timer has FIRED " .. player2:GetID()) end end require('o_mis') require('c_AvantGardens') --------------------------------------------------------------------------------------------------------- -- Client-side script for Concert Props Choice Builds. Each prop can be built into 1 of 4 types. -- If all 4 are built into the same thing, the Stage transforms, and 30 seconds later they all return to their "default" state (the object's render component) -- Based on scripts\client\ai\YRK\L_TB_BENCH.lua -- 5023 AG - Stage Rocket OLD 4029 AG Fog Machine Choice Build -- 4891 AG - Stage Spot Light OLD 4030 AG Spotlight Choice Build -- 5024 AG - Stage laser OLD 4031 AG Laser Light Choice Build -- 4858 AG - Speaker OLD 4032 AG Speaker Choice Build -- Destructible component 348 --------------------------------------------------------------------------------------------------------- -- All the lot nums for the prop choicebuilds LOT_NUMS = {} LOT_NUMS[1] = { CONSTANTS["LOT_CHOICEBUILD_ROCKET"], CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"], CONSTANTS["LOT_CHOICEBUILD_LASER"], CONSTANTS["LOT_CHOICEBUILD_SPEAKER"] } -- old Lot Nums from Bench script = { 3626, 3627, 3628, 3700 } function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) --make sure we have enough imagination if msg.user:GetImagination{}.imagination > 0 then -- Send every LOT number that isn't us local ournum = 1; -- Store all the lots nums that arent us -- TODO This should be in a table so that it would be dynamic, but not sure how to store one with SetVar yet local slot = self:GetVar("ourslot") for i = 1, #LOT_NUMS[slot] do if(self:GetVar("ourlotnum") ~= LOT_NUMS[slot][i]) then if(ournum == 1) then self:SetVar("lot1", LOT_NUMS[slot][i]) elseif(ournum == 2) then self:SetVar("lot2", LOT_NUMS[slot][i]) elseif(ournum == 3) then self:SetVar("lot3", LOT_NUMS[slot][i]) end ournum = ournum + 1 --local nextLot = #OUR_LOTNUMS + 1 --OUR_LOTNUMS[nextLot] = LOT_NUMS[i] end end UI:DisplayTripleBuild( self, true, { self:GetVar("lot1"), self:GetVar("lot2"), self:GetVar("lot3") } ) print ( tostring(self:GetVar("lot1")).. tostring(self:GetVar("lot2")).. tostring(self:GetVar("lot3"))) --print("Displaying UI - -- ---- -------------------------------------") --UI:DisplayTripleBuild( self, true, { OUR_LOTNUMS[1], OUR_LOTNUMS[2], OUR_LOTNUMS[3] } ) else --display tooltip msg.user:DisplayTooltip { bShow = true, strText = Localize("AG_TOOLTIP_CON_IMAGINATION"), iTime = 5000 } end end function onStartup(self) -- Save our LOT number self:SetVar("ourlotnum", self:GetLOT{}.objtemplate) for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(self:GetVar("ourlotnum") == LOT_NUMS[i][a]) then self:SetVar("ourslot", i) return end end end endrequire('o_mis') local oneTimeOnly = false; -- Something touches the phantom object function onCollisionPhantom(self, msg) -- print("Collision Detected") -- define player local playerID = GAMEOBJ:GetLocalCharID() -- un-set this tutorial flag so that we can play it again in another level. --playerID:SetFlag{iFlagID = 27, bFlag = false } -- if the collision came from the player, and oneTimeOnly hasn't been set yet if (msg.objectID:GetID() == playerID and oneTimeOnly == false) then --print("inside if statement") -- define player again for some reason local player = msg.objectID -- Set the player flag 27 as false so that it thinks it hasn't been played before player:SetFlag{iFlagID = 27, bFlag = false } -- 27 is the double jumping controls tutorial player:Help{ iHelpID = 27 } oneTimeOnly = true end end require('o_mis') -- Something touches the phantom object function onCollisionPhantom(self, msg) -- define player local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then local player = msg.objectID -- 26 is the jumping controls tutorial player:PlayFXEffect{ effectID = 410, effectType = "create", priority = 1.07 } end end require('o_mis') local oneTimeOnly = false; -- Something touches the phantom object function onCollisionPhantom(self, msg) -- define player local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID and oneTimeOnly == false) then local player = msg.objectID -- 26 is the jumping controls tutorial player:Help{ iHelpID = 26 } oneTimeOnly = true end end -------------------------------------------------------------- -- Client-side death trigger that will spawn an object while -- the player is dying. Change the Custom Variables to fit -- your needs. -- mrb... 5/21/09 -- djames: updated 9/28/09 -------------------------------------------------------------- -- Custom Variables -------------------------------------------------------------- local deathAnimation = "big-shark-death" -- Animation to play on the player when it dies local deathObject = 6268 -- Object to spawn when the player dies local deathObject2 = 8570 -- Object to spawn when the player dies local deathObjectOffset = {x=0,y=0,z=0} -- Offset to apply when spawning the deathObject local deathObjectAnimation = "idle" -- name of the animation playing on the deathObject -------------------------------------------------------------- -- onCollisionPhantom handles the player colliding with the -- attached object (i.e. water plane) by making them die -------------------------------------------------------------- function onCollisionPhantom(self, msg) local target = msg.objectID local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- If a player collided with me, then do our stuff if player:GetID() == msg.objectID:GetID() then -- stun the player so they can't wander around on the surface of the water player:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true} self:FireEventServerSide{ senderID = player, args = 'achieve' } --send a message to the server side script to update the shark death achievement --player:RequestDie{killerID = self, deathType = deathAnimation} end end function onOffCollisionPhantom(self, msg) local target = msg.objectID local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- If a player collided with me, then do our stuff if player:GetID() == msg.objectID:GetID() then -- stun the player so they can't wander around on the surface of the water player:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true} end end function loadDeathObject(self, target, pos, rot) if not pos or not rot and target then pos = target:GetPosition().pos rot = target:GetRotation() end -- snap the player to the position where they really died target:SetPosition{ pos = pos } --print("******* Spawn Death Object *******") local config = { {"no_timed_spawn", true}, {"groupID", "DeathObject2"} } --RESMGR:LoadObject{ objectTemplate = deathObject, x = pos.x + deathObjectOffset.x, y = pos.y + deathObjectOffset.y, z = pos.z + deathObjectOffset.z, rw = rot.w, rx = rot.x, ry = rot.y, rz = rot.z, owner = self, configData = config} --if deathObject2 then RESMGR:LoadObject{ objectTemplate = deathObject2, x = pos.x + deathObjectOffset.x, y = pos.y + deathObjectOffset.y, z = pos.z + deathObjectOffset.z, rw = rot.w, rx = rot.x, ry = rot.y, rz = rot.z, owner = self, configData = config} --end target:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true} end -------------------------------------------------------------- -- onKilledPlayer handles the player dying after receiving the -- message from the server by spawning in the deathObject. -------------------------------------------------------------- function onKilledPlayer(self, msg) loadDeathObject(self,msg.playerID,msg.deathPos,msg.deathRot) end -------------------------------------------------------------- -- onChildLoaded starts a timer to remove the deathObject -- based on its deathObjectAnimation time. -------------------------------------------------------------- function onChildLoaded( self, msg ) --print("******* onChildLoaded (client)") if msg.childID:GetLOT().objtemplate == deathObject2 then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local animTime = msg.childID:GetAnimationTime{animationID = deathObjectAnimation} --player:RequestDie{killerID = self, deathType = deathAnimation} GAMEOBJ:GetTimer():AddTimerWithCancel(animTime.time, "RemoveDeathObject", self ) end end -------------------------------------------------------------- -- timers... -------------------------------------------------------------- function onTimerDone(self, msg) if msg.name == "RemoveDeathObject" then --print('******* RemoveDeathObject (client)') local deathObj = self:GetObjectsInGroup{ group = "DeathObject2" }.objects for k,v in ipairs(deathObj) do GAMEOBJ:DeleteObject(v) end self:SetVar('bActive', true) end end require('o_mis') --////////////////////////////////////////////////////////////////////////////////// local camName = "SpiderBoss_Cam_01" -- cinematic name local camTime = 9 -- time to release player, length of cinematic local enteringTrigger = false --////////////////////////////////////////////////////////////////////////////////// function onCollisionPhantom(self, msg) -- define player 313 local playerID = GAMEOBJ:GetLocalCharID() -- exclusion checks if msg.objectID:GetID() ~= playerID then return end if enteringTrigger then enteringTrigger = false return end local player = msg.objectID enteringTrigger = true player:FlashNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Spider-Cave-Cinematic"} if msg.objectID:GetFlag{iFlagID = 34}.bFlag or msg.objectID:GetMissionState{missionID = 313}.missionState < 2 then return end GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "SpiderShow",self ) player:SetFlag{iFlagID = 34, bFlag = true} player:PlayCinematic { pathName = camName} end function onTimerDone(self, msg) if msg.name == "SpiderShow" then --print "Play spider anim" local Spidery = self:GetObjectsInGroup{ group = "Cave"}.objects for i = 1, table.maxn (Spidery) do -- Seagull for cinematic if Spidery[i]:GetLOT().objtemplate == 6308 then Spidery[i]:PlayAnimation{animationID = "enter"} end end end endfunction onCollisionPhantom(self, msg) local target = msg.objectID local lead = self:GetVar('leadIn') if lead == nil then lead = 0.5 end if target then target:PlayCinematic{ pathName = self:GetVar('camera'), leadIn = lead} end end -- onBouncerTriggered not working !!!! -- --function onBouncerTriggered(self, msg) -- local target = msg.objId -- if target == GAMEOBJ:GetLocalCharID() then -- target.PlayCinematic{ pathName = bCam, leadIn = 0.5} -- end --end require('o_mis') function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- exclusion checks if player:GetImagination().imagination < 1 then return end player:PlayCinematic { pathName = "Mon_QB_Bridge_01" } end function onRebuildCancel(self, msg) --print('exit') local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic() end --------------------------------------------------------------------------------------------------------- -- Client-side script for drum beats --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- includes -------------------------------------------------------------- require('c_AvantGardens') -------------------------------------------------------------- -- Render Ready -------------------------------------------------------------- function onRenderComponentReady( self, msg ) self:EquipItem{ bImmediate = true } end -------------------------------------------------------------- -- object notification -------------------------------------------------------------- function onNotifyObject( self, msg ) if ( msg.name == "unequip" ) then self:UnEquipItem{ bImmediate = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkForDone", self ) end end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "checkForDone" ) then if ( self:IsItemEquipped{}.isequipped == true ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkForDone", self ) else ShowBricksBreaking( self ) UnEquip( self ) end end end -------------------------------------------------------------- -- if appropriate for this instrument, show the equippable break up into bricks -------------------------------------------------------------- function ShowBricksBreaking( self ) local LOT = self:GetLOT{}.objtemplate if ( CONSTANTS["INSTRUMENT_HIDE"][LOT] == false ) then return end -- show the bricks breaking off --local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) local player = self:GetItemOwner{}.ownerID local playerPos = player:GetPosition{}.pos self:Smash{ position = playerPos } GAMEOBJ:DeleteObject( self ) end -------------------------------------------------------------- -- make sure this equippable never shows up on the player again -------------------------------------------------------------- function UnEquip( self ) --Note: -- at first I tried GAMEOBJ:DeleteObject( self ) -- then after playing an instrument, it was possible to equip several inventory items at the same time in whichever hand the equippable was -- but if I didn't delete the object -- then the equippables might show up on the player later when playing a different instrument or fighting the zombies -- so I do not delete the equippable, but tell it to forget which player it goes onto, so it will not mysteriously re-equip later self:ClearItemsOwner{} end --------------------------------------------------------------------------------------------------------- -- Client-side script for Concert instrument Quick Builds. -- When an instrument is built, it locks the mini-fig into an imagination-draining animation. -- This lasts until the player runs out of imagination or moves voluntarily. -- Players will hear different music depending on which instruments are currently being played. --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- copied from enum ERebuildChallengeState in lwoGame \ include \ LWORebuild.h CONSTANTS["REBUILD_STATE_COMPLETED"] = 2 -- Challenge complete CONSTANTS["UPDATE_FREQUENCY"] = 0.1 -- while playing the instrument, how often we check whether the player hit a movement key to stop playing -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) self:SetVar( "bBeingPlayed", false ) self:SetVar( "activePlayer", nil ) ResetEquippableIDs( self ) self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) self:SetVar( "leftInventoryLOT", -1 ) self:SetVar( "rightInventoryLOT", -1 ) self:SetVar( "reequipPlayer", nil ) end -------------------------------------------------------------- -- called anytime the rebuild object's state changes -------------------------------------------------------------- function onRebuildNotifyState( self, msg) -- make sure we didn't attach this script to some object besides our quickbuild instruments local instrumentLOT = self:GetLOT().objtemplate if ( IsValidInstrument( instrumentLOT ) == false ) then return end -- When the Quick Build is completed, the player gets to play it if they have any imagination if ( msg.iState == CONSTANTS["REBUILD_STATE_COMPLETED"] ) then storeObjectByName( self, "activePlayer", msg.player ) QuickBuildWasBuilt( self ) end end function QuickBuildWasBuilt( self ) -- take control away from the player SetPlayerControl( self, false ) -- set timers for when to hide the completed quickbuild and show the player playing the instrument -- do this quicky so we don't have to watch the finished quickbuild model to slam into place -- but we have to wait slightly first or get overridden by the quickbuild code GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Hide", self ) if ( IsLocalPlayerActive( self ) == true ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Play", self ) end end -------------------------------------------------------------- -- checks whether the given LOT is one of the instrument quickbuilds -------------------------------------------------------------- function IsValidInstrument( LOT ) return ( LOT == CONSTANTS["INSTRUMENT_LOT_GUITAR"] or LOT == CONSTANTS["INSTRUMENT_LOT_BASS"] or LOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] or LOT == CONSTANTS["INSTRUMENT_LOT_DRUM"] ) end -------------------------------------------------------------- -- show the camera panning around the concert area -------------------------------------------------------------- function PlayCinematic( self, instrumentLOT ) local player = GetActivePlayer( self ) if ( player ~= nil ) then local szPathName = CONSTANTS["INSTRUMENT_CINEMATIC"][instrumentLOT] player:PlayCinematic { pathName = szPathName } end end -------------------------------------------------------------- -- play the animation of the mini-fig playing the given instrument -------------------------------------------------------------- function PlayInstrumentAnim( self, instrumentLOT ) if ( IsLocalPlayerActive( self ) == false ) then return end -- start the animation local player = GetActivePlayer( self ) if ( player ~= nil ) then self:FireEventServerSide{ senderID = player, args = "playInstrumentAnim", param1 = instrumentLOT } end end -------------------------------------------------------------- -- add or remove music according to which instrument someone just started or stopped playing -- pass true to bActivate to turn the music on, or false to turn it off. -------------------------------------------------------------- function AffectMusic( self, instrumentLOT, bActivate) if ( IsLocalPlayerActive( self ) == false ) then return end local szMusicName = CONSTANTS["INSTRUMENT_MUSIC"][instrumentLOT] local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) if ( player ~= nil ) then local instrumentLOT = self:GetLOT().objtemplate if ( bActivate ) then self:FireEventServerSide{ senderID = player, args = "startMusic", param1 = instrumentLOT } else self:FireEventServerSide{ senderID = player, args = "stopMusic", param1 = instrumentLOT } end end end -------------------------------------------------------------- -- start the process of seeing the player playing the instrument -------------------------------------------------------------- function PlayInstrument( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end local instrumentLOT = self:GetLOT().objtemplate -- remember that someone is using this instrument self:SetVar( "bBeingPlayed", true ) -- load any related equippables (guitar, bass, drumsticks), which will equip onto the player --self:FireEventServerSide{ args = "swapEquippables", senderID = player } RememberInventoryItems( self ) -- start keeping track of movement key presses long enough to know if the player wants to break out of playing the instument TrackRecentMovementKeys( self, true ) -- show the cinematic PlayCinematic( self, instrumentLOT ) -- play the animation of the mini-fig playing the given instrument ResetPlayersAnim( self ) -- try to stop the quickbuild victory anim PlayInstrumentAnim( self, instrumentLOT ) -- start the appropriate music AffectMusic( self, instrumentLOT, true ) -- start a timer for when to check whether the instrument is still being played StartUpdateTimer( self ) -- start a timer for decreasing the player's imagination StartImaginationCostTimer( self ) end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "Hide" ) then HideQuickbuild( self, self:GetLOT().objtemplate ) RepositionPlayer( self, self:GetLOT().objtemplate ) elseif ( msg.name == "Play" ) then PlayInstrument( self ) elseif ( msg.name == "CheckOnPlayer" ) then UpdateBeingPlayed( self ) elseif ( msg.name == "DecreaseImagination" ) then DecreasePlayersImagination( self ) elseif ( msg.name == "EndPlayer" ) then EndActivePlayer( self ) elseif ( msg.name == "Unequip" ) then SetPlayerControl( self, true ) UnequipEquippables( self ) elseif( msg.name == "checkAnim" ) then CheckInstrumentAnim( self ) elseif( msg.name == "checkInventory" ) then CheckInventoryItems( self ) elseif( msg.name == "checkInstrumentEquippables" ) then CheckInstrumentEquippables( self ) end end -------------------------------------------------------------- -- have the player stop playing the instrument -------------------------------------------------------------- function StopPlayingInstrument( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- stop checking to see if the player finished playing the instrument self:SetVar( "bBeingPlayed", false ) if ( IsLocalPlayerActive( self ) == true ) then -- stop keeping track of movement key presses TrackRecentMovementKeys( self, false ) -- make sure the cinematic is stopped player:EndCinematic{ leadOut = 1.0 } -- don't want to hear this instrument anymore AffectMusic( self, self:GetLOT().objtemplate, false ) -- cancel timers that may be running GAMEOBJ:GetTimer():CancelTimer("CheckOnPlayer", self) GAMEOBJ:GetTimer():CancelTimer("DecreaseImagination", self) GAMEOBJ:GetTimer():CancelTimer("checkAnim", self) GAMEOBJ:GetTimer():CancelTimer("checkInventory", self) GAMEOBJ:GetTimer():CancelTimer("checkInstrumentEquippables", self) end -- show the player smashing the instrument -- and plan when to unequip any equippables for this instrument PlaySmashAnim( self, player ) end -------------------------------------------------------------- -- start a timer for when to check whether the player is still playing the instrument -------------------------------------------------------------- function StartUpdateTimer( self ) if ( IsLocalPlayerActive( self ) == false ) then return end GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["UPDATE_FREQUENCY"], "CheckOnPlayer", self ) end -------------------------------------------------------------- -- start a timer for when to decrease the player's imagination -------------------------------------------------------------- function StartImaginationCostTimer( self ) if ( IsLocalPlayerActive( self ) == false ) then return end GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["INSTRUMENT_COST_FREQUENCY"], "DecreaseImagination", self ) end -------------------------------------------------------------- -- check whether the intrument is still being played -- this stops if the player runs out of imagination or takes control by moving -------------------------------------------------------------- function UpdateBeingPlayed( self ) if ( self:GetVar( "bBeingPlayed" ) == false ) then return end -- check whether the player as run out of imagination local bOutOfImagination = IsPlayerOutOfImagination( self ) -- if not, check whether the player hit a movement key local bMovement = false if ( bOutOfImagination == false ) then bMovement = DidPlayerHitMovementKey( self ) end -- if the player has run out of imagination or hit a movement key, then kick them off the instrument if ( bOutOfImagination or bMovement ) then self:FireEventServerSide{ args = "stopPlaying", senderID = player } -- otherwise, set a new timer to check again else StartUpdateTimer( self ) end end -------------------------------------------------------------- -- returns whether the player has run out of imagination -------------------------------------------------------------- function IsPlayerOutOfImagination( self ) return ( GetPlayersImagination( self ) <= 0 ) end -------------------------------------------------------------- -- returns how much imagination the player currently has -------------------------------------------------------------- function GetPlayersImagination( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return 0 else return player:GetImagination{}.imagination end end -------------------------------------------------------------- -- returns the ID of the active player -------------------------------------------------------------- function GetActivePlayer( self ) return getObjectByName(self, "activePlayer") end -------------------------------------------------------------- -- takes some imagination away from the player -------------------------------------------------------------- function DecreasePlayersImagination( self ) if ( IsLocalPlayerActive( self ) == false ) then return end -- get how much imagination the player has now local iOldAmount = GetPlayersImagination( self ) -- subtract the cost of using the instrument local iNewAmount = iOldAmount - CONSTANTS["INSTRUMENT_IMAGINATION_COST"] if ( iNewAmount < 0 ) then iNewAmount = 0 end -- update their imagination local player = GetActivePlayer( self ) if ( player ~= nil ) then player:SetImagination{ imagination = iNewAmount } end -- start a new timer for when to decrease their imagination next StartImaginationCostTimer( self ) end -------------------------------------------------------------- -- returns whether the player hit one of the movement keys -------------------------------------------------------------- function DidPlayerHitMovementKey( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return false end if ( IsLocalPlayerActive( self ) == false ) then return false end local keysMsg = player:GetRecentMovementKeys{} return ( keysMsg.bForwardPressed or keysMsg.bReversePressed or keysMsg.bLeftPressed or keysMsg.bRightPressed or keysMsg.bJumpPressed ) end -------------------------------------------------------------- -- takes away or gives back player control -- (pass in false to take it away, true to turn it back on) -- Make sure you match calls to this carefully because the "PUSH" and "POP" sent to SetStunned -- increment or decrement the control's corresponding variable. -- (Each "true" sent to SetStunned below is used to know which controls' variables to adjust.) -- You can see how this works at LwoGame \ source \ LWOControllablePhysComponent.cpp in method msgSetStunned -------------------------------------------------------------- function SetPlayerControl( self, bRestore ) local player = GetActivePlayer( self ) if ( player == nil ) then return end if ( IsLocalPlayerActive( self ) == false ) then return end -- note: we can't use SetUserCtrlCompPause because -- we still need to receive player movement values in order to know -- if they want to break out of the instrument before running out of imagination. -- So we use SetStunned instead. -- SetStunned also lets the player move the camera up and down, -- which is consistent with what is allowed while they buid the quickbuild. local eChangeType = "PUSH" if ( bRestore == true ) then eChangeType = "POP" end player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } end -------------------------------------------------------------- -- check whether the active player is also the local player -------------------------------------------------------------- function IsLocalPlayerActive( self ) local player = GetActivePlayer( self ) return ( player ~= nil and self:GetVar( "activePlayer" ) == GAMEOBJ:GetLocalCharID() ) end -------------------------------------------------------------- -- tell the player's LWOUserControlComponent to start or stop tracking recent presses. -- When off, it only knows which key presses occurred that frame. -- If we turn on this tracking, it will rememeber key presses long enough for us to send a query several frames later and -- still find out if they key was pressed recently. -- We need to use this since our timer allows us to send queries every so often - not every frame. -------------------------------------------------------------- function TrackRecentMovementKeys( self, bTrack ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- only let the active player turn his own tracking on or off if ( IsLocalPlayerActive( self ) == false ) then return end player:TrackRecentMovementKeys{ bTrackForward = bTrack, bTrackReverse = bTrack, bTrackLeft= bTrack, bTrackRight = bTrack, bTrackJump = bTrack } end -------------------------------------------------------------- -- unequip the instrument equippables from the player -------------------------------------------------------------- function UnequipEquippables( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- if this instrument added any equippables, unequip them and -- start a timer to keep checking when they're gone and the inventory items can be re-equipped local bInstrumentEquippables = false if ( self:GetVar( "equippableLeft" ) ~= nil ) then getObjectByName( self, "equippableLeft" ):NotifyObject{ name = "unequip" } bInstrumentEquippables = true end if ( self:GetVar( "equippableRight" ) ~= nil ) then getObjectByName( self, "equippableRight" ):NotifyObject{ name = "unequip" } bInstrumentEquippables = true end if ( bInstrumentEquippables ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInstrumentEquippables", self ) end end -------------------------------------------------------------- -- once the anim of the player smashing the instrument finishes, forget about our active player -------------------------------------------------------------- function EndActivePlayer( self ) -- reset player's anim so they'll do idles again ResetPlayersAnim( self ) -- re-equip any inventory items the player had in-hand before playing the instrument local player = GetActivePlayer( self ) if ( player ~= nil ) then storeObjectByName( self, "reequipPlayer", player ) end ReequipInventoryItems( self ) -- forget about the active player self:SetVar( "activePlayer", nil ) self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) -- break the quickbuild self:FireEventServerSide{ senderID = self, args = "reset" } end -------------------------------------------------------------- -- show the anim of the player smashing the instrument -------------------------------------------------------------- function PlaySmashAnim( self, player ) -- get the name of the anim local instrumentLOT = self:GetLOT().objtemplate local szAnimName = CONSTANTS["INSTRUMENT_SMASH_ANIM"][instrumentLOT] if ( szAnimName ~= -1 ) then if ( IsLocalPlayerActive( self ) == true ) then -- play the animation self:FireEventServerSide{ senderID = player, args = "playSmashAnim", param1 = instrumentLOT } end -- find out how long the anim is local animLength = player:GetAnimationTime{ animationID = szAnimName }.time -- set a timer for when to reset the quickbuild GAMEOBJ:GetTimer():AddTimerWithCancel( animLength, "EndPlayer", self ) end -- unequip equippable items and restore player control -- or set a timer to do it partway through the smash anim PlanWhenToUnequipAndRestorePlayerControl( self, instrumentLOT ) -- if there is no smashing anim, reset the quickbuild now if ( szAnimName == -1 ) then EndActivePlayer( self ) end end -------------------------------------------------------------- -- hide the completed quickbuild, if appropriate for this instrument -- the guitar and bass need to be hidden because the equippable item shows the whole instrument -- the drums do not because their equippables are just the drumsticks -- the keyboard does not because it has no equippables -------------------------------------------------------------- function HideQuickbuild( self, instrumentLOT ) if ( CONSTANTS["INSTRUMENT_HIDE"][instrumentLOT] == false ) then return end self:SetVisible{ visible = false, fadeTime = 0.0 } end -------------------------------------------------------------- -- move the player to the best looking position to play this particular instrument -------------------------------------------------------------- function RepositionPlayer( self, instrumentLOT ) -- get the quickbuild's position and rotation local qbPos = self:GetPosition().pos local qbRot = self:GetRotation() local playerPos = qbPos local playerRot = qbRot -- special case: the player pos needs to be adjusted a little for the drums to put the player behind the drumset -- and for the guitar and bass because they are located right on the edge of the state in Happy Flower if ( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_DRUM"] ) then local drumOffset = { x = 0.0, y = 0.0, z = -0.5 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = drumOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_BASS"] ) then local drumOffset = { x = 5.0, y = 0.0, z = 0.0 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = drumOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_GUITAR"] ) then local drumOffset = { x = 5.0, y = 0.0, z = 0.0 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = drumOffset }.newPosition end local player = GetActivePlayer( self ) if ( player ~= nil and IsLocalPlayerActive( self ) == true ) then player:SetPosition{ pos = playerPos } player:SetRotation{ w = playerRot.w, x = playerRot.x, y = playerRot.y, z = playerRot.z } --player:Teleport{ pos = playerPos, bSetRotation = true, w = playerRot.w, x = playerRot.x, y = playerRot.y, z = playerRot.z } end -- special case: the player's rotation needs to be adjusted a little for the keyboard if ( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] ) then local newRot = self:GetPosition{}.pos newRot.x = 0.0 newRot.y = 1.5708 newRot.z = 0.0 player:RotateObject{ rotation = newRot } end self:SetVar( "targetPositionX", playerPos.x ) self:SetVar( "targetPositionZ", playerPos.z ) end -------------------------------------------------------------- -- ask the resource manager to load the corresponding equippable item(s) onto the player -- guitar and bass: equip the whole instrument -- drums: equip a drumstick into each hand -- keyboard: no equippables -- once an equippable is ready, L_AG_CONCERT_INSTRUMENT_EQUIPPABLE_CLIENT.lua will equip it to the player -------------------------------------------------------------- function LoadEquippables( self, instrumentLOT ) if ( self:GetVar( "activePlayer" ) == nil ) then return end local leftLOT = CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][instrumentLOT] local rightLOT = CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][instrumentLOT] local config = { { "equip", true }, -- CONFIG_EQUIP in lwoCommon \ include \ LwoConfigData.h { "owner", "|" .. self:GetVar( "activePlayer" ) } } -- CONFIG_OWNER if ( leftLOT ~= -1 ) then RESMGR:LoadObject { objectTemplate = leftLOT, owner = self, rw = 1.0, bIsLocalPlayer = false, bDroppedLoot = false, configData = config } end if ( rightLOT ~= -1 ) then RESMGR:LoadObject { objectTemplate = rightLOT, owner = self, rw = 1.0, bIsLocalPlayer = false, bDroppedLoot = false, configData = config } end end -------------------------------------------------------------- -- checks whether the given LOT is the left hand equippable for this instrument -------------------------------------------------------------- function IsValidLeftEquippable( self, LOT ) if ( LOT == -1 ) then return false end local instrumentLOT = self:GetLOT().objtemplate return ( LOT == CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][instrumentLOT] ) end -------------------------------------------------------------- -- checks whether the given LOT is the right hand equippable for this instrument -------------------------------------------------------------- function IsValidRightEquippable( self, LOT ) if ( LOT == -1 ) then return false end local instrumentLOT = self:GetLOT().objtemplate return ( LOT == CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][instrumentLOT] ) end -------------------------------------------------------------- -- child loaded (the equippables) -------------------------------------------------------------- function onChildLoaded( self, msg ) local childLOT = msg.childID:GetLOT().objtemplate -- remember the object ID of this equippable so we can easily unequip later if ( IsValidLeftEquippable( self, childLOT ) ) then storeObjectByName( self, "equippableLeft", msg.childID ) elseif ( IsValidRightEquippable( self, childLOT ) ) then storeObjectByName( self, "equippableRight", msg.childID ) end end -------------------------------------------------------------- -- reset the object ID's of the equippable items -------------------------------------------------------------- function ResetEquippableIDs( self ) self:SetVar( "equippableLeft", nil ) self:SetVar( "equippableRight", nil ) end -------------------------------------------------------------- -- tell the player to play idles again -------------------------------------------------------------- function ResetPlayersAnim( self ) local player = GetActivePlayer( self ) if ( player ~= nil ) then player:ResetPrimaryAnimation{} player:ResetSecondaryAnimation{} end end -------------------------------------------------------------- -- unequip equippable items and restore player control -- or set a timer to do it partway through the smash anim -------------------------------------------------------------- function PlanWhenToUnequipAndRestorePlayerControl( self, instrumentLOT ) -- if this instrument has equippable items, set a timer for when to unequip them -- for the bass and guitar, the amount of time to wait depends on when during the smash anim it would look best -- unequip and restore control now for the drums, which has no smash anim -- the keyboard has no equippables, but restore player control now local unequipTime = CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][instrumentLOT] if ( unequipTime == 0 ) then SetPlayerControl( self, true ) UnequipEquippables( self ) elseif ( unequipTime == -1 ) then SetPlayerControl( self, true ) else GAMEOBJ:GetTimer():AddTimerWithCancel( unequipTime, "Unequip", self ) end end -------------------------------------------------------------- -- notification received from server-side script -------------------------------------------------------------- function onNotifyClientObject( self, msg ) if ( msg.name == "stopPlaying" ) then StopPlayingInstrument( self ) elseif ( msg.name == "loadEquippables" ) then LoadEquippables( self, self:GetLOT().objtemplate ) elseif ( msg.name == "playerLeft" ) then if ( self:GetVar( "activePlayer" ) == msg.paramObj:GetID() ) then self:SetVar( "bBeingPlayed", false ) self:SetVar( "activePlayer", nil ) self:FireEventServerSide{ senderID = self, args = "reset" } UnequipEquippables( self ) end elseif ( msg.name == "checkInstrumentAnim" ) then self:SetVar( "checkingInstrumentAnim", true ) CheckInstrumentAnim( self ) end end -------------------------------------------------------------- -- RepositionPlayer moves the player to wherever looks best for this instrument -- and starts the anim of playing the instrument, -- but other clients will see the player walk from the old spot to the new one -- which makes the walk anim overstrike the instrument anim. -- check and see if this client now sees the active player at the desired position. -- if so, show the instrument playing anim -------------------------------------------------------------- function CheckInstrumentAnim( self ) if ( self:GetVar( "checkingInstrumentAnim" ) == false ) then return end local player = GetActivePlayer( self ) if ( player == nil ) then return end local currentPos = player:GetPosition().pos local targetPosX = self:GetVar( "targetPositionX" ) local targetPosZ = self:GetVar( "targetPositionZ" ) if ( targetPosX == nil or targetPosZ == nil ) then return end local deltaX = currentPos.x - targetPosX local deltaZ = currentPos.z - targetPosZ if ( deltaX < 0.0 ) then deltaX = 0.0 - deltaX end if ( deltaZ < 0.0 ) then deltaZ = 0.0 - deltaZ end local tolerance = 0.5 if ( deltaX < tolerance and deltaZ < tolerance ) then self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) local instrumentLOT = self:GetLOT().objtemplate player:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_ANIM"][instrumentLOT], fPriority = 4.0 } else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkAnim", self ) end end -------------------------------------------------------------- -- before creating the instrument's equippables, check if the player already has inventory items equipped -- if so, unequip the inventory items and -- remember them so we can reequip them once done with the instrument -------------------------------------------------------------- function RememberInventoryItems( self ) local player = GetActivePlayer( self ) if ( player == nil ) then end -- find out the LOT's of the items in the mini-fig's hands local leftLOT = player:GetEquippedItemType{ slot = "special_l" }.lotID local rightLOT = player:GetEquippedItemType{ slot = "special_r" }.lotID -- check which hand(s) this instrument needs to add equippables to local instrumentLOT = self:GetLOT().objtemplate local bInventoryItemsEquipped = false -- go through each inventory slot to find the items already in-hand -- and unequip any that go onto a hand that this instrument doesn't use local numInventoryItems = player:GetInventorySize{ inventoryType = 1 }.size -- 1 is INVENTORY_DEFAULT in lwoCommon / include / InventoryTypes.h for i = 0, numInventoryItems do local checkItem = player:GetInventoryItemInSlot{ slot = i }.itemID if ( checkItem:Exists() ) then if ( checkItem:GetLOT().objtemplate == leftLOT ) then self:SetVar( "leftInventoryLOT", leftLOT ) player:UnEquipInventory{ itemtounequip = checkItem } bInventoryItemsEquipped = true elseif ( checkItem:GetLOT().objtemplate == rightLOT ) then self:SetVar( "rightInventoryLOT", rightLOT ) player:UnEquipInventory{ itemtounequip = checkItem } bInventoryItemsEquipped = true end end -- end Exists() end -- end for loop -- if we need to wait for inventory items to unequip, -- set up a timer for checking if it's okay to load the instrument equippables. -- if there weren't any inventory items equipped, load the instrument equippables now if ( bInventoryItemsEquipped ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInventory", self ) else self:FireEventServerSide{ args = "loadEquippables", senderID = player } end end -------------------------------------------------------------- -- check whether the inventory items are unequipped yet -- if so, equip the instrument equippables -------------------------------------------------------------- function CheckInventoryItems( self ) local player = GetActivePlayer( self ) if ( player == nil ) then end local leftLOT = player:GetEquippedItemType{ slot = "special_l" }.lotID local rightLOT = player:GetEquippedItemType{ slot = "special_r" }.lotID if ( leftLOT ~= -1 or rightLOT ~= -1 ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInventory", self ) else local instrumentLOT = self:GetLOT().objtemplate self:FireEventServerSide{ args = "loadEquippables", senderID = player } end end -------------------------------------------------------------- -- the player had inventory items in-hand before playing the instrument. -- re-equip them. -------------------------------------------------------------- function ReequipInventoryItems( self ) local player = getObjectByName( self, "reequipPlayer" ) -- only allow the local player to re-equip its own inventory items if ( player == nil or self:GetVar( "reequipPlayer" ) ~= GAMEOBJ:GetLocalCharID() ) then return end -- remember the LOT's of the inventory items that we unequipped earlier local leftLOT = self:GetVar( "leftInventoryLOT" ) local rightLOT = self:GetVar( "rightInventoryLOT" ) -- re-equip the left-hand item, if there was one if ( leftLOT ~= -1 ) then self:FireEventServerSide{ senderID = player, args = "reequipItem", param1 = leftLOT } end -- re-equip the right-hand item, if there was one if ( rightLOT ~= -1 ) then self:FireEventServerSide{ senderID = player, args = "reequipItem", param1 = rightLOT } end self:SetVar( "leftInventoryLOT", -1 ) self:SetVar( "rightInventoryLOT", -1 ) self:SetVar( "reequipPlayer", nil ) end -------------------------------------------------------------- -- check whether the insturment's equppibable items are unequipped yet -- if so, re-equip the previously-equipped inventory items, if any -------------------------------------------------------------- function CheckInstrumentEquippables( self ) local player = getObjectByName( self, "reequipPlayer" ) if ( player == nil ) then return end -- check whether either instrument equippable is still equipped local bStillEquipped = false if ( self:GetVar( "equippableLeft" ) ~= nil ) then local leftItem = getObjectByName( self, "equippableLeft" ) if ( leftItem:IsItemEquipped{}.isequipped == true ) then bStillEquipped = true end end if ( self:GetVar( "equippableRight" ) ~= nil ) then local rightItem = getObjectByName( self, "equippableRight" ) if ( rightItem:IsItemEquipped{}.isequipped == true ) then bStillEquipped = true end end if ( bStillEquipped ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInstrumentEquippables", self ) else ResetEquippableIDs( self ) end endrequire('o_mis') local newZone = 1100 function onRebuildNotifyState(self, msg) if msg.iState == 2 then --if self:ActivityUserExists{userID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID())}.bExists then storeObjectByName(self, "Rocketbuilder", msg.player) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.01, "PlayerRebuild",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.9, "PlayerSoarHack",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "PlayerAnimate",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.1, "RocketLaunch",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.06, "RocketFiring",self ) -- trying to prevent aother animations breaking the rocket if GAMEOBJ:GetLocalCharID() == msg.player then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} end end end function onTimerDone (self,msg) local player = getObjectByName(self, "Rocketbuilder") local rocketPosition = self:GetPosition{}.pos local rocketRotation = self:GetRotation{} if (msg.name == "PlayerRebuild") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:PlayAnimation{animationID = "rebuild-rocket"} player:SetUserCtrlCompPause{bPaused = true} end end if (msg.name == "PlayerSoarHack") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:PlayAnimation{animationID = "rocket-soar"} end end if (msg.name == "PlayerAnimate") then self:PlayAnimation{animationID = "launch"} if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:SetPosition {pos = rocketPosition} player:SetRotation {x = rocketRotation.x, y = rocketRotation.y, z = rocketRotation.z, w = rocketRotation.w} player:PlayCinematic { pathName = self:GetVar("cameraPath") } end player:PlayAnimation{animationID = "rocket-launch"} -- if we don't do this, people don't see other clients animate end if (msg.name == "RocketLaunch") then getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "launch"} getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "launch"} end if (msg.name == "RocketFiring") then getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "firing"} getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "firing"} -- Set zone player timer local zTime = getObjectByName(self, "sectionTop"):GetAnimationTime{animationID = "firing"}.time GAMEOBJ:GetTimer():AddTimerWithCancel( zTime, "ZoneTimer",self ) end if (msg.name == "ZoneTimer") then -- set flag to false so we know the player has left the zone player:SetFlag{iFlagID = 32, bFlag = false} self:FireEventServerSide{senderID = player, args = "ZonePlayer", param1 = newZone} end end function onCustomRebuildSelected(self, msg) self:PlayFXEffect{effectType = "rebuild-complete"} if self:ActivityUserExists{userID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID())}.bExists then GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected1", param1 = msg.choice1LOT} GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected2", param1 = msg.choice2LOT} GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected3", param1 = msg.choice3LOT} end end function onChildLoaded(self, msg) --TODO: Make this better --print "child loaded" if msg.templateID == 4713 or msg.templateID == 4716 or msg.templateID == 4719 then storeObjectByName(self, "sectionTop", msg.childID) elseif msg.templateID == 4714 or msg.templateID == 4717 or msg.templateID == 4720 then storeObjectByName(self, "sectionMid", msg.childID) elseif msg.templateID == 4715 or msg.templateID == 4718 or msg.templateID == 4721 then storeObjectByName(self, "sectionBot", msg.childID) end end --function rotateVector(quaternion, vector) -- local matrix = {} -- matrix[1][1] = 1 - 2*math.pow(quaternion.y, 2) - 2*math.pow(quaternion.z, 2) -- matrix[1][2] = 2*quaternion.x*quaternion.y - 2*quaternion.z*quaternion.w --end --1 - 2*qy2 - 2*qz2 2*qx*qy - 2*qz*qw 2*qx*qz + 2*qy*qw --2*qx*qy + 2*qz*qw 1 - 2*qx2 - 2*qz2 2*qy*qz - 2*qx*qw --2*qx*qz - 2*qy*qw 2*qy*qz + 2*qx*qw 1 - 2*qx2 - 2*qy2require('o_mis') local newZone = 30 function onRebuildNotifyState(self, msg) if msg.iState == 2 then --if self:ActivityUserExists{userID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID())}.bExists then storeObjectByName(self, "Rocketbuilder", msg.player) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.01, "PlayerRebuild",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.9, "PlayerSoarHack",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "PlayerAnimate",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.1, "RocketLaunch",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.06, "RocketFiring",self ) -- trying to prevent aother animations breaking the rocket if GAMEOBJ:GetLocalCharID() == msg.player then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} end end end function onTimerDone (self,msg) local player = getObjectByName(self, "Rocketbuilder") local rocketPosition = self:GetPosition{}.pos local rocketRotation = self:GetRotation{} if (msg.name == "PlayerRebuild") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:PlayAnimation{animationID = "rebuild-rocket"} player:SetUserCtrlCompPause{bPaused = true} end end if (msg.name == "PlayerSoarHack") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:PlayAnimation{animationID = "rocket-soar"} end end if (msg.name == "PlayerAnimate") then self:PlayAnimation{animationID = "launch-AG"} if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:SetPosition {pos = rocketPosition} player:SetRotation {x = rocketRotation.x, y = rocketRotation.y, z = rocketRotation.z, w = rocketRotation.w} player:PlayCinematic { pathName = self:GetVar("cameraPath") } end player:PlayAnimation{animationID = "rocket-launch-AG"} -- if we don't do this, people don't see other clients animate end if (msg.name == "RocketLaunch") then getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "launch"} getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "launch"} end if (msg.name == "RocketFiring") then getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "firing"} getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "firing"} -- Set zone player timer local zTime = getObjectByName(self, "sectionTop"):GetAnimationTime{animationID = "firing"}.time GAMEOBJ:GetTimer():AddTimerWithCancel( zTime, "ZoneTimer",self ) end if (msg.name == "ZoneTimer") then --self:FireEventServerSide{senderID = player, args = "ZonePlayer", param1 = newZone} --player:DisplayZoneSummary{sender = self, show = true} local objs = self:GetObjectsInGroup{ group = "ZoneTransferObj", ignoreSpawners = true }.objects for i = 1, table.maxn ( objs ) do player:DisplayZoneSummary{sender = objs[i], show = true} player:PlayCinematic { pathName = "AG_Summary" } -- set flag to false so we know the player has left the zone player:SetFlag{iFlagID = 32, bFlag = false} end end end function onCustomRebuildSelected(self, msg) self:PlayFXEffect{effectType = "rebuild-complete"} if self:ActivityUserExists{userID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID())}.bExists then GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected1", param1 = msg.choice1LOT} GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected2", param1 = msg.choice2LOT} GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected3", param1 = msg.choice3LOT} end end function onChildLoaded(self, msg) --TODO: Make this better --print "child loaded" if msg.templateID == 4713 or msg.templateID == 4716 or msg.templateID == 4719 then storeObjectByName(self, "sectionTop", msg.childID) elseif msg.templateID == 4714 or msg.templateID == 4717 or msg.templateID == 4720 then storeObjectByName(self, "sectionMid", msg.childID) elseif msg.templateID == 4715 or msg.templateID == 4718 or msg.templateID == 4721 then storeObjectByName(self, "sectionBot", msg.childID) end end --function rotateVector(quaternion, vector) -- local matrix = {} -- matrix[1][1] = 1 - 2*math.pow(quaternion.y, 2) - 2*math.pow(quaternion.z, 2) -- matrix[1][2] = 2*quaternion.x*quaternion.y - 2*quaternion.z*quaternion.w --end --1 - 2*qy2 - 2*qz2 2*qx*qy - 2*qz*qw 2*qx*qz + 2*qy*qw --2*qx*qy + 2*qz*qw 1 - 2*qx2 - 2*qz2 2*qy*qz - 2*qx*qw --2*qx*qz - 2*qy*qw 2*qy*qz + 2*qx*qw 1 - 2*qx2 - 2*qy2 -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('c_AvantGardens') -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) self:SetVar("InvisTime", 10) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("InvisTime") , "InvisTime", self ) self:SetVisible{visible = false} self:ActivatePhysics{bActive = false} end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "InvisTime" ) then self:SetVisible{visible = true, fadeTime = 1} self:ActivatePhysics{bActive = true} end end function onStartup(self, msg) self:AddObjectToGroup{ group = "Cave" } endrequire('o_mis') function onStartup(self) self:SetRegistrationForUIUpdate{ eEventType = "POSITION_CHANGE", iMinimapObjType = 9, bRegister = true } end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('o_MissionHelp') -- copied from L_NPC_TOWN_SQUARE in the yrk client scripts require('client/ai/YRK/L_YRK_NPC_INTERACTIONS') require('c_Zorillo') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 20) SetProximityDistance(self, 35) self:SetVar("bRenderReady", false) InitializeAmbientHints( self ) ActivateInteractions( self ) end -------------------------------------------------------------- -- remember this NPC's possible chat bubble messages -- used if the NPC is clicked on during peace time -------------------------------------------------------------- function InitializeAmbientHints( self ) AddInteraction(self, "interactionText", Localize("NPC_AG_SHORTCUT_HINT")) AddInteraction(self, "interactionText", Localize("NPC_AG_JUMPING_HINT")) AddInteraction(self, "interactionText", Localize("NPC_AG_COLLECTIBLE_HINT")) end -- This script is attached to the [client] finish line quickbuild in AG. -- It handles the cinematic when the player builds the finish line and -- then shows the start/finish line objects. require('ai/AG/L_AG_SCENE_2_INCLUDE') local finishLineFlag = 33 local finishLineMission = 319 function HasPlayerFinishedBuild(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:GetFlag{iFlagID = finishLineFlag}.bFlag then return true end return false end function onStartup(self) -- bail if the player has already done the build if HasPlayerFinishedBuild(self) then return end -- hide everything in the "StartLine" group local obj = self:GetObjectsInGroup{ group = "StartLine", ignoreSpawners = true }.objects for k,v in ipairs(obj) do v:SetVisible{visible = false} end end function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- check requirements before starting cinematic local hasFlag = player:GetFlag{iFlagID = finishLineFlag}.bFlag local hasMission = player:GetHasMission{iMissionID = finishLineMission}.bHasMission local imagination = player:GetImagination().imagination if hasFlag then --print("RebuildActivated - hasFlag") return end if not hasMission then --print("RebuildActivated - !hasMission") return end if imagination < 1 then --print("RebuildActivated - no imagination") return end -- get the length of the cinematic and start playing it (if it exists) local cineTime = tonumber(LEVEL:GetCinematicInfo('Mon_QB_FinishLine_01')) if not cineTime then cineTime = 10.0 end player:PlayCinematic { pathName = "Mon_QB_FinishLine_01" } -- start a timer to show the "StartLine" group GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime - 4.5, "StartLineVisible", self ) -- 8.5 GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime - 3, "MissionTimer", self) end function onRebuildNotifyState(self, msg) -- qb was reset cancel all timers if ( msg.iState == 4 ) then --print('qb reset') GAMEOBJ:GetTimer():CancelAllTimers(self) end end function onTimerDone (self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (msg.name == "StartLineVisible") and HasPlayerFinishedBuild(self) then -- show everything in the "StartLine" group local obj = self:GetObjectsInGroup{ group = "StartLine", ignoreSpawners = true }.objects for k,v in ipairs(obj) do v:SetVisible{visible = true, fadeTime = 0.1} v:PlayAnimation{animationID = "bounce"} end end if (msg.name == "MissionTimer") and HasPlayerFinishedBuild(self) then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local missionGiverNPC = self:GetObjectsInGroup{ group = "FinishLine_NPC", ignoreSpawners = true }.objects[1] missionGiverNPC:FireEvent{args = "BuildFinished", senderID = self} end end -- This script is attached to the start/finish line objects in AG. -- It handles showing or hiding the objects after determining if -- the player has previously built the finish line. local finishLineFlag = 33 function onStartup(self) local playerID = GAMEOBJ:GetLocalCharID() local player = GAMEOBJ:GetObjectByID(playerID) -- make sure the player is ready if player:Exists() then -- check if the player flag has been set if player:GetFlag{iFlagID = finishLineFlag}.bFlag then --print("Showing finish line") self:SetVisible{visible = true} else --print("Hiding finish line") self:SetVisible{visible = false} end else -- the player is not ready (i.e. not added to the world yet), -- start a timer to check again in a sec --print("Player not ready, retrying in 1 sec") GAMEOBJ:GetTimer():AddTimerWithCancel(1.0, "RetryStartup", self) -- also, initially hide the finish line --print("Hiding finish line") self:SetVisible{visible = false} end end function onTimerDone(self, msg) if (msg.name == "RetryStartup") then -- try again... onStartup(self) end end -------------------------------------------------------------- -- Script on the bouncer for the pet dig to pet bouncer treasure node -- this script makes sure the spawner network is cleared and reset after -- each pet dig -- the instructions for setting up a pet dig to pet boucner can be found -- scripts/ai/AG/L_AG_PET_TREASURE_BOUNCER.lua -- updated Brandi... 1/27/10 -------------------------------------------------------------- function onStartup(self,msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 15, "BouncerTimer", self ) end function onTimerDone(self, msg) if ( msg.name == "BouncerTimer" ) then local bouncerNumber = self:GetVar("BouncerNumber") if bouncerNumber then local petbouncer = LEVEL:GetSpawnerByName("PetBouncer"..bouncerNumber) local petbouncerswitch = LEVEL:GetSpawnerByName("PetBouncerSwitch"..bouncerNumber) petbouncer:SpawnerDestroyObjects() petbouncerswitch:SpawnerDestroyObjects() end end endfunction onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local obj = self:GetObjectsInGroup{ group = "Jet_FX", ignoreSpawners = true }.objects[1] if self:GetLOT().objtemplate == 6859 and not self:GetVar('isInUse') then --print('pass client') obj:PlayAnimation{ animationID = "jetFX" } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5, "PlayCine", self ) end end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide) if not bHide then bHide = false end self:SetIconAboveHead{iconMode = 1, iconType = 69, bIconOff = bHide} end function onNotifyClientObject(self, msg) if msg.name == "toggleInUse" then if msg.param1 == -1 then --print('rdy') self:SetVar('isInUse', false) toggleActivatorIcon(self) else --print('inUse') toggleActivatorIcon(self, true) self:SetVar('isInUse', true) end end end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onTimerDone (self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (msg.name == "PlayCine") then player:PlayCinematic{ pathName = "Jet_Cam_01", leadIn = 2 } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- the text used for commenting after a transformation, based on which dueling NPC produced it. -- you can find the text for these in 4_game \ client \ locale \ translation.xml TALK = {} TALK[CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"]] = {} TALK[CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SENTINEL_SMACK_1" ) TALK[CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SENTINEL_SMACK_2" ) TALK[CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SENTINEL_SMACK_3" ) TALK[CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SENTINEL_SMACK_4" ) TALK[CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"]] = {} TALK[CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_PARADOX_SMACK_1" ) TALK[CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_PARADOX_SMACK_2" ) TALK[CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_PARADOX_SMACK_3" ) TALK[CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_PARADOX_SMACK_4" ) -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) registerWithZoneControlObject( self ) -- the NPC will display chat bubbles when clicked on SetInteractDistance( self, CONSTANTS["KIPPER_NPC_INTERACT_DISTANCE"] ) self:SetPickType{ ePickType = 14} -- PICK_LIST_INTERACTIVE -- from enum PICK_LIST_TYPE in lwoCommonVars.h InitializeChat( self ) end -------------------------------------------------------------- -- Render Ready -------------------------------------------------------------- function onRenderComponentReady( self, msg ) self:PlayAnimation{ animationID = "idle" } GAMEOBJ:GetZoneControlID():FireEvent{ senderID = self, args = "ActorReadyKipperDuel" } end -------------------------------------------------------------- -- remember the chat bubble messages used if the NPC is clicked on -------------------------------------------------------------- function InitializeChat( self ) -- you can find the text for these in client \ locale \ translation.xml if ( self:GetLOT{}.objtemplate == CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"] ) then AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_SENTINEL_CLICK" ) ) else AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_PARADOX_CLICK" ) ) end end -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetInteractDistance( self, dist ) if ( self and self:Exists() ) then self:SetVar("interactDistance", dist) end end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction( self, type, action ) if ( self and self:Exists() ) then local table = self:GetVar( type ) -- init table if need to if ( table == nil ) then table = {} end local num = #table + 1 table[num] = action self:SetVar( type, table ) end end -------------------------------------------------------------- -- handle client use -------------------------------------------------------------- function onClientUse(self, msg) -- display random chat local texts = self:GetVar( "interactionText" ) if ( texts and #texts > 0 ) then -- get a random text local num = math.random( 1, #texts ) self:DisplayChatBubble{ wsText = texts[num] } end end -------------------------------------------------------------- -- Notification to object -------------------------------------------------------------- function onNotifyObject( self, msg ) if ( msg.name == "TalkSmack" ) then TalkSmack( self, msg.param1 ) end end -------------------------------------------------------------- -- display bragging text because this NPC just finished a transformation -------------------------------------------------------------- function TalkSmack( self ) local duelLOT = self:GetLOT{}.objtemplate -- there is more than one possible comment for each dueling NPC local numChoices = #TALK[duelLOT] -- randomly decide which of the comments for this NPC to use local commentNum = math.random( 1, numChoices ) -- show the text self:DisplayChatBubble{ wsText = TALK[duelLOT][commentNum] } end -------------------------------------------------------------- -- Render Ready -------------------------------------------------------------- function onRenderComponentReady( self, msg ) -- make this invisible self:SetVisible{ visible = false, fadeTime = 0.0 } end require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) SetInteractDistance( self, CONSTANTS["KIPPER_NPC_INTERACT_DISTANCE"] ) -- let the mini-map know that this NPC is a mission giver self:AddObjectToGroup{ group = "Minimap_MissionGivers" } -- remember what the NPC should say after the mission is finished InitializeChat( self ) end -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetInteractDistance( self, dist ) if ( self and self:Exists() ) then self:SetVar( "interactDistance", dist ) end end -------------------------------------------------------------- -- mouseover -------------------------------------------------------------- function onCursorOn(self, msg) -- which cursor to use depends on whether the player has already finished the mission if ( IsMissionComplete( self ) == true ) then self:SetPickType{ePickType = 14} -- PICK_LIST_INTERACTIVE DisplayChat( self ) else self:SetPickType{ePickType = 4} -- PICK_LIST_MISSION_NPC end end -------------------------------------------------------------- -- returns whether or not the player his completed the mission -------------------------------------------------------------- function IsMissionComplete( self ) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( player == nil or player == 0 ) then return false end local missionState = player:GetMissionState{ missionID = CONSTANTS["KIPPER_MISSION_ID"] }.missionState -- if the mission is either available or active, then use the mission cursor if ( IsActiveMissionState( missionState ) ) then return false end return true end -------------------------------------------------------------- -- returns whether or not the mission is still in progress ( or not started yet ) -------------------------------------------------------------- function IsActiveMissionState ( state ) -- returns whether the given mission state should have a mission cursor if ( state == 1 or state == 9 or -- LWO_MISSION_STATE_STATE_AVAILABLE state == 2 or state == 10 or -- LWO_MISSION_STATE_STATE_ACTIVE state == 4 ) then -- LWO_MISSION_STATE_READY_TO_COMPLETE return true end return false end -------------------------------------------------------------- -- remember the chat bubble messages used if the NPC is clicked on after the mission is finished -------------------------------------------------------------- function InitializeChat( self ) -- you can find the text for these in client \ locale \ translation.xml AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_MISSION_GIVER_VIGILANT" ) ) AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_MISSION_GIVER_REPORTER" ) ) AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_MISSION_GIVER_NICE_WORK" ) ) AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_MISSION_GIVER_KNEW_YOU_COULD" ) ) end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction( self, type, action ) if ( self and self:Exists() ) then local table = self:GetVar( type ) -- init table if need to if ( table == nil ) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- pop up a chat bubble recognizing that the player finished the mission -------------------------------------------------------------- function DisplayChat( self ) -- display random chat local texts = self:GetVar( "interactionText" ) if ( texts and #texts > 0 ) then -- get a random text local num = math.random( 1, #texts ) self:DisplayChatBubble{ wsText = texts[num] } end end -------------------------------------------------------------- -- handle client use (click) -------------------------------------------------------------- function onClientUse( self, msg ) if ( IsMissionComplete( self ) == false ) then return end self:PlayAnimation{ animationID = "salute" } end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) registerWithZoneControlObject( self ) end -------------------------------------------------------------- -- Render Ready -------------------------------------------------------------- function onRenderComponentReady( self, msg ) -- tell the zone script that the model is ready -- it will pass that info on to L_ZONE_AG_KIPPER_DUEL_CLIENT.lua GAMEOBJ:GetZoneControlID():FireEvent{ senderID = self, args = "ModelReadyKipperDuel" } end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- the LOT's of the models produced by the duel transformations CONSTANTS["VALID_MODEL_LOTS"] = { CONSTANTS["KIPPER_DUEL_MOUSE_LOT"], CONSTANTS["KIPPER_DUEL_CAT_LOT"], CONSTANTS["KIPPER_DUEL_DOG_LOT"], CONSTANTS["KIPPER_DUEL_DRAGON_LOT"], CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"], CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"], CONSTANTS["KIPPER_DUEL_KIPPER_LOT"], CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"] } -- the text used for commenting on each transformation, based on the model produced. -- there is more than one possible comment for each. -- you can find the text for these in 4_game \ client \ locale \ translation.xml COMMENTARY = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_MOUSE_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_MOUSE_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_MOUSE_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_MOUSE_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_MOUSE_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_MOUSE_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_MOUSE_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_MOUSE_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_MOUSE_4" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_CAT_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_CAT_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CAT_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_CAT_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CAT_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_CAT_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CAT_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_CAT_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CAT_4" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DOG_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_DOG_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DOG_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DOG_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DOG_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DOG_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DOG_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DOG_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DOG_4" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DRAGON_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_DRAGON_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DRAGON_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DRAGON_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DRAGON_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DRAGON_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DRAGON_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_DRAGON_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_DRAGON_4" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_FIRE_ENGINE_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_FIRE_ENGINE_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_FIRE_ENGINE_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_FIRE_ENGINE_4" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_SUBMARINE_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_SUBMARINE_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_SUBMARINE_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_SUBMARINE_4" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_KIPPER_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_KIPPER_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_KIPPER_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_KIPPER_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_KIPPER_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_KIPPER_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_KIPPER_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_KIPPER_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_KIPPER_4" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"]] = {} COMMENTARY[CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"]][1] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_ELEPHANT_1" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"]][2] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_ELEPHANT_2" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"]][3] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_ELEPHANT_3" ) COMMENTARY[CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"]][4] = Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_ELEPHANT_4" ) -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) registerWithZoneControlObject( self ) -- the NPC will display chat bubbles when clicked on SetInteractDistance( self, CONSTANTS["KIPPER_NPC_INTERACT_DISTANCE"] ) self:SetPickType{ ePickType = 14 } -- PICK_LIST_INTERACTIVE -- from enum PICK_LIST_TYPE in lwoCommonVars.h InitializeChat( self ) end -------------------------------------------------------------- -- Render Ready -------------------------------------------------------------- function onRenderComponentReady( self, msg ) self:PlayAnimation{ animationID = "idle" } -- tell the zone script that the spectator NPC is ready -- it will pass that info on to L_ZONE_AG_KIPPER_DUEL_CLIENT.lua GAMEOBJ:GetZoneControlID():FireEvent{ senderID = self, args = "ActorReadyKipperDuel" } end -------------------------------------------------------------- -- remember the chat bubble messages used if the NPC is clicked on -------------------------------------------------------------- function InitializeChat( self ) -- you can find the text for these in 4_game \ client \ locale \ translation.xml AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CHAT1" ) ) AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CHAT2" ) ) AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CHAT3" ) ) AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CHAT4" ) ) AddInteraction( self, "interactionText", Localize( "NPC_NIM_AG_KIPPER_SPECTATOR_CHAT5" ) ) end -------------------------------------------------------------- -- sets the mouseover distance for interactions -------------------------------------------------------------- function SetInteractDistance( self, dist ) if ( self and self:Exists() ) then self:SetVar( "interactDistance", dist ) end end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction( self, type, action ) if ( self and self:Exists() ) then local table = self:GetVar( type ) -- init table if need to if ( table == nil ) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- handle client use -------------------------------------------------------------- function onClientUse( self, msg ) -- the player clicked on the spectator -- display random chat local texts = self:GetVar( "interactionText" ) if ( texts and #texts > 0 ) then -- get a random text local num = math.random( 1, #texts ) self:DisplayChatBubble{ wsText = texts[num] } end end -------------------------------------------------------------- -- Notification to object -------------------------------------------------------------- function onNotifyObject( self, msg ) if ( msg.name == "CommentOnTransformation" ) then CommentOnTransformation( self, msg.param1 ) end end -------------------------------------------------------------- -- display commentary about the current transformation -------------------------------------------------------------- function CommentOnTransformation( self, modelLOT ) if ( IsValidModelLOT( modelLOT ) == false ) then return end -- there is more than one possible comment for each transformation -- check how many there are for this transformation local numChoices = #COMMENTARY[modelLOT] -- randomly decide which of the comments for this model to use local commentNum = math.random( 1, numChoices ) -- show the text self:DisplayChatBubble{ wsText = COMMENTARY[modelLOT][commentNum] } end -------------------------------------------------------------- -- check whether the LOT is one of the transformable models -------------------------------------------------------------- function IsValidModelLOT( modelLOT ) for index = 1, #CONSTANTS["VALID_MODEL_LOTS"] do if ( modelLOT == CONSTANTS["VALID_MODEL_LOTS"][index] ) then return true end end return false end require('ai/AG/L_AG_SCENE_2_INCLUDE') --////////////////////////////////////////////////////////////////////////////////// local misID = 319 -- missionID from DB --////////////////////////////////////////////////////////////////////////////////// function onMissionDialogueOK(self, msg) if msg.missionID == misID then if msg.bIsComplete == true then GAMEOBJ:GetTimer():AddTimerWithCancel( 5, 'SendToRusty', self ) else --print('show finishline') local qbObj = self:GetObjectsInGroup{ group = 'FinishLineQB', ignoreSpawners = true }.objects[1] local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not qbObj then print('Cant find finishline objcet') return end local qbActivator = qbObj:GetBuildActivator().activatorID:GetID() qbObj:RebuildCancel() qbObj:DisplayRebuildActivator{bShow = false} player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end elseif msg.bIsComplete and msg.missionID == 318 then local courseNPC = GetCourseManager(self) courseNPC:RequestPickTypeUpdate() end end function onMissionDialogueCancelled(self, msg) if msg.missionID == misID then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic() end end function onFireEvent(self, msg) if msg.args == "BuildFinished" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic() player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} player:ForcePlayerToInteract{objToInteractWith = self} end end function onTimerDone (self,msg) if msg.name == 'SendToRusty' then local courseNPC = GetCourseManager(self) courseNPC:RequestPickTypeUpdate() --print('sent to rusty') end end require('o_mis') --////////////////////////////////////////////////////////////////////////////////// local npcName = 'Rusty' local missionCamDist = 10 -- distance to teleport player away from npc local misID = 318 -- missionID from DB local camTime = 16 -- time to release player --////////////////////////////////////////////////////////////////////////////////// ---------------------------------------------------------------- -- Happens on client interaction (must register for picking) ---------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local oPos = self:GetPosition() local oDir = self:GetObjectDirectionVectors() local camPos = {x = oPos.pos.x + (oDir.forward.x * missionCamDist), y = oPos.pos.y, z = oPos.pos.z + (oDir.forward.z * missionCamDist)} --+ (oDir.forward.y * posOffset) self:SetVar('DialogueOK', false) player:Teleport{pos = camPos} player:PlayCinematic { pathName = 'MissionDisplay_' .. npcName .. '_Cam' } end function onMissionDialogueOK(self, msg) --print('Dialogue OK') local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic() self:SetVar('DialogueOK', true) if msg.bIsComplete == false and msg.missionID == misID then -- freeze player and play cinematic player:SetUserCtrlCompPause{bPaused = true} player:PlayCinematic { pathName = 'Mission_' .. npcName .. '_Cam' } -- start timer to release player movement GAMEOBJ:GetTimer():AddTimerWithCancel( camTime, npcName .. 'Cam',self ) end end function onTerminateInteraction(self, msg) if self:GetVar('DialogueOK') then return end --print('terminate interaction') local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic() end function onTimerDone (self,msg) if (msg.name == npcName .. 'Cam') then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} end end require('o_mis') --////////////////////////////////////////////////////////////////////////////////// local npcName = 'Wisp' local misID = 311 -- missionID from DB local camTime = 3.5 -- time to release player local misID_2 = 335 -- missionID from DB local camTime_2 = 4.5 -- time to release player local missionCamDist = 10 -- distance to teleport player away from npc --////////////////////////////////////////////////////////////////////////////////// ---------------------------------------------------------------- -- Happens on client interaction (must register for picking) ---------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --local oPos = self:GetPosition() --local oDir = self:GetObjectDirectionVectors() --local camPos = {x = oPos.pos.x + (oDir.forward.x * missionCamDist), y = oPos.pos.y, z = oPos.pos.z + (oDir.forward.z * missionCamDist)} --+ (oDir.forward.y * posOffset) self:SetVar('DialogueOK', false) --player:Teleport{pos = camPos} player:SetVisible{visible = false, fadeTime = 0.5} player:PlayCinematic { pathName = 'MissionDisplay_' .. npcName .. '_Cam' } end function missionCinematic(self, player, mission, time) self:SetVar('DialogueOK', true) -- freeze player and play cinematic player:SetUserCtrlCompPause{bPaused = true} player:PlayCinematic { pathName = 'Mission_' .. npcName .. '_Cam_' .. tostring(mission)} -- start timer to release player movement GAMEOBJ:GetTimer():AddTimerWithCancel( camTime, npcName .. 'Cam',self ) end function onMissionDialogueOK(self, msg) --print('Dialogue OK') local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.5} if msg.bIsComplete == false and msg.missionID == misID then missionCinematic(self, player, misID, camTime) elseif msg.bIsComplete == false and msg.missionID == misID_2 then missionCinematic(self, player, misID_2, camTime_2) end end function onNotifyMission(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.missionState <= 1 then player:PlayCinematic { pathName = 'MissionDisplay_' .. npcName .. '_Cam' } player:SetVisible{visible = false, fadeTime = 0.5} end end function onTerminateInteraction(self, msg) if self:GetVar('DialogueOK') then return end --print('terminate interaction') local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.2} end function onTimerDone (self,msg) if (msg.name == npcName .. 'Cam') then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} end end require('o_mis') -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetMouseOverDistance(self, dist) if (self and self:Exists()) then self:SetVar("interactDistance", dist) end end -------------------------------------------------------------- -- sets the proximity for the object -------------------------------------------------------------- function SetProximityDistance(self, dist) if (self and self:Exists()) then self:SetVar("proxDistance", dist) self:SetProximityRadius{radius = self:GetVar("proxDistance"), name="chatBubbleProx"} end end -------------------------------------------------------------- -- check for valid type -------------------------------------------------------------- function IsValidType(type) if (type == "mouseOverEffect" or type == "mouseOverAnim" or type == "mouseOverText" or type == "interactionEffect" or type == "interactionAnim" or type == "interactionText" or type == "proximityEffect" or type == "proximityAnim" or type == "proximityText") then return true; end return false end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction(self, type, action) if (self and self:Exists()) then -- check type if (IsValidType(type) == false) then print("Bad Type of Interaction") return end local table = self:GetVar(type) -- init table if need to if (table == nil) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- override pick type to be interactive -------------------------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end -------------------------------------------------------------- -- handle cursor over object -------------------------------------------------------------- function onCursorOn(self, msg) -- do effects local effects = self:GetVar("mouseOverEffect") if effects and #effects > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("mouseOverAnim") if anims and #anims > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("mouseOverText") if texts and #texts > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle client use -------------------------------------------------------------- function onClientUse(self, msg) -- if the npc is going to open a mission dialogue, this skips the ambient interact if self:GetMissionForPlayer{playerID = msg.user}.missionState ~= 0 then return end -- we need to add this to keep this script from sending a packet to the server everytime a chat bubble pops up --msg.targetObject = '0' self:SetVar('isInUse', true) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "talking", self ) msg.user:PlayAnimation{animationID = "talk", bPlayImmediate = true} -- do effects local effects = self:GetVar("interactionEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("interactionAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} else -- check to see if the npc has a default talk animation, if not, prints out a warning if self:GetAnimationTime{animationID = "talk"}.time == 0 and self:GetVersioningInfo().bIsInternal then print("***WARNING*** From script client/ai/AG/L_AG_NPC.lua This npc needs a talk animation. My lot is "..self:GetLOT().objtemplate) end self:PlayAnimation{animationID = "talk", bPlayImmediate = true} end -- do effects local texts = self:GetVar("interactionText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end --return msg end -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() and msg.name == "chatBubbleProx" then -- do effects local effects = self:GetVar("proximityEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("proximityAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("proximityText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end end end function onTimerDone(self, msg) if (msg.name == "talking") then self:SetVar('isInUse', false) self:RequestPickTypeUpdate() end end ---------------------------------------------------- -- script on beck to show the emote tutorial after accepting his missions to salute him -- written by brandi 6/11/10 ----------------------------------------------------- function onMissionDialogueOK(self,msg) if msg.missionID == 315 and msg.iMissionState == 1 then UI:SendMessage( "DisplayTutorial", { {"type","speedchat"} } ) end end-------------------------------------------------------------- -- Description: -- -- Client script for playing effect on battlefield outpost console -- created mrb... 1/22/10 -------------------------------------------------------------- function onClientUse(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check if this is the local palyer or not if playerID ~= msg.user:GetID() then return end self:PlayFXEffect{name = "onInteract",effectType = "interact"} end function onTerminateInteraction(self,msg) self:StopFXEffect{name = "onInteract"} end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end -------------------------------------------------------------- -- Foot Race script that -- updated mrb... 4/30/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT') local gVars = { pathName = "Foot_Race_Path_01", goalLot = 8575, obsticleLot = {8572, 8576, 8578, 8579, 6214,}, --6215, numOfObsticles = 2, finalGoalObsticleLot = 6216, sStopTooltipText = Localize("FOOT_RACE_STOP_QUESTION"), sStartTooltipText = Localize("FOOT_RACE_START_QUESTION"), sFirstGoalText = Localize("FOOT_RACE_FIRST_GOAL"), sFinalGoalText = Localize("FOOT_RACE_FINAL_GOAL"), startTime = 10, -- amount of time the player should start the race with addTime = 10, -- amount of time to add when the player hits a goal completedSetFlagNum = nil, -- sets the specified flag when the race is completed completedFireEventGroup = nil,} -- -ie- "PandaGroup" - calls FireEventServerSide message named Foot_Race_Completed to the group with the playerID as param1 -- these variabls are for setting up the goal posts only local tGoalpostVars = { goalpostLot = 3890, goalpostOffset = 5.2, -- how far right and left of the object to spawn in the goal posts. nextEffectID = 503, nextEffectType = "create",} ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function onStartup(self) setLocalVars(self, gVars, tGoalpostVars) baseStartup(self) end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self) end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function onClientUse(self, msg) baseClientUse(self, msg) end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function onTerminateInteraction(self, msg) baseTerminateInteraction(self, msg) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) baseMessageBoxRespond(self, msg) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function onFireEvent(self, msg) baseFireEvent(self, msg) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function onActivityTimerUpdate(self, msg) baseActivityTimerUpdate(self, msg) end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function onActivityTimerDone(self, msg) baseActivityTimerDone(self, msg) end -------------------------------------------------------------- -- same as L_AG_NPC.lua, which adds the chat bubbles to ambient NPCs, -- but without the interact part, so it can be added to footrace NPCs -- created brandi 8/6/10 ------------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetMouseOverDistance(self, dist) if (self and self:Exists()) then self:SetVar("interactDistance", dist) end end -------------------------------------------------------------- -- sets the proximity for the object -------------------------------------------------------------- function SetProximityDistance(self, dist) if (self and self:Exists()) then self:SetVar("proxDistance", dist) self:SetProximityRadius{radius = self:GetVar("proxDistance"), name="chatBubbleProx"} end end -------------------------------------------------------------- -- check for valid type -------------------------------------------------------------- function IsValidType(type) if (type == "mouseOverEffect" or type == "mouseOverAnim" or type == "mouseOverText" or type == "interactionEffect" or type == "interactionAnim" or type == "interactionText" or type == "proximityEffect" or type == "proximityAnim" or type == "proximityText") then return true; end return false end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction(self, type, action) if (self and self:Exists()) then -- check type if (IsValidType(type) == false) then print("Bad Type of Interaction") return end local table = self:GetVar(type) -- init table if need to if (table == nil) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- handle cursor over object -------------------------------------------------------------- function onCursorOn(self, msg) -- do effects local effects = self:GetVar("mouseOverEffect") if effects and #effects > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("mouseOverAnim") if anims and #anims > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("mouseOverText") if texts and #texts > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() and msg.name == "chatBubbleProx" then -- do effects local effects = self:GetVar("proximityEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("proximityAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} else if self:GetAnimationTime{animationID = "prox"}.time == 0 and self:GetVersioningInfo().bIsInternal then print("***WARNING*** From script client/ai/AG/L_AG_NPC.lua This npc needs a talk animation. My lot is "..self:GetLOT().objtemplate) end self:PlayAnimation{animationID = "prox"} end -- do effects local texts = self:GetVar("proximityText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end end end -------------------------------------------------------------- -- Script to unlock minimap after mission is accepted and cinematic is played -- -- updated mrb... 3/26/10 -------------------------------------------------------------- --////////////////////////////////////////////////////////////////////////////////// local misID = 311 -- missionID from DB --////////////////////////////////////////////////////////////////////////////////// function onMissionDialogueOK(self, msg) local player = GAMEOBJ:GetControlledID() if not player then return end if msg.missionID == misID and msg.responder:GetID() == player:GetID() then if not ( player:GetFlag{iFlagID = 2}.bFlag ) then local cineTime = LEVEL:GetCinematicInfo("Mission_Wisp_Cam_311") or 1 GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime + 1, "unlockMinimap",self ) end end end function onTimerDone(self, msg) if msg.name == "unlockMinimap" then local player = GAMEOBJ:GetControlledID() if not player then return end -- 2 is the minimap tutorial player:Help{ iHelpID = 2 } end end -- Script that can be attached to a trigger volume to play the opening cinematic -- on the space ship. -- Created: 4/27/10 mrb... --////////////////////////////////////////////////////////////////////////////////// local cinemaName = 'Flythrough' -- name of cinematic in HF local tutDelay = '2' -- time after player is released from cinematic before displaying the wasd tut --////////////////////////////////////////////////////////////////////////////////// function onCollisionPhantom(self, msg) local target = msg.objectID local targetID = target:GetID() local playerID = GAMEOBJ:GetLocalCharID() -- Don't do this unless it's the local player if playerID == targetID then local faction = target:GetFaction() if faction.faction ~= 1 or msg.objectID:GetFlag{iFlagID = 59}.bFlag then return end local cinemaTime = LEVEL:GetCinematicInfo(cinemaName) -- time of cinematic and to release player -- set flag to true so we know the player has alread done this target:SetFlag{iFlagID = 59, bFlag = true} -- freeze player and play cinematic and sounds target:SetStunned{ StateChangeType = "PUSH", bCantMove = true } target:PlayCinematic { pathName = cinemaName } -- start timer to release player movement GAMEOBJ:GetTimer():AddTimerWithCancel( cinemaTime, "openCinematic",self ) -- change ui state to CinematicBars UI:SendMessage( "pushGameState", {{"state", "cinematic" }} ) end end function onTimerDone (self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.name == "openCinematic" then -- change ui state to normal UI:SendMessage( "popGameState", {{"state", "cinematic"}} ) -- release player movement player:SetStunned{ StateChangeType = "POP", bCantMove = true } -- display tooltip timer GAMEOBJ:GetTimer():AddTimerWithCancel( tutDelay, "displayWASD",self ) elseif msg.name == "displayWASD" then player:Help{ iHelpID = 6 } end end -------------------------------------------------------------- -- Script on the red crate in AG to make it invisible if the player isnt on the mission -- -- created by brandi 3/9/10 -------------------------------------------------------------- function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- make sure the player is ready if player:Exists() then local mission = player:GetMissionState{missionID = 746}.missionState -- if the player is not currently on the mission from Captain Jack to find his treasure, -- then make the crate invisible if mission ~= 2 then self:SetVisible{visible = false, fadeTime = 0} return end else -- if the player isnt fully loaded to check the player flag status, create 'heartbeat timer' GAMEOBJ:GetTimer():AddTimerWithCancel(1.0, "CheckPlayer", self) end end function onTimerDone(self,msg) if (msg.name == "CheckPlayer") then onRenderComponentReady(self,msg) end end function onNotifyObject( self, msg ) if ( msg.name == "zonePlayer" ) then -- the mosaic portal needs to zone the player, but it doesn't exist server-side. asking this object to do it instead. self:FireEventServerSide{ senderID = msg.ObjIDSender, args = "zonePlayer" } end end----------------------------------------------------------------------------------------------- --script so the player will always be able to rebuild the beacons once the mission is accepted ----------------------------------------------------------------------------------------------- function onStartup(self) --print("client script starting up!!!!") end local BeaconQB = 55 function onMissionDialogueOK(self, msg) --print("mission accepted") if msg.missionID == 322 then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetFlag{iFlagID = BeaconQB, bFlag = true} --print("flag set") end end-------------------------------------------------------------- -- Client-side death trigger that will spawn an object while -- the player is dying. Change the Custom Variables to fit -- your needs. -- mrb... 5/21/09 -- djames: updated 9/28/09 -------------------------------------------------------------- -- Custom Variables -------------------------------------------------------------- local deathAnimation = "electro-shock-death" -- Animation to play on the player when it dies local deathObject = 6315 -- Object to spawn when the player dies local deathObjectOffset = {x=0,y=0,z=0} -- Offset to apply when spawning the deathObject local deathObjectAnimation = "idle" -- name of the animation playing on the deathObject -------------------------------------------------------------- -- onCollisionPhantom handles the player colliding with the -- attached object (i.e. water plane) by making them die -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("******* onCollisionPhantom (client)") if not self:GetVar('bActive') then return end self:SetVar('bActive', false) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then --print(self:GetLOT().objtemplate) --print(msg.objectID:GetLOT().objtemplate) -- stun the player so they can't wander around on the surface of the water target:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true} --print("******* RequestDie (client)") target:RequestDie{killerID = self, deathType = deathAnimation} end return msg end -------------------------------------------------------------- -- onKilledPlayer handles the player dying after receiving the -- message from the server by spawning in the deathObject. -------------------------------------------------------------- function onKilledPlayer(self, msg) --print("******* onKilledPlayer (client)") local target = msg.playerID local pos = msg.deathPos local rot = msg.deathRot -- snap the player to the position where they really died target:SetPosition{ pos = pos } --print("******* Spawn Death Object *******") local config = { {"no_timed_spawn", true}, {"groupID", "DeathObject"} } RESMGR:LoadObject{ objectTemplate = deathObject, x = pos.x + deathObjectOffset.x, y = pos.y + deathObjectOffset.y, z = pos.z + deathObjectOffset.z, rw = rot.w, rx = rot.x, ry = rot.y, rz = rot.z, owner = self, configData = config} target:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true} return msg end -------------------------------------------------------------- -- onChildLoaded starts a timer to remove the deathObject -- based on its deathObjectAnimation time. -------------------------------------------------------------- function onChildLoaded( self, msg ) --print("******* onChildLoaded (client)") local animTime = msg.childID:GetAnimationTime{animationID = deathObjectAnimation} GAMEOBJ:GetTimer():AddTimerWithCancel(animTime.time, "RemoveDeathObject", self ) end -------------------------------------------------------------- -- timers... -------------------------------------------------------------- function onTimerDone(self, msg) if msg.name == "RemoveDeathObject" then --print('******* RemoveDeathObject (client)') local deathObj = self:GetObjectsInGroup{ group = "DeathObject" }.objects for k,v in ipairs(deathObj) do GAMEOBJ:DeleteObject(v) end self:SetVar('bActive', true) end end --this script automatically displays the complete mission window for the rocket parts -- mision in the spaceship function onMissionDialogueOK (self, msg) if (msg.missionID == 308) then --check that it is the rocket parts mission if (msg.iMissionState == 1) then --check to see if the player just accepted the mission --check to see if the player has any of the nosecone pie if ((msg.responder:GetInvItemCount{iObjTemplate = 4713}.itemCount == 1) or (msg.responder:GetInvItemCount{iObjTemplate = 4716}.itemCount == 1) or (msg.responder:GetInvItemCount{iObjTemplate = 4719}.itemCount == 1)) then --check to see if the player has any cockpit pieces if ((msg.responder:GetInvItemCount{iObjTemplate = 4714}.itemCount == 1) or (msg.responder:GetInvItemCount{iObjTemplate = 4717}.itemCount == 1) or (msg.responder:GetInvItemCount{iObjTemplate = 4720}.itemCount == 1)) then --check to see if the player has any engine pieces if ((msg.responder:GetInvItemCount{iObjTemplate = 4715}.itemCount == 1) or (msg.responder:GetInvItemCount{iObjTemplate = 4718}.itemCount == 1) or (msg.responder:GetInvItemCount{iObjTemplate = 4721}.itemCount == 1)) then --if the player has at least one of each of the rocket parts, start timer --the timer is necessary to make sure the current interaction with the skylane --is done before it can start the next one GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "completemission",self ) end end end end end end function onTimerDone(self,msg) if msg.name == "completemission" then --make the player interact with skylane again to complete the mission if they already have --all the rocket parts when they get the mission local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetPlayerInteraction{interaction = self} player:RequestUse{object = self } end end function onCollisionPhantom(self, msg) -- Only the local player can collide with this if ( msg.objectID:GetID() == GAMEOBJ:GetLocalCharID() ) then local player = msg.objectID if not ( player:GetFlag{iFlagID = 30}.bFlag ) then -- 30 is the smashing controls tutorial player:Help{ iHelpID = 30 } end GAMEOBJ:DeleteObject(self) end end local mobNum = 1 local spawnDist = 50 local playerFlag = 65 function onCollisionPhantom( self, msg ) if ( msg.objectID:GetFaction().faction == 1 ) and not msg.objectID:GetFlag{iFlagID = playerFlag}.bFlag then local target = '|' .. msg.objectID:GetID() local oPos = {pos = self:GetPosition().pos} local posOffset = -5 local oDir = msg.objectID:GetPlayerForward() if mobNum == 1 then posOffset = 10 spawnDist = 10 end local newPos = {x = oPos.pos.x + (oDir.fwd.x * spawnDist), y = oPos.pos.y, z = oPos.pos.z + (oDir.fwd.z * spawnDist)} --+ (oDir.fwd.y * posOffset) oPos.rot = self:GetRotation() --print("************** Spawn Strombie **************") local config = { {"wanderRadius", 35}, {"aggroRadius", 100}, {"tetherRadius", 150}, {"no_timed_spawn", true}, {"tempTarget", target}} for i=1, mobNum do local newOffset = {x = newPos.x + (posOffset/i), y = newPos.y, z = newPos.z + posOffset} RESMGR:LoadObject{ objectTemplate = 4712, x= newOffset.x, y= newOffset.y , z= newOffset.z, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = self, configData = config} -- posOffset = posOffset + 5 end msg.objectID:SetFlag{iFlagID = playerFlag, bFlag = true} end end function onChildLoaded( self, msg ) local stromMob = msg.childID local tempTarget = stromMob:GetVar("tempTarget" ) local target = GAMEOBJ:GetObjectByID(tempTarget) --print(stromMob:GetName().name .. ' should attack ' .. target:GetName().name) --stromMob:UnsetProximityRadius{name = "aggroRadius"} --stromMob:SetProximityRadius{radius = 100, name = "aggroRadius"} stromMob:AddThreatRating{newThreatObjID = target, ThreatToAdd = 500} end -------------------------------------------------------------- -- (CLIENT SIDE) Scenario Exit -- -- Handles client side dialogs/messages and input -------------------------------------------------------------- ---------------------------------------------------------------- -- Includes ---------------------------------------------------------------- --require('o_mis') require('c_AvantGardens') ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- Make this object interactable (must register for picking) -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end ---------------------------------------------------------------- -- Happens on client interaction (must register for picking) ---------------------------------------------------------------- function onClientUse(self, msg) end ------------------------------------------------- --This script is on a trigger just after Epsilon in the AG Battlefield -- if the player is a WASD player, then it shows the Q&E tutorial again. -- created brandi 6/28/10 ---------------------------------------------------- function onCollisionPhantom(self,msg) local player = msg.senderID if player:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("ToggleControlsTutorial", { {"bDisplay", true} , { "type", "Rotate" } } ) end end-------------------------------------------------------------- -- Description: -- -- Client script for AG Survival Instancer. -- Lets client know the object can be interacted with -- updated mrb... 3/23/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { releaseVersion = 182, -- which version release # the content should be made available for Beta 1 misID = 479, missionState = 2, transferZoneID = 1101, UI_Type = "AG_Survival_01", failText = Localize("MINIGAME_LOBBY_AG_SUVIVAL_FAIL_MESSAGE"),} function onStartup(self) baseSetVars(self, tVars) end -------------------------------------------------------------- -- (CLIENT SIDE) Obstacle Course Starter NPC -- -- Handles client side dialogs/messages and input -------------------------------------------------------------- ---------------------------------------------------------------- -- Includes ---------------------------------------------------------------- require('c_AvantGardens') --////////////////////////////////////////////////////////////////////////////////// local misID = 335 -- missionID from DB --////////////////////////////////////////////////////////////////////////////////// ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function onStartup(self) end ---------------------------------------------------------------- -- Happens on client interaction (must register for picking) ---------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) self:SetVar('DialogueOK', false) end function onTerminateInteraction(self, msg) if self:GetVar('DialogueOK') then return end --print('terminate interaction') local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) end -------------------------------------------------------------- -- Make this object interactable (must register for picking) -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end ---------------------------------------------------------------- -- Server sends us a notification to do help, show dialogs ---------------------------------------------------------------- function onHelp(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (player:GetMissionState{missionID = misID}.missionState == 2 or player:GetMissionState{missionID = misID}.missionState == 10 )then if (msg.iHelpID == 0) then player:DisplayMessageBox{bShow = true, imageID = 1, text = "Enter Battle to Collect Maelstrom?", callbackClient = self, identifier = "player_dialog_cancel_course"} end end end function onFireEventServerSide(self, msg) if (msg.args == "ZonePlayer") then msg.senderID:TransferToZone{ zoneID = msg.param1 } print('zone player') end endrequire('o_mis') -- Bob mission is 173 local bCINEMA_ONCE = false function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then local targetID = msg.objectID local BobMissionStatus = targetID:GetMissionState{missionID = 173}.missionState --Check the Bob mission to see the status --print ("Bob Mission Status is ".. BobMissionStatus) if (BobMissionStatus < 2) then --If the player has not accepted the mission, print the hint text. targetID:DisplayTooltip { bShow = true, strText = Localize("TOOLTIP_MISSION_GIVER"), strImageName = "../../textures/ui/tooltips/first_mission.dds", iTime = 6000 } --need to change to localized text, like below: --self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_INVITE_01")} end end end -- Old script below: --[[ function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID) then local player = msg.objectID local tooltipMsg = player:GetTooltipFlag{ iToolTip = 25 } if ((bCINEMA_ONCE == false) and (tooltipMsg) and (tooltipMsg.bFlag == false)) then player:SetUserCtrlCompPause{bPaused = true} bCINEMA_ONCE = true --player:Help{ iHelpID = 25 } player:PlayCinematic { pathName = "Bob_Cam" } player:DisplayTooltip { bShow = true, strText = "Bob uses the machine to activate your creative spark...", iTime = 5000 } --player:SetUserCtrlCompPause{bPaused = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0 , "Message2", self ) --GAMEOBJ:GetTimer():AddTimerWithCancel( 20.0 , "PauseTime", self ) local friends = self:GetObjectsInGroup{ group = "BobGroup" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 4009 then friends[i]:PlayFXEffect{effectType = "full"} end if friends[i]:GetLOT().objtemplate == 4763 then friends[i]:PlayFXEffect{effectType = "work"} end end end end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- if (msg.name == "PauseTime") then -- player:SetUserCtrlCompPause{bPaused = false} -- end if (msg.name == "Message2") then -- player:SetUserCtrlCompPause{bPaused = true} player:DisplayTooltip { bShow = true, strText = "But the machine jams!", iTime = 5000 } local friends = self:GetObjectsInGroup{ group = "BobGroup" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 4763 then friends[i]:PlayFXEffect{effectType = "shake"} end end GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0 , "Message3", self ) end if (msg.name == "Message3") then player:DisplayTooltip { bShow = true, strText = "Bob - Oh, yeah, that happens sometimes.", iTime = 5000 } local friends = self:GetObjectsInGroup{ group = "BobGroup" }.objects GAMEOBJ:GetTimer():AddTimerWithCancel( 4.66 , "Message4", self ) end if (msg.name == "Message4") then player:DisplayTooltip { bShow = true, strText = "Bob - Click me and let's see if we can repair it!", iTime = 5000 } player:SetTooltipFlag{ iToolTip = 25, bFlag = true } player:SetUserCtrlCompPause{bPaused = false} end end ]]-- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS["MOSAIC_PORTAL_LOT"] = 4023 CONSTANTS["BROKEN_MOSAIC_LOT"] = 4044 -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup( self ) ForgetPortal( self ) ForgetBroken ( self ) end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState( self, msg ) UpdateChildren( self, msg.iState ) end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady( self ) -- check what state the rebuild is in and add the broken mosaic or the portal if appropriate local rebuildState = self:GetRebuildState() -- if the state is idle we are active if (rebuildState ) then UpdateChildren( self, tonumber( rebuildState.iState ) ) end end -------------------------------------------------------------- -- called when a child object is loaded up, in this case, the portal -------------------------------------------------------------- function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["MOSAIC_PORTAL_LOT"] ) then storeObjectByName( self, "portalID", msg.childID ) storeParent( self, msg.childID ) elseif ( msg.childID:GetLOT().objtemplate == CONSTANTS["BROKEN_MOSAIC_LOT"] ) then storeObjectByName( self, "brokenID", msg.childID ) storeParent( self, msg.childID ) end end -------------------------------------------------------------- -- add or remove the portal and the broken mosaic, according to the current rebuild state -------------------------------------------------------------- function UpdateChildren( self, rebuildState ) --print( "rebuildState" ) --print ( rebuildState ) -- check whether we should have the mosaic portal if ( rebuildState == 3 ) then AddPortal( self ) else RemovePortal( self ) end -- check whether we should have the broken mosaic if ( rebuildState == 4 or rebuildState == 0) then AddBroken( self ) else RemoveBroken( self ) end end -------------------------------------------------------------- -- clear out the portal variable -------------------------------------------------------------- function ForgetPortal( self ) self:SetVar( "portalID", CONSTANTS["EMPTY_ID_NAME"] ) end -------------------------------------------------------------- -- spawn in the portal -------------------------------------------------------------- function AddPortal( self ) -- return out if we already have a portal if ( self:GetVar( "portalID" ) ~= CONSTANTS["NO_OBJECT"] ) then return end -- get our position and rotation local pos = self:GetPosition{}.pos local rotW = self:GetRotation{}.w local rotX = self:GetRotation{}.x local rotY = self:GetRotation{}.y local rotZ = self:GetRotation{}.z RESMGR:LoadObject { objectTemplate = CONSTANTS["MOSAIC_PORTAL_LOT"], x = pos.x, y = pos.y, z = pos.z, rw = rotW, rx = rotX, ry = rotY, rz = rotZ, owner = self } end -------------------------------------------------------------- -- remove the portal -------------------------------------------------------------- function RemovePortal( self ) local portalObj = getObjectByName( self, "portalID" ) if( portalObj ~= nil and portalObj:Exists() ) then GAMEOBJ:DeleteObject( portalObj ) ForgetPortal( self ) end end -------------------------------------------------------------- -- clear out the portal variable -------------------------------------------------------------- function ForgetBroken( self ) self:SetVar( "brokenID", CONSTANTS["EMPTY_ID_NAME"] ) end -------------------------------------------------------------- -- spawn in the portal -------------------------------------------------------------- function AddBroken( self ) -- return out if we already have a broken mosaic if ( self:GetVar( "brokenID" ) ~= CONSTANTS["NO_OBJECT"] ) then return end -- get our position and rotation local pos = self:GetPosition{}.pos local rotW = self:GetRotation{}.w local rotX = self:GetRotation{}.x local rotY = self:GetRotation{}.y local rotZ = self:GetRotation{}.z RESMGR:LoadObject { objectTemplate = CONSTANTS["BROKEN_MOSAIC_LOT"], x = pos.x, y = pos.y, z = pos.z, rw = rotW, rx = rotX, ry = rotY, rz = rotZ, owner = self } end -------------------------------------------------------------- -- remove the portal -------------------------------------------------------------- function RemoveBroken( self ) local brokenObj = getObjectByName( self, "brokenID" ) if( brokenObj ~= nil and brokenObj:Exists() ) then GAMEOBJ:DeleteObject( brokenObj ) ForgetBroken( self ) end end -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup( self ) self:SetPickType{ ePickType = 14 } -- PICK_LIST_INTERACTIVE from enum PICK_LIST_TYPE in lwoCommonVars.h self:SetProximityRadius{ radius = 200 } end -------------------------------------------------------------- -- when clicked on -------------------------------------------------------------- function onClientUse( self, msg ) -- get a list of all the objects near the mosaic and look through it for the maelstrom spike local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] if (target) and (target:Exists()) then if ( target:GetLOT{}.objtemplate == 4019 ) then -- the mosaic portal can't zone the player itself because it doesn't exist on the server target:NotifyObject{ ObjIDSender = msg.user, name = "zonePlayer" } end end index = index + 1 end end -------------------------------------------------------------- -- (CLIENT SIDE) Obstacle Course Starter NPC -- -- Handles client side dialogs/messages and input -- updated 5/18/10 - fixed bug in toggle leaderboard -------------------------------------------------------------- ---------------------------------------------------------------- -- Includes ---------------------------------------------------------------- require('c_AvantGardens') --////////////////////////////////////////////////////////////////////////////////// local npcName = '' local missionCamDist = 10 -- distance to teleport player away from npc local misID = 319 -- missionID from DB local misID2 = 317 local misID3 = 318 local camTime = 10 -- time to release player local timerTick = 0 local myPriority = 0.8 --////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Make this object interactable (must register for picking) -------------------------------------------------------------- function onGetPriorityPickListType(self, msg) if ( myPriority > msg.fCurrentPickTypePriority ) then local player = GAMEOBJ:GetControlledID() if player:Exists() then local missionStateA = player:GetMissionState{missionID = misID}.missionState local missionStateB = player:GetMissionState{missionID = misID3}.missionState local missionStateC = player:GetMissionState{missionID = misID2}.missionState msg.fCurrentPickTypePriority = myPriority if missionStateA < 4 and missionStateB >= 4 then self:SetIconAboveHead{bIconOff = true, iconMode = 0, iconType = 65} msg.ePickType = -1 return msg elseif missionStateA > 4 and missionStateB > 4 then if missionStateC > 1 and missionStateC < 5 then self:SetIconAboveHead{bIconOff = false, iconMode = 0, iconType = 4} else self:SetIconAboveHead{bIconOff = false, iconMode = 0, iconType = 65} end --print('showIcon') end msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------------------------- -- Server sends us a notification to do help, show dialogs ---------------------------------------------------------------- function onHelp(self, msg) local player = GAMEOBJ:GetControlledID() if not player:Exists() then return end local missionStateA = player:GetMissionState{missionID = misID}.missionState local missionStateC = player:GetMissionState{missionID = misID2}.missionState if missionStateA < 8 or (missionStateC > 1 and missionStateC < 8) then return end -- player is trying to exit the activity if (msg.iHelpID == 0) then -- show the exit message box player:DisplayMessageBox{bShow = true, imageID = 1, text = Localize("UI_OBSTACLE_COURSE_EXIT"), callbackClient = self, identifier = "player_dialog_cancel_course"} -- player is trying to start the activity elseif (msg.iHelpID == 1) then -- show the start message box UI:SendMessage("ToggleFootRace", { {"visible", true}, {"text", Localize("UI_OBSTACLE_COURSE_START")}, {"callbackClient", self}, {"identifier", "player_dialog_start_course"} }) freezePlayer(self, true) -- player is canceling the activity by moving out of range elseif (msg.iHelpID == 2) then UI:DisplayToolTip{strDialogText = Localize("UI_OBSTACLE_COURSE_OUT_OF_RANGE"), strImageName = "", bShow = true, iTime = 5000} UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }}) -- player is finishing the activity elseif (msg.iHelpID == 3) then --[[ UI:DisplayToolTip{strDialogText = Localize("UI_OBSTACLE_COURSE_FINISH") .. " Your Time is " .. SecondsToClock(self:GetVar('FinalTime')), strImageName = "", bShow = true, iTime = 5000} ]]-- -- player is starting the activity elseif (msg.iHelpID == 4) then -- trigger the Countdown player:ShowActivityCountdown { bPlayCountdownSound = false, bPlayAdditionalSound = false, } -- set a timer to Unpause and Go GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["COUNTDOWN_TIME"], "CourseGo", self ) end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) --gets the player and ends the player's cinematic if one is playing local player = GAMEOBJ:GetControlledID() if msg.iButton == 1 then if msg.identifier == "player_dialog_start_course" then player:ShowActivityCountdown() GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["COUNTDOWN_TIME"]+1, "CourseGo", self ) elseif msg.identifier == "player_dialog_cancel_course" then ---------------------------------------------------------------------------------------------------------------------- --You respond in the positive to "I would like to stop playing the foot race" ---------------------------------------------------------------------------------------------------------------------- UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) GAMEOBJ:GetTimer():CancelAllTimers( self ) timerTick = 0 end elseif msg.iButton == 0 and msg.identifier == "player_dialog_start_course" then freezePlayer(self) end if msg.identifier == "Exit" then player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Post-Monument"} end if player:Exists() then player:EndCinematic{ leadOut = 1.0 } player:SetVisible{visible = true, fadeTime = 0.5} player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end end function onMissionDialogueOK(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.bIsComplete == false then player:FlashNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Monument_2"} end end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function onShutdown(self, msg) local player = GAMEOBJ:GetControlledID() if player:Exists() then -- close any tooltip or messagebox player:DisplayTooltip{ bShow = false, strText = "..." } player:DisplayMessageBox{bShow = false, imageID = 1, text = Localize("UI_OBSTACLE_COURSE_EXIT"), callbackClient = self, identifier = "player_dialog_cancel_course"} player:DisplayMessageBox{bShow = false, imageID = 4, text = Localize("UI_OBSTACLE_COURSE_START"), callbackClient = self, identifier = "player_dialog_start_course"} end UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }}) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar('FinalTime', 0) timerTick = 0 end function onNotifyClientObject(self, msg) if msg.name == "stop_timer" then --UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }}) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar('FinalTime', msg.param2) UI:SendMessage( "UpdateFootRaceScoreboard", {{"raceComplete", true}, {"message", Localize("UI_OBSTACLE_COURSE_FINISH") .. " Your Time is " .. SecondsToClock(self:GetVar('FinalTime'))}} ) timerTick = 0 elseif msg.name == "ToggleLeaderBoard" and msg.paramObj:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("pushGameState", {{"state", "TimedRaceLeaderboard"}}) UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true}, {"hideReplay", true}, {"callbackObject", self} } ) GAMEOBJ:GetControlledID():ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Post-Monument"} end end function onTerminateInteraction(self, msg) local player = GAMEOBJ:GetControlledID() if player:Exists() then player:DisplayMessageBox{bShow = false} end end function freezePlayer(self, bFreeze) local player = GAMEOBJ:GetControlledID() if not player:Exists() then return end local eChangeType = "POP" if bFreeze then if self:GetVar('frozen') then if player:IsDead().bDead then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Freeze_Again", self ) end return end self:SetVar('frozen', true) eChangeType = "PUSH" else self:SetVar('frozen', false) end --print('Player ' .. eChangeType .. ' is frozen: ' .. tostring(self:GetVar('frozen'))) player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true, bDontTerminateInteract = true } --bCantMove = true, bCantTurn = false, bCantAttack = true, bCantEquip = false, bCantInteract = true } end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "CourseGo") or (msg.name == npcName .. 'Cam') then freezePlayer(self) UI:SendMessage( "ToggleFootRaceScoreboard", {{"visible", true }, {"time", 0 } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "ClockTick", self ) elseif msg.name == "ClockTick" then timerTick = timerTick + 1 UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", timerTick } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "ClockTick", self ) elseif msg.name == "Try_Freeze_Again" then freezePlayer(self, true) end end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) SetMouseOverDistance(self, 30) AddInteraction(self, "interactionAnim", "interact") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_ASTRONAUT_PICNICKER_CLICKED01")) --Maelstrom clouds are very dangerous. If you see any, investigate with extreme caution. AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_ASTRONAUT_PICNICKER_BANTER01")) --My sensors indicate a Maelstrom breach nearby. AddInteraction(self, "proximityText", Localize("NPC_ASTRONAUT_PICNICKER_BANTER02")) --Data suggests the presence of a Maelstrom infestation. AddInteraction(self, "proximityAnim", "prox") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_BEASTIE_BRICK_B_CLICKED01")) --Yo, I hear the fireman will teach you a dance emote. -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_BEASTIE_BRICK_B_BANTER01")) --Word. AddInteraction(self, "proximityText", Localize("NPC_BEASTIE_BRICK_B_BANTER02")) --Rock on, yo. end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_BEASTIE_BRICK_C_CLICKED01")) --What kind of emotes have you unlocked? -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_BEASTIE_BRICK_C_BANTER01")) --Word. AddInteraction(self, "proximityText", Localize("NPC_BEASTIE_BRICK_C_BANTER02")) --Rock on, yo. end ---------------------------------------------------------- -- client side script on the baby spider in a cage in AG --updated brandi 8/5/10 - Changed the interact stuff and cleaned up the script a little ------------------------------------------------- local sAnim = "cage-interact2" local sCinematic = "SpiderCage_Cam" local sCameshake = "npcdeathshake" local fxID = 1039 function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.user:GetID() == player:GetID() then if not self:GetVar('bPlayingAnim') then local animTime = self:GetAnimationTime{animationID = sAnim}.time - 1.35 local cineTime = LEVEL:GetCinematicInfo(sCinematic) + 1 self:SetVar('bPlayingAnim', true) GAMEOBJ:GetTimer():AddTimerWithCancel(animTime, "StartFX", self) GAMEOBJ:GetTimer():AddTimerWithCancel(cineTime, "StopFX", self) self:PlayAnimation{animationID = sAnim, bPlayImmediate = true} player:PlayCinematic{pathName = sCinematic} end end end function onTimerDone(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.name == "StartFX" then player:PlayFXEffect{name = "camshake", effectType = sCameshake, effectID = fxID} elseif msg.name == "StopFX" then self:SetVar('bPlayingAnim', false) player:StopFXEffect{name = "camshake"} player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end endrequire('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_CONCERT_DJ_CLICKED01")) --If you've got enough imagination, grab an instrument! end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_CONCERT_FAN_A_CLICKED01")) --Did you see that guy with lots of imagination? He played forever! -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_A_BANTER01")) --Love those effects! AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_A_BANTER02")) --I like the fireworks. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_A_BANTER03")) --Lasers are the best. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_A_BANTER04")) --We need some real rock stars. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_A_BANTER05")) --This place rocks! AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_A_BANTER06")) --Why don't you try out an instrument! end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_CONCERT_FAN_B_CLICKED01")) --Get up top and dance! -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_B_BANTER01")) --Love those effects! AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_B_BANTER02")) --I like the fireworks. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_B_BANTER03")) --Lasers are the best. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_B_BANTER04")) --We need some real rock stars. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_B_BANTER05")) --This place rocks! AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_B_BANTER06")) --Quit talking to me - go play an instrument! end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_CONCERT_FAN_C_CLICKED01")) --I love it when someone dances on the top platform. -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_C_BANTER01")) --Love those effects! AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_C_BANTER02")) --I like the fireworks. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_C_BANTER03")) --Lasers are the best. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_C_BANTER04")) --We need some real rock stars. AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_C_BANTER05")) --This place rocks! AddInteraction(self, "proximityText", Localize("NPC_CONCERT_FAN_C_BANTER06")) --Quit talking to me - go play an instrument! end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_COWBOY_PICNICKER_CLICKED01")) --I hear tell of trouble ahead. AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_COWBOY_PICNICKER_BANTER01")) --Oh give me a home... AddInteraction(self, "proximityText", Localize("NPC_COWBOY_PICNICKER_BANTER02")) --Where the buffalo roam... AddInteraction(self, "proximityAnim", "prox") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_FRIENDLY_FELIX_CLICKED01")) --Keep collecting bricks. They'll come in handy once you get to Nimbus Station! AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_FRIENDLY_FELIX_BANTER01")) --Ninjas, pirates, astronauts, cowboys! AddInteraction(self, "proximityText", Localize("NPC_FRIENDLY_FELIX_BANTER02")) --You can be anything in LEGO Universe. AddInteraction(self, "proximityText", Localize("NPC_FRIENDLY_FELIX_BANTER03")) --I march to my own beat... but there's a killer concert up ahead. AddInteraction(self, "proximityAnim", "prox") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_MONKEY_PICNICKER_CLICKED01")) --Oooh eeeeh aahhh! AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_MONKEY_PICNICKER_BANTER01")) --Ooo ooo ooo AddInteraction(self, "proximityText", Localize("NPC_MONKEY_PICNICKER_BANTER02")) --EEEE eee ee AddInteraction(self, "proximityText", Localize("NPC_MONKEY_PICNICKER_BANTER03")) --Oooo eeee oooo AddInteraction(self, "proximityAnim", "prox") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_NINJA_PICNICKER_CLICKED01")) --Successful building requires Imagination. Smash things to collect Imagination when you are low. AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_NINJA_PICNICKER_BANTER01")) --Look inside yourself and know: I am the fastest up the monument. AddInteraction(self, "proximityText", Localize("NPC_NINJA_PICNICKER_BANTER02")) --One who smashes will never build an understanding of the quickest path. AddInteraction(self, "proximityText", Localize("NPC_NINJA_PICNICKER_BANTER03")) --You must concur your fear of heights, captain. AddInteraction(self, "proximityAnim", "prox") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_PIRATE_PICNICKER_CLICKED01")) --How fast can ye get to the finish line above the monument? AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_PIRATE_PICNICKER_BANTER01")) --Arrrrr! I made it to the top of the monument much faster than you. AddInteraction(self, "proximityText", Localize("NPC_PIRATE_PICNICKER_BANTER02")) --Ye always go the long way around. AddInteraction(self, "proximityText", Localize("NPC_PIRATE_PICNICKER_BANTER03")) --I'll be taking the shortcut through the tunnel next time, yarrr. AddInteraction(self, "proximityAnim", "prox") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_RACE_FAN_1_CLICKED01")) --Did you notice the golden robots hidden around the monument? -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_RACE_FAN_1_BANTER01")) --Even faster than the pirate! AddInteraction(self, "proximityText", Localize("NPC_RACE_FAN_1_BANTER02")) --The ninja was never that fast. AddInteraction(self, "proximityText", Localize("NPC_RACE_FAN_1_BANTER03")) --Good job! end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_RACE_FAN_2_CLICKED01")) --Be sure to check out the concert up ahead! -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_RACE_FAN_2_BANTER01")) --Woo hoo! AddInteraction(self, "proximityText", Localize("NPC_RACE_FAN_2_BANTER02")) --Sweet! AddInteraction(self, "proximityText", Localize("NPC_RACE_FAN_2_BANTER03")) --My arms are getting tired. end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_RACE_FLAGGER_CLICKED01")) --Check in at the bottom of the monument if you want to be timed. You can race again and again. AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_RACE_FLAGGER_BANTER01")) --Another fast time! AddInteraction(self, "proximityText", Localize("NPC_RACE_FLAGGER_BANTER02")) --Yay! AddInteraction(self, "proximityText", Localize("NPC_RACE_FLAGGER_BANTER03")) --Excellent! end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_RACE_PHOTOGRAPHER_CLICKED01")) --Race as often as you want. Come back any time! AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_RACE_PHOTOGRAPHER_BANTER01")) --A great shot! AddInteraction(self, "proximityText", Localize("NPC_RACE_PHOTOGRAPHER_BANTER02")) --Terrific time! AddInteraction(self, "proximityText", Localize("NPC_RACE_PHOTOGRAPHER_BANTER03")) --Nice work! end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_ROBOT_PICNICKER_CLICKED01")) --The concert requires large quantities of imagination. Smash objects to recharge Imagination. AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_ROBOT_PICNICKER_BANTER01")) --Insect life forms. Why does it always have to be insect life forms? AddInteraction(self, "proximityText", Localize("NPC_ROBOT_PICNICKER_BANTER02")) --00011100 0011000111 01100 AddInteraction(self, "proximityText", Localize("NPC_ROBOT_PICNICKER_BANTER03")) --I hate getting bugs in my system. AddInteraction(self, "proximityAnim", "prox") end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech and animation AddInteraction(self, "interactionText", Localize("NPC_SLEEPING_KNIGHT_CLICKED01")) --zzzz. Zzz. Snort. AddInteraction(self, "interactionAnim", "greet") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_SLEEPING_KNIGHT_BANTER01")) --Zzzzz. AddInteraction(self, "proximityText", Localize("NPC_SLEEPING_KNIGHT_BANTER02")) --Zzzz-zzzz. end function onArrived(self, msg) if ( msg.wayPoint == 1 ) then self:PlayFXEffect{ name = "objects\\cannonbig\\cannonbig", effectType = "onsmash" } end endfunction onGetPriorityPickListType(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if (player:GetFlag{iFlagID = 66}.bFlag == true) then msg.ePickType = 14 -- Interactive pick type else msg.ePickType = -1 end end return msg end function onGetOverridePickType(self, msg) msg.ePickType = 6 -- smashable return msg end -------------------------------------------------------------- -- (CLIENT SIDE) Triggers -- -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) end require('client/general/MOD_BUILD_BORDER_EFFECTS') function onStartup(self) self:SetVar("hasPlayed", false) end function onModularBuildFinish(self, msg) if not self:GetVar("hasPlayed") then self:SetVar("hasPlayed", true) self:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "Spaceship_Post-Rocket"} end endrequire('o_mis') local oneTimeOnly = false; -- Something touches the phantom object function onCollisionPhantom(self, msg) -- define player local playerID = GAMEOBJ:GetLocalCharID() if (msg.objectID:GetID() == playerID and oneTimeOnly == false) then local player = msg.objectID -- 37 is the Modular Build Start tutorial player:Help{ iHelpID = 37 } oneTimeOnly = true end end local canFire = true function onCollision(self, msg) if canFire == true then print ("I hit the rocket") canFire = false GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PlayerAnimate",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 9.9, "PlayerTeleport",self ) end end function onTimerDone (self,msg) if (msg.name == "PlayerAnimate") then self:PlayAnimation{animationID = "launch"} local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetPosition {pos = {x=328.24,y=2627.17,z=-736.16}} player:SetRotation {x=0,y=0.628,z=0,w=0.777} player:SetUserCtrlCompPause{bPaused = true} player:PlayCinematic { pathName = "Rocket_Path_01" } player:PlayAnimation{animationID = "rocket"} elseif (msg.name == "PlayerTeleport") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} player:SetRotation {x=0,y=-0,z=0,w=1} player:SetPosition {pos = {x=200.31,y=759.37,z=-1162.71}} canFire = true end endfunction onCollisionPhantom(self, msg) -- Only the local player can collide with this if ( msg.objectID:GetID() == GAMEOBJ:GetLocalCharID() ) then local player = msg.objectID if not ( player:GetFlag{iFlagID = 30}.bFlag ) then -- 30 is the smashing controls tutorial player:Help{ iHelpID = 30 } end GAMEOBJ:DeleteObject(self) end end -- Something touches the phantom object function onCollisionPhantom(self, msg) -- exclusion checks if msg.objectID:GetID() ~= GAMEOBJ:GetLocalCharID() or msg.objectID:GetFlag{iFlagID = 32}.bFlag then return end local player = msg.objectID -- set flag to true so we know the player has alread done this player:SetFlag{iFlagID = 32, bFlag = true} -- display zone summary player:DisplayZoneSummary{sender = self, isZoneStart = true} end function onCollisionPhantom(self, msg) print ("I teleported to the ship.") GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PlayerTele",self ) end function onTimerDone (self,msg) if (msg.name == "PlayerTele") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetPosition {pos = {x=246,y=2642,z=-757}} player:SetRotation {x=0,y=0.628,z=0,w=0.777} end end require('o_mis') local ROCKETGROUP="RocketBuild" local ProxRadius = 20 local ToolDisplayTime = 4 function onStartup(self) -- set the proximity radius for the qb self:SetProximityRadius{radius = ProxRadius, name = "qbBouncer"} end function onProximityUpdate(self, msg) -- If this isn't the proximity radius for the bouncer, then we're done here if (msg.name ~= "qbBouncer") or self:GetVar('bIsDisplayed') then return end local playerID = GAMEOBJ:GetLocalCharID() if (msg.objId:GetID() == playerID) and msg.status == "ENTER" then local targetID = msg.objId local BobMissionStatus = targetID:GetMissionState{missionID = 173}.missionState --Check the Bob mission to see the status local QBGroup = self:GetObjectsInGroup{ group = ROCKETGROUP, ignoreSpawners=true }.objects local bIsInActivity = false; -- checks to see if the player is in an activity for i = 1, table.maxn (QBGroup) do --print("found group with i: "..i.."with id: "..QBGroup[i]:GetLOT().objtemplate ) if( QBGroup[i]:ActivityUserExists{userID=GAMEOBJ:GetObjectByID(playerID)}.bExists ) then bIsInActivity=true; end end --If the player is not doing the Rocket Build and they have completed the mission, print the hint text. if (not bIsInActivity and (BobMissionStatus == 8)) then local isClickOnceType = self:GetVar("isClickOnceType") -- decides which tool tip to use, it should always be else but you never know... if (isClickOnceType == true) then targetID:DisplayTooltip {bShow=true, strText = Localize("QB_TOOLTIP_CLICK_BRICKS_TO_REBUILD"), iTime = -1 } else targetID:DisplayTooltip {bShow=true, strText = Localize("QB_TOOLTIP_CLICK_BRICKS_AND_HOLD_TO_REBUILD"), iTime = -1 } end self:SetVar('bIsDisplayed', true) GAMEOBJ:GetTimer():AddTimerWithCancel( ToolDisplayTime, "Tool_Tip_Time", self ) end end end function HideTooltip(self) if (self:GetVar('bIsDisplayed')) then self:SetVar('bIsDisplayed', false) local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) playerID:DisplayTooltip {bShow=false} end end function onRebuildNotifyState(self, msg) --print('onRebuildNotifyState - prevState = ' .. msg.iPrevState .. ' curState = ' .. msg.iState) if ( msg.iState == 4 ) then -- qb was reset cancel all timers qb is respawned so the proximity will take care of the tool tip GAMEOBJ:GetTimer():CancelAllTimers(self) HideTooltip(self) elseif msg.iState == 5 then -- qb was started - if local player started it, cancel timers and start new timer to display the tool tip until its finished building self:ClearProximityRadius() HideTooltip(self) if (msg.player:GetID() == GAMEOBJ:GetLocalCharID()) then GAMEOBJ:GetTimer():CancelAllTimers(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Start_Tool_Tip", self ) end elseif msg.iState == 3 then -- qb was completed clear the proximity and turn off the tool tip GAMEOBJ:GetTimer():CancelAllTimers(self) HideTooltip(self) end end function onTimerDone(self, msg) if msg.name == "Tool_Tip_Time" then -- tool tip time is up reset it local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) self:SetVar('bIsDisplayed', false) playerID:DisplayTooltip {bShow=false} elseif msg.name == "Start_Tool_Tip" then -- delay the display tool tip on reset, cinematic was canceling it out local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) self:SetVar('bIsDisplayed', true) playerID:DisplayTooltip {bShow=true, strText = Localize("QB_TOOLTIP_CLICK_BRICKS_AND_HOLD_TO_REBUILD"), iTime = -1 } end end function onCollisionPhantom(self, msg) -- Only the local player can collide with this if ( msg.objectID:GetID() == GAMEOBJ:GetLocalCharID() ) then local player = msg.objectID if not ( player:GetFlag{iFlagID = 51}.bFlag ) then player:DisplayTooltip { bShow = true, strText = Localize"AG_TOOLTIP_COLLECTIBLES", strImageName = "../textures/ui/tooltips/AG_flag.dds", iTime = 6000 } player:SetFlag{iFlagID = 51, bFlag = true} end GAMEOBJ:DeleteObject(self) end end function onCollisionPhantom(self, msg) -- Only the local player can collide with this if ( msg.objectID:GetID() == GAMEOBJ:GetLocalCharID() ) then local player = msg.objectID if not ( player:GetFlag{iFlagID = 2}.bFlag ) then -- 2 is the minimap tutorial player:Help{ iHelpID = 2 } end GAMEOBJ:DeleteObject(self) end end -------------------------------------------------------------- -- Script to display messages to the player when they walk up -- to a launch pad in the spaceship. -- -- updated mrb... 4/27/10 Added talk to bob tooltip -------------------------------------------------------------- function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetControlledID() local targetID = msg.objectID if msg.objectID:GetID() == playerID:GetID() then local tipText = Localize("ROCKET_DROP_ROCKET_TO_LAUNCH") local preCheck1 = playerID:CheckPrecondition{PreconditionID = 8} -- talk to bob local preCheck2 = playerID:CheckPrecondition{PreconditionID = 6} -- talk to skylane local preCheck3 = playerID:CheckPrecondition{PreconditionID = 107} -- build a rocket if not preCheck1.bPass then tipText = preCheck1.FailedReason elseif not preCheck2.bPass then tipText = preCheck2.FailedReason elseif not preCheck3.bPass and not playerID:GetFlag{iFlagID = 54}.bFlag then tipText = preCheck2.FailedReason end playerID:DisplayTooltip {bShow=true, strText = tipText, iTime = 2500 } end end require('o_mis') -- Something touches the phantom object function onCollisionPhantom(self, msg) -- define player local playerID = GAMEOBJ:GetControlledID() if (msg.objectID:GetID() == playerID:GetID()) then local player = msg.objectID -- 26 is the jumping controls tutorial player:PlayFXEffect{ effectID = 136, effectType = "create", priority = 1.07 } end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) AddInteraction(self, "interactionAnim", "submit") endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) print "Freeze Minifig, turn wheel, play turn animation" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayAnimation{animationID = "ship-wheel"} self:PlayAnimation{animationID = "turn"} endfunction onClientUse(self) print "Unfreeze Player and return cam to normal" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Camera_End" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endlocal sections = {} local currentPlaceIndex = 1 local spawns = {5851,5852,5851,5852,5851,5852,5851,5852} local offset = 0 function onClientUse(self) print "Click a green section to move pieces from left to right, click again to reset" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Gameplay_Setup" } Deletespawns() for i = 1, #spawns do Loadspawn(i) end end function Loadspawn(yegges) RESMGR:LoadObject {objectTemplate = spawns[yegges], x = -161 + offset, y = 184.32, z = -483, owner = self} offset = offset + 5 end function Deletespawns() for i = 1, #sections do GAMEOBJ:DeleteObject(sections[i]) end sections = {} offset = 0 currentPlaceIndex = 1 end function onNotifyObject(self, msg) if msg.name == "padloaded" then sections[#sections + 1] = msg.ObjIDSender -- currentLoadIndex = currentLoadIndex + 1 elseif msg.name == "Selected" then if #sections >= currentPlaceIndex then print "Turn off FX on Object" -- Remove effect from sections[currentPlaceIndex] sections[currentPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} currentPlaceIndex = currentPlaceIndex + 1 print "Turn on FX on Object" -- Add effect from sections[currentPlaceIndex] end end end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end --[[ 5851 - Pad 01 5852 - Pad 02 5853 - Place Piece 01 5854 - Place Piece 02 5855 - Control Console 5856 - Cancel Button --]] require ('o_mis') function onRenderComponentReady(self, msg) print "pad starting up" local ControlObject = self:GetObjectsInGroup{ group = "GP_Control"}.objects[1] print (tostring(ControlObject:GetLOT().objtemplate)) ControlObject:NotifyObject{name = "padloaded", ObjIDSender = self} storeObjectByName(self, "ControlObject", ControlObject) end --[[function onClientUse(self, msg) print "Click A Green Piece to Move It" end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end --]]function onClientUse(self) local ControlObject = self:GetObjectsInGroup{ group = "GP_Control"}.objects[1] ControlObject:NotifyObject{ObjIDSender=self, name = "Selected"} end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "stop" } end end end --]]require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum02" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3557 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum03" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3558 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum04" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3559 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum05" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3560 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum06" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3561 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum07" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3562 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum08" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3563 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum09" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3564 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum10" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3565 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum11" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3566 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum12" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3567 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum13" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3568 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum14" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3569 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum15" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3570 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum16" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3571 then friends[i]:NotifyObject{ name = "stop" } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "repeatloop" } end end end --[[ function onUse(self, msg) local friends = self:GetObjectsInGroup{ group = "drum01" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3556 then friends[i]:NotifyObject{ name = "repeatloop" } end end end --]]require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum02" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3557 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum03" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3558 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum04" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3559 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum05" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3560 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum06" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3561 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum07" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3562 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum08" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3563 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum09" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3564 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum10" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3565 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum11" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3566 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum12" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3567 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum13" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3568 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum14" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3569 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum15" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3570 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onClientUse(self) SetMouseOverDistance(self, 100) self:PlayFXEffect{effectType = "press"} local friends = self:GetObjectsInGroup{ group = "drum16" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 3571 then friends[i]:NotifyObject{ name = "repeatloop" } end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_a") end function onClientUse(self) self:PlayFXEffect{effectType = "down_a"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_a"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_asharp") end function onClientUse(self) self:PlayFXEffect{effectType = "down_asharp"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_asharp"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_b") end function onClientUse(self) self:PlayFXEffect{effectType = "down_b"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_b"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_c") end function onClientUse(self) self:PlayFXEffect{effectType = "down_c"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_c"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_c2") end function onClientUse(self) self:PlayFXEffect{effectType = "down_c2"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_c2"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_c2sharp") end function onClientUse(self) self:PlayFXEffect{effectType = "down_c2sharp"} end function onCollisionPhantomn (self,msg) self:PlayFXEffect{effectType = "down_c2sharp"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_csharp") end function onClientUse(self) self:PlayFXEffect{effectType = "down_csharp"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_csharp"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_d") end function onClientUse(self) self:PlayFXEffect{effectType = "down_d"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_d"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_dsharp") end function onClientUse(self) self:PlayFXEffect{effectType = "down_dsharp"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_dsharp"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_e") end function onClientUse(self) self:PlayFXEffect{effectType = "down_e"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_e"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_f") end function onClientUse(self) self:PlayFXEffect{effectType = "down_f"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_f"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_fsharp") end function onClientUse(self) self:PlayFXEffect{effectType = "down_fsharp"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_fsharp"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_g") end function onClientUse(self) self:PlayFXEffect{effectType = "down_g"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_g"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "click_gsharp") end function onClientUse(self) self:PlayFXEffect{effectType = "down_gsharp"} end function onCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "down_gsharp"} end function onOffCollisionPhantom (self,msg) self:PlayFXEffect{effectType = "up"} end require('o_mis') require('client/ai/NP/L_NP_NPC') require('client/ai/L_BOUNCER_BASIC') require('State') require('o_StateCreate') require('o_Main') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_01") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_01", effectType = "repeat_01" } storeObjectByName ( self, "repeat_effect", true ) UI:SendChat{ChatString = "Start", ChatType = "LOCAL", Timestamp = 500} end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_01" } storeObjectByName ( self, "repeat_effect", false ) UI:SendChat{ChatString = "Stop", ChatType = "LOCAL", Timestamp = 500} end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_02") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_02", effectType = "repeat_02" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_02" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_03") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_03", effectType = "repeat_03" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_03" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_04") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_04", effectType = "repeat_04" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_04" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_05") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_05", effectType = "repeat_05" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_05" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_06") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_06", effectType = "repeat_06" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_06" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_07") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_07", effectType = "repeat_07" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_07" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_08") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_08", effectType = "repeat_08" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_08" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_09") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_09", effectType = "repeat_09" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_09" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_10") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_10", effectType = "repeat_10" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_10" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_11") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_11", effectType = "repeat_11" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_11" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_12") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_12", effectType = "repeat_12" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_12" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_13") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_13", effectType = "repeat_13" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_13" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_14") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_14", effectType = "repeat_14" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_14" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_15") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_15", effectType = "repeat_15" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_15" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) SetMouseOverDistance(self, 60) AddInteraction(self, "mouseOverAnim", "bounce_16") end function onNotifyObject(self, msg) if msg.name == "repeatloop" then self:PlayFXEffect{ name = "repeat_16", effectType = "repeat_16" } storeObjectByName ( self, "repeat_effect", true ) end if msg.name == "stop" then if getObjectByName ( self, "repeat_effect") == true then self:StopFXEffect{ name = "repeat_16" } storeObjectByName ( self, "repeat_effect", false ) end end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = self:GetVar("springpad_bouncemod") local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end-------------------------------------------------------------- -- Description: -- -- Hints for the player at Club LEGO form Max. -- updated tgc... 6/04/10 -------------------------------------------------------------- require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_A")) --Click the arrow next to the circle at the top of the screen to see other missions you have. AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_B")) --Check your passport for achievements to do. Doing achievements will get you all kinds of cool stuff! AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_C")) --You can always smash yourself in the Help Menu if you want. It's fun! AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_D")) --If you can't collect stuff, check your backpack, it might be full. AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_E")) --You can fly to anywhere in LEGO Universe from here! AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_F")) --Have you tried racing yet? Check out the race in Gnarled Forest, it's a lot of fun! AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_G")) --If you collect all five hidden bricks in Nimbus, you'll get a bigger backpack! AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_H")) --Look for flower stalks on the ground. Spray them with water and flowers will grow. Grow enough and you'll get a reward! AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_I")) --Look through all the binoculars you find, there might be a reward for you. AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_J")) --When in Nimbus Station, try playing all the instruments for thirty seconds and see what happens. Rock out! AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_K")) --Be sure and explore everywhere. You'll get cool stuff for finding all the hidden areas. AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_L")) --There is a Gorilla Mech in Gnarled Forest that is tough to smash. Build the bricks he pulls up from the ground into an anchor to beat him. AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_M")) --Smash all the enemies you come across. There are added bonuses when you smash a lot of them. AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_N")) --Read all the message plates you come across to learn more about the LEGO Universe and you'll get something special for reading them all. AddInteraction(self, "interactionText", Localize("MAX_CLUBLEGO_CLICK_O")) --If you wear a Ninja cowl when using the rocket launcher to go to Forbidden Valley, you'll land near the tree instead of at the beginning. -- Proximity speech AddInteraction(self, "proximityText", Localize("MAX_CLUBLEGO_RANDOM_A")) --Welcome Club LEGO Member! AddInteraction(self, "proximityText", Localize("MAX_CLUBLEGO_RANDOM_B")) --This place is for Club LEGO members only, you're exclusive hang out spot. AddInteraction(self, "proximityText", Localize("MAX_CLUBLEGO_RANDOM_C")) --Explore this place and have fun! AddInteraction(self, "proximityText", Localize("MAX_CLUBLEGO_RANDOM_D")) --Being a Club member has tons of extra benifits. AddInteraction(self, "proximityText", Localize("MAX_CLUBLEGO_RANDOM_E")) --Talk to me and I'll give you hints for the game. end require('o_mis') local myPriority = 1 function onStartup(self) end function onScriptNetworkVarUpdate(self,msg) if msg.tableOfVars.name == "pushState" then UI:SendMessage( "pushGameState", {{"state", "dps_gui" }} ) myPriority = 0 self:RequestPickTypeUpdate() GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "StorePlayer", self ) elseif msg.tableOfVars.name == "popState" then UI:SendMessage( "popGameState", {{"state", "dps_gui" }} ) myPriority = 1 self:RequestPickTypeUpdate() elseif msg.tableOfVars.name == "TotalHealth" then UI:SendMessage("DPSGUI", {{"Total", tostring(msg.tableOfVars.int1) }} ) elseif msg.tableOfVars.name == "StateRunning" then UI:SendMessage("DPSGUI", {{"cstate","running"}} ) elseif msg.tableOfVars.name == "timer" then UI:SendMessage("DPSGUI", {{"timer",tostring(msg.tableOfVars.int1)}}) elseif msg.tableOfVars.name == "rest" then UI:SendMessage("DPSGUI", {{"resetall","1"}}) elseif msg.tableOfVars.name == "Current" then if msg.tableOfVars.int1 >= 1 then if msg.tableOfVars.String1 then UI:SendMessage("DPSGUI", { {"Current", tostring(msg.tableOfVars.int1) }, {"Average", msg.tableOfVars.String1 } } ) else UI:SendMessage("DPSGUI", { {"Current", tostring(msg.tableOfVars.int1) }} ) end else if msg.tableOfVars.String1 then UI:SendMessage("DPSGUI", {{"Current", "|0" }, {"Average", msg.tableOfVars.string1 } } ) else UI:SendMessage("DPSGUI", {{"Current", "|0" }} ) end end if msg.tableOfVars.int2 then UI:SendMessage("DPSGUI", {{"timer",tostring(msg.tableOfVars.int2)}}) end end end function onGetPriorityPickListType(self, msg) if ( myPriority == 1 ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 else msg.ePickType = -1 end return msg end function onTimerDone(self,msg) if msg.name == "StorePlayer" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage("DPSGUI", {{"user", tostring(player) }} ) UI:SendMessage("DPSGUI", {{"npc", "|"..tostring(self:GetID()) }} ) end end -- Saved Vars function GetMissionVars(self) self:SetVar("ConductCoolDown", false) self:SetVar("ConductTimer_Started",false) self:SetVar("Emote_onExitBuyActive",false) Emote = {emote = emote} end function IsLocalCharacter(target) return GAMEOBJ:GetLocalCharID() == target:GetID() end function CreateMissionStates(self) if self:GetVar('Miss.OverRideConduct') then self:SetProximityRadius { radius = self:GetVar("Miss.conductRadius") , name = "conductRadius" } end self:UseStateMachine{} -- Idle State MissionIdle = State.create() MissionIdle.onEnter = function(self) end MissionIdle.onArrived = function(self) end -- Emote State MissionEmote = State.create() MissionEmote.onEnter = function(self) -- self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } emote(self, getMyMissionTarget(self), self:GetVar("EmoteType") ) -- print(debug.traceback()) end MissionEmote.onArrived = function(self) end addState(MissionIdle, "MissionIdle", "MissionIdle", self) addState(MissionEmote, "MissionEmote", "MissionEmote", self) beginStateMachine("MissionIdle", self) MissionIdle.onEnter(self) end function onProximityUpdate(self, msg) if msg.objType == "Enemies" or msg.objType == "NPC" then --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// if msg.name == "conductRadius" and msg.status == "ENTER" and IsLocalCharacter(msg.objId) and msg.objId:GetFaction().faction == 1 then storeMissionTarget(self, msg.objId) self:FaceTarget{ target = msg.objId, degreesOff = 5, keepFacingTarget = true } local myMissionID = self:GetMissionForPlayer{playerID = msg.objId}.missionID local myMissionState = self:GetMissionForPlayer{playerID = msg.objId}.missionState if myMissionState == 1 or myMissionState == 9 then -- STATE_AV AILABLE local chat1Text = self:GetMissionData{missionID = myMissionID}.chat1 if ( chat1Text and chat1Text ~= nil and chat1Text ~= "" ) then self:DisplayChatBubble{wsText = chat1Text } end self:SetVar("EmoteType", "missionState1") setState("MissionEmote", self) end if myMissionState == 2 or myMissionState == 10 then-- STATE_ACTIVE local chat2Text = self:GetMissionData{missionID = myMissionID}.chat2 if ( chat2Text and chat2Text ~= nil and chat2Text ~= "" ) then self:DisplayChatBubble{wsText = chat2Text } end self:SetVar("EmoteType", "missionState2") setState("MissionEmote", self) end if myMissionState == 4 or myMissionState == 12 then -- READY_TO_COMPLETE local chat3Text = self:GetMissionData{missionID = myMissionID}.chat3 if ( chat3Text and chat3Text ~= nil and chat3Text ~= "" ) then self:DisplayChatBubble{wsText = chat3Text } end self:SetVar("EmoteType", "missionState3") setState("MissionEmote", self) end if myMissionState == 0 then -- STATE_COMPLETED -- self:DisplayChatBubble{wsText = "null" } -- self:SetVar("EmoteType", "I am Nil") -- setState("MissionEmote", self) end end end --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// end function storeMissionTarget(self, target) idString = target:GetID() finalID = "|" .. idString self:SetVar("myMissionTarget", finalID) end function getMyMissionTarget(self) targetID = self:GetVar("myMissionTarget") return GAMEOBJ:GetObjectByID(targetID) end function emote(self,target, skillType) self:SetVar("EmbeddedTime", self:GetAnimationTime{ animationID = "interact" }.time) self:PlayFXEffect {priority = 1.2, effectType = skillType} end onNotifyMission = function(self,msg) msg = msg end onTerminateInteraction = function(self, msg) if foo == nil then print("Closed the windows") end end ---------------------------------------------------------- --Script by Steve Y -- 7/22/10 --plays a cinematic when the player enters the instance ---------------------------------------------------------- function onPlayerAddedToWorldLocal(self, msg) local player = msg.playerID player:PlayCinematic { pathName = "IntroCam" } end-------------------------------------------------------------- -- Client side script for the lootable chest for the dragon fight. -- -- created by mrb... 7/23/10 -------------------------------------------------------------- -- local constants local sOpenFX = "glow" local sIdleFX = "idiot" local sInteractAnim = "open" local sDeathAnim = "death" local sCreateAnim = "create" function onRenderComponentReady(self, msg) -- play the spawn animation and idle fx self:PlayAnimation{animationID = sCreateAnim, bPlayImmediate = true} self:PlayFXEffect{name = "onCreate", effectType = sIdleFX} end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then -- dont show the icon if it's in use msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not bHide then -- show the icon, cancel notification, set isInUse to false self:SetVar('isInUse', false) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) end -- request the interaction update self:RequestPickTypeUpdate() end function onCheckUseRequirements(self, msg) -- only let the player use the chest one time if self:GetVar("isInUse") then msg.bCanUse = false end return msg end function onClientUse(self, msg) -- get the animation time for the timers local animTime = self:GetAnimationTime{animationID = sInteractAnim}.time -- turn off the interaction icon toggleActivatorIcon(self, true) -- play the open fx/animation self:PlayFXEffect{name = "openFX", effectType = sOpenFX} self:PlayAnimation{animationID = sInteractAnim, bPlayImmediate = true} -- add in timers to stop fx and remove the chest GAMEOBJ:GetTimer():AddTimerWithCancel(animTime, "killChest", self) GAMEOBJ:GetTimer():AddTimerWithCancel(2, "StopFX", self) end function onTimerDone(self, msg) if msg.name == "killChest" then -- get the animation time for the timers local animTime = self:GetAnimationTime{animationID = sDeathAnim}.time -- add timer to hide the chest GAMEOBJ:GetTimer():AddTimerWithCancel(animTime - 0.2, "HideChest", self) -- play death anim and stop the idle fx self:PlayAnimation{animationID = sDeathAnim, bPlayImmediate = true} self:StopFXEffect{name = "onCreate"} elseif msg.name == "StopFX" then --toggleActivatorIcon(self) -- stop the open fx self:StopFXEffect{name = "openFX"} elseif msg.name == "HideChest" then -- hide the chest self:SetVisible{visible = false, fadeTime = 0.2} end end ----------------------------------------------------------------------------- --candle script to turn the health billboard off ----------------------------------------------------------------------------- function onRenderComponentReady(self) self:SetNameBillboardState{bState = false } end-------------------------------------------------------------- -- Makes the blood ravens fly away when you get close. -- -- created mrb... 7/23/10 -------------------------------------------------------------- local sOnProximityAnim = "fly1" local sIdleProximityAnim = "fly2" local sOffProximityAnim = "fly3" -------------------------------------------------------------- -- Sent when the script is started. -------------------------------------------------------------- function onStartup(self,msg) -- set up the proximity radius, and pulse the proximity self:SetProximityRadius{radius = 45, name = "BloodRaven"} self:GetProximityObjects{name = "BloodRaven"} end -------------------------------------------------------------- -- Sent when a player enter/leave a Proximity Radius -------------------------------------------------------------- function onProximityUpdate(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check to see if we are the correct player if playerID ~= msg.objId:GetID() then return end -- is this the correct proximity if msg.name == "BloodRaven" then local sAnim = sOnProximityAnim -- set bAway if msg.status == "ENTER" then self:SetVar("bAway", true) elseif msg.status == "LEAVE" then sAnim = sOffProximityAnim self:SetVar("bAway", false) end -- start animating if we're ready to if not self:GetVar("bAnimating") then self:PlayAnimation{animationID = sAnim, bTriggerOnCompleteMsg = true} self:SetVar("bAnimating", true) end end end function onAnimationComplete(self, msg) -- done animating self:SetVar("bAnimating", false) if msg.animationID == sOnProximityAnim then -- done flying away, decide to go back or idle away if not self:GetVar("bAway") then self:PlayAnimation{animationID = sOffProximityAnim, bTriggerOnCompleteMsg = true} self:SetVar("bAnimating", true) else self:PlayAnimation{animationID = sIdleProximityAnim} end elseif msg.animationID == sOffProximityAnim then -- done flying back, should we fly away if self:GetVar("bAway") then self:PlayAnimation{animationID = sOnProximityAnim, bTriggerOnCompleteMsg = true} self:SetVar("bAnimating", true) self:SetVar("bAway", false) end end end ----------------------------------------------------------------------------- --client script to play effects on the crypt FX object ----------------------------------------------------------------------------- function onRenderComponentReady(self) self:FireEventServerSide{senderID = self, args = "DoorReady"} end-------------------------------------------------------------- -- script on the dojo master to turn on the icons of the other ninjas in the tree when you take his mission -- -- updated Brandi... 3/19/10 -------------------------------------------------------------- function onMissionDialogueOK(self, msg) if msg.missionID == 496 and msg.iMissionState <= 2 then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local DojoNPCs = self:GetObjectsInGroup{ group = 'DojoNinjas', ignoreSpawners = true }.objects for k,v in ipairs(DojoNPCs) do --print('fireEventt to ' .. v:GetName().name) v:FireEvent{senderID = self, args = 'showIcon'} end end end-------------------------------------------------------------- -- Description: -- -- Client script for FV Dragon Instance. -- Lets client know the object can be interacted with -- updated mrb... 7/16/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { releaseVersion = 182, -- which version release # the content should be made available for Beta 1 UI_Type = "FV_Dragon_01",} function onStartup(self) baseSetVars(self, tVars) end-------------------------------------------------------------- -- Script to change the fog settings in Forbidden Valley as the player moves up the tree -- -- updated Brandi... 2/8/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print ("You entered") LEVEL:SetLights( true, 0x476A72, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0x6B6B6B, --upper Hemi color false, { 0.84, -0.54, -0.08 }, --directional direction true, 0x0f2430, --fog color true, --modifying draw distances (all of them) 1.0, 50.0, --fog near min/max 300.0, 300.0, --fog far min/max 100.0, 100.0, --post fog solid min/max 100.0, 700.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\fv_tree_scene-skybox.nif", 3.0 -- blend time ) end-------------------------------------------------------------- -- Script to change the fog settings in Forbidden Valley as the player moves back down the tree -- -- updated Brandi... 2/8/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print ("You exited") LEVEL:SetLights( true, 0x3D4D75, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color false, 0x6B6B6B, --upper Hemi color false, { 0.84, -0.54, -0.08 }, --directional direction true, 0x0f2430, --fog color true, --modifying draw distances (all of them) 1.0, 100.0, --fog near min/max 550.0, 550.0, --fog far min/max 100.0, 600.0, --post fog solid min/max 100.0, 700.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\fv_tree_scene-skybox.nif", 3.0 -- blend time ) end-------------------------------------------------------------------- --script to turn the effects on and off for the gate -------------------------------------------------------------------- function onStartup(self) self:AddObjectToGroup{group = "Gate"} self:SetVar("AmPlayingFX", false) end function onNotifyObject(self, msg) if msg.name == "GateActive" and self:GetVar("AmPlayingFX") == false then --print("playing FX") self:SetVar("AmPlayingFX", true) self:PlayFXEffect{effectID = 2988, name = "GateSpawn", effectType = "create"} GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "StartFX", self ) elseif msg.name == "GateDown" and self:GetVar("AmPlayingFX") then --print("shutting off FX") self:SetVar("AmPlayingFX", false) self:StopFXEffect{name = "GateEnergy"} self:StopFXEffect{name = "GateEnergy2"} --self:StopFXEffect{name = "GateSpawn"} end end function onTimerDone(self, msg) if msg.name == "StartFX" then self:PlayFXEffect{effectID = 2242, name = "GateEnergy2", effectType = "create"} self:PlayFXEffect{effectID = 2243, name = "GateEnergy", effectType = "create"} end end require('o_mis') function onStartup(self) self:SetRegistrationForUIUpdate{ eEventType = "POSITION_CHANGE", iMinimapObjType = 9, bRegister = true } self:SetVar("interactDistance", dist) SetProximityDistance(self, 122) end function SetProximityDistance(self, dist) self:SetProximityRadius{radius = dist, name="animProx"} end ------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() and msg.name == "animProx" and self:IsInCombat().bInCombat == false then self:PlayAnimation{animationID = "prox"} end end end ----------------------------------------------------------------------- --volume that destroys the monster ----------------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("collided") local playerID = GAMEOBJ:GetControlledID():GetID() if (msg.objectID:GetID() == playerID) then GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "killMonster", self ) local volume = self:GetObjectsInGroup{group = "MonsterSpawnVolume", ignoreSpawners = true}.objects[1] if volume then volume:NotifyObject{name = "MonsterDespawned"} end local gate = self:GetObjectsInGroup{group = "Gate", ignoreSpawners = true}.objects[1] if gate then gate:NotifyObject{name = "GateActive"} end end end function onTimerDone(self, msg) if msg.name == "killMonster" then monster = self:GetObjectsInGroup{group = "Monster"}.objects[1] if monster then monster:Die() end end end------------------------------------------------------------------------- --spawns in the monster at the FV gate ------------------------------------------------------------------------- function onStartup(self) self:SetVar("HaveSpawned", false) self:AddObjectToGroup{group = "MonsterSpawnVolume"} end function onCollisionPhantom(self, msg) --print("collided") if self:GetVar("HaveSpawned") == false then self:SetVar("HaveSpawned", true) local spawnerobj = self:GetObjectsInGroup{group = "MonsterSpawn", ignoreSpawners = true}.objects[1] if spawnerobj then local pos = spawnerobj:GetPosition().pos local rot = spawnerobj:GetRotation() local config = {{"groupID", "Monster" }} RESMGR:LoadObject { objectTemplate = 9503 , x = pos.x , y = pos.y , z = pos.z , rw = rot.w, rx = rot.x , ry = rot.y , rz = rot.z , owner = self,configData = config } end local gate = self:GetObjectsInGroup{group = "Gate", ignoreSpawners = true}.objects[1] if gate then gate:NotifyObject{name = "GateDown"} end end end function onNotifyObject(self, msg) if msg.name == "MonsterDespawned" then self:SetVar("HaveSpawned", false) end end-------------------------------------------------------------- -- Script for Forbidden Valley Guards. There are two guards at the gate in FV. If you emote a "Roar" animation in front of either, the other laughs. -- edited eb... 6/25/10 Changed prox distance so you were only ever close to one of the guards -------------------------------------------------------------- require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 9) -- When approaching AddInteraction(self, "proximityAnim", "prox") -- Click on speech AddInteraction(self, "interactionText", Localize("GUARD_NINJA_CLICK_A")) --Only those wearing the proper attire may pass through the gate. AddInteraction(self, "interactionText", Localize("GUARD_NINJA_CLICK_B")) --Turn back now traveler, please don't smash any of our shrines around the gate. AddInteraction(self, "interactionText", Localize("GUARD_NINJA_CLICK_C")) --You are very brave for coming this far. AddInteraction(self, "interactionText", Localize("GUARD_NINJA_CLICK_D")) --Somewhere beyond this gate lies the Great Tree. AddInteraction(self, "interactionText", Localize("GUARD_NINJA_CLICK_E")) --Those floating platforms beneath the bridge look very unstable. -- Proximity speech AddInteraction(self, "proximityText", Localize("GUARD_NINJA_RANDOM_A")) --Look, another hopeless traveler. AddInteraction(self, "proximityText", Localize("GUARD_NINJA_RANDOM_B")) --I haven't seen a visitor here for a long time. AddInteraction(self, "proximityText", Localize("GUARD_NINJA_RANDOM_C")) --So many have tried to enter the Forbidden Valley, so few have survived. AddInteraction(self, "proximityText", Localize("GUARD_NINJA_RANDOM_D")) --This beast will crush any traveler without the proper attire. AddInteraction(self, "proximityText", Localize("GUARD_NINJA_RANDOM_E")) --I heard some pirates made it into the valley. end-------------------------------------------------------------- -- Foot Race script that -- updated mrb... 2/17/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT') local gVars = { pathName = "Foot_Race_Path_01", goalLot = 8575, obsticleLot = {--[[8572, 8578, 8579, 6214,--]]}, --6215, 8576, numOfObsticles = 2, finalGoalObsticleLot = 6216, sStopTooltipText = Localize("DOJO_FOOT_RACE_STOP_QUESTION"), sStartTooltipText = Localize("DOJO_FOOT_RACE_START_QUESTION"), sFirstGoalText = Localize("DOJO_FOOT_RACE_FIRST_GOAL"), sFinalGoalText = Localize("DOJO_FOOT_RACE_FINAL_GOAL"), startTime = 10, -- amount of time the player should start the race with addTime = 10, -- amount of time to add when the player hits a goal completedSetFlagNum = nil, -- sets the specified flag when the race is completed completedFireEventGroup = nil,} -- -ie- "PandaGroup" - calls FireEventServerSide message named Foot_Race_Completed to the group with the playerID as param1 -- these variabls are for setting up the goal posts only local tGoalpostVars = { goalpostLot = 3890, goalpostOffset = 5.2, -- how far right and left of the object to spawn in the goal posts. nextEffectID = 503, nextEffectType = "create",} ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function onStartup(self) setLocalVars(self, gVars, tGoalpostVars) baseStartup(self) end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self) end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function onClientUse(self, msg) baseClientUse(self, msg) end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function onTerminateInteraction(self, msg) baseTerminateInteraction(self, msg) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) baseMessageBoxRespond(self, msg) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function onFireEvent(self, msg) baseFireEvent(self, msg) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function onActivityTimerUpdate(self, msg) baseActivityTimerUpdate(self, msg) end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function onActivityTimerDone(self, msg) baseActivityTimerDone(self, msg) end -------------------------------------------------------------- -- Foot Race script that -- updated mrb... 2/17/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT') local gVars = { pathName = "Foot_Race_Path_02", goalLot = 8575, obsticleLot = {--[[8572, 8578, 8579, 6214,--]]}, --6215, 8576, numOfObsticles = 0, finalGoalObsticleLot = 6216, sStopTooltipText = Localize("PANDA_FOOT_RACE_STOP_QUESTION"), --Do you want to exit out of the race? sStartTooltipText = Localize("PANDA_FOOT_RACE_START_QUESTION"), --Do you think you can race from here to Panda Paw in time? sFirstGoalText = Localize("PARADOX_FOOT_RACE_FIRST_GOAL"), --Nice work! Follow the gates to Panda Paw! sFinalGoalText = Localize("PARADOX_FOOT_RACE_FINAL_GOAL"), --You finished the race! You're really fast! startTime = 10, -- amount of time the player should start the race with addTime = 10, -- amount of time to add when the player hits a goal completedSetFlagNum = nil, -- sets the specified flag when the race is completed completedFireEventGroup = nil,} -- -ie- "PandaGroup" - calls FireEventServerSide message named Foot_Race_Completed to the group with the playerID as param1 -- these variabls are for setting up the goal posts only local tGoalpostVars = { goalpostLot = 3890, goalpostOffset = 5.2, -- how far right and left of the object to spawn in the goal posts. nextEffectID = 503, nextEffectType = "create",} ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function onStartup(self) setLocalVars(self, gVars, tGoalpostVars) baseStartup(self) end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self) end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function onClientUse(self, msg) baseClientUse(self, msg) end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function onTerminateInteraction(self, msg) baseTerminateInteraction(self, msg) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) baseMessageBoxRespond(self, msg) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function onFireEvent(self, msg) baseFireEvent(self, msg) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function onActivityTimerUpdate(self, msg) baseActivityTimerUpdate(self, msg) end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function onActivityTimerDone(self, msg) baseActivityTimerDone(self, msg) end -------------------------------------------------------------- -- Foot Race script that -- updated mrb... 2/17/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT') local gVars = { pathName = "Foot_Race_Path_03", goalLot = 8575, obsticleLot = {--[[8572, 8578, 8579, 6214,--]]}, --6215, 8576, numOfObsticles = 0, finalGoalObsticleLot = 6216, sStopTooltipText = Localize("PANDA_FOOT_RACE_STOP_QUESTION"), --Do you want to exit out of the race? sStartTooltipText = Localize("PANDA_FOOT_RACE_START_QUESTION"), --Do you want to complete the Panda race for a chance to tame a Panda? sFirstGoalText = Localize("PANDA_FOOT_RACE_FIRST_GOAL"), --Nice work! Keep going! sFinalGoalText = Localize("PANDA_FOOT_RACE_FINAL_GOAL"), --You finished the race! Now you can tame a Panda! startTime = 5, -- amount of time the player should start the race with addTime = 5, -- amount of time to add when the player hits a goal completedSetFlagNum = nil, -- sets the specified flag when the race is completed completedFireEventGroup = "PandaPet",} -- -ie- "PandaGroup" - calls FireEventServerSide message named Foot_Race_Completed to the group with the playerID as param1 -- these variabls are for setting up the goal posts only local tGoalpostVars = { goalpostLot = 2164, goalpostOffset = 5.2, -- how far right and left of the object to spawn in the goal posts. nextEffectID = 503, nextEffectType = "create",} ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function onStartup(self) setLocalVars(self, gVars, tGoalpostVars) baseStartup(self) end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self) end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function onClientUse(self, msg) baseClientUse(self, msg) end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function onTerminateInteraction(self, msg) baseTerminateInteraction(self, msg) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) baseMessageBoxRespond(self, msg) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function onFireEvent(self, msg) baseFireEvent(self, msg) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function onActivityTimerUpdate(self, msg) baseActivityTimerUpdate(self, msg) end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function onActivityTimerDone(self, msg) baseActivityTimerDone(self, msg) end -------------------------------------------------------------- -- script on the ninjas in the tree to hide their icons until the player gets the mission from the dojo master to talk to them -- -- updated Brandi... 3/19/10 -------------------------------------------------------------- -- when the map loads, hide the mission icons of the ninjas in the tree is the player is not on the mission to talk to them function onSetIconAboveHead(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --see if the icons arent already hidden, and check if the player is has the precondition set if not self:GetVar('bHide') and not player:CheckPrecondition{PreconditionID = 104}.bPass and not player:CheckPrecondition{PreconditionID = 105}.bPass then self:SetVar('bHide', true) --set a value to true so this wont spam GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "startup", self ) end end -- fire event comes from the dojo master when you take the mission to take his mission to talk to the other ninjas function onFireEvent(self, msg) if msg.args == 'showIcon' then --print('showIcon') -- show the mission icon over the npcs head self:SetIconAboveHead{bIconOff = false, iconMode = 0, iconType = 1} end end function onTimerDone(self, msg) if (msg.name == "startup") then --print('hideIcon') -- hide the mission icon over the npcs head self:SetIconAboveHead{bIconOff = true, iconMode = 0, iconType = 1} end end function onCheckUseRequirements(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not player:CheckPrecondition{PreconditionID = 104}.bPass and not player:CheckPrecondition{PreconditionID = 105}.bPass then -- if the player doesnt have the talk to the tree ninjsa mission, show a chat bubble that says talk to the dojo master self:DisplayChatBubble{wsText = player:CheckPrecondition{PreconditionID = 104}.FailedReason} msg.bCanUse = false return msg end end-------------------------------------------------------------- -- Client side script on the panda pet -- this script controls the icon and interactablity of the panda -- only the player who spawned the panda show see the interact icon above the panda and be able to tame it -- created by Steve... -- created from Brandi's Lion script... 2/17/10 -------------------------------------------------------------- function onStartup(self) self:SetVar("Timer", 0.5) end function onGetPriorityPickListType(self, msg) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then msg.fCurrentPickTypePriority = myPriority -- if the player is the player who spawned the pet, then set the panda to be interactable to that player --print("on panda player is "..tostring(player:GetID())) --print("on panda tamer is "..tostring(self:GetVar("pandatamer"))) if player:GetFlag{iFlagID = 81}.bFlag == true and self:GetVar("localPandaTamer") == player:GetID() then msg.ePickType = 14 -- Interactive pick type else msg.ePickType = -1 end else --if the player is not the player who spawned the panda, the player can't interact with the panda msg.ePickType = -1 GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Timer") , "Time", self ) end end return msg end -- i have to do the back and forth with FireEventServerSide and FireEventClientSide because SetNetworkVar doesn't serialize properly function onStartup(self,msg) -- doing this because SetNetworkVar is busted and unserialized if self:IsPetWild{}.bIsPetWild == false then return end end function onScriptNetworkVarUpdate(self,msg) local pandatamer = msg.tableOfVars["pandatamer"] if pandatamer then local player = GAMEOBJ:GetControlledID() if player:GetID() == pandatamer then self:SetVar("localPandaTamer",player:GetID()) self:RequestPickTypeUpdate() end end end function onTimerDone(self, msg) if msg.name == "Time" then self:RequestPickTypeUpdate() end end-------------------------------------------------------------- -- Client Script on the ninjas in FV that were freed from GF -- this sets interaction text and visible state -- updated Brandi... 8/2/10 - kept one script on all ninjas, but makes only the ones that have been freed visible or not -------------------------------------------------------------- require('o_mis') require('client/ai/AG/L_AG_NPC') local freeMis = {LOT_9256 = 701,LOT_9298 = 702,LOT_9299 = 703,LOT_9300 = 704} function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- When mousing over AddInteraction(self, "mouseOverAnim", "wave") -- Click on speech AddInteraction(self, "interactionText", Localize("FREED_NINJA_CLICK_A")) AddInteraction(self, "interactionText", Localize("FREED_NINJA_CLICK_B")) AddInteraction(self, "interactionText", Localize("FREED_NINJA_CLICK_C")) AddInteraction(self, "interactionText", Localize("FREED_NINJA_CLICK_D")) AddInteraction(self, "interactionText", Localize("FREED_NINJA_CLICK_E")) -- Proximity speech AddInteraction(self, "proximityText", Localize("FREED_NINJA_RANDOM_A")) -- Ah, it's good to be home. AddInteraction(self, "proximityText", Localize("FREED_NINJA_RANDOM_B")) --The air is so much fresher here. AddInteraction(self, "proximityText", Localize("FREED_NINJA_RANDOM_C")) --Week after week, nothing but bananas. It's enough to turn your skin yellow. AddInteraction(self, "proximityText", Localize("FREED_NINJA_RANDOM_D")) --Thanks for helping me escape. AddInteraction(self, "proximityText", Localize("FREED_NINJA_RANDOM_E")) --That monkey was working for us, you know. end function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then -- check to see if the player has completed the free the ninja mission, and if so, replace the ninja with a dummy if player:GetMissionState{missionID = freeMis["LOT_"..self:GetLOT().objtemplate]}.missionState ~= 8 then --print("should set to invisible") --self:SetVisible{visible = false, fadeTime = 0} uncomment when setvisible includes accessories -- add timer to so hopefully the accessories will load in first, and then all of it get set invisible GAMEOBJ:GetTimer():AddTimerWithCancel(2, "setInvisible", self ) return end else --heartbeat time to see if the player is loaded yet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "startup", self ) end end function onTimerDone(self, msg) if (msg.name == "startup") then onRenderComponentReady(self) elseif (msg.name == "setInvisible") then self:SetVisible{visible = false, fadeTime = 0} end end-------------------------------------------------------------- -- Client Script pirates in FV, they dont render if the player has completed the mission for them -- created Brandi... 8/4/10 -------------------------------------------------------------- local freeMis = {LOT_8657 = 740,LOT_8658 = 741,LOT_8659 = 742} function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then -- check to see if the player has completed the free the ninja mission, and if so, replace the ninja with a dummy if player:GetMissionState{missionID = freeMis["LOT_"..self:GetLOT().objtemplate]}.missionState == 8 then GAMEOBJ:GetTimer():AddTimerWithCancel(2, "setInvisible", self ) return end else --heartbeat time to see if the player is loaded yet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "startup", self ) end end function onTimerDone(self, msg) if (msg.name == "startup") then onRenderComponentReady(self) elseif (msg.name == "setInvisible") then self:SetVisible{visible = false, fadeTime = 0} end end-------------------------------------------------------------------------- --Brick Fury chat bubble text on proximity script -------------------------------------------------------------------------- -- Proximity speech local chat = {Localize("NPC_BRICK_FURY_1"), Localize("NPC_BRICK_FURY_2"), Localize("NPC_BRICK_FURY_3")} --1 = I love the smell of Maelstrom in the morning! --2 = You want the Maelstrom? YOU CAN'T HANDLE THE MAELSTROM!! --3 = I'm Brick Fury, Mitch! function onStartup(self) self:SetProximityRadius{radius = 30} end function onRenderComponentReady(self) self:SetNameBillboardState{bState = false } end function onProximityUpdate(self, msg) local player = GAMEOBJ:GetControlledID() if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() then local chatNum = math.random(1 , #chat) self:DisplayChatBubble{wsText = chat[chatNum]} end endfunction onStartup(self) self:SetVar("AmBuilt", false) self:SetVar("AmActive", false) end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar("AmBuilt") == true and self:GetVar("AmActive") == false then --print("I am interactive now") msg.ePickType = 14 -- Interactive pick type elseif self:GetVar("AmActive") == true then --print("I'm not interactive") msg.ePickType = -1 end end return msg end function onClientUse(self, msg) --print("I am being used") if self:GetVar("AmActive") == false then if self:GetVar("AmBuilt") == true then --print("I'm built and active") self:SetVar("AmActive", true) self:RequestPickTypeUpdate() end end end function onRebuildNotifyState(self, msg) if msg.iState == 2 then --print("I am built now") self:SetVar("AmBuilt", true) self:RequestPickTypeUpdate() elseif msg.iState == 4 then --print("I am broken now") self:SetVar("AmBuilt", false) self:SetVar("AmActive", false) self:RequestPickTypeUpdate() end endfunction onCollisionPhantom(self, msg) -- Only the local player can collide with this if ( msg.objectID:GetID() == GAMEOBJ:GetLocalCharID() ) then --print("collided") local player = msg.objectID local msgcheck = player:CheckPrecondition{PreconditionID = 96, iPreconditionType = 0} if not msgcheck.bPass then --print("failed") player:DisplayTooltip { bShow = true, strText = msgcheck.FailedReason, iTime = 3000 } end --GAMEOBJ:DeleteObject(self) end endfunction onCollisionPhantom(self, msg) -- Only the local player can collide with this if ( msg.objectID:GetID() == GAMEOBJ:GetLocalCharID() ) then --print("collided") local player = msg.objectID local msgcheck = player:CheckPrecondition{PreconditionID = 63, iPreconditionType = 0} if not msgcheck.bPass then --print("failed") player:DisplayTooltip { bShow = true, strText = msgcheck.FailedReason, iTime = 3000 } end --GAMEOBJ:DeleteObject(self) end end-- Helper function that disables all of the CLUT timers and resets all effects back to a neutral state function DoDisableCLUTLightning(self) GAMEOBJ:GetTimer():CancelTimer( "StartCLUTLightning", self ) GAMEOBJ:GetTimer():CancelTimer( "StartFlash", self ) GAMEOBJ:GetTimer():CancelTimer( "EndFlash", self ) GAMEOBJ:GetTimer():CancelTimer( "EyeFlashAdjustment", self ) -- Reset our rendering back to untinted / unCLUT'ed LEVEL:CLUTEffect( "(none)", 0.0, 1.0, 0.0, false ) LEVEL:FadeEffect( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false ) end -- We start our effect when we hit the collision phantom function onCollisionPhantom(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "StartCLUTLightning", self ) end -- We disable our effect when we leave the collision phantom function onOffCollisionPhantom(self, msg) DoDisableCLUTLightning(self) end -- We also disable the effect if the script component is shut down for any reason function onShutdown(self) DoDisableCLUTLightning(self) end -- Timers control every aspect of the lightning; this is where the effect itself lives function onTimerDone(self, msg) if (msg.name == "StartCLUTLightning") then LEVEL:CLUTEffect( "GF_LightningLUT.dds", 0.2, 0.0, 1.0, false ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "StartFlash", self ) end if (msg.name == "StartFlash") then LEVEL:FadeEffect( 1.0, 1.0, 1.0, 0.4, 1.0, 1.0, 1.0, 0.1, 0.1, false ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EndFlash", self ) end if (msg.name == "EndFlash") then LEVEL:CLUTEffect( "(none)", 0.1, 1.0, 0.0, false ) LEVEL:FadeEffect( 1.0, 1.0, 1.0, 0.1, 1.0, 1.0, 1.0, 0.05, 0.1, false ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "EyeFlashAdjustment", self ) end if (msg.name == "EyeFlashAdjustment") then LEVEL:FadeEffect( 1.0, 1.0, 1.0, 0.05, 0.0, 0.0, 0.0, 0.0, 0.5, false ) -- We do this because random can't output a floating point value local randVal = math.random(0, 1000) / 1000.0; -- Start another flash some random period of time in the future, but we want "epic" times only. A short flash, a medium flash, and a long flash. -- (if we just set this as 0.1 to 10.0, double flashes would almost never happen) local chanceVal = math.random(0, 3) if (chanceVal <= 1) then -- With that <=1, quick flashes are twice as likely as the othe flashes, for extra epicness GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 + (randVal * 0.1), "StartCLUTLightning", self ) elseif (chanceVal == 2) then GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0 + (randVal * 3.0), "StartCLUTLightning", self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0 + (randVal * 10.0), "StartCLUTLightning", self ) end end end-- used to hide the life bars over the bomb crate smashable function onRenderComponentReady(self, msg) self:SetNameBillboardState{bState = false } end function onOnHit(self, msg) -- Make it look like we died on the client. self:PerformClientSideDeath{i64AttackerID = msg.attacker, directionRelative_AngleY = msg.directionRelative_AngleY, directionRelative_AngleXZ = msg.directionRelative_AngleXZ, directionRelative_Force = msg.directionRelative_Force, bDontFlagAsDead = true, deathType = msg.deathType } end require('o_mis') local oneTimeOnly = false; -- Something touches the phantom object function onCollisionPhantom(self, msg) --print("Collision Detected") -- define player local playerID = GAMEOBJ:GetLocalCharID() -- un-set this tutorial flag so that we can play it again in another level. --playerID:SetFlag{iFlagID = 27, bFlag = false } -- if the collision came from the player, and oneTimeOnly hasn't been set yet if (msg.objectID:GetID() == playerID and oneTimeOnly == false) then --print("inside if statement") -- define player again for some reason local player = msg.objectID -- Set the player flag 27 as false so that it thinks it hasn't been played before player:SetFlag{iFlagID = 28, bFlag = false } -- 27 is the double jumping controls tutorial player:Help{ iHelpID = 28 } oneTimeOnly = true end end local myPriority = 0.8 function onGetPriorityPickListType(self, msg) if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onCheckUseRequirements(self, msg) local check = msg.objIDUser:CheckPrecondition{PreconditionID = 44} if ( msg.isFromUI ) then msg.HasReasonFromScript = true msg.Script_Failed_Requirement = (check.bPass == false) if (check.bPass == false) then msg.Script_Reason = check.FailedReason end msg.Script_IconID = check.IconID; msg.Script_TargetAmount = check.TargetAmount; msg.Script_TargetLOT = check.TargetLOT; end if ( check.bPass == false) then msg.bCanUse = false return msg end end function onClientUse(self, msg) --print("player interacted") -- lock player, play cinematic, start animation group CapCannon local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() oPos.pos = self:GetPosition().pos oPos.pos.x = self:GetPosition().pos.x + (oDir.forward.x * -3) oPos.pos.y = self:GetPosition().pos.y oPos.pos.z = self:GetPosition().pos.z + (oDir.forward.y * -3) oPos.rot = self:GetRotation() player:SetPosition{pos = {x = oPos.pos.x, y = oPos.pos.y, z = oPos.pos.z}} player:SetRotation {x=oPos.rot.x,y=oPos.rot.y,z=oPos.rot.z,w=oPos.rot.w} player:PlayAnimation{ animationID = "cannon-strike", bPlayImmediate = true } player:SetUserCtrlCompPause{bPaused = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 1.6, "FireCannon",self ) -- This is the right way to terminate the interaction with the player in this -- case, however, our script interface won't let us set objectIDs to zero yet... --msg.targetObject = 0 end function onTimerDone (self,msg) if (msg.name == "FireCannon") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} player:SetUserCtrlCompPause{bPaused = false} local cineTime = tonumber(LEVEL:GetCinematicInfo("Cannon_Cam")) GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime, "cinematicTimer",self ) player:PlayCinematic { pathName = "Cannon_Cam" } local cannon = self:GetObjectsInGroup{ group = "SharkCannon" , ignoreSpawners = true}.objects --print(#cannon) if #cannon ~= 0 then cannon[1]:PlayAnimation{ animationID = "cannon", bPlayImmediate = true } end end if (msg.name == "cinematicTimer") then --print('should go back to gameplay') local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage( "popGameState", {{"state", "cinematic"}} ) end endrequire('o_mis') function onStartup(self) self:SetRegistrationForUIUpdate{ eEventType = "POSITION_CHANGE", iMinimapObjType = 9, bRegister = true } end --[[ function onRenderComponentReady(self, msg) self:PlayAnimation{animationID = "spawn"} end --]]require('o_mis') function onRenderComponentReady(self, msg) self:PlayAnimation{animationID = "spawn"} end function onRenderComponentReady(self, msg) --print('onRenderComponentReady') --sets the flag invisible to start the map self:SetVisible{ visible = false } end function onPhysicsComponentReady(self, msg) --sets the flag to not collidable with the player at the start of the map self:SetCollisionGroup{colGroup = 25} end function onNotifyClientObject(self,msg) --print('%%%%%%%%%%%%%%%%%%%%%%% onNotifyClientObject @@@@@@@@@@@@@@@@@@@@@@@@@@') --notification from L_GF_PET_TREASURE_NODE if msg.name == "changePhysics" then --set physics on --self:ActivatePhysics{bActive = true} self:SetCollisionGroup{ colGroup = 1 } --visibliy on --print('**************** the physics should change ****************************') self:SetVisible{visible = true } end endfunction onMissionDialogueOK(self,msg) --print('onMissionDialogueOK ' .. msg.iMissionState .. ' - ' .. msg.missionID) if msg.missionID == 228 and msg.bIsComplete == true then local player = msg.responder player:DisplayTooltip{ bShow = true, strText = "Collect Imagination to use as AMMO for your pistol.", iTime = 3000 } end endfunction onMissionDialogueOK(self,msg) --print('onMissionDialogueOK ' .. msg.iMissionState .. ' - ' .. msg.missionID) if msg.missionID == 381 then if msg.iMissionState < 2 then --print('give duck bricks') msg.responder:AddItemToInventory{iObjTemplate = 610, itemCount = 1} msg.responder:AddItemToInventory{iObjTemplate = 109, itemCount = 2} msg.responder:AddItemToInventory{iObjTemplate = 1199, itemCount = 1} msg.responder:AddItemToInventory{iObjTemplate = 576, itemCount = 1} msg.responder:AddItemToInventory{iObjTemplate = 72, itemCount = 2} --[[elseif msg.iMissionState == 4 then --print('player has ' .. msg.responder:GetInvItemCount{iObjTemplate = 6086}.itemCount .. ' thinking caps 1') if msg.responder:GetInvItemCount{iObjTemplate = 6086}.itemCount > 0 then print('remove thinking cap 1') -- thinking cap = 6086 msg.responder:RemoveItemFromInventory{iObjTemplate = 6086} end]]-- end end end -------------------------------------------------------------- -- Client Script on the jail cell doors in Gnarled Forest -- this script limits the doors to only being smashed by hammers from FV, -- and sends a message to the ninja inside that it can be interacted with -- updated Brandi... 2/22/10 -- updated mrb... 5/17/10 - removed updated health message -------------------------------------------------------------- --table of the 4 hammers the player could get in forbidden valley local hammers = { 2963,3014,3015,3016} function onRenderComponentReady(self) -- turn off the health bar above the jail cell door self:SetNameBillboardState{bState = false } self:SetVar("smashed",false) end function onOnHit(self,msg) local player = GAMEOBJ:GetControlledID() --makes sure the player is the only client to see this if msg.attacker:GetID() == player:GetID() and self:GetVar("smashed") == false then local item = player:GetEquippedItemType{ slot = "special_r" }.lotID local smash = false -- check to see if the player had one of the hammers equipped, door can only be smashed with one of the hammers for k,v in ipairs(hammers) do if item == v then smash = true break end end --if the player hit the door with one of the hammers if smash == true then self:Smash() self:SetVar("smashed",true) GAMEOBJ:GetTimer():AddTimerWithCancel(15, "unSmashTimer", self ) local mis385 = player:GetMissionState{missionID = 385}.missionState -- if the player is on the free or feed the ninjas mission, turn on the icon of the ninja behind the door if player:GetFlag{iFlagID = 68}.bFlag == true and mis385 >= 8 then local group = "Ninja"..self:GetVar("number") local ninja = self:GetObjectsInGroup{ group = group, ignoreSpawners = true }.objects[1] ninja:FireEventClientSide{ args = "doorbusted" } end end end end function UnSmashMe(self) if self:GetVar("smashed") == true then self:UnSmash{duration = 5} self:SetVar("smashed",false) local group = "Ninja"..self:GetVar("number") local ninja = self:GetObjectsInGroup{ group = group, ignoreSpawners = true }.objects[1] ninja:FireEventClientSide{ args = "doorRebuilt" } end end function onNotifyObject(self,msg) --notifyed from ninja that the player interacted with the ninja and stop the door from bring unsmashed if msg.name == "CancelTimer" then GAMEOBJ:GetTimer():CancelTimer("unSmashTimer", self) -- notify from the ninja to unsmash the jail door elseif msg.name == "unSmash" then UnSmashMe(self) end end function onTimerDone(self,msg) --timer on the door to unsmash itself if msg.name == "unSmashTimer" then UnSmashMe(self) end end -------------------------------------------------------------- -- Client Script on the ninjas in Gnarled Forest -- this script sets the icons and picktype of the ninjas depending on mission the player is on -- updated Brandi... 2/22/10 -- updated brandi 8/2/10 - undid the rotation of the spawned in dummy -- updated brandi 8/4/10 - added teleport animation to ninjas -------------------------------------------------------------- --missions on ninjas local feedMis = {LOT_6732 = 386,LOT_6733 = 387,LOT_6734 = 388,LOT_6736 = 390} local freeMis = {LOT_6732 = 701,LOT_6733 = 702,LOT_6734 = 703,LOT_6736 = 704} -- hides the icons above the players head, and set them uninteractable if they icons are turned off function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then -- check to see if the player has completed the free the ninja mission, and if so, replace the ninja with a dummy if player:GetMissionState{missionID = freeMis["LOT_"..self:GetLOT().objtemplate]}.missionState == 8 then HideNinja(self) return end else --heartbeat time to see if the player is loaded yet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "startup", self ) end end function onCheckUseRequirements(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:GetID() == msg.objIDUser:GetID() then local checkFeed = player:GetMissionState{missionID = feedMis["LOT_"..self:GetLOT().objtemplate]}.missionState local checkFree = player:GetMissionState{missionID = freeMis["LOT_"..self:GetLOT().objtemplate]}.missionState local check705 = player:GetMissionState{missionID = 705}.missionState -- if the player hasn't started the jailkeep missions if checkFeed < 2 or (checkFeed == 8 and checkFree < 2) then self:DisplayChatBubble{wsText = Localize("GF_NINJA_TALK_TO_JAILKEEP")} msg.bCanUse = false return msg -- if the player is done with the jailkeep missions, but hasnt started the free the ninjas missions elseif checkFeed > 4 and checkFree < 2 and check705 < 2 then self:DisplayChatBubble{wsText = Localize("GF_NINJA_GO_TO_FV")} msg.bCanUse = false return msg -- if the player is on the jailkeep missions, but hasn't broken the jailcell door down elseif checkFree < 6 and check705 > 1 and player:GetMissionState{missionID = 385}.missionState == 8 and not self:GetVar("doorBusted") then self:DisplayChatBubble{wsText = Localize("GF_NINJA_BREAK_DOOR_DOWN")} msg.bCanUse = false return msg end end end function onClientUse(self,msg) --sends a message to the jail door to cancel the smash door timer so the door doesnt get rebuilt while the player is interacting with the missiongiver local group = "JailCell0"..self:GetVar("number") local door = self:GetObjectsInGroup{ group = group, ignoreSpawners = true }.objects[1] door:NotifyObject{name = "CancelTimer"} end function onMissionDialogueOK(self,msg) -- if the player is completing a mission if msg.iMissionState == 4 then -- check to see if the mission the player is completing is a feed me mission, if it is, hide their icons and skip the rest if msg.missionID == feedMis["LOT_"..self:GetLOT().objtemplate] then self:SetVar("doorBusted", false) GAMEOBJ:GetTimer():AddTimerWithCancel(5, "TellDoorToUnSmash", self ) return end -- check to see if the mission is a free me mission if msg.missionID == freeMis["LOT_"..self:GetLOT().objtemplate] then --timer to let the ninja teleport effect play out GAMEOBJ:GetTimer():AddTimerWithCancel(2, "freeNinjas", self ) end end end function onMissionDialogueCancelled(self,msg) -- if the player canceled their mission, tell the door to unsmash GAMEOBJ:GetTimer():AddTimerWithCancel(5, "TellDoorToUnSmash", self ) end function onFireEventClientSide(self, msg) -- this is broken, because fire event gets sent to everyone ones client script -- events sent from the script on the jail keep and the 'free the ninjas' ninja if msg.args == 'doorbusted' then self:SetVar("doorBusted", true) elseif msg.args == "doorRebuilt" then self:SetVar("doorBusted", false) end end function HideNinja(self) local mypos = self:GetPosition().pos local myRot = self:GetRotation() self:SetVisible{visible = false, fadeTime = 0} local config = { { "groupID" , "dummy"..self:GetVar("number") } , { "renderCullingGroup" , "3" } } --this will be taken out on real script when i have the real dummy asset RESMGR:LoadObject { objectTemplate = 8565 , x = mypos.x , y = mypos.y+0.5 , z = mypos.z ,rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z,owner = self, bIsSmashable = false , configData = config} end function onTimerDone(self, msg) if (msg.name == "startup") then onRenderComponentReady(self) end -- set the ninja as invisible, spawn in the dummy ninja and cancel the timer on the door to reset if msg.name == "freeNinjas" then self:SetVar("doorBusted", false) self:PlayFXEffect{name = 'teleport', effectID = 98, effectType = "teleport"} self:PlayAnimation{ animationID = "brandi-is-queen" } GAMEOBJ:GetTimer():AddTimerWithCancel(self:GetAnimationTime{ animationID = "brandi-is-queen" }.time - 1.5, "HideNinja", self ) end if msg.name == "HideNinja" then HideNinja(self) local group = "JailCell0"..self:GetVar("number") local door = self:GetObjectsInGroup{ group = group, ignoreSpawners = true }.objects[1] door:NotifyObject{name = "CancelTimer"} GAMEOBJ:GetTimer():AddTimerWithCancel(15, "TellDoorToUnSmash", self ) end -- set the ninja as visible, and kill the dummy ninja if (msg.name == "TellDoorToUnSmash") then local group = "JailCell0"..self:GetVar("number") local door = self:GetObjectsInGroup{ group = group, ignoreSpawners = true }.objects[1] door:NotifyObject{name = "unSmash"} end end require('o_mis') --local bHasBeenUsed = false local bCINEMA_ONCE = false function onStartup(self) --print ("Cine Script Started!") -- Set variable on self to remember if the Rancher has been found --self:SetVar("RancherFound", false) end -- Something touches the phantom object function onCollisionPhantom(self, msg) --print ("Collision Detected") -- define player local playerID = GAMEOBJ:GetLocalCharID() --print (playerID) --print (msg.objectID:GetID()) if (msg.objectID:GetID() == playerID) then --print ("playerID triggered the collision") local player = msg.objectID -- Cinematic should only happen once - Cinema Once keeps it from getting more than one collision message, Tool-tip settings prevent it from ever re-occuring when player returns. if (bCINEMA_ONCE == false) then -- Update bool so that cinematic never plays again. bCINEMA_ONCE = true -- Disable player control and set a timer to return it --player:SetUserCtrlCompPause{bPaused = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 14.5 , "PauseTime", self ) -- Play cinematic. player:PlayCinematic { pathName = "LandingCam" } player:DisplayZoneSummary{sender = self, isZoneStart = true} end end end require('o_mis') function onRebuildNotifyState(self, msg) local player = msg.player if (msg.iState == 2) then -- Store player for later use in timers storeObjectByName(self, "SwingerClient", player) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "BeforeClientStart",self ) end end function onTimerDone(self, msg) local player = getObjectByName(self,"SwingerClient") if msg.name == "BeforeClientStart" then local oPos = { pos = "", rot = ""} oPos.pos = self:GetPosition().pos oPos.pos.x = self:GetPosition().pos.x oPos.pos.y = self:GetPosition().pos.y oPos.pos.z = self:GetPosition().pos.z oPos.rot = self:GetRotation() player:SetUserCtrlCompPause{bPaused = true} player:SetPosition{pos = {x = oPos.pos.x, y = oPos.pos.y, z = oPos.pos.z}} player:SetRotation {x=oPos.rot.x,y=oPos.rot.y,z=oPos.rot.z,w=oPos.rot.w} GAMEOBJ:GetTimer():AddTimerWithCancel( 6.25, "FinalClientCountdown", self ) elseif msg.name == "FinalClientCountdown" then local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() local degrees = 25 local rads = degrees * math.pi/180 local newPlayerRot = {x=0,y=rads,z=0} oPos.pos = self:GetPosition().pos oPos.pos.x = oPos.pos.x + (oDir.forward.x * 20.5) oPos.pos.y = oPos.pos.y + 12 oPos.pos.z = oPos.pos.z + (oDir.forward.z * 20.5) player:SetPosition{pos = {x = oPos.pos.x, y = oPos.pos.y, z = oPos.pos.z}} player:SetUserCtrlCompPause{bPaused = false} player:RotateObject{rotation = newPlayerRot} end end-------------------------------------------------------------- -- 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:GetEquippedItemType{ 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 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:GetEquippedItemType{ 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 -------------------------------------------------------------- -- Description: -- -- Client script for GF Race Instancer. -- Lets client know the object can be interacted with -- updated mrb... 3/23/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { releaseVersion = 183, -- which version release # the content should be made available for Beta 1 misID = 624, -- run the foot race to unlock missionState = 2, itemType = 8092, -- allow vehicles to start the racing failItem = Localize("MINIGAME_LOBBY_RACE_DRAG_ITEM_FAIL_MESSAGE"), UI_Type = "GF_Race_01", failText = Localize("MINIGAME_LOBBY_GF_RACE_FAIL_MESSAGE"), bUseBothInteractions = true,} -- if this is set to true then the player will be able to drag or click function onStartup(self) baseSetVars(self, tVars) end -------------------------------------------------------------- -- Description: -- -- Client script for AG Survival Instancer. -- Lets client know the object can be interacted with -- updated mrb... 1/26/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { -- misID = 629, -- run the foot race -- missionState = 8, itemType = 8092, -- allow vehicles to start the racing failItem = "Please drag a vehicle to the activator to start!", UI_Type = "GF_Race_01", failText = "Talk to Gangway Kelley to unlock this race.",} function onStartup(self) baseSetVars(self, tVars) end require('o_mis') --11 function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- exclusion checks if msg.objectID:GetID() ~= playerID then return end -- exclusion checks s local player = msg.objectID if not player:GetFlag{iFlagID = 36}.bFlag then player:SetUserCtrlCompPause{bPaused = true} player:PlayCinematic { pathName = "Ravine" } player:SetFlag{iFlagID = 36, bFlag = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 11, "CameraTimer", self ) end end function onTimerDone (self,msg) if (msg.name == "CameraTimer") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} end end -------------------------------------------------------------- -- Description: -- -- Client script for Shooting Gallery NPC in GF area. -- Lets client know the object can be interacted with -- updated mrb... 3/23/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { releaseVersion = 181, -- which version release # the content should be made available for Beta 1 misID = 230, missionState = 8, UI_Type = "GF_SG_01", failText = Localize("MINIGAME_LOBBY_GF_SG_FAIL_MESSAGE"),} function onStartup(self) baseSetVars(self, tVars) endlocal myPriority = 0.8 function onGetPriorityPickListType(self, msg) if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end-------------------------------------------------------------- -- Description: -- -- Client script for AG Survival Instancer. -- Lets client know the object can be interacted with -- updated mrb... 3/23/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { releaseVersion = 182, -- which version release # the content should be made available for Beta 1 misID = 381, missionState = 8, transferZoneID = 1301, UI_Type = "GF_Survival_01", failText = Localize("MINIGAME_LOBBY_GF_SUVIVAL_FAIL_MESSAGE"),} function onStartup(self) baseSetVars(self, tVars) end -------------------------------------------------------------- -- Client side script on the object to spawn the lion pet -- this script controls the interactablity of the object -- created by Brandi... 2/17/10 -------------------------------------------------------------- function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetControlledID() --check to see if the player is loaded before setting the pick type on the lion spawner object -- if i don't do this check, the pick type runs before the player is loaded, and the flag check always fails if player:Exists() then self:RequestPickTypeUpdate() else --heartbeat time to see if the player is loaded yet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if player:Exists() then --check to see if the player has the flag set to spawn the lion if player:GetFlag{iFlagID = 67}.bFlag == true then --and #lions < 1 then msg.ePickType = 14 -- Interactive pick type else msg.ePickType = -1 end end end --set the picktype on the object for the check within the timer to make sure not to run the script unnecessarily self:SetVar{"picktype",msg.ePickType} return msg end function onFireEventClientSide(self,msg) --display popup window letting the player know they can't spawn another lion --two messages, one saying the player cant spawn more than one lion at a time and one saying that there are too many lions spawned --right now both messages are the same, but eventually they should be different local player = GAMEOBJ:GetControlledID() if msg.args == "tooManyLions" then if player:GetID() == msg.senderID:GetID() then --print("There are too many lions right now, try again in a few minutes") player:DisplayTooltip{ bShow = true, strText = Localize("LION_SUMMON_FAIL"), iTime = 300 } end end end function onTimerDone(self, msg) local oldPickType = self:GetVar{"picktype"} pickType = -1 if ( msg.name == "UpdateIcons" ) then --print("PickType=" .. tostring(pickType) .. ", oldPickType=" ..tostring(oldPickType)) if oldPickType and (pickType ~= oldPickType) then onRenderComponentReady(self) GAMEOBJ:GetTimer():CancelTimer("UpdateIcons", self ) else --rerun the render component ready to see if the player has loaded yet onRenderComponentReady(self) end end endfunction onPhysicsComponentReady(self, msg) self:FireEventServerSide{args = 'physicsReady'} end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Beach area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetLights( true, 0xFFFFFF, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.17, -0.81, 0.56 }, --directional direction true, 0x84c9ff, --fog color true, --modifying draw distances (all of them) 350.0, 350.0, --fog near min/max 2000.0, 2000.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 1500.0, 2500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_gen_sky_lightblue.nif", 1.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Beach area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function DoDisableCLUTSun(self) GAMEOBJ:GetTimer():CancelAllTimers(self ) -- Reset our rendering back to untinted LEVEL:CLUTEffect( "(none)", 0.0, 1.0, 0.0, false ) end function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetSkyDome("mesh/env/env_sky_ra_gf-beach.nif") LEVEL:SetLights( true, 0xFFFFFF, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.18, -0.52, 0.83 }, --directional direction true, 0xd1f6ff, --fog color true, --modifying draw distances (all of them) 200.0, 200.0, --fog near min/max 1600.0, 1600.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf-beach.nif", 1.0 -- blend time ) -- Starting the fade on phantom collision GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "StartCLUTSun", self ) end end -- Timer controlling and calling the Sun Fade function onTimerDone(self, msg) if (msg.name == "StartCLUTSun") then LEVEL:CLUTEffect( "LUT_2xsunny.dds", 0.5, 0.0, 1.0, false) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "EndCLUTSun", self ) end if (msg.name == "EndCLUTSun") then LEVEL:CLUTEffect( "(none)", 4, 1.0, 0.0, false ) end end -- We disable the effect if the script component is shut down for any reason function onShutdown(self) DoDisableCLUTSun(self) end -------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Dock area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0xD1D0B1, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.20, -0.58, 0.79 }, --directional direction true, 0xA8C4DB, --fog color true, --modifying draw distances (all of them) 0.0, 0.0, --fog near min/max 1000.0, 1000.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_gen_sky_lightblue.nif", 1.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Start area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0xFFFFFF, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.65, -0.52, 0.55 }, --directional direction true, 0x2f3568, --fog color true, --modifying draw distances (all of them) 00.0, 00.0, --fog near min/max 600.0, 600.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf.nif", 2.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Start area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0xFFFFFF, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.65, -0.52, 0.55 }, --directional direction true, 0x3c87c1, --fog color true, --modifying draw distances (all of them) 200.0, 200.0, --fog near min/max 1200.0, 1200.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf.nif", 1.5 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings and CLUT in GF Racetrack as the player ENTERS Skull range -- -- updated NateS... 3/24/10 -------------------------------------------------------------- function DoDisableCLUTSkull(self) GAMEOBJ:GetTimer():CancelAllTimers(self ) -- Reset our rendering back to untinted / unCLUT'ed LEVEL:CLUTEffect( "(none)", 0.0, 1.0, 0.0, false ) end function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0xFFFFFF, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.65, -0.52, 0.55 }, --directional direction true, 0xff6a12, --fog color true, --modifying draw distances (all of them) 00.0, 00.0, --fog near min/max 800.0, 800.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf.nif", 2.0 -- blend time ) -- Starting the clut on phantom collision GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "StartCLUTSkull", self ) end end -- Timer controlling and calling the CLUT function onTimerDone(self, msg) if (msg.name == "StartCLUTSkull") then LEVEL:CLUTEffect( "flamin_skull_lut_gamefile.dds", 4, 0.0, 1.0, false) GAMEOBJ:GetTimer():AddTimerWithCancel( 4, "EndCLUTSkull", self ) end if (msg.name == "EndCLUTSkull") then LEVEL:CLUTEffect( "(none)", 4, 1.0, 0.0, false ) end end -- We disable the effect if the script component is shut down for any reason function onShutdown(self) DoDisableCLUTSkull(self) end -------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Ravine area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0xFFFFFF, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { -0.81, -0.52, -0.25 }, --directional direction true, 0x193960, --fog color true, --modifying draw distances (all of them) 0.0, 0.0, --fog near min/max 1000.0, 1000.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 1500.0, 1500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_gen_sky_lightblue.nif", 1.5 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Beach area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetSkyDome("mesh/env/env_sky_ra_gf.nif") LEVEL:SetLights( true, 0x315596, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.18, -0.52, 0.83 }, --directional direction true, 0x122d4c, --fog color true, --modifying draw distances (all of them) 00.0, 00.0, --fog near min/max 1000.0, 800.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf.nif", 3.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Start area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function DoDisableCLUTSun(self) GAMEOBJ:GetTimer():CancelAllTimers(self ) -- Reset our rendering back to untinted LEVEL:CLUTEffect( "(none)", 0.0, 1.0, 0.0, false ) end function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0xFFFFFF, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.65, -0.52, 0.55 }, --directional direction true, 0xb2dcff, --fog color true, --modifying draw distances (all of them) 200.0, 200.0, --fog near min/max 2000.0, 2000.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf.nif", 1.0 -- blend time ) -- Starting the fade on phantom collision GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "StartCLUTSun", self ) end end -- Timer controlling and calling the Sun Fade function onTimerDone(self, msg) if (msg.name == "StartCLUTSun") then LEVEL:CLUTEffect( "LUT_2xsunny.dds", 0.5, 0.0, 1.0, false) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "EndCLUTSun", self ) end if (msg.name == "EndCLUTSun") then LEVEL:CLUTEffect( "(none)", 4, 1.0, 0.0, false ) end end -- We disable the effect if the script component is shut down for any reason function onShutdown(self) DoDisableCLUTSun(self) end -------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Start area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0x312b26, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.65, -0.52, 0.55 }, --directional direction true, 0x7a6556, --fog color true, --modifying draw distances (all of them) 00.0, 00.0, --fog near min/max 700.0, 700.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf.nif", 1.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Beach area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetLights( true, 0x243328, --ambient color false, 0x919191, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.18, -0.52, 0.83 }, --directional direction true, 0x344c47, --fog color true, --modifying draw distances (all of them) 00.0, 00.0, --fog near min/max 600.0, 600.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 3500.0, 3500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_sky_ra_gf.nif", 1.5 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog settings in GF Racetrack as the player ENTERS Trench area -- -- updated SeanB... 3/18/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then --print ("You entered") LEVEL:SetLights( true, 0x535e6b, --ambient color false, 0x000000, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.20, -0.58, 0.79 }, --directional direction true, 0x181b35, --fog color true, --modifying draw distances (all of them) 00.0, 00.0, --fog near min/max 600.0, 600.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 1500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\env_gen_sky_lightblue.nif", 1.0 -- blend time ) end end require('o_mis') require('c_GnarledForest') --------------------------------------------------------------------------------------------------------- -- Client-side script for Concert Props Choice Builds. Each prop can be built into 1 of 4 types. -- If all 4 are built into the same thing, the Stage transforms, and 30 seconds later they all return to their "default" state (the object's render component) -- Based on scripts\client\ai\YRK\L_TB_BENCH.lua -- 5023 AG - Stage Rocket OLD 4029 AG Fog Machine Choice Build -- 4891 AG - Stage Spot Light OLD 4030 AG Spotlight Choice Build -- 5024 AG - Stage laser OLD 4031 AG Laser Light Choice Build -- 4858 AG - Speaker OLD 4032 AG Speaker Choice Build -- Destructible component 348 --------------------------------------------------------------------------------------------------------- -- All the lot nums for the prop choicebuilds function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) --make sure we have enough imagination if msg.user:GetImagination{}.imagination > 0 then -- Send every LOT number that isn't us local ournum = 1; -- Store all the lots nums that arent us -- TODO This should be in a table so that it would be dynamic, but not sure how to store one with SetVar yet local slot = self:GetVar("ourslot") for i = 1, #LOT_NUMS[slot] do if(self:GetVar("ourlotnum") ~= LOT_NUMS[slot][i]) then if(ournum == 1) then self:SetVar("lot1", LOT_NUMS[slot][i]) elseif(ournum == 2) then self:SetVar("lot2", LOT_NUMS[slot][i]) elseif(ournum == 3) then self:SetVar("lot3", LOT_NUMS[slot][i]) end ournum = ournum + 1 --local nextLot = #OUR_LOTNUMS + 1 --OUR_LOTNUMS[nextLot] = LOT_NUMS[i] end end print ("in onclientuse") UI:DisplayTripleBuild( self, true, { self:GetVar("lot1"), self:GetVar("lot2"), self:GetVar("lot3") } ) print ( tostring(self:GetVar("lot1")).. tostring(self:GetVar("lot2")).. tostring(self:GetVar("lot3"))) print("Displaying UI - -- ---- -------------------------------------") --UI:DisplayTripleBuild( self, true, { OUR_LOTNUMS[1], OUR_LOTNUMS[2], OUR_LOTNUMS[3] } ) else --display tooltip msg.user:DisplayTooltip { bShow = true, strText = Localize("AG_TOOLTIP_CON_IMAGINATION"), iTime = 5000 } end end --[[ function onStartup(self) -- Save our LOT number self:SetVar("ourlotnum", self:GetLOT{}.objtemplate) for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(self:GetVar("ourlotnum") == LOT_NUMS[i][a]) then self:SetVar("ourslot", i) return end end end end ]]------------------------------------------------------------ --plays a cinematic when the player enters a volume ---------------------------------------------------------- function onStartup(self) self:SetVar("HavePlayed", false) end function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetControlledID() if (msg.objectID:GetID() == playerID:GetID()) then --print ("playerID triggered the collision") local player = msg.objectID if self:GetVar("HavePlayed") == false then self:SetVar("HavePlayed", true) player:PlayCinematic { pathName = "IntroCam_3" } end end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- -------------------------------------------------------------- -- On collision -------------------------------------------------------------- function onCollision(self, msg) -- always ignore collision msg.ignoreCollision = true return msg end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["PROJECTILE_LOT"] = 1822 -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- ignore projectiles if (msg.objectID:GetLOT() == CONSTANTS["PROJECTILE_LOT"]) then msg.ignoreCollision = true return msg end end --L_ACT_CANNON.lua -- Client Side -- global vars ------------------------------- local platformTemplateID = 1863 function onStartup(self) -- Spawn the platform -- local mypos = self:GetPosition().pos -- RESMGR:LoadObject { -- objectTemplate = platformTemplateID, -- x = mypos.x, -- y = mypos.y, -- z = mypos.z, -- rw = 1, -- owner = self -- } -- Load client side parameters Here end -- For the cannon, we rotate the object to face the aim position function onShootingGalleryClientAimUpdate(self, msg) -- do nothing end -------------------------------------------------------------- -- Description: -- -- Client script for Shooting Gallery NPC in GF area. -- Lets client know the object can be interacted with -- -------------------------------------------------------------- require('client/c_CannonInstancer') function onStartup(self) Initialize(self) self:SetProximityRadius{radius = 15} end function onProximityUpdate(self, msg) if msg.status == "LEAVE" then local player = msg.objId local localPlayer = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) if player:GetName().name == localPlayer:GetName().name then UI:SendMessage("HideHT", {{"HIDE", true }} ) end end end function onNotifyClientObject(self,msg) if msg.name == "Clicked" and GAMEOBJ:GetLocalCharID() == msg.paramObj:GetID() then local player = msg.paramObj:GetID() local finalID = "|" .. player UI:SendMessage("EnterSG", {{"user", finalID }} ) end if msg.name == "PreconditionFail" and GAMEOBJ:GetLocalCharID() == msg.paramObj:GetID() then msg.paramObj:DisplayTooltip{ bShow = true, strText = "Collect cannonballs to play the Shooting Gallery!", iTime = 0 } end end function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg endrequire('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Client side script for GF SG Effects --// - Hides the effect actors --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) -- instant hide of object self:SetVisible { visible = false, fadeTime = 0 } end --L_ACT_CANNON.lua -- Client Side -- global vars ------------------------------- local platformTemplateID = 1863 function onStartup(self) -- Spawn the platform -- local mypos = self:GetPosition().pos -- RESMGR:LoadObject { -- objectTemplate = platformTemplateID, -- x = mypos.x, -- y = mypos.y, -- z = mypos.z, -- rw = 1, -- owner = self -- } -- Load client side parameters Here end -- For the cannon, we rotate the object to face the aim position function onShootingGalleryClientAimUpdate(self, msg) -- do nothing end --L_ACT_CANNON.lua -- Client Side -- global vars ------------------------------- local platformTemplateID = 1863 function onStartup(self) -- Spawn the platform -- local mypos = self:GetPosition().pos -- RESMGR:LoadObject { -- objectTemplate = platformTemplateID, -- x = mypos.x, -- y = mypos.y, -- z = mypos.z, -- rw = 1, -- owner = self -- } -- Load client side parameters Here end -- For the cannon, we rotate the object to face the aim position function onShootingGalleryClientAimUpdate(self, msg) -- do nothing end --L_ACT_CANNON.lua -- Client Side -- global vars ------------------------------- local platformTemplateID = 1863 function onStartup(self) -- Spawn the platform -- local mypos = self:GetPosition().pos -- RESMGR:LoadObject { -- objectTemplate = platformTemplateID, -- x = mypos.x, -- y = mypos.y, -- z = mypos.z, -- rw = 1, -- owner = self -- } -- Load client side parameters Here end -- For the cannon, we rotate the object to face the aim position function onShootingGalleryClientAimUpdate(self, msg) -- do nothing end function onCollision(self, msg) local target = msg.objectID --UI:SendChat{ChatString = "Collision!", ChatType = "LOCAL", Timestamp = 500} local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then local vecString = self:GetVar("bouncer_destination") local speed = self:GetVar("bouncer_speed") if vecString and speed then -- Parse the vector3 from the level file into three floats local posX, posY, posZ = string.match(vecString, "(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)") -- Create a vector in Lua to pass in message local vec = {x = posX, y = posY, z = posZ} target:BouncePlayer{niDestPt = vec, fSpeed = speed} end end msg.ignoreCollision = true return msg end --SUPER HACK!! (WE'RE SO AWESOME) --Should use a message specifically to set bouncer params function onEmotePlayed(self, msg) x, y, z, speed = string.match(msg.emoteID, "(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)#(%d+)") vector = x .. '\031' .. y .. '\031' .. z self:SetVar("bouncer_destination", vector) self:SetVar("bouncer_speed", speed) endfunction onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then local vecString = self:GetVar("bouncer_destination") -- Parse the vector3 from the level file into three floats local posX = 176 local posY = 751 local posZ = -441 local speed = 95 -- Create a vector in Lua to pass in message local vec = {x = posX, y = posY, z = posZ} target:BouncePlayer{niDestPt = vec, fSpeed = speed} end msg.ignoreCollision = true return msg endfunction onCollision(self, msg) msg.ignoreCollision = true return msg end function onStartup(self) local oPos = self:GetPosition().pos print("********** Warning **********") print("Hello my name is: " .. self:GetName().name) print("I'm located at: x = " .. oPos.x .. " y = " .. oPos.y .. " z = " .. oPos.z) print("Please remove L_ACT_DEAD_WATER_TEAM_4.lua from my client side script in HF.") print("Thank You") print("*****************************") endfunction onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then GAMEOBJ:GetZoneControlID():UpdateMissionTask{taskType = "Win", value = GAMEOBJ:GetSystemTime(), target = self} end msg.ignoreCollision = true return msg end-- Script that can be attached to any misison giver on the client in HF. Config data -- variables must be set in HF. missionID, cinemaName, cinemaTime -- Created: 4/09/09 mrb... --////////////////////////////////////////////////////////////////////////////////// -- local variables local missionID = '' -- missionID from DB local cinemaName = '' -- name of cinematic in HF local cinemaTime = '' -- time of cinematic and to release player local player = '' --////////////////////////////////////////////////////////////////////////////////// function onStartup(self) -- get the varables set in HF in the mission givers configData, if mission print error missionID = self:GetVar("missionID") -- missionID from DB if missionID == '' then print('Missing missionID in ConfigData') end cinemaName = self:GetVar("cinemaName") -- name of cinematic in HF if cinemaName == '' then print('Missing cinemaName in ConfigData') end cinemaTime = self:GetVar("cinemaTime") -- time of cinematic and to release player if cinemaTime == '' then print('Missing cinemaTime in ConfigData') end player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- the player end function onMissionDialogueOK(self, msg) if not missionID or not cinemaName or not cinemaTime then return end if msg.bIsComplete == false and msg.missionID == missionID then -- freeze player and play cinematic player:SetUserCtrlCompPause{bPaused = true} player:PlayCinematic { pathName = cinemaName } -- start timer to release player movement GAMEOBJ:GetTimer():AddTimerWithCancel( cinemaTime, "missionCamera",self ) end end function onTimerDone (self,msg) if (msg.name == "missionCamera") then -- release player movement player:SetUserCtrlCompPause{bPaused = false} end end ---- Script that can be attached to any misison giver on the client in HF. Config data ---- variables must be set in HF. missionID, cinemaName, cinemaTime ---- Created: 6/16/09 mrb... ----////////////////////////////////////////////////////////////////////////////////// ---- local variables local missionCamDist = 10 -- distance to teleport player away from npc local npcName = '' -- name of the npc giving in the Config Data of HF local player = '' ----////////////////////////////////////////////////////////////////////////////////// function onStartup(self) -- get the varables set in HF in the mission givers configData, if mission print error npcName = self:GetVar('npcName') -- name of npc in HF if npcName == '' then print('Missing npcName in ConfigData') end player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- the player local oRot = self:GetRotation() self:SetVar('rotX', oRot.x) self:SetVar('rotY', oRot.y) self:SetVar('rotZ', oRot.z) self:SetVar('rotW', oRot.w) end function onClientUse(self, msg) self:SetRotation{x = self:GetVar('rotX'), y = self:GetVar('rotY'), z = self:GetVar('rotZ'), w = self:GetVar('rotW')} --local oPos = self:GetPosition() --local teleOffset = missionCamDist + 5 --local oDir = self:GetObjectDirectionVectors() --local telePos = {x = oPos.pos.x + (oDir.forward.x * teleOffset), y = oPos.pos.y, z = oPos.pos.z + (oDir.forward.z * teleOffset)} self:SetVar('DialogueOK', false) --player:Teleport{pos = camPos} player:SetVisible{visible = false, fadeTime = 0.5} player:PlayCinematic { pathName = 'MissionDisplay_' .. self:GetVar('npcName') .. '_Cam' } end function onMissionDialogueOK(self, msg) if not npcName then return end player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.5} self:SetVar('DialogueOK', true) --if msg.bIsComplete == false then -- player:SetUserCtrlCompPause{bPaused = true} --end end function onNotifyMission(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.missionState <= 1 then player:PlayCinematic { pathName = 'MissionDisplay_' .. self:GetVar('npcName') .. '_Cam' } player:SetVisible{visible = false, fadeTime = 0.5} end end function onTerminateInteraction(self, msg) if self:GetVar('DialogueOK') then return end player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.5} end function onMissionDialogueCancelled(self, msg) player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.5} end-- Script that can be attached to any misison giver on the client in HF. Config data -- variables must be set in HF. missionID, cinemaName, cinemaTime -- Created: 6/16/09 mrb... --////////////////////////////////////////////////////////////////////////////////// -- local variables local missionCamDist = 10 -- distance to teleport player away from npc local missionID = '' -- missionID from DB local cinemaName = '' -- name of cinematic in HF local cinemaTime = '' -- time of cinematic and to release player local player = '' --////////////////////////////////////////////////////////////////////////////////// function onStartup(self) -- get the varables set in HF in the mission givers configData, if mission print error missionID = self:GetVar('missionID') -- missionID from DB if missionID == '' then print('Missing missionID in ConfigData') end cinemaName = self:GetVar('cinemaName') -- name of cinematic in HF if cinemaName == '' then print('Missing cinemaName in ConfigData') end cinemaTime = self:GetVar('cinemaTime') -- time of cinematic and to release player if cinemaTime == '' then print('Missing cinemaTime in ConfigData') end player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- the player local oRot = self:GetRotation() self:SetVar('rotX', oRot.x) self:SetVar('rotY', oRot.y) self:SetVar('rotZ', oRot.z) self:SetVar('rotW', oRot.w) end function onClientUse(self, msg) self:SetRotation{x = self:GetVar('rotX'), y = self:GetVar('rotY'), z = self:GetVar('rotZ'), w = self:GetVar('rotW')} --local oPos = self:GetPosition() --local teleOffset = missionCamDist + 5 --local oDir = self:GetObjectDirectionVectors() --local telePos = {x = oPos.pos.x + (oDir.forward.x * teleOffset), y = oPos.pos.y, z = oPos.pos.z + (oDir.forward.z * teleOffset)} self:SetVar('DialogueOK', false) --player:Teleport{pos = camPos} player:SetVisible{visible = false, fadeTime = 0.5} player:PlayCinematic { pathName = 'MissionDisplay_' .. self:GetVar('npcName') .. '_Cam' } end function onMissionDialogueOK(self, msg) if not missionID or not cinemaName or not cinemaTime then return end player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.5} local bComplete = self:GetVar('PlayOnComplete') if not bComplete then bComplete = false end if msg.bIsComplete == bComplete and msg.missionID == self:GetVar('missionID') then self:SetVar('DialogueOK', true) -- freeze player and play cinematic player:SetUserCtrlCompPause{bPaused = true} player:PlayCinematic { pathName = self:GetVar('cinemaName') } -- start timer to release player movement GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar('cinemaTime'), 'missionCamera',self ) end end function onNotifyMission(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.missionState <= 1 then player:PlayCinematic { pathName = 'MissionDisplay_' .. self:GetVar('npcName') .. '_Cam' } player:SetVisible{visible = false, fadeTime = 0.5} end end function onMissionDialogueCancelled(self, msg) player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.5} end function onTimerDone (self,msg) if (msg.name == 'missionCamera') then -- release player movement player:SetUserCtrlCompPause{bPaused = false} end end function onTerminateInteraction(self, msg) if self:GetVar('DialogueOK') then return end player:EndCinematic() player:SetVisible{visible = true, fadeTime = 0.5} endrequire('o_mis') require('client/ai/NP/L_NP_NPC') -------------------------------------------------------------- -- Description: -- -- Client script for Shooting Gallery NPC in GF area. -- Lets client know the object can be interacted with -- -------------------------------------------------------------- -------------------------------------------------------------- -- Handle this message to override pick type -------------------------------------------------------------- function onStartup(self) AddInteraction(self, "interactionAnim", "greet") end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) local strText = "Enter Pet Ranch?" -- show a dialog box local args = { {"bShow", true}, {"imageID", 3}, {"callbackClient", self}, {"text", strText}, {"strIdentifier", "Pet_Ranch_Start"} } UI:SendMessage("DisplayMessageBox", args) end-------------------------------------------------------------- -- Description: -- -- Client script for Shooting Gallery NPC in GF area. -- Lets client know the object can be interacted with -- -------------------------------------------------------------- -------------------------------------------------------------- -- Handle this message to override pick type -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Generic Rebuild -- Script (CLIENT) --// - The spawned entity that will be breaking a rebuild --/////////////////////////////////////////////////////////////////////////////////////// function onRenderComponentReady(self, msg) -- play the rebuild enter animation on the client local anim_time = self:GetAnimationTime{ animationID = "rebuild-enter" }.time self:PlayFXEffect{effectType = "rebuild-enter"} end --/////////////////////////////////////////////////////////////////////////////////////// --// Rebuild Tutorial -- CLIENT Script --/////////////////////////////////////////////////////////////////////////////////////// function onHelp(self, msg) if msg.iHelpID == 0 then UI:DisplayToolTip{strDialogText = "Stand near the Piece and click it to pick it up.", strImageName = "", bShow=true, iTime=0} elseif msg.iHelpID == 1 then UI:DisplayToolTip{strDialogText = "Now click the blinking part on the rebuild to place the Piece.", strImageName = "", bShow=true, iTime=0} end end --/////////////////////////////////////////////////////////////////////////////////////// --// Rebuild Tutorial NPC -- CLIENT Script --/////////////////////////////////////////////////////////////////////////////////////// CONSTANTS = {} CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"] = 0 CONSTANTS["CLIENT_TOOLTIP_MISSION_COMPLETE"] = 1 CONSTANTS["MINIFIG_BODY_TORSO"] = 1 CONSTANTS["MINIFIG_BODY_LEGS"] = 2 function onRenderComponentReady(self, msg) -- change torso (red plain shirt) self:SwapDecalAndColor{decalIndex = 0, color = 0, bodyPiece = CONSTANTS["MINIFIG_BODY_TORSO"]} -- change legs (blue pants) self:SwapDecalAndColor{decalIndex = 0, color = 2, bodyPiece = CONSTANTS["MINIFIG_BODY_LEGS"]} end function onHelp(self, msg) if msg.iHelpID == CONSTANTS["CLIENT_TOOLTIP_MISSION_ACCEPT"] then UI:DisplayToolTip{strDialogText = "Click this to start rebuilding.", strImageName = "", bShow=true, iTime=0} elseif msg.iHelpID == CONSTANTS["CLIENT_TOOLTIP_MISSION_COMPLETE"] then UI:DisplayToolTip{strDialogText = "Follow the path and build the next one. You must build it in order!", strImageName = "", bShow=true, iTime=7000} end end -------------------------------------------------------------- -- Handle this message to override pick type -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 4 return msg endrequire('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Generic Rebuild -- Script (CLIENT) --// - The spawned entity that will be breaking a rebuild --/////////////////////////////////////////////////////////////////////////////////////// local effect_interval = 0.25 function onRenderComponentReady(self, msg) -- start a timer that will play the effects GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) end onTimerDone = function(self, msg) -- play the effect if msg.name == "DoEffect" then -- play the wake effect every interval self:PlayFXEffect{effectType = "onmove"} -- start a timer that will play the effects GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) end end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Client side script for Static Cannon --// - Fires periodically on the client within an interval and after a cooldown --// - Only fires if the player is within specified distance --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Parameters and Constants -------------------------------------------------------------- -- interval of time a fire can occur in (int seconds) local minInterval = 5 local maxInterval = 10 -- cooldown from firing, will not fire again until cooldown is complete (float seconds) local fireCooldown = 5.0 -- player must be within min distance or firing won't happen local proxRadius = 240.0 -------------------------------------------------------------- -- Startup of object -------------------------------------------------------------- function onStartup(self) SetIsActive(self, false) end -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetProximityRadius { radius = proxRadius } end -------------------------------------------------------------- -- Called when an entity gets within proximity of the object -------------------------------------------------------------- function onProximityUpdate(self, msg) -- if the local player is close enough to us if (msg.status == "ENTER") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then SetIsActive(self, true) SetupFireTimer(self) elseif (msg.status == "LEAVE") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then -- cancel all timers SetIsActive(self, false) GAMEOBJ:GetTimer():CancelAllTimers( self ) end end -------------------------------------------------------------- -- Setup timer for firing -------------------------------------------------------------- function SetupFireTimer(self) if (IsActive(self) == true) then local ran = math.random(minInterval,maxInterval) GAMEOBJ:GetTimer():AddTimerWithCancel( ran, "DoFire",self ) end end -------------------------------------------------------------- -- Cannon plays effects -------------------------------------------------------------- function DoFireEffect(self) if (IsActive(self) == true) then self:PlayFXEffect{ effectType = "onfire_large" } self:PlayFXEffect{ effectType = "onfire2_large" } self:PlayFXEffect{ effectType = "environment_fire" } GAMEOBJ:GetTimer():AddTimerWithCancel( fireCooldown, "FireCooldown",self ) end end -------------------------------------------------------------- -- Get IsActive state -------------------------------------------------------------- function IsActive(self) return self:GetVar("IsActive") end -------------------------------------------------------------- -- Set IsActive State -------------------------------------------------------------- function SetIsActive(self, bActive) self:SetVar("IsActive", bActive) end -------------------------------------------------------------- -- Called when timers complete -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "DoFire") then DoFireEffect(self) end if (msg.name == "FireCooldown") then SetupFireTimer(self) end end require('o_mis') --------------------------------------------------------- -- Wishing Well Client Script --------------------------------------------------------- local myPriority = 1 local coinCost = 1 local reUsetimer = 10 local useObject = true local icon = 3519 local object = 3040 function onStartup(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local playerID = tostring(player:GetID()) self:SetVar(playerID, false) end --------------------------------------------------------- -- Toggle Pick Type --------------------------------------------------------- function onGetPriorityPickListType(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local playerID = tostring(player:GetID()) local hasPlayer = self:GetVar(playerID) if ( myPriority > msg.fCurrentPickTypePriority ) then if hasPlayer == true then msg.ePickType = -1 else msg.ePickType = 14 end end return msg end function onCheckUseRequirements(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local playerID = tostring(player:GetID()) local orgcurrency = player:GetCurrency().currency local hasPlayer = self:GetVar(playerID) local hasMoney = tostring(orgcurrency) msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function notifyServerStateNotify(self, other, msg) -- check to see if the chat server is online if not bChatServerOnline then -- close the UI window because the interaction was terminated should return iButton -1 GAMEOBJ:GetTimer():CancelAllTimers(self) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) LeaveLobby(self,other) other:DisplayTooltip { bShow = true, strText = Localize("MINIGAME_LOBBY_CHAT_SERVER_DOWN"), iTime = 3000 } end end function notifyDie(self, other, msg) -- if the player dies leave the lobby LeaveLobby(self,other) end function notifyMatchUpdate(self,other,msg) -- check to make sure we were sent a msg and the lobby is open if not msg or not self:GetVar('LobbyOpen') then return end if msg.data.player then if msg.type == 0 then --print('MatchUpdate - ' .. msg.type .. ' = ' .. GAMEOBJ:GetObjectByID(msg.data.player):GetName().name) local tempTable = self:GetVar('tLobbyPlayers') local tempTable2 = self:GetVar('tLobbyPlayerNames') local bAdd = true -- create a tempTable if there isn't tLobbyPlayers in GetVar if not tempTable then tempTable = {} end -- create a tempTable2 if there isn't tLobbyPlayerNames in GetVar if not tempTable2 then tempTable2 = {} end -- add the player sent to tempTable if tempTable[msg.data.player] ~= nil then bAdd = false end -- add all this data, save the vars and update the lobby if bAdd then tempTable[msg.data.player] = 0 tempTable2[msg.data.player] = msg.data.playerName self:SetVar('tLobbyPlayers', tempTable) self:SetVar('tLobbyPlayerNames', tempTable2) UpdateLobby(self) end elseif msg.type == 1 then LeaveLobby(self,GAMEOBJ:GetObjectByID(msg.data.player)) elseif msg.type == 5 then -- player ready ReadyInstance(self, msg.data.player, true) UpdateLobby(self) elseif msg.type == 6 then -- player not ready ReadyInstance(self, msg.data.player, false) UpdateLobby(self) end elseif msg.data.time then -- update the time and UI local player = GAMEOBJ:GetControlledID() local countdownTime = math.floor(msg.data.time) GAMEOBJ:GetTimer():CancelAllTimers(self) if msg.type == 2 then UI:SendMessage("UpdateInstanceLobby", {{"user", player}, {"callbackObj", self}, {"countdownTime", "--"}, {"type", tVars.UI_Type}} ) else if countdownTime > 0 then UI:SendMessage("UpdateInstanceLobby", {{"user", player}, {"callbackObj", self}, {"countdownTime", countdownTime}, {"type", tVars.UI_Type}} ) self:SetVar('CountdownTick', countdownTime - 1) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) else self:SetVar('CountdownTick', countdownTime) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) UI:SendMessage("UpdateInstanceLobby", {{"user", player}, {"callbackObj", self}, {"countdownTime", self:GetVar('ActivityTable').waitTime}, {"type", tVars.UI_Type}} ) end end end end function UpdateLobby(self) local player = GAMEOBJ:GetControlledID() local playerID = player:GetID() local actTable = self:GetVar('ActivityTable') local tPlayers = self:GetVar('tLobbyPlayers') local tPlayerNames = self:GetVar('tLobbyPlayerNames') local minigameVars = {{"user", player}, {"callbackObj", self},{"activityName", actTable.ActivityName}, {"type", tVars.UI_Type},} -- if tPlayers doens't exist then create a new table with the nessessary variables if not tPlayers then tPlayers = {} tPlayers[playerID] = 0 self:SetVar('tLobbyPlayers', tPlayers) tPlayerNames = {} tPlayerNames[playerID] = player:GetName().name self:SetVar('tLobbyPlayerNames', tPlayerNames) end local count = 1 -- loop through all the players in the tPlayers and update the settings for k,v in pairs(tPlayers) do local name = tPlayerNames[k] -- Use Unknown Player if we cannot find the player name if name ~= nil and name ~= "" then table.insert(minigameVars, {"p".. count .. "_name", name}) else table.insert(minigameVars, {"p".. count .. "_name", Localize("MINGAME_LOBBY_UNKNOWN_PLAYER")}) --shouldn't ever get this case end -- if the player is in the ready state then check the box if v == 0 then table.insert(minigameVars, {"p"..count.."_check", false}) else table.insert(minigameVars, {"p"..count.."_check", true}) end count = count + 1 end for i = count, actTable.maxTeamSize*actTable.maxTeams do table.insert(minigameVars, {"p".. i .. "_name", Localize("MINIGAME_LOBBY_WAITING_FOR_PLAYER") .. "..."}) table.insert(minigameVars, {"p".. i .."_check", false}) end -- send message to UI to update the lobby UI:SendMessage("UpdateInstanceLobby", minigameVars ) end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetControlledID() local eChangeType = "POP" local bVisible = true -- freeze and hide the player if bFreeze is true if bFreeze then eChangeType = "PUSH" bVisible = false end -- update the player stunned/visible state playerID:SetVisible{visible = bVisible, fadeTime = 2} playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } end function EnterLobby(self, player) -- check to see if the chat server is down if not checkChatServer(player) then return end local actTable = self:GetVar('ActivityTable') local playerID = player:GetID() local item = self:GetVar(playerID) -- check for item interaction and send appropriate requests if not item then player:MatchRequest{type = 0, value = actTable.ActivityID } -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) else player:MatchRequest{type = 0, value = actTable.ActivityID, activator=self, playerChoices={droppedItem=item} } -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) end -- freeze and hide player freezePlayer(self, true) -- if max num of players is 1 transfer straight into mini game if actTable.maxTeamSize == 1 and actTable.maxTeams == 1 then player:DisplayTooltip { bShow = true, strText = Localize("MINIGAME_LOBBY_WAIT_MESSAGE_START") .. " " .. self:GetVar('ActivityTable').ActivityName .. " " .. Localize("MINIGAME_LOBBY_WAIT_MESSAGE_END"), iTime = 100000 } else -- send Lua notifications, open and update lobby self:SetVar('LobbyOpen', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="MatchUpdate"} self:SendLuaNotificationRequest{requestTarget=player, messageName="ServerStateNotify"} self:SendLuaNotificationRequest{requestTarget=player, messageName="Die"} UI:SendMessage("ToggleInstanceLobby", {{"visible", true}, {"type", tVars.UI_Type}, {"minPlayersRequired", (actTable.minTeamSize * actTable.minTeams)}}) UpdateLobby(self) end end function ReadyInstance(self, playerID, ready) local tempTable = self:GetVar('tLobbyPlayers') -- make a new table if it didn't exist if not tempTable then tempTable = {} end local findplayer = tempTable[playerID] -- if there is a player then set the appropriate ready state if findplayer ~= nil then if not ready then tempTable[playerID] = 0 else tempTable[playerID] = ready end self:SetVar('tLobbyPlayers', tempTable) end end function LeaveLobby(self,player) -- if this is the local player then reset everything back to beginning state if player:GetID() == GAMEOBJ:GetControlledID():GetID() then GAMEOBJ:GetTimer():CancelAllTimers(self) player:MatchRequest{type = 0, value = 0} -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) self:SetVar('LobbyOpen', false) self:SetVar("helpOpen", false) self:SetVar('tLobbyPlayers', {}) self:SetVar('tLobbyPlayerNames', {}) UI:SendMessage("UpdateInstanceLobby", {{"user", GAMEOBJ:GetControlledID()}, {"callbackObj", self}, {"countdownTime", self:GetVar('ActivityTable').waitTime}, {"type", tVars.UI_Type}} ) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) self:SendLuaNotificationCancel{requestTarget=player, messageName="MatchUpdate"} self:SendLuaNotificationCancel{requestTarget=player, messageName="ServerStateNotify"} self:SendLuaNotificationCancel{requestTarget=player, messageName="Die"} freezePlayer(self) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} else -- not local player so just update the lobby and remove the player from the table removePlayerFromLobby(self,player) UpdateLobby(self) end end function removePlayerFromLobby(self,player) local tempTable = self:GetVar('tLobbyPlayers') local tempTable2 = self:GetVar('tLobbyPlayerNames') local actTable = self:GetVar('ActivityTable') local iRemove = 0 -- clear the player from the tables tempTable[player:GetID()] = nil tempTable2[player:GetID()] = nil -- update the tables self:SetVar('tLobbyPlayers', tempTable) self:SetVar('tLobbyPlayerNames', tempTable2) end function split(str, pat) local t = {} -- splits a string based on the given pattern and returns a table string.gsub(str .. pat, "(.-)" .. pat, function(result) table.insert(t, result) end) return t end function onTimerDone(self, msg) -- todo: need to break out the timers into start and wait, so if there is network lag it wont close ui on first timer; or a bool if ( msg.name == "StartTimer" ) then local countdownTime = self:GetVar('CountdownTick') -- update the UI with the new time UI:SendMessage("UpdateInstanceLobby", {{"user", GAMEOBJ:GetControlledID()}, {"callbackObj", self}, {"countdownTime", countdownTime}, {"type", tVars.UI_Type}} ) if countdownTime > 0 then -- start another 1 sec timer self:SetVar('CountdownTick', countdownTime - 1) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) else -- all done close out the lobby UI and pop up the waiting message local player = GAMEOBJ:GetControlledID() GAMEOBJ:GetTimer():CancelAllTimers(self) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) --UI:SendMessage("MiniGameLobby", {{"user", player}, {"callbackObj", self}, {"countdownTime", self:GetVar('ActivityTable').waitTime}, {"LobbyVisible", false}} ) player:DisplayTooltip { bShow = true, strText = Localize("MINIGAME_LOBBY_WAIT_MESSAGE_START") .. " " .. self:GetVar('ActivityTable').ActivityName .. " " .. Localize("MINIGAME_LOBBY_WAIT_MESSAGE_END"), iTime = 100000 } end end end -------------------------------------------------------------- -- Battle instance Activators single and multiple player -- created by Trent -- updated mrb... 5/4/10 -------------------------------------------------------------- -------------------------------------------------------------- -- Sent when a player enter/leave a Proximity Radius -------------------------------------------------------------- function onProximityUpdate(self, msg) local playerID = GAMEOBJ:GetControlledID():GetID() -- check to see if we are the correct player if playerID ~= msg.objId:GetID() then return end -- send the correct UI message if (msg.status == "ENTER") then end end -------------------------------------------------------------- -- Spawn Temp FX Rings -------------------------------------------------------------- function onRenderComponentReady(self, msg) local Markpos = self:GetPosition().pos local Markrot = self:GetRotation() RESMGR:LoadObject { objectTemplate = 10068 , x = Markpos.x , y = Markpos.y - 4 , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self }; RESMGR:LoadObject { objectTemplate = 10068 , x = Markpos.x , y = Markpos.y - 8 , z = Markpos.z ,rw = Markrot.w , rx = Markrot.x, ry = Markrot.y , rz = Markrot.z, owner = self }; end -------------------------------------------------------------- -- ON CLIENT USE check Missions -------------------------------------------------------------- function onClientUse(self,msg) local player = msg.user player:DisplayMessageBox{bShow = true, imageID = 1, callbackClient = self, text = "Exit?" , identifier = "Exit"} end function onMessageBoxRespond(self,msg) local player = msg.sender if msg.iButton == 1 and msg.identifier == "Exit" then if player ~= nil then player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end end end -------------------------------------------------------------- -- Script on the Binoculars -- plays an animation, the cinematic and updates the achievement -- -- updated Brandi... 1/28/10 -- updated Brandi... 3/17/10 -- updated mrb... 5/5/10 -- removed some extra lines that were crashing occasionally -------------------------------------------------------------- --To set up -- each binocular cinamatic must be named "binoc_##" -- on each binocular, config data must be set for "number" and "0:##" -- ## should corrispond with the binocular being used, and the cinematic you want to play -- ## must be unique for the achievments to work, and there must be an entry for the binoc in the player flag -- database table if that binoc is to be used for the achievement -- Entries in the player plag table -- Should corraspond with the map number -- so all the binocs in the spaceship should start at 1001,1002,1003,etc... -- AG with 1101,1102,1103, etc... ------------------------------------------------------------------------ -- turning on the effects on the binoculars based on whether the player has looked through -- them before or not function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetControlledID() -- make sure the player is ready if player:Exists() then local map = LEVEL:GetCurrentZoneID() if not map then GAMEOBJ:GetTimer():AddTimerWithCancel(1.0, "CheckPlayer", self) return end local number = self:GetVar('number') -- get the number on the binoc config data from HF self:SetVar("beingUsed",false) -- set to check to keep the cinematic from being played again if number then --make sure the script doesnt fail if the binoc doesnt have config data local flagNumber = tonumber(string.sub(map,0,2)..number) --make player flag number if map then --skips the rest of the function if the map wasnt loaded enough to get the map number if (player:GetFlag{iFlagID = flagNumber}.bFlag == false) then --if the player flag is false, the player hasnt looked though the binocs before -- turn on the binocular effect self:PlayFXEffect{ name = "binocular_alert" , effectType = "cast" } end end end else -- if the player isnt fully loaded to check the player flag status, create 'heartbeat timer' GAMEOBJ:GetTimer():AddTimerWithCancel(1.0, "CheckPlayer", self) end end --make binocular interactable and set the interact icon function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onCheckUseRequirements(self, msg) --check to make sure the player isnt currently using the binoculars if self:GetVar("beingUsed") then msg.bCanUse = false return msg end end function onClientUse(self,msg) --SetUserCtrlCompPause crashs the game when used in this function, so i moved everything to a onTimerDone function to avoid crashes --not ideal, but it works GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "startBinoc",self ) self:SetVar("beingUsed", true) end function onFireEventClientSide(self,msg) if msg.args == "achieve" then self:StopFXEffect{ name = "binocular_alert" } end end function onTimerDone (self,msg) if (msg.name == "startBinoc" ) then local oDir = self:GetRotation() --self:GetObjectDirectionVectors().forward local player = GAMEOBJ:GetControlledID() GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "lookanimation",self ) player:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} player:SetRotation{ x = oDir.x , y = oDir.y, z =oDir.z , w=oDir.w} player:PlayAnimation{animationID = "binoculars-idle"} --temp animation while we wait for an animation of the player looking through the binoculars elseif (msg.name == "lookanimation") then -- animation is done, play the cinematic local player = GAMEOBJ:GetControlledID() local number = self:GetVar('number') local cineTime = 1 --set so even if the binoc doesnt have a cinematic assoicated with it yet, it will show a 1 sec cinematic if number then local soundName = self:GetVar('sound') -- grab the sound set in the config data of the binoc in HF -- let the script run even if there isnt config data, or doesnt have a cinematic path local cTime = tonumber(LEVEL:GetCinematicInfo("binoc_"..number)) if cTime then --play cinematic player:PlayCinematic { pathName = "binoc_"..number } cineTime = cTime end end player:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} UI:SendMessage( "pushGameState", {{"state", "cinematic" }} ) GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime, "cinematicTimer",self ) --let the script run even if the sound config data if soundName then self:PlayNDAudioEmitter{m_NDAudioEventGUID = soundName} end elseif (msg.name == "cinematicTimer") then local player = GAMEOBJ:GetControlledID() UI:SendMessage( "popGameState", {{"state", "cinematic"}} ) player:PlayAnimation{animationID = "ben_is_king"} --reset animation player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} self:SetVar("beingUsed",false) elseif (msg.name == "CheckPlayer") then onRenderComponentReady(self,msg) end end require('client/ai/L_BOUNCER_BASIC') function onCollisionPhantom(self, msg) local target = msg.objectID bounceObj(self, target) return msg end --require this script to gain access to this function that allows bouncer behavior function bounceObj(self, target) local vecString = self:GetVar("bouncer_destination") -- Parse the vector3 from the level file into three floats local posX, posY, posZ = string.match(vecString, "(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)\031(%p?%w+%p?%w+)") --UI:SendChat{ChatString = vecString, ChatType = "LOCAL", Timestamp = 500} local speed = self:GetVar("bouncer_speed") -- Create a vector in Lua to pass in message local vec = {x = posX, y = posY, z = posZ} self:PlayFXEffect{effectType = "onbounce"} target:PlayFXEffect{effectType = "onbounce", priority = 1.1} target:BouncePlayer{niDestPt = vec, fSpeed = speed, ObjIDBouncer = self} local faction = target:GetFaction() -- If player has used a bouncer, and they have a pet, notify the pet about the bounce. if ( faction.faction == 1 ) then local pet = target:GetPetID().objID if ( pet and pet:Exists() ) then -- Let pet know player has used a bouncer pet:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 3} end end endfunction onStartup(self) self:SetProximityRadius{radius = 20} end function onProximityUpdate(self, msg) if ( msg.status == "ENTER" ) then if ( GAMEOBJ:GetLocalCharID() == msg.objId:GetID() ) then msg.objId:DisplayTooltip{ bShow = true, strText = "This is a bouncer, you can bounce on it.", iTime = 5000 } end end end function onCollisionPhantom(self, msg) --print("IN VOLUME") CAMERA:SetDesiredPitchMax("CAMERA_MAIN_GAME_D", 160) CAMERA:SetDesiredPitchMin("CAMERA_MAIN_GAME_D", 125) end function onOffCollisionPhantom(self, msg) --print("OUT OF VOLUME") CAMERA:SetDesiredPitchMax("CAMERA_MAIN_GAME_D", 105) CAMERA:SetDesiredPitchMin("CAMERA_MAIN_GAME_D", 100) end function onCollisionPhantom(self, msg) --print("IN VOLUME") CAMERA:SetDesiredPitchMax("CAMERA_MAIN_GAME_D", 95) CAMERA:SetDesiredPitchMin("CAMERA_MAIN_GAME_D", 90) end function onOffCollisionPhantom(self, msg) --print("OUT OF VOLUME") CAMERA:SetDesiredPitchMax("CAMERA_MAIN_GAME_D", 105) CAMERA:SetDesiredPitchMin("CAMERA_MAIN_GAME_D", 100) end function onStartup(self) --UI:SendChat{ChatString = "door:onStartup", ChatType = "LOCAL", Timestamp = 500} --GAMEOBJ:GetTimer():AddTimerWithCancel( 30, "OpenDoor", self ) end function onHit(self, msg) --UI:SendChat{ChatString = "door:onHit", ChatType = "LOCAL", Timestamp = 500} end onTimerDone = function(self, msg) if (msg.name == "OpenDoor") then --UI:SendChat{ChatString = "door:OpenDoor", ChatType = "LOCAL", Timestamp = 500} --self:PlayAnimation{ animationID = "open" } end end require('o_mis') function onCollisionPhantom(self, msg) if GAMEOBJ:GetLocalCharID() == msg.senderID:GetID() then print "CollisionPhantom" storeObjectByName(self, "Rocketbuilder", msg.senderID) print "is local char" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) for i =0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate >= 4684 and player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate <=4721 then local item = player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate self:SetVar("rocketLOT", item) print ("Found rocket " .. item .. "in slot " .. i) RESMGR:LoadObject { objectTemplate = item , owner = self } break end end end end end function onStartup (self) print "Create Rocket Starting" end function onChildLoaded(self, msg) print "ChildLoaded" if msg.templateID == self:GetVar("rocketLOT") then storeObjectByName(self,"rocketID",msg.childID) end end require('o_mis') function onCollisionPhantom(self, msg) if GAMEOBJ:GetLocalCharID() == msg.senderID:GetID() then print "CollisionPhantom" storeObjectByName(self, "Rocketbuilder", msg.senderID) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.9, "PlayerSoarHack",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "PlayerAnimate",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.1, "RocketLaunch",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.06, "RocketFiring",self ) print "is local char" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} for i =0, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then if player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate >= 4684 and player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate <=4721 then local item = player:GetInventoryItemInSlot{slot = i }.itemID:GetLOT{}.objtemplate self:SetVar("rocketLOT", item) print ("Found rocket " .. item .. "in slot " .. i) RESMGR:LoadObject { objectTemplate = item , owner = self } break end end end end end function onStartup (self) print "Generic Rocket Starting" end function onChildLoaded(self, msg) print "ChildLoaded" if msg.templateID == self:GetVar("rocketLOT") then storeObjectByName(self,"rocketID",msg.childID) end end function onTimerDone (self,msg) print ("TimerDone " .. msg.name) local player = getObjectByName(self, "Rocketbuilder") local rocketPosition = self:GetPosition{}.pos local rocketRotation = self:GetRotation{} if (msg.name == "PlayerSoarHack") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:PlayAnimation{animationID = "rocket-soar"} end end if (msg.name == "PlayerAnimate") then self:PlayAnimation{animationID = "launch"} if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:SetPosition {pos = rocketPosition} player:SetRotation {x = rocketRotation.x, y = rocketRotation.y, z = rocketRotation.z, w = rocketRotation.w} player:PlayCinematic { pathName = self:GetVar("cameraPath") } end player:PlayAnimation{animationID = "rocket-launch"} -- if we don't do this, people don't see other clients animate end if (msg.name == "RocketLaunch") then --getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "launch"} --getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "launch"} --getObjectByName(self, "rocketID"):PlayFXEffect{effectType="launch"} end if (msg.name == "RocketFiring") then --getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "firing"} --getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "firing"} --getObjectByName(self, "rocketID"):PlayFXEffect{effectType="firing"} -- Set zone player timer local zTime = 2 --getObjectByName(self, "rocketID"):GetAnimationTime{animationID = "firing"}.time GAMEOBJ:GetTimer():AddTimerWithCancel( zTime, "ZoneTimer", self ) end if (msg.name == "ZoneTimer") then print ("ZoneTimer " .. self:GetVar("zoneID")) self:FireEventServerSide{senderID = player, args = "ZonePlayer", param1 = self:GetVar("zoneID")} end end require('o_mis') function onStartup(self) if not self:GetVar('ZoneToMap') then print('** Missing Config Data (newZone) for Rocket Transition **') self:SetVar('ZoneToMap', 30) end end function onRebuildNotifyState(self, msg) if msg.iState == 2 then --if self:ActivityUserExists{userID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID())}.bExists then storeObjectByName(self, "Rocketbuilder", msg.player) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.01, "PlayerRebuild",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.9, "PlayerSoarHack",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "PlayerAnimate",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.1, "RocketLaunch",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.06, "RocketFiring",self ) -- trying to prevent aother animations breaking the rocket if GAMEOBJ:GetLocalCharID() == msg.player then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} end end end function onTimerDone (self,msg) local player = getObjectByName(self, "Rocketbuilder") local rocketPosition = self:GetPosition{}.pos local rocketRotation = self:GetRotation{} if (msg.name == "PlayerRebuild") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:PlayAnimation{animationID = "rebuild-rocket"} player:SetUserCtrlCompPause{bPaused = true} end end if (msg.name == "PlayerSoarHack") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:PlayAnimation{animationID = "rocket-soar"} end end if (msg.name == "PlayerAnimate") then self:PlayAnimation{animationID = "launch-AG"} if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:SetPosition {pos = rocketPosition} player:SetRotation {x = rocketRotation.x, y = rocketRotation.y, z = rocketRotation.z, w = rocketRotation.w} player:PlayCinematic { pathName = self:GetVar("cameraPath") } end player:PlayAnimation{animationID = "rocket-launch-AG"} -- if we don't do this, people don't see other clients animate end if (msg.name == "RocketLaunch") then getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "launch"} getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "launch"} end if (msg.name == "RocketFiring") then getObjectByName(self, "sectionTop"):PlayFXEffect{effectType = "firing"} getObjectByName(self, "sectionBot"):PlayFXEffect{effectType = "firing"} -- Set zone player timer local zTime = getObjectByName(self, "sectionTop"):GetAnimationTime{animationID = "firing"}.time GAMEOBJ:GetTimer():AddTimerWithCancel( zTime, "ZoneTimer",self ) end if (msg.name == "ZoneTimer") then self:FireEventServerSide{senderID = player, args = "ZonePlayer", param1 = self:GetVar('ZoneToMap')} -- set flag to false so we know the player has left the zone player:SetFlag{iFlagID = 32, bFlag = false} --player:DisplayZoneSummary{sender = self, show = true} --local objs = self:GetObjectsInGroup{ group = "ZoneTransferObj", ignoreSpawners = true }.objects --for i = 1, table.maxn ( objs ) do -- player:DisplayZoneSummary{sender = objs[i], show = true} -- player:PlayCinematic { pathName = "AG_Summary" } --end end end function onCustomRebuildSelected(self, msg) self:PlayFXEffect{effectType = "rebuild-complete"} if self:ActivityUserExists{userID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID())}.bExists then GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected1", param1 = msg.choice1LOT} GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected2", param1 = msg.choice2LOT} GAMEOBJ:GetZoneControlID():NotifyObject{name = "customRocketSelected3", param1 = msg.choice3LOT} end end function onChildLoaded(self, msg) --TODO: Make this better --print "child loaded" if msg.templateID == 4713 or msg.templateID == 4716 or msg.templateID == 4719 then storeObjectByName(self, "sectionTop", msg.childID) elseif msg.templateID == 4714 or msg.templateID == 4717 or msg.templateID == 4720 then storeObjectByName(self, "sectionMid", msg.childID) elseif msg.templateID == 4715 or msg.templateID == 4718 or msg.templateID == 4721 then storeObjectByName(self, "sectionBot", msg.childID) end end --function rotateVector(quaternion, vector) -- local matrix = {} -- matrix[1][1] = 1 - 2*math.pow(quaternion.y, 2) - 2*math.pow(quaternion.z, 2) -- matrix[1][2] = 2*quaternion.x*quaternion.y - 2*quaternion.z*quaternion.w --end --1 - 2*qy2 - 2*qz2 2*qx*qy - 2*qz*qw 2*qx*qz + 2*qy*qw --2*qx*qy + 2*qz*qw 1 - 2*qx2 - 2*qz2 2*qy*qz - 2*qx*qw --2*qx*qz - 2*qy*qw 2*qy*qz + 2*qx*qw 1 - 2*qx2 - 2*qy2-------------------------------------------------------------- -- Description: -- -- Client script for Guild Master in the FV area -- Lets client know the object can be interacted with -- -------------------------------------------------------------- -------------------------------------------------------------- -- Handle this message to override pick type -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 4 return msg end-------------------------------------------------------------- -- Client side script to hide the health bar above an object -- updated Brandi... 2/25/10 -------------------------------------------------------------- function onRenderComponentReady(self) --turn off the health bar above object self:SetNameBillboardState{bState = false } self:SetVar("smashed",false) endfunction onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() --print("******** Landed ***********") local respawnPos = {x=469, y= 265, z = 477} local currentPos = target:GetPosition() local respawnPoints = self:GetObjectsInGroup{ group = "RespawnPoints" }.objects local respawnPos = respawnPoints[1]:GetPosition().pos target:Teleport{ pos = respawnPos} --end return msg end require('client/mission_Bob')require('State') require('/client/mission_Temp') function onStartup(self) Miss = {} --///////////////////////////////////////////////////////////////////////// -- Enter/Exit Conduct Radius --///////////////////////////////////////////////////////////////////////// Miss['Conduct_CoolDown'] = 1 -- Affects the Trigger time upon exiting/entering the conduct radius Miss['Conduct_Delay'] = 1 -- Delay before triggering the emote Miss['Main_EmoteID'] = 69 -- Global emote ID -- Conduct Radius Miss['OverRideConduct'] = true Miss['conductRadius'] = 20 -- Conduct -----------------------OnEnter Miss['Emote_enter'] = "enter" -- Conduct -----------------------OnExit Miss['Emote_onExit'] = "leave" --/////////////////////////////////////////////////////////////////////////// -- Mission States --/////////////////////////////////////////////////////////////////////////// -- Emote ------------------------------------------------------[[ OnAVAILABLE ]] Miss['Emote_onAVAILABLE'] = "missionState1" -- Emote -----------------------------------------------------[[ OnACTIVE ]] Miss['Emote_onACTIVE '] = "missionState2" -- Emote -----------------------------------------------------[[ OnREADY_TO_COMPLETE ]] Miss['Emote_onREADY_TO_COMPLETE '] = "missionState3" -- Emote -----------------------------------------------------[[ OnSTATE_COMPLETED ]] Miss['Emote_onSTATE_COMPLETED '] = "missionState4" --[[ LWO_MissSION_STATE_AVAILABLE = 0x1, LWO_MissSION_STATE_ACTIVE = 0x2, LWO_MissSION_STATE_READY_TO_COMPLETE = 0x4, LWO_MissSION_STATE_COMPLETED = 0x8, --]] ------ Do not change ------------------------------------------------ self:SetVar("Miss",Miss) GetMissionVars(self) CreateMissionStates(self) ------------------------------------------------------------------------------- endrequire('State') require('/client/mission_Main') function onStartup(self) Miss = {} --///////////////////////////////////////////////////////////////////////// -- Enter/Exit Conduct Radius --///////////////////////////////////////////////////////////////////////// Miss['Conduct_CoolDown'] = 0.5 -- Effects the Trigger time upone exiting/entering the conduct radius. Miss['Conduct_Delay'] = 0.1 -- Delay before triggering the emote. Miss['Main_EmoteID'] = 69 -- Global emote ID -- Conduct Radius Miss['OverRideConduct'] = true Miss['conductRadius'] = 20 -- Conduct ----------------------- OnEnter Miss['Emote_enter'] = "enter" -- Conduct ----------------------- OnExit Miss['Emote_onExit'] = "leave" --/////////////////////////////////////////////////////////////////////////// -- Buy Sell --/////////////////////////////////////////////////////////////////////////// -- Emote ------------------------------------------------------[[ OnAVAILABLE ]] Miss['Emote_onAVAILABLE'] = "missionState1" -- Emote -----------------------------------------------------[[ OnACTIVE ]] Miss['Emote_onACTIVE '] = "missionState2" -- Emote -----------------------------------------------------[[ OnREADY_TO_COMPLETE ]] Miss['Emote_onREADY_TO_COMPLETE '] = "missionState3" -- Emote -----------------------------------------------------[[ OnSTATE_COMPLETED ]] Miss['Emote_onSTATE_COMPLETED '] = "missionState4" --[[ LWO_MissSION_STATE_AVAILABLE = 0x1, LWO_MissSION_STATE_ACTIVE = 0x2, LWO_MissSION_STATE_READY_TO_COMPLETE = 0x4, LWO_MissSION_STATE_COMPLETED = 0x8, --]] ------ Due not change -------------------------------------------------------- self:SetVar("Miss",Miss) GetMissionVars(self) CreateMissionStates(self) ------------------------------------------------------------------------------- endrequire('o_mis') function onFireEventClientSide(self, msg) -- print ("firer" .. msg.args .. " " .. msg.object:GetID() .. " " .. msg.senderID:GetID() ) storeObjectByName(self, "player", msg.senderID) storeObjectByName(self, "rocket", msg.object) local targetZone = self:GetVar("targetZone") local targetScene = self:GetVar("targetScene") if targetScene == nil then self:SetVar("targetScene",""); targetScene = "" end local playSummary = self:GetVar("playSummary") if playSummary == nil then self:SetVar("playSummary",false); playSummary = false end local summaryCamera = self:GetVar("summaryCamera") if summaryCamera == nil then self:SetVar("summaryCamera",""); summaryCamera = "" end local launchPath = self:GetVar("launchCamera") if launchPath == nil then self:SetVar("launchCamera",""); launchPath = "" end local gmlevel = self:GetVar("GMLevel") if gmlevel == nil then gmlevel = 0 ; self:SetVar("GMLevel",0) end local playerAnim = self:GetVar("playerAnim") local rocketAnim = self:GetVar("rocketAnim") if playerAnim == nil then self:SetVar("playerAnim","rocket-launch-AG"); playerAnim = self:GetVar("playerAnim") end if rocketAnim == nil then self:SetVar("rocketAnim","launch-AG"); rocketAnim = self:GetVar("rocketAnim") end local player=getObjectByName(self,"player") local rocket=getObjectByName(self,"rocket") if GAMEOBJ:GetLocalCharID() == player:GetID() then UI:SendMessage( "ToggleBackpack", {{"visible", false }, {"tabName", "models"}} ) end -- print ("HEAD player " .. self:GetVar("player") ) local mypos = self:GetPosition().pos local myrot = self:GetRotation() local config = { {"player", "|" .. player:GetID() } , {"rocket", "|" .. rocket:GetID() }, {"GMLevel", self:GetVar("GMLevel") }, {"targetZone", self:GetVar("targetZone") }, {"targetScene", self:GetVar("targetScene") }, {"summaryCamera", self:GetVar("summaryCamera") }, {"launchCamera", self:GetVar("launchCamera") }, {"playSummary", self:GetVar("playSummary") }, {"playerAnim", self:GetVar("playerAnim") }, {"rocketAnim", self:GetVar("rocketAnim") }, {"custom_script_client" , "scripts/client/ai/NEW_ROCKET_LAUNCH_TAIL.lua" } } RESMGR:LoadObject { objectTemplate = 6 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, rw=myrot.w, rx=myrot.x, ry=myrot.y, rz=myrot.z, configData = config } end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 25) --AddInteraction(self, "proximityText", "Can you help me turn this jetpack on?") --AddInteraction(self, "proximityText", "Can you turn this jetpack on for me?") AddInteraction(self, "interactionAnim", "interact") end function onStartup(self) --UI:SendChat{ChatString = "bumper:onStartup", ChatType = "LOCAL", Timestamp = 500} -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} end function onCollision(self, msg) local target = GAMEOBJ:GetZoneControlID() -- Send the message to the zone object, who will relay it to C++ target:ArcadeScoreEvent{objectID = self, templateID = self:GetLOT().objtemplate} end -------------------------------------------------------------- -- Displays a fancy animation as you walk up to the rocket pad -- created by cassie -- updated brandi... 6/8/10 added local variable, and different text based on launcher types, and localized text -- updated mrb... 7/21/10 - added check all preconditions -------------------------------------------------------------- local PropertyLauncher = 7678 --object id of the property rocket launcher local RocketText = "ROCKET_SIGNAGE" -- localization string for normal rocket launchers local PropertyRocketText = "ROCKET_SIGNAGE_PROPERTY" -- localization string for property rocket launchers -------------------------------------------------------------- -- Sent when the script is started. -------------------------------------------------------------- function onStartup(self,msg) -- set up the proximity radius self:SetProximityRadius{radius = 30, name = "RocketSign"} local instanceIcon = 74 if self:GetLOT().objtemplate == PropertyLauncher then instanceIcon = 83 end -- set up the two proximity radius for icon display self:SetProximityRadius{iconID = instanceIcon, radius = 80, name = "Icon_Display_Distance"} end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 -- set the pick type if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function split(str, pat) local t = {} if str and pat then string.gsub(str .. pat, "(.-)" .. pat, function(result) table.insert(t, result) end) end return t end ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) if not isFromUI then local preConVar = self:GetVar("CheckPrecondition") local bPass = true -- if we dont have CheckPreconditions set in HF then return out of this function if preConVar and preConVar ~= "" then local check = msg.objIDUser:CheckListOfPreconditionsFromLua{PreconditionsToCheck = preConVar, requestingID = self} if not check.bPass then msg.HasReasonFromScript = true msg.Script_IconID = check.IconID msg.Script_Reason = check.FailedReason msg.Script_Failed_Requirement = true msg.bCanUse = false bPass = false end end if bPass then msg.HasReasonFromScript = true msg.Script_IconID = 2872 msg.Script_Failed_Requirement = true -- if its a property rocket launcher, display different text than if its a normal rocket launcher if self:GetLOT().objtemplate == PropertyLauncher then msg.Script_Reason = Localize(PropertyRocketText) else msg.Script_Reason = Localize(RocketText) end end end msg.bCanUse = false return msg end -------------------------------------------------------------- -- Sent when a player enter/leave a Proximity Radius -------------------------------------------------------------- function onProximityUpdate(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check to see if we are the correct player if playerID ~= msg.objId:GetID() then return end -- send the correct UI message if msg.name == "RocketSign" then if msg.status == "ENTER" then local mapNum = self:GetVar("transferZoneID") if not mapNum then mapNum = 20 end local mapName = Localize("ZoneTable_" .. mapNum .. "_DisplayDescription") --UI:SendMessage( "TurnOn", {}, self ) UI:SendMessage( "ToggleRocketSignage", { {"bVisible", true}, {"name", mapName}, {"zoneNumber", tostring(mapNum)} }, self ) elseif msg.status == "LEAVE" then --UI:SendMessage( "TurnOff", {}, self ) UI:SendMessage( "ToggleRocketSignage", { {"bVisible", false} }, self ) end end end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onClientUse(self, msg) self:PlayAnimation{ animationID = "interact" } --msg.targetObject = 0 --Need to readd after Ian Hall fixes crash endfunction onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onCollisionPhantom(self, msg) local target = msg.objectID local elast = self:GetVar("springpad_bouncemod") self:PlayFXEffect {priority = 1.2, effectType = "pinball_bumper"} --target:PlaySound{ strSoundName = "Pinball_Bumper" } --msg.objectID:PlaySound{ strSoundName = "Pinball_Bumper3" } --local maximumSpeed = 100.0 -- Will load from level file local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} return msg end CONSTANTS = {} CONSTANTS["cooldown"] = 2.0 function onStartup(self) self:SetVar("TimerActive", false) end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then if (self:GetVar("TimerActive") == true) then else local params = target:GetSleddingState().bSleddingState if (tostring(params) ~= "true") then target:SetSleddingState{bSleddingState = true} else target:SetSleddingState{bSleddingState = false} end GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["cooldown"], "CoolDown",self ) self:SetVar("TimerActive", true) end end return msg end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- parse the name to get out the wave number -- use the wave number to select the spawns -- of format "SpawnWaveXXX" where XXX is the spawn number if (msg.name == "CoolDown") then self:SetVar("TimerActive", false) end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then target:SetSleddingState{bSleddingState = false} end return msg end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then target:SetSleddingState{bSleddingState = true} end return msg end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then --local elast = 2.0 -- Will load from level file local elast = self:GetVar("springpad_bouncemod") --local maximumSpeed = 100.0 -- Will load from level file local maximumSpeed = self:GetVar("springpad_maxspeed") local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end local isBouncing = false function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() --print("******** Bounce ***********") -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then if isBouncing == true then return msg else isBouncing = true end --local elast = 2.0 -- Will load from level file local elast = self:GetVar("springpad_bouncemod") if elast == nil then elast = 250 end --print('******************' .. elast) --local maximumSpeed = 100.0 -- Will load from level file local maximumSpeed = self:GetVar("springpad_maxspeed") if maximumSpeed == nil then maximumSpeed = 1000 --print('******************' .. maximumSpeed) end local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local pVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, playerVelocity = pVel, elasticity = elast, maxSpeed = maximumSpeed} end GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "BounceCooldown", self ) return msg end onTimerDone = function(self, msg) if msg.name == "BounceCooldown" then isBouncing = false end end-------------------------------------------------------------- -- Generic Story Box Interaction script, opens/closes the story -- box UI based on the config data set in HF on the object running -- this script. -- updated mrb... 5/04/10 -- added altFlagID to fix PC issue -------------------------------------------------------------- -- *********************************************************** -- HF config data format -- storyText -> 0:stringName -- needed to work -- altFlagID -> 1:flagID -- if the flag is different from 10000 + mapNum + storyText number use this -- *********************************************************** -- turning on the effects on the binoculars based on whether the player has looked through -- them before or not function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetControlledID() -- make sure the player is ready if player:Exists() then if self:GetVar('storyText') then --make sure the script doesnt fail if the binoc doesnt have config data local flagNumber = self:GetVar('altFlagID') or (10000 + LEVEL:GetCurrentZoneID() + tonumber(string.sub(self:GetVar('storyText'), -2))) --make player flag number if (player:GetFlag{iFlagID = flagNumber}.bFlag == false) then --if the player flag is false, the player hasnt looked though the binocs before -- turn on the binocular effect self:PlayFXEffect{ name = "plaque_attract" , effectType = "attract" } else self:PlayFXEffect{ name = "plaquefx" , effectType = "display" } end end else -- if the player isnt fully loaded to check the player flag status, create 'heartbeat timer' GAMEOBJ:GetTimer():AddTimerWithCancel(1.0, "CheckPlayer", self) end end ---------------------------------------------- -- sent when the local player interacts with the -- object ---------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetControlledID() -- check to see if we are the correct player if player:GetID() ~= msg.user:GetID() or self:GetVar('isInUse') then return end -- tell the Story Box UI element to open and what to display, then turn off the interaction icon UI:SendMessage("pushGameState", {{"state", "Story"}, {"context", {{"visible", true }, {"text", getText(self) }, {"senderID", player}, {"callbackObj", self}}} }) toggleActivatorIcon(self, true) player:UsedInformationPlaque{i64Plaque = self} -- check to see if there is a valid achievement mission set in HF config data, then UpdateMissionTask if needed. if getMission(self) then local boxFlag = self:GetVar('altFlagID') or (10000 + LEVEL:GetCurrentZoneID() + tonumber(string.sub(self:GetVar('storyText'), -2))) if (player:GetFlag{iFlagID = boxFlag}.bFlag == false) then player:SetFlag{iFlagID = boxFlag, bFlag = true} self:StopFXEffect{name = "plaque_attract" } self:PlayFXEffect{ name = "plaquefx" , effectType = "display" } end end end function onTerminateInteraction(self,msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleStoryBox", {{"visible", false }} ) toggleActivatorIcon(self) end ---------------------------------------------- -- sent when the object story box is closed; -- this can be done by hitting the x, esc or enter ---------------------------------------------- function onMessageBoxRespond(self, msg) -- UI element has been closed turn on the icon toggleActivatorIcon(self) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- sent when the requested local player is hit -- by something, this is used to close the story box ---------------------------------------------- function notifyOnHit(self, other, msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleStoryBox", {{"visible", false }} ) toggleActivatorIcon(self) end ---------------------------------------------- -- checks to see if there is config data set in -- HF, if not this returns the default message ---------------------------------------------- function getText(self) local textVar = self:GetVar('storyText') -- default story box text message, tells the developer how to put in the localization string if not textVar then return [[Missing story text, set the correctly localization string in HF configdata. Format = storyText -> 0:stringName]] end return Localize(textVar) end ---------------------------------------------- -- checks to see if there is config data set in -- HF, if not this returns -1 ---------------------------------------------- function getMission(self) local missVar = self:GetVar('storyText') -- check if there is a mission set in HF config data and return the correct info if not missVar then missVar = -1 end return missVar end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide) local player = GAMEOBJ:GetControlledID() if not bHide then -- show the icon, cancel notification, set isInUse to false bHide = false self:SetVar('isInUse', false) self:SendLuaNotificationCancel{requestTarget=player, messageName="OnHit"} player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="OnHit"} end -- request the interaction update self:RequestPickTypeUpdate() end function onTimerDone (self,msg) if (msg.name == "CheckPlayer") then onRenderComponentReady(self,msg) end end--[[require('State') require('/client/c_Main') require('o_mis') function onStartup(self) Ven = {} --///////////////////////////////////////////////////////////////////////// -- Enter/Exit Conduct Radius --///////////////////////////////////////////////////////////////////////// Ven['Conduct_CoolDown'] = 1 -- Effects the Trigger time upone exiting/entering the conduct radius. Ven['Conduct_Delay'] = 1 -- Delay before triggering the emote. Ven['Main_EmoteID'] = 69 -- Global emote ID -- Conduct Radius Ven['OverRideConduct'] = true Ven['conductRadius'] = 20 -- Conduct ----------------------- OnEnter Ven['Emote_enterType'] = "enter" -- Conduct ----------------------- OnExit_Buy or Sell Ven['Emote_onExitBuySell'] = "leave" -- Conduct ----------------------- OnExit_Null Ven['Emote_onExitType'] = "leave" -- Conduct ----------------------- OnExit_Sell Ven['Emote_onExitSellType'] = "cancel" --/////////////////////////////////////////////////////////////////////////// -- Vendor States --/////////////////////////////////////////////////////////////////////////// -- Emote OnBuy --------------------- OnBuy Ven['Emote_onBuyType'] = "buy" -- Emote OnSell --------------------- OnSell Ven['Emote_onSellType'] = "sell" ------ Do not change ------------------------------------------------ self:SetVar("Ven",Ven) LoadVenderVarsOnce(self) GetVenderVars(self) CreateVenderStates(self) ------------------------------------------------------------------------------- end --]]-------------------------------------------------------------- -- Description: Base Client script for Shooting Gallery NPC -- in GF area. Lets client know the object can be interacted with -- players are stored as a table with the playerID as a key and -- the readyState as a value. -- -- ALSO: Add L_BASE_DRAG_INTERACT_INSTANCER_SERVER.lua -- to server side to make instancer use drag to interact -- and double click functionality (racing) -- -- updated mrb... 8/4/10 -- added callbackObj to the toggle lobby UI message -------------------------------------------------------------- local tVars = {} local tLobby = {} ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local verInfo = msg.objIDUser:GetVersioningInfo() -- check to see if the instancer is supposed to be blocked for beta if not verInfo.bIsInternal and verInfo.iMajorRelease < 1 and verInfo.iVersionRelease < tVars.releaseVersion then msg.objIDUser:DisplayTooltip { bShow = true, strText = self:GetVar('ActivityTable').ActivityName .. " " .. Localize("MINIGAME_LOBBY_BETA_CLOSED_MESSAGE"), iTime = 3000 } msg.bCanUse = false else msg.bCanUse = checkChatServer(msg.objIDUser) end -- if this is an item interaction and they havent build a car/modular obj do this stuff if tVars.itemType then if msg.objIDUser:GetInvItemCount{iObjTemplate = tVars.itemType}.itemCount < 1 then msg.HasReasonFromScript = true msg.Script_IconID = 3140 msg.Script_Reason = Localize("MINIGAME_LOBBY_RACE_BUILD_A_CAR_FAIL") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false end end return msg end function onProximityUpdate(self, msg) -- if the player is using a racing instancer and they entered into the interaction range then set lua notification if msg.name == "Interaction_Distance" and tVars.itemType then if msg.status == "ENTER" then self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetControlledID(), messageName="RequestUseItemOn"} else self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetControlledID(), messageName="RequestUseItemOn"} end end end function notifyRequestUseItemOn(self, other, msg) -- set the object that was double clicked if other:GetID() == GAMEOBJ:GetControlledID():GetID() then self:SetVar("UseObjectID", "|" .. msg.itemToUse:GetID()) --print(msg.itemToUse:GetName().name) end end function onGetInteractionDetails(self, msg) local instanceType = split(tVars.UI_Type, "_")[2] if instanceType == "Race" then msg.TextDetails = Localize("MINIGAME_LOBBY_RACE_DRAG_A_CAR_INTERACT") -- needs localization end return msg end function baseSetVars(self, table) tVars = table local actNum = self:GetActivityID().activityID -- 5 -- -- save out the activity table self:SetVar('ActivityTable', GAMEOBJ:GetDBTable{table='Activities',keyname='ActivityID',key=actNum}) -- we notify the game object system so it can predownload our zone assets GAMEOBJ:NotifyOfZoneTransferObject( self, actNum, 0 ) local instanceIcon = 78 local instanceType = split(tVars.UI_Type, "_")[2] if instanceType == "Survival" then instanceIcon = 79 elseif instanceType == "Dragon" then instanceIcon = 79 elseif instanceType == "SG" then instanceIcon = 81 end -- set up the two proximity radius for icon display self:SetProximityRadius{iconID = instanceIcon, radius = 35, name = "Icon_Display_Distance"} self:SetProximityRadius{radius = self:GetVar("interaction_distance"), name = "Interaction_Distance"} end function checkChatServer(player) -- check to see if the chat server is down if not player:GetServerState().bChatServerOnline then player:DisplayTooltip { bShow = true, strText = Localize("MINIGAME_LOBBY_CHAT_SERVER_DOWN"), iTime = 3000 } return false end return true end function showFirstScreen(self, player) -- if help window is open or chat server is down dont showFirstScreen if self:GetVar("helpOpen") or not checkChatServer(player) then return end -- check if the this object has been unlocked. if tVars.misID and player:GetMissionState{missionID = tVars.misID}.missionState < tVars.missionState then player:DisplayTooltip { bShow = true, strText = tVars.failText, iTime = 3000 } return end -- send message to the UI to open the lobby UI:SendMessage("pushGameState", {{"state", "Lobby"}, {"context", {{"user", player}, {"callbackObj", self}, {"HelpVisible", "show" }, {"type", tVars.UI_Type}} } }) self:SetVar("helpOpen", true) end function onClientUse(self, msg) local player = GAMEOBJ:GetControlledID() -- check if this is the local palyer or not if player:GetID() ~= msg.user:GetID() or self:GetVar('LobbyOpen') then return end -- see if this is an item interaction or a normal interaction if tVars.itemType then local modObj = player:GetFirstInventoryItemByLOT{ iObjTemplate = tVars.itemType, inventoryType = 5 }.itemID -- if we have an obj use it to interact or display the fail text if modObj then itemInteract(self, tVars.itemType, modObj) else player:DisplayTooltip { bShow = true, strText = tVars.failItem, iTime = 3000 } end else showFirstScreen(self, player) end end function checkDoubleClickInteract(self, playerID, objID) -- do we have the required variables passed to us? if not playerID or not objID then return end local bFail = true -- check var -- see if the player is within the client side interaction proximity for k,v in ipairs(self:GetProximityObjects{name = "Interaction_Distance"}.objects) do if v:GetID() == playerID then bFail = false break end end -- if not then return out of the function if bFail then return end local player = GAMEOBJ:GetControlledID() -- check to make sure we have the correct player and that the object double clicked was the correct LOT if playerID ~= player:GetID() or GAMEOBJ:GetObjectByID(objID):GetLOT().objtemplate ~= tVars.itemType then return end -- find the first LOT in the players inventory local modObj = player:GetFirstInventoryItemByLOT{ iObjTemplate = tVars.itemType, inventoryType = 5 }.itemID -- if we have an obj then sen the interaction if modObj then -- set the player interaction player:SetPlayerInteraction{interaction = self} -- send message to use the obj as the drag interaction itemInteract(self, tVars.itemType, modObj) end end function onScriptNetworkVarUpdate(self, msg) local player = GAMEOBJ:GetControlledID() -- check to see if we have the correct message and deal with it if msg.tableOfVars["bPassedCheck.1"] == player:GetID() then checkDoubleClickInteract(self, msg.tableOfVars["bPassedCheck.1"], msg.tableOfVars["bPassedCheck.2"]) end end function onUseItemOnClient(self,msg) -- if we aren't an item interaction return out of this function if not tVars.itemType then return end -- set the player interaction msg.playerID:SetPlayerInteraction{interaction = self} itemInteract(self, msg.itemLOT, msg.itemToUse) end function itemInteract(self, itemLOT, itemToUse) -- check to see if the itemLOT matches the interaction item in tVars if itemLOT == tVars.itemType then -- open the help window showFirstScreen(self, GAMEOBJ:GetControlledID()) -- Store the item they dropped on us self:SetVar(GAMEOBJ:GetControlledID():GetID(), itemToUse:GetID()) else GAMEOBJ:GetControlledID():DisplayTooltip { bShow = true, strText = tVars.failItem, iTime = 3000 } end end function onTerminateInteraction(self,msg) -- check to see if the help window is open if not self:GetVar("helpOpen") then return end local player = GAMEOBJ:GetControlledID() -- see if the player fails the mission state check if tVars.misID and player:GetMissionState{missionID = tVars.misID}.missionState < tVars.missionState then return end -- close the UI window because the interaction was terminated should return iButton -1 UI:SendMessage("ToggleInstanceEnter", {{"visible", false}}) UI:SendMessage( "popGameState", {{"state", "Lobby"}} ) self:SetVar("helpOpen", false) end function onMessageBoxRespond(self, msg) -- when the player hit's ok or hits enter transfer to new zone local player = GAMEOBJ:GetControlledID() --print(msg.identifier .. " : " .. msg.iButton) -- handle UI button responses if msg.iButton == 1 then if msg.identifier == "PlayButton" and not self:GetVar('LobbyOpen')then self:SetVar("helpOpen", false) EnterLobby(self, player) elseif msg.identifier == "LobbyReady" then player:MatchRequest{type = 1, value = 1} -- type: 1 = REQUEST_READY; value = (1 = ready, 0 = notready) elseif msg.identifier == "LobbyUnready" then player:MatchRequest{type = 1, value = 0} end elseif msg.iButton == -1 then if msg.identifier == "CloseButton" then self:SetVar("helpOpen", false) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end end if msg.identifier == "LobbyExit" and msg.iButton ~= -1 then LeaveLobby(self,player) end end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 -- set the pick type if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function notifyServerStateNotify(self, other, msg) -- check to see if the chat server is online if not bChatServerOnline then -- close the UI window because the interaction was terminated should return iButton -1 GAMEOBJ:GetTimer():CancelAllTimers(self) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) LeaveLobby(self,other) other:DisplayTooltip { bShow = true, strText = Localize("MINIGAME_LOBBY_CHAT_SERVER_DOWN"), iTime = 3000 } end end function notifyDie(self, other, msg) -- if the player dies leave the lobby LeaveLobby(self,other) end function notifyMatchUpdate(self,other,msg) -- check to make sure we were sent a msg and the lobby is open if not msg or not self:GetVar('LobbyOpen') then return end if msg.data.player then if msg.type == 0 then --print('MatchUpdate - ' .. msg.type .. ' = ' .. GAMEOBJ:GetObjectByID(msg.data.player):GetName().name) local tempTable = self:GetVar('tLobbyPlayers') local tempTable2 = self:GetVar('tLobbyPlayerNames') local bAdd = true -- create a tempTable if there isn't tLobbyPlayers in GetVar if not tempTable then tempTable = {} end -- create a tempTable2 if there isn't tLobbyPlayerNames in GetVar if not tempTable2 then tempTable2 = {} end -- add the player sent to tempTable if tempTable[msg.data.player] ~= nil then bAdd = false end -- add all this data, save the vars and update the lobby if bAdd then tempTable[msg.data.player] = 0 tempTable2[msg.data.player] = msg.data.playerName self:SetVar('tLobbyPlayers', tempTable) self:SetVar('tLobbyPlayerNames', tempTable2) UpdateLobby(self) end elseif msg.type == 1 then LeaveLobby(self,GAMEOBJ:GetObjectByID(msg.data.player)) elseif msg.type == 5 then -- player ready ReadyInstance(self, msg.data.player, true) UpdateLobby(self) elseif msg.type == 6 then -- player not ready ReadyInstance(self, msg.data.player, false) UpdateLobby(self) end elseif msg.data.time then -- update the time and UI local player = GAMEOBJ:GetControlledID() local countdownTime = math.floor(msg.data.time) GAMEOBJ:GetTimer():CancelAllTimers(self) if msg.type == 2 then if not self:GetVar("bOpenedLobbyOnce") then --print('first time') self:SetVar("bOpenedLobbyOnce", true) else --print('lost a player') self:SetVar("resetWaitingForPlayers", true) UI:SendMessage("UpdateInstanceLobby", {{"user", player}, {"callbackObj", self}, {"resetWaitingForPlayers", true}} ) end UpdateLobby(self) else if countdownTime > 0 then if self:GetVar("resetWaitingForPlayers") then self:SetVar("resetWaitingForPlayers", false) UI:SendMessage("UpdateInstanceLobby", {{"user", player}, {"callbackObj", self}, {"resetWaitingForPlayers", false}} ) end self:SetVar('CountdownTick', countdownTime - 1) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) UpdateLobby(self, countdownTime) else self:SetVar('CountdownTick', countdownTime) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) UpdateLobby(self, self:GetVar('ActivityTable').waitTime) end end end end function UpdateLobby(self, optionalTime) local player = GAMEOBJ:GetControlledID() local playerID = player:GetID() local actTable = self:GetVar('ActivityTable') local tPlayers = self:GetVar('tLobbyPlayers') local tPlayerNames = self:GetVar('tLobbyPlayerNames') local minigameVars = {{"user", player}, {"callbackObj", self}} -- if tPlayers doens't exist then create a new table with the nessessary variables if not tPlayers then tPlayers = {} tPlayers[playerID] = 0 self:SetVar('tLobbyPlayers', tPlayers) tPlayerNames = {} tPlayerNames[playerID] = player:GetName().name self:SetVar('tLobbyPlayerNames', tPlayerNames) end local count = 1 -- loop through all the players in the tPlayers and update the settings for k,v in pairs(tPlayers) do local name = tPlayerNames[k] -- Use Unknown Player if we cannot find the player name if name ~= nil and name ~= "" then table.insert(minigameVars, {"p".. count .. "_name", name}) else table.insert(minigameVars, {"p".. count .. "_name", Localize("MINGAME_LOBBY_UNKNOWN_PLAYER")}) --shouldn't ever get this case end -- if the player is in the ready state then check the box if v == 0 then table.insert(minigameVars, {"p"..count.."_check", false}) else table.insert(minigameVars, {"p"..count.."_check", true}) end count = count + 1 end for i = count, actTable.maxTeamSize*actTable.maxTeams do table.insert(minigameVars, {"p".. i .. "_name", Localize("MINIGAME_LOBBY_WAITING_FOR_PLAYER") .. "..."}) table.insert(minigameVars, {"p".. i .."_check", false}) end local playersNeeded = (actTable.minTeamSize*actTable.minTeams) - (count - 1) if playersNeeded >= 0 then table.insert(minigameVars, {"updatePlayersNeeded", playersNeeded}) end if optionalTime then table.insert(minigameVars, {"countdownTime", optionalTime}) end -- send message to UI to update the lobby UI:SendMessage("UpdateInstanceLobby", minigameVars ) end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetControlledID() local eChangeType = "POP" local bVisible = true -- freeze and hide the player if bFreeze is true if bFreeze then eChangeType = "PUSH" bVisible = false end -- update the player stunned/visible state playerID:SetVisible{visible = bVisible, fadeTime = 2} playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } end function EnterLobby(self, player) -- check to see if the chat server is down if not checkChatServer(player) then return end local actTable = self:GetVar('ActivityTable') local playerID = player:GetID() local item = self:GetVar("UseObjectID") -- if they didn't double-click a car, use their default if item == nil or item == 0 then item = self:GetVar(playerID) end -- check for item interaction and send appropriate requests if not item then player:MatchRequest{type = 0, value = actTable.ActivityID } -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) else player:MatchRequest{type = 0, value = actTable.ActivityID, activator=self, playerChoices={droppedItem=item} } -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) end -- freeze and hide player freezePlayer(self, true) -- if max num of players is 1 transfer straight into mini game if actTable.maxTeamSize == 1 and actTable.maxTeams == 1 then player:DisplayTooltip { bShow = true, NoRevive = true, strText = Localize("MINIGAME_LOBBY_WAIT_MESSAGE_START") .. " " .. actTable.ActivityName .. " " .. Localize("MINIGAME_LOBBY_WAIT_MESSAGE_END"), iTime = 100000 } else -- send Lua notifications, open and update lobby self:SetVar('LobbyOpen', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="MatchUpdate"} self:SendLuaNotificationRequest{requestTarget=player, messageName="ServerStateNotify"} self:SendLuaNotificationRequest{requestTarget=player, messageName="Die"} UI:SendMessage("ToggleInstanceLobby", {{"visible", true}, {"callbackObj", self}, {"type", tVars.UI_Type}, {"minPlayersRequired", (actTable.minTeamSize * actTable.minTeams)},{"activityName", actTable.ActivityName}}) UpdateLobby(self) end end function ReadyInstance(self, playerID, ready) local tempTable = self:GetVar('tLobbyPlayers') -- make a new table if it didn't exist if not tempTable then tempTable = {} end local findplayer = tempTable[playerID] -- if there is a player then set the appropriate ready state if findplayer ~= nil then if not ready then tempTable[playerID] = 0 else tempTable[playerID] = ready end self:SetVar('tLobbyPlayers', tempTable) end end function LeaveLobby(self,player) -- if this is the local player then reset everything back to beginning state if player:GetID() == GAMEOBJ:GetControlledID():GetID() then GAMEOBJ:GetTimer():CancelAllTimers(self) player:MatchRequest{type = 0, value = 0} -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) self:SetVar('LobbyOpen', false) self:SetVar("helpOpen", false) self:SetVar('tLobbyPlayers', {}) self:SetVar('tLobbyPlayerNames', {}) UI:SendMessage("UpdateInstanceLobby", {{"user", GAMEOBJ:GetControlledID()}, {"callbackObj", self}, {"countdownTime", self:GetVar('ActivityTable').waitTime}} ) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) self:SendLuaNotificationCancel{requestTarget=player, messageName="MatchUpdate"} self:SendLuaNotificationCancel{requestTarget=player, messageName="ServerStateNotify"} self:SendLuaNotificationCancel{requestTarget=player, messageName="Die"} freezePlayer(self) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} self:SetVar("bOpenedLobbyOnce", false) else -- not local player so just update the lobby and remove the player from the table removePlayerFromLobby(self,player) UpdateLobby(self) end end function removePlayerFromLobby(self,player) local tempTable = self:GetVar('tLobbyPlayers') local tempTable2 = self:GetVar('tLobbyPlayerNames') local actTable = self:GetVar('ActivityTable') local iRemove = 0 -- clear the player from the tables tempTable[player:GetID()] = nil tempTable2[player:GetID()] = nil -- update the tables self:SetVar('tLobbyPlayers', tempTable) self:SetVar('tLobbyPlayerNames', tempTable2) end function split(str, pat) local t = {} -- splits a string based on the given pattern and returns a table string.gsub(str .. pat, "(.-)" .. pat, function(result) table.insert(t, result) end) return t end function onTimerDone(self, msg) -- todo: need to break out the timers into start and wait, so if there is network lag it wont close ui on first timer; or a bool if ( msg.name == "StartTimer" ) then local countdownTime = self:GetVar('CountdownTick') -- update the UI with the new time UI:SendMessage("UpdateInstanceLobby", {{"user", GAMEOBJ:GetControlledID()}, {"callbackObj", self}, {"countdownTime", countdownTime}} ) if countdownTime > 0 then -- start another 1 sec timer self:SetVar('CountdownTick', countdownTime - 1) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) else -- all done close out the lobby UI and pop up the waiting message local player = GAMEOBJ:GetControlledID() GAMEOBJ:GetTimer():CancelAllTimers(self) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) --UI:SendMessage("MiniGameLobby", {{"user", player}, {"callbackObj", self}, {"countdownTime", self:GetVar('ActivityTable').waitTime}, {"LobbyVisible", false}} ) player:DisplayTooltip { bShow = true, NoRevive = true, strText = Localize("MINIGAME_LOBBY_WAIT_MESSAGE_START") .. " " .. self:GetVar('ActivityTable').ActivityName .. " " .. Localize("MINIGAME_LOBBY_WAIT_MESSAGE_END"), iTime = 100000 } end end end local color = '' local round = 1 -- round the player is one local finalRound = '' local phase = 0 --phase in the game, this will reset to 0 every round and go up to the number of rounds local gameStarted = false local rand = {} --random color table local randColors = {} local playerInput = 0 --times the player has collided with a square each turn local playerTurn = false function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onClientUse(self,msg) if gameStarted == false then print("you used me") DelayBeforeRound(self) gameStarted = true msg.user:SetPlayerControlScheme{iScheme = 3} end end function DelayBeforeRound(self) --GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):DisplayTooltip { bShow = true, strText = "Round starts in 3.. 2... 1...", iTime = 500 } GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ShowActivityCountdown() GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):SetUserCtrlCompPause{bPaused = true} GAMEOBJ:GetTimer():AddTimerWithCancel(5, "startRoundIn", self ) end function PickAColors(self,msg) --for i = 1, round do rand[round] = math.random(1,4) --end for k,j in pairs(rand) do print("picking colors "..j.." and i = "..k) end if #rand > 0 then playColors(self) else PickAColors(self,msg) end end function playColors(self) if phase < round then phase = phase + 1 local squares = self:GetObjectsInGroup{ group = "Squares", ignoreSpawners = true}.objects local oneSquare = squares[rand[phase]] --print(GAMEOBJ:GetObjectByID(oneSquare:GetID())) print(oneSquare:GetVar('color')) randColors[phase] = oneSquare:GetVar('color') oneSquare:NotifyObject{ name = "PlayGameFX" } if phase == round then GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):SetUserCtrlCompPause{bPaused = false} playerTurn = true for k,v in ipairs(randColors) do print(v) end GAMEOBJ:GetTimer():AddTimerWithCancel(30, "playerTimer", self ) return end GAMEOBJ:GetTimer():AddTimerWithCancel(1, "delay", self ) end end function onNotifyClientObject(self, msg) if ( msg.name == "playerCollided" ) then GAMEOBJ:GetTimer():CancelTimer("playerTimer", self); if playerInput < round and gameStarted == true and playerTurn == true then playerInput = playerInput + 1 print ("the player collided with "..msg.paramStr) print(randColors[playerInput]) if randColors[playerInput] == msg.paramStr then local group = "Square"..randColors[playerInput] print("player was correct and group is "..group) local collidedsquare = self:GetObjectsInGroup{ group = "Square"..msg.paramStr ,ignoreSpawners = true}.objects[1] collidedsquare:NotifyObject{ name = "PlayerFX" } local oPos = self:GetPosition() GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):SetPosition{pos = {x=oPos.pos.x , y=oPos.pos.y, z=oPos.pos.z, }} else print("player was wrong") GameOver(self) end if playerInput == round then print("player succeded? i think") playerTurn = false round = round +1 phase = 0 --phase in the game, this will reset to 0 every round and go up to the number of rounds playerInput = 0 DelayBeforeRound(self) end end end end function GameOver(self) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):DisplayTooltip { bShow = true, strText = "Game Over try again", iTime = 1000 } gameStarted = false GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ResetPlayerControlScheme{} round = 1 phase = 0 --phase in the game, this will reset to 0 every round and go up to the number of rounds rand = {} --random color table randColors = {} playerInput = 0 print("game stopped") end function onTimerDone(self,msg) if msg.name == "delay" then playColors(self) end if msg.name == "startRoundIn" then PickAColors(self) end if msg.name == "playerTimer" then GameOver(self) end if msg.name == "ResetCamera" then GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):PlayCinematic{pathName = "SimonCamera" } GAMEOBJ:GetTimer():AddTimerWithCancel( 999999 , "ResetCamera" , self ) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):SetUserCtrlCompPause{bPaused = false} end endlocal color = '' function onNotifyObject(self, msg) --print("i was notified but the message name was wrong") if ( msg.name == "PlayGameFX" ) then --print("square was notified") color = self:GetVar('color') print("square "..color) self:PlayFXEffect{name = 'color', effectID = 229, effectType = "change"} GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StopFX", self ) end if ( msg.name == "PlayerFX" ) then print("square was notified") color = self:GetVar('color') print("square "..color) self:PlayFXEffect{name = 'color', effectID = 379, effectType = "create"} GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StopFX", self ) end end function onTimerDone(self,msg) if msg.name == "StopFX" then print("I SAID STOP") color = self:GetVar('color') self:StopFXEffect{ name = 'color' } end endlocal counter = 0 function onCollisionPhantom(self,msg) local color = self:GetVar('color') --print("trigger "..color) --print(msg.objectID:GetID()) counter = counter + 1 --print(counter) local manager = self:GetObjectsInGroup{ group = "manager" ,ignoreSpawners = true}.objects[1] local oPos = manager:GetPosition().pos msg.objectID:Teleport{pos = oPos } --SetPosition{pos = {x=oPos.pos.x , y=oPos.pos.y, z=oPos.pos.z, }} manager:NotifyClientObject{ name = "playerCollided" , paramStr = color} endrequire('o_mis') function onStartup(self) -- print ("NRLT startup " ) local targetZone = self:GetVar("targetZone") local targetScene = self:GetVar("targetScene") if targetScene == nil then self:SetVar("targetScene",""); targetScene = "" end local playSummary = self:GetVar("playSummary") local summaryCamera = self:GetVar("summaryCamera") if summaryCamera == nil then self:SetVar("summaryCamera",""); summaryCamera = "" end local launchPath = self:GetVar("launchCamera") if launchPath == nil then self:SetVar("launchCamera",""); launchPath = "" end local gmlevel = self:GetVar("GMLevel") if gmlevel == nil then gmlevel = 0 end local playerAnim = self:GetVar("playerAnim") local rocketAnim = self:GetVar("rocketAnim") if playerAnim == nil then self:SetVar("playerAnim","rocket-launch-AG"); playerAnim = self:GetVar("playerAnim") end if rocketAnim == nil then self:SetVar("rocketAnim","launch-AG"); rocketAnim = self:GetVar("rocketAnim") end local player=getObjectByName(self,"player") local rocket=getObjectByName(self,"rocket") -- print ("player " .. player:GetID() .. " rocket " .. rocket:GetID()) if GAMEOBJ:GetLocalCharID() == player:GetID() then GAMEOBJ:GetTimer():AddTimerWithCancel( 50, "TimeExpired",self ) end if (player:GetGMLevel{}.ucGMLevel < gmlevel) then player:DisplayTooltip { bShow = true, strText = "Launchpad under construction. Cannot launch now.", iTime = 5000 } return end self:SetVar("preloads",0) player:PreloadAnimation{animationID = playerAnim, respondObjID = self } if rocket:Exists() then rocket:PreloadAnimation{animationID = rocketAnim, respondObjID = self } end -- print ("Launching New Rocket to zone " .. targetZone .. ":" .. targetScene -- .. " summary:" .. tostring(playSummary) .. " summaryCamera " .. summaryCamera -- .. " launchCamera " .. launchPath -- .. " playerAnim " .. playerAnim .. " rocketAnim " .. rocketAnim -- ) -- print ("Rocket Exists " .. tostring(rocket:Exists())) if GAMEOBJ:GetLocalCharID() == player:GetID() then -- print ("pausing controls") player:SetUserCtrlCompPause{bPaused = true} end if rocket:Exists() then -- print ("waiting for just a few seconds") rocket:SetCustomBuild{} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "EquippedRocket",self ) player:PlayCinematic { pathName = self:GetVar("launchCamera") } else -- print ("Waiting for rocket to load") self:SendLuaNotificationRequest{requestTarget=player, messageName="ChildRenderComponentReady"} end player:EquipInventory { itemtoequip = rocket } end function onAnimationFinishedPreloading(self,msg) local preloads = self:GetVar("preloads") preloads = preloads+1 self:SetVar("preloads",preloads) --print ("preloads " .. preloads) end function notifyChildRenderComponentReady(self,other,msg) -- print ("notifyChildRenderComponentReady " .. tostring(self) .. " " .. tostring(other) .. " " .. tostring(msg) ) local player=getObjectByName(self,"player") local rocket=getObjectByName(self,"rocket") rocket:RefreshProxy() rocket:PreloadAnimation{animationID = rocketAnim, respondObjID = self } self:SendLuaNotificationCancel{requestTarget=player, messageName="ChildRenderComponentReady"} -- print ("Rocket Ready") -- print ("waiting for just a few seconds more") GAMEOBJ:GetTimer():AddTimerWithCancel( .5, "EquippedRocket",self ) player:PlayCinematic { pathName = self:GetVar("launchCamera") } end function BeginTheDance(self) local player=getObjectByName(self,"player") local rocket=getObjectByName(self,"rocket") if self:GetVar("preloads")<2 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "EquippedRocket",self ) end -- print ("Begin The Dance") rocket:SetCustomBuild{} rocket:MakePhysics {} rocket:DetachObject {} rocket:SetOffscreenAnimation { bAnimateOffscreen = true } player:PlayAnimation {animationID = "setdown-carry"} player:SetAnimationSet {strSet = "", bPush=true } local lpos = self:GetPosition{} -- print ("setting pos to " .. lpos.pos.x .. "," .. lpos.pos.y .. "," .. lpos.pos.z) rocket:SetPosition { pos = lpos.pos } local rot = self:GetRotation{} -- print ("setting rot to " .. rot.x .. "," .. rot.y .. "," .. rot.z .. "," .. rot.w) rocket:SetRotation {x = rot.x, y = rot.y, z = rot.z, w = rot.w } rocket:SetVisible {visible = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "PlayerAnimate", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.1, "RocketLaunch", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.06, "RocketFiring", self ) end function onTimerDone (self,msg) -- print ("timerDone..." .. msg.name) local player = getObjectByName(self, "player") local rocket = getObjectByName(self, "rocket") local rocketPosition = self:GetPosition{}.pos local rocketRotation = self:GetRotation{} local playerAnim = self:GetVar("playerAnim") local rocketAnim = self:GetVar("rocketAnim") if (msg.name == "EquippedRocket") then BeginTheDance(self) end if (msg.name == "PlayerAnimate") then if(player:GetID() == GAMEOBJ:GetLocalCharID() ) then player:SetPosition {pos = rocketPosition} player:SetRotation {x = rocketRotation.x, y = rocketRotation.y, z = rocketRotation.z, w = rocketRotation.w} end player:PlayAnimation{animationID = playerAnim } rocket:PlayAnimation{animationID = rocketAnim } -- Set zone player timer local zTime = rocket:GetAnimationTime{animationID = rocketAnim }.time if (zTime == 0) then zTime = 4.0 end GAMEOBJ:GetTimer():AddTimerWithCancel( zTime, "ZoneTimer",self ) end if (msg.name == "RocketLaunch") then rocket:PlayFXEffect{effectType = "launch"} end if (msg.name == "RocketFiring") then rocket:PlayFXEffect{effectType = "firing"} end if ( msg.name == "ZoneTimer" ) then rocket:SetVisible {visible = false, fadeTime=0 } player:SetVisible {visible = false, fadeTime=0 } if GAMEOBJ:GetLocalCharID() == player:GetID() then rocket:PlayAnimation{ animationID = "idle" } player:SetAnimationSet { strSet = "", bPush=false } player:UnEquipInventory { itemtounequip = rocket } player:SetFlag{ iFlagID = 32, bFlag = false } -- flag 32 is play the rocket landing or not. false means play GAMEOBJ:GetTimer():CancelTimer("TimeExpired",self) self:GetParentObj{}.objIDParent:FireEventServerSide { senderID = player, args = "ClearLauncher" } if (self:GetVar("playSummary")) then player:DisplayZoneSummary{ sender=self, isZoneStart=false } player:PlayCinematic { pathName = self:GetVar("summaryCamera") } else self:GetParentObj{}.objIDParent:FireEventServerSide { senderID = player, args = "ZonePlayer"} end -- else print ("Foriegn rocket launch done") end end if msg.name == "TimeExpired" and GAMEOBJ:GetLocalCharID() == player:GetID() then self:GetParentObj{}.objIDParent:FireEventServerSide{senderID = player, args = "ZonePlayer"} end end function onZoneSummaryDismissed (self,msg) local player = getObjectByName(self, "player") -- print ("zoneSummaryDismissed " .. player:GetID() .. " " .. GAMEOBJ:GetLocalCharID() ) if GAMEOBJ:GetLocalCharID() == player:GetID() then self:GetParentObj{}.objIDParent:FireEventServerSide{senderID = player, args = "ZonePlayer"} -- else print ("Foriegn ZoneSummaryDismissed") end end --client-side switch function onStartup(self) end function onGetOverridePickType(self, msg) msg.ePickType = 14 --interactive return msg endrequire('o_mis') function onStartup(self) end function onRenderComponentReady(self, msg) end function onPCreateEffectFinished(self, msg) self:PlayFXEffect{ effectType="onspawn" } end -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) if msg.status == "ENTER" then -- forward the event to the parent if (msg.objId:GetLOT().objtemplate == 3710) then getParent(self):FireEvent{args = "monkey_prox", senderID = self} end end end --client-side bouncer switch function onStartup(self) end function onGetOverridePickType(self, msg) msg.ePickType = 14 --NPC type return msg endrequire('client/ai/L_BOUNCER_BASIC') --client-side bouncer script function onStartup(self) end function onBouncerTriggered(self, msg) --Hackish fix for the 'bounce collision' local player = msg.triggerObj local objPos = player:GetPosition().pos objPos.y = objPos.y + 1 --player:DisplayChatBubble{wsText = (objPos.x .. " " .. objPos.y .. " " .. objPos.z)} player:SetPosition{pos = objPos} bounceObj(self, msg.triggerObj) end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 1 -- -- On proximity of the local character, will approach and -- present help screen information for playing the game. -- When the player has finished reading the help, he will -- leave and despawn. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('client/ai/NP/L_NP_NPC') -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- Happens on client interaction -------------------------------------------------------------- function onClientUse(self, msg) -- get the player local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (player) and (player:Exists()) then -- show help end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "mouseOverAnim", "wave") AddInteraction(self, "interactionText", "You are in the Avant Gardens.") AddInteraction(self, "interactionText", "Take a look around, there are some interesting people here.") AddInteraction(self, "interactionText", "Have you seen the dinosaur?") AddInteraction(self, "interactionText", "Where did you come from?") AddInteraction(self, "proximityText", "Welcome to Nimbus Park!") AddInteraction(self, "proximityText", Localize("NPC_GENERIC_HI_THERE")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_HELLO")) end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 15) AddInteraction(self, "mouseOverAnim", "np_greet") AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_A_GRAND_MONUMENT!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THIS_GARDEN_IN_SOOTHING")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_ARE_YOU_LOOKING_FOR_BATTERIES_TOO?")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_HI_THERE")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_HELLO")) end function onRenderComponentReady(self, msg) -- change torso (red plain shirt) self:SwapDecalAndColor{decalIndex = 0, color = 0, bodyPiece = 1} -- change legs (blue pants) self:SwapDecalAndColor{decalIndex = 0, color = 2, bodyPiece = 2} endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_I_HEARD_THE_BEASTIE_BLOCKS_WERE_GOOD")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THIS_CONCERT_BETTER_BE_GREAT")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_DID_YOU_SEE_THAT_OLD_MAN_OVER_THERE?")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_GO_BEASTIE_BLOCKS!")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_YEAH!")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_HEY_THERE")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_WHY_IS_SHERLAND_SO_OLD?")) end -------------------------------------------------------------- -- Called when this object is ready to render -------------------------------------------------------------- function onRenderComponentReady(self, msg) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="SceneActorReady" } end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_I'M_GETTING_READY_FOR_THE_OBSTACLE_COURSE")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_I'M_TRYING_TO_BEAT_MY_BEST_TIME")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_IS_YOUR_BEST_TIME?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THE_BOUNCERS_ARE_THE_HARDEST_PART")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_I_HOPE_YOU_KNOW_HOW_TO_DOUBLE_JUMP!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_I_FEEL_ASLEEP")) AddInteraction(self, "proximityAnim", "yawn") AddInteraction(self, "proximityText", Localize("NPC_GENERIC_*STRETCH*")) end function onRenderComponentReady(self, msg) -- change torso (red plain shirt) self:SwapDecalAndColor{decalIndex = 0, color = 0, bodyPiece = 1} -- change legs (blue pants) self:SwapDecalAndColor{decalIndex = 0, color = 2, bodyPiece = 2} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_TRY_SMASHING_SOME_OF_THE_ROCKS_IN_THE_ROCK_GARDEN")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THESE_STATUES_ARE_GREAT")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THIS_FOUNTAIN_IS_SOOTHING")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_ARE_YOU_HAVING_A_GOOD_TIME_IN_NIMBUS_PARK?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_GET_THE_BRICK?")) AddInteraction(self, "proximityAnim", "cheer") AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_WELCOME_TO_NIMBUS_PARK!")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_WONDERLAND_IS_GREAT!")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_GOOD_AFTERNOON")) end function onRenderComponentReady(self, msg) -- change torso (red plain shirt) self:SwapDecalAndColor{decalIndex = 0, color = 0, bodyPiece = 1} -- change legs (blue pants) self:SwapDecalAndColor{decalIndex = 0, color = 2, bodyPiece = 2} end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 35) SetProximityDistance(self, 35) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THESE_ANTS_ARE_EVERYWHERE!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHERE_ARE_THEY_TAKING_MY_FOOD?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_MY_PICNIC_IS_RUINED!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_NOW_I'M_GOING_TO_BE_HUNGRY")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_MAN_I_HATE_ANTS!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHERE_IS_THE_ORKIN_MAN?")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_GO_AWAY_ANTS!")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_SHOO_BUGS!")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_AHHH!_MY_FOOD!")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_WHAT_IS_GOING_ON?!")) end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THIS_PLAYGROUND_IS_FUN!")) AddInteraction(self, "interactionText", Localize("NPC_GENERIC_CLOWNS_ARE_GREAT!")) AddInteraction(self, "interactionText", Localize("NPC_GENERIC_I_LIKE_ERIK_BEYER!")) AddInteraction(self, "interactionText", Localize("NPC_GENERIC_YEGGE_BROKE_THE_BUILD!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_HAPPENS_WHEN_I_CLICK_THE_SWITCHES?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_HAPPENS_WHEN_I_CLICK_THE_SWITCHES?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_HAPPENS_WHEN_I_CLICK_THE_SWITCHES?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_HAPPENS_WHEN_I_CLICK_THE_SWITCHES?")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_DID_YOU_SEE_THOSE_SWITCHES?")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_I'VE_GOTTA_COLLECT_THE_GOLD_BRICKS!")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_HELLO")) end function onRenderComponentReady(self, msg) -- change torso (red plain shirt) self:SwapDecalAndColor{decalIndex = 0, color = 0, bodyPiece = 1} -- change legs (blue pants) self:SwapDecalAndColor{decalIndex = 0, color = 2, bodyPiece = 2} endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 40) SetProximityDistance(self, 40) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_GET_EM_OFF_ME!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_I'M_SCARED_OF_BUGS!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_MY_PICNIC_IS_RUINED!")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_AM_I_GOING_TO_DO?")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_OH_NO!")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_EWW")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_ANTS_EVERYWHERE!")) end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 40) SetProximityDistance(self, 40) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_THE_MAELSTROM_HAS_TAKEN_OVER_THE_PARK_MOWERS")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_SOMETHING_IS_WRONG_WITH_THE_PARK_MOWERS")) AddInteraction(self, "interactionText", Localize("NPC_GENERIC_WHAT_IS_GOING_ON?!")) AddInteraction(self, "interactionText", Localize("NPC_GENERIC_WHAT_ARE_WE_GOING_TO_DO?")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_IS_THAT_PART_OF_THE_MAELSTROM?")) AddInteraction(self, "proximityText", Localize("NPC_GENERIC_WHAT_IS_GOING_ON?!")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_WHY_IS_THE_GRASS_BENT?")) end function onRenderComponentReady(self, msg) -- change torso (red plain shirt) self:SwapDecalAndColor{decalIndex = 0, color = 0, bodyPiece = 1} -- change legs (blue pants) self:SwapDecalAndColor{decalIndex = 0, color = 2, bodyPiece = 2} endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 40) SetProximityDistance(self, 40) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_ANYONE_HAVE_A_FRISBEE?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHAT_A_GREAT_DAY_IN_NIMBUS_PARK")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_DO_YOU_SMELL_FOOD?")) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_WHERE'S_THE_MUSTARD?")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_DID_YOU_SEE_THE_ANTS?")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_WHO'S_GRILLING_THE_BURGERS?")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_I_WANT_TO_PLAY_VOLLEYBALL")) end function onRenderComponentReady(self, msg) -- change torso (red plain shirt) self:SwapDecalAndColor{decalIndex = 0, color = 0, bodyPiece = 1} -- change legs (blue pants) self:SwapDecalAndColor{decalIndex = 0, color = 2, bodyPiece = 2} endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_CAMERA_READY!_NOW_POSE!")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_WANT_YOUR_PICTURE_TAKEN?_CLICK_ON_ME")) end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional AddInteraction(self, "interactionText", "*ClipperBot-8000 Status: Ready*") AddInteraction(self, "interactionText", "Executing Trimming Procedures.") AddInteraction(self, "interactionText", "Batteries at Full Power.") AddInteraction(self, "interactionText", "Current Location: Avant Gardens.") end -------------------------------------------------------------- -- (CLIENT SIDE) Generic script for actors in scene 3 -- -- Responsible for registering with the client side -- zone object to control actions and animations. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('client/ai/NP/L_NP_NPC') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) -- load my help --------------------- AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_READY_TO_COMPLETE, function(self) local doNothing = 0 end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_COMPLETE, function(self) local doNothing = 0 end) SetProximityDistance(self, 30) end -------------------------------------------------------------- -- Make this object interactable -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end -------------------------------------------------------------- -- Display a chat bubble -------------------------------------------------------------- function ShowChatBubble(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- try mission state local m4 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_4_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], m4.missionState) == false) then -- mission not complete local num = math.random(1,#CONSTANTS["CROWD_NO_MISSION_TEXT"]) self:DisplayChatBubble{wsText = CONSTANTS["CROWD_NO_MISSION_TEXT"][num]} else -- mission complete local num = math.random(1,#CONSTANTS["CROWD_YES_MISSION_TEXT"]) self:DisplayChatBubble{wsText = CONSTANTS["CROWD_YES_MISSION_TEXT"][num]} end end -------------------------------------------------------------- -- Happens on client interaction -------------------------------------------------------------- function onClientUse(self, msg) ShowChatBubble(self) end -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then local ran = math.random(1,100) if ran <= CONSTANTS["CROWD_PROX_CHANCE"] and msg.status == "ENTER" and msg.objId:GetID() == player:GetID() then ShowChatBubble(self) self:PlayFXEffect{ name = "crowd", effectID = CONSTANTS["SCENE_3_CROWD_EFFECT_ID"], effectType = CONSTANTS["SCENE_3_CROWD_EFFECT_TYPE"] } end end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 40) AddInteraction(self, "interactionText", Localize("NPC_NP_AMB_YOU_CAN_CLICK_ON_EXHIBITS_TO_VOTE_FOR_THEM")) AddInteraction(self, "proximityAnim", "follow") AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_WOULD_YOU_LIKE_TO_KNOW_MORE_ABOUT_EXHIBITS?")) end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_GENERIC_CHECK_THIS_OUT!")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_CLICK_ME_TO_SEE_SOME_JUGGLING!")) endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) AddInteraction(self, "interactionAnim", "onclick") end-------------------------------------------------------------- -- (CLIENT SIDE) Script for the BBoy mission giver in -- scene 3 -- -- Responsible for registering with the client side -- zone object to control actions and animations. -- and passing data to the zone object when the local client -- completes/accepts missions. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) -- load my help --------------------- -- Mission 4 (dance for me) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{wsText = CONSTANTS["SCENE_3_MISSION_4_READY_COMPLETE_TEXT"] } GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_3_mission_4_ready_to_complete" } end) end -------------------------------------------------------------- -- Called when this object is ready to render -------------------------------------------------------------- function onRenderComponentReady(self, msg) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="SceneActorReady" } end -------------------------------------------------------------- -- Called when client clicks OK on a mission dialog -------------------------------------------------------------- function onMissionDialogueOK(self, msg) -- on mission 1 accept (find sherland) if (msg.missionID == CONSTANTS["SCENE_3_MISSION_1_ID"] and msg.bIsComplete == false) then self:PlayAnimation{ animationID = "talk" } -- on mission 3 complete (get our cd back) elseif (msg.missionID == CONSTANTS["SCENE_3_MISSION_3_ID"] and msg.bIsComplete == true) then GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_3_mission_3_complete" } -- on mission 4 accept (dance for us) elseif (msg.missionID == CONSTANTS["SCENE_3_MISSION_4_ID"] and msg.bIsComplete == false) then GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_3_mission_4_accept" } -- start local watch timer for the dance GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "CheckLocalCharacterMission",self ) -- on mission 4 complete (dance for us) elseif (msg.missionID == CONSTANTS["SCENE_3_MISSION_4_ID"] and msg.bIsComplete == true) then GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_3_mission_4_complete" } end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- check for the local character if (msg.name == "CheckLocalCharacterMission") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- check for mission state help, if fail keep watching local m4 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_4_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], m4.missionState) == false) then GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "CheckLocalCharacterMission",self ) end end end-------------------------------------------------------------- -- (CLIENT SIDE) Obstacle Course Starter NPC -- -- Starts the course for the player -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('client/ai/NP/L_NP_NPC') -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) self:SetVar("IsPlayerInCourse", false) -- @TODO: change to leaderboard at somepoint self:SetVar("PlayerBestTime", 0) SetProximityDistance(self, 20) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_TALK_TO_ME_TO_START_THE_COURSE")) end -------------------------------------------------------------- -- Happens on client interaction -------------------------------------------------------------- function onClientUse(self, msg) -- is player in course? if (self:GetVar("IsPlayerInCourse") == false) then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) strText = "" if (tonumber(self:GetVar("PlayerBestTime")) > 0) then strText = strText .. Localize("NPC_NP_AMB_YOUR_BEST_TIME") .. ": " .. ParseTime(self:GetVar("PlayerBestTime")) .. "\n\n" end strText = strText .. CONSTANTS["COURSE_STARTER_OFFER_TEXT"] .. "\n" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 1, callbackClient = self, text = strText, identifier = "Course_Start"} else -- Actions for already being in course self:DisplayChatBubble{ wsText = CONSTANTS["COURSE_STARTER_ACTIVE_TEXT"] } end end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this was from the local character if (GAMEOBJ:GetLocalCharID() == msg.sender:GetID()) then -- user wants to start the course if (msg.iButton == 1 and msg.identifier == "Course_Start") then -- tell the zone object about it GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_4_course_start" } self:DisplayChatBubble{ wsText = CONSTANTS["COURSE_STARTER_ACTIVE_TEXT"] } end end end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 1 -- -- On proximity of the local character, will approach and -- present help screen information for playing the game. -- When the player has finished reading the help, he will -- leave and despawn. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) self:SetVar("bHelpShown", false) self:SetVar("bFollow", false) end -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetProximityRadius { radius = CONSTANTS["FELIX_1_PROX_RADIUS"] } end -------------------------------------------------------------- -- Called when an entity gets within proximity of the object -------------------------------------------------------------- function onProximityUpdate(self, msg) -- if the local player is close enough to us if (msg.status == "ENTER") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) and (self:GetVar("bFollow") == false) then -- set flag to prevent re-following self:SetVar("bFollow", true) -- get the local character local player = msg.objId -- follow the player local mySpeed = self:GetSpeed().speed self:FollowTarget { targetID = player, radius = CONSTANTS["FELIX_1_INTERACT_RADIUS"], speed = mySpeed, keepFollowing = false } -- store the player in felix object to face on arrival storeObjectByName(self, "playerTarget", player) elseif (msg.status == "LEAVE") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then -- @TODO: anything here? Despawn? end end -------------------------------------------------------------- -- Called when object reaches destination -------------------------------------------------------------- function onArrived(self, msg) -- done following target if (msg.pathType == "FollowTarget") then ShowBigHelp(self) -- are we here because of a path? elseif (msg.pathType == "Waypoint") then if (msg.isLastPoint == true) then -- make felix leave/despawn, next frame self:SetVisible{ visible = false, fadeTime = 1.0 } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "Despawn",self ) else self:ContinueWaypoints() end end end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this was from the local character if (GAMEOBJ:GetLocalCharID() == msg.sender:GetID()) then -- flag the tooltip bit msg.sender:SetTooltipFlag{ iToolTip = CONSTANTS["PLAYER_FELIX_1_FLAG_BIT"], bFlag = true } -- unpause player msg.sender:SetUserCtrlCompPause{bPaused = false} -- set felix on his way self:SetVar("attached_path", CONSTANTS["FELIX_1_FLEE_PATHNAME"]) self:SetVar("attached_path_start", 0) self:FollowWaypoints() local mySpeed = self:GetSpeed().speed self:SetPathingSpeed{ speed = mySpeed } self:DisplayChatBubble{ wsText = CONSTANTS["FELIX_1_FLEE_TEXT"] } end end -------------------------------------------------------------- -- Handle notifications -------------------------------------------------------------- function onNotifyObject(self, msg) if (msg.name == "ForceHelp") then ShowBigHelp(self) end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if msg.name == "Despawn" then GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:DeleteObject(self) end end -------------------------------------------------------------- -- Try to show the big help -------------------------------------------------------------- function ShowBigHelp(self) if (self:GetVar("bHelpShown") == false) then -- set flag self:SetVar("bHelpShown", true) -- get the player i'm following local player = getObjectByName(self, "playerTarget") if (player) and (player:Exists()) then -- show help -- pause player player:SetUserCtrlCompPause{bPaused = true} -- face the player self:FaceTarget{ target = player, degreesOff = 5, keepFacingTarget = false } end end end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 2 -- -- On player interaction, felix will respond with help based -- on mission status. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) -- load my help --------------------- -- Mission 1 AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_THIS_GUY_NEEDS_YOUR_HELP,_TRY_CLICKING_ON_HIM") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_NOW_THAT_YOU_HAVE_FOUND_ALL_THE_BATTERIES,_CLICK_ON_HIM_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], MISSION_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_FOLLOW_THE_PATH_ACROSS_THE_BRIDGE,_I'LL_CATCH_UP") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_THE_BATTERIES_ARE_AROUND_HERE_SOMEWHERE") } end) end -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetProximityRadius { radius = CONSTANTS["FELIX_2_PROX_RADIUS"] } end -------------------------------------------------------------- -- Make this object interactable -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end -------------------------------------------------------------- -- Happens on client interaction -------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- try mission 1 local m1 = player:GetMissionState{ missionID = CONSTANTS["SCENE_2_MISSION_1_ID"] } ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], m1.missionState) end -------------------------------------------------------------- -- Called when an entity gets within proximity of the object -------------------------------------------------------------- function onProximityUpdate(self, msg) -- if the local player left our radius, try showing him the chat help if (msg.status == "LEAVE") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then ShowChatHelp(self) end end -------------------------------------------------------------- -- Check player and show chat help if player has not seen -------------------------------------------------------------- function ShowChatHelp(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then -- check the tooltip flag to see if he has done this event local tooltipMsg = player:GetTooltipFlag{ iToolTip = CONSTANTS["PLAYER_CHAT_HELP_FLAG_BIT"] } if ((tooltipMsg) and (tooltipMsg.bFlag == false)) then -- show tooltip UI:DisplayToolTip { strDialogText = CONSTANTS["SCENE_2_CHAT_HELP_TEXT"], strImageName = "", bShow=true, iTime=5000 } -- flag the tooltip bit player:SetTooltipFlag{ iToolTip = CONSTANTS["PLAYER_CHAT_HELP_FLAG_BIT"], bFlag = true } end end end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 3 -- -- On player interaction, felix will respond with help based -- on mission status. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) -- load my help --------------------- -- Mission 1 (talk to sherland) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_1_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_THE_BEASTIE_BLOCKS_NEED_YOUR_HELP,_TALK_TO_THE_KID_ON_STAGE") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_1_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_LOOK_AROUND_FOR_OLD_MAN_SHERLAND") } end) -- Mission 2 (get earphones) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_2_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_TALK_TO_OLD_MAN_SHERLAND_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_2_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GIVE_THE_EARPHONES_TO_OLD_MAN_SHERLAND") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_2_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_SMASH_SOME_CRATES_TO_FIND_OLD_MAN_SHERLAND'S_EARPHONES") } end) -- Mission 3 (return cd) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_3_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_TALK_TO_OLD_MAN_SHERLAND_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_3_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GIVE_THE_CD_TO_THE_KID_ON_STAGE") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_3_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GIVE_THE_CD_TO_THE_KID_ON_STAGE") } end) -- Mission 4 (use emote) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_THE_KID_ON_STAGE_WANTS_TO_TALK_TO_YOU_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_NICE_MOVES,_TALK_TO_THE_KID_ON_STAGE_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_STAND_ON_STAGE_AND_TYPE_'/DANCE'_IN_THE_CHATBOX,_THEN_PRESS_ENTER") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GOOD_JOB,_CONTINUE_DOWN_THE_PATH_AND_I'LL_CATCH_UP") } end) end -------------------------------------------------------------- -- Called when this object is ready to render -------------------------------------------------------------- function onRenderComponentReady(self, msg) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="SceneActorReady" } end -------------------------------------------------------------- -- Make this object interactable -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end -------------------------------------------------------------- -- Happens on client interaction -------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- start with mission 4 local m4 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_4_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], m4.missionState) == false) then -- try mission 3 local m3 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_3_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_3_ID"], m3.missionState) == false) then -- try mission 2 local m2 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_2_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_2_ID"], m2.missionState) == false) then -- try mission 1 local m1 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_1_ID"] } ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_1_ID"], m1.missionState) end end end end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 4 -- -- On player interaction, felix will respond with help based -- on mission status. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('client/ai/NP/L_NP_NPC') -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_NP_FELIX_STEP_ON_THE_BOUNCER_TO_GET_TO_THE_COURSE")) AddInteraction(self, "proximityText", Localize("NPC_NP_FELIX_WELCOME_TO_THE_NIMBUS_PARK_OBSTACLE_COURSE")) end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 5 -- -- On player interaction, felix will respond with help based -- on mission status. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) -- load my help --------------------- -- Mission 1 AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_1_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_THIS_GUY_NEEDS_YOUR_HELP,_TRY_CLICKING_ON_HIM") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_1_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_YOU'VE_FOUND_ALL_THE_BRICKS,_NOW_TALK_TO_HIM_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_1_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_IF_YOU_NEED_BRICKS,_TRY_SMASHING_THINGS_IN_THE_ROCK_GARDEN_UP_AHEAD") } end) -- Mission 2 AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_2_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GOOD_JOB,_TALK_TO_HIM_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_2_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_NICE_JOB_BUILDING_IT,_NOW_TALK_TO_HIM_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_2_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_TRY_BUILDING_ONE_OF_THE_STATUES_IN_THE_AREA_BY_CLICKING_ON_IT") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_2_ID"], MISSION_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GREAT_JOB._FOLLOW_THE_PATH_AND_I'LL_CATCH_UP_IN_A_FEW") } end) end -------------------------------------------------------------- -- Make this object interactable -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end -------------------------------------------------------------- -- Happens on client interaction -------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- try mission 2 local m2 = player:GetMissionState{ missionID = CONSTANTS["SCENE_5_MISSION_2_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_2_ID"], m2.missionState) == false) then -- try mission 1 local m1 = player:GetMissionState{ missionID = CONSTANTS["SCENE_5_MISSION_1_ID"] } ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_5_MISSION_1_ID"], m1.missionState) end end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 6 -- -- On player interaction, felix will respond with help based -- on mission status. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) -- load my help --------------------- -- Mission 1 AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_1_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_ANTS_ARE_RUINING_EVERYONE'S_PICNIC._TALK_TO_THAT_GUY_UP_AHEAD_TO_FIND_OUT_MORE") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_1_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GOOD_JOB,_NOW_TALK_TO_HIM_AGAIN") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_1_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_TRY_SMASHING_SOME_ANTS_IN_THE_PARK") } end) -- Mission 2 AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_2_ID"], MISSION_AVAILABLE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_NOW_THAT_YOU_UNDERSTAND_COMBAT,_HEAD_UP_THE_HILL._THERE'S_SOMETHING_FISHY_GOING_ON") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_2_ID"], MISSION_READY_TO_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_YOU'VE_STOPPED_THE_MOWERS,_NOW_RETURN_TO_THE_GUY") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_2_ID"], MISSION_ACTIVE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_TRY_SMASHING_SOME_OF_THE_CORRUPTED_MOWERS,_BE_CAREFUL_THEY_CAN_HURT_YOU") } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_2_ID"], MISSION_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_NP_FELIX_GREAT_JOB._NOW_CONTINUE_ON_AND_I'LL_SEE_YOU_AROUND") } end) end -------------------------------------------------------------- -- Make this object interactable -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end -------------------------------------------------------------- -- Happens on client interaction -------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- try mission 2 local m2 = player:GetMissionState{ missionID = CONSTANTS["SCENE_6_MISSION_2_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_2_ID"], m2.missionState) == false) then -- try mission 1 local m1 = player:GetMissionState{ missionID = CONSTANTS["SCENE_6_MISSION_1_ID"] } ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_6_MISSION_1_ID"], m1.missionState) end end -------------------------------------------------------------- -- (CLIENT SIDE) Friendly Felix in Scene 7 -- -- On player interaction, felix will respond with help based -- on mission status. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('client/ai/NP/L_NP_NPC') -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) SetProximityDistance(self, 60) AddInteraction(self, "proximityText", Localize("NPC_NP_FELIX_YOU'VE_FINISHED_NIMBUS_PARK!_I_CAN_TAKE_YOU_TO_YOUREEKA")) end -------------------------------------------------------------- -- Make this object interactable -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --Interactive type return msg end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional --SetMouseOverDistance(self, 30) SetProximityDistance(self, 25) AddInteraction(self, "proximityText", "Can you help me turn this jetpack on?") AddInteraction(self, "proximityText", "Can you turn this jetpack on for me?") end require('o_mis') require('client/ai/NP/L_NP_NPC') local cooldown = 23.0 function onStartup(self) self:SetVar("Usable", true) --set the vars for interaction. NOTE: any/all of thses are optional --SetMouseOverDistance(self, 30) SetProximityDistance(self, 25) AddInteraction(self, "proximityText", "Grrrrrrrr!") AddInteraction(self, "proximityText", "Rowr!") end function onClientUse(self, msg) if (self:GetVar("Usable") == false) then return else -- otherwise set us as not usable (because we are using now) self:SetVar("Usable", false) self:PlayAnimation{animationID = "interact"} GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "DoSound",self ) end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- set our state as usable if (msg.name == "Cooldown") then self:SetVar("Usable", true) -- keep moving elseif (msg.name == "DoSound") then local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) player:PlaySound{strSoundName="raptor"} GAMEOBJ:GetTimer():AddTimerWithCancel( cooldown, "Cooldown",self ) end endrequire('o_mis') function onStartup(self) registerWithZoneControlObject(self) end -------------------------------------------------------------- -- Called when this object is ready to render -------------------------------------------------------------- function onRenderComponentReady(self, msg) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="SceneActorReady" } end-------------------------------------------------------------- -- (CLIENT SIDE) Script for the mission giver in -- scene 2 -- -- Responsible for registering with the client side -- zone object to control actions and animations. -- and passing data to the zone object when the local client -- completes/accepts missions. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('client/ai/NP/L_NP_NPC') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], MISSION_COMPLETE, function(self) self:DisplayChatBubble{ wsText = Localize("NPC_GENERIC_THANKS_FOR_YOUR_HELP") } end) SetProximityDistance(self, 30) AddInteraction(self, "proximityAnim", "attention") end -------------------------------------------------------------- -- Called when client clicks OK on a mission dialog -------------------------------------------------------------- function onMissionDialogueOK(self, msg) -- on mission 1 complete (collectible batteries) if (msg.missionID == CONSTANTS["SCENE_2_MISSION_1_ID"] and msg.bIsComplete == true) then GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_2_mission_1_complete" } end end -------------------------------------------------------------- -- Called when client clicks on the npc -------------------------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- try mission 1 local m1 = player:GetMissionState{ missionID = CONSTANTS["SCENE_2_MISSION_1_ID"] } ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], m1.missionState) end-------------------------------------------------------------- -- (CLIENT SIDE) Script for the Sherland mission giver in -- scene 3 -- -- Responsible for registering with the client side -- zone object to control actions and animations. -- and passing data to the zone object when the local client -- completes/accepts missions. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') require('o_MissionHelp') -- local table to hold mission data MISSION_DATA = {} -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) -- load my help --------------------- -- Mission 3 (give mic back) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_READY_TO_COMPLETE, function(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_3_mission_4_ready_to_complete" } end) end -------------------------------------------------------------- -- Called when client clicks OK on a mission dialog -------------------------------------------------------------- function onMissionDialogueOK(self, msg) -- on mission 2 accept (smash crates) if (msg.missionID == CONSTANTS["SCENE_3_MISSION_2_ID"] and msg.bIsComplete == false) then self:PlayAnimation{ animationID = "talk" } -- on mission 3 accept (give mic back) elseif (msg.missionID == CONSTANTS["SCENE_3_MISSION_3_ID"] and msg.bIsComplete == false) then self:PlayAnimation{animationID = "mission_complete"} end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- check for the local character if (msg.name == "CheckLocalCharacterMission") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- check for mission state help, if fail keep watching local m4 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_4_ID"] } if (ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], m4.missionState) == false) then GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "CheckLocalCharacterMission",self ) end end end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 20) AddInteraction(self, "interactionText", "I hope no one presses that red button over there.") AddInteraction(self, "interactionText", "Is that all the troll can carry?") AddInteraction(self, "interactionText", "Did you check the collision on these fences? I heard Sean W. exported them.") AddInteraction(self, "interactionText", "This area is under construction.") AddInteraction(self, "interactionText", "Watch your step. This area is under construction.") AddInteraction(self, "proximityText", "No, no, no ... over there!") AddInteraction(self, "proximityText", "Break time is over!") AddInteraction(self, "proximityText", "We gotta get this building done.") end -------------------------------------------------------------- -- (CLIENT SIDE) Generic script for actors in scene 2 -- -- Responsible for registering with the client side -- zone object to control actions and animations. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) end -------------------------------------------------------------- -- (CLIENT SIDE) Generic script for actors in scene 3 -- -- Responsible for registering with the client side -- zone object to control actions and animations. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- register ourself to be instructed later registerWithZoneControlObject(self) end -------------------------------------------------------------- -- Called when this object is ready to render -------------------------------------------------------------- function onRenderComponentReady(self, msg) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="SceneActorReady" } end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Client side script for Static Cannon --// - Fires periodically on the client within an interval and after a cooldown --// - Only fires if the player is within specified distance --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Parameters and Constants -------------------------------------------------------------- -- interval of time a fire can occur in (int seconds) local minInterval = 5 local maxInterval = 10 -- cooldown from firing, will not fire again until cooldown is complete (float seconds) local fireCooldown = 5.0 -- player must be within min distance or firing won't happen local proxRadius = 240.0 -------------------------------------------------------------- -- Startup of object -------------------------------------------------------------- function onStartup(self) SetIsActive(self, false) end -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetProximityRadius { radius = proxRadius } end -------------------------------------------------------------- -- Called when an entity gets within proximity of the object -------------------------------------------------------------- function onProximityUpdate(self, msg) -- if the local player is close enough to us if (msg.status == "ENTER") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then SetIsActive(self, true) SetupFireTimer(self) elseif (msg.status == "LEAVE") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then -- cancel all timers SetIsActive(self, false) GAMEOBJ:GetTimer():CancelAllTimers( self ) end end -------------------------------------------------------------- -- Setup timer for firing -------------------------------------------------------------- function SetupFireTimer(self) if (IsActive(self) == true) then local ran = math.random(minInterval,maxInterval) GAMEOBJ:GetTimer():AddTimerWithCancel( ran, "DoFire",self ) end end -------------------------------------------------------------- -- Cannon plays effects -------------------------------------------------------------- function DoFireEffect(self) if (IsActive(self) == true) then self:PlayFXEffect{ effectType = "fire" } --self:PlayFXEffect{ effectType = "onfire2_large" } --self:PlayFXEffect{ effectType = "environment_fire" } GAMEOBJ:GetTimer():AddTimerWithCancel( fireCooldown, "FireCooldown",self ) end end -------------------------------------------------------------- -- Get IsActive state -------------------------------------------------------------- function IsActive(self) return self:GetVar("IsActive") end -------------------------------------------------------------- -- Set IsActive State -------------------------------------------------------------- function SetIsActive(self, bActive) self:SetVar("IsActive", bActive) end -------------------------------------------------------------- -- Called when timers complete -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "DoFire") then DoFireEffect(self) end if (msg.name == "FireCooldown") then SetupFireTimer(self) end end -------------------------------------------------------------- -- (CLIENT SIDE) Script for meteors in scene 2 -- -------------------------------------------------------------- -------------------------------------------------------------- -- Called when an object hits the final waypoint on a path -------------------------------------------------------------- function onPlatformAtLastWaypoint(self, msg) -- notify the zone object, pass our template id GAMEOBJ:GetZoneControlID():NotifyObject{ name = "meteor_path_complete", param1 = self:GetLOT().objtemplate } -- remove ourself GAMEOBJ:DeleteObject(self) end require('o_mis') -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetMouseOverDistance(self, dist) if (self and self:Exists()) then self:SetVar("interactDistance", dist) end end -------------------------------------------------------------- -- sets the proximity for the object -------------------------------------------------------------- function SetProximityDistance(self, dist) if (self and self:Exists()) then self:SetVar("proxDistance", dist) self:SetProximityRadius{radius = self:GetVar("proxDistance")} end end -------------------------------------------------------------- -- check for valid type -------------------------------------------------------------- function IsValidType(type) if (type == "mouseOverEffect" or type == "mouseOverAnim" or type == "mouseOverText" or type == "interactionEffect" or type == "interactionAnim" or type == "interactionText" or type == "proximityEffect" or type == "proximityAnim" or type == "proximityText") then return true; end return false end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction(self, type, action) if (self and self:Exists()) then -- check type if (IsValidType(type) == false) then print("Bad Type of Interaction") return end local table = self:GetVar(type) -- init table if need to if (table == nil) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- override pick type to be interactive -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --interactive type return msg end -------------------------------------------------------------- -- handle cursor over object -------------------------------------------------------------- function onCursorOn(self, msg) -- do effects local effects = self:GetVar("mouseOverEffect") if effects and #effects > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("mouseOverAnim") if anims and #anims > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("mouseOverText") if texts and #texts > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle client use -------------------------------------------------------------- function onClientUse(self, msg) -- do effects local effects = self:GetVar("interactionEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("interactionAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("interactionText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() then -- do effects local effects = self:GetVar("proximityEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("proximityAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("proximityText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end end end -- The destination string is seperated by semi-colons so HF can -- set config data easily function onCollision(self, msg) local target = msg.objectID local faction = target:GetFaction() -- If a player collided with me, then do our stuff if faction and faction.faction == 1 then local vecString = self:GetVar("bouncer_destination") local speed = self:GetVar("bouncer_speed") if vecString and speed then -- Parse the vector3 from the level file into three floats local posX, posY, posZ = string.match(vecString, "(%p?%w+%p?%w+);(%p?%w+%p?%w+);(%p?%w+%p?%w+)") -- Create a vector in Lua to pass in message local vec = {x = posX, y = posY, z = posZ} self:PlayFXEffect{effectType = "onbounce"} target:PlayFXEffect{effectType = "onbounce", priority = 1.1} target:BouncePlayer{niDestPt = vec, fSpeed = speed} end end msg.ignoreCollision = true return msg end -- param1 = scene number function onNotifyObject(self, msg) if msg.name == "startCam" then -- get path local path = self:GetVar("camPath") if (path) and (msg.param1 > 0) then -- save scene self:SetVar("SceneNum", msg.param1) -- set camera up self:SetMovingPlatformParams{ wsPlatformPath = path, iStartIndex = 0 } CAMERA:ActivateCamera("CAMERA_ATTACHED") CAMERA:AttachCameraToObj("CAMERA_ATTACHED", self, true, true) CAMERA:SetRenderCamera("CAMERA_ATTACHED") end end end function onPlatformAtLastWaypoint(self, msg) -- return to prev camera CAMERA:SetToPrevGameCam() -- notify zone object that we are done local sceneNum = self:GetVar("SceneNum") if (sceneNum) then GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_" .. sceneNum .. "_end" } end end -- hide self on render function onRenderComponentReady(self, msg) self:SetVisible{ visible = false } end-------------------------------------------------------------- -- (CLIENT SIDE) Changing statues in scene 1 -- -- On proximity of the local character, will change statue. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Startup of object -------------------------------------------------------------- function onStartup(self) -- current Model's LOT self:SetVar("CurrentModel",CONSTANTS["LOT_NULL"]) -- flag for tracking if statue is ready to change SetIsReady(self,true) -- get a model LOT local newLOT = SelectNewModel(self, CONSTANTS["SCENE_1_STATUE_LOTS"]) -- spawn a model SpawnModel(self, newLOT) end -------------------------------------------------------------- -- Called when rendering is complete for this object -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetProximityRadius { radius = CONSTANTS["SCENE_1_STATUE_PROX_RADIUS"] } end -------------------------------------------------------------- -- Called when an entity gets within proximity of the object -------------------------------------------------------------- function onProximityUpdate(self, msg) -- if the local player is close enough to us if (msg.status == "ENTER") and (IsReady(self)) and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then -- spawn a random model local newLOT = SelectNewModel(self, CONSTANTS["SCENE_1_STATUE_LOTS"]) SpawnModel(self, newLOT) end end -------------------------------------------------------------- -- Picks a random model and returns the LOT. Will not pick -- the currently displayed model's LOT -------------------------------------------------------------- function SelectNewModel(self, lotTable) -- cases of 0 or 1 statue LOT if (#lotTable < 1) then return CONSTANTS["LOT_NULL"] elseif (#lotTable == 1) then return lotTable[1] end -- get current model LOT local curModel = self:GetVar("CurrentModel") local ranModel = curModel -- pick a random model until different while (ranModel == curModel) do local ran = math.random(1,#lotTable) ranModel = lotTable[ran] end return ranModel end -------------------------------------------------------------- -- Setup timer for firing -------------------------------------------------------------- function SpawnModel(self, modelLOT) if (IsReady(self) == true) then -- get current model local childModel = getObjectByName(self,"childModel") if (childModel) then -- show change effect childModel::PlayFXEffect{ effectID = CONSTANTS["SCENE_1_STATUE_EFFECT_ID"], effectType = CONSTANTS["SCENE_1_STATUE_EFFECT_TYPE"] } -- get rid of the child GAMEOBJ:DeleteObject(childModel) end -- spawn the new model in local mypos = self:GetPosition().pos mypos.x = mypos.x + CONSTANTS["SCENE_1_STATUE_OFFSET"].x mypos.y = mypos.y + CONSTANTS["SCENE_1_STATUE_OFFSET"].y mypos.z = mypos.z + CONSTANTS["SCENE_1_STATUE_OFFSET"].z RESMGR:LoadObject { objectTemplate = modelLOT, x = mypos.x, y = mypos.y, z = mypos.z, owner = self } -- store new model's LOT self:SetVar("CurrentModel", modelLOT) -- set ready to false and create a cooldown SetIsReady(self, false) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["SCENE_1_STATUE_COOLDOWN"], "ReadyCooldown",self ) end end -------------------------------------------------------------- -- Get IsReady state -------------------------------------------------------------- function IsReady(self) return self:GetVar("IsReady") end -------------------------------------------------------------- -- Set IsReady State -------------------------------------------------------------- function SetIsReady(self, bReady) self:SetVar("IsReady", bReady) end -------------------------------------------------------------- -- Called when timers complete -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "ReadyCooldown") then SetIsReady(self,true) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- store spawn for use later storeObjectByName(self, "childModel", msg.childID) end-------------------------------------------------------------- -- (CLIENT SIDE) Trigger for Course Cancel -- -- Cancels the course for the player -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- if the local character is entering the trigger if (msg.objectID:GetID() == GAMEOBJ:GetLocalCharID()) then -- tell the zone object about it GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_4_course_cancel" } end -- ignore collisions msg.ignoreCollision = true return msg end -------------------------------------------------------------- -- (CLIENT SIDE) Trigger for Course Finish -- -- Ends the course for the player -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- if the local character is entering the trigger if (msg.objectID:GetID() == GAMEOBJ:GetLocalCharID()) then -- tell the zone object about it GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_4_course_finish" } end -- ignore collisions msg.ignoreCollision = true return msg end -------------------------------------------------------------- -- (CLIENT SIDE) Trigger for Felix in Scene 1 -- -- Responsible for spawning felix for the player on the client -- if the client has not completed the scene 1 felix event. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- CONSTANTS["PLAYER_WATCH_TIMER_INTERVAL"] = 1.0 -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) -- start a local character watch timer GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["PLAYER_WATCH_TIMER_INTERVAL"], "CheckLocalCharacterExists",self ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- check for the local character if (msg.name == "CheckLocalCharacterExists") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- restart the timer and try again -- if local character is not ready yet if (GAMEOBJ:GetLocalCharID() ~= CONSTANTS["NO_OBJECT"]) then -- try to spawn felix DoFelixSpawn(self) else GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["PLAYER_WATCH_TIMER_INTERVAL"], "CheckLocalCharacterExists",self ) end end end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- if the local character is passing through the trigger if (msg.objectID:GetID() == GAMEOBJ:GetLocalCharID()) then -- force felix interaction if he still exists local felix = getObjectByName(self, "felixObj") if (felix and felix:Exists()) then felix:NotifyObject{ name = "ForceHelp" } end end -- ignore collisions msg.ignoreCollision = true return msg end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- store spawn for use later storeObjectByName(self, "felixObj", msg.childID) -- store who the parent is storeParent(self, msg.childID) end -------------------------------------------------------------- -- Check player and spawn felix if needed -------------------------------------------------------------- function DoFelixSpawn(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then -- check the tooltip flag to see if he has done this event local tooltipMsg = player:GetTooltipFlag{ iToolTip = CONSTANTS["PLAYER_FELIX_1_FLAG_BIT"] } if ((tooltipMsg) and (tooltipMsg.bFlag == false)) then -- spawn in felix RESMGR:LoadObject { objectTemplate = CONSTANTS["FELIX_1_LOT"], x = CONSTANTS["FELIX_1_SPAWN_POS"].x, y = CONSTANTS["FELIX_1_SPAWN_POS"].y, z = CONSTANTS["FELIX_1_SPAWN_POS"].z, rw = CONSTANTS["FELIX_1_SPAWN_ROT"].w, rx = CONSTANTS["FELIX_1_SPAWN_ROT"].x, ry = CONSTANTS["FELIX_1_SPAWN_ROT"].y, rz = CONSTANTS["FELIX_1_SPAWN_ROT"].z, owner = self } end end end -------------------------------------------------------------- -- (CLIENT SIDE) Trigger for Help -- -- Responsible for showing help information to player when -- he is in the trigger for a certain period of time. -- Same script works for all triggers via c_NimbusPark.lua -- constants. -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) GAMEOBJ:GetTimer():CancelAllTimers( self ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "ShowHelp") then -- show help information based on this object's LOT if (CONSTANTS["HELP_TRIGGER_DATA"][self:GetLOT().objtemplate] ~= nil) then UI:DisplayToolTip { strDialogText = CONSTANTS["HELP_TRIGGER_DATA"][self:GetLOT().objtemplate], strImageName = "", bShow=true, iTime=0 } end end end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- if the local character is passing through the trigger if (msg.objectID:GetID() == GAMEOBJ:GetLocalCharID()) then -- start a timer to trigger help GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["HELP_TRIGGER_IDLE_TIME"], "ShowHelp",self ) end -- ignore collisions msg.ignoreCollision = true return msg end -------------------------------------------------------------- -- Off Collision -------------------------------------------------------------- function onOffCollision(self, msg) -- if the local character is leaving the trigger if (msg.senderID:GetID() == GAMEOBJ:GetLocalCharID()) then -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- close the tooltip UI:DisplayToolTip { strDialogText = "...", strImageName = "", bShow=false, iTime=0 } end end -------------------------------------------------------------- -- (CLIENT SIDE) Trigger for Scene 2 client-side event -- -- Responsible for starting scene 2 events based on mission -- state of the player or tooltip help -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_NimbusPark') -------------------------------------------------------------- -- Object specific constants -------------------------------------------------------------- -------------------------------------------------------------- -- Called when object is loaded into the level -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- On Collision -------------------------------------------------------------- function onCollision(self, msg) -- if the local character is passing through the trigger if (msg.objectID:GetID() == GAMEOBJ:GetLocalCharID()) then -- test flag for event local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local tooltipMsg = player:GetTooltipFlag{ iToolTip = CONSTANTS["SCENE_2_EVENT_FLAG_BIT"] } -- if the player has NOT seen the event if ((tooltipMsg) and (tooltipMsg.bFlag == false)) then -- set the flag player:SetTooltipFlag{ iToolTip = CONSTANTS["SCENE_2_EVENT_FLAG_BIT"], bFlag = true } -- start the scene event GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_2_start" } end end -- ignore collisions msg.ignoreCollision = true return msg end function onCollisionPhantom(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{name = "CollectableCollected"} GAMEOBJ:DeleteObject(self) return msg endfunction onCollisionPhantom(self, msg) GAMEOBJ:GetZoneControlID():NotifyObject{name = "BigCollectableCollected"} GAMEOBJ:DeleteObject(self) return msg end-------------------------------------------------------------- -- Displays a fancy animation as you walk up to Faction Vendors -- created by cassie -- updated mrb... 1/18/10 -------------------------------------------------------------- -- OnEnter Proximity Radius function onStartup(self,msg) -- set up the proximity radius self:SetProximityRadius { radius = 30 } end function onProximityUpdate(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check to see if we are the correct player if playerID ~= msg.objId:GetID() then return end local animTime = 0 local animName = "next" -- pick the correct animation based on enter or leave if (msg.status == "ENTER") then animName = "next" elseif (msg.status == "LEAVE") then animName = "back" end -- Get the animation time based on animName animTime = self:GetAnimationTime{animationID = animName}.time -- play the UI animation UI:SendMessage( "FactionSign_" .. animName, {}, self ) -- play the correct animation self:PlayAnimation{animationID = "next", bPlayImmediate = true} -- cancel all timers and start one based on animName and animTime GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( animTime, animName, self ) --print(animName .. ' ' .. animTime) end -- timers... function onTimerDone(self, msg) -- play the correct idle animation if msg.name == "back" then self:PlayAnimation{animationID = "Sign1", bPlayImmediate = true} elseif msg.name == "next" then self:PlayAnimation{animationID = "Sign2", bPlayImmediate = true} end end ------------------------------------------------------------- -- constants -------------------------------------------------------------- -- constants for the NPC that wants to see a dance emote -------------------------------------------------------------- local CONSTANTS = {} -- the mission number for dancing in front of this NPC CONSTANTS["DANCE_ADMIRER_MISSION"] = 175 -------------------------------------------------------------- -- constants for dancing up near the disco ball -------------------------------------------------------------- -- the group an NPC must be assigned to in Happy Flower in order for it to mirror the player's dancing CONSTANTS["CONCERT_FAN_GROUP"] = "dance_crowd" -- indices for the acceptable dances, same as above CONSTANTS["INDEX_DWARF"] = 1 CONSTANTS["INDEX_FIREFIGHTER"] = 2 CONSTANTS["INDEX_BREAKDANCE"] = 3 CONSTANTS["INDEX_SKILLZ"] = 4 -- the corresponding animations (from Emotes table in database) CONSTANTS["DISCO_ANIMS"] = {} CONSTANTS["DISCO_ANIMS"][CONSTANTS["INDEX_DWARF"]] = "headbang" -- emote 207 CONSTANTS["DISCO_ANIMS"][CONSTANTS["INDEX_FIREFIGHTER"]] = "hat-dance" -- emote 208 CONSTANTS["DISCO_ANIMS"][CONSTANTS["INDEX_BREAKDANCE"]] = "breakdance" -- emote 192 CONSTANTS["DISCO_RECHECK_DELAY"] = 1.0 CONSTANTS["DISCO_RADIUS"] = 30 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) self:SetProximityRadius{ radius = CONSTANTS["DISCO_RADIUS"] } SetTimerToCheckProximity( self ) end -------------------------------------------------------------- -- Set a timer to check whether the player is dancing nearby -------------------------------------------------------------- function SetTimerToCheckProximity( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["DISCO_RECHECK_DELAY"], "checkProximity", self ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "checkProximity" ) then CheckProximity( self ) SetTimerToCheckProximity( self ) end end -------------------------------------------------------------- -- check whether the local player is nearby doing a dance emote -- if so, make the crowd do the same dance -- for each item in this NPC's proximity: -- first check if it's the local player -- and is playing the corresponding anim -------------------------------------------------------------- function CheckProximity( self ) -- get a list of all the objects within proximity local proxObjs = self:GetProximityObjects().objects -- go through the list and check each one for i = 1 , table.maxn( proxObjs ) do local nearbyObj = proxObjs[i] -- check to see if it's the local player and doing a dance emote local emoteNum = GetLocalPlayersDanceEmote( nearbyObj ) if ( emoteNum ~= -1 ) then MakeCrowdDance( self, emoteNum ) return end end MakeCrowdStop( self ) end -------------------------------------------------------------- -- returns the name of the dance emote ID that the local player is playing -- or -1 if the local player isn't playing a dance emote nearby -------------------------------------------------------------- function GetLocalPlayersDanceEmote( obj ) -- check if the object is even a player if ( IsLocalPlayer( obj ) == false ) then return -1 end for emoteIndex = 1 , table.maxn( CONSTANTS["DISCO_ANIMS"] ) do if ( IsPlayingEmoteAnim( obj, CONSTANTS["DISCO_ANIMS"][emoteIndex] ) ) then return CONSTANTS["DISCO_ANIMS"][emoteIndex] end end return -1 end -------------------------------------------------------------- -- returns whether or not given the obj is the local character -------------------------------------------------------------- function IsLocalPlayer( obj ) return ( obj:GetID() == GAMEOBJ:GetLocalCharID() ) end -------------------------------------------------------------- -- returns whether or not the given player is playing the given anim -------------------------------------------------------------- function IsPlayingEmoteAnim( player, anim ) local emoteMsg = player:GetCurrentAnimation{} return ( emoteMsg.primaryAnimationID == anim or emoteMsg.secondaryAnimationID == anim ) end -------------------------------------------------------------- -- any NPC's in the group should play the given anim -------------------------------------------------------------- function MakeCrowdDance( self, anim ) local crowdObjects = self:GetObjectsInGroup{ group = CONSTANTS["CONCERT_FAN_GROUP"] }.objects for i = 1, table.maxn ( crowdObjects ) do crowdObjects[i]:PlayAnimation{ animationID = anim } end end -------------------------------------------------------------- -- any NPC's in the group should play their idles -------------------------------------------------------------- function MakeCrowdStop( self ) local crowdObjects = self:GetObjectsInGroup{ group = CONSTANTS["CONCERT_FAN_GROUP"] }.objects for i = 1, table.maxn ( crowdObjects ) do crowdObjects[i]:PlayAnimation{ animationID = "idle" } end end--------------------------------------------------------------------------------------------------------- -- Client-side script for Concert instrument Quick Builds. -- When an instrument is built, it locks the mini-fig into an imagination-draining animation. -- This lasts until the player runs out of imagination or moves voluntarily. -- Players will hear different music depending on which instruments are currently being played. -- updated mrb... 5/17/10 - removed setimagination and firing event to server instead --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- constants for the musical instruments quickbuilds -------------------------------------------------------------- local CONSTANTS = {} -- the object template for each instrument CONSTANTS["INSTRUMENT_LOT_GUITAR"] = 4039 CONSTANTS["INSTRUMENT_LOT_BASS"] = 4040 CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] = 4041 CONSTANTS["INSTRUMENT_LOT_DRUM"] = 4042 -- the anim used to show the player playing each instrument CONSTANTS["INSTRUMENT_ANIM"] = {} CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "drums" -- the anim used to show the player smashing each instrument CONSTANTS["INSTRUMENT_SMASH_ANIM"] = {} CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = -1 -- has no smashing anim -- the music used for each instrument CONSTANTS["INSTRUMENT_MUSIC"] = {} CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Guitar" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Bass" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Keys" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Drums" -- path set up through Happy Flower for the cinematic for each instrument CONSTANTS["INSTRUMENT_CINEMATIC"] = {} CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Cam_G" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Cam_B" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Cam_K" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Cam_D" -- the LOT for the left hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 4991 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 4992 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- no equippable used CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4995 -- the LOT for the right hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4996 -- whether or not to hide the completed quickbuild while the player is playing the instrument CONSTANTS["INSTRUMENT_HIDE"] = {} CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = false CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = false -- once the smash anim starts playing, how long to wait before unequipping the instrument CONSTANTS["INSTRUMENT_UNEQUIP_TIME"] = {} CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 1.033 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 0.94 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- has no equippables CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 0 -- has no smash anim, unequip immediately -- how much imagination is repeatedly drained while the instrument is being played CONSTANTS["INSTRUMENT_IMAGINATION_COST"] = 2 -- how often imagination is drained while playing the instrument CONSTANTS["INSTRUMENT_COST_FREQUENCY"] = 4.0 -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- copied from enum ERebuildChallengeState in lwoGame \ include \ LWORebuild.h CONSTANTS["REBUILD_STATE_COMPLETED"] = 2 -- Challenge complete CONSTANTS["UPDATE_FREQUENCY"] = 0.1 -- while playing the instrument, how often we check whether the player hit a movement key to stop playing -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) self:SetVar( "bBeingPlayed", false ) self:SetVar( "activePlayer", nil ) ResetEquippableIDs( self ) self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) self:SetVar( "leftInventoryLOT", -1 ) self:SetVar( "rightInventoryLOT", -1 ) self:SetVar( "reequipPlayer", nil ) end -------------------------------------------------------------- -- called anytime the rebuild object's state changes -------------------------------------------------------------- function onRebuildNotifyState( self, msg) -- make sure we didn't attach this script to some object besides our quickbuild instruments local instrumentLOT = self:GetLOT().objtemplate if ( IsValidInstrument( instrumentLOT ) == false ) then return end -- When the Quick Build is completed, the player gets to play it if they have any imagination if ( msg.iState == CONSTANTS["REBUILD_STATE_COMPLETED"] ) then storeObjectByName( self, "activePlayer", msg.player ) QuickBuildWasBuilt( self ) end end function QuickBuildWasBuilt( self ) -- take control away from the player SetPlayerControl( self, false ) -- set timers for when to hide the completed quickbuild and show the player playing the instrument -- do this quicky so we don't have to watch the finished quickbuild model to slam into place -- but we have to wait slightly first or get overridden by the quickbuild code GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Hide", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Play", self ) end -------------------------------------------------------------- -- checks whether the given LOT is one of the instrument quickbuilds -------------------------------------------------------------- function IsValidInstrument( LOT ) return ( LOT == CONSTANTS["INSTRUMENT_LOT_GUITAR"] or LOT == CONSTANTS["INSTRUMENT_LOT_BASS"] or LOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] or LOT == CONSTANTS["INSTRUMENT_LOT_DRUM"] ) end -------------------------------------------------------------- -- show the camera panning around the concert area -------------------------------------------------------------- function PlayCinematic( self, instrumentLOT ) local player = GetActivePlayer( self ) if ( player ~= nil ) then local szPathName = CONSTANTS["INSTRUMENT_CINEMATIC"][instrumentLOT] player:PlayCinematic { pathName = szPathName } end end -------------------------------------------------------------- -- play the animation of the mini-fig playing the given instrument -------------------------------------------------------------- function PlayInstrumentAnim( self, instrumentLOT ) -- start the animation local player = GetActivePlayer( self ) player:ChangeIdleFlags{off = 1} if ( IsLocalPlayerActive( self ) == false ) then return end if ( player ~= nil ) then self:FireEventServerSide{ senderID = player, args = "playInstrumentAnim", param1 = instrumentLOT } end end -------------------------------------------------------------- -- add or remove music according to which instrument someone just started or stopped playing -- pass true to bActivate to turn the music on, or false to turn it off. -------------------------------------------------------------- function AffectMusic( self, instrumentLOT, bActivate) if ( IsLocalPlayerActive( self ) == false ) then return end local szMusicName = CONSTANTS["INSTRUMENT_MUSIC"][instrumentLOT] local player = GAMEOBJ:GetControlledID() if ( player ~= nil ) then local instrumentLOT = self:GetLOT().objtemplate if ( bActivate ) then self:FireEventServerSide{ senderID = player, args = "startMusic", param1 = instrumentLOT } else self:FireEventServerSide{ senderID = player, args = "stopMusic", param1 = instrumentLOT } end end end -------------------------------------------------------------- -- start the process of seeing the player playing the instrument -------------------------------------------------------------- function PlayInstrument( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end local instrumentLOT = self:GetLOT().objtemplate -- remember that someone is using this instrument self:SetVar( "bBeingPlayed", true ) -- load any related equippables (guitar, bass, drumsticks), which will equip onto the player --self:FireEventServerSide{ args = "swapEquippables", senderID = player } RememberInventoryItems( self ) -- start keeping track of movement key presses long enough to know if the player wants to break out of playing the instument TrackRecentMovementKeys( self, true ) -- show the cinematic PlayCinematic( self, instrumentLOT ) -- play the animation of the mini-fig playing the given instrument ResetPlayersAnim( self ) -- try to stop the quickbuild victory anim PlayInstrumentAnim( self, instrumentLOT ) -- start the appropriate music AffectMusic( self, instrumentLOT, true ) -- start a timer for when to check whether the instrument is still being played StartUpdateTimer( self ) -- start a timer for decreasing the player's imagination StartImaginationCostTimer( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 20, "AchievementTimer_20", self ) end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "Hide" ) then HideQuickbuild( self, self:GetLOT().objtemplate ) RepositionPlayer( self, self:GetLOT().objtemplate ) elseif ( msg.name == "Play" ) then PlayInstrument( self ) elseif ( msg.name == "CheckOnPlayer" ) then UpdateBeingPlayed( self ) elseif ( msg.name == "DecreaseImagination" ) then DecreasePlayersImagination( self ) elseif ( msg.name == "EndPlayer" ) then EndActivePlayer( self ) elseif ( msg.name == "Unequip" ) then SetPlayerControl( self, true ) UnequipEquippables( self ) elseif ( msg.name == "checkAnim" ) then CheckInstrumentAnim( self ) elseif ( msg.name == "checkInventory" ) then CheckInventoryItems( self ) elseif ( msg.name == "checkInstrumentEquippables" ) then CheckInstrumentEquippables( self ) elseif ( msg.name == "AchievementTimer" ) then self:FireEventServerSide{senderID = GetActivePlayer( self ), args = "DoAchievement"} elseif ( msg.name == "AchievementTimer_20" ) then self:FireEventServerSide{senderID = GetActivePlayer( self ), args = "DoAchievement_20sec"} GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "AchievementTimer", self ) end end -------------------------------------------------------------- -- have the player stop playing the instrument -------------------------------------------------------------- function StopPlayingInstrument( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- stop checking to see if the player finished playing the instrument self:SetVar( "bBeingPlayed", false ) if ( IsLocalPlayerActive( self ) == true ) then -- stop keeping track of movement key presses TrackRecentMovementKeys( self, false ) -- make sure the cinematic is stopped player:EndCinematic{ leadOut = 1.0 } -- don't want to hear this instrument anymore AffectMusic( self, self:GetLOT().objtemplate, false ) -- cancel timers that may be running GAMEOBJ:GetTimer():CancelTimer("CheckOnPlayer", self) GAMEOBJ:GetTimer():CancelTimer("DecreaseImagination", self) GAMEOBJ:GetTimer():CancelTimer("checkAnim", self) GAMEOBJ:GetTimer():CancelTimer("checkInventory", self) GAMEOBJ:GetTimer():CancelTimer("checkInstrumentEquippables", self) GAMEOBJ:GetTimer():CancelAllTimers(self) end -- show the player smashing the instrument -- and plan when to unequip any equippables for this instrument PlaySmashAnim( self, player ) end -------------------------------------------------------------- -- start a timer for when to check whether the player is still playing the instrument -------------------------------------------------------------- function StartUpdateTimer( self ) if ( IsLocalPlayerActive( self ) == false ) then return end GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["UPDATE_FREQUENCY"], "CheckOnPlayer", self ) end -------------------------------------------------------------- -- start a timer for when to decrease the player's imagination -------------------------------------------------------------- function StartImaginationCostTimer( self ) if ( IsLocalPlayerActive( self ) == false ) then return end GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["INSTRUMENT_COST_FREQUENCY"], "DecreaseImagination", self ) end -------------------------------------------------------------- -- check whether the intrument is still being played -- this stops if the player runs out of imagination or takes control by moving -------------------------------------------------------------- function UpdateBeingPlayed( self ) if ( self:GetVar( "bBeingPlayed" ) == false ) then return end -- check whether the player as run out of imagination local bOutOfImagination = IsPlayerOutOfImagination( self ) -- if not, check whether the player hit a movement key local bMovement = false if ( bOutOfImagination == false ) then bMovement = DidPlayerHitMovementKey( self ) end -- if the player has run out of imagination or hit a movement key, then kick them off the instrument if ( bOutOfImagination or bMovement ) then self:FireEventServerSide{ args = "stopPlaying", senderID = player } -- otherwise, set a new timer to check again else StartUpdateTimer( self ) end end -------------------------------------------------------------- -- returns whether the player has run out of imagination -------------------------------------------------------------- function IsPlayerOutOfImagination( self ) return ( GetPlayersImagination( self ) <= 0 ) end -------------------------------------------------------------- -- returns how much imagination the player currently has -------------------------------------------------------------- function GetPlayersImagination( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return 0 else return player:GetImagination{}.imagination end end -------------------------------------------------------------- -- returns the ID of the active player -------------------------------------------------------------- function GetActivePlayer( self ) return getObjectByName(self, "activePlayer") end -------------------------------------------------------------- -- takes some imagination away from the player -------------------------------------------------------------- function DecreasePlayersImagination( self ) if ( IsLocalPlayerActive( self ) == false ) then return end -- get how much imagination the player has now local iOldAmount = GetPlayersImagination( self ) -- subtract the cost of using the instrument local iNewAmount = iOldAmount - CONSTANTS["INSTRUMENT_IMAGINATION_COST"] if ( iNewAmount < 0 ) then iNewAmount = 0 end -- update their imagination local player = GetActivePlayer( self ) if ( player ~= nil ) then self:FireEventServerSide{senderID = player, args = "UpdateImagination", param1 = iNewAmount} --player:SetImagination{ imagination = iNewAmount } end -- start a new timer for when to decrease their imagination next StartImaginationCostTimer( self ) end -------------------------------------------------------------- -- returns whether the player hit one of the movement keys -------------------------------------------------------------- function DidPlayerHitMovementKey( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return false end if ( IsLocalPlayerActive( self ) == false ) then return false end local keysMsg = player:GetRecentMovementKeys{} return ( keysMsg.bForwardPressed or keysMsg.bReversePressed or keysMsg.bLeftPressed or keysMsg.bRightPressed or keysMsg.bJumpPressed ) end -------------------------------------------------------------- -- takes away or gives back player control -- (pass in false to take it away, true to turn it back on) -- Make sure you match calls to this carefully because the "PUSH" and "POP" sent to SetStunned -- increment or decrement the control's corresponding variable. -- (Each "true" sent to SetStunned below is used to know which controls' variables to adjust.) -- You can see how this works at LwoGame \ source \ LWOControllablePhysComponent.cpp in method msgSetStunned -------------------------------------------------------------- function SetPlayerControl( self, bRestore ) local player = GetActivePlayer( self ) if ( player == nil ) then return end if ( IsLocalPlayerActive( self ) == false ) then return end -- note: we can't use SetUserCtrlCompPause because -- we still need to receive player movement values in order to know -- if they want to break out of the instrument before running out of imagination. -- So we use SetStunned instead. -- SetStunned also lets the player move the camera up and down, -- which is consistent with what is allowed while they buid the quickbuild. local eChangeType = "PUSH" if ( bRestore == true ) then eChangeType = "POP" end player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } end -------------------------------------------------------------- -- check whether the active player is also the local player -------------------------------------------------------------- function IsLocalPlayerActive( self ) local player = GetActivePlayer( self ) return ( player ~= nil and self:GetVar( "activePlayer" ) == GAMEOBJ:GetControlledID():GetID() ) end -------------------------------------------------------------- -- tell the player's LWOUserControlComponent to start or stop tracking recent presses. -- When off, it only knows which key presses occurred that frame. -- If we turn on this tracking, it will rememeber key presses long enough for us to send a query several frames later and -- still find out if they key was pressed recently. -- We need to use this since our timer allows us to send queries every so often - not every frame. -------------------------------------------------------------- function TrackRecentMovementKeys( self, bTrack ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- only let the active player turn his own tracking on or off if ( IsLocalPlayerActive( self ) == false ) then return end player:TrackRecentMovementKeys{ bTrackForward = bTrack, bTrackReverse = bTrack, bTrackLeft= bTrack, bTrackRight = bTrack, bTrackJump = bTrack } end -------------------------------------------------------------- -- unequip the instrument equippables from the player -------------------------------------------------------------- function UnequipEquippables( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- if this instrument added any equippables, unequip them and -- start a timer to keep checking when they're gone and the inventory items can be re-equipped local bInstrumentEquippables = false if ( self:GetVar( "equippableLeft" ) ~= nil ) then getObjectByName( self, "equippableLeft" ):NotifyObject{ name = "unequip" } bInstrumentEquippables = true end if ( self:GetVar( "equippableRight" ) ~= nil ) then getObjectByName( self, "equippableRight" ):NotifyObject{ name = "unequip" } bInstrumentEquippables = true end if ( bInstrumentEquippables ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInstrumentEquippables", self ) end end -------------------------------------------------------------- -- once the anim of the player smashing the instrument finishes, forget about our active player -------------------------------------------------------------- function EndActivePlayer( self ) -- reset player's anim so they'll do idles again ResetPlayersAnim( self ) -- re-equip any inventory items the player had in-hand before playing the instrument local player = GetActivePlayer( self ) if ( player ~= nil ) then storeObjectByName( self, "reequipPlayer", player ) end ReequipInventoryItems( self ) -- forget about the active player self:SetVar( "activePlayer", nil ) self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) -- break the quickbuild self:FireEventServerSide{ senderID = self, args = "reset" } end -------------------------------------------------------------- -- show the anim of the player smashing the instrument -------------------------------------------------------------- function PlaySmashAnim( self, player ) -- get the name of the anim local instrumentLOT = self:GetLOT().objtemplate local szAnimName = CONSTANTS["INSTRUMENT_SMASH_ANIM"][instrumentLOT] if ( szAnimName ~= -1 ) then if ( IsLocalPlayerActive( self ) == true ) then -- play the animation self:FireEventServerSide{ senderID = player, args = "playSmashAnim", param1 = instrumentLOT } end -- find out how long the anim is local animLength = player:GetAnimationTime{ animationID = szAnimName }.time -- set a timer for when to reset the quickbuild GAMEOBJ:GetTimer():AddTimerWithCancel( animLength, "EndPlayer", self ) end -- unequip equippable items and restore player control -- or set a timer to do it partway through the smash anim PlanWhenToUnequipAndRestorePlayerControl( self, instrumentLOT ) -- if there is no smashing anim, reset the quickbuild now if ( szAnimName == -1 ) then EndActivePlayer( self ) end end -------------------------------------------------------------- -- hide the completed quickbuild, if appropriate for this instrument -- the guitar and bass need to be hidden because the equippable item shows the whole instrument -- the drums do not because their equippables are just the drumsticks -- the keyboard does not because it has no equippables -------------------------------------------------------------- function HideQuickbuild( self, instrumentLOT ) if ( CONSTANTS["INSTRUMENT_HIDE"][instrumentLOT] == false ) then return end self:SetVisible{ visible = false, fadeTime = 0.0 } end -------------------------------------------------------------- -- move the player to the best looking position to play this particular instrument -------------------------------------------------------------- function RepositionPlayer( self, instrumentLOT ) -- get the quickbuild's position and rotation local qbPos = self:GetPosition().pos local qbRot = self:GetRotation() local playerPos = qbPos local playerRot = qbRot -- special case: the player pos needs to be adjusted a little for the drums to put the player behind the drumset -- and for the guitar and bass because they are located right on the edge of the state in Happy Flower if ( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_DRUM"] ) then local drumOffset = { x = 0.0, y = 0.0, z = -0.5 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = drumOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_BASS"] ) then local drumOffset = { x = 5.0, y = 0.0, z = 0.0 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = drumOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_GUITAR"] ) then local drumOffset = { x = 5.0, y = 0.0, z = 0.0 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = drumOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] ) then local drumOffset = { x = -1.15, y = 0.0, z = 1.5 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = drumOffset }.newPosition end local player = GetActivePlayer( self ) if ( player ~= nil and IsLocalPlayerActive( self ) == true ) then player:SetPosition{ pos = playerPos } player:SetRotation{ w = playerRot.w, x = playerRot.x, y = playerRot.y, z = playerRot.z } end -- special case: the player's rotation needs to be adjusted a little for the keyboard if ( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] ) then local newRot = self:GetPosition{}.pos newRot.x = 0.0 newRot.y = 0.8 newRot.z = 0.0 player:RotateObject{ rotation = newRot } end self:SetVar( "targetPositionX", playerPos.x ) self:SetVar( "targetPositionZ", playerPos.z ) end -------------------------------------------------------------- -- ask the resource manager to load the corresponding equippable item(s) onto the player -- guitar and bass: equip the whole instrument -- drums: equip a drumstick into each hand -- keyboard: no equippables -- once an equippable is ready, L_AG_CONCERT_INSTRUMENT_EQUIPPABLE_CLIENT.lua will equip it to the player -------------------------------------------------------------- function LoadEquippables( self, instrumentLOT ) if ( self:GetVar( "activePlayer" ) == nil ) then return end local leftLOT = CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][instrumentLOT] local rightLOT = CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][instrumentLOT] local config = { { "equip", true }, -- CONFIG_EQUIP in lwoCommon \ include \ LwoConfigData.h { "owner", "|" .. self:GetVar( "activePlayer" ) } } -- CONFIG_OWNER if ( leftLOT ~= -1 ) then RESMGR:LoadObject { objectTemplate = leftLOT, owner = self, rw = 1.0, bIsLocalPlayer = false, bDroppedLoot = false, configData = config } end if ( rightLOT ~= -1 ) then RESMGR:LoadObject { objectTemplate = rightLOT, owner = self, rw = 1.0, bIsLocalPlayer = false, bDroppedLoot = false, configData = config } end end -------------------------------------------------------------- -- checks whether the given LOT is the left hand equippable for this instrument -------------------------------------------------------------- function IsValidLeftEquippable( self, LOT ) if ( LOT == -1 ) then return false end local instrumentLOT = self:GetLOT().objtemplate return ( LOT == CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][instrumentLOT] ) end -------------------------------------------------------------- -- checks whether the given LOT is the right hand equippable for this instrument -------------------------------------------------------------- function IsValidRightEquippable( self, LOT ) if ( LOT == -1 ) then return false end local instrumentLOT = self:GetLOT().objtemplate return ( LOT == CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][instrumentLOT] ) end -------------------------------------------------------------- -- child loaded (the equippables) -------------------------------------------------------------- function onChildLoaded( self, msg ) local childLOT = msg.childID:GetLOT().objtemplate -- remember the object ID of this equippable so we can easily unequip later if ( IsValidLeftEquippable( self, childLOT ) ) then storeObjectByName( self, "equippableLeft", msg.childID ) elseif ( IsValidRightEquippable( self, childLOT ) ) then storeObjectByName( self, "equippableRight", msg.childID ) end end -------------------------------------------------------------- -- reset the object ID's of the equippable items -------------------------------------------------------------- function ResetEquippableIDs( self ) self:SetVar( "equippableLeft", nil ) self:SetVar( "equippableRight", nil ) end -------------------------------------------------------------- -- tell the player to play idles again -------------------------------------------------------------- function ResetPlayersAnim( self ) local player = GetActivePlayer( self ) if ( player ~= nil ) then player:ChangeIdleFlags{on = 1} player:ResetPrimaryAnimation{} player:ResetSecondaryAnimation{} end end -------------------------------------------------------------- -- unequip equippable items and restore player control -- or set a timer to do it partway through the smash anim -------------------------------------------------------------- function PlanWhenToUnequipAndRestorePlayerControl( self, instrumentLOT ) -- if this instrument has equippable items, set a timer for when to unequip them -- for the bass and guitar, the amount of time to wait depends on when during the smash anim it would look best -- unequip and restore control now for the drums, which has no smash anim -- the keyboard has no equippables, but restore player control now local unequipTime = CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][instrumentLOT] if ( unequipTime == 0 ) then SetPlayerControl( self, true ) UnequipEquippables( self ) elseif ( unequipTime == -1 ) then SetPlayerControl( self, true ) else GAMEOBJ:GetTimer():AddTimerWithCancel( unequipTime, "Unequip", self ) end end -------------------------------------------------------------- -- notification received from server-side script -------------------------------------------------------------- function onNotifyClientObject( self, msg ) if ( msg.name == "stopPlaying" ) then StopPlayingInstrument( self ) elseif ( msg.name == "loadEquippables" ) then LoadEquippables( self, self:GetLOT().objtemplate ) elseif ( msg.name == "playerLeft" ) then if ( self:GetVar( "activePlayer" ) == msg.paramObj:GetID() ) then self:SetVar( "bBeingPlayed", false ) self:SetVar( "activePlayer", nil ) self:FireEventServerSide{ senderID = self, args = "reset" } UnequipEquippables( self ) end elseif ( msg.name == "checkInstrumentAnim" ) then self:SetVar( "checkingInstrumentAnim", true ) CheckInstrumentAnim( self ) end end -------------------------------------------------------------- -- RepositionPlayer moves the player to wherever looks best for this instrument -- and starts the anim of playing the instrument, -- but other clients will see the player walk from the old spot to the new one -- which makes the walk anim overstrike the instrument anim. -- check and see if this client now sees the active player at the desired position. -- if so, show the instrument playing anim -------------------------------------------------------------- function CheckInstrumentAnim( self ) if ( self:GetVar( "checkingInstrumentAnim" ) == false ) then return end local player = GetActivePlayer( self ) if ( player == nil ) then return end local currentPos = player:GetPosition().pos local targetPosX = self:GetVar( "targetPositionX" ) local targetPosZ = self:GetVar( "targetPositionZ" ) if ( targetPosX == nil or targetPosZ == nil ) then return end local deltaX = currentPos.x - targetPosX local deltaZ = currentPos.z - targetPosZ if ( deltaX < 0.0 ) then deltaX = 0.0 - deltaX end if ( deltaZ < 0.0 ) then deltaZ = 0.0 - deltaZ end local tolerance = 0.5 if ( deltaX < tolerance and deltaZ < tolerance ) then self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) local instrumentLOT = self:GetLOT().objtemplate player:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_ANIM"][instrumentLOT], fPriority = 4.0 } else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkAnim", self ) end end -------------------------------------------------------------- -- before creating the instrument's equippables, check if the player already has inventory items equipped -- if so, unequip the inventory items and -- remember them so we can reequip them once done with the instrument -------------------------------------------------------------- function RememberInventoryItems( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end if ( player:GetID() ~= GAMEOBJ:GetControlledID():GetID() ) then return end -- find out the LOT's of the items in the mini-fig's hands local leftLOT = player:GetEquippedItemType{ slot = "special_l" }.lotID local rightLOT = player:GetEquippedItemType{ slot = "special_r" }.lotID -- check which hand(s) this instrument needs to add equippables to local instrumentLOT = self:GetLOT().objtemplate local bInventoryItemsEquipped = false -- go through each inventory slot to find the items already in-hand -- and unequip any that go onto a hand that this instrument doesn't use local numInventoryItems = player:GetInventorySize{ inventoryType = 1 }.size -- 1 is INVENTORY_DEFAULT in lwoCommon / include / InventoryTypes.h for i = 0, numInventoryItems do local checkItem = player:GetInventoryItemInSlot{ slot = i }.itemID if ( checkItem:Exists() ) then if ( checkItem:GetLOT().objtemplate == leftLOT ) then self:SetVar( "leftInventoryLOT", leftLOT ) player:UnEquipInventory{ itemtounequip = checkItem } bInventoryItemsEquipped = true elseif ( checkItem:GetLOT().objtemplate == rightLOT ) then self:SetVar( "rightInventoryLOT", rightLOT ) player:UnEquipInventory{ itemtounequip = checkItem } bInventoryItemsEquipped = true end end -- end Exists() end -- end for loop -- if we need to wait for inventory items to unequip, -- set up a timer for checking if it's okay to load the instrument equippables. -- if there weren't any inventory items equipped, load the instrument equippables now if ( bInventoryItemsEquipped ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInventory", self ) else self:FireEventServerSide{ args = "loadEquippables", senderID = player } end end -------------------------------------------------------------- -- check whether the inventory items are unequipped yet -- if so, equip the instrument equippables -------------------------------------------------------------- function CheckInventoryItems( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end local leftLOT = player:GetEquippedItemType{ slot = "special_l" }.lotID local rightLOT = player:GetEquippedItemType{ slot = "special_r" }.lotID if ( leftLOT ~= -1 or rightLOT ~= -1 ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInventory", self ) else local instrumentLOT = self:GetLOT().objtemplate self:FireEventServerSide{ args = "loadEquippables", senderID = player } end end -------------------------------------------------------------- -- the player had inventory items in-hand before playing the instrument. -- re-equip them. -------------------------------------------------------------- function ReequipInventoryItems( self ) local player = getObjectByName( self, "reequipPlayer" ) -- only allow the local player to re-equip its own inventory items if ( player == nil or self:GetVar( "reequipPlayer" ) ~= GAMEOBJ:GetControlledID():GetID() ) then return end -- remember the LOT's of the inventory items that we unequipped earlier local leftLOT = self:GetVar( "leftInventoryLOT" ) local rightLOT = self:GetVar( "rightInventoryLOT" ) -- re-equip the left-hand item, if there was one if ( leftLOT ~= -1 ) then self:FireEventServerSide{ senderID = player, args = "reequipItem", param1 = leftLOT } end -- re-equip the right-hand item, if there was one if ( rightLOT ~= -1 ) then self:FireEventServerSide{ senderID = player, args = "reequipItem", param1 = rightLOT } end self:SetVar( "leftInventoryLOT", -1 ) self:SetVar( "rightInventoryLOT", -1 ) self:SetVar( "reequipPlayer", nil ) end -------------------------------------------------------------- -- check whether the insturment's equppibable items are unequipped yet -- if so, re-equip the previously-equipped inventory items, if any -------------------------------------------------------------- function CheckInstrumentEquippables( self ) local player = getObjectByName( self, "reequipPlayer" ) if ( player == nil ) then return end -- check whether either instrument equippable is still equipped local bStillEquipped = false if ( self:GetVar( "equippableLeft" ) ~= nil ) then local leftItem = getObjectByName( self, "equippableLeft" ) if ( leftItem:IsItemEquipped{}.isequipped == true ) then bStillEquipped = true end end if ( self:GetVar( "equippableRight" ) ~= nil ) then local rightItem = getObjectByName( self, "equippableRight" ) if ( rightItem:IsItemEquipped{}.isequipped == true ) then bStillEquipped = true end end if ( bStillEquipped ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "checkInstrumentEquippables", self ) else ResetEquippableIDs( self ) end end-------------------------------------------------------------- -- Duck Showcaser script; this script does the logic required -- by the duck showcase mission. Gives brick group/thinking hat. -- created mrb... 3/02/10 -------------------------------------------------------------- local releaseVersion = 200 -- which version release # the content should be made available for Beta 1 local misID = 370 local duckBricks = {["29"] = 1, -- format is {["LOT_NUM"] = NUM_OF_BRICKS} ["31"] = 2, ["32"] = 1, ["40"] = 2} function onStartup(self) math.randomseed( os.time() ) end ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local verInfo = msg.objIDUser:GetVersioningInfo() if not verInfo.bIsInternal and verInfo.iMajorRelease < 1 and verInfo.iVersionRelease < releaseVersion then if msg.objIDUser:GetInvItemCount{iObjTemplate = 6086}.itemCount > 0 then --print('remove thinking cap 1') msg.objIDUser:DisplayTooltip { bShow = true, strText = "Here is your Level 2 Thinking Hat, return to Mardolf.", iTime = 3000 } msg.objIDUser:RemoveItemFromInventory{iObjTemplate = 6086} msg.objIDUser:AddItemToInventory{iObjTemplate = 7009, itemCount = 1} else --msg.objIDUser:RemoveItemFromInventory{iObjTemplate = 7009} msg.objIDUser:DisplayTooltip { bShow = true, strText = "Showcases are unavailable at this time.", iTime = 3000 } end msg.bCanUse = false end return msg end function onSetIconAboveHead(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not self:GetVar('bHide') and not player:CheckPrecondition{PreconditionID = 46}.bPass and not player:CheckPrecondition{PreconditionID = 47}.bPass then self:SetVar('bHide', true) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "startup", self ) end end function addInventoryGroup(self, player) if not player then return end player:UpdateInventoryGroup{action = "ADD", inventoryType = 2, groupID = "Duck_Build_Bricks", groupName = "Duck Build", locked = true} for k,v in pairs(duckBricks) do player:UpdateInventoryGroupContents{action = "ADD", inventoryType = 2, groupID = "Duck_Build_Bricks", templateID = tostring(k)} player:AddItemToInventory{iObjTemplate = tostring(k), itemCount = v} end player:SetInventoryFilter{inventoryType = 2, filterType = "GROUP", filterData = "Duck_Build_Bricks"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.5 , "toggleBackpack", self ) end function onMissionDialogueOK(self,msg) if msg.missionID == misID then if msg.iMissionState < 2 then --print('give duck bricks') addInventoryGroup(self, msg.responder) elseif msg.iMissionState == 4 then --print('player has ' .. msg.responder:GetInvItemCount{iObjTemplate = 6086}.itemCount .. ' thinking caps 1') if msg.responder:GetInvItemCount{iObjTemplate = 6086}.itemCount > 0 then --print('remove thinking cap 1') msg.responder:RemoveItemFromInventory{iObjTemplate = 6086} end end end end function onFireEvent(self, msg) if msg.args == 'showIcon' then self:SetVar('bHide', false) self:SetIconAboveHead{bIconOff = false, iconMode = 0, iconType = 1} end end function onTimerDone(self, msg) if (msg.name == "startup") then self:SetIconAboveHead{bIconOff = true, iconMode = 0, iconType = 1} elseif (msg.name == "toggleBackpack") then UI:SendMessage("ToggleBackpack", {{"visible", true}, {"tabName", "my_bricks"}}) end end ----------------------------------------------------------- -- This script is on the faction rep -- after selecting a faction, the player is stunned, and two seconds later -- offered the correct mission to go talk to their new faction rep -- written by Mike B -- modified by Brandi, took out a notify object that was no longer needed and stunned the player ---------------------------------------------------------------- local misID = 474 -- join a faction mission function onMissionDialogueOK(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.responder:GetID() ~= player:GetID() then return end if msg.missionID == misID and msg.iMissionState == 4 then player:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 3, 'nextMissionStart', self ) end end function onTimerDone (self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.name == 'nextMissionStart' then player:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} player:ForcePlayerToInteract{ objToInteractWith = self } end end --**************************************************************** -- THIS SCRIPT IS NO LONGER IN USE. KEPT ONLY FOR REFERENCE -- PLEASE DELETE BEFORE GOLD MASTER --****************************************************************** local misID = 482 function onMissionDialogueOK(self,msg) --print('onMissionDialogueOK ' .. msg.iMissionState .. ' - ' .. msg.missionID) if msg.missionID == misID and msg.iMissionState < 2 then self:FireEventServerSide{ senderID = msg.responder, args = 'updateMission' } end end -------------------------------------------------------------- -- LEGO Club door Client Script -- updated mrb... 6/15/10 -- added updated UI -------------------------------------------------------------- local instanceIcon = 87 -- npcIcon out of db function onStartup(self) -- set up the two proximity radius for icon display self:SetProximityRadius{iconID = instanceIcon, radius = 75, name = "Icon_Display_Distance"} end ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local verify = msg.objIDUser:GetLegoClubMembershipStatus() if not verify.bCountryEligible then if msg.isFromUI then -- This MUST be set to true, otherwise all requirements from this script will be ignored msg.HasReasonFromScript = true msg.Script_Failed_Requirement = true msg.Script_Reason = Localize("LEGO_CLUB_DOOR_MEMBERSHIP_UNAVAILABLE") --"Sorry LEGO Club is not available in your country." msg.Script_IconID = 3633 end msg.bCanUse = false end return msg end --------------------------------------------------- -- this gets called if you have the scripted -- interaction icon attached to the object through -- the mapicon db table, set icon and text --------------------------------------------------- function onGetInteractionDetails(self, msg) local verify = GAMEOBJ:GetControlledID():GetLegoClubMembershipStatus().bMember local uiText = Localize("LEGO_CLUB_DOOR_MEMBERSHIP_VERIFIED") --"Membership verified, interact to enter LEGO Club World." local mapID = self:GetVar("transferZoneID") if mapID == "1200" then uiText = Localize("LEGO_CLUB_DOOR_RETURN_TO_NS") --"Interact to return to Nimbus Station." elseif not verify then -- if we're not a member do this text uiText = Localize("LEGO_CLUB_DOOR_MEMBERSHIP_FAILED") --"You need to be a LEGO Club member to use this, interact to learn how to join." end msg.TextDetails = uiText return msg end ---------------------------------------------- -- sent when the local player interacts with the -- object ---------------------------------------------- function onClientUse(self, msg) if GAMEOBJ:GetLocalCharID() ~= msg.user:GetID() then return end local mapID = self:GetVar("transferZoneID") if mapID == "1200" then self:FireEventServerSide{args = tostring(GAMEOBJ:GetLocalCharID())} return end local verify = msg.user:GetLegoClubMembershipStatus().bMember local uiType = "Lego_Club_Valid" -- if not a member then use this UI type if not verify then uiType = "Lego_Club_Invalid" end msg.user:LegoClubAccessResult{ result = verify } -- send message to the UI to open the lobby UI:SendMessage("pushGameState", { {"state", "Lobby"}, {"context", {{"user", msg.user}, {"callbackObj", self}, {"HelpVisible", "show" }, {"type", uiType}} }}) self:SetVar("uiOpen", true) end ---------------------------------------------- -- sent when the object story box is closed; -- this can be done by hitting the x, esc or enter ---------------------------------------------- function onMessageBoxRespond(self, msg) -- UI element has been closed turn on the icon if msg.identifier == "PlayButton" then if msg.iButton == 1 then self:FireEventServerSide{args = tostring(GAMEOBJ:GetLocalCharID())} end end -- terminate interaction so the icon will come back GAMEOBJ:GetControlledID():TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end function onTerminateInteraction(self,msg) -- check to see if the help window is open if not self:GetVar("uiOpen") then return end local player = GAMEOBJ:GetControlledID() -- close the UI window because the interaction was terminated should return iButton -1 UI:SendMessage("ToggleInstanceEnter", {{"visible", false}}) UI:SendMessage( "popGameState", {{"state", "Lobby"}} ) self:SetVar("uiOpen", false) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end -------------------------------------------------------------- -- Displays a fancy animation as you walk up to the LUP door pad -- -- updated mrb... 8/9/10 - added check all preconditions and show UI -------------------------------------------------------------- function onStartup(self,msg) -- set up the proximity radius self:SetProximityRadius{radius = 30, name = "RocketSign"} end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onCheckUseRequirements(self, msg) local verInfo = msg.objIDUser:GetVersioningInfo() -- check to see if the instancer is supposed to be blocked for beta if not verInfo.bIsInternal then msg.HasReasonFromScript = true msg.Script_IconID = 3509 msg.Script_Reason = Localize("UI_LUP_DOOR_UNDER_CONSTRUCTION") msg.Script_Failed_Requirement = true msg.bCanUse = false -- if we dont have CheckPreconditions set in HF then return out of this function else local preConVar = self:GetVar("CheckPrecondition") if preConVar and preConVar ~= "" then local check = msg.objIDUser:CheckListOfPreconditionsFromLua{PreconditionsToCheck = preConVar, requestingID = self} if not check.bPass then msg.HasReasonFromScript = true msg.Script_IconID = check.IconID msg.Script_Reason = check.FailedReason msg.Script_Failed_Requirement = true msg.bCanUse = false end end end return msg end -------------------------------------------------------------- -- Sent when a player enter/leave a Proximity Radius -------------------------------------------------------------- function onProximityUpdate(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check to see if we are the correct player if playerID ~= msg.objId:GetID() then return end -- send the correct UI message if msg.name == "RocketSign" then if msg.status == "ENTER" then local mapNum = self:GetVar("transferZoneID") if not mapNum then mapNum = 20 end local mapName = Localize("ZoneTable_" .. mapNum .. "_DisplayDescription") --UI:SendMessage( "TurnOn", {}, self ) UI:SendMessage( "ToggleRocketSignage", { {"bVisible", true}, {"name", mapName}, {"zoneNumber", tostring(mapNum)} }, self ) elseif msg.status == "LEAVE" then --UI:SendMessage( "TurnOff", {}, self ) UI:SendMessage( "ToggleRocketSignage", { {"bVisible", false} }, self ) end end end --**************************************************************** -- THIS SCRIPT IS NO LONGER IN USE. KEPT ONLY FOR REFERENCE -- PLEASE DELETE BEFORE GOLD MASTER --****************************************************************** -- local misID = 480 -- function onRespondToMission(self, msg) -- --print('mission: ' .. msg.missionID) -- if msg.missionID ~= misID then return end -- local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- local factionNPCs = self:GetObjectsInGroup{ group = 'DuckShowcaser', ignoreSpawners = true }.objects -- -- if the player is not on the mission or not completed the mission then set the icons on the faction npc's -- if not player:CheckPrecondition{PreconditionID = 50}.bPass and not player:CheckPrecondition{PreconditionID = 51}.bPass then -- for k,v in ipairs(factionNPCs) do -- --print('fireEvent to ' .. v:GetName().name) -- v:FireEvent{senderID = self, args = 'showIcon'} -- end -- end -- end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) -- Click on speech AddInteraction(self, "interactionText", Localize("NPC_NS_NEXUS_GRUNT_CLICKED01")) --The Factions must unite and build a tower to regain control of the Nexus! AddInteraction(self, "interactionAnim", "prox") -- Proximity speech AddInteraction(self, "proximityText", Localize("NPC_NS_NEXUS_GRUNT_BANTER01")) --This is the way to the Nexus! AddInteraction(self, "proximityAnim", "prox") end -------------------------------------------------------------- -- Foot Race script that -- updated mrb... 2/17/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT') local gVars = { pathName = "Foot_Race_Path_01", goalLot = 8575, obsticleLot = {--[[8572, 8578, 8579, 6214,--]]}, --6215, 8576, numOfObsticles = 0, finalGoalObsticleLot = 6216, sStopTooltipText = Localize("FOOT_RACE_STOP_QUESTION"), sStartTooltipText = Localize("FOOT_RACE_START_QUESTION"), sFirstGoalText = Localize("FOOT_RACE_FIRST_GOAL"), sFinalGoalText = Localize("FOOT_RACE_FINAL_GOAL"), startTime = 5, -- amount of time the player should start the race with addTime = 5, -- amount of time to add when the player hits a goal completedSetFlagNum = 85, -- sets the specified flag when the race is completed completedFireEventGroup = nil,} -- -ie- "PandaGroup" - calls FireEventServerSide message named Foot_Race_Completed to the group with the playerID as param1 -- these variabls are for setting up the goal posts only local tGoalpostVars = { goalpostLot = 3890, goalpostOffset = 5.2, -- how far right and left of the object to spawn in the goal posts. nextEffectID = 503, nextEffectType = "create",} ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function onStartup(self) setLocalVars(self, gVars, tGoalpostVars) baseStartup(self) end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self) end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function onClientUse(self, msg) baseClientUse(self, msg) end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function onTerminateInteraction(self, msg) baseTerminateInteraction(self, msg) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) baseMessageBoxRespond(self, msg) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function onFireEvent(self, msg) baseFireEvent(self, msg) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function onActivityTimerUpdate(self, msg) baseActivityTimerUpdate(self, msg) end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function onActivityTimerDone(self, msg) baseActivityTimerDone(self, msg) end function onSetIconAboveHead(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not self:GetVar('bHide') and not player:CheckPrecondition{PreconditionID = 46}.bPass and not player:CheckPrecondition{PreconditionID = 47}.bPass then self:SetVar('bHide', true) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "startup", self ) end end function onFireEvent(self, msg) if msg.args == 'showIcon' then --print('showIcon') self:SetIconAboveHead{bIconOff = false, iconMode = 0, iconType = 1} end end function onTimerDone(self, msg) if (msg.name == "startup") then --print('hideIcon') self:SetIconAboveHead{bIconOff = true, iconMode = 0, iconType = 1} end end -------------------------------------------------------------- -- Description: -- -- Client script for NS Race Instancer. -- Lets client know the object can be interacted with -- updated mrb... 3/23/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { releaseVersion = 183, -- which version release # the content should be made available for Beta 1 misID = 624, -- run the foot race to unlock missionState = 2, itemType = 8092, -- allow vehicles to start the racing failItem = Localize("MINIGAME_LOBBY_RACE_DRAG_ITEM_FAIL_MESSAGE"), UI_Type = "NS_Race_01", failText = Localize("MINIGAME_LOBBY_NS_RACE_FAIL_MESSAGE"), bUseBothInteractions = true,} -- if this is set to true then the player will be able to drag or click function onStartup(self) baseSetVars(self, tVars) end -------------------------------------------------------------- -- Description: -- -- Client script for Shooting Gallery NPC in GF area. -- Lets client know the object can be interacted with -- updated mrb... 3/23/10 -------------------------------------------------------------- require('client/ai/MINIGAME/BASE_INSTANCER') local tVars = { releaseVersion = 182, -- which version release # the content should be made available for Beta 1 misID = 370, missionState = 8, transferZoneID = 1202, UI_Type = "NS_SG_01", failText = Localize("MINIGAME_LOBBY_NS_SG_FAIL_MESSGE"),} function onStartup(self) baseSetVars(self, tVars) end -------------------------------------------------------------- -- Client side script on the console behind the paradox rep. -- this script checks to see if the player can use the console, and if not -- it shows them and tells them why not -- server script is located scripts\ai\NS\L_NS_TOKEN_CONSOLE_SERVER.lua -------------------------------------------------------------- -- Variables pulled out to make tweaking the numbers easier for systems local bricksToTake = 20 -- the maelstrom infected bricks this interaction cost -- MAKE SURE THIS MATCHES THE SERVER SIDE SCRIPT -- REMEMBER TO CHANGE STRING IN LOCALIZATION TABLE REQUIRED_MAELSTROM_BRICKS -- checks to see if the player is eligible to use the console function onCheckUseRequirements(self,msg) -- to make sure the player isn't interacting with the object just to quickbuild it -- state 2 means the quickbuild is complete if self:GetRebuildState{}.iState == 2 then local player = msg.objIDUser -- has the player joined a faction if player:GetMissionState{missionID = 474}.missionState < 8 then msg.HasReasonFromScript = true msg.Script_IconID = 3275 msg.Script_Reason = Localize("NS_FACTION_REPS") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false -- mission on Paradox Rep to get the hammer from FV elseif player:GetMissionState{missionID = 509}.missionState < 8 then msg.HasReasonFromScript = true msg.Script_IconID = 2867 msg.Script_Reason = Localize("NEED_HAMMER") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false -- mission on the paradox rep to interact with the console elseif player:GetMissionState{missionID = 781}.missionState < 8 or player:GetMissionState{missionID = 863}.missionState < 2 then msg.HasReasonFromScript = true msg.Script_IconID = 2983 msg.Script_Reason = Localize("TALK_PARADOX_REP") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false -- need to have certain number of maelstrom bricks elseif player:GetInvItemCount{ iObjTemplate = 6194}.itemCount < bricksToTake then msg.HasReasonFromScript = true msg.Script_IconID = 2926 msg.Script_Reason = Localize("REQUIRED_MAELSTROM_BRICKS") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false end return msg end end -- This function is called when the object starts up or someone requests a pick type update -- Handling this to set pick type on an object, which makes it able to be interactive function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type (Setting to -1 makes something non-interactive) end return msg end -------------------------------------------------------------- -- Script to change the fog/light settings in NS Racetrack as the player ENTERS Annex area -- -- updated NateS... 4/9/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetLights( true, 0x0208d3, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.17, -0.81, 0.56 }, --directional direction true, 0x705a6f, --fog color true, --modifying draw distances (all of them) 100.0, 100.0, --fog near min/max 1700.0, 1700.0, --fog far min/max 2060.0, 2060.0, --post fog solid min/max 00.0, 00.0, --post fog fade min/max 3500.0, 3500.0, --static object cutoff min/max 3000.0, 3000.0, --dynamic object cutoff min/max false, "mesh\env\env_gen_sky_lightblue.nif", 1.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog/light settings in NS Racetrack as the player ENTERS Ship reveal area -- -- updated NateS... 4/9/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetLights( true, 0x0208d3, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.17, -0.81, 0.56 }, --directional direction true, 0x29253d, --fog color true, --modifying draw distances (all of them) 00.0, 00.0, --fog near min/max 1000.0, 1000.0, --fog far min/max 2500.0, 2500.0, --post fog solid min/max 00.0, 00.0, --post fog fade min/max 3500.0, 3500.0, --static object cutoff min/max 3000.0, 3000.0, --dynamic object cutoff min/max false, "mesh\env\env_gen_sky_lightblue.nif", 1.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog/light settings in NS Racetrack as the player ENTERS the area under the spaceship -- -- updated NateS... 4/9/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetLights( true, 0x1e2051, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.17, -0.81, 0.56 }, --directional direction true, 0xffcd6b, --fog color true, --modifying draw distances (all of them) 0.0, 0.0, --fog near min/max 2000.0, 2000.0, --fog far min/max 2500.0, 2500.0, --post fog solid min/max 00.0, 000.0, --post fog fade min/max 3500.0, 3500.0, --static object cutoff min/max 3000.0, 3000.0, --dynamic object cutoff min/max false, "mesh\env\env_gen_sky_lightblue.nif", 4.0 -- blend time ) end end-------------------------------------------------------------- -- Script to change the fog/light settings in NS Racetrack as the player ENTERS the start area -- -- updated NateS... 4/9/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) if msg.objectID:GetID() == GAMEOBJ:GetControlledID():GetID() then LEVEL:SetLights( true, 0x636ed3, --ambient color true, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 0.0, 0.5, 0.0 }, --directional direction true, 0xffba3a, --fog color true, --modifying draw distances (all of them) 100.0, 100.0, --fog near min/max 2000.0, 2000.0, --fog far min/max 2000.0, 2000.0, --post fog solid min/max 00.0, 000.0, --post fog fade min/max 3500.0, 3500.0, --static object cutoff min/max 3000.0, 3000.0, --dynamic object cutoff min/max false, "mesh\env\env_gen_sky_lightblue.nif", 2.0 -- blend time ) end endrequire('o_mis') --local bHasBeenUsed = false --[[ local bCINEMA_ONCE = false function onStartup(self) --print ("Bouncer Cine Script Started!") -- Set variable on self to remember if the Rancher has been found self:SetVar("RancherFound", false) end -- Something touches the phantom object function onCollisionPhantom(self, msg) -- define the message sender from the collision as "player" local player = msg.objectID -- Define myMissionState as the current state of mission 136, for the TargetID local PetFoodMissionStatus = player:GetMissionState{missionID = 111}.missionState -- Cinematic should only happen once, and only during the Pet Food Mission if (bCINEMA_ONCE == false and PetFoodMissionStatus == 2) then -- Have we looked for the Rancher yet? if ( self:GetVar("RancherFound") == false) then -- Call function to find the Rancher FindRancher(self) -- Make sure to never call function again self:SetVar("RancherFound", true) end --print ("Collision Detected") -- Disable player control and set a timer to return it --player:SetUserCtrlCompPause{bPaused = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "PauseTime", self ) -- Play cinematic. player:PlayCinematic { pathName = "Bouncer_Cine" } player:DisplayTooltip { bShow = true, strText = "CINEMATIC: Pet needs food. Pet Rancher gives food. Now try clicking your pet", iTime = 10000 } -- Call up the Pet Rancher from where it was stored on they cylinder (self) local PetRancher = getObjectByName(self, "PetRancher") -- Play animation on Pet Rancher (two methods) --PetRancher:PlayAnimation{animationID = "throw-food"} Emote.emote(PetRancher, PetRancher, "throw-food" ) -- Update bool so that cinematic never plays again. bCINEMA_ONCE = true end end function FindRancher(self) --print ("Inside FindRancher Function") local cylinder = self:GetObjectsInGroup{ group = self:GetVar("grp_name") }.objects for i = 1, table.maxn (cylinder) do --print ("looking for Rancher") --print (self:GetVar("grp_name")) --print(tostring(table.maxn (cylinder))) --print(tostring(cylinder[i]:GetLOT().objtemplate)) if (cylinder[i]:GetLOT().objtemplate) == 3257 then --3257 is Pet Rancher --print( type(cylinder[i]:GetLOT().objtemplate)) --print( type(3257)) storeObjectByName(self, "PetRancher", cylinder[i]) -- Stores the Pet Ranch ID under the name Pet Rancher storeObjectByName(cylinder[i], "cylinder", self) --print ("Rancher has been found") end end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "PauseTime") then print ("Timer is done!") -- Get the player again (local variables aren't shared by different functions) and return player control local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --player:SetUserCtrlCompPause{bPaused = false} end end ]]--require ('/ai/PETS/L_PET_BOUNCER_CLIENT') function onCollisionPhantom(self, msg) -- Someting touches the Pet Switch --print ("Message on collision") local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- Get the player --local player = msg.objectID -- get the ID of the thing that sent the collision message local TameMissionStatus = player:GetMissionState{missionID = 110}.missionState --define myMissionState as the current state of mission 136, for the TargetID --print ("TameMission Status is ".. TameMissionStatus) --Taming Mission Messages if ((TameMissionStatus > 2) and (TameMissionStatus < 8)) then --GGJ Mission has not yet been completed player:DisplayChatBubble{wsText = Localize("HOLD THE PHONE! I need to check in with the Pet Rancher.")} end end -------------------------------------------------------------- -- Client side script on the lion pet -- this script controls the icon and interactablity of the lion -- only the player who spawned the lion show see the interact icon above the lion and be able to tame it -- created by Brandi... 2/17/10 -------------------------------------------------------------- function onGetPriorityPickListType(self, msg) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then if player:Exists() then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) msg.fCurrentPickTypePriority = myPriority -- if the player is the player who spawned the pet, then set the lion to be interactable to that player --print("on lion player is "..tostring(player:GetID())) --print("on lion tamer is "..tostring(self:GetVar("liontamer"))) if self:GetVar("localCrabTamer") == player:GetID() then msg.ePickType = 14 -- Interactive pick type end else --if the player is not the player who spawned the lion, the player can't interact with the lion msg.ePickType = -1 end end return msg end -- i have to do the back and forth with FireEventServerSide and FireEventClientSide because SetNetworkVar doesn't serialize properly function onStartup(self,msg) -- doing this because SetNetworkVar is busted and unserialized if self:IsPetWild{}.bIsPetWild == false then return end end function onScriptNetworkVarUpdate(self,msg) local crabtamer = msg.tableOfVars["crabtamer"] if crabtamer then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:GetID() == crabtamer then self:SetVar("localCrabTamer",player:GetID()) self:RequestPickTypeUpdate() end end end -------------------------------------------------------------- -- Server side script on the crab pet -- this script control the crab life before he is tamed by a player -- created by Brandi... 2/17/10 -- updated by Dallas 7/29/10 - fixed 'or' statement -------------------------------------------------------------- function onStartup(self) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local player = self:GetVar("tamer") self:SetNetworkVar("crabtamer", player) --kill the lion after 2 minutes if the player who spawned it doesn't tame it GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "killSelf",self ) end function onNotifyPetTamingMinigame(self,msg) --if the player begins the taming minigame, cancel the timer that kills the lion if msg.notifyType == "BEGIN" then GAMEOBJ:GetTimer():CancelTimer("killSelf",self) --if the player fails or quits the minigame, kill the lion elseif msg.notifyType == ("QUIT") or msg.notifyType == ("FAILED") then self:RequestDie{killerID = self, killType = "SILENT"} --if the player succeeds in the minigame, command the lion to go to the player, otherwise he could teleport off -- because the minigame tells him to go to his spawn point, and he doesnt have one elseif msg.notifyType == "SUCCESS" then local player = msg.PlayerTamingID self:CommandPet{iPetCommandType = 6} self:RemoveObjectFromGroup{group = "crab"..player:GetID()} end end function onTimerDone (self,msg) -- kill the lion if he's been alive for too long. Lions have a very short life span if (msg.name == "killSelf") then --double check not to kill a lion that is actually someones pet if self:IsPetWild{}.bIsPetWild == false then return end self:RequestDie{killerID = self, killType = "SILENT"} end end require('o_mis') function onStartup(self, msg) --print "preloading" local Frisbeed = self:GetObjectsInGroup{ group = "Frisbee"}.objects for i = 1, table.maxn (Frisbeed) do -- Seagull for cinematic if Frisbeed[i]:GetLOT().objtemplate == 7667 then Frisbeed[i]:PreloadAnimation{animationID = "throw", respondObjID = self} -- Frisbee elseif Frisbeed[i]:GetLOT().objtemplate == 7668 then Frisbeed[i]:PreloadAnimation{animationID = "throw", respondObjID = self} -- Lion elseif Frisbeed[i]:GetLOT().objtemplate == 3995 then Frisbeed[i]:PreloadAnimation{animationID = "boomerang-cinematic", respondObjID = self} -- Coalessa elseif Frisbeed[i]:GetLOT().objtemplate == 3257 then Frisbeed[i]:PreloadAnimation{animationID = "boomerang-cinematic", respondObjID = self} -- Hiding the real seagull on client end end end function onCollisionPhantom(self, msg) local playerID = GAMEOBJ:GetLocalCharID() local bCINEMA_ONCE = false if (msg.objectID:GetID() == playerID) then local player = msg.objectID local tooltipMsg = player:GetTooltipFlag{ iToolTip = 1 } -- Cinematic should only happen once - Cinema Once keeps it from getting more than one collision message, Tool-tip settings prevent it from ever re-occuring when player returns. if ((bCINEMA_ONCE == false) and (tooltipMsg) and (tooltipMsg.bFlag == false)) then -- Update bool so that cinematic never plays again. bCINEMA_ONCE = true local Frishack = self:GetObjectsInGroup{ group = "Seagull", ignorespawners = true}.objects[1] Frishack:SetVisible{visible = false} -- give the player the flag to let them tame pets player:Help{ rerouteID = player, iHelpID = 1 } -- Disable player control and set a timer to return it UI:SendMessage( "pushGameState", {{"state", "cinematic" }} ) -- Play cinematic player:PlayCinematic { pathName = "Intro_Cine" } GAMEOBJ:GetTimer():AddTimerWithCancel( LEVEL:GetCinematicInfo( "Intro_Cine" )+1, "Message6", self ) player:PlayNDAudioEmitter{m_NDAudioEventGUID = '{02486966-a047-4587-89f5-634c60d6c41c}' } -- Play animations on all four objects--seagull, frisbee, Coalessa, and lion local Frisbeed = self:GetObjectsInGroup{ group = "Frisbee"}.objects for i = 1, table.maxn (Frisbeed) do -- Seagull for cinematic if Frisbeed[i]:GetLOT().objtemplate == 7667 then Frisbeed[i]:PlayAnimation{animationID = "throw"} Frisbeed[i]:SetOffscreenAnimation{bAnimateOffscreen = true} -- Frisbee elseif Frisbeed[i]:GetLOT().objtemplate == 7668 then Frisbeed[i]:PlayAnimation{animationID = "throw"} Frisbeed[i]:SetOffscreenAnimation{bAnimateOffscreen = true} -- Lion elseif Frisbeed[i]:GetLOT().objtemplate == 3995 then Frisbeed[i]:PlayAnimation{animationID = "boomerang-cinematic"} Frisbeed[i]:SetOffscreenAnimation{bAnimateOffscreen = true} -- Coalessa elseif Frisbeed[i]:GetLOT().objtemplate == 3257 then Frisbeed[i]:PlayAnimation{animationID = "boomerang-cinematic"} Frisbeed[i]:SetOffscreenAnimation{bAnimateOffscreen = true} -- Hiding the real seagull on client end end end end end function onTimerDone(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (msg.name == "Message6") then player:SetTooltipFlag{ iToolTip = 24 , bFlag = true } UI:SendMessage( "popGameState", {{"state", "cinematic"}} ) local Frishack = self:GetObjectsInGroup{ group = "Seagull", ignorespawners = true}.objects[1] Frishack:SetVisible{visible = true} end end-------------------------------------------------------------- -- Client side script on the lion pet -- this script controls the icon and interactablity of the lion -- only the player who spawned the lion show see the interact icon above the lion and be able to tame it -- created by Brandi... 2/17/10 -------------------------------------------------------------- function onGetPriorityPickListType(self, msg) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then msg.fCurrentPickTypePriority = myPriority -- if the player is the player who spawned the pet, then set the lion to be interactable to that player --print("on lion player is "..tostring(player:GetID())) --print("on lion tamer is "..tostring(self:GetVar("liontamer"))) if player:GetFlag{iFlagID = 67}.bFlag == true and self:GetVar("localLionTamer") == player:GetID() then msg.ePickType = 14 -- Interactive pick type else --if the player is not the player who spawned the lion, the player can't interact with the lion msg.ePickType = -1 end end end return msg end -- i have to do the back and forth with FireEventServerSide and FireEventClientSide because SetNetworkVar doesn't serialize properly function onStartup(self,msg) -- doing this because SetNetworkVar is busted and unserialized if self:IsPetWild{}.bIsPetWild == false then return end end function onScriptNetworkVarUpdate(self,msg) local liontamer = msg.tableOfVars["liontamer"] if liontamer then local player = GAMEOBJ:GetControlledID() if player:GetID() == liontamer then self:SetVar("localLionTamer",player:GetID()) self:RequestPickTypeUpdate() end end end -------------------------------------------------------------- -- Server side script on the lion pet -- this script control the lions life before he is tamed by a player -- created by Brandi... 2/17/10 -- updated by Dallas 7/29/10 - fixed 'or' statement -------------------------------------------------------------- function onStartup(self) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local player = self:GetVar("tamer") self:SetNetworkVar("liontamer", player) --kill the lion after 2 minutes if the player who spawned it doesn't tame it GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "killSelf",self ) end function onNotifyPetTamingMinigame(self,msg) --if the player begins the taming minigame, cancel the timer that kills the lion if msg.notifyType == "BEGIN" then GAMEOBJ:GetTimer():CancelTimer("killSelf",self) --if the player fails or quits the minigame, kill the lion elseif msg.notifyType == ("QUIT") or msg.notifyType == ("FAILED") then self:RequestDie{killerID = self, killType = "SILENT"} --if the player succeeds in the minigame, command the lion to go to the player, otherwise he could teleport off -- because the minigame tells him to go to his spawn point, and he doesnt have one elseif msg.notifyType == "SUCCESS" then local player = msg.PlayerTamingID self:CommandPet{iPetCommandType = 6} local lions = self:GetObjectsInGroup{ group = "lions", ignoreSpawners = true }.objects print("before "..#lions) print("remove object from group lion"..player:GetID()) self:RemoveObjectFromGroup{group = "lions"} self:RemoveObjectFromGroup{group = "lion"..player:GetID()} local lions2 = self:GetObjectsInGroup{ group = "lions", ignoreSpawners = true }.objects print("after "..#lions2) end end function onTimerDone (self,msg) -- kill the lion if he's been alive for too long. Lions have a very short life span if (msg.name == "killSelf") then --double check not to kill a lion that is actually someones pet if self:IsPetWild{}.bIsPetWild == false then return end self:RequestDie{killerID = self, killType = "SILENT"} end end --Client side script allows item to be clicked. Works with L_PET_PETFOOD.LUA ---------------------------------------------------------------------- -- Item can be clicked ---------------------------------------------------------------------- --[[ function onGetOverridePickType(self, msg) -- Get the Pick Type (cursor clicking options) for the script object, in preparation of changing it. --print ("inside onGetOverridePickType function (client)") msg.ePickType = 14 -- Set the Pick Type to 14 return msg -- Send Pick Type 14 back to the script object end ]]-- --require('o_mis') function onStartup(self) -- When the Object with this script attacthed (self) loads or "starts up," --print("started up TEST") self:SetProximityRadius{ radius = 8, name = "ALL"} self:SetProximityRadius{ radius = 4, name = "LEAVE_MESSAGE"} self:SetVar("DISABLE", false) self:SetVar("REBUILD_ICON_FOUND", false) self:SetVar("BRIDGE_FOUND", false) end function onProximityUpdate(self, msg) -- returns objId --print (msg.status) --print (msg.name) --Hint message will only be displayed when the player leaves the area, so this message won't conflict with the "you don't have enough bricks" message from the rebuild activator if (msg.status == "LEAVE" and msg.name == "LEAVE_MESSAGE" and msg.objId:GetFaction().faction == 1) then --print ("left region") -- If the hint message is not currently disabled, proceed if (self:GetVar("DISABLE") == false) then FindBridge(self) -- Look to see what objects are nearby local foundObj = self:GetProximityObjects { name = "ALL"}.objects for i = 1, table.maxn (foundObj) do --Check to see if the rebuild activator (1692) is present if (foundObj[i]:GetLOT().objtemplate == 1692) then --print ("rebuild activator found") self:SetVar("REBUILD_ICON_FOUND", true) break end end --If the rebuild Icon is present AND the bridge is present if ((self:GetVar("REBUILD_ICON_FOUND")) and (self:GetVar("BRIDGE_FOUND") == true )) then self:SetVar("DISABLE", true) local player = msg.objId -- get the ID of the thing that sent the collision message player:DisplayTooltip{ bShow = true, strText = "That broken bridge has the bricks I need!", iTime = 5000 } --display hint message and leave it on until player turns it off GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "temp_disable", self ) end end end end onTimerDone = function(self, msg) if msg.name == "temp_disable" then self:SetVar("DISABLE", false) self:SetVar("REBUILD_ICON_FOUND", false) self:SetVar("BRIDGE_FOUND", false) end end --------------------------------------------------------------------------------------- -- Check to see if the broken bridge is there or not --------------------------------------------------------------------------------------- function FindBridge(self) --print ("Inside FindBridge Function") local cylinder = self:GetObjectsInGroup{ group = self:GetVar("grp_name") }.objects for i = 1, table.maxn (cylinder) do --print ("looking for bridge") if ((cylinder[i]:GetLOT().objtemplate) == 3881) then --3881 is bridge smashable --print ("Bridge has been found") self:SetVar("BRIDGE_FOUND", true) end end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "PauseTime") then --print ("Timer is done!") -- Get the player again (local variables aren't shared by different functions) and return player control local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} end end require('o_mis') local bHasBeenUsed = false function onCollisionPhantom(self, msg) -- Someting touches the Pet Switch --print ("Message on collision") local target = msg.objectID -- get the ID of the thing that sent the collision message if ( target:GetFaction().faction == 99 ) then -- Check to see if the thing that sent the collision message is a pet local petswitch = getObjectByName(self, "pet_bouncer") self:PlayAnimation{animationID = "down"} petswitch:NotifyObject{name = "on"} if bHasBeenUsed == true then -- Do not display message more than once return end local player = target:GetParentObj().objIDParent --get the ID of the player if ( (player) and (player:Exists()) ) then player:DisplayTooltip{ bShow = true, strText = "Click your pet - it will activate the switch!", iTime = 0 } --display hint message and leave it on until player turns it off bHasBeenUsed = true; --Don't ever display this tooltip again end end end function onOffCollisionPhantom (self,msg) local petswitch = getObjectByName(self, "pet_bouncer") self:PlayAnimation{animationID = "up"} petswitch:NotifyObject{name = "off"} end require('o_mis') -- GLOBALS -- local FAR_RADIUS = 40 local NEAR_RADIUS = 20 local MESSAGE_NUMBER = 1 -------------------------------------------------------------- function onStartup(self) -- When the Object with this script attacthed (self) loads or "starts up," self:SetProximityRadius{ radius = FAR_RADIUS, name = "FAR_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" self:SetProximityRadius{ radius = NEAR_RADIUS, name = "NEAR_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" --print ("Started up!") end function onGetOverridePickType(self, msg) -- Get the Pick Type (cursor clicking options) for the script object, in preparation of changing it. msg.ePickType = 14 -- Set the Pick Type to 14 return msg -- Send Pick Type 14 back to the script object end function onProximityUpdate(self, msg) -- NPC is approached --print ("Approached!") local targetID = msg.objId --GGJ Define targetID as msg.objID (the thing that sent the message, which is hopefully the player) if (msg.status == "ENTER" and msg.name == "FAR_MESSAGE" and msg.objId:GetFaction().faction == 1 and MESSAGE_NUMBER == 1) then --if the Proximity Message was "Enter" in the far radius and the message was sent by the player, then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_INVITE_01")} elseif (msg.status == "ENTER" and msg.name == "NEAR_MESSAGE" and msg.objId:GetFaction().faction == 1 and MESSAGE_NUMBER == 1) then --if the Proximity Message was "Enter" in the near radius and the message was sent by the player, then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_INVITE_02")} elseif (msg.status == "LEAVE" and msg.objId:GetFaction().faction == 1 and MESSAGE_NUMBER >= 2 ) then --if the Proximity Message was "Enter" in the near radius and the message was sent by the player, then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_INVITE_03")} end end function onCheckUseRequirements(self, msg) --print ("Clicked!") --local user = msg.objIDUser --local pet = user:GetPetID().objID msg.preventRequirementsIcon = true if msg.isFromUI then return end if (MESSAGE_NUMBER == 1) then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_MESSAGE_01")} MESSAGE_NUMBER = (MESSAGE_NUMBER + 1) elseif (MESSAGE_NUMBER == 2) then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_MESSAGE_02")} MESSAGE_NUMBER = (MESSAGE_NUMBER + 1) elseif (MESSAGE_NUMBER == 3) then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_MESSAGE_03")} MESSAGE_NUMBER = (MESSAGE_NUMBER + 1) elseif (MESSAGE_NUMBER == 4) then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_MESSAGE_04")} MESSAGE_NUMBER = (MESSAGE_NUMBER + 1) elseif (MESSAGE_NUMBER == 5) then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_MESSAGE_05")} MESSAGE_NUMBER = (MESSAGE_NUMBER + 1) elseif (MESSAGE_NUMBER == 6) then self:DisplayChatBubble{wsText = Localize("PET_TUTORIAL_MESSAGE_06")} MESSAGE_NUMBER = 1 end msg.bCanUse = false return msg end require('o_mis') require('client/ai/L_BOUNCER_BASIC') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" CONSTANTS["BOUNCER_LOT"] = 3736 CONSTANTS["HF_NODE_BOUNCER"] = 7 CONSTANTS["HF_SUB_ITEM_SEP_STRING"] = "\x1F" function onStartup( self ) --print( "PET HYDRANT: onStartup" ) --self:AddSkill{ skillID = CONSTANTS["DESTINK_SKILL_ID"] } self:SetVar( "waterEffect", "" ) self:SetProximityRadius { radius = 10 } self:SetVar( "broken", false ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 --interactive return msg end function BreakHydrant( self ) --print( "HYDRANT: break_hydrant" ) self:FireEventServerSide{ senderID = self, args = "breakHydrant" } AddWaterEffect( self ) SpawnBouncer( self ) end function RepairHydrant( self ) --print( "HYDRANT: repair_hydrant" ) self:FireEventServerSide{ senderID = self, args = "repairHydrant" } RemoveBouncer( self ) CancelWaterEffect( self ) end function AddWaterEffect( self ) -- if this hydrant already has the water effect, don't add another one if ( self:GetVar( "waterEffect" ) == true ) then return end self:PlayFXEffect{ name = "water", effectID = 384, effectType = "water" } self:SetVar( "waterEffect", true ) end function CancelWaterEffect( self ) local myEffect = self:GetVar("waterEffect") if ( myEffect ) then self:StopFXEffect{ name = "water" } end self:SetVar( "waterEffect", false ) end function SpawnBouncer( self ) --print ("start of spawnBouncer") -- get the hydrant's position local hydrantPos = self:GetPosition{}.pos -- determine where to spawn the bouncer local bouncerPos = self:GetPosition{}.pos bouncerPos.x = hydrantPos.x bouncerPos.y = hydrantPos.y bouncerPos.z = hydrantPos.z -- determine where to make the player land local landingPos = self:GetPosition{}.pos landingPos.x = bouncerPos.x + 200 landingPos.y = bouncerPos.y landingPos.z = bouncerPos.z + 500 --print ("PetBouncer") --landingPos.x = 28.55 --landingPos.y = 197.66 --landingPos.z = -142.74 -- set up bouncer config data local landingString = landingPos.x .. CONSTANTS["HF_SUB_ITEM_SEP_STRING"] .. landingPos.y .. CONSTANTS["HF_SUB_ITEM_SEP_STRING"] .. landingPos.z local config = { {"bouncer_speed", 500.0} , {"objtype", CONSTANTS["HF_NODE_BOUNCER"]}, {"bouncer_destination", landingString } } --bouncer speed was 100. Changing this somehow caused it to go straight up. RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER_LOT"], x = bouncerPos.x, y = bouncerPos.y, z = bouncerPos.z, owner = self, objType = CONSTANTS["HF_NODE_BOUNCER"], configData = config } end function onChildLoaded( self,msg ) --print( "HYRDRANT: onChildLoaded" ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["BOUNCER_LOT"] ) then --print( "HYDRANT: bouncer loaded" ) storeObjectByName( self, "bouncer", msg.childID ) end end function RemoveBouncer( self ) --print( "HYDRANT: RemoveBouncer" ) local bouncerObj = getObjectByName( self, "bouncer" ) if( bouncerObj ~= nil ) then --print( "HYRDRANT: bouncer Die" ) GAMEOBJ:DeleteObject( bouncerObj ) end end function onBouncerTriggered( self, msg ) --CleanNearbyPlayers( self ) --Hackish fix for the 'bounce collision' local player = msg.triggerObj local objPos = player:GetPosition().pos objPos.y = objPos.y + 1 player:SetPosition{pos = objPos} bounceObj(self, msg.triggerObj) end function onClientUse( self, msg ) --print( "HYDRANT: onClientUse" ) if ( self:GetVar( "broken" ) == false ) then -- break the hydrant self:SetVar( "broken", true ) BreakHydrant( self ) CleanNearbyPlayers( self ) else -- it was already broken, so repair it self:SetVar( "broken", false ) RepairHydrant( self ) end end function CleanNearbyPlayers( self ) --print( "client-sde CleanNearbyPlayers" ) self:FireEventServerSide{ senderID = self, args = "cleanPlayers" } end function onCollisionPhantom(self,msg) --print("player collided") local seagull = self:GetObjectsInGroup{ group = "Seagull", ignoreSpawners = true}.objects[1] seagull:PlayAnimation{animationID = "fly-away"} GAMEOBJ:GetTimer():AddTimerWithCancel( seagull:GetAnimationTime{ animationID = "fly-away" }.time , "flyaway", self ) end function onOffCollisionPhantom(self,msg) --print("player done collideing with phantom") local seagull = self:GetObjectsInGroup{ group = "Seagull", ignoreSpawners = true}.objects[1] seagull:PlayAnimation{animationID = "fly-land"} end function onTimerDone(self, msg) if (msg.name == "flyaway") then --print("flyaway timer done") local seagull = self:GetObjectsInGroup{ group = "Seagull", ignoreSpawners = true}.objects[1] seagull:PlayAnimation{animationID = "fly-hover"} end end-------------------------------------------------------------- -- Server side script on Coalessa in pet rock -- this script unlocks the pet taming emote for the player -- created by Brandi... 2/17/10 -------------------------------------------------------------- function onFireEventServerSide(self, msg) --print('onMissionDialogueOK ' .. msg.iMissionState .. ' - ' .. msg.missionID) if msg.args == 'unlockEmote' then msg.senderID:SetEmoteLockState{ emoteID=115, bLock = false } end end-------------------------------------------------------------- -- Client side script on Coalessa in pet rock -- this script checks the missions state and player flags -- created by Brandi... 2/17/10 -------------------------------------------------------------- function onMissionDialogueOK(self,msg) --print('onMissionDialogueOK ' .. msg.iMissionState .. ' - ' .. msg.missionID) --checks if mission is tame a pet mission if msg.missionID == 110 then --if the player just accepted the mission, give them the pet taming emote if msg.iMissionState < 2 then --print('unlocking emote') --have to send to a server script because the emotes cant be unlocked from the client self:FireEventServerSide{senderID = msg.responder, args = 'unlockEmote' } end end --if the mission is the tame every other pet in the game mission (more to be added to this later) if msg.missionID == 688 then --*** once the pets have scripts on them to set the player flags when they are tamed, need to add a check to see -- how many different pets the player has tamed to up date this mission --if the player completed the mission set their flag on if msg.iMissionState == 4 then msg.responder:SetFlag{iFlagID = 67, bFlag = true} --wont actually need this in the real game, the object to spawn the lion is in a different map local group = self:GetObjectsInGroup{group = "lionstuff", ignoreSpawners = true}.objects for k,v in ipairs(group) do if v then v:RequestPickTypeUpdate() end end end end end-------------------------------------------------------------- -- Server side script on the object to spawn the lion pet -- lion has to be spawned for a server side script because the lion is a pet to be tamed -- pet taming minigame runs on the server as well as the client -- created by Brandi... 2/11/10 -------------------------------------------------------------- function onUse(self,msg) local mypos = self:GetPosition().pos local player = msg.user local lions = self:GetObjectsInGroup{ group = "lions", ignoreSpawners = true }.objects local playerlion = self:GetObjectsInGroup{ group = "lion"..player:GetID(), ignoreSpawners = true }.objects if #playerlion > 0 then --print("You already spawned a lion") self:FireEventClientSide{args = "playerLion", senderID = player} return end if #lions > 4 then --print("There are too many lions right now, try again in a few minutes") self:FireEventClientSide{args = "tooManyLions", senderID = player} return end -- off sets the lion spawn so it doesn't spawn in the middle of the spawner object -- this is arbitrary and will be changed depending on where this goes in a level mypos.x = mypos.x + 20 --set the tamer as the player to check that only this player can tame that lion -- and set the group id to include the player id to make sure this player can only spawn one lion at a time local config = { { "tamer", player:GetID() } , { "groupID", "lion"..player:GetID()..";lions" } } RESMGR:LoadObject { objectTemplate = 3520 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, configData = config } end-------------------------------------------------------------- -- Client side script on the object to spawn the lion pet -- this script controls the interactablity of the object -- created by Brandi... 2/11/10 -------------------------------------------------------------- function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --check to see if the player is loaded before setting the pick type on the lion spawner object -- if i don't do this check, the pick type runs before the player is loaded, and the flag check always fails if player:Exists() then self:RequestPickTypeUpdate() else --heartbeat time to see if the player is loaded yet GAMEOBJ:GetTimer():AddTimerWithCancel(0.5, "UpdateIcons", self ) end end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority --check to see if the player has the flag set to spawn the lion if player:Exists() then if player:GetFlag{iFlagID = 67}.bFlag == true then --and #lions < 1 then msg.ePickType = 14 -- Interactive pick type end else msg.ePickType = -1 end end --set the picktype on the object for the check within the timer to make sure not to run the script unnecessarily self:SetVar{"picktype",msg.ePickType} return msg end function onFireEventClientSide(self,msg) --display popup window letting the player know they can't spawn another lion --two messages, one saying the player cant spawn more than one lion at a time and one saying that there are too many lions spawned --right now both messages are the same, but eventually they should be different local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.args == "playerLion" then if player:GetID() == msg.senderID:GetID() then --print("You already spawned a lion") player:DisplayTooltip{ bShow = true, strText = Localize("LION_SUMMON_FAIL"), iTime = 300 } end end if msg.args == "tooManyLions" then if player:GetID() == msg.senderID:GetID() then --print("There are too many lions right now, try again in a few minutes") player:DisplayTooltip{ bShow = true, strText = Localize("LION_SUMMON_FAIL"), iTime = 300 } end end end function onTimerDone(self, msg) local oldPickType = self:GetVar{"picktype"} pickType = -1 if ( msg.name == "UpdateIcons" ) then --print("PickType=" .. tostring(pickType) .. ", oldPickType=" ..tostring(oldPickType)) if oldPickType and (pickType ~= oldPickType) then onRenderComponentReady(self) GAMEOBJ:GetTimer():CancelTimer("UpdateIcons", self ) else --rerun the render component ready to see if the player has loaded yet onRenderComponentReady(self) end end endfunction onRenderComponentReady(self, msg) self:SetVisible{visible = false, fadeTime = 0.0} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) Set = {} --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = true Set['Name'] = "Dog" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 10 -- Aggro Radius Set['conductRadius'] = 10 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 8 -- Tether Speed Set['wanderRadius'] = 25 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 2 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = .75 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "scared" -- Animation Type --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Neutral" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 3 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time -- NPC Hated List Set['NPCHated_1'] = nil --Faction of a NPC Set['NPCHated_2'] = nil --Faction of a NPC Set['NPCHated_3'] = nil --Faction of a NPC Set['NPCHated_4'] = nil --Faction of a NPC --[[ //////////////////////////////////////////////////////////////////////////////// _____ _____ _ ____ | ___| | ____| / \ | _ \ | |_ | _| / _ \ | |_) | | _| | |___ / ___ \ | _ < |_| |_____| /_/ \_\ |_| \_\ Fear uses the ConductRadius you may NOT enable a conduct behavior when using Fear --]] -- Fear Settings Set['FearPlayer'] = false -- Fear the Player Bool Set['FearNPC'] = false -- Fear Other NPC Bool Set['FearCombat'] = false -- Fear when other NPC/Player are in combat Set['FearHP'] = false -- Fear base on remaining HP Set['FearHPamount'] = 1 -- The amout of HP need to fear -- ['FearTime'] the amout of time to flee,, -- If ['FearHP'] = true NPC will retrun and attack after time has expired. Set['FearChance'] = 100 Set['FearType'] = "EmoteFlee" -- ['Flee'],['FleeEmote'], ['EmoteFlee'] Set['FearDistance'] = 10 -- Flee Distance Set['FearTime'] = 5 -- Time before retruning to the orginal pos. Set['FearSpeed'] = 5 -- NPC walk speed Set['FearFace'] = true -- NPC will face target when it has reached its flee pos. Set['FearFOV'] = 360 -- [int/nil] FOV setting NPC must see you before Fleeing [Note: conduct FOV must be set to -true- ] -- The conduct Radius will be nilled out if FOV is used. -- optional: Use for Flee Taunt -- Set['FearEmoteType'] = "scared" -- Animation Type -- Fear NPC list Set['FearNPC_1'] = nil --Faction of a NPC Set['FearNPC_2'] = nil --Faction of a NPC Set['FearNPC_3'] = nil --Faction of a NPC Set['FearNPC_4'] = nil --Faction of a NPC --[[ --////////////////////////////////////////////////////////////////////////////// _ _ _____ _ ____ _____ ____ | | | | | ____| | | | _ \ | ____| | _ \ | |_| | | _| | | | |_) | | _| | |_) | | _ | | |___ | |___ | __/ | |___ | _ < |_| |_| |_____| |_____| |_| |_____| |_| \_\ --]] Set['Helper'] = false -- Bool Set['HelperType'] = "string" -- ["Aggro"],["Health"],["investigate"] Set['HelperDis'] = 20 -- The Distance to call for help Set['HelperFaction'] = 4 -- Faciton to help --[[ --///////////////////////////////////////////////////////////////////////// ____ ___ _ _ ____ _ _ ____ _____ / ___| / _ \ | \ | | | _ \ | | | | / ___| |_ _| | | | | | | | \| | | | | | | | | | | | | | | |___ | |_| | | |\ | | |_| | | |_| | | |___ | | \____| \___/ |_| \_| |____/ \___/ \____| |_| --]] Set['Conduct_Active'] = false -- Conduct 1 Active true/false Set['Conduct_Chance'] = 100 -- Chance to play Set['Con_Order'] = "AE" -- Emote - Action - AE - EA - AEA - EAE - Set['Con_FOV'] = 360 -- 360 it the Standard Conduct Set['Con_Faction'] = 1 -- Faction of the NPC/Player Set['Con_Target'] = true -- Target NPC/Player During Aciton + Emote -------------------------------------------------------------------------------- -- Action Set['Con_Type'] = "face" -- String name of type ['follow'],['face'],['goto'],['teleport'] Set['Con_Type_Opt'] = "" --{{ OPT }}-- follow = [int Speed], goto = ['x,y,z'], teleport = ['x,y,z'] face = ['x,y,z'] Set['Con_Action_Delay'] = 1 -- Delay after playing Action -- Emote Set['Con_EffectType'] = "interact" -- The Effect Name Set['Con_Emote_Delay'] = 1 -- Delay after playing Emote --[[ --////////////////////////////////////////////////////////////////////////////// ____ _____ _____ ____ _ _ ____ ____ | _ \ | ____| |_ _| / ___| | | / \ / ___| / ___| | |_) | | _| | | | | | | / _ \ \___ \ \___ \ | __/ | |___ | | | |___ | |___ / ___ \ ___) | ___) | |_| |_____| |_| \____| |_____| /_/ \_\ |____/ |____/ --]] Set['Pet_Active'] = false -- Active [true/false] Set['Pet_ParentMovement'] = false -- Lock parent in a frozen state Cant't attack or move Set['Pet_DeathLinked'] = true -- When Parent dies pets will despawn Set['Pet_AggroLinked'] = true -- If Parent is attacked the childern will assist Set['Pet_RespawnPets'] = true Set['Pet_SpawnID'] = 1876 -- Spawner ID [1876 = Grumpy] Set['Pet_Count'] = 2 -- Number of pets the given parent can have Set['Pet_Respawn'] = 10 -- Pet Respawn time Set['Pet_DisMin'] = 10 -- Radius Min Distance Set['Pet_DisMax'] = 20 -- Radius Max Distance Set['Pet_Follow'] = false -- Pet will follow the Parent Set['Pet_FollowDis'] = 5 -- Distance to follow -- Not working right now -- Set['Pet_HealthLink'] = false Set['Pet_UseEffect'] = false Set['Pet_SpawnType'] = "name" Set['Pet_Child'] = false Set['Pet_ChildMovement'] = "follow" ------ Due not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:SetProximityRadius{radius = 10} end function onProximityUpdate(self, msg) if msg.status == "ENTER" then self:PlayFXEffect{effectType = "scared"} end end require('o_mis') -- Generic Male is 3385 -- 110 Tame a Pet Mission -- 111 Collect Gold Bricks Mission --[[ Null: Player has never had and does not currently have the mission (aka "Available"). MissionState = 1 Accepted: Player has taken the mission from the mission giver, but has not completed all of the tasks (aka "Active"). MissionState = 2 Ready to Complete: Player has accepted the mission, and all of the tasks are complete, but player has not accepted the reward. MissionState = 4 Completed: Player has completed the mission and accepted the reward. MissionState = 8 Completed and Available: Player has completed the mission at least once, and it is a repeatable mission, ready to be started again. MissionState = 9 Completed and Active: Player has completed the mission at least once, and has begun it again, but not completed all tasks. MissionState = 10 Completed and Ready to Complete: Player has completed the mission at least once, and has completed it again, but has not accepted the reward. MissionState = 12 Failed: Player has failed the mission and is experiencing great sadness. MissionState = 16 Completed and Reported: The mission has been completed one or more time, and Wolf Blitzer has talked about it. (?Actual definition coming soon?) MissionState = 32 ]]-- -- GLOBALS -- local FAR_RADIUS = 40 local NEAR_RADIUS = 20 -------------------------------------------------------------- function onStartup(self) -- When the Object with this script attacthed (self) loads or "starts up," self:SetProximityRadius{ radius = FAR_RADIUS, name = "FAR_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" self:SetProximityRadius{ radius = NEAR_RADIUS, name = "NEAR_MESSAGE" } -- Define the message for the Far Radius as "Far_Message" end -- function IsLocalCharacter(target) -- Get the ID of the target that triggered this message -- return GAMEOBJ:GetLocalCharID() == target:GetID() -- CLIENT ONLY Get the player object, check to see if it's the same as the ID of the target -- end function onProximityUpdate(self, msg) -- Generic male is approached local targetID = msg.objId --GGJ Define targetID as msg.objID (the thing that sent the message, which is hopefully the player) local TameMissionStatus = targetID:GetMissionState{missionID = 110}.missionState --define myMissionState as the current state of mission 136, for the TargetID local PetFoodMissionStatus = targetID:GetMissionState{missionID = 111}.missionState --define myMissionState as the current state of mission 136, for the TargetID --print ("TameMission Status is ".. TameMissionStatus) --print ("PetFoodMission Status is ".. BrickMissionStatus) if (msg.status == "ENTER" and msg.name == "FAR_MESSAGE" and msg.objId:GetFaction().faction == 1) then --if the Proximity Message was "Enter" in the far radius and the message was sent by the player, then --Taming Mission Messages if (TameMissionStatus == 1) then --GGJ Mission has never been started self:DisplayChatBubble{wsText = Localize("AREN'T_THEY_CUTE?")} elseif (TameMissionStatus == 2) then --GGJ Mission is "accepted" self:DisplayChatBubble{wsText = Localize("PICK_THE_PET_YOU_WANT,_AND_GIVE_IT_A_CLICK!")} elseif (TameMissionStatus == 4) then -- Mission is done, but player hasn't returned to Rancher yet self:DisplayChatBubble{wsText = Localize("YOU_TAMED_ONE!")} --Pet Food Mission Messages elseif (PetFoodMissionStatus == 2) then --Mission is "accepted" self:DisplayChatBubble{wsText = Localize("A_PET_CAN_HELP_IN_LOTS_OF_WAYS.")} elseif (PetFoodMissionStatus == 4) then --Mission is done, but player hasn't returned to Rancher yet self:DisplayChatBubble{wsText = Localize("SEE_THE_PET_PAW_ICON?")} end elseif (msg.status == "ENTER" and msg.name == "NEAR_MESSAGE" and msg.objId:GetFaction().faction == 1) then --if the Proximity Message was "Enter" in the near radius and the message was sent by the player, then --Taming Mission Messages if (TameMissionStatus == 1) then --GGJ Mission has never been started self:DisplayChatBubble{wsText = Localize("CHECK_IN_WITH_THE_PET_RANCHER_FOR_INSTRUCTIONS.")} elseif (TameMissionStatus == 2) then --GGJ Mission is "accepted," etc. self:DisplayChatBubble{wsText = Localize("IN_THE_PET-TAMING-MINI-GAME,_YOU_MUST_CHOOSE_THE_BRICKS_THAT_BELONG_IN_THE_MODEL.")} elseif (TameMissionStatus == 4) then --Mission is done, but player hasn't returned to Rancher yet self:DisplayChatBubble{wsText = Localize("RETURN_TO_THE_PET_RANCHER_FOR_YOUR_NEXT_TASK.")} --PetFood Mission Messages elseif (PetFoodMissionStatus == 2) then --GGJ Mission is "Completed," etc. self:DisplayChatBubble{wsText = Localize("PETS_CAN_SNIFF_OUT_HIDDEN_TREASURE,_AND_DIG_IT_UP_FOR_YOU.")} elseif (PetFoodMissionStatus == 4 or PetFoodMissionStatus == 8) then --Mission is done, but player hasn't returned to Rancher yet self:DisplayChatBubble{wsText = Localize("USE_THE_PET_PAW_ICON_TO_GIVE_YOUR_PET_COMMANDS!")} end end end require('o_mis') --/////////////////////////////////////////////////////////////////////////////////////// --// Generic Rebuild -- Script (CLIENT) --// - The spawned entity that will be breaking a rebuild --/////////////////////////////////////////////////////////////////////////////////////// local effect_interval = 0.25 function onRenderComponentReady(self, msg) -- start a timer that will play the effects GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) end onTimerDone = function(self, msg) -- play the effect if msg.name == "DoEffect" then -- play the wake effect every interval self:PlayFXEffect{effectType = "onmove"} -- start a timer that will play the effects GAMEOBJ:GetTimer():AddTimerWithCancel( effect_interval, "DoEffect", self ) end end require('o_mis') -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetMouseOverDistance(self, dist) if (self and self:Exists()) then self:SetVar("interactDistance", dist) end end -------------------------------------------------------------- -- sets the proximity for the object -------------------------------------------------------------- function SetProximityDistance(self, dist) if (self and self:Exists()) then self:SetVar("proxDistance", dist) self:SetProximityRadius{radius = self:GetVar("proxDistance")} end end -------------------------------------------------------------- -- check for valid type -------------------------------------------------------------- function IsValidType(type) if (type == "mouseOverEffect" or type == "mouseOverAnim" or type == "mouseOverText" or type == "interactionPlayerAnim" or type == "interactionEffect" or type == "interactionAnim" or type == "interactionText" or type == "proximityEffect" or type == "proximityAnim" or type == "proximityText") then return true; end return false end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction(self, type, action) if (self and self:Exists()) then -- check type if (IsValidType(type) == false) then print("Bad Type of Interaction") return end local table = self:GetVar(type) -- init table if need to if (table == nil) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- override pick type to be interactive -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --interactive type return msg end -------------------------------------------------------------- -- handle cursor over object -------------------------------------------------------------- function onCursorOn(self, msg) -- do effects local effects = self:GetVar("mouseOverEffect") if effects and #effects > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("mouseOverAnim") if anims and #anims > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("mouseOverText") if texts and #texts > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle client use -------------------------------------------------------------- function onClientUse(self, msg) -- do effects local effects = self:GetVar("interactionEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("interactionAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do anims on player local anims = self:GetVar("interactionPlayerAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("interactionText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() then -- do effects local effects = self:GetVar("proximityEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("proximityAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("proximityText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end end end require('o_mis') require('client/ai/SND/L_AUDIO_CLIENT') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 10) AddInteraction(self, "proximityEffect", "proxsnd") end function onCollision(self,msg) local song = self:GetVar("music"); if(song) then local soundID = SOUND:PlaySequence(song); local objects = self:GetObjectsInGroup {group = self:GetVar("group name")}.objects objects[1]:NotifyObject{param1=soundID} end msg.ignoreCollision = true; return msg end function onCollision(self,msg) local song = self:GetVar("music"); if(song) then SOUND:StopSequence(song); self: SetVar ("music", nil) end msg.ignoreCollision = true; return msg end function onNotifyObject (self, msg) self: SetVar ("music", msg.param1) end require('o_mis') require('client/ai/SND/L_AUDIO_CLIENT') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 1) AddInteraction(self, "interactionPlayerAnim", "shocked") end require('o_mis') require('client/ai/SND/L_AUDIO_CLIENT') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 30) AddInteraction(self, "interactionEffect", "plysnd") end require('o_mis') require('client/ai/SND/L_AUDIO_CLIENT') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 20) AddInteraction(self, "proximityEffect", "proxsnd") end require('o_mis') require('client/ai/SND/L_AUDIO_CLIENT') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 30) AddInteraction(self, "interactionEffect", "plysnd") end require('o_mis') require('client/ai/SND/L_AUDIO_CLIENT') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 10) AddInteraction(self, "proximityEffect", "proxsnd") end require('o_mis') require('client/ai/SND/L_AUDIO_CLIENT') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 20) AddInteraction(self, "proximityEffect", "proxsnd") end --require('o_mis') function onClientUse(self) --print "Start timers" GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PlayerTeleportFreezeandOrient",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.9, "Snap",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "PlayerUnfreezeandCamera",self ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onTimerDone (self, msg) if (msg.name == "PlayerTeleportFreezeandOrient") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} --player:SetPosition {pos = {x=-144.16,y=184.28,z=-461.66}} player:SetRotation {x=0,y=-1,z=0,w=0} end if (msg.name == "Snap") then CAMERA:SnapCameraToPlayer() end if (msg.name == "PlayerUnfreezeandCamera") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:RemoveSkill{ skillID = 66 } player:AddSkill{ skillID = 66 } player:CastSkill{ optionalTargetID = self, skillID = 66 } player:PlayCinematic { pathName = "Gameplay_Setup" } player:SetUserCtrlCompPause{bPaused = false} end end require('o_mis') function onRenderComponentReady(self, msg) self:AddObjectToGroup{ group = "Blue" } end function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) storeObjectByName(self, "TeleGuy", player) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "TeleToOrange",self ) end function onTimerDone(self, msg) if msg.name == "TeleToOrange" then local OrangeObject = self:GetObjectsInGroup{ group = "Orange"}.objects for i = 1, table.maxn (OrangeObject) do if OrangeObject[i]:GetLOT().objtemplate == 5896 then local orangetelepos = OrangeObject[i]:GetPosition().pos local orangex = orangetelepos.x local orangey = orangetelepos.y + 2 local orangez = orangetelepos.z + 2 getObjectByName(self,"TeleGuy"):SetPosition {pos = {x = orangex, y = orangey, z = orangez}} end end end end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end --require('o_mis') function onClientUse(self) -- print "Return cam to normal" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Camera_End" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endfunction onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end require('o_mis') function onStartup(self, msg) local ControlClimberObject = self:GetObjectsInGroup{ group = "GP_Climb"}.objects[1] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "ClimberNotify",self ) storeObjectByName(self, "ControlClimberObject", ControlClimberObject) end function onTimerDone(self, msg) if msg.name == "ClimberNotify" then getObjectByName(self,"ControlClimberObject"):NotifyObject{name = "climberloaded", ObjIDSender = self} end end--require('o_mis') function onClientUse(self) --print "Start timers" GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PlayerTeleportFreezeandOrient",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.9, "Snap",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "PlayerUnfreezeandCamera",self ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onTimerDone (self, msg) if (msg.name == "PlayerTeleportFreezeandOrient") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} player:SetPosition {pos = {x=-144.16,y=184.28,z=-461.66}} player:SetRotation {x=0,y=-1,z=0,w=0} end if (msg.name == "Snap") then CAMERA:SnapCameraToPlayer() end if (msg.name == "PlayerUnfreezeandCamera") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Gameplay_Setup" } player:SetUserCtrlCompPause{bPaused = false} end end require('o_mis') CONSTANTS = {} CONSTANTS["ClimbSide"] = 5915 CONSTANTS["ClimbTop"] = 5914 CONSTANTS["ClimbWall"] = 5916 local climbsections = {} local currentClimberPlaceIndex = 1 local climberspawns = {5915,5915,5915,5915,5914,5914,5914,5916,5916,5916,5916} local climberoffset = 0 local currentClimberLoadIndex = 1 function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) currentClimberPlaceIndex = 1 currentClimberLoadIndex = 1 Deleteclimberspawns() Loadnextclimberspawn() local friends = self:GetObjectsInGroup{ group = "GP_Control" }.objects for i = 1, table.maxn (friends) do if friends[i]:GetLOT().objtemplate == 5899 then friends[i]:NotifyObject{name = "padcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5900 then friends[i]:NotifyObject{name = "bouncecancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5925 then friends[i]:NotifyObject{name = "misccancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5926 then friends[i]:NotifyObject{name = "trapcancel", ObjIDSender = self} elseif friends[i]:GetLOT().objtemplate == 5927 then friends[i]:NotifyObject{name = "blockercancel", ObjIDSender = self} end end end function Loadnextclimberspawn() if currentClimberLoadIndex <= #climberspawns then if climberspawns[currentClimberLoadIndex] == CONSTANTS["ClimbSide"] then local config = { {"climbable", "ladder"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["ClimbSide"], x = -116.86 + climberoffset, y = 184.23, z = -506.23, configData = config } elseif climberspawns[currentClimberLoadIndex] == CONSTANTS["ClimbTop"] then local config = { {"climbable", "wall"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["ClimbTop"], x = -116.86 + climberoffset, y = 184.23, z = -506.23, configData = config } elseif climberspawns[currentClimberLoadIndex] == CONSTANTS["ClimbWall"] then local config = { {"climbable", "wall"} } RESMGR:LoadObject { objectTemplate = CONSTANTS["ClimbWall"], x = -116.86 + climberoffset, y = 184.23, z = -506.23, configData = config } end climberoffset = climberoffset + 5 currentClimberLoadIndex = currentClimberLoadIndex + 1 end end function Deleteclimberspawns() for i = 1, #climbsections do GAMEOBJ:DeleteObject(climbsections[i]) end climbsections = {} climberoffset = 0 currentClimberPlaceIndex = 1 currentClimberLoadIndex = 1 end function onNotifyObject(self, msg) if msg.name == "climberloaded" then climbsections[#climbsections + 1] = msg.ObjIDSender Loadnextclimberspawn() elseif msg.name == "Selected" then if #climbsections >= currentClimberPlaceIndex then climbsections[currentClimberPlaceIndex]:SetPosition{pos=msg.ObjIDSender:GetPosition{}.pos} -- climbsections[currentClimberPlaceIndex]:StopFXEffect{name = "hot"} currentClimberPlaceIndex = currentClimberPlaceIndex + 1 -- if currentClimberPlaceIndex <= #climbsections then -- climbsections[currentClimberPlaceIndex]:PlayFXEffect{name = "hot", effectType = "select"} -- end end elseif msg.name == "climbercancel" then currentClimberPlaceIndex = 12 currentClimberLoadIndex = 12 end end --require('o_mis') function onClientUse(self) --print "Start timers" GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "PlayerTeleportFreezeandOrient",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.9, "Snap",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "PlayerUnfreezeandCamera",self ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onTimerDone (self, msg) if (msg.name == "PlayerTeleportFreezeandOrient") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} --player:SetPosition {pos = {x=-144.16,y=184.28,z=-461.66}} player:SetRotation {x=0,y=-1,z=0,w=0} end if (msg.name == "Snap") then CAMERA:SnapCameraToPlayer() end if (msg.name == "PlayerUnfreezeandCamera") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:RemoveSkill{ skillID = 66 } player:AddSkill{ skillID = 66 } player:CastSkill{ optionalTargetID = self, skillID = 66 } player:PlayCinematic { pathName = "Play" } player:SetUserCtrlCompPause{bPaused = false} end end --require('o_mis') function onCollisionPhantom(self, msg) print "teleport" local target = msg.senderID local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z local cratepos = self:GetPosition{}.pos local crateposx = cratepos.x + playerVelx / 5 local crateposy = cratepos.y + playerVely / 5 local crateposz = cratepos.z + playerVelz / 5 self:SetPosition{pos = {x = crateposx, y = crateposy, z = crateposz}} end function onOffCollisionPhantom(self, msg) print "update leave" endrequire('o_mis') function onTimerDone(self, msg) if msg.name == "LeftDeathTeleport" then getObjectByName(self,"DrownLefter"):SetPosition {pos = {x = -173.5,y = 190,z = -561.74}} getObjectByName(self,"DrownLefter"):SetUserCtrlCompPause{bPaused = false} end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then storeObjectByName(self, "DrownLefter", target) getObjectByName(self,"DrownLefter"):SetUserCtrlCompPause{bPaused = true} getObjectByName(self,"DrownLefter"):PlayAnimation{animationID = "drown"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "LeftDeathTeleport",self ) end end require('o_mis') function onTimerDone(self, msg) if msg.name == "RightDeathTeleport" then getObjectByName(self,"DrownRighter"):SetPosition {pos = {x = -106.02,y = 189.99,z = -561.75}} getObjectByName(self,"DrownRighter"):SetUserCtrlCompPause{bPaused = false} end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then storeObjectByName(self, "DrownRighter", target) getObjectByName(self,"DrownRighter"):SetUserCtrlCompPause{bPaused = true} getObjectByName(self,"DrownRighter"):PlayAnimation{animationID = "drown"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "RightDeathTeleport",self ) end end require('o_mis') function onTimerDone(self, msg) if msg.name == "FireDeathTeleport" then getObjectByName(self,"Burner"):SetPosition{pos = {x = -106.02,y = 189.99,z = -561.75}} getObjectByName(self,"Burner"):SetUserCtrlCompPause{bPaused = false} end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then storeObjectByName(self, "Burner", target) getObjectByName(self,"Burner"):SetUserCtrlCompPause{bPaused = true} getObjectByName(self,"Burner"):PlayAnimation{animationID = "burn"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "FireDeathTeleport",self ) end end require('o_mis') function onStartup(self) self:AddObjectToGroup{ group = "Level" } end function onNotifyObject(self, msg) if msg.name == "Raise" then --print "Lower" self:PlayAnimation{animationID = "raise"} elseif msg.name == "Lower" then --print "Lower" self:PlayAnimation{animationID = "lower"} end end require('o_mis') function onRenderComponentReady(self, msg) self:AddObjectToGroup{ group = "Orange" } end function onClientUse(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) storeObjectByName(self, "TeleGuy", player) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "TeleToBlue",self ) end function onTimerDone(self, msg) if msg.name == "TeleToBlue" then local BlueObject = self:GetObjectsInGroup{ group = "Blue"}.objects for i = 1, table.maxn (BlueObject) do if BlueObject[i]:GetLOT().objtemplate == 5895 then local bluetelepos = BlueObject[i]:GetPosition().pos local bluex = bluetelepos.x local bluey = bluetelepos.y + 2 local bluez = bluetelepos.z + 2 getObjectByName(self,"TeleGuy"):SetPosition {pos = {x = bluex, y = bluey, z = bluez}} end end end end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') function onClientUse(self) --print "Start timers" GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "TeleportFreezeOrient",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.9, "Snap",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "UnfreezeTeleportCamera",self ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onTimerDone (self, msg) if (msg.name == "TeleportFreezeOrient") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} player:SetRotation {x=0,y=-1,z=0,w=0} end if (msg.name == "Snap") then CAMERA:SnapCameraToPlayer() end if (msg.name == "UnfreezeTeleportCamera") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) CAMERA:ActivateCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetRenderCamera("CAMERA_SIDE_SCROLLER") player:SetPosition{pos = {x=-106.02, y=189.99, z=-561.75}} player:SetRotation {x=0,y=0.707,z=0,w=0.707} player:SetUserCtrlCompPause{bPaused = false} player:RemoveSkill{ skillID = 170 } player:AddSkill{ skillID = 170 } player:CastSkill{ optionalTargetID = self, skillID = 170 } local plane = self:GetObjectsInGroup{ group = "Level" }.objects for i = 1, table.maxn (plane) do if plane[i]:GetLOT().objtemplate == 5850 then plane[i]:NotifyObject{ name="Lower" } end end end end require('o_mis') function onClientUse(self) --print "Start timers" GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "TeleportFreezeOrient",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.9, "Snap",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "UnfreezeTeleportCamera",self ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onTimerDone (self, msg) if (msg.name == "TeleportFreezeOrient") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} player:SetRotation {x=0,y=-1,z=0,w=0} end if (msg.name == "Snap") then CAMERA:SnapCameraToPlayer() end if (msg.name == "UnfreezeTeleportCamera") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) CAMERA:ActivateCamera("CAMERA_SIDE_SCROLLER") CAMERA:SetRenderCamera("CAMERA_SIDE_SCROLLER") player:SetPosition {pos = {x=-173.5,y=190,z=-561.74}} player:SetRotation {x=0,y=0.707,z=0,w=0.707} player:SetUserCtrlCompPause{bPaused = false} player:RemoveSkill{ skillID = 170 } player:AddSkill{ skillID = 170 } player:CastSkill{ optionalTargetID = self, skillID = 170 } local plane = self:GetObjectsInGroup{ group = "Level" }.objects for i = 1, table.maxn (plane) do if plane[i]:GetLOT().objtemplate == 5850 then plane[i]:NotifyObject{ name="Lower" } end end end end function onClientUse(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) CAMERA:SetToPrevGameCam() player:RemoveSkill{ skillID = 170 } player:AddSkill{ skillID = 174 } player:CastSkill{ optionalTargetID = self, skillID = 174 } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') function onTimerDone(self, msg) if msg.name == "SpikeDeathTeleport" then getObjectByName(self,"Spiker"):SetPosition{pos = {x = -106.02,y = 189.99,z = -561.75}} getObjectByName(self,"Spiker"):SetUserCtrlCompPause{bPaused = false} end end function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then storeObjectByName(self, "Spiker", target) getObjectByName(self,"Spiker"):SetUserCtrlCompPause{bPaused = true} getObjectByName(self,"Spiker"):PlayAnimation{animationID = "shocked"} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "SpikeDeathTeleport",self ) end end --require('o_mis') function onClientUse(self) -- print "Return cam to normal" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) CAMERA:SetToPrevGameCam() player:RemoveSkill{ skillID = 170 } player:AddSkill{ skillID = 174 } player:CastSkill{ optionalTargetID = self, skillID = 174 } player:SetPosition {pos = {x=-186,y=184.28,z=-551}} player:SetRotation {x=0,y=-1,z=0,w=0} local plane = self:GetObjectsInGroup{ group = "Level" }.objects for i = 1, table.maxn (plane) do if plane[i]:GetLOT().objtemplate == 5850 then plane[i]:NotifyObject{ name="Raise" } end end end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end--require('o_mis') function onClientUse(self) -- print "Return cam to normal" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) CAMERA:SetToPrevGameCam() player:RemoveSkill{ skillID = 170 } player:AddSkill{ skillID = 174 } player:CastSkill{ optionalTargetID = self, skillID = 174 } player:SetPosition {pos = {x = -106.02,y = 189.99, z = -531}} local plane = self:GetObjectsInGroup{ group = "Level" }.objects for i = 1, table.maxn (plane) do if plane[i]:GetLOT().objtemplate == 5850 then plane[i]:NotifyObject{ name="Raise" } end end end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') function onTimerDone(self, msg) local vinepos = self:GetPosition{}.pos local vineleftx = vinepos.x - 9 local vinerightx = vinepos.x + 9 local viney = vinepos.y - 10 local vinez = vinepos.z + 3 local platformx = vinepos.x local platformy = vinepos.y + -11.545 local platformz = vinepos.z + 1.859 if msg.name == "Swing Left" then getObjectByName(self,"Tarzan"):SetPosition{pos = {x = vineleftx, y = viney, z = vinez}} getObjectByName(self,"Tarzan"):PlayAnimation{animationID = "swing-hack"} getObjectByName(self,"Tarzan"):SetUserCtrlCompPause{bPaused = false} end if msg.name == "Swing Right" then getObjectByName(self,"Tarzan"):SetPosition{pos = {x = vinerightx, y = viney, z = vinez}} getObjectByName(self,"Tarzan"):PlayAnimation{animationID = "swing-hack"} getObjectByName(self,"Tarzan"):SetUserCtrlCompPause{bPaused = false} end if msg.name == "Swing Teleport Left" then getObjectByName(self,"Tarzan"):SetUserCtrlCompPause{bPaused = true} -- getObjectByName(self,"Tarzan"):PlayAnimation{animationID = "swing-rt"} getObjectByName(self,"Tarzan"):SetPosition{pos = {x = platformx, y = platformy, z = platformz}} getObjectByName(self,"Tarzan"):SetRotation {x=0,y=-0.707,z=0,w=0.707} end if msg.name == "Tele Hack Left" then getObjectByName(self,"Tarzan"):PlayAnimation{animationID = "swing-lt"} self:PlayAnimation{animationID = "swing-lt"} end if msg.name == "Swing Teleport Right" then getObjectByName(self,"Tarzan"):SetUserCtrlCompPause{bPaused = true} -- getObjectByName(self,"Tarzan"):PlayAnimation{animationID = "swing-rt"} getObjectByName(self,"Tarzan"):SetPosition{pos = {x = platformx, y = platformy, z = platformz}} getObjectByName(self,"Tarzan"):SetRotation {x=0,y=0.707,z=0,w=0.707} end if msg.name == "Tele Hack Right" then getObjectByName(self,"Tarzan"):PlayAnimation{animationID = "swing-rt"} self:PlayAnimation{animationID = "swing-rt"} end if msg.name == "Unfreeze" then -- To hack the animation freezing problem when two animations are toggled too quickly self:PlayAnimation{animationID = "idle"} print "You can swing now" end end function onCollisionPhantom(self, msg) local vinepos = self:GetPosition{}.pos local target = msg.senderID local mypos = target:GetPosition().pos local vinepadx = vinepos.x local vinepady = vinepos.y local vinepadz = vinepos.z storeObjectByName(self, "Tarzan", target) if mypos.x > vinepos.x then --target:SetPosition {pos = {x = vinepadx, y = vinepady, z = vinepadz}} --target:SetUserCtrlCompPause{bPaused = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Swing Teleport Left",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.0, "Tele Hack Left",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "Swing Left",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 4.6, "Unfreeze",self ) elseif mypos.x < vinepos.x then --target:SetPosition {pos = vinepos} --target:SetUserCtrlCompPause{bPaused = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Swing Teleport Right",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.0, "Tele Hack Right",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "Swing Right",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 4.6, "Unfreeze",self ) end end require('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self) SetMouseOverDistance(self, 30) SetProximityDistance(self, 30) AddInteraction(self, "interactionAnim", "interact") end require('o_mis') function onClientUse(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "roadView" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') function onClientUse(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Angle2" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') function onClientUse(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Angle3" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endrequire('o_mis') function onClientUse(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "Angle4" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endfunction onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onStartup(self) self:AddObjectToGroup{ group = "MR_FinishLine" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onStartup(self,msg) self:AddObjectToGroup{ group = "MR_FinishLine" } end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:AddSkill{ skillID = 66 } player:CastSkill{ optionalTargetID = self, skillID = 66 } player:SetAnimationSet{strSet = "racecar"} player:PlayCinematic { pathName = "Camera_End" } CAMERA:SnapCameraToPlayer() end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endfunction onClientUse(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "RoadFreezeandOrient",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.9, "RoadSnap",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "RoadUnfreezeandCamera",self ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onTimerDone (self, msg) if (msg.name == "RoadFreezeandOrient") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} player:SetRotation {x=0,y=0,z=0,w=1} end if (msg.name == "RoadSnap") then CAMERA:SnapCameraToPlayer() end if (msg.name == "RoadUnfreezeandCamera") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayCinematic { pathName = "roadView" } player:SetUserCtrlCompPause{bPaused = false} end endfunction onGetPriorityPickListType(self, msg) msg.ePickType = 14 -- Interactive pick type return msg endfunction onStartup(self,msg) self:SetProximityRadius { radius = 20 } end function onProximityUpdate(self, msg) local target = msg.objId local faction = target:GetFaction() if faction and faction.faction == 1 then if msg.status == "ENTER" then self:PlayAnimation{ animationID = "cheer" } elseif msg.status == "LEAVE" then self:PlayAnimation{ animationID = "idle" } end end endfunction onStartup(self,msg) self:SetVar("horse", 0) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self,msg) local player = msg.user self:PlayAnimation{animationID = "down"} if self:GetVar("horse") == 0 then print "Horse time!" player:SetAnimationSet{strSet = "horse-mount", bPush=true} player:PlayAnimation{ animationID = "mount-horse-mount" } self:SetVar("horse", 1) else print "Back to normal." player:SetAnimationSet{strSet = "horse-mount", bPush=false} self:SetVar("horse", 0) end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 30) AddInteraction(self, "interactionText", Localize("NPC_GENERIC_CHECK_THIS_OUT!")) AddInteraction(self, "proximityText", Localize("NPC_NP_AMB_CLICK_ME_TO_SEE_SOME_JUGGLING!")) endrequire('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self,msg) self:SetVar("MGState", 1) self:SetProximityRadius { radius = 20 } end function onProximityUpdate(self, msg) local target = msg.objId local faction = target:GetFaction() if faction and faction.faction == 1 and self:GetVar("MGState") == 1 then if msg.status == "ENTER" then self:PlayAnimation{ animationID = "missionState1" } self:DisplayChatBubble {wsText = "I need your help!"} elseif msg.status == "LEAVE" then self:PlayAnimation{ animationID = "idle" } self:DisplayChatBubble {wsText = "I still need your help!"} end elseif faction and faction.faction == 1 and self:GetVar("MGState") == 2 then if msg.status == "ENTER" then self:PlayAnimation{ animationID = "missionState2" } self:DisplayChatBubble {wsText = "Why aren't you done yet?!"} elseif msg.status == "LEAVE" then self:PlayAnimation{ animationID = "idle" } self:DisplayChatBubble {wsText = "Get 'er done!"} end elseif faction and faction.faction == 1 and self:GetVar("MGState") == 3 then if msg.status == "ENTER" then self:PlayAnimation{ animationID = "missionState3" } self:DisplayChatBubble {wsText = "You did it!"} elseif msg.status == "LEAVE" then self:PlayAnimation{ animationID = "idle" } self:DisplayChatBubble {wsText = "You are awesome!"} end elseif faction and faction.faction == 1 and self:GetVar("MGState") == 4 then if msg.status == "ENTER" then self:PlayAnimation{ animationID = "missionState4" } self:DisplayChatBubble {wsText = "Thanks for the help!"} elseif msg.status == "LEAVE" then self:PlayAnimation{ animationID = "idle" } self:DisplayChatBubble {wsText = "Thanks again!"} end end end function onClientUse(self, msg) if self:GetVar("MGState") == 1 then self:PlayAnimation{ animationID = "missionState2" } self:DisplayChatBubble {wsText = "Why aren't you done yet?!"} self:SetVar("MGState", 2) elseif self:GetVar("MGState") == 2 then self:PlayAnimation{ animationID = "missionState3" } self:DisplayChatBubble {wsText = "You did it!"} self:SetVar("MGState", 3) elseif self:GetVar("MGState") == 3 then self:PlayAnimation{ animationID = "missionState4" } self:DisplayChatBubble {wsText = "Thanks for the help!"} self:SetVar("MGState", 4) elseif self:GetVar("MGState") == 4 then self:PlayAnimation{ animationID = "missionState1" } self:DisplayChatBubble {wsText = "I need your help!"} self:SetVar("MGState", 1) end endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) AddInteraction(self, "interactionAnim", "onclick") endfunction onNotifyClientObject(self, msg) if msg.name == "Lostya" then self:DisplayChatBubble {wsText = "Where are you?"} --print "Where are you client?!" end if msg.name == "Gotcha" then --print "I see you client!" self:DisplayChatBubble {wsText = "I see you!"} end endrequire('o_mis') require('client/ai/AG/L_AG_NPC') function onStartup(self,msg) self:SetVar("MGState", 1) self:SetVar("Sleeping", 1) self:SetProximityRadius { radius = 20 } end function onProximityUpdate(self, msg) local target = msg.objId local faction = target:GetFaction() if faction and faction.faction == 1 then if msg.status == "LEAVE" then if self:GetVar("Sleeping") == 0 then self:PlayAnimation{ animationID = "sleep" } self:SetVar("Sleeping", 2) self:DisplayChatBubble {wsText = "I'm going back to bed."} GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) end end end end function onClientUse(self, msg) if self:GetVar("MGState") == 1 then if self:GetVar("Sleeping") == 1 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "wake" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "WakeState1",self ) self:DisplayChatBubble {wsText = "Huh?"} elseif self:GetVar("Sleeping") == 0 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "sleep" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) self:DisplayChatBubble {wsText = "Go do that thing I asked you to do."} self:SetVar("MGState", 2) end elseif self:GetVar("MGState") == 2 then if self:GetVar("Sleeping") == 1 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "wake" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "WakeState2",self ) self:DisplayChatBubble {wsText = "Wuh?"} elseif self:GetVar("Sleeping") == 0 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "sleep" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) self:DisplayChatBubble {wsText = "Come back when you're ready."} self:SetVar("MGState", 3) elseif self:GetVar("Sleeping") == 2 then self:SetVar("MGState", 3) end elseif self:GetVar("MGState") == 3 then if self:GetVar("Sleeping") == 1 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "wake" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "WakeState3",self ) self:DisplayChatBubble {wsText = "Derp?"} elseif self:GetVar("Sleeping") == 0 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "sleep" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) self:DisplayChatBubble {wsText = "Thanks again!"} self:SetVar("MGState", 4) elseif self:GetVar("Sleeping") == 2 then self:SetVar("MGState", 4) end elseif self:GetVar("MGState") == 4 then if self:GetVar("Sleeping") == 1 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "wake" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "WakeState4",self ) self:DisplayChatBubble {wsText = "Bwah?"} elseif self:GetVar("Sleeping") == 0 then self:SetVar("Sleeping", 2) self:PlayAnimation{ animationID = "sleep" } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) self:DisplayChatBubble {wsText = "Thanks again!"} self:SetVar("MGState", 1) elseif self:GetVar("Sleeping") == 2 then self:SetVar("MGState", 1) end end end function onTimerDone(self, msg) if msg.name == "WakeState1" then local objs = self:GetProximityObjects().objects if table.getn(objs) >= 2 then self:PlayAnimation{ animationID = "missionState1" } self:DisplayChatBubble {wsText = "I need your help!"} self:SetVar("Sleeping", 0) elseif table.getn(objs) == 1 then self:PlayAnimation{ animationID = "sleep" } self:DisplayChatBubble {wsText = "I'm going back to bed."} GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) end elseif msg.name == "WakeState2" then local objs = self:GetProximityObjects().objects if table.getn(objs) >= 2 then self:PlayAnimation{ animationID = "missionState2" } self:DisplayChatBubble {wsText = "Why aren't you done yet?!"} self:SetVar("Sleeping", 0) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.3, "GoBackToSleep",self ) elseif table.getn(objs) == 1 then self:PlayAnimation{ animationID = "sleep" } self:DisplayChatBubble {wsText = "I'm going back to bed."} GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) end elseif msg.name == "WakeState3" then local objs = self:GetProximityObjects().objects if table.getn(objs) >= 2 then self:PlayAnimation{ animationID = "missionState3" } self:DisplayChatBubble {wsText = "You did it!"} self:SetVar("Sleeping", 0) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.3, "GoBackToSleep",self ) elseif table.getn(objs) == 1 then self:PlayAnimation{ animationID = "sleep" } self:DisplayChatBubble {wsText = "I'm going back to bed."} GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) end elseif msg.name == "WakeState4" then local objs = self:GetProximityObjects().objects if table.getn(objs) >= 2 then self:PlayAnimation{ animationID = "missionState4" } self:DisplayChatBubble {wsText = "Thanks for the help!"} self:SetVar("Sleeping", 0) GAMEOBJ:GetTimer():AddTimerWithCancel( 7.6, "GoBackToSleep",self ) elseif table.getn(objs) == 1 then self:PlayAnimation{ animationID = "sleep" } self:DisplayChatBubble {wsText = "I'm going back to bed."} GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) end elseif msg.name == "RestoreSleep" then self:SetVar("Sleeping", 1) elseif msg.name == "GoBackToSleep" then self:PlayAnimation{ animationID = "sleep" } self:DisplayChatBubble {wsText = "I'm going back to bed."} GAMEOBJ:GetTimer():AddTimerWithCancel( 7.5, "RestoreSleep",self ) end end function onStartup(self,msg) self:SetVar("organuse", 0) end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self,msg) local player = msg.user self:PlayAnimation{animationID = "down"} if self:GetVar("organuse") == 0 then print "Organ Time!" player:SetAnimationSet{strSet = "horse-mount", bPush=true} player:PlayCinematic { pathName = "OrganCam" } player:SetPosition{pos = {x = 635.356, y = 200, z = -142.295}} player:SetRotation{x=0, y=1, z=0, w=0} self:SetVar("organuse", 1) else print "Back to normal." player:SetAnimationSet{strSet = "", bPush=false} player:PlayCinematic { pathName = "CancelCam" } self:SetVar("organuse", 0) end end require('o_mis') function onStartup(self) -- Resetting picktype self:SetVar("organuseclient", 0) self:RequestPickTypeUpdate() -- REMOVED FOR NOW - Make sure organ is playing its idle animation -- REMOVED FOR NOW - self:PlayAnimation{ animationID = "key-up" } end function onGetPriorityPickListType(self, msg) if self:GetVar("organuseclient") == 1 then msg.ePickType = -1 -- Non-Interactive pick type return msg else msg.ePickType = 14 -- Interactive pick type return msg end end function onNotifyClientObject(self, msg) if msg.name == "organstart" then -- Make the client unclickable for everyone else that tries to use it self:SetVar("organuseclient", 1) self:RequestPickTypeUpdate() end end function UpdateBeingPlayed( self ) local player = getObjectByName(self,"OrganUserOnClient") local Imagination = player:GetImagination{}.imagination -- Check whether the player as run out of imagination if Imagination > 0 then bMovement = DidPlayerHitMovementKey(self) if bMovement == true then -- If the player hit a movement key, then send a server side message to kick them off the organ self:FireEventServerSide{senderID = self, args = "PlayerMoved"} else -- If the player hasn't moved, set a new timer to check again GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "CheckOnPlayer", self ) end end end function TrackRecentMovementKeys( self, bTrack ) -- Actual tracking of key presses local player = getObjectByName(self,"OrganUserOnClient") player:TrackRecentMovementKeys{ bTrackForward = bTrack, bTrackReverse = bTrack, bTrackLeft= bTrack, bTrackRight = bTrack, bTrackJump = bTrack } end function DidPlayerHitMovementKey( self ) -- Return some value if key was pressed local player = getObjectByName(self,"OrganUserOnClient") local keysMsg = player:GetRecentMovementKeys{} return ( keysMsg.bForwardPressed or keysMsg.bReversePressed or keysMsg.bLeftPressed or keysMsg.bRightPressed or keysMsg.bJumpPressed ) end function onTimerDone(self, msg) if ( msg.name == "CheckOnPlayer" ) then -- Keep checking to see if player moved UpdateBeingPlayed( self ) end end function onEnableActivity(self, msg) if (msg.bEnable == true) then local player = GAMEOBJ:GetControlledID() --Relative position/rotation data local oPos = { pos = "", rot = ""} local oDir = self:GetObjectDirectionVectors() oPos.pos = self:GetPosition().pos oPos.rot = self:GetRotation() -- Storing vectors for player oPos.pos.x = oPos.pos.x + (oDir.forward.x * 2.107) oPos.pos.z = oPos.pos.z + (oDir.forward.z * 2.107) print "Activity Enabled" -- Toggle variable for picktype self:SetVar("organuseclient", 1) -- Store the player name storeObjectByName(self, "OrganUserOnClient", player) -- Stun the Player since camera changes forbid interactions player:SetStunned{StateChangeType = "PUSH", bCantMove = true, bCantAttack = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} -- Make player transparent getObjectByName(self,"OrganUserOnClient"):StopFXEffect{name = "untransparent"} player:PlayFXEffect{name = "transparent", effectID = 2754, effectType = "trans"} -- REMOVED FOR NOW - Make the organ drop obstructing geometry for the camera angle and server-side fake keys -- REMOVED FOR NOW - self:PlayAnimation{animationID = "key-down"} -- REMOVED FOR NOW - Play the organ camera angle for awesomeness -- REMOVED FOR NOW - player:PlayCinematic{pathName = "OrganCam"} -- Place the player on the organ bench player:SetPosition{pos = {x = oPos.pos.x, y = oPos.pos.y, z = oPos.pos.z}} player:SetRotation{x=oPos.rot.x, y=oPos.rot.y, z=oPos.rot.z, w=oPos.rot.w} -- Start the organ animation idle set player:ChangeIdleFlags{on = 13} -- Turn off the icon above the organ during play self:SetIconAboveHead{bIconOff = true, iconMode = 1, iconType = 69} -- Change the picktype to make self:RequestPickTypeUpdate() -- Flip the player 180 local newRot = self:GetPosition{}.pos newRot.x = 0.0 newRot.y = 3.1416 newRot.z = 0.0 player:RotateObject{rotation = newRot} -- Start the move-check timer and key tracking GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "CheckOnPlayer", self ) TrackRecentMovementKeys(self, true) else print "Disabling activity" -- REMOVED FOR NOW - Restore the organ visuals on client -- REMOVED FOR NOW - self:PlayAnimation{ animationID = "key-up" } -- Turn the icon back on self:SetIconAboveHead{iconMode = 1, iconType = 69, bIconOff = false} -- Unstun player getObjectByName(self,"OrganUserOnClient"):SetStunned{StateChangeType = "POP", bCantMove = true, bCantAttack = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} --Make player untransparent getObjectByName(self,"OrganUserOnClient"):StopFXEffect{name = "transparent"} getObjectByName(self,"OrganUserOnClient"):PlayFXEffect{name = "untransparent", effectID = 2754, effectType = "untrans"} -- REMOVED FOR NOW - Cancel camera -- REMOVED FOR NOW - getObjectByName(self,"OrganUserOnClient"):EndCinematic{ leadOut = 1.0 } --Restore animation set to normal getObjectByName(self,"OrganUserOnClient"):ChangeIdleFlags{off = 13} -- Stop tracking keypresses TrackRecentMovementKeys( self, false ) -- Purge player from memory self:SetVar("OrganUserOnClient", nil) -- Make organ clickable again self:SetVar("organuseclient", 0) self:RequestPickTypeUpdate() end endfunction onStartup(self) self:SetVar("keyuseclient", 1) self:RequestPickTypeUpdate() end function onGetPriorityPickListType(self, msg) if self:GetVar("keyuseclient") == 1 then msg.ePickType = -1 -- Non-Interactive pick type return msg else msg.ePickType = 14 -- Interactive pick type return msg end end function onNotifyClientObject(self, msg) if msg.name == "Click" then self:SetVar("keyuseclient", 0) self:RequestPickTypeUpdate() elseif msg.name == "NoClick" then self:SetVar("keyuseclient", 1) self:RequestPickTypeUpdate() end endrequire('o_mis') local bCINEMA_ONCE = false function onStartup(self, msg) print "preloading" local Frisbeed = self:GetObjectsInGroup{ group = "Frisbee"}.objects for i = 1, table.maxn (Frisbeed) do if Frisbeed[i]:GetLOT().objtemplate == 7711 then Frisbeed[i]:PreloadAnimation{animationID = "launch", respondObjID = self} end end end function onClientUse(self, msg) print "Use" local player = msg.user player:PlayCinematic { pathName = "LandingCine_0" } local Frisbeed = self:GetObjectsInGroup{ group = "Frisbee"}.objects for i = 1, table.maxn (Frisbeed) do if Frisbeed[i]:GetLOT().objtemplate == 7711 then Frisbeed[i]:PlayAnimation{animationID = "launch"} Frisbeed[i]:SetOffscreenAnimation{bAnimateOffscreen = true} end end end function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg endfunction onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() if faction and faction.faction == 1 then local elast = 2.0 local maxSpeed = 300.0 local vec = self:GetUpVector().niUpVector local vel = self:GetLinearVelocity().linVelocity local playerVel = target:GetLinearVelocity().linVelocity target:Deflect{direction = vec, velocity = vel, elasticity = elast, maxSpeed = maximumSpeed, playerVelocity = playerVel} end return msg end -------------------------------------------------------------- -- Client script for air stink. Handles its effect -- based on the state of the zone -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- for testing state switch only --CONSTANTS["TEST_TIME"] = 10 -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- perform actions based on zone state if (prevState and prevState ~= state) then if ( state == CONSTANTS["ZONE_STATE_NO_INVASION"] or state == CONSTANTS["ZONE_STATE_TRANSITION"] ) then RemoveEffect(self) else EnableEffect(self, "add") end end end -------------------------------------------------------------- -- does the effect exist -------------------------------------------------------------- function EffectExists(effect) return (effect and tostring(effect) ~= tostring(CONSTANTS["NO_OBJECT"])) end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect(self, name) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("currentEffect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = "stink", effectType = name } -- save the effect self:SetVar( "currentEffect", true ) end -------------------------------------------------------------- -- Removes the effect -------------------------------------------------------------- function RemoveEffect(self) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("currentEffect") -- remove the effect if ( EffectExists(myEffect) ) then self:StopFXEffect{ name = "stink" } self:SetVar("currentEffect", false ) end end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="ZoneStateClientObjectReady" } -- instantly hide the render object, we only care to see the effect self:SetVisible{visible = false, fadeTime = 0.0} -- TEST ONLY -- --GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["TEST_TIME"], "testNoInvasion", self ) end -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetVar("currentEffect", CONSTANTS["NO_OBJECT"]) -- set state to No Info, waiting for state information SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INFO"]) end -------------------------------------------------------------- -- Called when object gets a notification -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetZoneState(self, msg.param1) end end --[[ -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone(self, msg) print ("Timer name: "..msg.name) local time = CONSTANTS["TEST_TIME"] if ( msg.name == "testNoInvasion" ) then SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INVASION"]) GAMEOBJ:GetTimer():AddTimerWithCancel(time, "testTransition", self ) elseif ( msg.name == "testTransition" ) then SetZoneState(self, CONSTANTS["ZONE_STATE_TRANSITION"]) GAMEOBJ:GetTimer():AddTimerWithCancel(time, "testHigh", self ) elseif ( msg.name == "testHigh" ) then SetZoneState(self, CONSTANTS["ZONE_STATE_HIGH_ALERT"]) GAMEOBJ:GetTimer():AddTimerWithCancel(time, "testMedium", self ) elseif ( msg.name == "testMedium" ) then SetZoneState(self, CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) GAMEOBJ:GetTimer():AddTimerWithCancel(time, "testLow", self ) elseif ( msg.name == "testLow" ) then SetZoneState(self, CONSTANTS["ZONE_STATE_LOW_ALERT"]) GAMEOBJ:GetTimer():AddTimerWithCancel(time, "testDone", self ) elseif ( msg.name == "testDone" ) then SetZoneState(self, CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) GAMEOBJ:GetTimer():AddTimerWithCancel(time, "testNoInvasion", self ) end end ]]-- -------------------------------------------------------------- -- On startup -------------------------------------------------------------- function onStartup( self ) self:SetVar( "bRenderReady", false ) self:PlayAnimation{ animationID = "balloon1" } end -------------------------------------------------------------- -- got a msg from the server-side script just for this client -------------------------------------------------------------- function onNotifyClientRebuildSectionState( self, msg ) -- the server-side zone script got onPlayerLoaded -- it passed that info to the balloon's server-side script -- which then called this on the newly-loaded player's client -- use the appropriate balloon anim based on how inflated it currently is -- (Note: this has nothing to do with rebuilds. -- We're just using this msg because it can send a msg to one particular client. ) UpdateAnimation( self, msg.iState ) end -------------------------------------------------------------- -- change the animantion to reflect how much stink is currently feeding into it -------------------------------------------------------------- function UpdateAnimation( self, stinkAmount ) if ( self:GetVar( "bRenderReady" ) == false ) then return end if ( stinkAmount == 0 ) then self:PlayAnimation{ animationID = "balloon1" } elseif ( stinkAmount == 1 ) then self:PlayAnimation{ animationID = "balloon2" } elseif ( stinkAmount == CONSTANTS["SUFFICIENT_STINK"] ) then self:PlayAnimation{ animationID = "balloon3" } end end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar( "bRenderReady", true ) end -------------------------------------------------------------- -- Client script for bubble blower. Handles their effect -- based on the state of the zone -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- perform actions based on zone state if (prevState and prevState ~= state) then if (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then -- if no invasion play the peace effect RemoveEffect(self) RemoveEffect2(self) EnableEffect(self, "statue_idle") EnableEffect2(self, "statue_idle2") -- play animation SetAnimation(self, "idle_light") elseif (state == CONSTANTS["ZONE_STATE_TRANSITION"]) then -- disable the effect in this state RemoveEffect(self) RemoveEffect2(self) -- show a one time only effect and delay the looping effect self:PlayFXEffect{ effectType = "statue_to_bubble" } SetAnimation(self, "light_to_alarm") GAMEOBJ:GetTimer():AddTimerWithCancel(3.5 , "DelayedIdleEffect", self ) elseif (state == CONSTANTS["ZONE_STATE_HIGH_ALERT"]) then -- disable the effect in this state RemoveEffect(self) RemoveEffect2(self) EnableEffect(self, "bubble_idle") -- play animation SetAnimation(self, "idle_alarm") elseif (state == CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) then -- disable the effect in this state RemoveEffect(self) RemoveEffect2(self) EnableEffect(self, "bubble_idle") -- play animation SetAnimation(self, "idle_alarm") elseif (state == CONSTANTS["ZONE_STATE_LOW_ALERT"]) then -- disable the effect in this state RemoveEffect(self) RemoveEffect2(self) EnableEffect(self, "bubble_idle") -- play animation SetAnimation(self, "idle_alarm") elseif (state == CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) then -- if no invasion play the peace effect RemoveEffect(self) RemoveEffect2(self) -- play animation SetAnimation(self, "alarm_to_light") end end end -------------------------------------------------------------- -- Plays and sets the animation -------------------------------------------------------------- function SetAnimation(self, name) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- play animation self:PlayAnimation{animationID = name} end -------------------------------------------------------------- -- does the effect exist -------------------------------------------------------------- function EffectExists(effect) return (effect and tostring(effect) ~= tostring(CONSTANTS["NO_OBJECT"])) end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect(self, name) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("currentEffect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = "bubble1", effectType = name } -- save the effect self:SetVar("currentEffect", true) end -------------------------------------------------------------- -- Removes an effect on the spout -------------------------------------------------------------- function RemoveEffect(self) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("currentEffect") -- remove the effect if ( myEffect ) then self:StopFXEffect{ name = "bubble1" } self:SetVar("currentEffect", false) end end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect2(self, name) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("currentEffect2") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = "bubble2", effectType = name } -- save the effect self:SetVar("currentEffect2", true) end -------------------------------------------------------------- -- Removes an effect on the spout -------------------------------------------------------------- function RemoveEffect2(self) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("currentEffect2") -- remove the effect if ( myEffect ) then self:StopFXEffect{ name = "bubble2" } self:SetVar("currentEffect2", false) end end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="ZoneStateClientObjectReady" } end -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetVar("currentEffect", CONSTANTS["NO_OBJECT"]) self:SetVar("currentEffect2", CONSTANTS["NO_OBJECT"]) -- set state to No Info, waiting for state information SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INFO"]) end -------------------------------------------------------------- -- Called when object gets a notification -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetZoneState(self, msg.param1) end end -------------------------------------------------------------- -- called when timer complete -------------------------------------------------------------- function onTimerDone(self, msg) -- play an animation if (msg.name == "DelayedIdleEffect") then RemoveEffect(self) RemoveEffect2(self) EnableEffect(self, "bubble_idle") end end require('o_mis') -- All the lot nums for the maze LOT_NUMS = {} LOT_NUMS[1] = { 3712, 3713, 3714, 3712 } --3712 chicken 3713 skunk 3714 sheep function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) -- Send every LOT number that isn't us local ournum = 1; -- Store all the lots nums that arent us -- TODO This should be in a table so that it would be dynamic, but not sure how to store one with SetVar yet local slot = self:GetVar("ourslot") for i = 1, #LOT_NUMS[slot] do --if(self:GetVar("ourlotnum") ~= LOT_NUMS[slot][i] or ournum == 3 and i == 4) then if(ournum == 1) then self:SetVar("lot1", LOT_NUMS[slot][i]) elseif(ournum == 2) then self:SetVar("lot2", LOT_NUMS[slot][i]) elseif(ournum == 3) then self:SetVar("lot3", LOT_NUMS[slot][i]) end ournum = ournum + 1 --local nextLot = #OUR_LOTNUMS + 1 --OUR_LOTNUMS[nextLot] = LOT_NUMS[i] --end end --print("TRIPLE: " .. self:GetVar("lot1") .." " .. self:GetVar("lot2") .. " " .. self:GetVar("lot3")) UI:DisplayTripleBuild( self, true, { self:GetVar("lot1"), self:GetVar("lot2"), self:GetVar("lot3") } ) --print("TRIPLE: " .. OUR_LOTNUMS[1] .." " .. OUR_LOTNUMS[2] .. " " .. OUR_LOTNUMS[3]) --UI:DisplayTripleBuild( self, true, { OUR_LOTNUMS[1], OUR_LOTNUMS[2], OUR_LOTNUMS[3] } ) end function onStartup(self) -- Save our LOT number self:SetVar("ourlotnum", self:GetLOT{}.objtemplate) for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(self:GetVar("ourlotnum") == LOT_NUMS[i][a]) then self:SetVar("ourslot", i) return end end end endfunction onScriptNetworkVarUpdate(self,msg) if ( self:GetNetworkVar( 'blooming' ) == true ) then self:BlendPrimaryAnimation{animationID = "bloom"} GAMEOBJ:GetTimer():AddTimerWithCancel( 10 , "Wilt", self ) end end function onTimerDone (self, msg) if msg.name == "Wilt" then self:BlendPrimaryAnimation{animationID = "idle"} end end-------------------------------------------------------------- -- Client script for fountain. Handles their effect -- based on the state of the zone -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- perform actions based on zone state if (prevState and prevState ~= state) then if (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then -- if no invasion play the peace effect RemoveEffect(self, 1) RemoveEffect(self, 2) RemoveEffect(self, 3) RemoveEffect(self, 4) EnableEffect(self, 1, "peaceTime1") EnableEffect(self, 2, "peaceTime2") EnableEffect(self, 3, "peaceTime3") EnableEffect(self, 4, "peaceTime4") -- play animation SetAnimation(self, "normal") elseif (state == CONSTANTS["ZONE_STATE_TRANSITION"]) then -- disable the effect in this state RemoveEffect(self, 1) RemoveEffect(self, 2) RemoveEffect(self, 3) RemoveEffect(self, 4) -- play animation with optional delay SetAnimation(self, "alertUp") elseif (state == CONSTANTS["ZONE_STATE_HIGH_ALERT"]) then -- disable the effect in this state RemoveEffect(self, 1) RemoveEffect(self, 2) RemoveEffect(self, 3) RemoveEffect(self, 4) EnableEffect(self, 1, "alarmTime") -- play animation SetAnimation(self, "normal_up") elseif (state == CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) then -- disable the effect in this state RemoveEffect(self, 1) RemoveEffect(self, 2) RemoveEffect(self, 3) RemoveEffect(self, 4) EnableEffect(self, 1, "alarmTime") -- play animation SetAnimation(self, "normal_up") elseif (state == CONSTANTS["ZONE_STATE_LOW_ALERT"]) then -- disable the effect in this state RemoveEffect(self, 1) RemoveEffect(self, 2) RemoveEffect(self, 3) RemoveEffect(self, 4) EnableEffect(self, 1, "alarmTime") -- play animation SetAnimation(self, "normal_up") elseif (state == CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) then -- if no invasion play the peace effect RemoveEffect(self, 1) RemoveEffect(self, 2) RemoveEffect(self, 3) RemoveEffect(self, 4) -- play animation SetAnimation(self, "alertDown") end end end -------------------------------------------------------------- -- Plays and sets the animation -------------------------------------------------------------- function SetAnimation(self, name) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- play animation self:PlayAnimation{animationID = name} end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect(self, num, action) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("currentEffect" .. num) if ( myEffect == true ) then print("fountain on already") return end -- make a new effect self:PlayFXEffect{ name = "fountain" .. num, effectType = action } -- save the effect self:SetVar( "currentEffect" .. num, true ) end -------------------------------------------------------------- -- Removes an effect on the spout -------------------------------------------------------------- function RemoveEffect(self, num) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("currentEffect" .. num) -- remove the effect if ( myEffect ) then self:StopFXEffect{ name = "fountain" .. num } self:SetVar("currentEffect" .. num , false) end end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="ZoneStateClientObjectReady" } end -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetVar("currentEffect1", CONSTANTS["NO_OBJECT"]) self:SetVar("currentEffect2", CONSTANTS["NO_OBJECT"]) self:SetVar("currentEffect3", CONSTANTS["NO_OBJECT"]) self:SetVar("currentEffect4", CONSTANTS["NO_OBJECT"]) -- set state to No Info, waiting for state information SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INFO"]) end -------------------------------------------------------------- -- Called when object gets a notification -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetZoneState(self, msg.param1) end end require('client/ai/L_BOUNCER_BASIC') --client-side bouncer script function onStartup(self) end function onBouncerTriggered(self, msg) --Hackish fix for the 'bounce collision' --print ( "------------------------------------" ) --print ( "hazmat bouncer -clientside- onBouncerTriggered" ) --print ( "------------------------------------" ) local player = msg.triggerObj local objPos = player:GetPosition().pos objPos.y = objPos.y + 1 player:SetPosition{pos = objPos} bounceObj(self, msg.triggerObj) end -------------------------------------------------------------- -- Client script for the hazmat truck. Handles its effects -- based on the state of the zone -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- the name of each particle effect CONSTANTS["FRONT_EFFECT_NAME"] = "frontLights" CONSTANTS["LEFT_EFFECT_NAME"] = "leftLights" CONSTANTS["RIGHT_EFFECT_NAME"] = "rightLights" -- for testing state switch only --CONSTANTS["TEST_TIME"] = 10 -------------------------------------------------------------- -- Returns true if the object is in the idle rebuild state -------------------------------------------------------------- function IsActive(self) -- get the rebuild state local rebuildState = self:GetRebuildState() -- if the state is idle we are active if (rebuildState and tonumber(rebuildState.iState) == 3) then return true else return false end end -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetVar(CONSTANTS["FRONT_EFFECT_NAME"] .. "Effect", CONSTANTS["NO_OBJECT"]) self:SetVar(CONSTANTS["LEFT_EFFECT_NAME"] .. "Effect", CONSTANTS["NO_OBJECT"]) self:SetVar(CONSTANTS["RIGHT_EFFECT_NAME"] .. "Effect", CONSTANTS["NO_OBJECT"]) -- set state to No Info, waiting for state information SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INFO"]) end -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- perform actions based on zone state if (prevState and prevState ~= state) then if (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then -- if no invasion, then there should be no effects on the truck RemoveParticleEffects(self) else -- the skunk invasion is happening. -- add effects to the truck, if they aren't there already EnableParticleEffects(self) end end end -------------------------------------------------------------- -- does the effect exist -------------------------------------------------------------- function EffectExists(effect) return (effect and tostring(effect) ~= tostring(CONSTANTS["NO_OBJECT"])) end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="ZoneStateClientObjectReady" } if (IsActive(self) == true or self:GetLOT().objtemplate == CONSTANTS["HAZMAT_VAN_LOT"]) then -- and set the animation set to the right state self:SetAnimationSet{strSet = ""} else -- show this as broken if it is supposed to be self:SetAnimationSet{strSet = "broken"} end -- TEST ONLY -- --GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["TEST_TIME"], "testNoInvasion", self ) end -------------------------------------------------------------- -- Called when object gets a notification -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetZoneState(self, msg.param1) end end -------------------------------------------------------------- -- enables all the particle effects for the truck lights -------------------------------------------------------------- function EnableParticleEffects(self) EnableEffect(self, CONSTANTS["FRONT_EFFECT_NAME"]) EnableEffect(self, CONSTANTS["LEFT_EFFECT_NAME"]) EnableEffect(self, CONSTANTS["RIGHT_EFFECT_NAME"]) end -------------------------------------------------------------- -- Enables an effect on the truck by name unless one is already present -------------------------------------------------------------- function EnableEffect(self, action) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar(action .. "Effect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = action .. "Effect", effectType = action } -- save the effect self:SetVar( action .. "Effect", true ) end -------------------------------------------------------------- -- Removes all effect on the truck -------------------------------------------------------------- function RemoveParticleEffects(self) RemoveEffect(self, CONSTANTS["FRONT_EFFECT_NAME"]) RemoveEffect(self, CONSTANTS["LEFT_EFFECT_NAME"]) RemoveEffect(self, CONSTANTS["RIGHT_EFFECT_NAME"]) end -------------------------------------------------------------- -- Removes a particle effect from the truck -------------------------------------------------------------- function RemoveEffect(self, action) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar(action .. "Effect") -- remove the effect if ( myEffect ) then self:StopFXEffect{ name = action .. "Effect" } self:SetVar( action .. "Effect", false) end end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then -- change animations to non-broken self:SetAnimationSet{strSet = ""} else -- set animations to broken self:SetAnimationSet{strSet = "broken"} end end require('o_mis') require('client/ai/YRK/L_YRK_NPC_INTERACTIONS') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 35) SetProximityDistance(self, 35) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_THIS_IS_MY_FIRST_DAY")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_DO_YOU_KNOW_HOW_TO_WORK_THIS_THING")) ActivateInteractions( self ) -- let the mini-map know that there are missions related to this guy self:AddObjectToGroup{ group = "Minimap_MissionGivers" } end function onRenderComponentReady( self, msg ) -- we don't want to see it in its starting position, so pause briefly before displaying self:SetObjectRender{ isRendering = false } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "renderTimer", self ) end -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "renderTimer") then self:SetObjectRender{ isRendering = true } end end function onCursorOn(self, msg) -- which cursor to use depends on whether the player has a hazmat guy mission if ( UseMissionCursor( self ) == true ) then self:SetPickType{ePickType = 4} -- PICK_LIST_MISSION_NPC else self:SetPickType{ePickType = 14} -- PICK_LIST_INTERACTIVE end end function UseMissionCursor( self ) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( player == nil or player == 0 ) then return false end local myMissionState1 = player:GetMissionState{ missionID = 171 }.missionState -- inventor's mission to talk to trainee local myMissionState2 = player:GetMissionState{ missionID = 141 }.missionState -- trainees' mission to repair truck local myMissionState3 = player:GetMissionState{ missionID = 123 }.missionState -- trainees' mission to talk to skunk buster boss again -- if any of the 3 missions is either available or active, then use the mission cursor if ( IsAcceptableMissionState( myMissionState1 ) or IsAcceptableMissionState( myMissionState2 ) or IsAcceptableMissionState( myMissionState3 ) ) then return true end return false end function IsAcceptableMissionState ( state ) -- returns whether the given mission state should have a mission cursor if ( state == 1 or state == 9 or -- LWO_MISSION_STATE_STATE_AVAILABLE state == 2 or state == 10 or -- LWO_MISSION_STATE_STATE_ACTIVE state == 4 ) then -- LWO_MISSION_STATE_READY_TO_COMPLETE return true end return false end -------------------------------------------------------------- -- client side script bounces the player and tells the hydrant to clean off their skunk stink -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/ai/L_BOUNCER_BASIC') require('o_mis') -------------------------------------------------------------- -- on collision functions -------------------------------------------------------------- function onCollisionPhantom(self, msg) bounceNow( self, msg.objectID ) return msg end -------------------------------------------------------------- -- bounces the player and tells the hydrant to clean off their skunk stink -------------------------------------------------------------- function bounceNow( self, target ) bounceObj(self, target) --local hydrant = getParent(self) local hydrant = self:GetParentObj().objIDParent if ( hydrant == nil ) then return end -- ask the hydrant to check if the player has skunk stink, and if so, wash them off hydrant:NotifyObject{ ObjIDSender = target, name = "cleanPlayer" } end -------------------------------------------------------------- -- includes -------------------------------------------------------------- require('client/ai/L_BOUNCER_BASIC') -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) self:SetVar( "bGotConfig", false) end -------------------------------------------------------------- -- on collision functions -------------------------------------------------------------- function onCollisionPhantom(self, msg) bounceNow( self, msg.objectID ) return msg end -------------------------------------------------------------- -- bounces the player and tells the hydrant to clean off their skunk stink -------------------------------------------------------------- function bounceNow( self, target ) if ( self:GetVar( "bGotConfig" ) == false ) then return end --print( "client-side bounceNow" ) bounceObj( self, target ) NotifyBrokenHydrant( self, target ) end -------------------------------------------------------------- -- tell the broken hydrant to clean off the player and to revert to the regular hydrant since the bouncer has been used -------------------------------------------------------------- function NotifyBrokenHydrant( self, target ) local hydrant = self:GetParentObj().objIDParent if( hydrant ~= nil and hydrant:Exists() ) then --print( "bouncer's parent exists" ) -- ask the hydrant to check if the player has skunk stink, and if so, wash them off -- and to revert to a regular hydrant hydrant:NotifyObject{ ObjIDSender = target, name = "cleanPlayer" } end end -------------------------------------------------------------- -- got the bouncer config info from server-side -------------------------------------------------------------- function onPlayAnimation( self, msg ) -- using this message just as a way to get a float and a string from server-side -- to get the bouncer config data -- ( tried using onScriptNetworkVarUpdate but if 2 clients are running, only 1 of them receives that message ) if ( self:GetVar( 'bGotConfig' ) == true ) then return end self:SetVar( "bouncer_speed", msg.fPriority ) self:SetVar( "bouncer_destination", msg.animationID ) --print( "client-side bouncer got config data" ) --print( self:GetVar( "bouncer_speed" ) ) --print( self:GetVar( "bouncer_destination" ) ) self:SetVar( "bGotConfig", true) end -------------------------------------------------------------- -- Includes require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS["HYDRANT_BOUNCER_LOT"] = 4008 -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) self:SetVar("bRenderReady", false) self:SetVar("waterEffect", CONSTANTS["NO_OBJECT"]) end -------------------------------------------------------------- -- Handled when rendering is ready -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) AddWaterEffect( self ) end -------------------------------------------------------------- -- add the water particle effect -------------------------------------------------------------- function AddWaterEffect( self ) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("waterEffect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = "water", effectID = 384, effectType = "water" } -- save the effect self:SetVar( "waterEffect", true ) end function onNotifyObject( self, msg ) if ( msg.name == "cleanPlayer" ) then --print( "client-side broken hydrant got msg from bouncer to clean player" ) self:FireEventServerSide{ senderID = msg.ObjIDSender, args = "cleanPlayer" } end end -------------------------------------------------------------- -- called when a child object is loaded up, in this case, the bouncer -------------------------------------------------------------- function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["HYDRANT_BOUNCER_LOT"] ) then --print( "bouncer loaded client-side" ) storeParent( self, msg.childID ) end end require('o_mis') require('client/ai/L_BOUNCER_BASIC') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" CONSTANTS["BOUNCER_LOT"] = 3736 CONSTANTS["HF_NODE_BOUNCER"] = 7 CONSTANTS["HF_SUB_ITEM_SEP_STRING"] = "\x1F" CONSTANTS["SPOUT_BOUNCER_SPEED"] = 700.0 CONSTANTS["SPOUT_BOUNCER_DEST"] = {x = 150.2, y = 316.47, z = -253.5} function onStartup( self ) --print( "HYDRANT: onStartup" ) --self:AddSkill{ skillID = CONSTANTS["DESTINK_SKILL_ID"] } self:SetVar( "waterEffect", "" ) self:SetProximityRadius { radius = 10 } self:SetVar( "broken", false ) end function onGetOverridePickType(self, msg) msg.ePickType = 14 --interactive return msg end function BreakHydrant( self ) --print( "HYDRANT: break_hydrant" ) self:FireEventServerSide{ senderID = self, args = "breakHydrant" } AddWaterEffect( self ) SpawnBouncer( self ) end function RepairHydrant( self ) --print( "HYDRANT: repair_hydrant" ) self:FireEventServerSide{ senderID = self, args = "repairHydrant" } RemoveBouncer( self ) CancelWaterEffect( self ) end function AddWaterEffect( self ) -- if this hydrant already has the water effect, don't add another one if ( self:GetVar( "waterEffect" ) == true ) then return end self:PlayFXEffect{ name = "water", effectID = 384, effectType = "water" } self:SetVar( "waterEffect", true ) end function CancelWaterEffect( self ) local myEffect = self:GetVar("waterEffect") if ( myEffect ) then self:StopFXEffect{ name = "water" } end self:SetVar( "waterEffect", false ) end function SpawnBouncer( self ) -- get the hydrant's position local hydrantPos = self:GetPosition{}.pos -- we'll spawn the bouncer at the same position local bouncerPos = self:GetPosition{}.pos bouncerPos.x = hydrantPos.x bouncerPos.y = hydrantPos.y bouncerPos.z = hydrantPos.z -- default bouncer information local landingPos = CONSTANTS["SPOUT_BOUNCER_DEST"] local bounceSpeed = CONSTANTS["SPOUT_BOUNCER_SPEED"] -- set up bouncer config data local landingString = landingPos.x .. CONSTANTS["HF_SUB_ITEM_SEP_STRING"] ..landingPos.y .. CONSTANTS["HF_SUB_ITEM_SEP_STRING"] .. landingPos.z local config = { {"bouncer_speed", bounceSpeed} , {"objtype", CONSTANTS["HF_NODE_BOUNCER"]}, {"bouncer_destination", landingString } } RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER_LOT"], x = bouncerPos.x, y = bouncerPos.y, z = bouncerPos.z, owner = self, objType = CONSTANTS["HF_NODE_BOUNCER"], configData = config } end function onChildLoaded( self,msg ) --print( "HYRDRANT: onChildLoaded" ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["BOUNCER_LOT"] ) then --print( "HYDRANT: bouncer loaded" ) storeObjectByName( self, "bouncer", msg.childID ) end end function RemoveBouncer( self ) --print( "HYDRANT: RemoveBouncer" ) local bouncerObj = getObjectByName( self, "bouncer" ) if( bouncerObj ~= nil ) then --print( "HYRDRANT: bouncer Die" ) GAMEOBJ:DeleteObject( bouncerObj ) end end function onBouncerTriggered( self, msg ) --CleanNearbyPlayers( self ) --Hackish fix for the 'bounce collision' local player = msg.triggerObj local objPos = player:GetPosition().pos objPos.y = objPos.y + 1 player:SetPosition{pos = objPos} bounceObj(self, msg.triggerObj) end function onClientUse( self, msg ) --print( "HYDRANT: onClientUse" ) if ( self:GetVar( "broken" ) == false ) then -- break the hydrant self:SetVar( "broken", true ) BreakHydrant( self ) CleanNearbyPlayers( self ) else -- it was already broken, so repair it self:SetVar( "broken", false ) RepairHydrant( self ) end end function CleanNearbyPlayers( self ) --print( "client-sde CleanNearbyPlayers" ) self:FireEventServerSide{ senderID = self, args = "cleanPlayers" } end -------------------------------------------------------------- -- Client side script handles particle effect and bouncer -- when rebuild states change -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- CONSTANTS["HYDRANT_BOUNCER_LOT"] = 3736 -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) self:SetVar("bRenderReady", false) self:SetPickType{ePickType = 14} self:SetVar("waterEffect", CONSTANTS["NO_OBJECT"]) ForgetBouncer( self ) end -------------------------------------------------------------- -- Returns true if the object is in the idle rebuild state -- ( in the hydrant's case, this means there is no water coming out of it right now ) -------------------------------------------------------------- function IsActive(self) -- get the rebuild state local rebuildState = self:GetRebuildState() -- if the state is idle we are active if (rebuildState and tonumber(rebuildState.iState) == 3) then return true else return false end end -------------------------------------------------------------- -- Handled when rendering is ready -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) if (IsActive(self) == false) then -- add the particle effect and bouncer BreakHydrant( self ) end end -------------------------------------------------------------- -- Handle notification of rebuild changes -------------------------------------------------------------- function onRebuildNotifyState(self, msg) -- if we just hit the idle state if (msg.iState == 3) then -- cancel all timers TODO do I need this? GAMEOBJ:GetTimer():CancelAllTimers( self ) -- remove the particle effect and the bouncer RepairHydrant( self ) else -- add the particle effect and bouncer BreakHydrant( self ) end end -------------------------------------------------------------- -- break the hydrant so water comes out -------------------------------------------------------------- function BreakHydrant( self ) AddWaterEffect( self ) AddBouncer( self ) end -------------------------------------------------------------- -- repair the hydrant so water no longer comes out -------------------------------------------------------------- function RepairHydrant( self ) CancelWaterEffect( self ) RemoveBouncer( self ) end -------------------------------------------------------------- -- add the water particle effect -------------------------------------------------------------- function AddWaterEffect( self ) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("waterEffect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = "water", effectID = 384, effectType = "water" } -- save the effect self:SetVar("waterEffect" , true ) end -------------------------------------------------------------- -- cancel the water particle effect -------------------------------------------------------------- function CancelWaterEffect( self ) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("waterEffect") -- remove the effect if ( myEffect ) then self:StopFXEffect{ name = "water" } self:SetVar("waterEffect", false) end end -------------------------------------------------------------- -- add the bouncer -------------------------------------------------------------- function AddBouncer( self ) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have a bouncer if ( self:GetVar( "bouncerID" ) ~= CONSTANTS["NO_OBJECT"] ) then return end -- get the hydrant's position local hydrantPos = self:GetPosition{}.pos -- we'll spawn the bouncer at the same position local bouncerPos = self:GetPosition{}.pos bouncerPos.x = hydrantPos.x bouncerPos.y = hydrantPos.y bouncerPos.z = hydrantPos.z local bounceSpeed = self:GetVar("bouncer_speed") -- set up bouncer config data local vecString = self:GetVar("bouncer_destination") local config = { {"bouncer_speed", bounceSpeed} , {"objtype", CONSTANTS["HF_NODE_BOUNCER"]}, {"bouncer_destination", vecString } } RESMGR:LoadObject { objectTemplate = CONSTANTS["HYDRANT_BOUNCER_LOT"], x = bouncerPos.x, y = bouncerPos.y, z = bouncerPos.z, owner = self, objType = CONSTANTS["HF_NODE_BOUNCER"], configData = config } end -------------------------------------------------------------- -- called when a child object is loaded up, in this case, the bouncer -------------------------------------------------------------- function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["HYDRANT_BOUNCER_LOT"] ) then storeObjectByName( self, "bouncerID", msg.childID ) storeParent( self, msg.childID ) end end -------------------------------------------------------------- -- remove the bouncer -------------------------------------------------------------- function RemoveBouncer( self ) local bouncerObj = getObjectByName( self, "bouncerID" ) if( bouncerObj ~= nil and bouncerObj:Exists() ) then GAMEOBJ:DeleteObject( bouncerObj ) ForgetBouncer( self ) end end -------------------------------------------------------------- -- clear out the bouncer variable -------------------------------------------------------------- function ForgetBouncer( self ) self:SetVar( "bouncerID", CONSTANTS["EMPTY_ID_NAME"] ) end -------------------------------------------------------------- -- called when a notification is sent -------------------------------------------------------------- function onNotifyObject( self, msg ) if (msg.name == "cleanPlayer") then -- the bouncer says it bounced somebody, so clean off their skunk stink self:FireEventServerSide{ senderID = msg.ObjIDSender, args = "cleanPlayer" } end end -------------------------------------------------------------- -- Client script for skunk detectors. handles state -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- perform actions based on zone state if (prevState and prevState ~= state) then DoZoneStateActions(self, state) end end -------------------------------------------------------------- -- Perform actions based on zone state -------------------------------------------------------------- function DoZoneStateActions(self, state) if (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then -- if no invasion remove effect RemoveEffect(self) elseif (state == CONSTANTS["ZONE_STATE_TRANSITION"]) then -- cancel any effect and play a new one RemoveEffect(self) EnableEffect(self, "red") elseif (state == CONSTANTS["ZONE_STATE_HIGH_ALERT"]) then -- cancel any effect and play a new one RemoveEffect(self) EnableEffect(self, "red") elseif (state == CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) then -- cancel any effect and play a new one RemoveEffect(self) EnableEffect(self, "orange") elseif (state == CONSTANTS["ZONE_STATE_LOW_ALERT"]) then -- cancel any effect and play a new one RemoveEffect(self) EnableEffect(self, "yellow") elseif (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then -- if no invasion remove effect RemoveEffect(self) end end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect(self, action) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("currentEffect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = "skunk", effectType = action } -- save the effect self:SetVar( "currentEffect", true ) end -------------------------------------------------------------- -- Removes an effect on the spout -------------------------------------------------------------- function RemoveEffect(self) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("currentEffect") -- remove the effect if ( myEffect == true ) then self:StopFXEffect{ name = "skunk" } self:SetVar("currentEffect", false) end end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- do actions based on state DoZoneStateActions(self, GetZoneState(self)) end -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- Called when object gets a notification -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetZoneState(self, msg.param1) end end require('o_mis') require('o_Main') function onStartup(self) end function onGetOverridePickType(self, msg) msg.ePickType = 14 --NPC type return msg end --function onClientUse(self, msg) -- this DOES rotate the object, but only for the client who clicked it --self:SetRotation{ x = 0.0, y = 0.7071, z = 0.0, w = 0.7071, bIgnoreDirtyFlags = true } --endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onGetOverridePickType(self, msg) msg.ePickType = 2 --NPC type return msg end function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 40) SetProximityDistance(self, 40) AddInteraction(self, "mouseOverEffect", "mouseover") AddInteraction(self, "proximityText", "Click ME!") endrequire('o_mis') require('client/ai/YRK/L_YRK_NPC_INTERACTIONS') require('c_Zorillo') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 35) SetProximityDistance(self, 35) self:SetVar("bRenderReady", false) -- set state to No Info, waiting for state information SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INFO"]) DeactivateInteractions( self ) InitializeAmbientHints( self ) registerWithZoneControlObject(self) end -------------------------------------------------------------- -- remember this NPC's possible chat bubble messages -- used if the NPC is clicked on during peace time -------------------------------------------------------------- function InitializeAmbientHints( self ) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_THE_SKUNK_BUSTERS_SEEM_TO_HAVE_A_LEAK_ON_THIER_ROOF")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_THERE_WHEN_THE_SKUNKS_INVADE,_THE_SKUNKS_BUSTERS_ARE_HERE..._KINDA")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_WE_NEED_NEW_SKUNK_BUSTERS")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_THE_BALLOON_CAN_ALSO_BE_POWERED_BY_A_FIG_WHO'S_SMELLY_WITH_SPECIAL_STINK")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_HAVE_YOU_SEEN_THE_STINK_POWERED_BALLOON_AT_THE_INVENTOR_SHOP?")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_WE_NEED_NEW_SKUNK_BUSTERS")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_RUMOR_HAS_IT_THAT_STANDING_ON_A_FOUNTAIN_SPOUT_MAKES_THE_OTHER_SPOUTS_MORE_POWERFUL")) AddInteraction(self, "interactionText", Localize("NPC_YRK_AMB_I_HEAR_IT_TAKES_2_FIGS_TO_GET_THE_INVENTOR_BALLOON_TO_FLY")) end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="ZoneStateClientObjectReady" } end -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- perform actions based on zone state if (prevState and prevState ~= state) then if ( state == CONSTANTS["ZONE_STATE_NO_INVASION"] ) then ActivateInteractions( self ) else DeactivateInteractions( self ) end end end -------------------------------------------------------------- -- Called when object gets a notification -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetZoneState(self, msg.param1) end end -------------------------------------------------------------- -- Client script for single lamp posts. Handles their effect -- based on the state of the zone -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state) -- get current state local prevState = GetZoneState(self) self:SetVar("ZoneState", state) -- perform actions based on zone state if (prevState and prevState ~= state) then if (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then -- if no invasion play the peace effect RemoveEffect(self) EnableEffect(self, "peaceTime") -- play animation SetAnimation(self, "idle_light") elseif (state == CONSTANTS["ZONE_STATE_TRANSITION"]) then -- disable the effect in this state RemoveEffect(self) EnableEffect(self, "red") -- play animation with optional delay local delay = self:GetVar("anim_delay") if (delay and tonumber(delay) > 0) then GAMEOBJ:GetTimer():AddTimerWithCancel( tonumber(delay) , "PlayAnim_LightToAlarm", self ) else SetAnimation(self, "light_to_alarm") end elseif (state == CONSTANTS["ZONE_STATE_HIGH_ALERT"]) then -- disable the effect in this state RemoveEffect(self) EnableEffect(self, "red") -- play animation SetAnimation(self, "idle_alarm") elseif (state == CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) then -- disable the effect in this state RemoveEffect(self) EnableEffect(self, "orange") -- play animation SetAnimation(self, "idle_alarm") elseif (state == CONSTANTS["ZONE_STATE_LOW_ALERT"]) then -- disable the effect in this state RemoveEffect(self) EnableEffect(self, "yellow") -- play animation SetAnimation(self, "idle_alarm") elseif (state == CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) then -- if no invasion play the peace effect RemoveEffect(self) -- play animation SetAnimation(self, "alarm_to_light") end end end -------------------------------------------------------------- -- adds a detector to this object, if one does not exist -------------------------------------------------------------- function SpawnDetector(self) -- if we have a child detector already, we are done local myChild = getObjectByName(self, "ChildDetector") if(myChild and myChild:Exists()) then -- send state information myChild:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } return end -- get position local mypos = self:GetPosition().pos -- Add a detector here RESMGR:LoadObject { objectTemplate = CONSTANTS["LAMP_DETECTOR_LOT"], x= mypos.x, y= mypos.y, z= mypos.z, owner = self, rw= 0.7071, rx= 0.0, ry= -0.7071, rz = 0.0 } end -------------------------------------------------------------- -- removes a detector spawned by this object -------------------------------------------------------------- function RemoveDetector(self) -- Remove the child local myChild = getObjectByName(self, "ChildDetector") if(myChild and myChild:Exists()) then myChild:Die{killerID = myChild, killType = "SILENT"} end end -------------------------------------------------------------- -- called when a child is loaded -------------------------------------------------------------- function onChildLoaded(self,msg) if msg.templateID == CONSTANTS["LAMP_DETECTOR_LOT"] then -- store current state msg.childID:SetVar("ZoneState", GetZoneState(self)) -- store the object and it's parent storeObjectByName(self, "ChildDetector", msg.childID) storeParent(self, msg.childID) end end -------------------------------------------------------------- -- Plays and sets the animation -------------------------------------------------------------- function SetAnimation(self, name) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- play animation self:PlayAnimation{animationID = name} end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect(self, action ) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("currentEffect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name="lamp", effectType = action } -- save the effect self:SetVar( "currentEffect", true ) end -------------------------------------------------------------- -- Removes an effect on the spout -------------------------------------------------------------- function RemoveEffect(self) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("currentEffect") -- remove the effect if ( myEffect ) then self:StopFXEffect{ name = "lamp" } self:SetVar("currentEffect", false) end end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="ZoneStateClientObjectReady" } end -------------------------------------------------------------- -- Called when object is added to world -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetVar("currentEffect", CONSTANTS["NO_OBJECT"]) -- set state to No Info, waiting for state information SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INFO"]) end -------------------------------------------------------------- -- Called when object gets a notification -------------------------------------------------------------- function onNotifyObject(self, msg) -- set the state if (msg.name == "zone_state_change") then SetZoneState(self, msg.param1) end end -------------------------------------------------------------- -- called when timer complete -------------------------------------------------------------- function onTimerDone(self, msg) -- play an animation if (msg.name == "PlayAnim_LightToAlarm") then SetAnimation(self, "light_to_alarm") elseif (msg.name == "PlayAnim_AlarmToLight") then SetAnimation(self, "alarm_to_light") end end -------------------------------------------------------------- -- Client side script maintains the state of the spouts using -- player proximity -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Locals and Constants -------------------------------------------------------------- -- states for the water height CONSTANTS["WATER_HEIGHT_NORMAL"] = 1 -- the normal amount of water that comes out when no spouts are plugged CONSTANTS["WATER_HEIGHT_INCREASED"] = 2 -- a little higher. 1 other spout is plugged, but this one isn't CONSTANTS["WATER_HEIGHT_LAUNCHABLE"] = 3 -- high enough to launch the player above the fountain. Both of the other spouts are plugged but this one isn't CONSTANTS["effectName"] = "water" CONSTANTS["effectNum"] = 216 -- the number and the names for the water particle effects SPOUT_EFFECT_NAME = {} SPOUT_EFFECT_NAME[CONSTANTS["WATER_HEIGHT_NORMAL"]] = "spoutLow" SPOUT_EFFECT_NAME[CONSTANTS["WATER_HEIGHT_INCREASED"]] = "spoutMed" SPOUT_EFFECT_NAME[CONSTANTS["WATER_HEIGHT_LAUNCHABLE"]] = "spoutHigh" CONSTANTS["WATER_EFFECT_NAMES"] = SPOUT_EFFECT_NAME CONSTANTS["BOUNCER_LOT"] = 3379 -------------------------------------------------------------- -- Get the enable state -------------------------------------------------------------- function GetEnableState(self) return self:GetVar("SpoutEnabled") end -------------------------------------------------------------- -- Set the enable state -------------------------------------------------------------- function SetEnableState(self, state) -- get prev state local bPrevEnabled = GetEnableState(self) -- calc new state and set local bIsEnabled = (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) self:SetVar("SpoutEnabled", bIsEnabled) -- perform actions based on new enable state if (bPrevEnabled ~= bIsEnabled) then -- try to change effects based on enable state if (bIsEnabled == true and self:GetVar("PlayerOnMe") == false) then RemoveEffect(self) EnableEffect(self, GetStateEffectName(self)) -- if state changed and is at max without a player on it try to add a bouncer if (tonumber(self:GetVar("SpoutState")) >= tonumber(CONSTANTS["WATER_HEIGHT_LAUNCHABLE"])) then -- make bouncer AddBouncer(self) end else -- disabled or someone standing on it RemoveEffect(self) RemoveBouncer(self) end end end -------------------------------------------------------------- -- get the name from the array based on spout state -------------------------------------------------------------- function GetStateEffectName(self) local state = self:GetVar("SpoutState") return CONSTANTS["WATER_EFFECT_NAMES"][state] end -------------------------------------------------------------- -- Enables an effect on the spout unless one is already present -------------------------------------------------------------- function EnableEffect(self, action) -- return early if render is not ready or we are disabled if (self:GetVar("bRenderReady") == false or GetEnableState(self) == false) then return end -- return out if we already have an effect local myEffect = self:GetVar("waterEffect") if ( myEffect ) then return end -- make a new effect self:PlayFXEffect{ name = CONSTANTS["effectName"], effectID = CONSTANTS["effectNum"], effectType = action } -- save the effect self:SetVar("waterEffect", true ) end -------------------------------------------------------------- -- Removes an effect on the spout -------------------------------------------------------------- function RemoveEffect(self) -- return early if render is not ready if (self:GetVar("bRenderReady") == false) then return end -- get current effect local myEffect = self:GetVar("waterEffect") -- remove the effect if ( myEffect ) then self:StopFXEffect{ name = CONSTANTS["effectName"] } self:SetVar( "waterEffect", false ) end end -------------------------------------------------------------- -- Called when the render is ready on the client -------------------------------------------------------------- function onRenderComponentReady(self, msg) self:SetVar("bRenderReady", true) -- let the zone control object know we are ready to be instructed GAMEOBJ:GetZoneControlID():FireEvent{ senderID=self, args="ZoneStateClientObjectReady" } end -------------------------------------------------------------- -- On startup -------------------------------------------------------------- function onStartup(self) -- register ourself with the client-side zone script to be instructed later registerWithZoneControlObject(self) self:SetVar("waterEffect", false) self:SetVar("bRenderReady", false) self:SetVar("PlayerOnMe", false ) -- @TODO: leaveprox does not work on logout -- stores if the spout is currently enabled self:SetVar("SpoutEnabled", true) -- start spout at normal level self:SetVar("SpoutState", CONSTANTS["WATER_HEIGHT_NORMAL"]) self:SetProximityRadius{ radius = CONSTANTS["SPOUT_RADIUS"]} -- set state to No Info, waiting for state information SetEnableState(self, CONSTANTS["ZONE_STATE_NO_INFO"]) end -------------------------------------------------------------- -- Called when proximity is updated -------------------------------------------------------------- function onProximityUpdate(self, msg) -- if spout state is maxed out, do nothing local state = self:GetVar("SpoutState") if (tonumber(state) >= tonumber(CONSTANTS["WATER_HEIGHT_LAUNCHABLE"])) then return end -- a player enters proximity while no players are on it if ( msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 and self:GetVar("PlayerOnMe") == false ) then NotifyGroupObjects(self, "SpoutOff") elseif ( msg.status == "LEAVE" and msg.objId:GetFaction().faction == 1 ) then GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "ProxCheck",self ) end end -------------------------------------------------------------- -- Determines if any players are currently in proximity -------------------------------------------------------------- function ArePlayersInProximity(self) local objs = self:GetProximityObjects().objects local index = 1 while index <= table.getn(objs) do local target = objs[index] local faction = target:GetFaction() --verify that we are only bouncing players if faction and faction.faction == 1 then return true; end index = index + 1 end return false; end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) -- check for players in proximity if (msg.name == "ProxCheck") then -- no one left if (ArePlayersInProximity(self) == false) then NotifyGroupObjects(self, "SpoutOn") end end end -------------------------------------------------------------- -- tries to increase our state, returns true if it changes -------------------------------------------------------------- function IncreaseSpoutState(self) local state = self:GetVar("SpoutState") -- no change if maxed if (tonumber(state) >= tonumber(CONSTANTS["WATER_HEIGHT_LAUNCHABLE"])) then return false else -- increase otherwise and return an update state = tonumber(state) + 1 self:SetVar("SpoutState", state) return true end end -------------------------------------------------------------- -- tries to decrease our state, returns true if it changes -------------------------------------------------------------- function DecreaseSpoutState(self) local state = self:GetVar("SpoutState") -- no change if min if (tonumber(state) <= tonumber(CONSTANTS["WATER_HEIGHT_NORMAL"])) then return false else -- increase otherwise and return an update state = tonumber(state) - 1 self:SetVar("SpoutState", state) return true end end -------------------------------------------------------------- -- Notification to object -------------------------------------------------------------- function onNotifyObject(self, msg) -- someone is turning a spout off if (msg.name == "SpoutOff") then -- if we were the sender if (msg.ObjIDSender:GetID() == self:GetID()) then -- someone is on us self:SetVar( "PlayerOnMe", true ) -- remove our effect and any bouncer RemoveEffect(self) RemoveBouncer(self) else -- we are not the sender -- update our spout state local bStateChange = IncreaseSpoutState(self) -- change effects if needed if (bStateChange and self:GetVar("PlayerOnMe") == false) then RemoveEffect(self) EnableEffect(self, GetStateEffectName(self)) -- if state changed and is at max without a player on it if (tonumber(self:GetVar("SpoutState")) >= tonumber(CONSTANTS["WATER_HEIGHT_LAUNCHABLE"])) then -- make bouncer AddBouncer(self) end end end -- someone is turning a spout on elseif (msg.name == "SpoutOn") then -- if we were the sender if (msg.ObjIDSender:GetID() == self:GetID()) then -- someone is off us self:SetVar( "PlayerOnMe", false ) -- turn our effect back on EnableEffect(self, GetStateEffectName(self)) else -- we are not the sender -- update our spout state local bStateChange = DecreaseSpoutState(self) -- change effects if needed if (bStateChange and self:GetVar("PlayerOnMe") == false) then RemoveEffect(self) EnableEffect(self, GetStateEffectName(self)) RemoveBouncer(self) end end elseif (msg.name == "slashCommand") then -- if spout state is maxed out, do nothing local state = self:GetVar("SpoutState") if (tonumber(state) < tonumber(CONSTANTS["WATER_HEIGHT_LAUNCHABLE"])) then if ( self:GetVar( "PlayerOnMe" ) == true ) then NotifyGroupObjects(self, "SpoutOn") else NotifyGroupObjects(self, "SpoutOff") end end -- set the state elseif (msg.name == "zone_state_change") then SetEnableState(self, msg.param1) end end -------------------------------------------------------------- -- send a message to all objects in group -------------------------------------------------------------- function NotifyGroupObjects(self, notifyName) -- send a notify to everyone local objects = self:GetObjectsInGroup{ group = CONSTANTS["SPOUT_GROUP_NAME"] }.objects for i = 1, table.maxn (objects) do objects[i]:NotifyObject{ name = notifyName, ObjIDSender = self } end end -------------------------------------------------------------- -- adds a bouncer on the spout -------------------------------------------------------------- function AddBouncer( self ) -- return early if we are disabled if (GetEnableState(self) == false) then return end -- get the spout's position local spoutPos = self:GetPosition{}.pos -- we'll spawn the bouncer at the same position local bouncerPos = self:GetPosition{}.pos bouncerPos.x = spoutPos.x bouncerPos.y = spoutPos.y bouncerPos.z = spoutPos.z -- default bouncer information local landingPos = CONSTANTS["SPOUT_BOUNCER_DEST"] local bounceSpeed = CONSTANTS["SPOUT_BOUNCER_SPEED"] -- set up bouncer config data local vecString = self:GetVar("bouncer_destination") local config = { {"bouncer_speed", bounceSpeed} , {"objtype", CONSTANTS["HF_NODE_BOUNCER"]}, {"bouncer_destination", vecString } } RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER_LOT"], x = bouncerPos.x, y = bouncerPos.y, z = bouncerPos.z, owner = self, objType = CONSTANTS["HF_NODE_BOUNCER"], configData = config } end -------------------------------------------------------------- -- called when children are loaded -------------------------------------------------------------- function onChildLoaded( self,msg ) if ( msg.childID:GetLOT().objtemplate == CONSTANTS["BOUNCER_LOT"] ) then storeObjectByName( self, "bouncerID", msg.childID ) end end -------------------------------------------------------------- -- removes a bouncer from the spout -------------------------------------------------------------- function RemoveBouncer( self ) local bouncerObj = getObjectByName( self, "bouncerID" ) if( bouncerObj ~= nil and bouncerObj:Exists() ) then GAMEOBJ:DeleteObject( bouncerObj ) end end require('o_mis') -- All the lot nums for the maze LOT_NUMS = {} LOT_NUMS[1] = { 3626, 3627, 3628, 3700 } function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) -- Send every LOT number that isn't us local ournum = 1; -- Store all the lots nums that arent us -- TODO This should be in a table so that it would be dynamic, but not sure how to store one with SetVar yet local slot = self:GetVar("ourslot") for i = 1, #LOT_NUMS[slot] do if(self:GetVar("ourlotnum") ~= LOT_NUMS[slot][i]) then if(ournum == 1) then self:SetVar("lot1", LOT_NUMS[slot][i]) elseif(ournum == 2) then self:SetVar("lot2", LOT_NUMS[slot][i]) elseif(ournum == 3) then self:SetVar("lot3", LOT_NUMS[slot][i]) end ournum = ournum + 1 --local nextLot = #OUR_LOTNUMS + 1 --OUR_LOTNUMS[nextLot] = LOT_NUMS[i] end end --print("TRIPLE: " .. self:GetVar("lot1") .." " .. self:GetVar("lot2") .. " " .. self:GetVar("lot3")) UI:DisplayTripleBuild( self, true, { self:GetVar("lot1"), self:GetVar("lot2"), self:GetVar("lot3") } ) --print("TRIPLE: " .. OUR_LOTNUMS[1] .." " .. OUR_LOTNUMS[2] .. " " .. OUR_LOTNUMS[3]) --UI:DisplayTripleBuild( self, true, { OUR_LOTNUMS[1], OUR_LOTNUMS[2], OUR_LOTNUMS[3] } ) end function onStartup(self) -- Save our LOT number self:SetVar("ourlotnum", self:GetLOT{}.objtemplate) for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(self:GetVar("ourlotnum") == LOT_NUMS[i][a]) then self:SetVar("ourslot", i) return end end end endrequire('o_mis') -- All the lot nums for the maze LOT_NUMS = {} LOT_NUMS[1] = { 3663, 3664, 3665, 3667 } LOT_NUMS[2] = { 3677, 3678, 3679, 3680 } LOT_NUMS[3] = { 3681, 3682, 3683, 3684 } LOT_NUMS[4] = { 3685, 3686, 3687, 3688 } function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) -- Send every LOT number that isn't us local ournum = 1; -- Store all the lots nums that arent us -- TODO This should be in a table so that it would be dynamic, but not sure how to store one with SetVar yet local slot = self:GetVar("ourslot") for i = 1, #LOT_NUMS[slot] do if(self:GetVar("ourlotnum") ~= LOT_NUMS[slot][i]) then if(ournum == 1) then self:SetVar("lot1", LOT_NUMS[slot][i]) elseif(ournum == 2) then self:SetVar("lot2", LOT_NUMS[slot][i]) elseif(ournum == 3) then self:SetVar("lot3", LOT_NUMS[slot][i]) end ournum = ournum + 1 --local nextLot = #OUR_LOTNUMS + 1 --OUR_LOTNUMS[nextLot] = LOT_NUMS[i] end end --print("TRIPLE: " .. self:GetVar("lot1") .." " .. self:GetVar("lot2") .. " " .. self:GetVar("lot3")) UI:DisplayTripleBuild( self, true, { self:GetVar("lot1"), self:GetVar("lot2"), self:GetVar("lot3") } ) --print("TRIPLE: " .. OUR_LOTNUMS[1] .." " .. OUR_LOTNUMS[2] .. " " .. OUR_LOTNUMS[3]) --UI:DisplayTripleBuild( self, true, { OUR_LOTNUMS[1], OUR_LOTNUMS[2], OUR_LOTNUMS[3] } ) end function onStartup(self) -- Save our LOT number self:SetVar("ourlotnum", self:GetLOT{}.objtemplate) for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(self:GetVar("ourlotnum") == LOT_NUMS[i][a]) then self:SetVar("ourslot", i) return end end end endrequire('o_mis') -- All the lot nums for the maze LOT_NUMS = {} LOT_NUMS[1] = { 3712, 3713, 3714, 3712 } --3712 chicken 3713 skunk 3714 sheep function onGetOverridePickType(self, msg) msg.ePickType = 14 return msg end function onClientUse(self, msg) -- Send every LOT number that isn't us local ournum = 1; -- Store all the lots nums that arent us -- TODO This should be in a table so that it would be dynamic, but not sure how to store one with SetVar yet local slot = self:GetVar("ourslot") for i = 1, #LOT_NUMS[slot] do --if(self:GetVar("ourlotnum") ~= LOT_NUMS[slot][i] or ournum == 3 and i == 4) then if(ournum == 1) then self:SetVar("lot1", LOT_NUMS[slot][i]) elseif(ournum == 2) then self:SetVar("lot2", LOT_NUMS[slot][i]) elseif(ournum == 3) then self:SetVar("lot3", LOT_NUMS[slot][i]) end ournum = ournum + 1 --local nextLot = #OUR_LOTNUMS + 1 --OUR_LOTNUMS[nextLot] = LOT_NUMS[i] --end end --print("TRIPLE: " .. self:GetVar("lot1") .." " .. self:GetVar("lot2") .. " " .. self:GetVar("lot3")) UI:DisplayTripleBuild( self, true, { self:GetVar("lot1"), self:GetVar("lot2"), self:GetVar("lot3") } ) --print("TRIPLE: " .. OUR_LOTNUMS[1] .." " .. OUR_LOTNUMS[2] .. " " .. OUR_LOTNUMS[3]) --UI:DisplayTripleBuild( self, true, { OUR_LOTNUMS[1], OUR_LOTNUMS[2], OUR_LOTNUMS[3] } ) end function onStartup(self) -- Save our LOT number self:SetVar("ourlotnum", self:GetLOT{}.objtemplate) for i = 1, #LOT_NUMS do for a = 1, #LOT_NUMS[i] do if(self:GetVar("ourlotnum") == LOT_NUMS[i][a]) then self:SetVar("ourslot", i) return end end end end--require('o_mis') --require('client/ai/NP/L_NP_NPC') function onStartup(self) --AddInteraction(self, "interactionAnim", "interact") end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 15) AddInteraction(self, "mouseOverAnim", "np_greet") AddInteraction(self, "interactionText", Localize("NPC_YRK_BALLOON_GET_4_SMELLY_MINIFIGS_TO_STAND_UNDER_THE_BALLOON_INTAKES")) AddInteraction(self, "proximityText", Localize("NPC_YRK_BALLOON_I_KNOW_HOW_TO_GET_THE_BALLOON_TO_FLY")) endrequire('o_mis') -- note: scripts that include this are responsibe for initializing -- bUseInteractions and setting their own pick type -------------------------------------------------------------- -- sets the mouse over distance for interactions -------------------------------------------------------------- function SetMouseOverDistance(self, dist) if (self and self:Exists()) then self:SetVar("interactDistance", dist) end end -------------------------------------------------------------- -- sets the proximity for the object -------------------------------------------------------------- function SetProximityDistance(self, dist) if (self and self:Exists()) then self:SetVar("proxDistance", dist) self:SetProximityRadius{radius = self:GetVar("proxDistance")} end end -------------------------------------------------------------- -- check for valid type -------------------------------------------------------------- function IsValidType(type) if (type == "mouseOverEffect" or type == "mouseOverAnim" or type == "mouseOverText" or type == "interactionEffect" or type == "interactionAnim" or type == "interactionText" or type == "proximityEffect" or type == "proximityAnim" or type == "proximityText") then return true; end return false end -------------------------------------------------------------- -- adds an interaction, possible types include: -------------------------------------------------------------- -- mouseOverEffect, mouseOverAnim, mouseOverText, -- interactionEffect, interactionAnim, interactionText, -- proximityEffect, proximityAnim, proximityText, -------------------------------------------------------------- function AddInteraction(self, type, action) if (self and self:Exists()) then -- check type if (IsValidType(type) == false) then print("Bad Type of Interaction") return end local table = self:GetVar(type) -- init table if need to if (table == nil) then table = {} end local num = #table + 1 table[num] = action self:SetVar(type, table) end end -------------------------------------------------------------- -- handle cursor over object -------------------------------------------------------------- function onCursorOn(self, msg) if ( UseInteractions( self ) == false ) then return end -- do effects local effects = self:GetVar("mouseOverEffect") if effects and #effects > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("mouseOverAnim") if anims and #anims > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("mouseOverText") if texts and #texts > 0 and (msg.distance < self:GetVar("interactDistance")) then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle client use -------------------------------------------------------------- function onClientUse(self, msg) if ( UseInteractions( self ) == false ) then return end -- do effects local effects = self:GetVar("interactionEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("interactionAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("interactionText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end -------------------------------------------------------------- -- handle proximity updates -------------------------------------------------------------- function onProximityUpdate(self, msg) if ( UseInteractions( self ) == false ) then return end local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if ( (player) and (player:Exists()) ) then if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() then -- do effects local effects = self:GetVar("proximityEffect") if effects and #effects > 0 then -- get a random effect local num = math.random(1, #effects) self:PlayFXEffect{effectType = effects[num]} end -- do anims local anims = self:GetVar("proximityAnim") if anims and #anims > 0 then -- get a random animation local num = math.random(1, #anims) self:PlayAnimation{animationID = anims[num]} end -- do effects local texts = self:GetVar("proximityText") if texts and #texts > 0 then -- get a random text local num = math.random(1, #texts) self:DisplayChatBubble{wsText = texts[num]} end end end end -------------------------------------------------------------- -- returns whether or not the player is allowed to interact with this object right now -------------------------------------------------------------- function UseInteractions( self ) -- if the flag has never been set, initialize it to true if ( self:GetVar( "bUseInteractions" ) == nil ) then self:SetVar( "bUseInteractions", true ) end return self:GetVar( "bUseInteractions" ) end -------------------------------------------------------------- -- allow the player to interact with this object -------------------------------------------------------------- function ActivateInteractions( self ) self:SetVar( "bUseInteractions", true ) self:SetPickType{ePickType = 14} -- PICK_LIST_INTERACTIVE -- from enum PICK_LIST_TYPE in lwoCommonVars.h end -------------------------------------------------------------- -- don't allow the player to interact with this object -------------------------------------------------------------- function DeactivateInteractions( self ) self:SetVar( "bUseInteractions", false ) self:SetPickType{ePickType = 0} -- PICK_LIST_GENERIC -- from enum PICK_LIST_TYPE in lwoCommonVars.h end require('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 15) AddInteraction(self, "mouseOverAnim", "np_greet") AddInteraction(self, "interactionText", Localize("NPC_YRK_MAZE_CERTAIN_WALLS_IN_THE_MAZE_CAN_BE_BUILT_INTO_DIFFERENT_WALLS")) AddInteraction(self, "proximityText", Localize("NPC_YRK_MAZE_THERE_IS_A_TROLL_IN_THE_MAZE_THAT_NEEDS_WATER_BADLY")) endrequire('o_mis') require('client/ai/NP/L_NP_NPC') function onStartup(self) --set the vars for interaction. NOTE: any/all of thses are optional SetMouseOverDistance(self, 30) SetProximityDistance(self, 15) AddInteraction(self, "mouseOverAnim", "np_greet") AddInteraction(self, "interactionText", Localize("NPC_YRK_SLIDE_CLICK_ON_THE_HYDRANT_UP_THERE_TO_ACCESS_THE_SLIDE ")) AddInteraction(self, "proximityText", Localize("NPC_YRK_SLIDE_HOP_ON_THIS_PLATFORM_TO_VISIT_THE_SLIDE")) end function onRenderComponentReady(self, msg) -- instantly hide the render object, we only care to see the effect self:SetVisible{visible = false, fadeTime = 0.0} end-------------------------------------------------------------- -- Description: -- -- Client script for Shooting Gallery NPC in ZP area. -- Lets client know the object can be interacted with -- -------------------------------------------------------------- -------------------------------------------------------------- -- Handle this message to override pick type -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 9 return msg endfunction Initialize(self) self:SetRegistrationForUIUpdate{ eEventType = "OVERHEAD_ICON_CHANGE", iMinimapObjType = 5 } end -------------------------------------------------------------- -- Handle this message to override pick type -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 9 return msg end -- Load Once function LoadVenderVarsOnce(self) end -- Saved Vars function GetVenderVars(self) self:SetVar("ConductCoolDown", false) self:SetVar("ConductTimer_Started",false) self:SetVar("Emote_onExitBuyActive",false) self:SetVar("Vendor_BuyCount", 0) self:SetVar("Vendor_SellCount", 0) end function CreateVenderStates(self) if self:GetVar('Ven.OverRideConduct') then self:SetProximityRadius { radius = self:GetVar("Ven.conductRadius") , name = "conductRadius" } end self:UseStateMachine{} -- Idle State VenderIdle = State.create() VenderIdle.onEnter = function(self) -- end VenderIdle.onArrived = function(self) end -- Emote State VenderEmote = State.create() VenderEmote.onEnter = function(self) -- self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } -- Emote.emote(self, getMyVendorTarget(self), self:GetVar("Ven.Emote_enterType") ) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "BreakPlayEmote", self ) end VenderEmote.onArrived = function(self) end addState(VenderIdle, "VenderIdle", "VenderIdle", self) addState(VenderEmote, "VenderEmote", "VenderEmote", self) beginStateMachine("VenderIdle", self) VenderIdle.onEnter(self) end --[[ function onProximityUpdate(self, msg) if msg.objType == "Enemies" or msg.objType == "NPC" then --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// if msg.name == "conductRadius" and msg.status == "ENTER" then storeVendorTarget(self, msg.objId) SetVendorEmote(self, self:GetVar("Ven.Emote_enterType")) setState("VenderEmote",self) end end if msg.name == "conductRadius" and msg.status == "LEAVE" and not self:GetVar("ExitConductTimer_Started")then storeVendorTarget(self, msg.objId) if self:GetVar("Vendor_SellCount") ~= 0 or self:GetVar("Vendor_BuyCount") ~= 0 then SetVendorEmote(self, self:GetVar("Ven.Emote_onExitBuySell")) setState("VenderEmote",self) else SetVendorEmote(self, self:GetVar("Ven.Emote_onExitType")) setState("VenderEmote",self) end self:SetVar("Vendor_BuyCount",0) self:SetVar("Vendor_SellCount",0) end --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// --////////////////////////////////////////////////////////////////////////////////// end onTimerDone = function(self, msg) if msg.name == "BreakPlayEmote" then setState("VenderIdle",self) end end -------- Vendor Buy onBuyFromVendor = function(self, msg) self:SetVar("Vendor_BuyCount", msg.count) Emote.emote(self, target, self:GetVar("Ven.Emote_onBuyType") ) end ------- Vendor Sell onSellToVendor = function(self, msg) Emote.emote(self, target, self:GetVar("Ven.Emote_onSellType") ) self:SetVar("Vendor_SellCount", msg.count) end ------- Vendor Exit onTerminateInteraction = function(self, msg) end -------------------------- MIS function SetVendorEmote(self, type) self:SetVar("EmoteType", type) end function storeVendorTarget(self, target) idString = target:GetID() finalID = "|" .. idString self:SetVar("myVendorTarget", finalID) end function getMyVendorTarget(self) targetID = self:GetVar("myVendorTarget") return GAMEOBJ:GetObjectByID(targetID) end function emote(self,target, skillType) self:SetVar("EmbeddedTime", self:GetAnimationTime{ animationID = "interact" }.time) self:PlayFXEffect {priority = 1.2, effectType = skillType} end --]] -- *********************************************************** -- HF config data format -- showcaseName -> 0:stringName -- The group name of the showcase this is going to pull the data from -- *********************************************************** require('o_mis'); function onRenderComponentReady(self,msg) self:PlayFXEffect{ name = "plaque_attract" , effectType = "attract" } --self:PlayFXEffect{ name = "plaquefx" , effectType = "display" } end ---------------------------------------------- -- sent when the local player interacts with the -- object ---------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetControlledID() -- check to see if we are the correct player if player:GetID() ~= msg.user:GetID() or self:GetVar('isInUse') then return end -- tell the Story Box UI element to open and what to display, then turn off the interaction icon --UI:SendMessage("pushGameState", {{"state", "Story"}, {"context", {{"visible", true }, {"text", getText(self) }, {"senderID", player}, {"callbackObj", self}} }} ) local exhibitObj = GetExhibit(self); if (exhibitObj ~= nil) then exhibitObj:NotifyObject{name = "LUPExhibitShowObject", ObjIDSender = self} toggleActivatorIcon(self, true) end end function onTerminateInteraction(self,msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleStoryBox", {{"visible", false }} ) toggleActivatorIcon(self) end ---------------------------------------------- -- sent when the object story box is closed; -- this can be done by hitting the x, esc or enter ---------------------------------------------- function onMessageBoxRespond(self, msg) -- UI element has been closed turn on the icon toggleActivatorIcon(self) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactable pick type end end return msg end function onStartup(self) end ---------------------------------------------- -- sent when the requested local player is hit -- by something, this is used to close the story box ---------------------------------------------- function notifyOnHit(self, other, msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleStoryBox", {{"visible", false }} ) toggleActivatorIcon(self) end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHidew ---------------------------------------------- function toggleActivatorIcon(self, bHide) local player = GAMEOBJ:GetControlledID() if not bHide then -- show the icon, cancel notification, set isInUse to false bHide = false self:SetVar('isInUse', false) self:SendLuaNotificationCancel{requestTarget=player, messageName="OnHit"} else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="OnHit"} end -- request the interaction update self:RequestPickTypeUpdate() end function GetExhibit(self) local exhibitObj = getObjectByName(self, "myExhibit"); if(exhibitObj ~= nil) then return exhibitObj; else local groupName = self:GetVar("exhibitName"); if(groupName == nil) then error("Add config data to this object in Happy Flower. showcaseName 0:stringNameofExhibit"); end local objList = self:GetObjectsInGroup{group = groupName, ignoreSelf = true}.objects; if (objList and #objList > 1) then exhibitObj = objList[2]; storeObjectByName(self, "myExhibit", exhibitObj) return exhibitObj; end end return nil; end -- *********************************************************** -- HF config data format -- imageDir -> 0:directory (relative to client/res/textures) -- *********************************************************** TVfileCache = {}; -- This is global to all objects running this script. Normally this is forbidden, but I actually want this global --function onStartup() --end -- Load up the first image when the render component is ready function onRenderComponentReady(self, msg) SetNextImage(self); GAMEOBJ:GetTimer():AddTimerWithCancel( math.random(30, 45), "LUPTVTimer",self ); end function TVInitDirectory(dir) TVfileCache[dir] = RESMGR:GetFilesInDir(dir, "dds", true, ""); -- call like this RESMGR:GetFilesInDir(string directory, string extension (blank for all extensions), bool check sub directories, string wildcard); end -- Swap images and reset the timer function onTimerDone(self, msg) if (msg.name == "LUPTVTimer") then SetNextImage(self); GAMEOBJ:GetTimer():AddTimerWithCancel( math.random(30, 45), "LUPTVTimer",self ); end end -- You can set which directory to load from. By default it is textures/lup/ and all subdirectories function TVGetDirectory(self) local imageDir = self:GetVar("imageDir"); if(imageDir == nil) then imageDir = "textures/lup"; end local temp = TVGetDirFromCache(imageDir); return temp; end -- Get the directory from the cache. -- If that directory hasn't been processed yet, then init that directory and then return function TVGetDirFromCache(imageDir) local dir = TVfileCache[imageDir]; if(dir == nil) then TVInitDirectory(imageDir); dir = TVfileCache[imageDir]; end return dir; end -- Load up the next image at random function SetNextImage(self) local imageDir = TVGetDirectory(self); local numFiles = #imageDir; if(numFiles >= 1) then local lastIdx = self:GetVar("fileIdx"); local newIdx = math.random(1, numFiles); -- make sure we're not loading the same image twice if(newIdx == lastIdx) then newIdx = newIdx + 1; if(newIdx > numFiles) then newIdx = 1; end end self:SetVar("fileIdx", newIdx); UI:SendMessage( "SetLUPTVImage", {{"ImageName", imageDir[newIdx]}}, self ); end end function onCollisionPhantom(self, msg) local config = { {"objectID", "|" .. msg.objectID:GetID()}, {"leadIn", 1}, {"leadOut", 1}, {"lag", 0.1}, {"lockPos", true} } msg.objectID:AddCameraEffect{ effectType = "lookAt", effectID = "lookatFall", duration = 5, configData = config } end-------------------------------------------------------------- -- Mail Box Script -- created mrb... 4/30/10 -- updated releaseVersion to 184 -------------------------------------------------------------- local releaseVersion = 184 -- which version release # the content should be made available ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local verInfo = msg.objIDUser:GetVersioningInfo() if not verInfo.bIsInternal and verInfo.iMajorRelease < 1 and verInfo.iVersionRelease < releaseVersion then if ( msg.isFromUI ) then -- This MUST be set to true, otherwise all requirements from this script will be ignored msg.HasReasonFromScript = true msg.Script_Failed_Requirement = true msg.Script_Reason = Localize("MAIL_UNAVAILABLE") end msg.bCanUse = false end return msg end ---------------------------------------------- -- sent when the local player interacts with the -- object ---------------------------------------------- function onClientUse(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check to see if we are the correct player if playerID ~= msg.user:GetID() or self:GetVar('isInUse') then return end local player = GAMEOBJ:GetObjectByID(playerID) -- tell the Story Box UI element to open and what to display, then turn off the interaction icon UI:SendMessage( "pushGameState", {{"state", "Mail"}} ) toggleActivatorIcon(self, true) end function onTerminateInteraction(self,msg) -- player was hit close the UI element and turn on the icon --looks like this was relying on the UI to send the callback to terminate interaction, that is no longer the case --toggling the mail UI will result in poping the mail game state --we are relying on UI to terminate the interaction when there is a player initiated close UI:SendMessage( "ToggleMail", {{"visible", false}} ) toggleActivatorIcon(self) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- sent when the requested local player is hit -- by something, this is used to close the story box ---------------------------------------------- function notifyOnHit(self, other, msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleMail", {{"visible", false}} ) toggleActivatorIcon(self) end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not bHide then -- show the icon, cancel notification, set isInUse to false bHide = false self:SetVar('isInUse', false) self:SendLuaNotificationCancel{requestTarget=player, messageName="OnHit"} player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="OnHit"} end -- request the interaction update self:RequestPickTypeUpdate() end -- This script is used by the modular build "ghost" pieces, to make them start modular build when they're clicked -- It also forwards object drop messages to the parent modular build so you can drag parts into place from your inventory local myPriority = 0.8 function onClientUse(self, msg) msg.targetObject = self:GetParentObj().objIDParent return msg end function onUseItemOnClient(self, msg) self:GetParentObj().objIDParent:ClientUseModuleOn{ playerID = msg.playerID, dropTarget = self, droppedObjectID = msg.itemToUse, droppedLOT = msg.itemLOT } end function onGetPriorityPickListType(self, msg) if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 8 -- Build pick type end return msg end-- This script forwards object drop messages to the parent modular build so you can drag parts into place from your inventory function onUseItemOnClient(self, msg) self:GetParentObj().objIDParent:ClientUseModuleOn{ playerID = msg.playerID, dropTarget = self, droppedObjectID = msg.itemToUse, droppedLOT = msg.itemLOT } end function onCollisionPhantom(self, msg) local localPlayerID = GAMEOBJ:GetLocalCharID() local collidingID = msg.senderID:GetID() if(localPlayerID ~= collidingID) then msg.senderID:SetVisible{visible=false, fadeTime=0} --print("onCollisionPhantom") end end function onOffCollisionPhantom(self, msg ) local localPlayerID = GAMEOBJ:GetLocalCharID() local collidingID = msg.senderID:GetID() if(localPlayerID ~= collidingID) then msg.senderID:SetVisible{visible=true, fadeTime=0} --print("offCollisionPhantom") end end -------------------------------------------------------------- -- Description: Client side script to hide pedestals on -- external builds, qa/beta/live -- -- Created 4/27/10 mrb... -------------------------------------------------------------- function onStartup(self) local verInfo = self:GetVersioningInfo() -- check to see if the object is supposed to be blocked for beta if not verInfo.bIsInternal then self:SetVisible{visible = false, fadeTime = 0} end end function onRenderComponentReady(self, msg) self:PlayFXEffect{effectID = 575, effectName = "qbdeploy"} end-- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) if msg.objectID:CheckPrecondition{PreconditionID = 33}.bPass == false then return end local buildObj = self buildObj:PlayAnimation{animationID = "Light_Up", bPlayImmediate = true} GAMEOBJ:GetTimer():CancelAllTimers( self ) --local animTime = self:GetAnimationTime{animationID = "Light_Up"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.417, "Idle2", self ) end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) if msg.objectID:CheckPrecondition{PreconditionID = 33}.bPass == false then return end local buildObj = self buildObj:PlayAnimation{animationID = "Dim_Down", bPlayImmediate = true} GAMEOBJ:GetTimer():CancelAllTimers( self ) --local animTime = self:GetAnimationTime{animationID = "Dim_Down"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.375, "Idle1", self ) end -- timers... function onTimerDone(self, msg) if msg.name == "Idle1" then local buildObj = self buildObj:PlayAnimation{animationID = "Dim_Loop", bPlayImmediate = true} elseif msg.name == "Idle2" then local buildObj = self buildObj:PlayAnimation{animationID = "Lit_Up_Loop", bPlayImmediate = true} end end--Chat Test -- GLOBALS -- -- define what the radius of the NPC will be local INTERACT_RADIUS = 100 local RAND_CHAT1 = {"Get over here soldier!", "I need your help!", "Be careful soldier!"} local RAND_CHAT2 = {"I hope nothing happens while we transmit the data.", "Where are all my soldiers?", "This crash site is kind of spooky."} local CHAT_TIME = 10.0 -- use the game message to assign the defined radius function onStartup(self) self:SetProximityRadius { radius = INTERACT_RADIUS } GAMEOBJ:GetTimer():AddTimerWithCancel(CHAT_TIME, "ChatTimer", self) end function onTimerDone(self, msg) if( msg.name == "ChatTimer" ) then local index = math.random(1,#RAND_CHAT2) self:DisplayChatBubble{wsText = RAND_CHAT2[index]} GAMEOBJ:GetTimer():AddTimerWithCancel(CHAT_TIME, "ChatTimer", self) end end function onProximityUpdate(self, msg) if (msg.status == "ENTER") and (msg.objId:GetID() == GAMEOBJ:GetLocalCharID()) then GAMEOBJ:GetTimer():CancelAllTimers( self ) local index = math.random(1,#RAND_CHAT1) self:DisplayChatBubble{wsText = RAND_CHAT1[index]} GAMEOBJ:GetTimer():AddTimerWithCancel(CHAT_TIME, "ChatTimer", self) end endfunction onPlayerLoaded(self, msg) x, y = 2, "awesome" print (x .. y) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then StartZoneSummary(self) return end local charPosition = msg.charID:GetPosition().pos local charRotation = msg.charID:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = {x = 0, y = 0, z = 0, w = 1} spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then StartZoneSummary(self) return end local charPosition = msg.charID:GetPosition().pos local charRotation = msg.charID:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = {x = 0, y = 0, z = 0, w = 1} spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then StartZoneSummary(self) return end local charPosition = msg.charID:GetPosition().pos local charRotation = msg.charID:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = {x = 0, y = 0, z = 0, w = 1} spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then StartZoneSummary(self) return end local charPosition = msg.charID:GetPosition().pos local charRotation = msg.charID:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = {x = 0, y = 0, z = 0, w = 1} spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then StartZoneSummary(self) return end local charPosition = msg.charID:GetPosition().pos local charRotation = msg.charID:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = {x = 0, y = 0, z = 0, w = 1} spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then StartZoneSummary(self) return end local charPosition = msg.charID:GetPosition().pos local charRotation = msg.charID:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = {x = 0, y = 0, z = 0, w = 1} spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then StartZoneSummary(self) return end local charPosition = msg.charID:GetPosition().pos local charRotation = msg.charID:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = {x = 0, y = 0, z = 0, w = 1} spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end ---------------------------------------------------------------- -- Description: -- -- client script on bob in spaceship to show animations after completing first -- mission and forcing second mission offer -- updated brandi... 1/22/10 -------------------------------------------------------------- --////////////////////////////////////////////////////////////////////////////////// local missionCamDist = 10 -- distance to teleport player away from npc --////////////////////////////////////////////////////////////////////////////////// function onStartup(self) self:PreloadAnimation{animationID = "charge"} end function onInteractionAttemptFromOutOfRange(self, msg) -- We must always let the input system know we handled the interaction attempt msg.bHandled = true self:DisplayChatBubble{wsText = "You need to move closer."} return msg end function emote(self,target, skillType) self:SetVar("EmbeddedTime", self:GetAnimationTime{ animationID = "interact" }.time) self:PlayFXEffect {priority = 1.2, effectType = skillType} end function onMissionDialogueOK (self, msg) if (msg.missionID == 173) then if ( msg.bIsComplete == true ) then GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "PlayCheer",self ) -- get the local player and lock controls/movment local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- set a variable indicating an "extra" stun is being applied to the player self:SetVar("ExtraAnimStun", true) -- stun the player so they don't move while the animation is playing player:SetStunned{StateChangeType = "PUSH", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} self:PlayAnimation{animationID = "charge"} -- set the player flag so that the imagination consoles near the launch stations work player:SetFlag{iFlagID = "66", bFlag = true} -- tell the consoles near the end of the ship that they can be interacted with local group = self:GetObjectsInGroup{group = "console", ignoreSpawners = true}.objects for i, object in pairs(group) do if object then object:RequestPickTypeUpdate() end end -- get the player tele location object placed in HF and save the position and rotation local pLocObj = self:GetObjectsInGroup{ group = "Imag_Cam_Player_Loc" }.objects local pPos = pLocObj[1]:GetPosition().pos local pRot = pLocObj[1]:GetRotation() -- move the player to the correct location and start the charge animation player:SetPosition {pos = {x=pPos.x,y=pPos.y,z=pPos.z}} player:SetRotation {x=pRot.x,y=pRot.y,z=pRot.z,w=pRot.w} player:PlayAnimation{animationID = "charge"} -- play Imagination_Cam cinematic using mission_text db player:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } else local cineTime = LEVEL:GetCinematicInfo("Bob_Imagination_Cam") or 1 GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime + 1, "doLookAroundTip",self ) end elseif msg.missionID == 660 and msg.iMissionState < 4 and not msg.responder:GetStunned().bCanMove then -- check the variable indicating an "extra" stun was applied to the player local extraAnimStun = self:GetVar("ExtraAnimStun") -- if the "extra" stun was applied, remove it now if extraAnimStun == true then self:SetVar("ExtraAnimStun", nil) msg.responder:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} end end end function onMissionDialogueCancelled(self, msg) if not msg.responder:GetStunned().bCanMove and msg.missionID == 660 then -- remove the "extra" stun indicator. if there was one, the extra stun state -- was cancelled when the mission offerer cinematic ended self:SetVar("ExtraAnimStun", nil) msg.responder:SetStunned{StateChangeType = "POP", bCantMove = true, bIgnoreImmunity = true, bCantTurn = true, bCantEquip = true} end end function onTimerDone (self,msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- depending on which timer is up play different animations and facial animations. if (msg.name == "PlayCheer") then GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "PlayBlink",self ) player:PlayFaceDecalAnimation { animationID = "Happy", useAllDecals = true } player:PlayAnimation{animationID = "cheer"} self:PlayAnimation{ animationID = "clap" } elseif (msg.name == "PlayBlink") then local waitTime = player:GetAnimationTime{animationID = "Blink"}.time player:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( waitTime, "OfferNextMission",self ) elseif (msg.name == "OfferNextMission") then player:EndCinematic() --forcing player interaction to offer next bob mission player:ForcePlayerToInteract{objToInteractWith = self} elseif (msg.name == "doLookAroundTip") then player:EndCinematic() player:Help{ iHelpID = 28 } end end require('o_mis') CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function GetMissionVars(self) self:SetVar("ConductCoolDown", false) self:SetVar("ConductTimer_Started",false) self:SetVar("Emote_onExitBuyActive",false) Emote = {emote = emote} end function IsLocalCharacter(target) return GAMEOBJ:GetLocalCharID() == target:GetID() end --[[ function CreateMissionStates(self) --self:SetProximityRadius { radius = 20 ,name = "misArrows" } --self:SetVar("ArrowSent", nil) --self:SetVar("childNUM", 1) if self:GetVar('Miss.OverRideConduct') then self:SetProximityRadius { radius = self:GetVar("Miss.conductRadius") , name = "conductRadius" } end self:UseStateMachine{} -- Idle State MissionIdle = State.create() MissionIdle.onEnter = function(self) end MissionIdle.onArrived = function(self) end -- Emote State MissionEmote = State.create() MissionEmote.onEnter = function(self) emote(self, getMyMissionTarget(self), self:GetVar("EmoteType") ) -- print(debug.traceback()) end MissionEmote.onArrived = function(self) end addState(MissionIdle, "MissionIdle", "MissionIdle", self) addState(MissionEmote, "MissionEmote", "MissionEmote", self) beginStateMachine("MissionIdle", self) MissionIdle.onEnter(self) end --]] function emote(self,target, skillType) DoObjectAction(self, "anim", skillType) end --------------Special code for mission arrow prototype --[[ onChildLoaded = function(self,msg) if msg.childID:GetLOT().objtemplate == 4014 then local v = self:GetVar("childNUM") local x = "Spawn_"..v msg.childID:SetMovingPlatformParams{ wsPlatformPath = self:GetVar(x), iStartIndex = 1 } local n = v + 1 self:SetVar("childNUM", n) end end onMissionDialogueOK = function(self, msg) if self:GetVar("Mission_Arrow") == nil then --print("nil Misson") end if msg.bIsComplete == true and self:GetVar("Mission_Complete") ~= nil then local foundObj = self:GetProximityObjects{ name = "misArrows" }.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetLOT().objtemplate == 4639 then --storeObjectByName(missionObj[i], "missionArrow", self) foundObj[i]:NotifyObject{ name = "removeArrow" } break end end end if self:GetVar("Mission_Arrow") ~= nil and self:GetVar("ArrowSent") == nil then --print("Arrows Sent") local s = self:GetVar("Mission_Arrow") local path = split(s, '-') for b = 1, table.maxn(path) do self:SetVar("Spawn_"..b,path[b]) local config = { {"renderDisabled", true } , {"Group_Obj", 99 } } local firstWP = self:GetPosition().pos RESMGR:LoadObject { objectTemplate = 4014 , x= firstWP.x , y= firstWP.y , z= firstWP.z , owner = self, configData = config } self:SetVar("ArrowSent", 99) end end end --]]require('o_mis') function GetMissionVars(self) --self:SetVar("ConductCoolDown", false) --self:SetVar("ConductTimer_Started",false) self:SetVar("Emote_onExitBuyActive",false) --Emote = {emote = emote} end function IsLocalCharacter(target) return GAMEOBJ:GetLocalCharID() == target:GetID() end function CreateMissionStates(self) if self:GetVar('Miss.OverRideConduct') then self:SetProximityRadius { radius = "16" , name = "conductRadius" } end self:UseStateMachine{} -- Idle State MissionIdle = State.create() MissionIdle.onEnter = function(self) end MissionIdle.onArrived = function(self) end -- Emote State MissionEmote = State.create() MissionEmote.onEnter = function(self) -- self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } emote(self, getMyMissionTarget(self), self:GetVar("EmoteType")) end MissionEmote.onArrived = function(self) end addState(MissionIdle, "MissionIdle", "MissionIdle", self) addState(MissionEmote, "MissionEmote", "MissionEmote", self) beginStateMachine("MissionIdle", self) MissionIdle.onEnter(self) end function onProximityUpdate(self, msg) if msg.objType == "NPC" then if msg.name == "conductRadius" and msg.status == "ENTER" and IsLocalCharacter(msg.objId) and msg.objId:GetFaction().faction == (1 or 55) then local myMissionID = self:GetMissionForPlayer{playerID = msg.objId}.missionID local myMissionState = self:GetMissionForPlayer{playerID = msg.objId}.missionState print ("My mission state: ".. (myMissionState)) if myMissionState == 65 then print "Mission 1" self:SetVar("EmoteType", "missionState1") setState("MissionEmote", self) end if myMissionState == 2 or myMissionState == 10 then print "Mission 2" self:SetVar("EmoteType", "missionState2") setState("MissionEmote", self) end if myMissionState == 3 or myMissionState == 12 or myMissionState == 4 then print "Mission 3" self:SetVar("EmoteType", "missionState3") setState("MissionEmote", self) end if myMissionState == 73 then print "Mission 4" self:SetVar("EmoteType", "missionState4") setState("MissionEmote", self) end if myMissionState == 0 then print "Mission New" self:SetVar("EmoteType", "missionState1") setState("MissionEmote", self) end end end if msg.name == "conductRadius" and msg.status ~= "ENTER" and IsLocalCharacter(msg.objId) and msg.objId:GetFaction().faction == 1 then print "Leave" self:SetVar("EmoteType", "idle") setState("MissionEmote", self) end end function storeMissionTarget(self, target) idString = target:GetID() finalID = "|" .. idString self:SetVar("myMissionTarget", finalID) end function getMyMissionTarget(self) targetID = self:GetVar("myMissionTarget") return GAMEOBJ:GetObjectByID(targetID) end function emote(self,target, skillType) DoObjectAction(self, "anim", skillType) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then return end --print("ROCKET TRANSITION BEGIN: PLAYER ID " .. tostring(msg.charID:GetID()) .. " !!!!!") local charPosition = msg.charID:GetPosition().pos local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim if sceneID == 4 then spawnPos = {x = 540.89, y = 406.03, z = 98.5} spawnRot = {x = 0, y = -0.2927, z = 0, w = 0.9562} spawnCinematic = "" spawnTransitionAnim = "rocket-transition_default" else spawnPos = {x = -407.78, y = 353.17, z = -157.66} spawnRot = {x = 0, y = 0.804, z = 0, w = 0.594} spawnCinematic = "AG_01" spawnTransitionAnim = "rocket-transition_AG" end -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- which of the two NPC's is associated with the transformations named 1_ and which with the transformations named 2_ -- this is determined by a flag set in scripts \ c_AvantGardens.lua if ( CONSTANTS["KIPPER_DUEL_SENTINEL_GOES_FIRST"] == true ) then CONSTANTS["ORDER_SENTINEL"] = 1 CONSTANTS["ORDER_PARADOX"] = 2 else CONSTANTS["ORDER_PARADOX"] = 1 CONSTANTS["ORDER_SENTINEL"] = 2 end -- after sending the load request for a model, how long to wait before the assemly NPC comments on the transformation CONSTANTS["COMMENTARY_DELAY"] = 0.25 -- the order in which the different models get transformed -- the number in front represents which of the 2 competing objects changes TRANSFORMATIONS = {} TRANSFORMATIONS["1_NOTHING_TO_MOUSE"] = 1 TRANSFORMATIONS["2_NOTHING_TO_CAT"] = 2 TRANSFORMATIONS["1_MOUSE_TO_DOG"] = 3 TRANSFORMATIONS["2_CAT_TO_DRAGON"] = 4 TRANSFORMATIONS["1_DOG_TO_FIRE_ENGINE"] = 5 TRANSFORMATIONS["2_DRAGON_TO_SUBMARINE"] = 6 TRANSFORMATIONS["1_FIRE_ENGINE_TO_KIPPER"] = 7 TRANSFORMATIONS["2_SUBMARINE_TO_ELEPHANT"] = 8 TRANSFORMATIONS["1_KIPPER_TO_MOUSE"] = 9 TRANSFORMATIONS["2_ELEPHANT_TO_CAT"] = 10 TRANSFORMATIONS["NOT_STARTED"] = 0 TRANSFORMATIONS["START_FROM_NOTHING"] = TRANSFORMATIONS["1_NOTHING_TO_MOUSE"] TRANSFORMATIONS["FIRST_LOOPING"] = TRANSFORMATIONS["1_MOUSE_TO_DOG"] TRANSFORMATIONS["LAST_LOOPING"] = TRANSFORMATIONS["2_ELEPHANT_TO_CAT"] -- the LOT for the model produced by each transformation MODEL_LOTS = {} MODEL_LOTS[TRANSFORMATIONS["1_NOTHING_TO_MOUSE"] ] = CONSTANTS["KIPPER_DUEL_MOUSE_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_NOTHING_TO_CAT"]] = CONSTANTS["KIPPER_DUEL_CAT_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_MOUSE_TO_DOG"]] = CONSTANTS["KIPPER_DUEL_DOG_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_CAT_TO_DRAGON"]] = CONSTANTS["KIPPER_DUEL_DRAGON_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_DOG_TO_FIRE_ENGINE"]] = CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_DRAGON_TO_SUBMARINE"]] = CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_FIRE_ENGINE_TO_KIPPER"]] = CONSTANTS["KIPPER_DUEL_KIPPER_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_SUBMARINE_TO_ELEPHANT"]] = CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_KIPPER_TO_MOUSE"]] = CONSTANTS["KIPPER_DUEL_MOUSE_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_ELEPHANT_TO_CAT"]] = CONSTANTS["KIPPER_DUEL_CAT_LOT"] -- which NPC ( 1 or 2 ) is the owner of each transformation OWNER_NUMS = {} OWNER_NUMS[TRANSFORMATIONS["1_NOTHING_TO_MOUSE"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_NOTHING_TO_CAT"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_MOUSE_TO_DOG"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_CAT_TO_DRAGON"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_DOG_TO_FIRE_ENGINE"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_DRAGON_TO_SUBMARINE"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_FIRE_ENGINE_TO_KIPPER"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_SUBMARINE_TO_ELEPHANT"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_KIPPER_TO_MOUSE"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_ELEPHANT_TO_CAT"]] = 2 -- how close to the corresponding NPC to place the model -- (compared to the whole distance between the 2 NPC's ) CONSTANTS["DISTANCE_FACTOR"] = 7.0 / 24.0 -- half way between 1/3 of the way and 1/4 of the way -- the LOTs for the dummy models used to start us off -- these transform into the mouse and cat CONSTANTS["KIPPER_DUEL_DUMMY_MOUSE_LOT"] = 4966 CONSTANTS["KIPPER_DUEL_DUMMY_CAT_LOT"] = 4973 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartupKipperDuel(self) self:SetVar("currentTransformation", TRANSFORMATIONS["NOT_STARTED"] ) end -------------------------------------------------------------- -- Called when zone object gets an onFireEvent for "ActorReadyKipperDuel" -- because the render component just became ready for one of the NPC's -------------------------------------------------------------- function ActorReadyKipperDuel( self, actor ) local LOT = actor:GetLOT().objtemplate if ( LOT == CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"] ) then storeObjectByName( self, "KipperDuelSentinelNPC", actor ) elseif ( LOT == CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"] ) then storeObjectByName( self, "KipperDuelParadoxNPC", actor ) elseif( LOT == CONSTANTS["KIPPER_SPECTATOR_ASSEMBLY_NPC_LOT"] ) then storeObjectByName( self, "KipperSpectatorAssemblyNPC", actor ) end -- if all 3 actors are now ready, set up a timer to set off the whole duel if ( VerifyActors( self ) ) then SpawnInvisibleStartingModels( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["KIPPER_DUEL_TIME_BETWEEN_MODELS"], "nextTransformation", self ) end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDoneKipperDuel( self, msg ) if ( msg.name == "nextTransformation" ) then DoNextTransformation( self ) elseif ( msg.name == "commentary" ) then ShowSpectatorCommentary( self ) end end -------------------------------------------------------------- -- set the transformation number to the next one in the progression -------------------------------------------------------------- function IncrementTransformationNum( self ) -- check which transformation was done last local curTransformation = self:GetVar( "currentTransformation" ) -- if we haven't started yet, start with the 2 transformations from nothing if ( curTransformation == TRANSFORMATIONS["NOT_STARTED"] ) then self:SetVar("currentTransformation", TRANSFORMATIONS["START_FROM_NOTHING"] ) -- if both objects have cycled back to their first incarnations, then restart the chain of transformations -- (skip the transformations from nothing) elseif ( curTransformation == TRANSFORMATIONS["LAST_LOOPING"] ) then self:SetVar("currentTransformation", TRANSFORMATIONS["FIRST_LOOPING"] ) -- otherwise, just go to the next transformation in order else self:SetVar("currentTransformation", curTransformation + 1 ) end end -------------------------------------------------------------- -- returns whether the stored objects are valid actors for the kipper duel -------------------------------------------------------------- function VerifyActors(self) if ( getObjectByName( self, "KipperDuelSentinelNPC" ) and getObjectByName( self, "KipperDuelParadoxNPC" ) and getObjectByName( self, "KipperSpectatorAssemblyNPC" ) ) then if ( getObjectByName( self, "KipperDuelSentinelNPC" ):Exists() and getObjectByName( self, "KipperDuelParadoxNPC" ):Exists() and getObjectByName( self, "KipperSpectatorAssemblyNPC" ):Exists() ) then return true end end return false end -------------------------------------------------------------- -- transform the existing model into a new one -------------------------------------------------------------- function DoNextTransformation( self ) if ( VerifyActors(self) == false ) then return end -- figure out which transformation is due IncrementTransformationNum( self ) --print( "incremented transformation num to " .. self:GetVar("currentTransformation" ) ) -- ask the LWOChangelingComponent to transform it into the one we need now TransformModel( self ) end -------------------------------------------------------------- -- returns whether the current transformation number affects model 1 or 2 -------------------------------------------------------------- function GetChanglingModelNum( self ) -- return whether the current transformation is on the 1st or 2nd model local curTransformation = self:GetVar( "currentTransformation" ) return OWNER_NUMS[curTransformation] end -------------------------------------------------------------- -- returns whether or not the current model belongs to the Sentinel NPC -- if not, it belongs to the Paradox NPC -------------------------------------------------------------- function ModelBelongsToSentinelNPC( self ) local modelNum = GetChanglingModelNum( self ) if ( modelNum == CONSTANTS["ORDER_SENTINEL"] ) then return true else return false end end -------------------------------------------------------------- -- have the Assembly NPC comment on the last transformation -------------------------------------------------------------- function ShowSpectatorCommentary( self ) if ( VerifyActors(self) == false ) then return end MakeSpectatorWatch( self ) local assemblyObj = getObjectByName( self, "KipperSpectatorAssemblyNPC" ) local modelLOT = GetCurrentModelLOT( self ) -- send a notification to the assembly NPC with the LOT for the model to comment on -- this goes through to scripts \ client \ ai \ AG \ L_AG_KIPPER_SPECTATOR_NPC_CLIENT.lua assemblyObj:NotifyObject{ name = "CommentOnTransformation", param1 = modelLOT } end -------------------------------------------------------------- -- get the LOT for the model produced by the current transformation -------------------------------------------------------------- function GetCurrentModelLOT( self ) local curTransformation = self:GetVar( "currentTransformation" ) return MODEL_LOTS[curTransformation] end -------------------------------------------------------------- -- ask the LWOChangelingBuildComponent to transform the current model into the one we want now -------------------------------------------------------------- function TransformModel( self ) local SentinelObj = getObjectByName( self, "KipperDuelSentinelNPC" ) local ParadoxObj = getObjectByName( self, "KipperDuelParadoxNPC" ) local targetLOT = GetCurrentModelLOT( self ) if ( GetChanglingModelNum( self ) == 1 ) then if ( getObjectByName( self, "changlingModel_1" ) ) then if ( ModelBelongsToSentinelNPC( self ) == true ) then --print( "sentinel transforms model 1 into " .. targetLOT ) getObjectByName( self, "changlingModel_1" ):TransformChangelingBuild{ listenerID = self, miniFigID = SentinelObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } else --print( "paradox transforms model 1 into " .. targetLOT ) getObjectByName( self, "changlingModel_1" ):TransformChangelingBuild{ listenerID = self, miniFigID = ParadoxObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } end end else -- model 2 if ( getObjectByName( self, "changlingModel_2" ) ) then if ( ModelBelongsToSentinelNPC( self ) == true ) then --print( "sentinel transforms model 2 into " .. targetLOT ) getObjectByName( self, "changlingModel_2" ):TransformChangelingBuild{ listenerID = self, miniFigID = SentinelObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } else --print( "paradox transforms model 2 into " .. targetLOT ) getObjectByName( self, "changlingModel_2" ):TransformChangelingBuild{ listenerID = self, miniFigID = ParadoxObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } end end end end -------------------------------------------------------------- -- Called when zone object gets an onFireEvent for "ModelReadyKipperDuel" -- because the render component became ready for the newest changeling model -------------------------------------------------------------- function ModelReadyKipperDuel( self, model ) local LOT = model:GetLOT().objtemplate if ( IsValidModel( LOT ) == false ) then return end local modelNum = GetChanglingModelNum( self ) if ( modelNum == 1 ) then storeObjectByName( self, "changlingModel_1", model ) else storeObjectByName( self, "changlingModel_2", model ) end StartTimersUponNewModelLoaded( self ) DuelingNPCsReactToNewModel( self ) end -------------------------------------------------------------- -- return if template is a valid changeling model -------------------------------------------------------------- function IsValidModel( LOT ) for index = 1, #MODEL_LOTS do if ( LOT == MODEL_LOTS[index] ) then return true end end return false end -------------------------------------------------------------- -- return if template is a valid changeling model -------------------------------------------------------------- function StartTimersUponNewModelLoaded( self ) -- start a timer for having the Assembly NPC spectator comment on the transformation GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["COMMENTARY_DELAY"], "commentary", self ) -- start a new timer to initiate the next transformation GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["KIPPER_DUEL_TIME_BETWEEN_MODELS"], "nextTransformation", self ) end -------------------------------------------------------------- -- a transformation just finished and the old object sent a msg with the new model's object ID -------------------------------------------------------------- function onReturnChangelingBuildID( self, msg ) -- test only -- not actually using this because we want to wait until we know the render component is ready for the new model -- that is caught in L_AG_KIPPER_MODEL_CLIENT.lua and passed through to the zone script -- (the return msg is sent is sent at the same time as the spawn msg for the new model) --print( "kipper duel received new model ID" ) end -------------------------------------------------------------- -- spawn hidden models that can be changed into the mouse and cat to start with -------------------------------------------------------------- function SpawnInvisibleStartingModels( self ) if ( VerifyActors(self) == false ) then return end -- how close to the corresponding NPC to place the model -- (compared to the whole distance between the 2 NPC's ) local distanceFactor = CONSTANTS["DISTANCE_FACTOR"] -- get the NPC's positions local posSentinel = getObjectByName(self, "KipperDuelSentinelNPC"):GetPosition().pos local posParadox = getObjectByName(self, "KipperDuelParadoxNPC"):GetPosition().pos -- calculate the model positions local posForSentinelModel = { x = ( ( posParadox.x - posSentinel.x ) * distanceFactor ) + posSentinel.x, y = ( ( posParadox.y - posSentinel.y ) * distanceFactor ) + posSentinel.y, z = ( ( posParadox.z - posSentinel.z ) * distanceFactor ) + posSentinel.z } local posForParadoxModel = { x = ( ( posSentinel.x - posParadox.x ) * distanceFactor ) + posParadox.x, y = ( ( posSentinel.y - posParadox.y ) * distanceFactor ) + posParadox.y, z = ( ( posSentinel.z - posParadox.z ) * distanceFactor ) + posParadox.z } -- get the NPC's rotations -- we'll use the same rotations for the models local rotMsg1 = getObjectByName(self, "KipperDuelSentinelNPC"):GetRotation() local rotForSentinelModel = { w = rotMsg1.w, x = rotMsg1.x, y = rotMsg1.y, z = rotMsg1.z } local rotMsg2 = getObjectByName(self, "KipperDuelParadoxNPC"):GetRotation() local rotForParadoxModel = { w = rotMsg2.w, x = rotMsg2.x, y = rotMsg2.y, z = rotMsg2.z } -- spawn the new models RESMGR:LoadObject { objectTemplate = CONSTANTS["KIPPER_DUEL_DUMMY_MOUSE_LOT"], bIsSmashable = true, x = posForSentinelModel.x, y = posForSentinelModel.y, z = posForSentinelModel.z, rw = rotForSentinelModel.w, rx = rotForSentinelModel.x, ry = rotForSentinelModel.y, rz = rotForSentinelModel.z, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["KIPPER_DUEL_DUMMY_CAT_LOT"], bIsSmashable = true, x = posForParadoxModel.x, y = posForParadoxModel.y, z = posForParadoxModel.z, rw = rotForParadoxModel.w, rx = rotForParadoxModel.x, ry = rotForParadoxModel.y, rz = rotForParadoxModel.z, owner = self } end -------------------------------------------------------------- -- loaded up one of the invisible starting models -------------------------------------------------------------- function onChildLoadedKipperDuel(self, msg) if ( msg.templateID == 4966 ) then storeObjectByName( self, "changlingModel_1", msg.childID ) elseif ( msg.templateID == 4973 ) then storeObjectByName( self, "changlingModel_2", msg.childID ) end end -------------------------------------------------------------- -- after a new model is loaded up, the dueling NPC that created it talks it up -------------------------------------------------------------- function ModelsOwnerTalksSmack( self ) if ( VerifyActors(self) == false ) then return end local duelObj = getObjectByName( self, "KipperDuelParadoxNPC" ) if ( ModelBelongsToSentinelNPC( self ) == true ) then duelObj = getObjectByName( self, "KipperDuelSentinelNPC" ) end local modelLOT = GetCurrentModelLOT( self ) -- send a notification to the NPC with the LOT for the model to comment on -- this goes through to scripts \ client \ ai \ AG \ L_AG_KIPPER_DUEL_NPC_CLIENT.lua duelObj:NotifyObject{ name = "TalkSmack", param1 = modelLOT } end -------------------------------------------------------------- -- after a new model is loaded up, the dueling NPCs react to it -------------------------------------------------------------- function DuelingNPCsReactToNewModel( self ) if ( VerifyActors(self) == false ) then return end local sentinelObj = getObjectByName( self, "KipperDuelSentinelNPC" ) local paradoxObj = getObjectByName( self, "KipperDuelParadoxNPC" ) local ownerObj = sentinelObj local opponentObj = paradoxObj if ( ModelBelongsToSentinelNPC( self ) == false ) then ownerObj = paradoxObj opponentObj = sentinelObj end -- the owner of the new model plays a gloating anim ownerObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_GLOAT"], fPriority = 1.5 } -- the other dueling NPC plays a pouting anim opponentObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_POUT"], fPriority = 1.5 } -- the new model's owner comments on it ModelsOwnerTalksSmack( self ) end -------------------------------------------------------------- -- make the spectator animate in the direction of the transformation -------------------------------------------------------------- function MakeSpectatorWatch( self ) if ( VerifyActors(self) == false ) then return end local spectatorObj = getObjectByName( self, "KipperSpectatorAssemblyNPC" ) local bSentinelIsOwner = ModelBelongsToSentinelNPC( self ) local bSentinelIsToTheLeft = CONSTANTS["SENTINEL_IS_LEFT_OF_SPECTATOR"] local bLookLeft = true if ( bSentinelIsOwner == true and bSentinelIsToTheLeft == false ) then bLookLeft = false elseif ( bSentinelIsOwner == false and bSentinelIsToTheLeft == true ) then bLookLeft = false end if ( bLookLeft ) then spectatorObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_LEFT"], fPriority = 1.5 } else spectatorObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_RIGHT"], fPriority = 1.5 } end end -------------------------------------------------------------- -- Generic Survival Instance Client Zone Script: Including this -- file gives the custom functions for the Survival game. -- Updated mrb... 1/7/10 -- Updated stc... 5/19/10 - changed UI message structure to work with the game state system -------------------------------------------------------------- -- Localize("SURVIVAL_WAITING_FOR_PLAYER") -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('ai/L_ACTIVITY_MANAGER') --////////////////////////////////////////////////////////////////////////////////// -- local variables local teamScoreBoard = {} local tMedalsSolo = { {name = Localize("Missions_467_name"), score = 300}, -- 467; Survivor {name = Localize("Missions_468_name"), score = 600} } -- 468; Ultimate Survivor local tMedals = { {name = Localize("Missions_392_name"), score = 60}, -- 392; Outwit {name = Localize("Missions_393_name"), score = 180}, -- 393; Outplay {name = Localize("Missions_394_name"), score = 300}, -- 394; Outlast {name = Localize("Missions_395_name"), score = 420}, -- 395; Survivalist {name = Localize("Missions_396_name"), score = 480}, -- 396; Be Prepared! {name = Localize("Missions_397_name"), score = 540}, -- 397; Paramedics! {name = Localize("Missions_398_name"), score = 600}, } -- 398; Unstoppable! --local tMedals = { {name = "Outwit", score = 10}, {name = "Outplay", score = 20} } -- testing --------------------------------------------------------------- -- Startup of the object ----------------------------------------------------------------. function onCharacterUnserialized(self, msg) UI:SendMessage( "pushGameState", {{"state", "Survival"}}) end function checkScoreBoardTable(self, tScoreBoard, bRemoveTable) local t = teamScoreBoard local tTemp = {} local isUsed = false for k,v in ipairs(teamScoreBoard) do if v.nameVar ~= Localize("SURVIVAL_NO_PLAYER") and v.nameVar ~= tScoreBoard.nameVar and v.nameVar ~= '' then table.insert(tTemp,v) --print('add old player to used table ' .. v.nameVar) end if v.nameVar == tScoreBoard.nameVar and bRemoveTable then isUsed = true end end if not isUsed then table.insert(tTemp,tScoreBoard) --print('add new player to used table ' .. tScoreBoard.nameVar) end table.sort(tTemp, function(a,b) return a.nameVarb.smashVar end) table.sort(tTemp, function(a,b) return a.timeVar>b.timeVar end) self:SetVar("playerNum", table.maxn(tTemp)) while table.maxn(tTemp) < 4 do --tVaule = tValue + 1 table.insert(tTemp, { nameVar = Localize("SURVIVAL_NO_PLAYER"), timeVar = 0, scoreVar = 0, smashVar = 0}) end --print('***************') --for k,v in ipairs(t) do -- print('*** player ' .. k .. ' ***') -- print(t[k].nameVar .. ' time: ' .. t[k].timeVar .. ' score: ' .. t[k].scoreVar .. ' smash: ' .. t[k].smashVar) -- print('***************') --end return tTemp end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 or nSeconds == nil then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function numToString(iNum) if iNum == 0 or iNum == nil then return "**" end return tostring(iNum) end function showScoreBoard(self) p = teamScoreBoard if not p then print('missing scoreboard data') return end --for k,v in ipairs(p) do print(p[k].nameVar) end -- Hide timer ui UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }}) -- Show UI UI:SendMessage("ToggleSurvivalSummary", { { "visible", true }, { "p1_check", false }, -- checkmarks { "p2_check", false }, { "p3_check", false }, { "p4_check", false }, { "p1_name", p[1].nameVar }, -- names { "p2_name", p[2].nameVar }, { "p3_name", p[3].nameVar }, { "p4_name", p[4].nameVar }, { "p1_time", SecondsToClock(p[1].timeVar) }, -- times { "p2_time", SecondsToClock(p[2].timeVar) }, { "p3_time", SecondsToClock(p[3].timeVar) }, { "p4_time", SecondsToClock(p[4].timeVar) }, { "p5_time", SecondsToClock(p[1].timeVar) }, { "p1_smash", numToString(p[1].smashVar) }, -- smash { "p2_smash", numToString(p[2].smashVar) }, { "p3_smash", numToString(p[3].smashVar) }, { "p4_smash", numToString(p[4].smashVar) }, { "p5_smash", numToString(p[1].smashVar + p[3].smashVar + p[2].smashVar + p[4].smashVar) }, { "p1_score", numToString(p[1].scoreVar) }, -- score { "p2_score", numToString(p[2].scoreVar) }, { "p3_score", numToString(p[3].scoreVar) }, { "p4_score", numToString(p[4].scoreVar) }, { "p5_score", numToString(p[1].scoreVar + p[3].scoreVar + p[2].scoreVar + p[4].scoreVar) }} ) end function PlayerConfirm(self, playerID) local playerNum = "" for k,v in ipairs(teamScoreBoard) do --print('my name is ' .. teamScoreBoard[k].nameVar) if playerID:GetName().name == teamScoreBoard[k].nameVar then playerNum = tostring(k) end end UI:SendMessage("UpdateSurvivalSummary", {{"p" .. playerNum .. "_check", true }} ) end function setTeamUI(self) local num = #self:MiniGameGetTeamPlayers{teamID = 1}.objects --print('set team ui') if num > 1 then for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] if i == 1 then player:TeamAddPlayerMsg{name = self:MiniGameGetTeamPlayers{teamID = 1}.objects[1], bIsLeader = true} end player:TeamAddPlayerMsg{name = self:MiniGameGetTeamPlayers{teamID = 1}.objects[1]} player:RequestTeamUIUpdate{} end end end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local eChangeType = "POP" if bFreeze then if playerID:IsDead().bDead then --print('frozen') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Freeze_Again", self ) return end eChangeType = "PUSH" end playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } --print('Player ' .. playerID:GetName().name .. ' ' .. eChangeType .. ' is frozen: ' .. tostring(self:GetVar('frozen')) .. ' ' .. tostring(playerID:GetStunned().bCanMove)) if playerID:GetStunned().bCanMove and eChangeType == "PUSH" then print(playerID:GetName().name .. ' is still able to move') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Try_Freeze_Again", self ) end end function onNotifyClientObject(self, msg) if msg.name == "ToggleLeaderBoard" and msg.paramObj:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true} } ) end end function onNotifyClientZoneObject(self, msg) --if msg.name ~= "Update_Default_Start_Timer" then print('notify ' .. msg.name) end if msg.name == "Start_Timer" then -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) elseif msg.name == "Player_Died" then -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( msg.param1 ) }, {"inextbesttime", SecondsToClock(msg.param1) }, {"inextbestname", Localize("SURVIVAL_DEAD_RIGHT_SIDE_NAME_PLATE") } } ) self:SetVar("displayDeath", true) if msg.paramStr == "false" then msg.paramObj:DisplayTooltip { bShow = true, strText = Localize("SURVIVAL_DEAD_TOOL_TIP_MESSAGE"), iTime = 3000 } --print('playerdied *****************') end elseif msg.name == "Update_Timer" then if self:GetVar("displayDeath") then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( msg.param1 ) } } ) else if self:GetVar("HoldingTopScore") then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", SecondsToClock( msg.param1 ) }, {"inextbesttime", SecondsToClock(msg.param1) }, {"inextbestname", msg.paramObj:GetName().name } } ) else UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", SecondsToClock( msg.param1 ) } }) checkNextHighScore(self, msg.param1) end end elseif msg.name == "Update_Default_Start_Timer" then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) UI:SendMessage( "UpdateSurvivalSummary", {{"visible", true}, {"countdownTime", msg.param1 }} ) elseif msg.name == "Kill_Default_Start_Timer" then --print('Kill Default Start Timer') UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) elseif msg.name == "Kill_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) elseif msg.name == "Reset_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) UI:SendMessage( "UpdateSurvivalSummary", {{"p1_check", false }, {"p2_check", false }, {"p3_check", false }, {"p4_check", false }} ) --teamScoreBoard = {} elseif msg.name == "Wave_Message" then UI:SendMessage( "ToggleGenericTextField", {{"visible", true }, {"text", "Wave: " .. msg.paramStr } }) elseif msg.name == "Start_Wave_Message" then UI:SendMessage("ToggleLeaderboard", { {"id", msg.paramStr},{"visible", false} } ) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ShowActivityCountdown() UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) setTeamUI(self) freezePlayer(self) --print(GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetName().name) elseif msg.name == "Define_Player_To_UI" then local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- add player to the ui UI:SendMessage( "UpdateSurvivalSummary", {{"user", msg.paramObj }} ) -- set player to auto-respawn playerID:SetPlayerAllowedRespawn{dontPromptForRespawn=true} elseif msg.name == "Update_ScoreBoard" then --print('update player') local tempTable = { nameVar = msg.paramObj:GetName().name, timeVar = msg.param1, scoreVar = tonumber(msg.paramStr), smashVar = msg.param2} teamScoreBoard = checkScoreBoardTable(self, tempTable) elseif msg.name == "Show_ScoreBoard" then local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --print("Show_ScoreBoard " .. playerID:GetName().name) playerID:RequestTeamUIUpdate{} self:SetVar("displayDeath", false) showScoreBoard(self) if msg.paramStr == playerID:GetID() then freezePlayer(self, true) end UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) -- clear game vars self:SetVar("HoldingTopScore", false) self:SetVar("NextBest", false ) self:SetVar("NextBestName", false) self:SetVar("bShowedPlayer", false) self:SetVar("FoundPlayer", false ) elseif msg.name == "PlayerConfirm_ScoreBoard" then PlayerConfirm(self, msg.paramObj) elseif msg.name == "Kill_ScoreBoard" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage("ToggleSurvivalSummary", {{"visible", false }}) UI:SendMessage("EmbedUI", {{"sgembed", true }}) -- closes the leaderboard teamScoreBoard = {} UI:SendMessage( "ToggleActivityCloseButton", { {"bShow", true}, {"GameObject", self}, {"MessageName", "toLua"}, {"senderID", player} } ) elseif msg.name == "Exit_Waves" then local tempTable = { nameVar = msg.paramObj:GetName().name, timeVar = msg.param1, scoreVar = tonumber(msg.paramStr), smashVar = msg.param2} UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) if GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetName().name == tempTable.nameVar then UI:SendMessage("ToggleSurvivalSummary", {{"visible", false }}) UI:SendMessage("EmbedUI", {{"sgembed", true }}) -- closes the leaderboard UI:SendMessage( "popGameState", {{"state", "Survival"}} ) UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) return end --print('remove player ' .. tempTable.nameVar) msg.paramObj:TeamRemovePlayerMsg{name = 'SurvivalTeam'} teamScoreBoard = checkScoreBoardTable(self, tempTable, true) showScoreBoard(self) end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- Response to Exit activity dialog and user pressed OK if msg.identifier == "exit_screen" and msg.iButton == 1 then -- restart waves self:FireEventServerSide{senderID = msg.sender, args = 'start'} -- Response to Start activity dialog and ok is pressed and player is not in activity elseif msg.identifier == "exit_screen" and msg.iButton == 0 then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) -- exit instance self:FireEventServerSide{senderID = msg.sender, args = 'exit'} -- Response to Start activity dialog and ok is pressed and player is not in activity elseif (msg.identifier == "Exit" ) and msg.iButton == 1 then UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) elseif msg.identifier == "ActivityCloseButtonPressed" and msg.iButton == -1 then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- display exit box player:DisplayMessageBox{bShow = true, imageID = 1, text = Localize("SURVIVAL_EXIT_QUESTION"), callbackClient = self, identifier = "Exit"} end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] local n = 1 local tableValues = {} for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Time"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("bShowedPlayer", false) self:SetVar("NextBest", false) self:SetVar("NextBestName", false) self:SetVar("LeaderTable", tableValues) setNextHighScore(self, iScore) end end function setNextHighScore(self, iScore) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local name_value = 0 local score_value = 0 local name = 0 local score = 0 local tableValues = self:GetVar("LeaderTable") or {} local curName = self:GetVar("NextBestName") local playerScore = 0 if not curName then curName = player:GetName().name end for testName = 1, #tableValues do if tableValues[testName] == curName then name = testName score = (testName + 1) if name ~= 1 then name_value = (testName - 2) score_value = (testName - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif name_value == 1 then name_value = 1 score_value = 2 end end if tableValues[testName] == player:GetName().name then self:SetVar("FoundPlayer", true ) playerScore = tableValues[(testName + 1)] end end local uiName = tableValues[name] or player:GetName().name local uiScore = tableValues[score] or playerScore local uiNextName = tableValues[name_value] or player:GetName().name local uiNextScore = tableValues[score_value] or playerScore if not self:GetVar("bShowedPlayer") then uiNextName = uiName uiNextScore = uiScore end if not iScore then iScore = 0 end local tempMedals = tMedals if self:GetVar("playerNum") == 1 then tempMedals = tMedalsSolo end local highestScore = tableValues[2] or 0 if iScore >= math.floor(highestScore) or not self:GetVar("FoundPlayer") then local pass = false for k,v in ipairs(tempMedals) do if iScore < v.score then uiNextName = v.name uiNextScore = v.score pass = true break end end if not pass then self:SetVar("HoldingTopScore", true) uiNextName = player:GetName().name uiNextScore = iScore end end UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", player:GetName().name}, {"inextbesttime", SecondsToClock(uiNextScore) }, {"inextbestname", tostring(uiNextName) } } ) self:SetVar("NextBest", math.floor(uiNextScore) ) self:SetVar("NextBestName", uiNextName ) self:SetVar("bShowedPlayer", true) end function checkNextHighScore(self, iScore) if not iScore or not self:GetVar('NextBest') then return end if iScore >= self:GetVar('NextBest') then setNextHighScore(self, iScore) end end function onTimerDone(self, msg) if msg.name == "Try_Freeze_Again" then freezePlayer(self, true) end end local WORLD_VIGNETTE_LOT = 4884 local TRUCK_VIGNETTE_LOT = 4906 local CONTROLLER_VIGNETTE_LOT = 4907 local STARS_VIGNETTE_LOT = 4914 local PATH_NAMES = {} PATH_NAMES[1]="Rocket_01_Path_01" PATH_NAMES[2]="Rocket_02_Path_01" PATH_NAMES[3]="Rocket_Path_01" PATH_NAMES[4]="Rocket_04_Path_01" function onStartupTransition(self) end function onChildLoadedTransition( self, msg ) if (msg.templateID == 4983) then storeObjectByName(self, "customClone", msg.childID) elseif (msg.templateID == WORLD_VIGNETTE_LOT) then storeObjectByName(self, "vignetteObject", msg.childID) elseif (msg.templateID == STARS_VIGNETTE_LOT) then storeObjectByName(self, "vignetteStars", msg.childID) elseif (msg.templateID == TRUCK_VIGNETTE_LOT) then storeObjectByName(self, "vignetteTruck", msg.childID) elseif (msg.templateID == CONTROLLER_VIGNETTE_LOT) then storeObjectByName(self, "vignetteController", msg.childID) end end function onCinematicUpdateTransition(self, msg) if(msg.event == "STARTED") then if(msg.pathName == "Rocket_Path_04") then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.01, "RocketSoar",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.05, "TruckPreload",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 11.33, "RocketPic",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 13, "FaceFocus",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 14.1, "RocketLand",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 19.5, "TruckBoom",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 22, "RocketBoom",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 26, "FaceChange",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 29, "RocketUnfreeze",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 29.49, "TelePlayer",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 29.52, "SnapPlayersCam",self ) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetPosition {pos = {x=526.3,y=94.6,z=-443.57}} player:SetRotation {x=0,y=-0.549,z=0,w=0.835} canFire = true RESMGR:LoadObject {objectTemplate = 4983, x = 668.55, y = 134.2, z = -506.13, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} --print(tostring(self:GetVar("selection1")) .. " " .. tostring(self:GetVar("selection2")) .. " " .. tostring(self:GetVar("selection3"))) RESMGR:LoadObject {objectTemplate = self:GetVar("selection1"), owner = self} RESMGR:LoadObject {objectTemplate = self:GetVar("selection2"), owner = self} RESMGR:LoadObject {objectTemplate = self:GetVar("selection3"), owner = self} else for i,v in ipairs(PATH_NAMES) do if msg.pathName == v then RESMGR:LoadObject {objectTemplate = WORLD_VIGNETTE_LOT, x = 668.55, y = 134.2, z = -506.13, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = STARS_VIGNETTE_LOT, x = 668.55, y = 134.2, z = -506.13, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = TRUCK_VIGNETTE_LOT, x = 645.89, y = 134.2, z = -556.34, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = CONTROLLER_VIGNETTE_LOT, x = 691.34, y = 134.33, z = -512.25, rw = 0.551, rx = 0, ry = 0.833, rz = 0, owner = self} end end end end end function onNotifyObjectTransition(self, msg) if msg.name == "customRocketSelected1" then self:SetVar("selection1", msg.param1) elseif msg.name == "customRocketSelected2" then self:SetVar("selection2", msg.param1) elseif msg.name == "customRocketSelected3" then self:SetVar("selection3", msg.param1) end end function onChildRenderComponentReadyTransition(self, msg) if msg.childLOT == self:GetVar("selection1") then storeObjectByName(self, "selection1Obj", msg.childID) elseif msg.childLOT == self:GetVar("selection2") then storeObjectByName(self, "selection2Obj", msg.childID) elseif msg.childLOT == self:GetVar("selection3") then storeObjectByName(self, "selection3Obj", msg.childID) end if getObjectByName(self, "selection1Obj") and getObjectByName(self, "selection2Obj") and getObjectByName(self, "selection3Obj") then getObjectByName(self, "customClone"):AttachObject{childID = getObjectByName(self, "selection3Obj"), subNodeName = "custom_attach_point"} getObjectByName(self, "selection3Obj"):AttachObject{childID = getObjectByName(self, "selection2Obj"), subNodeName = "CP_A1"} getObjectByName(self, "selection2Obj"):AttachObject{childID = getObjectByName(self, "selection1Obj"), subNodeName = "CP_B2"} end end function onTimerDoneTransition( self, msg ) if (msg.name == "RocketSoar") then --print "Truck Hack" getObjectByName(self, "customClone"):PlayAnimation{animationID = "soar"} local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayAnimation{animationID = "rocket-soar"} player:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } getObjectByName(self, "vignetteObject"):PlayAnimation{animationID = "soar"} getObjectByName(self, "vignetteStars"):PlayAnimation{animationID = "soar"} getObjectByName(self, "vignetteController"):PlayAnimation{animationID = "soar"} getObjectByName(self, "vignetteTruck"):PlayAnimation{animationID = "land"} end if (msg.name == "TruckPreload") then if getObjectByName(self, "selection1Obj") and getObjectByName(self, "selection2Obj") and getObjectByName(self, "selection3Obj") then getObjectByName(self, "selection3Obj"):PlayFXEffect{effectType = "launch"} getObjectByName(self, "selection2Obj"):PlayFXEffect{effectType = "launch"} getObjectByName(self, "selection1Obj"):PlayFXEffect{effectType = "launch"} end --print "Truck Land" getObjectByName(self, "vignetteTruck"):PlayAnimation{animationID = "land"} end if (msg.name == "RocketPic") then --print "Picture Time" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Happy", useAllDecals = true } -- getObjectByName(self, "customClone"):PlayAnimation{animationID = "rocket-pic"} -- local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- player:PlayAnimation{animationID = "rocket-pic"} end if (msg.name == "FaceFocus") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } end if (msg.name == "RocketLand") then --print "Landing Time" -- getObjectByName(self, "customClone"):PlayAnimation{animationID = "rocket-land"} -- local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteObject")) GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteStars")) -- player:PlayAnimation{animationID = "rocket-land"} end if (msg.name == "TruckBoom") then getObjectByName(self, "vignetteTruck"):PlayAnimation{animationID = "boom"} end if (msg.name == "RocketBoom") then --print "BOOM!" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:DeleteObject(getObjectByName(self, "selection1Obj")) getObjectByName(self, "selection2Obj"):DetachObject{} GAMEOBJ:DeleteObject(getObjectByName(self, "selection2Obj")) getObjectByName(self, "selection3Obj"):DetachObject{} GAMEOBJ:DeleteObject(getObjectByName(self, "selection3Obj")) end if (msg.name == "FaceChange") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end if (msg.name == "RocketUnfreeze") then --print "Frees Player" getObjectByName(self, "selection1Obj"):DetachObject{} GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteTruck")) GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteController")) GAMEOBJ:DeleteObject(getObjectByName(self, "customClone")) end if (msg.name == "TelePlayer") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetPosition {pos = {x=443.63,y=94.34,z=-485.2}} player:SetRotation {x=0,y=-0.873,z=0,w=0.486} player:SetUserCtrlCompPause{bPaused = false} end if (msg.name == "SnapPlayersCam") then CAMERA:SnapCameraToPlayer() end end CONSTANTS = {} CONSTANTS["CONTROLLER_LOT"] = 2873 CONTROLLER = {} function onObjectLoaded(self, msg) -- controller object loaded if (msg.templateID == CONSTANTS["CONTROLLER_LOT"]) then CONTROLLER = msg.objectID end end -- Relay the event to the C++ controller function onArcadeScoreEvent(self, msg) CONTROLLER:ArcadeScoreEvent{objectID = msg.objectID} end function onStartup(self, msg) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "Go", self ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "Go") then UI:DisplayToolTip{strDialogText = "Follow the path. Scoring will be based on coins collected. Good luck!", strImageName = "", bShow=true, iTime=0} end end -------------------------------------------------------------- -- Generic Survival Instance Client Zone Script: Including this -- file gives the custom functions for the Survival game. -- Updated mrb... 1/7/10 -- Updated stc... 5/19/10 - changed UI message structure to work with the game state system -------------------------------------------------------------- -- Localize("SURVIVAL_WAITING_FOR_PLAYER") -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('ai/L_ACTIVITY_MANAGER') --////////////////////////////////////////////////////////////////////////////////// -- local variables local teamScoreBoard = {} local tMedalsSolo = { {name = Localize("Missions_467_name"), score = 300}, -- 467; Survivor {name = Localize("Missions_468_name"), score = 600} } -- 468; Ultimate Survivor local tMedals = { {name = Localize("Missions_392_name"), score = 60}, -- 392; Outwit {name = Localize("Missions_393_name"), score = 180}, -- 393; Outplay {name = Localize("Missions_394_name"), score = 300}, -- 394; Outlast {name = Localize("Missions_395_name"), score = 420}, -- 395; Survivalist {name = Localize("Missions_396_name"), score = 480}, -- 396; Be Prepared! {name = Localize("Missions_397_name"), score = 540}, -- 397; Paramedics! {name = Localize("Missions_398_name"), score = 600}, } -- 398; Unstoppable! --local tMedals = { {name = "Outwit", score = 10}, {name = "Outplay", score = 20} } -- testing --------------------------------------------------------------- -- Startup of the object ----------------------------------------------------------------. function onCharacterUnserialized(self, msg) UI:SendMessage( "pushGameState", {{"state", "Survival"}}) end function checkScoreBoardTable(self, tScoreBoard, bRemoveTable) local t = teamScoreBoard local tTemp = {} local isUsed = false for k,v in ipairs(teamScoreBoard) do if v.nameVar ~= Localize("SURVIVAL_NO_PLAYER") and v.nameVar ~= tScoreBoard.nameVar and v.nameVar ~= '' then table.insert(tTemp,v) --print('add old player to used table ' .. v.nameVar) end if v.nameVar == tScoreBoard.nameVar and bRemoveTable then isUsed = true end end if not isUsed then table.insert(tTemp,tScoreBoard) --print('add new player to used table ' .. tScoreBoard.nameVar) end table.sort(tTemp, function(a,b) return a.nameVarb.smashVar end) table.sort(tTemp, function(a,b) return a.timeVar>b.timeVar end) self:SetVar("playerNum", table.maxn(tTemp)) while table.maxn(tTemp) < 4 do --tVaule = tValue + 1 table.insert(tTemp, { nameVar = Localize("SURVIVAL_NO_PLAYER"), timeVar = 0, scoreVar = 0, smashVar = 0}) end --print('***************') --for k,v in ipairs(t) do -- print('*** player ' .. k .. ' ***') -- print(t[k].nameVar .. ' time: ' .. t[k].timeVar .. ' score: ' .. t[k].scoreVar .. ' smash: ' .. t[k].smashVar) -- print('***************') --end return tTemp end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 or nSeconds == nil then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function numToString(iNum) if iNum == 0 or iNum == nil then return "**" end return tostring(iNum) end function showScoreBoard(self) p = teamScoreBoard if not p then print('missing scoreboard data') return end --for k,v in ipairs(p) do print(p[k].nameVar) end -- Hide timer ui UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }}) -- Show UI UI:SendMessage("ToggleSurvivalSummary", { { "visible", true }, { "p1_check", false }, -- checkmarks { "p2_check", false }, { "p3_check", false }, { "p4_check", false }, { "p1_name", p[1].nameVar }, -- names { "p2_name", p[2].nameVar }, { "p3_name", p[3].nameVar }, { "p4_name", p[4].nameVar }, { "p1_time", SecondsToClock(p[1].timeVar) }, -- times { "p2_time", SecondsToClock(p[2].timeVar) }, { "p3_time", SecondsToClock(p[3].timeVar) }, { "p4_time", SecondsToClock(p[4].timeVar) }, { "p5_time", SecondsToClock(p[1].timeVar) }, { "p1_smash", numToString(p[1].smashVar) }, -- smash { "p2_smash", numToString(p[2].smashVar) }, { "p3_smash", numToString(p[3].smashVar) }, { "p4_smash", numToString(p[4].smashVar) }, { "p5_smash", numToString(p[1].smashVar + p[3].smashVar + p[2].smashVar + p[4].smashVar) }, { "p1_score", numToString(p[1].scoreVar) }, -- score { "p2_score", numToString(p[2].scoreVar) }, { "p3_score", numToString(p[3].scoreVar) }, { "p4_score", numToString(p[4].scoreVar) }, { "p5_score", numToString(p[1].scoreVar + p[3].scoreVar + p[2].scoreVar + p[4].scoreVar) }} ) end function PlayerConfirm(self, playerID) local playerNum = "" for k,v in ipairs(teamScoreBoard) do --print('my name is ' .. teamScoreBoard[k].nameVar) if playerID:GetName().name == teamScoreBoard[k].nameVar then playerNum = tostring(k) end end UI:SendMessage("UpdateSurvivalSummary", {{"p" .. playerNum .. "_check", true }} ) end function setTeamUI(self) local num = #self:MiniGameGetTeamPlayers{teamID = 1}.objects --print('set team ui') if num > 1 then for i = 1, #self:MiniGameGetTeamPlayers{teamID = 1}.objects do local player = self:MiniGameGetTeamPlayers{teamID = 1}.objects[i] if i == 1 then player:TeamAddPlayerMsg{name = self:MiniGameGetTeamPlayers{teamID = 1}.objects[1], bIsLeader = true} end player:TeamAddPlayerMsg{name = self:MiniGameGetTeamPlayers{teamID = 1}.objects[1]} player:RequestTeamUIUpdate{} end end end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local eChangeType = "POP" if bFreeze then if playerID:IsDead().bDead then --print('frozen') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Freeze_Again", self ) return end eChangeType = "PUSH" end playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } --print('Player ' .. playerID:GetName().name .. ' ' .. eChangeType .. ' is frozen: ' .. tostring(self:GetVar('frozen')) .. ' ' .. tostring(playerID:GetStunned().bCanMove)) if playerID:GetStunned().bCanMove and eChangeType == "PUSH" then print(playerID:GetName().name .. ' is still able to move') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Try_Freeze_Again", self ) end end function onNotifyClientObject(self, msg) if msg.name == "ToggleLeaderBoard" and msg.paramObj:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true} } ) end end function onNotifyClientZoneObject(self, msg) --if msg.name ~= "Update_Default_Start_Timer" then print('notify ' .. msg.name) end if msg.name == "Start_Timer" then -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) elseif msg.name == "Player_Died" then -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( msg.param1 ) }, {"inextbesttime", SecondsToClock(msg.param1) }, {"inextbestname", Localize("SURVIVAL_DEAD_RIGHT_SIDE_NAME_PLATE") } } ) self:SetVar("displayDeath", true) if msg.paramStr == "false" then msg.paramObj:DisplayTooltip { bShow = true, strText = Localize("SURVIVAL_DEAD_TOOL_TIP_MESSAGE"), iTime = 3000 } --print('playerdied *****************') end elseif msg.name == "Update_Timer" then if self:GetVar("displayDeath") then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( msg.param1 ) } } ) else if self:GetVar("HoldingTopScore") then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", SecondsToClock( msg.param1 ) }, {"inextbesttime", SecondsToClock(msg.param1) }, {"inextbestname", msg.paramObj:GetName().name } } ) else UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", SecondsToClock( msg.param1 ) } }) checkNextHighScore(self, msg.param1) end end elseif msg.name == "Update_Default_Start_Timer" then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) UI:SendMessage( "UpdateSurvivalSummary", {{"visible", true}, {"countdownTime", msg.param1 }} ) elseif msg.name == "Kill_Default_Start_Timer" then --print('Kill Default Start Timer') UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) elseif msg.name == "Kill_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) elseif msg.name == "Reset_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) UI:SendMessage( "UpdateSurvivalSummary", {{"p1_check", false }, {"p2_check", false }, {"p3_check", false }, {"p4_check", false }} ) --teamScoreBoard = {} elseif msg.name == "Wave_Message" then UI:SendMessage( "ToggleGenericTextField", {{"visible", true }, {"text", "Wave: " .. msg.paramStr } }) elseif msg.name == "Start_Wave_Message" then UI:SendMessage("ToggleLeaderboard", { {"id", msg.paramStr},{"visible", false} } ) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ShowActivityCountdown() UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) setTeamUI(self) freezePlayer(self) --print(GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetName().name) elseif msg.name == "Define_Player_To_UI" then local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- add player to the ui UI:SendMessage( "UpdateSurvivalSummary", {{"user", msg.paramObj }} ) -- set player to auto-respawn playerID:SetPlayerAllowedRespawn{dontPromptForRespawn=true} elseif msg.name == "Update_ScoreBoard" then --print('update player') local tempTable = { nameVar = msg.paramObj:GetName().name, timeVar = msg.param1, scoreVar = tonumber(msg.paramStr), smashVar = msg.param2} teamScoreBoard = checkScoreBoardTable(self, tempTable) elseif msg.name == "Show_ScoreBoard" then local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) --print("Show_ScoreBoard " .. playerID:GetName().name) playerID:RequestTeamUIUpdate{} self:SetVar("displayDeath", false) showScoreBoard(self) if msg.paramStr == playerID:GetID() then freezePlayer(self, true) end UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) -- clear game vars self:SetVar("HoldingTopScore", false) self:SetVar("NextBest", false ) self:SetVar("NextBestName", false) self:SetVar("bShowedPlayer", false) self:SetVar("FoundPlayer", false ) elseif msg.name == "PlayerConfirm_ScoreBoard" then PlayerConfirm(self, msg.paramObj) elseif msg.name == "Kill_ScoreBoard" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage("ToggleSurvivalSummary", {{"visible", false }}) UI:SendMessage("EmbedUI", {{"sgembed", true }}) -- closes the leaderboard teamScoreBoard = {} UI:SendMessage( "ToggleActivityCloseButton", { {"bShow", true}, {"GameObject", self}, {"MessageName", "toLua"}, {"senderID", player} } ) elseif msg.name == "Exit_Waves" then local tempTable = { nameVar = msg.paramObj:GetName().name, timeVar = msg.param1, scoreVar = tonumber(msg.paramStr), smashVar = msg.param2} UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) if GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetName().name == tempTable.nameVar then UI:SendMessage("ToggleSurvivalSummary", {{"visible", false }}) UI:SendMessage("EmbedUI", {{"sgembed", true }}) -- closes the leaderboard UI:SendMessage( "popGameState", {{"state", "Survival"}} ) UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) return end --print('remove player ' .. tempTable.nameVar) msg.paramObj:TeamRemovePlayerMsg{name = 'SurvivalTeam'} teamScoreBoard = checkScoreBoardTable(self, tempTable, true) showScoreBoard(self) end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- Response to Exit activity dialog and user pressed OK if msg.identifier == "exit_screen" and msg.iButton == 1 then -- restart waves self:FireEventServerSide{senderID = msg.sender, args = 'start'} -- Response to Start activity dialog and ok is pressed and player is not in activity elseif msg.identifier == "exit_screen" and msg.iButton == 0 then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) -- exit instance self:FireEventServerSide{senderID = msg.sender, args = 'exit'} -- Response to Start activity dialog and ok is pressed and player is not in activity elseif (msg.identifier == "Exit" ) and msg.iButton == 1 then UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) elseif msg.identifier == "ActivityCloseButtonPressed" and msg.iButton == -1 then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- display exit box player:DisplayMessageBox{bShow = true, imageID = 1, text = Localize("SURVIVAL_EXIT_QUESTION"), callbackClient = self, identifier = "Exit"} end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] local n = 1 local tableValues = {} for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Time"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("bShowedPlayer", false) self:SetVar("NextBest", false) self:SetVar("NextBestName", false) self:SetVar("LeaderTable", tableValues) setNextHighScore(self, iScore) end end function setNextHighScore(self, iScore) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local name_value = 0 local score_value = 0 local name = 0 local score = 0 local tableValues = self:GetVar("LeaderTable") or {} local curName = self:GetVar("NextBestName") local playerScore = 0 if not curName then curName = player:GetName().name end for testName = 1, #tableValues do if tableValues[testName] == curName then name = testName score = (testName + 1) if name ~= 1 then name_value = (testName - 2) score_value = (testName - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif name_value == 1 then name_value = 1 score_value = 2 end end if tableValues[testName] == player:GetName().name then self:SetVar("FoundPlayer", true ) playerScore = tableValues[(testName + 1)] end end local uiName = tableValues[name] or player:GetName().name local uiScore = tableValues[score] or playerScore local uiNextName = tableValues[name_value] or player:GetName().name local uiNextScore = tableValues[score_value] or playerScore if not self:GetVar("bShowedPlayer") then uiNextName = uiName uiNextScore = uiScore end if not iScore then iScore = 0 end local tempMedals = tMedals if self:GetVar("playerNum") == 1 then tempMedals = tMedalsSolo end local highestScore = tableValues[2] or 0 if iScore >= math.floor(highestScore) or not self:GetVar("FoundPlayer") then local pass = false for k,v in ipairs(tempMedals) do if iScore < v.score then uiNextName = v.name uiNextScore = v.score pass = true break end end if not pass then self:SetVar("HoldingTopScore", true) uiNextName = player:GetName().name uiNextScore = iScore end end UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", player:GetName().name}, {"inextbesttime", SecondsToClock(uiNextScore) }, {"inextbestname", tostring(uiNextName) } } ) self:SetVar("NextBest", math.floor(uiNextScore) ) self:SetVar("NextBestName", uiNextName ) self:SetVar("bShowedPlayer", true) end function checkNextHighScore(self, iScore) if not iScore or not self:GetVar('NextBest') then return end if iScore >= self:GetVar('NextBest') then setNextHighScore(self, iScore) end end function onTimerDone(self, msg) if msg.name == "Try_Freeze_Again" then freezePlayer(self, true) end end -------------------------------------------------------------- -- Cinematic update handler -------------------------------------------------------------- function onCinematicUpdate(self, msg) if(msg.event == "STARTED") then print("Path: " .. msg.pathName .. " started") -- RemoveAllCameraEffects() if(msg.pathName == "C") then LookCameraAtObject(GAMEOBJ:GetLocalCharID()) end elseif(msg.event == "WAYPOINT") then print("Path: " .. msg.pathName .. " reached waypoint " .. msg.waypoint) print("Path Time / Overall: " .. msg.pathTime .. " / " .. msg.overallTime) if(msg.pathName == "B" and msg.waypoint == 1) then ShakeCamera() end if(msg.pathName == "C" and msg.waypoint == 5) then -- RemoveCameraEffect("lookitMe!!") end elseif(msg.event == "ENDED") then print("Path: " .. msg.pathName .. " ended") else print("What the hoof?") end end -------------------------------------------------------------- -- Plays a short shake effect on the camera -------------------------------------------------------------- function ShakeCamera() local config = { {"posFrequency", 24}, {"rotFrequency", 2}, {"xAmplitude", 4}, {"zRotation", 5} } GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):AddCameraEffect{ effectType = "shake", effectID = "omgMyShaek", duration = 5, configData = config } end -------------------------------------------------------------- -- Attaches a look-at effect to the camera -------------------------------------------------------------- function LookCameraAtObject(object) local config = { {"objectID", "|" .. object}, {"leadIn", 5}, {"leadOut", 5}, {"lag", 0.85}, {"FOV", 10} } GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):AddCameraEffect{ effectType = "lookAt", effectID = "lookitMe!!", duration = 30, configData = config } end -------------------------------------------------------------- -- Removes a single camera effect from the local player -------------------------------------------------------------- function RemoveCameraEffect(removeID) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):RemoveCameraEffect{ effectID = removeID } end -------------------------------------------------------------- -- Removes all camera effects from the local player -------------------------------------------------------------- function RemoveAllCameraEffects() GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):RemoveAllCameraEffects{} end -- Rocket Landing Head require('o_mis') function onCharacterUnserialized(self, msg) local player=msg.charID local mypos = self:GetPosition().pos local myrot = self:GetRotation() local config = { {"player", "|" .. player:GetID() }, { "custom_script_client" , "scripts/client/zone/NEW_ROCKET_LANDING_TAIL.lua" } } RESMGR:LoadObject { objectTemplate = 6 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, rw=myrot.w, rx=myrot.x, ry=myrot.y, rz=myrot.z, configData = config } end -- Rocket Landing Head AG require('o_mis') function onCharacterUnserialized(self, msg) local player=msg.charID local mypos = self:GetPosition().pos local myrot = self:GetRotation() local config = { {"player", "|" .. player:GetID() }, { "custom_script_client" , "scripts/client/zone/NEW_ROCKET_LANDING_TAIL_AG.lua" } } RESMGR:LoadObject { objectTemplate = 6 , x = mypos.x , y = mypos.y , z = mypos.z ,owner = self, rw=myrot.w, rx=myrot.x, ry=myrot.y, rz=myrot.z, configData = config } end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"] = 3 CONSTANTS["HELP_SCREEN_TEXT"] = "SG1" -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onPlayerReady(self) self:SetVar("PlayerReady", true) -- get local player local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) -- check the tooltip flag local tooltipMsg = player:GetTooltipFlag{iToolTip = CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"]} if (tooltipMsg.bFlag == false) then -- set the tooltip? else -- fake the msgbox close to start the activity GAMEOBJ:GetZoneControlID():MessageBoxRespond{ identifier = CONSTANTS["HELP_SCREEN_TEXT"], sender = player } end end function onNotifyClientZoneObject(self,msg) -- UpDate Timer UI -- if msg.name == "count" and self:GetVar("PlayerReady") ~= nil then UI:SendMessage("ChageUI", { {"sgTimer", msg.parmar1 } }) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"] = 3 CONSTANTS["HELP_SCREEN_TEXT"] = "SG1" -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onPlayerReady(self) -- get local player local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) -- check the tooltip flag local tooltipMsg = player:GetTooltipFlag{iToolTip = CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"]} if (tooltipMsg.bFlag == false) then -- set the tooltip? else -- fake the msgbox close to start the activity GAMEOBJ:GetZoneControlID():MessageBoxRespond{ identifier = CONSTANTS["HELP_SCREEN_TEXT"], sender = player } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "Go", self ) self:SetVar("GameStarted", GAMEOBJ:GetSystemTime()) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "Go") then -- LEVEL:SetLights( -- false,0x0000ff, -- false,0x0000ff, -- false,0x0000ff, -- false,0x808000, -- false,{0.7,0.7,0.0}, -- true,-700.0, -- true,-10000.0, -- false,0x008080, -- false,"mesh/env/env_sky_won_team_ninetimes.nif" -- ) end end CONSTANTS = {} CONSTANTS["CONTROLLER_LOT"] = 2802 CONSTANTS["PLATFORM_LOT"] = 2801 CONSTANTS["MOVINGPLATFORM_LOT"] = 2800 CONSTANTS["BOUNCER_LOT"] = 2806 CONSTANTS["SPRINGPAD_LOT"] = 2807 CONSTANTS["DOORPIECE_LOT"] = 999 CONSTANTS["SMASHABLE_LOT"] = 999 CONTROLLER = {} PLAYER = {} function onStartup(self, msg) UI:SendChat{ChatString = "zone:startup", ChatType = "LOCAL", Timestamp = 500} PLAYER = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) UI:SendChat{ChatString = "zone:player is " .. PLAYER:GetID(), ChatType = "LOCAL", Timestamp = 500} end -- Register important objects when loaded function onObjectLoaded(self, msg) -- controller object loaded if (msg.templateID == CONSTANTS["CONTROLLER_LOT"]) then CONTROLLER = msg.objectID end end -- Relay the event to the C++ controller function onArcadeScoreEvent(self, msg) local objTemplate = msg.templateID if( objTemplate ~= CONSTANTS["CONTROLLER_LOT"] ) then CONTROLLER:ArcadeScoreEvent{objectID = msg.objectID} --PLAYER:PlaySound{strSoundName = "UI/Vendor_Sale" } --PLAYER:PlayAnimation{ animationID = "mf_m_g_ball-roll-reverse" } --PLAYER:Teleport end end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- -------------------------------------------------------------- -- -- INSTRUCTIONS: -- -- To use this script, you must first include it in a zone -- control object script. -- -- Then, implement the following methods and inside each one -- make sure to call the CUSTOMROCKET_* version: -- -- - onChildRenderComponentReady -- - onChildBuildAssemblyComplete -- - onAnimationFinishedPreloading -- - onTimerDone -- -- (You can choose to put your own custom stuff on your functions -- if you so choose... it won't interfere with this system) -- -- Lastly, call CUSTOMROCKET_BeginTransition with the appropriate -- parameters -- -- (see scripts/client/zone/AG/L_ZONE_AG_CLIENT.lua for an example) -- -------------------------------------------------------------- function CUSTOMROCKET_BeginTransition(self, charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) charID:SetPosition{pos = spawnPos} charID:SetRotation{x = spawnRot.x, y = spawnRot.y, z = spawnRot.z, w = spawnRot.w} charID:ActivatePhysics{bActivate = false} charID:SetVisible{visible = false, fadeTime = 0.0} local config = { {"playerID","|"..charID:GetID()}, {"cinematic", spawnCinematic}, {"transitionAnim", spawnTransitionAnim} } RESMGR:LoadObject { objectTemplate = 6398, x = spawnPos.x, y = spawnPos.y, z = spawnPos.z, rw = spawnRot.w, rx = spawnRot.x, ry = spawnRot.y, rz = spawnRot.z, owner = self, configData = config} end function CUSTOMROCKET_onChildRenderComponentReady(self, msg) if msg.childLOT == 6398 then local playerID = GAMEOBJ:GetObjectByID(msg.childID:GetVar("playerID")) --print("--------------------- (Child ID: " .. tostring(msg.childID:GetID()) .. ")") --print("--------------------- (Child LOT: " .. tostring(msg.childID:GetLOT().objtemplate) .. ")") --print("--------------------- (Player ID: " .. tostring(msg.childID:GetVar("groupID")) .. ")") --print("--------------------- (Player (Actual) ID: " .. tostring(playerID:GetID())) -- fail if the player doesn't exist anymore if (playerID:Exists() == false) then return end -- Attach whatever we last built (assumedly a rocket or similar) as the custom build to show. local lastBuildTokenList = playerID:GetLastCustomBuild().tokenizedLOTList msg.childID:SetBuildAssembly{ tokenizedLOTList = lastBuildTokenList } end end function CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) if msg.childLOT == 6398 then local playerID = GAMEOBJ:GetObjectByID(msg.childID:GetVar("playerID")) -- fail if the player doesn't exist anymore if (playerID:Exists() == false) then return end -- the animation we need to play depends on whether the owner is the local player local playerTransitionAnim if (msg.childID:GetVar("transitionAnim") ~= nil) then playerTransitionAnim = msg.childID:GetVar("transitionAnim") else playerTransitionAnim = "rocket-transition_default" end -- First, preload the anims, to get them as in-sync as we can playerID:PreloadAnimation{animationID = playerTransitionAnim, respondObjID = self, userData = { {"playerID","|"..playerID:GetID()}, {"rocketID","|"..msg.childID:GetID()} } } end end function CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) if (msg.userData["rocketID"] ~= nil) then local playerID = GAMEOBJ:GetObjectByID(msg.userData["playerID"]) local rocketID = GAMEOBJ:GetObjectByID(msg.userData["rocketID"]) -- if either the rocket or the player no longer exist, bail out if (rocketID:Exists() == false or playerID:Exists() == false) then if (playerID:Exists() and playerID:GetID() == GAMEOBJ:GetLocalCharID()) then StartZoneSummary(self) end return end -- if we've finished pre-loading the player's animation, then preload the rocket's animation next if (msg.animObjID:GetID() == playerID:GetID()) then rocketID:PreloadAnimation{animationID = msg.animationID, respondObjID = self, userData = { {"playerID","|"..msg.userData["playerID"]}, {"rocketID","|"..msg.userData["rocketID"]} } } else -- Force the player to be visible, so that it can't miss its animation calls / doesn't look funny during them playerID:PCreateEffectFinished() playerID:SetVisible{visible = true, fadeTime = 0.0} -- Enable the rocket to animate off-screen, since this is a cinematic, and off-screen is required rocketID:SetOffscreenAnimation{bAnimateOffscreen = true} playerID:SetOffscreenAnimation{bAnimateOffscreen = true} -- if we're done pre-loading animations, we're ready to kick off the final animations -- (they differ depending on if we're the local character or just another player) if (playerID:GetID() == GAMEOBJ:GetLocalCharID()) then GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "deleteLocalRocket_" .. rocketID:GetID(),self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "CustomLocalRocketTimer",self ) -- change ui state to CinematicBars UI:SendMessage( "pushGameState", {{"state", "cinematic" }} ) -- Now, start the animations playerID:PlayAnimation{animationID = msg.animationID} rocketID:PlayAnimation{animationID = msg.animationID} if (rocketID:GetVar("cinematic") ~= nil) then playerID:PlayCinematic { pathName = rocketID:GetVar("cinematic") } end else GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "deleteOtherRocket_" .. rocketID:GetID() .. "_" .. playerID:GetID(), self ) -- Now, start the animations playerID:PlayAnimation{animationID = msg.animationID} rocketID:PlayAnimation{animationID = msg.animationID} end end end end function CUSTOMROCKET_onTimerDone(self, msg) if (string.find(msg.name, "deleteLocalRocket") ~= nil) then objids = {} for w in string.gmatch(msg.name, "%d+") do objids[#objids + 1] = w end GAMEOBJ:DeleteObject(GAMEOBJ:GetObjectByID(objids[1])) StartZoneSummary(self) end if (string.find(msg.name, "deleteOtherRocket") ~= nil) then objids = {} for w in string.gmatch(msg.name, "%d+") do objids[#objids + 1] = w end EndOtherCharacterTransition(self, GAMEOBJ:GetObjectByID(objids[1]), GAMEOBJ:GetObjectByID(objids[2])) end end ---------------------------------------------------------------------------- -- Begin Custom Helper Functions (local just to the custom rocket intro): ---------------------------------------------------------------------------- -- Kick off the Zone Intro UI, mark the transition as complete function StartZoneSummary(self) -- change ui state to normal UI:SendMessage( "popGameState", {{"state", "cinematic"}} ) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- set flag to true so we know the player has already done this player:SetFlag{iFlagID = 32, bFlag = true} -- reactivate their physics player:ActivatePhysics{bActivate = true} -- display zone summary player:DisplayZoneSummary{sender = self, isZoneStart = true} end -- function to call when any non-local characters finish their rocket transitions function EndOtherCharacterTransition(self,rocketID,playerID) --print("EndOtherCharTransition: Found RocketID " .. tostring(rocketID:GetID())) --print("EndOtherCharTransition: Found PlayerID " .. tostring(playerID:GetID())) if (playerID:Exists()) then playerID:SetOffscreenAnimation{bAnimateOffscreen = false} playerID:ActivatePhysics{bActivate = true} end GAMEOBJ:DeleteObject(rocketID) end require('o_mis') function onStartup(self) self:SetVar("GameStarted", GAMEOBJ:GetSystemTime()) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onStartup(self) local player = getObjectByName(self,"player") if (player:CharacterNeedsTransition{}.bNeedsTransition == false) then if GAMEOBJ:GetLocalCharID() == player:GetID() then StartZoneSummary(self) end return end local charPosition = player:GetPosition().pos local charRotation = player:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = charRotation spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" -- other players always use the default transition animation, regardless if (player:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, player, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onStartup(self) local player = getObjectByName(self,"player") if (player:CharacterNeedsTransition{}.bNeedsTransition == false) then if GAMEOBJ:GetLocalCharID() == player:GetID() then StartZoneSummary(self) end return end local charPosition = player:GetPosition().pos local charRotation = player:GetRotation() local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim spawnPos = {x = charPosition.x, y = charPosition.y, z = charPosition.z} spawnRot = charRotation spawnCinematic = "LandingCine_" .. sceneID spawnTransitionAnim = "rocket-transition_default" if sceneID == 2 then spawnTransitionAnim = "rocket-transition_AG" end -- if sceneID == 4 then -- spawnPos = {x = 540.89, y = 404.03, z = 98.5} -- spawnRot = {x = 0, y = -0.2927, z = 0, w = 0.9562} -- else -- spawnPos = {x = -407.78, y = 348.84, z = -157.66} -- spawnRot = {x = 0, y = 0.804, z = 0, w = 0.594} -- end -- other players always use the default transition animation, regardless if (player:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, player, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -- these scripts contain specific scene functionality for the client zone object require('client/zone/AG/L_ZONE_AG_KIPPER_DUEL_CLIENT') -- Actor storage by scene for zone ACTORS = {} -------------------------------------------------------------- -- Clears all actors data -------------------------------------------------------------- function ClearActorsData() ACTORS = {} ACTORS["KipperDuel"] = {} end -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) ClearActorsData() -- Scene Specific onStartupKipperDuel(self) end -------------------------------------------------------------- -- Generic message from a specific object -------------------------------------------------------------- function onFireEvent( self, msg ) -- object is telling us it is ready and to set its scene state -- based on the completion of a scene if ( msg.args == "ActorReadyKipperDuel" ) then ActorReadyKipperDuel( self, msg.senderID ) elseif ( msg.args == "ModelReadyKipperDuel" ) then ModelReadyKipperDuel( self, msg.senderID ) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- Scene Specific onChildLoadedKipperDuel( self, msg ) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function( self, msg ) -- Scene Specific onTimerDoneKipperDuel( self, msg ) end -------------------------------------------------------------- -- Nimbus Park - Scene 1 Specific Client Zone Script Functions -------------------------------------------------------------- function Scene1Startup(self) end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function Scene1OnChildLoaded(self, msg) --if msg.templateID == then --elseif msg.templateID == then --end for index = 1, #CONSTANTS["SCENE_1_WIZARD_BATTLE_LOTS"] do if msg.templateID == CONSTANTS["SCENE_1_WIZARD_BATTLE_LOTS"][index] then storeObjectByName(self, "BattleObject", msg.childID) end end end -------------------------------------------------------------- -- Generic notification message -------------------------------------------------------------- function Scene1OnNotifyObject(self, msg) --if msg.name == then --elseif msg.name == then --end end -------------------------------------------------------------- -- Called when Player Ready from loading into zone -------------------------------------------------------------- function Scene1OnPlayerReady(self, msg) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function Scene1OnTimerDone(self, msg) if verifyActors(self) then if msg.name == "Wizard1Cast" then GAMEOBJ:GetTimer():AddTimerWithCancel( 1.2, "spawnBattleObject",self ) local obj = getObjectByName(self, "Scene1Wizard1") obj:PlayAnimation{animationID = "cast"} local num = math.random(1,#CONSTANTS["WIZARD_CAST_TEXT"]) obj:DisplayChatBubble{wsText = CONSTANTS["WIZARD_CAST_TEXT"][num]} GAMEOBJ:GetTimer():AddTimerWithCancel( 7.0, "Wizard1Cast",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.5, "Wizard2Cast",self ) elseif msg.name == "Wizard2Cast" then GAMEOBJ:GetTimer():AddTimerWithCancel( 1.2, "spawnBattleObject",self ) local obj = getObjectByName(self, "Scene1Wizard2") obj:PlayAnimation{animationID = "cast"} local num = math.random(1,#CONSTANTS["WIZARD_CAST_TEXT"]) obj:DisplayChatBubble{wsText = CONSTANTS["WIZARD_CAST_TEXT"][num]} elseif msg.name == "spawnBattleObject" then spawnBattleObject(self) end end end function Scene1OnObjectLoaded(self, msg) end -------------------------------------------------------------- -- Called when zone object gets an onFireEvent for "SceneActorReady" -- event. -------------------------------------------------------------- function Scene1ActorReady(self, actor) if actor:GetLOT().objtemplate == CONSTANTS["SCENE_1_WIZARD_1_LOT"] then storeObjectByName(self, "Scene1Wizard1", actor) GAMEOBJ:GetTimer():AddTimerWithCancel( 5.0, "Wizard1Cast",self ) elseif actor:GetLOT().objtemplate == CONSTANTS["SCENE_1_WIZARD_2_LOT"] then storeObjectByName(self, "Scene1Wizard2", actor) end end local curBattleIndex = 0 function spawnBattleObject(self) if verifyActors(self) then if getObjectByName(self, "BattleObject") then getObjectByName(self, "BattleObject"):Die{}--killType = "SILENT"} end local newIndex = math.random(#CONSTANTS["SCENE_1_WIZARD_BATTLE_LOTS"]) while curBattleIndex == newIndex do newIndex = math.random(#CONSTANTS["SCENE_1_WIZARD_BATTLE_LOTS"]) end curBattleIndex = newIndex local pos = calcSpawnPoint(self) local battleLOT = CONSTANTS["SCENE_1_WIZARD_BATTLE_LOTS"][curBattleIndex] --print("spawning object: " .. CONSTANTS["SCENE_1_WIZARD_BATTLE_LOTS"][1] .. " at " .. tostring(posMsg.x) .. " " .. tostring(posMsg.y) .. " " .. tostring(posMsg.z)) --print (battleLOT) RESMGR:LoadObject { objectTemplate = battleLOT, bIsSmashable = true, x = pos.x, y = pos.y, z = pos.z, owner = self } else print("actors unverified!") end end function calcSpawnPoint(self) local pos1 = getObjectByName(self, "Scene1Wizard1"):GetPosition().pos local pos2 = getObjectByName(self, "Scene1Wizard2"):GetPosition().pos local finalPos = {x = (pos2.x - pos1.x)/2 + pos1.x, y = (pos2.y - pos1.y)/2 + pos1.y, z = (pos2.z - pos1.z)/2 + pos1.z} return finalPos end function verifyActors(self) if getObjectByName(self, "Scene1Wizard1") and getObjectByName(self, "Scene1Wizard2") then if getObjectByName(self, "Scene1Wizard1"):Exists() and getObjectByName(self, "Scene1Wizard2"):Exists() then return true end end if getObjectByName(self, "BattleObject") then getObjectByName(self, "BattleObject"):Die{}--killType = "SILENT"} end return false end-------------------------------------------------------------- -- Nimbus Park - Scene 2 Specific Client Zone Script Functions -------------------------------------------------------------- function Scene2Startup(self) -- var to record if scene 2 has been completed, so we can setup animations and effects self:SetVar("Scene2Complete", false) -- load Mission State information -- Mission 1 (collection) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], MISSION_COMPLETE, function(self) local doNothing = 0 end) end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function Scene2OnChildLoaded(self, msg) --[[ -- Do scene 2 stuff if (msg.templateID == CONSTANTS["SCENE_2_METEOR_LOT"]) then -- get the platform moving msg.childID:SetMovingPlatformParams{ wsPlatformPath = CONSTANTS["SCENE_2_METEOR_PATH"], iStartIndex = 0 } elseif (msg.templateID == CONSTANTS["SCENE_2_METEOR_SHARD_LOT"]) then -- get the platform moving msg.childID:SetMovingPlatformParams{ wsPlatformPath = CONSTANTS["SCENE_2_METEOR_SHARD_PATH"], iStartIndex = 0 } elseif (msg.templateID == CONSTANTS["SCENE_2_CAMERA_LOT"]) then -- give the camera path data, and start it moving msg.childID:SetVar("camPath", CONSTANTS["SCENE_2_CAMERA_PATH"]) msg.childID:NotifyObject{ name = "startCam", param1 = 2 } end --]] end -------------------------------------------------------------- -- Generic notification message -------------------------------------------------------------- function Scene2OnNotifyObject(self, msg) -- the scene mission has been completed if (msg.name == "scene_2_mission_1_complete") then -- trigger the 'building' state DoSceneAction(2, "stopeffects") DoSceneAction(2, "effect", "building") -- timer to trigger next state after build GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["SCENE_2_MONUMENT_BUILD_TIME"], "MonumentBuildDone",self ) -- the trigger was hit to start the scene elseif (msg.name == "scene_2_start") then -- pause player local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} -- start cinematic player:PlayCinematic{ pathName = "MeteorPath_01" } DoSceneAction(2, "anim", "scene") -- timer to delay player teleport and animation GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "PlayerTeleAndAnimate",self ) -- timer to break the monument based on animations GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["SCENE_2_CINE_TIMING_STATUE_HIT"], "BreakMonument",self ) -- timer to end cinematic GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["SCENE_2_CINE_LENGTH"], "CinematicEnd",self ) --[[ -- Load Camera Object RESMGR:LoadObject { objectTemplate = CONSTANTS["SCENE_2_CAMERA_LOT"], x = 142, y = 275, z = -342, owner = self } -- Load Meteor RESMGR:LoadObject { objectTemplate = CONSTANTS["SCENE_2_METEOR_LOT"], x = 142, y = 275, z = -342, owner = self } -- Load Shard RESMGR:LoadObject { objectTemplate = CONSTANTS["SCENE_2_METEOR_SHARD_LOT"], x = 142, y = 275, z = -342, owner = self } -- @TODO: OnCollision/play animation on monument (breaking) --]] -- the cinematic has ended elseif (msg.name == "scene_2_end") then -- unpause player local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} --[[ elseif (msg.name == "meteor_path_complete") then -- if the object is the shard if (msg.param1 == CONSTANTS["SCENE_2_METEOR_SHARD_LOT"]) then DoSceneAction(2, "stopeffects") DoSceneAction(2, "effect", "breaking") -- timer to trigger next state after build GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["SCENE_2_MONUMENT_BREAK_TIME"], "MonumentBreakDone",self ) end --]] end end -------------------------------------------------------------- -- Called when Player Ready from loading into zone -------------------------------------------------------------- function Scene2OnPlayerReady(self, msg) -- if local character is ready local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (GAMEOBJ:GetLocalCharID() ~= CONSTANTS["NO_OBJECT"]) then -- check for mission state help local m1 = player:GetMissionState{ missionID = CONSTANTS["SCENE_2_MISSION_1_ID"] } local bMissionComplete = ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_2_MISSION_1_ID"], m1.missionState) -- get tooltip flag for this event local tooltipMsg = player:GetTooltipFlag{ iToolTip = CONSTANTS["SCENE_2_EVENT_FLAG_BIT"] } -- if the player has NOT seen the event OR the player has completed the mission if ((tooltipMsg) and (tooltipMsg.bFlag == false)) or (bMissionComplete == true) then DoSceneAction(2, "effect", "working") else DoSceneAction(2, "effect", "broken") end end end -------------------------------------------------------------- -- Called when zone object gets an onFireEvent for "SceneActorReady" -- event. -------------------------------------------------------------- function Scene2ActorReady(self, actor) -- If this is a valid actor and the scene is complete local bScene2Complete = self:GetVar("Scene2Complete") if ( IsValidActor(2, actor:GetLOT().objtemplate) == true ) then -- set the state of the scene if (bScene2Complete == true) then DoSceneAction(2, "effect", "working") else DoSceneAction(2, "effect", "broken") end end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function Scene2OnTimerDone(self, msg) if (msg.name == "MonumentBuildDone") then DoSceneAction(2, "stopeffects") DoSceneAction(2, "effect", "working") elseif (msg.name == "MonumentBreakDone") then DoSceneAction(2, "stopeffects") DoSceneAction(2, "effect", "broken") elseif (msg.name == "BreakMonument") then DoSceneAction(2, "stopeffects") DoSceneAction(2, "effect", "breaking") -- timer to trigger next state after build GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["SCENE_2_MONUMENT_BREAK_TIME"], "MonumentBreakDone",self ) -- the cinematic has ended elseif (msg.name == "CinematicEnd") then -- unpause player local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} elseif (msg.name == "PlayerTeleAndAnimate") then -- teleport the player to the right location in the scene local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:Teleport{ pos = CONSTANTS["SCENE_2_PLAYER_CINE_POS"], x = CONSTANTS["SCENE_2_PLAYER_CINE_ROT"].x, y = CONSTANTS["SCENE_2_PLAYER_CINE_ROT"].y, z = CONSTANTS["SCENE_2_PLAYER_CINE_ROT"].z, w = CONSTANTS["SCENE_2_PLAYER_CINE_ROT"].w, bSetRotation = true, bIgnoreY = true } -- play an animation on the player player:PlayAnimation{ animationID = "meteor-reaction" } end end -------------------------------------------------------------- -- Nimbus Park - Scene 3 Specific Client Zone Script Functions -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function Scene3Startup(self) -- var to record if scene 3 has been completed, so we can setup animations and effects self:SetVar("Scene3Complete", false) -- load Mission State information -- Mission 4 (dance for me) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_READY_TO_COMPLETE, function(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_3_mission_4_ready_to_complete" } end) AddMissionHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], MISSION_COMPLETE, function(self) GAMEOBJ:GetZoneControlID():NotifyObject{ name="scene_3_mission_4_ready_to_complete" } end) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function Scene3OnTimerDone(self, msg) if (msg.name == "BBlockDance") then DoSceneAction(3,"anim","start") end end -------------------------------------------------------------- -- Called when Player Ready from loading into zone -------------------------------------------------------------- function Scene3OnPlayerReady(self, msg) -- if local character is ready local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (GAMEOBJ:GetLocalCharID() ~= CONSTANTS["NO_OBJECT"]) then -- check for mission state help, this will setup the scene local m4 = player:GetMissionState{ missionID = CONSTANTS["SCENE_3_MISSION_4_ID"] } ActivateHelp(self, MISSION_DATA, CONSTANTS["SCENE_3_MISSION_4_ID"], m4.missionState) end end -------------------------------------------------------------- -- Called when zone object gets an onFireEvent for "SceneActorReady" -- event. -------------------------------------------------------------- function Scene3ActorReady(self, actor) -- If this is a valid actor and the scene is complete local bScene3Complete = self:GetVar("Scene3Complete") if ( bScene3Complete == true and IsValidActor(3, actor:GetLOT().objtemplate) == true ) then -- start any concert effects DoObjectAction(actor,"effect","concert") -- play cheer animations on actors DoObjectAction(actor,"anim","cheer") -- see what scene this object is for DoObjectAction(actor,"anim","start") end end -------------------------------------------------------------- -- Generic notification message -------------------------------------------------------------- function Scene3OnNotifyObject(self, msg) -- mic returned if (msg.name == "scene_3_mission_3_complete") then -- DoSceneAction(3,"anim","cheer") elseif (msg.name == "scene_3_mission_4_accept") then DoSceneAction(3,"anim","wait") elseif (msg.name == "scene_3_mission_4_ready_to_complete") then -- set state of the scene self:SetVar("Scene3Complete", true) -- start any concert effects DoSceneAction(3,"effect","concert") -- play cheer animations on actors DoSceneAction(3,"anim","cheer") -- play pump animations on bboys DoSceneAction(3,"anim","pump") -- start a timer to trigger dancing/singing animations on bboys when pump is complete GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["SCENE_3_BBOY_DANCE_DELAY"], "BBlockDance",self ) elseif (msg.name == "scene_3_mission_4_complete") then -- DoSceneAction(3,"anim","breakdance") end end-------------------------------------------------------------- -- Nimbus Park - Scene 4 Specific Client Zone Script Functions -------------------------------------------------------------- local courseCollectables = {} local numCollectables = 0 local numCollected = 0 local numBigCollected = 0 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function Scene4Startup(self) self:SetVar("IsPlayerInCourse", false) end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function Scene4OnChildLoaded(self, msg) if (msg.templateID == CONSTANTS["CollectableTemplate"]) or (msg.templateID == CONSTANTS["BigCollectableTemplate"]) then numCollectables = numCollectables + 1 courseCollectables[numCollectables] = msg.childID end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function Scene4OnObjectLoaded(self, msg) -- check for scene 4 course LOTs if (msg.templateID == CONSTANTS["COURSE_STARTER_LOT"]) then storeObjectByName(self, "CourseStarter", msg.objectID) end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function Scene4OnTimerDone(self, msg) if (msg.name == "CourseGo") then -- unpause player local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = false} -- record start time local startTime = GAMEOBJ:GetSystemTime() self:SetVar("CourseStartTime", startTime) end end -------------------------------------------------------------- -- Shuts down the course -------------------------------------------------------------- function Scene4CourseShutdown(self, msg) for i = 1, #courseCollectables do if courseCollectables[i]:Exists() then GAMEOBJ:DeleteObject(courseCollectables[i]) end end numCollectables = 0 numCollected = 0 numBigCollected = 0 end -------------------------------------------------------------- -- Starts the course -------------------------------------------------------------- function Scene4CourseStartup(self) local pathMsg = LEVEL:GetPathWaypoints(CONSTANTS["CollectablePath"]) if (tostring(type(pathMsg)) == "table") then for i, v in pairs(pathMsg) do RESMGR:LoadObject { objectTemplate = CONSTANTS["CollectableTemplate"], bIsSmashable = false, x = v.pos.x, y = v.pos.y, z = v.pos.z, rw = v.rot.w, rx = v.rot.x, ry = v.rot.y, rz = v.rot.z, owner = self } end end pathMsg = LEVEL:GetPathWaypoints(CONSTANTS["BigCollectablePath"]) if (tostring(type(pathMsg)) == "table") then for i, v in pairs(pathMsg) do RESMGR:LoadObject { objectTemplate = CONSTANTS["BigCollectableTemplate"], bIsSmashable = false, x = v.pos.x, y = v.pos.y, z = v.pos.z, rw = v.rot.w, rx = v.rot.x, ry = v.rot.y, rz = v.rot.z, owner = self } end end end -------------------------------------------------------------- -- Generic notification message -------------------------------------------------------------- function Scene4OnNotifyObject(self, msg) -- Scene 4 Course Triggers, player must be in course if (self:GetVar("IsPlayerInCourse") == true) then if (msg.name == "scene_4_course_cancel") then -- cancel the course self:SetVar("IsPlayerInCourse", false) --clean up the course Scene4CourseShutdown(self, msg) local starter = getObjectByName(self,"CourseStarter") if (starter) then starter:SetVar("IsPlayerInCourse", false) end UI:DisplayToolTip { strDialogText = CONSTANTS["COURSE_OUT_OF_RANGE_TEXT"], strImageName = "", bShow = true, iTime = CONSTANTS["COURSE_OUT_OF_RANGE_MSG_SHOW_TIME"] } elseif (msg.name == "scene_4_course_finish") then -- record the time local startTime = self:GetVar("CourseStartTime") local endTime = GAMEOBJ:GetSystemTime() local totalTime = tonumber(endTime) - tonumber(startTime) local modifiedTotal = totalTime - numCollected * tonumber(CONSTANTS["CollectableTimeAdded"]) - numBigCollected * tonumber(CONSTANTS["BigCollectableTimeAdded"]) --numCollected * 2 seconds if modifiedTotal <= 10 then modifiedTotal = 10 end -- finish the course self:SetVar("IsPlayerInCourse", false) --clean up the course Scene4CourseShutdown(self, msg) -- send details to the starter local starter = getObjectByName(self,"CourseStarter") if (starter) then starter:SetVar("IsPlayerInCourse", false) -- check for best time change local curBestTime = tonumber(starter:GetVar("PlayerBestTime")) if ( (totalTime < curBestTime) or (curBestTime == 0) ) then starter:SetVar("PlayerBestTime",modifiedTotal) end end -- inform the player UI:DisplayToolTip { strDialogText = CONSTANTS["COURSE_FINISH_TEXT"] .. " " .. ParseTime(totalTime) .. " " .. CONSTANTS["COURSE_FINISH_TEXT2"] .. " " .. ParseTime(modifiedTotal), strImageName = "", bShow = true, iTime = CONSTANTS["COURSE_FINISH_MSG_SHOW_TIME"] } elseif msg.name == "CollectableCollected" then numCollected = numCollected + 1 elseif msg.name == "BigCollectableCollected" then numBigCollected = numBigCollected + 1 end end -- start a new course, must not be in one already if (msg.name == "scene_4_course_start" and self:GetVar("IsPlayerInCourse") == false) then -- pause player local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetUserCtrlCompPause{bPaused = true} -- start the course self:SetVar("IsPlayerInCourse", true) local starter = getObjectByName(self,"CourseStarter") if (starter) then starter:SetVar("IsPlayerInCourse", true) end -- trigger the Countdown player:ShowActivityCountdown { bPlayCountdownSound = false, bPlayAdditionalSound = false, } -- set a timer to Unpause and Go GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["COUNTDOWN_TIME"], "CourseGo", self ) Scene4CourseStartup(self) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- -- these scripts contain specific scene functionality for the client zone object --require('client/zone/NS/L_ZONE_NS_KIPPER_DUEL_CLIENT') require('client/zone/L_ZONE_CUSTOM_ROCKET_INTRO') -- Actor storage by scene for zone ACTORS = {} -------------------------------------------------------------- -- Clears all actors data -------------------------------------------------------------- --function ClearActorsData() -- ACTORS = {} -- ACTORS["KipperDuel"] = {} --end -------------------------------------------------------------- -- Startup -------------------------------------------------------------- --function onStartup(self) -- ClearActorsData() -- -- Scene Specific -- onStartupKipperDuel(self) --end -------------------------------------------------------------- -- return if template is a valid actor -------------------------------------------------------------- --function IsValidActor( sceneName, templateID ) -- local sceneStr = "sceneName" .. "_VALID_ACTORS" -- -- list of actors does not exist -- if ( CONSTANTS[ sceneStr ] == nil ) then -- return false -- end -- -- look for a valid actor -- for actorLOT = 1, #CONSTANTS[ sceneStr ] do -- if ( templateID == CONSTANTS[sceneStr][actorLOT] ) then -- return true -- end -- end -- return false --end -------------------------------------------------------------- -- Generic message from a specific object -------------------------------------------------------------- --function onFireEvent( self, msg ) -- -- object is telling us it is ready and to set its scene state -- -- based on the completion of a scene -- if ( msg.args == "ActorReadyKipperDuel" ) then -- --print( "client-side zone script - onFireEvent - ActorReadyKipperDuel" ) -- ActorReadyKipperDuel( self, msg.senderID ) -- elseif ( msg.args == "ModelReadyKipperDuel" ) then -- ModelReadyKipperDuel( self, msg.senderID ) -- end --end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- --function onChildLoaded(self, msg) -- -- Scene Specific -- onChildLoadedKipperDuel( self, msg ) --end -------------------------------------------------------------- -- Creating rocket for transition -------------------------------------------------------------- function onCharacterUnserialized(self, msg) if (msg.charID:CharacterNeedsTransition{}.bNeedsTransition == false) then return end --print("ROCKET TRANSITION BEGIN: PLAYER ID " .. tostring(msg.charID:GetID()) .. " !!!!!") local charPosition = msg.charID:GetPosition().pos local sceneID = LEVEL:GetSceneAtPos( charPosition ) local spawnPos local spawnRot local spawnCinematic local spawnTransitionAnim if sceneID == 4 then spawnPos = {x = 540.89, y = 406.03, z = 98.5} spawnRot = {x = 0, y = -0.2927, z = 0, w = 0.9562} spawnCinematic = "" spawnTransitionAnim = "rocket-transition_default" else spawnPos = {x = -136.11, y = 285.39, z = 209.43} spawnRot = {x = 0, y = 145, z = 0, w = 0} spawnCinematic = "Landing_From_AG" spawnTransitionAnim = "rocket-transition_AG" end -- other players always use the default transition animation, regardless if (msg.charID:GetID() ~= GAMEOBJ:GetLocalCharID()) then spawnTransitionAnim = "rocket-transition_default" end CUSTOMROCKET_BeginTransition(self, msg.charID, spawnPos, spawnRot, spawnCinematic, spawnTransitionAnim) end -------------------------------------------------------------- -- Rocket Rebuild Script -------------------------------------------------------------- function onChildRenderComponentReady(self, msg) CUSTOMROCKET_onChildRenderComponentReady(self, msg) end function onChildBuildAssemblyComplete(self, msg) CUSTOMROCKET_onChildBuildAssemblyComplete(self, msg) end function onAnimationFinishedPreloading(self, msg) CUSTOMROCKET_onAnimationFinishedPreloading(self, msg) end function onTimerDone(self, msg) -- Scene Specific Kipper Dual onTimerDoneKipperDuel( self, msg ) CUSTOMROCKET_onTimerDone(self, msg) -- (formerly was "FacialAnimationFocused", but it was renamed to make it generic and usable by more scripts) if (msg.name == "CustomLocalRocketTimer") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 1.16, "FacialAnimationShocked",self ) end if (msg.name == "FacialAnimationShocked") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 2.36, "FacialAnimationAngry",self ) end if (msg.name == "FacialAnimationAngry") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Angry", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.36, "FacialAnimationBlink02",self ) end if (msg.name == "FacialAnimationBlink02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 7.56, "FacialAnimationShocked02",self ) end if (msg.name == "FacialAnimationShocked02") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.77, "FacialAnimationBlink03",self ) end if (msg.name == "FacialAnimationBlink03") then local localChar = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) localChar:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- which of the two NPC's is associated with the transformations named 1_ and which with the transformations named 2_ -- this is determined by a flag set in scripts \ c_AvantGardens.lua if ( CONSTANTS["KIPPER_DUEL_SENTINEL_GOES_FIRST"] == true ) then CONSTANTS["ORDER_SENTINEL"] = 1 CONSTANTS["ORDER_PARADOX"] = 2 else CONSTANTS["ORDER_PARADOX"] = 1 CONSTANTS["ORDER_SENTINEL"] = 2 end -- after sending the load request for a model, how long to wait before the assemly NPC comments on the transformation CONSTANTS["COMMENTARY_DELAY"] = 0.25 -- the order in which the different models get transformed -- the number in front represents which of the 2 competing objects changes TRANSFORMATIONS = {} TRANSFORMATIONS["1_NOTHING_TO_MOUSE"] = 1 TRANSFORMATIONS["2_NOTHING_TO_CAT"] = 2 TRANSFORMATIONS["1_MOUSE_TO_DOG"] = 3 TRANSFORMATIONS["2_CAT_TO_DRAGON"] = 4 TRANSFORMATIONS["1_DOG_TO_FIRE_ENGINE"] = 5 TRANSFORMATIONS["2_DRAGON_TO_SUBMARINE"] = 6 TRANSFORMATIONS["1_FIRE_ENGINE_TO_KIPPER"] = 7 TRANSFORMATIONS["2_SUBMARINE_TO_ELEPHANT"] = 8 TRANSFORMATIONS["1_KIPPER_TO_MOUSE"] = 9 TRANSFORMATIONS["2_ELEPHANT_TO_CAT"] = 10 TRANSFORMATIONS["NOT_STARTED"] = 0 TRANSFORMATIONS["START_FROM_NOTHING"] = TRANSFORMATIONS["1_NOTHING_TO_MOUSE"] TRANSFORMATIONS["FIRST_LOOPING"] = TRANSFORMATIONS["1_MOUSE_TO_DOG"] TRANSFORMATIONS["LAST_LOOPING"] = TRANSFORMATIONS["2_ELEPHANT_TO_CAT"] -- the LOT for the model produced by each transformation MODEL_LOTS = {} MODEL_LOTS[TRANSFORMATIONS["1_NOTHING_TO_MOUSE"] ] = CONSTANTS["KIPPER_DUEL_MOUSE_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_NOTHING_TO_CAT"]] = CONSTANTS["KIPPER_DUEL_CAT_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_MOUSE_TO_DOG"]] = CONSTANTS["KIPPER_DUEL_DOG_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_CAT_TO_DRAGON"]] = CONSTANTS["KIPPER_DUEL_DRAGON_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_DOG_TO_FIRE_ENGINE"]] = CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_DRAGON_TO_SUBMARINE"]] = CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_FIRE_ENGINE_TO_KIPPER"]] = CONSTANTS["KIPPER_DUEL_KIPPER_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_SUBMARINE_TO_ELEPHANT"]] = CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"] MODEL_LOTS[TRANSFORMATIONS["1_KIPPER_TO_MOUSE"]] = CONSTANTS["KIPPER_DUEL_MOUSE_LOT"] MODEL_LOTS[TRANSFORMATIONS["2_ELEPHANT_TO_CAT"]] = CONSTANTS["KIPPER_DUEL_CAT_LOT"] -- which NPC ( 1 or 2 ) is the owner of each transformation OWNER_NUMS = {} OWNER_NUMS[TRANSFORMATIONS["1_NOTHING_TO_MOUSE"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_NOTHING_TO_CAT"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_MOUSE_TO_DOG"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_CAT_TO_DRAGON"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_DOG_TO_FIRE_ENGINE"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_DRAGON_TO_SUBMARINE"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_FIRE_ENGINE_TO_KIPPER"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_SUBMARINE_TO_ELEPHANT"]] = 2 OWNER_NUMS[TRANSFORMATIONS["1_KIPPER_TO_MOUSE"]] = 1 OWNER_NUMS[TRANSFORMATIONS["2_ELEPHANT_TO_CAT"]] = 2 -- how close to the corresponding NPC to place the model -- (compared to the whole distance between the 2 NPC's ) CONSTANTS["DISTANCE_FACTOR"] = 7.0 / 24.0 -- half way between 1/3 of the way and 1/4 of the way -- the LOTs for the dummy models used to start us off -- these transform into the mouse and cat CONSTANTS["KIPPER_DUEL_DUMMY_MOUSE_LOT"] = 4966 CONSTANTS["KIPPER_DUEL_DUMMY_CAT_LOT"] = 4973 -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartupKipperDuel(self) self:SetVar("currentTransformation", TRANSFORMATIONS["NOT_STARTED"] ) end -------------------------------------------------------------- -- Called when zone object gets an onFireEvent for "ActorReadyKipperDuel" -- because the render component just became ready for one of the NPC's -------------------------------------------------------------- function ActorReadyKipperDuel( self, actor ) local LOT = actor:GetLOT().objtemplate if ( LOT == CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"] ) then storeObjectByName( self, "KipperDuelSentinelNPC", actor ) elseif ( LOT == CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"] ) then storeObjectByName( self, "KipperDuelParadoxNPC", actor ) elseif( LOT == CONSTANTS["KIPPER_SPECTATOR_ASSEMBLY_NPC_LOT"] ) then storeObjectByName( self, "KipperSpectatorAssemblyNPC", actor ) end -- if all 3 actors are now ready, set up a timer to set off the whole duel if ( VerifyActors( self ) ) then SpawnInvisibleStartingModels( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["KIPPER_DUEL_TIME_BETWEEN_MODELS"], "nextTransformation", self ) end end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDoneKipperDuel( self, msg ) if ( msg.name == "nextTransformation" ) then DoNextTransformation( self ) elseif ( msg.name == "commentary" ) then ShowSpectatorCommentary( self ) end end -------------------------------------------------------------- -- set the transformation number to the next one in the progression -------------------------------------------------------------- function IncrementTransformationNum( self ) -- check which transformation was done last local curTransformation = self:GetVar( "currentTransformation" ) -- if we haven't started yet, start with the 2 transformations from nothing if ( curTransformation == TRANSFORMATIONS["NOT_STARTED"] ) then self:SetVar("currentTransformation", TRANSFORMATIONS["START_FROM_NOTHING"] ) -- if both objects have cycled back to their first incarnations, then restart the chain of transformations -- (skip the transformations from nothing) elseif ( curTransformation == TRANSFORMATIONS["LAST_LOOPING"] ) then self:SetVar("currentTransformation", TRANSFORMATIONS["FIRST_LOOPING"] ) -- otherwise, just go to the next transformation in order else self:SetVar("currentTransformation", curTransformation + 1 ) end end -------------------------------------------------------------- -- returns whether the stored objects are valid actors for the kipper duel -------------------------------------------------------------- function VerifyActors(self) if ( getObjectByName( self, "KipperDuelSentinelNPC" ) and getObjectByName( self, "KipperDuelParadoxNPC" ) and getObjectByName( self, "KipperSpectatorAssemblyNPC" ) ) then if ( getObjectByName( self, "KipperDuelSentinelNPC" ):Exists() and getObjectByName( self, "KipperDuelParadoxNPC" ):Exists() and getObjectByName( self, "KipperSpectatorAssemblyNPC" ):Exists() ) then return true end end return false end -------------------------------------------------------------- -- transform the existing model into a new one -------------------------------------------------------------- function DoNextTransformation( self ) if ( VerifyActors(self) == false ) then return end -- figure out which transformation is due IncrementTransformationNum( self ) --print( "incremented transformation num to " .. self:GetVar("currentTransformation" ) ) -- ask the LWOChangelingComponent to transform it into the one we need now TransformModel( self ) end -------------------------------------------------------------- -- returns whether the current transformation number affects model 1 or 2 -------------------------------------------------------------- function GetChanglingModelNum( self ) -- return whether the current transformation is on the 1st or 2nd model local curTransformation = self:GetVar( "currentTransformation" ) return OWNER_NUMS[curTransformation] end -------------------------------------------------------------- -- returns whether or not the current model belongs to the Sentinel NPC -- if not, it belongs to the Paradox NPC -------------------------------------------------------------- function ModelBelongsToSentinelNPC( self ) local modelNum = GetChanglingModelNum( self ) if ( modelNum == CONSTANTS["ORDER_SENTINEL"] ) then return true else return false end end -------------------------------------------------------------- -- have the Assembly NPC comment on the last transformation -------------------------------------------------------------- function ShowSpectatorCommentary( self ) if ( VerifyActors(self) == false ) then return end MakeSpectatorWatch( self ) local assemblyObj = getObjectByName( self, "KipperSpectatorAssemblyNPC" ) local modelLOT = GetCurrentModelLOT( self ) -- send a notification to the assembly NPC with the LOT for the model to comment on -- this goes through to scripts \ client \ ai \ AG \ L_AG_KIPPER_SPECTATOR_NPC_CLIENT.lua assemblyObj:NotifyObject{ name = "CommentOnTransformation", param1 = modelLOT } end -------------------------------------------------------------- -- get the LOT for the model produced by the current transformation -------------------------------------------------------------- function GetCurrentModelLOT( self ) local curTransformation = self:GetVar( "currentTransformation" ) return MODEL_LOTS[curTransformation] end -------------------------------------------------------------- -- ask the LWOChangelingBuildComponent to transform the current model into the one we want now -------------------------------------------------------------- function TransformModel( self ) local SentinelObj = getObjectByName( self, "KipperDuelSentinelNPC" ) local ParadoxObj = getObjectByName( self, "KipperDuelParadoxNPC" ) local targetLOT = GetCurrentModelLOT( self ) if ( GetChanglingModelNum( self ) == 1 ) then if ( getObjectByName( self, "changlingModel_1" ) ) then if ( ModelBelongsToSentinelNPC( self ) == true ) then --print( "sentinel transforms model 1 into " .. targetLOT ) getObjectByName( self, "changlingModel_1" ):TransformChangelingBuild{ listenerID = self, miniFigID = SentinelObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } else --print( "paradox transforms model 1 into " .. targetLOT ) getObjectByName( self, "changlingModel_1" ):TransformChangelingBuild{ listenerID = self, miniFigID = ParadoxObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } end end else -- model 2 if ( getObjectByName( self, "changlingModel_2" ) ) then if ( ModelBelongsToSentinelNPC( self ) == true ) then --print( "sentinel transforms model 2 into " .. targetLOT ) getObjectByName( self, "changlingModel_2" ):TransformChangelingBuild{ listenerID = self, miniFigID = SentinelObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } else --print( "paradox transforms model 2 into " .. targetLOT ) getObjectByName( self, "changlingModel_2" ):TransformChangelingBuild{ listenerID = self, miniFigID = ParadoxObj, newModelLOT = targetLOT, fAdditionalBricksDelay = CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"], fMaxPositionOffset = CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] } end end end end -------------------------------------------------------------- -- Called when zone object gets an onFireEvent for "ModelReadyKipperDuel" -- because the render component became ready for the newest changeling model -------------------------------------------------------------- function ModelReadyKipperDuel( self, model ) local LOT = model:GetLOT().objtemplate if ( IsValidModel( LOT ) == false ) then return end local modelNum = GetChanglingModelNum( self ) if ( modelNum == 1 ) then storeObjectByName( self, "changlingModel_1", model ) else storeObjectByName( self, "changlingModel_2", model ) end StartTimersUponNewModelLoaded( self ) DuelingNPCsReactToNewModel( self ) end -------------------------------------------------------------- -- return if template is a valid changeling model -------------------------------------------------------------- function IsValidModel( LOT ) for index = 1, #MODEL_LOTS do if ( LOT == MODEL_LOTS[index] ) then return true end end return false end -------------------------------------------------------------- -- return if template is a valid changeling model -------------------------------------------------------------- function StartTimersUponNewModelLoaded( self ) -- start a timer for having the Assembly NPC spectator comment on the transformation GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["COMMENTARY_DELAY"], "commentary", self ) -- start a new timer to initiate the next transformation GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["KIPPER_DUEL_TIME_BETWEEN_MODELS"], "nextTransformation", self ) end -------------------------------------------------------------- -- a transformation just finished and the old object sent a msg with the new model's object ID -------------------------------------------------------------- function onReturnChangelingBuildID( self, msg ) -- test only -- not actually using this because we want to wait until we know the render component is ready for the new model -- that is caught in L_AG_KIPPER_MODEL_CLIENT.lua and passed through to the zone script -- (the return msg is sent is sent at the same time as the spawn msg for the new model) --print( "kipper duel received new model ID" ) end -------------------------------------------------------------- -- spawn hidden models that can be changed into the mouse and cat to start with -------------------------------------------------------------- function SpawnInvisibleStartingModels( self ) if ( VerifyActors(self) == false ) then return end -- how close to the corresponding NPC to place the model -- (compared to the whole distance between the 2 NPC's ) local distanceFactor = CONSTANTS["DISTANCE_FACTOR"] -- get the NPC's positions local posSentinel = getObjectByName(self, "KipperDuelSentinelNPC"):GetPosition().pos local posParadox = getObjectByName(self, "KipperDuelParadoxNPC"):GetPosition().pos -- calculate the model positions local posForSentinelModel = { x = ( ( posParadox.x - posSentinel.x ) * distanceFactor ) + posSentinel.x, y = ( ( posParadox.y - posSentinel.y ) * distanceFactor ) + posSentinel.y, z = ( ( posParadox.z - posSentinel.z ) * distanceFactor ) + posSentinel.z } local posForParadoxModel = { x = ( ( posSentinel.x - posParadox.x ) * distanceFactor ) + posParadox.x, y = ( ( posSentinel.y - posParadox.y ) * distanceFactor ) + posParadox.y, z = ( ( posSentinel.z - posParadox.z ) * distanceFactor ) + posParadox.z } -- get the NPC's rotations -- we'll use the same rotations for the models local rotMsg1 = getObjectByName(self, "KipperDuelSentinelNPC"):GetRotation() local rotForSentinelModel = { w = rotMsg1.w, x = rotMsg1.x, y = rotMsg1.y, z = rotMsg1.z } local rotMsg2 = getObjectByName(self, "KipperDuelParadoxNPC"):GetRotation() local rotForParadoxModel = { w = rotMsg2.w, x = rotMsg2.x, y = rotMsg2.y, z = rotMsg2.z } -- spawn the new models RESMGR:LoadObject { objectTemplate = CONSTANTS["KIPPER_DUEL_DUMMY_MOUSE_LOT"], bIsSmashable = true, x = posForSentinelModel.x, y = posForSentinelModel.y, z = posForSentinelModel.z, rw = rotForSentinelModel.w, rx = rotForSentinelModel.x, ry = rotForSentinelModel.y, rz = rotForSentinelModel.z, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["KIPPER_DUEL_DUMMY_CAT_LOT"], bIsSmashable = true, x = posForParadoxModel.x, y = posForParadoxModel.y, z = posForParadoxModel.z, rw = rotForParadoxModel.w, rx = rotForParadoxModel.x, ry = rotForParadoxModel.y, rz = rotForParadoxModel.z, owner = self } end -------------------------------------------------------------- -- loaded up one of the invisible starting models -------------------------------------------------------------- function onChildLoadedKipperDuel(self, msg) if ( msg.templateID == 4966 ) then storeObjectByName( self, "changlingModel_1", msg.childID ) elseif ( msg.templateID == 4973 ) then storeObjectByName( self, "changlingModel_2", msg.childID ) end end -------------------------------------------------------------- -- after a new model is loaded up, the dueling NPC that created it talks it up -------------------------------------------------------------- function ModelsOwnerTalksSmack( self ) if ( VerifyActors(self) == false ) then return end local duelObj = getObjectByName( self, "KipperDuelParadoxNPC" ) if ( ModelBelongsToSentinelNPC( self ) == true ) then duelObj = getObjectByName( self, "KipperDuelSentinelNPC" ) end local modelLOT = GetCurrentModelLOT( self ) -- send a notification to the NPC with the LOT for the model to comment on -- this goes through to scripts \ client \ ai \ AG \ L_AG_KIPPER_DUEL_NPC_CLIENT.lua duelObj:NotifyObject{ name = "TalkSmack", param1 = modelLOT } end -------------------------------------------------------------- -- after a new model is loaded up, the dueling NPCs react to it -------------------------------------------------------------- function DuelingNPCsReactToNewModel( self ) if ( VerifyActors(self) == false ) then return end local sentinelObj = getObjectByName( self, "KipperDuelSentinelNPC" ) local paradoxObj = getObjectByName( self, "KipperDuelParadoxNPC" ) local ownerObj = sentinelObj local opponentObj = paradoxObj if ( ModelBelongsToSentinelNPC( self ) == false ) then ownerObj = paradoxObj opponentObj = sentinelObj end -- the owner of the new model plays a gloating anim ownerObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_GLOAT"], fPriority = 1.5 } -- the other dueling NPC plays a pouting anim opponentObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_POUT"], fPriority = 1.5 } -- the new model's owner comments on it ModelsOwnerTalksSmack( self ) end -------------------------------------------------------------- -- make the spectator animate in the direction of the transformation -------------------------------------------------------------- function MakeSpectatorWatch( self ) if ( VerifyActors(self) == false ) then return end local spectatorObj = getObjectByName( self, "KipperSpectatorAssemblyNPC" ) local bSentinelIsOwner = ModelBelongsToSentinelNPC( self ) local bSentinelIsToTheLeft = CONSTANTS["SENTINEL_IS_LEFT_OF_SPECTATOR"] local bLookLeft = true if ( bSentinelIsOwner == true and bSentinelIsToTheLeft == false ) then bLookLeft = false elseif ( bSentinelIsOwner == false and bSentinelIsToTheLeft == true ) then bLookLeft = false end if ( bLookLeft ) then spectatorObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_LEFT"], fPriority = 1.5 } else spectatorObj:PlayAnimation{ animationID = CONSTANTS["KIPPER_ANIM_RIGHT"], fPriority = 1.5 } end endlocal WORLD_VIGNETTE_LOT = 4884 local TRUCK_VIGNETTE_LOT = 4906 local CONTROLLER_VIGNETTE_LOT = 4907 local STARS_VIGNETTE_LOT = 4914 local PATH_NAMES = {} PATH_NAMES[1]="Rocket_01_Path_01" PATH_NAMES[2]="Rocket_02_Path_01" PATH_NAMES[3]="Rocket_Path_01" PATH_NAMES[4]="Rocket_04_Path_01" function onStartupTransition(self) end function onChildLoadedTransition( self, msg ) if (msg.templateID == 4983) then storeObjectByName(self, "customClone", msg.childID) elseif (msg.templateID == WORLD_VIGNETTE_LOT) then storeObjectByName(self, "vignetteObject", msg.childID) elseif (msg.templateID == STARS_VIGNETTE_LOT) then storeObjectByName(self, "vignetteStars", msg.childID) elseif (msg.templateID == TRUCK_VIGNETTE_LOT) then storeObjectByName(self, "vignetteTruck", msg.childID) elseif (msg.templateID == CONTROLLER_VIGNETTE_LOT) then storeObjectByName(self, "vignetteController", msg.childID) end end function onCinematicUpdateTransition(self, msg) if(msg.event == "STARTED") then if(msg.pathName == "Rocket_Path_04") then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.01, "RocketSoar",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.05, "TruckPreload",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 11.33, "RocketPic",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 13, "FaceFocus",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 14.1, "RocketLand",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 19.5, "TruckBoom",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 22, "RocketBoom",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 26, "FaceChange",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 29, "RocketUnfreeze",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 29.49, "TelePlayer",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 29.52, "SnapPlayersCam",self ) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetPosition {pos = {x=526.3,y=94.6,z=-443.57}} player:SetRotation {x=0,y=-0.549,z=0,w=0.835} canFire = true RESMGR:LoadObject {objectTemplate = 4983, x = 668.55, y = 134.2, z = -506.13, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} --print(tostring(self:GetVar("selection1")) .. " " .. tostring(self:GetVar("selection2")) .. " " .. tostring(self:GetVar("selection3"))) RESMGR:LoadObject {objectTemplate = self:GetVar("selection1"), owner = self} RESMGR:LoadObject {objectTemplate = self:GetVar("selection2"), owner = self} RESMGR:LoadObject {objectTemplate = self:GetVar("selection3"), owner = self} else for i,v in ipairs(PATH_NAMES) do if msg.pathName == v then RESMGR:LoadObject {objectTemplate = WORLD_VIGNETTE_LOT, x = 668.55, y = 134.2, z = -506.13, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = STARS_VIGNETTE_LOT, x = 668.55, y = 134.2, z = -506.13, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = TRUCK_VIGNETTE_LOT, x = 645.89, y = 134.2, z = -556.34, rw = 0.835, rx = 0, ry = -0.549, rz = 0, owner = self} RESMGR:LoadObject {objectTemplate = CONTROLLER_VIGNETTE_LOT, x = 691.34, y = 134.33, z = -512.25, rw = 0.551, rx = 0, ry = 0.833, rz = 0, owner = self} end end end end end function onNotifyObjectTransition(self, msg) if msg.name == "customRocketSelected1" then self:SetVar("selection1", msg.param1) elseif msg.name == "customRocketSelected2" then self:SetVar("selection2", msg.param1) elseif msg.name == "customRocketSelected3" then self:SetVar("selection3", msg.param1) end end function onChildRenderComponentReadyTransition(self, msg) if msg.childLOT == self:GetVar("selection1") then storeObjectByName(self, "selection1Obj", msg.childID) elseif msg.childLOT == self:GetVar("selection2") then storeObjectByName(self, "selection2Obj", msg.childID) elseif msg.childLOT == self:GetVar("selection3") then storeObjectByName(self, "selection3Obj", msg.childID) end if getObjectByName(self, "selection1Obj") and getObjectByName(self, "selection2Obj") and getObjectByName(self, "selection3Obj") then getObjectByName(self, "customClone"):AttachObject{childID = getObjectByName(self, "selection3Obj"), subNodeName = "custom_attach_point"} getObjectByName(self, "selection3Obj"):AttachObject{childID = getObjectByName(self, "selection2Obj"), subNodeName = "CP_A1"} getObjectByName(self, "selection2Obj"):AttachObject{childID = getObjectByName(self, "selection1Obj"), subNodeName = "CP_B2"} end end function onTimerDoneTransition( self, msg ) if (msg.name == "RocketSoar") then --print "Truck Hack" getObjectByName(self, "customClone"):PlayAnimation{animationID = "soar"} local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayAnimation{animationID = "rocket-soar"} player:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } getObjectByName(self, "vignetteObject"):PlayAnimation{animationID = "soar"} getObjectByName(self, "vignetteStars"):PlayAnimation{animationID = "soar"} getObjectByName(self, "vignetteController"):PlayAnimation{animationID = "soar"} getObjectByName(self, "vignetteTruck"):PlayAnimation{animationID = "land"} end if (msg.name == "TruckPreload") then if getObjectByName(self, "selection1Obj") and getObjectByName(self, "selection2Obj") and getObjectByName(self, "selection3Obj") then getObjectByName(self, "selection3Obj"):PlayFXEffect{effectType = "launch"} getObjectByName(self, "selection2Obj"):PlayFXEffect{effectType = "launch"} getObjectByName(self, "selection1Obj"):PlayFXEffect{effectType = "launch"} end --print "Truck Land" getObjectByName(self, "vignetteTruck"):PlayAnimation{animationID = "land"} end if (msg.name == "RocketPic") then --print "Picture Time" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Happy", useAllDecals = true } -- getObjectByName(self, "customClone"):PlayAnimation{animationID = "rocket-pic"} -- local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- player:PlayAnimation{animationID = "rocket-pic"} end if (msg.name == "FaceFocus") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Focused", useAllDecals = true } end if (msg.name == "RocketLand") then --print "Landing Time" -- getObjectByName(self, "customClone"):PlayAnimation{animationID = "rocket-land"} -- local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteObject")) GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteStars")) -- player:PlayAnimation{animationID = "rocket-land"} end if (msg.name == "TruckBoom") then getObjectByName(self, "vignetteTruck"):PlayAnimation{animationID = "boom"} end if (msg.name == "RocketBoom") then --print "BOOM!" local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Shocked", useAllDecals = true } GAMEOBJ:DeleteObject(getObjectByName(self, "selection1Obj")) getObjectByName(self, "selection2Obj"):DetachObject{} GAMEOBJ:DeleteObject(getObjectByName(self, "selection2Obj")) getObjectByName(self, "selection3Obj"):DetachObject{} GAMEOBJ:DeleteObject(getObjectByName(self, "selection3Obj")) end if (msg.name == "FaceChange") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:PlayFaceDecalAnimation { animationID = "Blink", useAllDecals = true } end if (msg.name == "RocketUnfreeze") then --print "Frees Player" getObjectByName(self, "selection1Obj"):DetachObject{} GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteTruck")) GAMEOBJ:DeleteObject(getObjectByName(self, "vignetteController")) GAMEOBJ:DeleteObject(getObjectByName(self, "customClone")) end if (msg.name == "TelePlayer") then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) player:SetPosition {pos = {x=443.63,y=94.34,z=-485.2}} player:SetRotation {x=0,y=-0.873,z=0,w=0.486} player:SetUserCtrlCompPause{bPaused = false} end if (msg.name == "SnapPlayersCam") then CAMERA:SnapCameraToPlayer() end end ---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 71 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) -- this section only happens on AG Small property and it handles all the bobtooltips for the tutorial missions. local player = GAMEOBJ:GetControlledID() -- scroll through all the messages in the table of vars for k,v in pairs(msg.tableOfVars) do if k == "PlayerAction" then -- the player entered the property edit mode if v == "Enter" then -- they havent placed a model before, and they are on the place 4 models mission if player:GetFlag{iFlagID = 101}.bFlag == false and player:GetMissionState{missionID = 871}.missionState == 2 then player:DisplayTooltip{ bShow = true, id = "PropTutModelOut", strText = Localize("TOOLTIP_PROPERTY_MODEL_EQUIP_A"), iTime = 214748 } -- the player is on the second tutorial mission elseif player:GetMissionState{missionID = 891}.missionState == 2 then -- turn off the put on thinking hat tooltip player:DisplayTooltip{ bShow = false, id = "PropTutThinkingHat" } -- if the player hasnt picked up a model or hasnt rotated a model, tell them to pick up a model if player:GetFlag{iFlagID = 109}.bFlag == false or player:GetFlag{iFlagID = 110}.bFlag == false then player:DisplayTooltip{ bShow = true, id = "PropTutPickUpModel", strText = Localize("TOOLTIP_PROPERTY_MODEL_PICK_UP"), iTime = 214748 } --if the player has picked up and rotated a model, then start the put a model away tutorial elseif player:GetFlag{iFlagID = 109}.bFlag == true or player:GetFlag{iFlagID = 110}.bFlag == true then UI:SendMessage( "DisplayTutorial", { {"type","propertyEdit"} , {"subType","putAway"} } ) end end -- the player equipped a model from their backpack elseif v == "ModelEquipped" then -- they havent placed a model before, and they are on the place 4 models mission if player:GetFlag{iFlagID = 101}.bFlag == false and player:GetMissionState{missionID = 871}.missionState == 2 then -- hide the take a model out tooltip and show press shift tooltip player:DisplayTooltip{ bShow = false, id = "PropTutPropTutModelOut"} player:DisplayTooltip{ bShow = true, id = "PropTutPropTutPressShift", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_A"), iTime = 214748 } end -- if the player exited property edit mode elseif v == "Exit" then -- close any tooltips this tutorial might have opened player:DisplayTooltip{ bShow = false, id = "PropTut" } end elseif k == "Tooltip" then -- display tooltip for place a model if v == "PlaceModel" then player:DisplayTooltip{ bShow = true, id = "PropTutPlaceModel", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_A"), iTime = 214748 } -- display tooltip for put thinking hat on elseif v == "ThinkingHat" then player:DisplayTooltip{ bShow = true, id = "PropTutThinkingHat", strText = Localize("TOOLTIP_PROPERTY_THINKING_CAP"), iTime = 214748 } -- turn off tooltip for pick up a model elseif v == "PickUpModelOff" then player:DisplayTooltip{ bShow = false, id = "PropTutPickUpModel" } -- turn off tooltip for pick up a model, and start the rotate ui tutorial elseif v == "Rotate" then player:DisplayTooltip{ bShow = false, id = "PropTutPickUpModel" } UI:SendMessage( "DisplayTutorial", { {"type","propertyEdit"} , {"subType","rotate"} } ) -- turn off tooltip for place a model and start ui tutorial for put away a model elseif v == "PutAway" then player:DisplayTooltip{ bShow = false, id = "PropTutPlaceModel"} UI:SendMessage( "DisplayTutorial", { {"type","propertyEdit"} , {"subType","putAway"} } ) -- turn off tooltip for two more models elseif v == "TwoMoreModelsOff" then player:DisplayTooltip{ bShow = false, id = "PropTutTwoMoreModels"} -- turn off tooltip for another model and display tooltip for 2 more models elseif v == "TwoMoreModels" then player:DisplayTooltip{ bShow = false, id = "PropTutAnotherModel"} player:DisplayTooltip{ bShow = true, id = "PropTutTwoMoreModels", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_C"), iTime = 214748 } -- turn off tooltip for press shift and display tool tip for place another model elseif v == "AnotherModel" then player:DisplayTooltip{ bShow = false, id = "PropTutPressShift"} player:DisplayTooltip{ bShow = true, id = "PropTutAnotherModel", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_B"), iTime = 214748 } end end end end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 3200.0, 3200.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/env_sky_won_ag_property.nif") LEVEL:SetLights( true, 0x3e7891, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color true, 0xC9E5FF, --upper Hemi color true, { 0.6, -0.8, -0.02 }, --directional direction true, 0x8fd1e6, --fog color true, --modifying draw distances (all of them) 50.0, 50.0, --fog near min/max 350.0, 350.0, --fog far min/max 100.0, 100.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 1000.0, 1000.0, --static object cutoff min/max 350.0, 350.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_ag_property.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 99 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 3200.0, 3200.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/PP_PlayerProperty/M_Medium/env_sky_fv_property.nif") LEVEL:SetLights( true, 0xD8E9FF, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color true, 0xADADAD, --upper Hemi color true, { 0.09, -0.91, -0.40 }, --directional direction true, 0x244959, --fog color true, --modifying draw distances (all of them) 1.0, 100.0, --fog near min/max 265.0, 265.0, --fog far min/max 100.0, 100.0, --post fog solid min/max 100.0, 700.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_ag_property.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 98 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 3200.0, 3200.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/PP_PlayerProperty/S_Small/env_sky_gf_smallProperty.nif") LEVEL:SetLights( true, 0xD4FFFC, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color true, 0xFFFFFF, --upper Hemi color true, { -1.00, 0.0, 0.0 }, --directional direction true, 0xC9E0E1, --fog color true, --modifying draw distances (all of them) 200.0, 200.0, --fog near min/max 200.0, 400.0, --fog far min/max 0.0, 80.0, --post fog solid min/max 350.0, 350.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_ag_property.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end---------------------------------------------------------------- --Base Client script for property pushback. --this script is required from a level specific script -- this script will only work with the server script as well ---------------------------------------------------------------- ---------------------------------------------------------------- -- Define empty tables that will be set from the level specific script ---------------------------------------------------------------- local Group = {} local Flags = {} ---------------------------------------------------------------- -- variables passed of the level specific script that are used throughout the base script ---------------------------------------------------------------- function setGameVariables(passedGroups,passedFlags) Group = passedGroups Flags = passedFlags end ---------------------------------------------------------------- -- called when the server script sets a network var ---------------------------------------------------------------- function baseScriptNetworkVarUpdate(self,msg) local player = GAMEOBJ:GetControlledID() -- the property is unclaimed, turn the visiblity on the border and the vendor off if msg.tableOfVars["unclaimed"] then borderOff(self) if player:GetFlag{ iFlagID = Flags.defeatedPropFlag }.bFlag == false then vendorOff(self) end -- the property is rented elseif msg.tableOfVars["renter"] then -- if the local player is not the renter, turn the border off if msg.tableOfVars["renter"] ~= player:GetID() then borderOff(self) end end end ---------------------------------------------------------------- -- turns the visiblity on the property off ---------------------------------------------------------------- function borderOff(self) -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PlaqueGroup, ignoreSpawners = true }.objects -- make sure it got something from the group if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do -- use the property plaque to turn the visiblility of the border asset off propertyPlaques[i]:SetPropertyBoundsVisibility{visible = false} end else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkBorderAgain", self ) end end ---------------------------------------------------------------- -- turns the visiblity on the property off ---------------------------------------------------------------- function vendorOff(self) -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PlaqueGroup, ignoreSpawners = true }.objects -- make sure it got something from the group if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do -- use the property plaque to turn the visiblility of the vendor asset off propertyPlaques[i]:SetPropertyVendorVisibility{visible = false} end else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkVendorAgain", self ) end end ---------------------------------------------------------------- -- called when the script is sent messages from the server script ---------------------------------------------------------------- function baseNotifyClientObject(self,msg) -- turn the normal property sky on if msg.name == "SkyOff" then maelstromSkyOff(self) return -- turn the maelstrom sky on elseif msg.name == "maelstromSkyOn" then maelstromSkyOn(self) return end -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PlaqueGroup, ignoreSpawners = true }.objects -- turn the visiblity on the vendor asset on if msg.name == "vendorOn" then if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do propertyPlaques[i]:SetPropertyVendorVisibility{visible = true} end end -- turn the property border on elseif msg.name == "boundsOn" then if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do propertyPlaques[i]:SetPropertyBoundsVisibility{visible = true, fadeTime=0.5} end end -- play the turn on animation for the border elseif msg.name == "boundsAnim" then if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do propertyPlaques[i]:SetPropertyBoundsVisibility{visible = true}--, animationName = "BorderIn"} end end elseif msg.name == "GuardChat" then local Guard = self:GetObjectsInGroup{ group = Group.Guard, ignoreSpawners = true }.objects[1] Guard:DisplayChatBubble{wsText = "I need to go help other minifigures secure their properties. Have fun."} elseif msg.name == "PlayCinematic" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage( "pushGameState", {{"state", "cinematic" }} ) player:PlayCinematic { pathName = msg.paramStr } local cineTime = tonumber(LEVEL:GetCinematicInfo(msg.paramStr)) GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime, "cinematicTimer",self ) end end ---------------------------------------------------------------- -- called when the map shuts down ---------------------------------------------------------------- function baseShutdown(self) DisableLUT(self) end ---------------------------------------------------------------- -- set the LUT back to normal ---------------------------------------------------------------- function DisableLUT(self) LEVEL:CLUTEffect( "(none)", 0.0, 1.0, 0.0, false ) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function baseTimerDone(self,msg) -- set the LUT back to normal if msg.name == "DisableLUT" then DisableLUT(self) elseif msg.name == "checkBorderAgain" then borderOff(self) elseif msg.name == "checkVendorAgain" then vendorOff(self) elseif msg.name == "cinematicTimer" then UI:SendMessage( "popGameState", {{"state", "cinematic"}} ) end end ---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 71 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque" } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x525066, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { 0.18, 0.93, 0.33 }, --directional direction true, 0x322A91, --fog color true, --modifying draw distances (all of them) 100.0, 0.0, --fog near min/max 500.0, 200.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/env_sky_won_ag_property.nif") LEVEL:SetLights( true, 0x6B9EBF, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color true, 0xC9E5FF, --upper Hemi color true, { 0, -2500, 1500 }, --directional direction true, 0xFFF7D8, --fog color true, --modifying draw distances (all of them) 125.0, 150.0, --fog near min/max 255.0, 250.0, --fog far min/max 100.0, 100.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 1000.0, 1000.0, --static object cutoff min/max 350.0, 350.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_ag_property.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "DisableLUT", self ) end---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 97 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional color false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 3200.0, 3200.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/PP_PlayerProperty/S_Small/NS_PP_01_sky_planetoids.nif") LEVEL:SetLights( true, 0xDDDDDD, --ambient color false, 0xAAAAAA, --directional color false, 0xFFFFFF, --specular color true, 0xFAB489, --upper Hemi color true, { -0.23, -0.46, 0.86 }, --directional direction true, 0x394379, --fog color true, --modifying draw distances (all of them) 50.0, 50.0, --fog near min/max 275.0, 290.0, --fog far min/max 300.0, 500.0, --post fog solid min/max 300.0, 200.0, --post fog fade min/max 700.0, 1100.0, --static object cutoff min/max 150.0, 150.0, --dynamic object cutoff min/max true, "mesh\env\PP_PlayerProperty\S_Small\NS_PP_01_sky_planetoids.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end--/////////////////////////////////////////////////////////////////////////////////////// --// YouReeka zone script - client side --/////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_Zorillo') -------------------------------------------------------------- -- Locals -------------------------------------------------------------- -- stores all loaded lamps LAMPS = {} -- stores all bubble blower statues BUBBLE_BLOWERS = {} -- stores all loaded spouts SPOUTS = {} -- stores all loaded mid-air stink effects AIR_STINKS = {} -- stores all ambient NPC's that give out hint chat bubbles during peace time AMBIENT_NPCS = {} -------------------------------------------------------------- -- Get the state of the zone -------------------------------------------------------------- function GetZoneState(self) return self:GetVar("ZoneState") end -------------------------------------------------------------- -- Set the state of the zone -------------------------------------------------------------- function SetZoneState(self, state, bInitialUpdate) -- get current state local prevState = GetZoneState(self) -- set to new state self:SetVar("ZoneState", state) --print("Setting Client Zone State to " .. state) -- do actions based on new state if (prevState and prevState ~= state) then if (state == CONSTANTS["ZONE_STATE_NO_INVASION"]) then DoNoInvasionStateActions(self, bInitialUpdate) elseif (state == CONSTANTS["ZONE_STATE_TRANSITION"]) then DoTransitionStateActions(self, bInitialUpdate) elseif (state == CONSTANTS["ZONE_STATE_HIGH_ALERT"]) then DoHighAlertStateActions(self, bInitialUpdate) elseif (state == CONSTANTS["ZONE_STATE_MEDIUM_ALERT"]) then DoMediumAlertStateActions(self, bInitialUpdate) elseif (state == CONSTANTS["ZONE_STATE_LOW_ALERT"]) then DoLowAlertStateActions(self, bInitialUpdate) elseif (state == CONSTANTS["ZONE_STATE_DONE_TRANSITION"]) then DoDoneTransitionActions(self, bInitialUpdate) end end end -------------------------------------------------------------- -- do actions associated with No Invasion state -------------------------------------------------------------- function DoNoInvasionStateActions(self, bInitialUpdate) -- update lamps SendStateToLamps(self) -- update bubble blowers SendStateToBubbleBlowers(self) -- update spouts SendStateToSpouts(self) --update mid-air stink SendStateToAirStink(self) --update the hazmat truck SendStateToHazmatTruck(self) -- Play animation on fountain alert SendStateToFountain(self) --update chat bubbles for ambient NPC's SendStateToAmbientNPCs(self) -- set skybox to normal useNormalSky(self) end -------------------------------------------------------------- -- do actions associated with Transition state -------------------------------------------------------------- function DoTransitionStateActions(self, bInitialUpdate) -- update spouts SendStateToSpouts(self) --update mid-air stink SendStateToAirStink(self) --update the hazmat truck SendStateToHazmatTruck(self) -- Start earthquake shakeCamera(self) -- animate the inventor building animateInventorBuilding(self) --update chat bubbles for ambient NPC's SendStateToAmbientNPCs(self) -- start a timer to trigger the siren/lamps (func playSirenSound) GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["EARTHQUAKE_DURATION"], "EarthquakeEnd", self ) -- start a timer to trigger fountain alert GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["FOUNTAIN_ALERT_TIMING"], "StartFountainAlert", self ) -- start a timer to trigger skunks/sky GAMEOBJ:GetTimer():AddTimerWithCancel(CONSTANTS["SKUNK_SPAWN_TIMING"], "SkunksSpawning", self ) end -------------------------------------------------------------- -- Shake the camera -------------------------------------------------------------- function shakeCamera(self) local quakeCenter = getObjectByName( self, "earthquakeCenter" ) if(quakeCenter ~= nil) then quakeCenter:PlayEmbeddedEffectOnAllClientsNearObject{ radius = 50000.0, fromObjectID = quakeCenter, effectName = "camshake" } end end -------------------------------------------------------------- -- animate the inventor building, and objects involved with it -------------------------------------------------------------- function animateInventorBuilding(self) local building = getObjectByName( self, "inventorBuildingObject" ) if(building ~= nil) then building:PlayFXEffect{effectType = "shake"} end local thrower = getObjectByName( self, "switchThrowerObject" ) if(thrower ~= nil) then thrower:PlayAnimation{animationID = "shake"} end end -------------------------------------------------------------- -- plays siren sound on fountain -------------------------------------------------------------- function playSirenSound(self) local quakeCenter = getObjectByName( self, "earthquakeCenter" ) if(quakeCenter ~= nil) then quakeCenter:PlayFXEffect{ effectType = "siren" } end end -------------------------------------------------------------- -- play animation on fountain alert object -------------------------------------------------------------- function SendStateToFountain(self, anim) local myObject = getObjectByName( self, "fountainAlertObject" ) if(myObject ~= nil) then myObject:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- send lamp notifications based on state -------------------------------------------------------------- function SendStateToLamps(self) -- notify lamps of state for lampID = 1, #LAMPS do local lamp = GAMEOBJ:GetObjectByID(LAMPS[lampID]) lamp:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- send bubble blower notifications based on state -------------------------------------------------------------- function SendStateToBubbleBlowers(self) -- notify bubble blowers of state for bbID = 1, #BUBBLE_BLOWERS do local bb = GAMEOBJ:GetObjectByID(BUBBLE_BLOWERS[bbID]) bb:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- send spout notifications based on state -------------------------------------------------------------- function SendStateToSpouts(self) -- notify spouts of state for spoutID = 1, #SPOUTS do local spout = GAMEOBJ:GetObjectByID(SPOUTS[spoutID]) spout:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- send air sitnk notifications based on state -------------------------------------------------------------- function SendStateToAirStink(self) -- notify air stink of state for airStinkID = 1, #AIR_STINKS do local airStink = GAMEOBJ:GetObjectByID(AIR_STINKS[airStinkID]) airStink:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- send ambient NPC's notifications based on state -------------------------------------------------------------- function SendStateToAmbientNPCs(self) -- notify ambient NPCs of state for ambientID = 1, #AMBIENT_NPCS do local ambient = GAMEOBJ:GetObjectByID(AMBIENT_NPCS[ambientID]) ambient:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- send the hazmat truck notifications based on state -------------------------------------------------------------- function SendStateToHazmatTruck(self) local truck = getObjectByName( self, "hazmatTruckObject" ) if(truck ~= nil) then truck:NotifyObject{ name="zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- do actions associated with High Alert state -------------------------------------------------------------- function DoHighAlertStateActions(self, bInitialUpdate) -- update spouts SendStateToSpouts(self) -- update lamps SendStateToLamps(self) -- update bubble blowers SendStateToBubbleBlowers(self) --update mid-air stink SendStateToAirStink(self) --update the hazmat truck SendStateToHazmatTruck(self) -- Play animation on fountain alert SendStateToFountain(self) --update chat bubbles for ambient NPC's SendStateToAmbientNPCs(self) -- set skybox to stinky useStinkySky(self) end -------------------------------------------------------------- -- do actions associated with Medium Alert state -------------------------------------------------------------- function DoMediumAlertStateActions(self, bInitialUpdate) -- update spouts SendStateToSpouts(self) -- update lamps SendStateToLamps(self) -- update bubble blowers SendStateToBubbleBlowers(self) --update mid-air stink SendStateToAirStink(self) --update the hazmat truck SendStateToHazmatTruck(self) -- Play animation on fountain alert SendStateToFountain(self) --update chat bubbles for ambient NPC's SendStateToAmbientNPCs(self) -- set skybox to stinky useStinkySky(self) end -------------------------------------------------------------- -- do actions associated with Low Alert state -------------------------------------------------------------- function DoLowAlertStateActions(self, bInitialUpdate) -- update spouts SendStateToSpouts(self) -- update lamps SendStateToLamps(self) -- update bubble blowers SendStateToBubbleBlowers(self) --update mid-air stink SendStateToAirStink(self) --update the hazmat truck SendStateToHazmatTruck(self) -- Play animation on fountain alert SendStateToFountain(self) --update chat bubbles for ambient NPC's SendStateToAmbientNPCs(self) -- set skybox to stinky useStinkySky(self) end -------------------------------------------------------------- -- do actions associated with done transition -------------------------------------------------------------- function DoDoneTransitionActions(self, bInitialUpdate) -- update spouts SendStateToSpouts(self) -- update lamps SendStateToLamps(self) -- update bubble blowers SendStateToBubbleBlowers(self) --update mid-air stink SendStateToAirStink(self) --update chat bubbles for ambient NPC's SendStateToAmbientNPCs(self) --update the hazmat truck SendStateToHazmatTruck(self) -- Play animation on fountain alert SendStateToFountain(self) -- set skybox to normal useNormalSky(self) end -------------------------------------------------------------- -- Init zone variables -------------------------------------------------------------- function InitZoneVars(self) SetZoneState(self, CONSTANTS["ZONE_STATE_NO_INFO"], true) self:SetVar("StinkySkySet", false) end -------------------------------------------------------------- -- Object on added to world -------------------------------------------------------------- function onStartup(self) -- init the zone vars InitZoneVars(self) end -------------------------------------------------------------- -- Generic message from a specific object -------------------------------------------------------------- function onFireEvent(self, msg) -- object is telling us it is ready and to set its ready if (msg.args == "ZoneStateClientObjectReady") then -- respond with the state of the zone msg.senderID:NotifyObject{name = "zone_state_change", param1 = GetZoneState(self) } end end -------------------------------------------------------------- -- called when timers expire -------------------------------------------------------------- function onTimerDone(self, msg) --print ("Client Timer name: "..msg.name) -- timer for earthquake ending if (msg.name == "EarthquakeEnd") then -- start siren sound playSirenSound(self) -- update lamps SendStateToLamps(self) -- update bubble blowers SendStateToBubbleBlowers(self) -- timer to start fountain alerts elseif (msg.name == "StartFountainAlert") then -- Play animation on fountain alert SendStateToFountain(self) -- timer to start skunk spawns and sky change elseif (msg.name == "SkunksSpawning") then -- set skybox to stinky useStinkySky(self) end end -------------------------------------------------------------- -- set the sky to normal -------------------------------------------------------------- function useNormalSky(self) -- do not set sky if already normal if (self:GetVar("StinkySkySet") == false) then return end self:SetVar("StinkySkySet", false) LEVEL:SetSkyDome ( CONSTANTS["NORMAL_SKYBOX"] ) LEVEL:SetLights( true, 0x5487B7, --ambient color false, 0xf4efff, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 2084.81, -3500.98, 1557.21 }, --directional direction true, 0xd6efff, --fog color true, --modifying draw distances (all of them) 100.0, 100.0, --fog near min/max 700.0, 700.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 1360.0, 1360.0, --static object cutoff min/max 860.0, 860.0, --dynamic object cutoff min/max true, "mesh/env/challenge_sky_light_2awesome.nif" ) end -------------------------------------------------------------- -- set the sky to stinky -------------------------------------------------------------- function useStinkySky(self) -- do not set sky if already stinky if (self:GetVar("StinkySkySet") == true) then return end self:SetVar("StinkySkySet", true) LEVEL:SetSkyDome ( CONSTANTS["STINKY_SKYBOX"] ) LEVEL:SetLights( true, 0x333333, --ambient color false, 0xf4f4f4, --directional color false, 0xFFFFFF, --specular color false, 0xFFFFFF, --upper Hemi color false, { 2084.81, -3500.98, 1557.21 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 50.0, 50.0, --fog near min/max 200.0, 200.0, --fog far min/max 160.0, 160.0, --post fog solid min/max 500.0, 500.0, --post fog fade min/max 860.0, 860.0, --static object cutoff min/max 360.0, 360.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_yore_skunk-stink.nif" ) end -------------------------------------------------------------- -- Called on networked notification from server -------------------------------------------------------------- function onNotifyClientZoneObject(self, msg) -- the zone state has changed if (msg.name == "zone_state_change") then GAMEOBJ:GetTimer():CancelAllTimers( self ) SetZoneState(self, msg.param1, false) end end -------------------------------------------------------------- -- Called when an object is loaded into the zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- earthquake lot loaded if ( msg.templateID == CONSTANTS["EARTHQUAKE_CENTER_LOT"] ) then storeObjectByName( self, "earthquakeCenter", msg.objectID ) -- fountain alert loaded elseif ( msg.templateID == CONSTANTS["FOUNTAIN_ALERT_LOT"] ) then storeObjectByName( self, "fountainAlertObject", msg.objectID ) -- inventor building loaded elseif ( msg.templateID == CONSTANTS["INVENTOR_BUILDING_LOT"] ) then storeObjectByName( self, "inventorBuildingObject", msg.objectID ) -- switch thrower loaded elseif ( msg.templateID == CONSTANTS["SWITCH_THROWER_LOT"] ) then storeObjectByName( self, "switchThrowerObject", msg.objectID ) -- lamp loaded elseif ( msg.templateID == CONSTANTS["SINGLE_LAMP_LOT"] ) then -- store object in the single lamps array local nextLamp = #LAMPS + 1 LAMPS[nextLamp] = msg.objectID:GetID() -- bubble blower loaded elseif ( msg.templateID == CONSTANTS["BUBBLE_BLOWER_LOT"] ) then -- store object in the bubble blowers array local nextBB = #BUBBLE_BLOWERS + 1 BUBBLE_BLOWERS[nextBB] = msg.objectID:GetID() -- spout loaded elseif ( msg.templateID == CONSTANTS["SPOUT_LOT"] ) then -- store object in the single lamps array local nextSpout = #SPOUTS + 1 SPOUTS[nextSpout] = msg.objectID:GetID() elseif ( msg.templateID == CONSTANTS["AIR_STINK_LOT"] ) then -- store object in the single lamps array local nextAirStink = #AIR_STINKS + 1 AIR_STINKS[nextAirStink] = msg.objectID:GetID() -- hazmat truck loaded elseif ( msg.templateID == CONSTANTS["HAZMAT_VAN_LOT"] ) then storeObjectByName( self, "hazmatTruckObject", msg.objectID ) elseif ( IsPanicNPC( msg.templateID ) ) then -- store object in the single ambient NPC's array local nextAmbient = #AMBIENT_NPCS + 1 AMBIENT_NPCS[nextAmbient] = msg.objectID:GetID() end end -------------------------------------------------------------- -- Sent by the server to notify client of zone state on login -------------------------------------------------------------- function onNotifyClientRebuildSectionState(self, msg) --print("-------- Player Getting info on Client, setting state") SetZoneState(self, msg.iState, true) end -------------------------------------------------------------- -- return if template is a valid panic npc -------------------------------------------------------------- function IsPanicNPC(templateID) -- list of npcs does not exist if (CONSTANTS["INVASION_PANIC_ACTORS"] == nil) then return false end -- look for a valid actor for actors = 1, #CONSTANTS["INVASION_PANIC_ACTORS"] do if (templateID == CONSTANTS["INVASION_PANIC_ACTORS"][actors]) then return true end end return false end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"] = 3 CONSTANTS["HELP_SCREEN_TEXT"] = "SkunkSG" -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onPlayerReady(self) -- get local player local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) -- check the tooltip flag local tooltipMsg = player:GetTooltipFlag{iToolTip = CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"]} if (tooltipMsg.bFlag == false) then -- set the tooltip? else -- fake the msgbox close to start the activity GAMEOBJ:GetZoneControlID():MessageBoxRespond{ identifier = CONSTANTS["HELP_SCREEN_TEXT"], sender = player } end end -------------------------------------------------------------- -- Constants/Settings for Avant Gardens Scripts -------------------------------------------------------------- CONSTANTS = {} -------------------------------------------------------------- -- Other -------------------------------------------------------------- CONSTANTS["NO_OBJECT"] = "0" CONSTANTS["EMPTY_ID_NAME"] = "|" .. CONSTANTS["NO_OBJECT"] CONSTANTS["LOT_NULL"] = -1 -------------------------------------------------------------- -- Scene 1 -------------------------------------------------------------- -------------------------------------------------------------- -- Scene 2 constants -------------------------------------------------------------- CONSTANTS["COUNTDOWN_TIME"] = 3.0 --CONSTANTS["S2_EXIT_COURSE_TEXT"] = Localize("UI_OBSTACLE_COURSE_EXIT") --CONSTANTS["S2_START_COURSE_TEXT"] = Localize("UI_OBSTACLE_COURSE_START") --CONSTANTS["S2_OUT_OF_RANGE_COURSE_TEXT"] = Localize("UI_OBSTACLE_COURSE_OUT_OF_RANGE") --CONSTANTS["S2_FINISH_COURSE_TEXT"] = Localize("UI_OBSTACLE_COURSE_FINISH") -------------------------------------------------------------- -- Scene 2 -- Kipper commercial constants -------------------------------------------------------------- -- the LOT's of the NPC's CONSTANTS["KIPPER_DUEL_SENTINEL_NPC_LOT"] = 4776 CONSTANTS["KIPPER_DUEL_PARADOX_NPC_LOT"] = 4777 CONSTANTS["KIPPER_SPECTATOR_ASSEMBLY_NPC_LOT"] = 4790 -- how long to hold on each model before asking for the next transformation CONSTANTS["KIPPER_DUEL_TIME_BETWEEN_MODELS"] = 3.5 -- whether or not the sentinel NPC goes first (mouse) -- if false, then paradox goes first CONSTANTS["KIPPER_DUEL_SENTINEL_GOES_FIRST"] = true -- the LOT's for the models produced by the two dueling NPC's CONSTANTS["KIPPER_DUEL_MOUSE_LOT"] = 4779 CONSTANTS["KIPPER_DUEL_CAT_LOT"] = 4780 CONSTANTS["KIPPER_DUEL_DOG_LOT"] = 4781 CONSTANTS["KIPPER_DUEL_DRAGON_LOT"] = 4782 CONSTANTS["KIPPER_DUEL_FIRE_ENGINE_LOT"] = 4783 CONSTANTS["KIPPER_DUEL_SUBMARINE_LOT"] = 4784 CONSTANTS["KIPPER_DUEL_KIPPER_LOT"] = 4786 CONSTANTS["KIPPER_DUEL_ELEPHANT_LOT"] = 4789 -- how long to wait after smashing off the old bricks before spawning in any additional ones needed CONSTANTS["KIPPER_DUEL_ADDITIONAL_BRICKS_DELAY"] = 0.5 -- the max x and z offset to spawn each brick at compared to its final location in the completed model CONSTANTS["KIPPER_DUEL_MAX_BRICK_POS_OFFSET"] = 5.0 -- how far away you can click on one of the NPC's to trigger text CONSTANTS["KIPPER_NPC_INTERACT_DISTANCE"] = 35.0 -- the mission number to talk to the reporter in Zorillo CONSTANTS["KIPPER_MISSION_ID"] = 214 -- the anim names for the dueling NPC's CONSTANTS["KIPPER_ANIM_GLOAT"] = "good" CONSTANTS["KIPPER_ANIM_POUT"] = "bad" -- the anim names for the spectator NPC CONSTANTS["KIPPER_ANIM_LEFT"] = "talk-left" CONSTANTS["KIPPER_ANIM_RIGHT"] = "talk-right" -- whether the spectator considers the sentinel NPC to the left CONSTANTS["SENTINEL_IS_LEFT_OF_SPECTATOR"] = true -------------------------------------------------------------- -- Scene 2 -- constants for Burno's hotdog cart -------------------------------------------------------------- CONSTANTS["LOT_BURNO"] = 4045 CONSTANTS["LOT_PATH_UNDER_BURNO"] = 4814 CONSTANTS["LOT_BURNO_HOTDOG_CART"] = 4046 -------------------------------------------------------------- -- Scene 3 -- constants for the musical instruments quickbuilds -------------------------------------------------------------- -- the object template for each instrument CONSTANTS["INSTRUMENT_LOT_GUITAR"] = 4039 CONSTANTS["INSTRUMENT_LOT_BASS"] = 4040 CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] = 4041 CONSTANTS["INSTRUMENT_LOT_DRUM"] = 4042 -- the anim used to show the player playing each instrument CONSTANTS["INSTRUMENT_ANIM"] = {} CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "drums" -- the anim used to show the player smashing each instrument CONSTANTS["INSTRUMENT_SMASH_ANIM"] = {} CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = -1 -- has no smashing anim -- the music used for each instrument CONSTANTS["INSTRUMENT_MUSIC"] = {} CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Guitar" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Bass" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Keys" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Drums" -- path set up through Happy Flower for the cinematic for each instrument CONSTANTS["INSTRUMENT_CINEMATIC"] = {} CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Cam_G" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Cam_B" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Cam_K" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Cam_D" -- the LOT for the left hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 4991 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 4992 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- no equippable used CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4995 -- the LOT for the right hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4996 -- whether or not to hide the completed quickbuild while the player is playing the instrument CONSTANTS["INSTRUMENT_HIDE"] = {} CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = false CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = false -- once the smash anim starts playing, how long to wait before unequipping the instrument CONSTANTS["INSTRUMENT_UNEQUIP_TIME"] = {} CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 1.033 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 0.94 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- has no equippables CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 0 -- has no smash anim, unequip immediately -- how much imagination is repeatedly drained while the instrument is being played CONSTANTS["INSTRUMENT_IMAGINATION_COST"] = 2 -- how often imagination is drained while playing the instrument CONSTANTS["INSTRUMENT_COST_FREQUENCY"] = 4.0 -------------------------------------------------------------- -- Scene 3 -- constants for the NPC that wants to see a dance emote -------------------------------------------------------------- -- the mission number for dancing in front of this NPC CONSTANTS["DANCE_ADMIRER_MISSION"] = 175 -------------------------------------------------------------- -- Scene 3 -- constants for dancing up near the disco ball -------------------------------------------------------------- -- the group an NPC must be assigned to in Happy Flower in order for it to mirror the player's dancing CONSTANTS["CONCERT_FAN_GROUP"] = "dance_crowd" -- indices for the acceptable dances, same as above CONSTANTS["INDEX_DWARF"] = 1 CONSTANTS["INDEX_FIREFIGHTER"] = 2 CONSTANTS["INDEX_BREAKDANCE"] = 3 CONSTANTS["INDEX_SKILLZ"] = 4 -- the corresponding animations (from Emotes table in database) CONSTANTS["DISCO_ANIMS"] = {} CONSTANTS["DISCO_ANIMS"][CONSTANTS["INDEX_DWARF"]] = "headbang" -- emote 207 CONSTANTS["DISCO_ANIMS"][CONSTANTS["INDEX_FIREFIGHTER"]] = "hat-dance" -- emote 208 CONSTANTS["DISCO_ANIMS"][CONSTANTS["INDEX_BREAKDANCE"]] = "breakdance" -- emote 192 CONSTANTS["DISCO_ANIMS"][CONSTANTS["INDEX_SKILLZ"]] = "breakdance" -- emote 209 -------------------------------------------------------------- -- Scene 3 -- constants for the concert prop choicebuilds -------------------------------------------------------------- -- the LOT's for the props CONSTANTS["LOT_CHOICEBUILD_ROCKET"] = 5023 CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"] = 4891 CONSTANTS["LOT_CHOICEBUILD_LASER"] = 5024 CONSTANTS["LOT_CHOICEBUILD_SPEAKER"] = 4858 -- the concert shell particle effect number for each LOT CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"] = {} CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_ROCKET"]] = 537 CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"]] = -1 -- no effect CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_LASER"]] = -1 CONSTANTS["CHOICEBUILD_SHELL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_SPEAKER"]] = 538 -- the concert hill particle effect number for each LOT CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"] = {} CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_ROCKET"]] = -1 CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"]] = 539 CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_LASER"]] = 267 CONSTANTS["CHOICEBUILD_HILL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_SPEAKER"]] = -1 -- the discoball particle effect number for each LOT CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"] = {} CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_ROCKET"]] = -1 CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"]] = -1 CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_LASER"]] = 266 CONSTANTS["CHOICEBUILD_DISCOBALL_EFFECT_NUM"][CONSTANTS["LOT_CHOICEBUILD_SPEAKER"]] = -1 -- the name of the particle effects for each LOT CONSTANTS["CHOICEBUILD_EFFECT_NAME"] = {} CONSTANTS["CHOICEBUILD_EFFECT_NAME"][CONSTANTS["LOT_CHOICEBUILD_ROCKET"]] = "flamethrower" CONSTANTS["CHOICEBUILD_EFFECT_NAME"][CONSTANTS["LOT_CHOICEBUILD_SPOTLIGHT"]] = "spotlight" CONSTANTS["CHOICEBUILD_EFFECT_NAME"][CONSTANTS["LOT_CHOICEBUILD_LASER"]] = "laser" CONSTANTS["CHOICEBUILD_EFFECT_NAME"][CONSTANTS["LOT_CHOICEBUILD_SPEAKER"]] = "speaker" -- the names of the groups with the objects the particle effects get attached to -- this is set up through Happy Flower CONSTANTS["CHOICEBUILD_SHELL_GROUP"] = "effectsShell" CONSTANTS["CHOICEBUILD_HILL_GROUP"] = "effectsHill" CONSTANTS["CHOICEBUILD_DISCOBALL_GROUP"] = "effectsDiscoball" -------------------------------------------------------------- -- Scene 3 -- constants for the stage platforms that move when the choicebuilds are all alike -------------------------------------------------------------- -- the LOT's for stage and the moving platforms CONSTANTS["LOT_STAGE"] = 3504 CONSTANTS["LOT_STAGE_PLATFORM_LARGE"] = 5027 CONSTANTS["LOT_STAGE_PLATFORM_SMALL"] = 5028 -- important path waypoints CONSTANTS["WAYPOINT_LARGE_EXTENSION"] = 1 -- the large moving platform looks like an extension of the stage CONSTANTS["WAYPOINT_LARGE_STEPS"] = 2 -- the large moving platform looks like a step up to the golden brick CONSTANTS["WAYPOINT_SMALL_EXTENSION"] = 1 -- the small moving platform looks like an extension of the stage CONSTANTS["WAYPOINT_SMALL_STEPS"] = 3 -- the small moving platform looks like a step up to the golden brick -------------------------------------------------------------- -- Scene 4 -------------------------------------------------------------- -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- Pads a number with zeros on the left, to fill a field of the specified -- length. -------------------------------------------------------------- function ZeroPad(number, length) return string.rep("0", length - #tostring(number)) .. tostring(number) end -------------------------------------------------------------- -- parses time to a string -------------------------------------------------------------- function ParseTime(numTime) local newTime = tonumber(numTime) local min = math.floor(newTime / 1000 / 60) newTime = newTime - (min * 1000 * 60) local sec = math.floor(newTime / 1000) newTime = newTime - (sec * 1000) local msec = math.floor(newTime) local strTime = "" if (min > 0) then strTime = ZeroPad(min,2) .. ":" .. ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) else strTime = ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) end return strTime end-------------------------------------------------------------- -- Constants/Settings for Nimbus Park Scripts -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- CONSTANTS = {} -------------------------------------------------------------- -- Other -------------------------------------------------------------- CONSTANTS["NO_OBJECT"] = "0" CONSTANTS["LOT_NULL"] = -1 CONSTANTS["PLAYER_FELIX_1_FLAG_BIT"] = 4 CONSTANTS["PLAYER_CHAT_HELP_FLAG_BIT"] = 12 CONSTANTS["SCENE_2_EVENT_FLAG_BIT"] = 13 CONSTANTS["SCENE_3_EVENT_FLAG_BIT"] = 14 CONSTANTS["HELP_TRIGGER_IDLE_TIME"] = 3.0 CONSTANTS["NUM_SCENES"] = 7 -- [LOT / Help Text] for Help Triggers HELP_DATA = {} HELP_DATA[3239] = Localize("HELP_TRIGGER_TEXT_MOVEMENT") HELP_DATA[3240] = Localize("HELP_TRIGGER_TEXT_JUMP") HELP_DATA[3241] = Localize("HELP_TRIGGER_TEXT_DOUBLE_JUMP") HELP_DATA[3242] = Localize("HELP_TRIGGER_TEXT_BUILD_BOUNCER") HELP_DATA[3420] = Localize("HELP_TRIGGER_TEXT_WALL_SMASH") CONSTANTS["HELP_TRIGGER_DATA"] = HELP_DATA -------------------------------------------------------------- -- Scene 1 -------------------------------------------------------------- CONSTANTS["FELIX_1_LOT"] = 3203 CONSTANTS["FELIX_1_SPAWN_POS"] = { x = 307.49, y = 332.9, z = -547.02 } CONSTANTS["FELIX_1_SPAWN_ROT"] = { x = 0.0, y = 1.0, z = 0.0, w = 0.0 } CONSTANTS["FELIX_1_PROX_RADIUS"] = 80 CONSTANTS["FELIX_1_INTERACT_RADIUS"] = 15 CONSTANTS["FELIX_1_FLEE_PATHNAME"] = "felix1path" CONSTANTS["FELIX_1_FLEE_TEXT"] = Localize("FELIX_1_FLEE_TEXT") STATUE_LOTS = { 2469, 2465, 2949 } CONSTANTS["SCENE_1_STATUE_LOTS"] = STATUE_LOTS CONSTANTS["SCENE_1_STATUE_COOLDOWN"] = 10.0 CONSTANTS["SCENE_1_STATUE_PROX_RADIUS"] = 53.0 CONSTANTS["SCENE_1_STATUE_OFFSET"] = {x = 0.0, y = 8.3, z = 0.0 } CONSTANTS["SCENE_1_STATUE_EFFECT_ID"] = 229 CONSTANTS["SCENE_1_STATUE_EFFECT_TYPE"] = "change" CONSTANTS["SCENE_1_WIZARD_1_LOT"] = 3727 CONSTANTS["SCENE_1_WIZARD_2_LOT"] = 3728 CONSTANTS["SCENE_1_WIZARD_BATTLE_LOTS"] = {3762, 3763, 3764, 3765, 3766, 3767, 3768, 3770} CONSTANTS["SCENE_1_VALID_ACTORS"] = {3727,3728} WIZARD_TEXT = {} WIZARD_TEXT[1] = "Shazam!" WIZARD_TEXT[2] = "I choose you..." WIZARD_TEXT[3] = "How about this!" WIZARD_TEXT[4] = "Oh yeah? Try this!" WIZARD_TEXT[5] = "Hocus Pocus!" WIZARD_TEXT[6] = "Take that!" WIZARD_TEXT[7] = "This is better!" WIZARD_TEXT[8] = "My turn!" WIZARD_TEXT[9] ="Form of..." CONSTANTS["WIZARD_CAST_TEXT"] = WIZARD_TEXT -------------------------------------------------------------- -- Scene 2 -------------------------------------------------------------- CONSTANTS["SCENE_2_VALID_ACTORS"] = {3696, 2562, 3694} -- statue, npc, meteorscene CONSTANTS["FELIX_2_PROX_RADIUS"] = 20 CONSTANTS["SCENE_2_MISSION_1_ID"] = 115 CONSTANTS["SCENE_2_CHAT_HELP_TEXT"] = Localize("NP_SCENE_2_CHAT_HELP_TEXT") --CONSTANTS["SCENE_2_METEOR_LOT"] = 3637 --CONSTANTS["SCENE_2_METEOR_SHARD_LOT"] = 3638 --CONSTANTS["SCENE_2_CAMERA_LOT"] = 3604 --CONSTANTS["SCENE_2_METEOR_SPEED"] = 5.0 --CONSTANTS["SCENE_2_METEOR_PATH"] = "meteor_path" --CONSTANTS["SCENE_2_METEOR_SHARD_PATH"] = "meteor_shard_path" --CONSTANTS["SCENE_2_CAMERA_PATH"] = "scene2_camera_path" CONSTANTS["SCENE_2_MONUMENT_BUILD_TIME"] = 5.0 CONSTANTS["SCENE_2_MONUMENT_BREAK_TIME"] = 5.0 CONSTANTS["SCENE_2_PLAYER_CINE_POS"] = { x = 621.89, y = 252.72, z = 87.17 } CONSTANTS["SCENE_2_PLAYER_CINE_ROT"] = { x = 0.0, y = 0.0, z = 0.0, w = 1.0 } CONSTANTS["SCENE_2_CINE_TIMING_STATUE_HIT"] = 18.133 CONSTANTS["SCENE_2_CINE_LENGTH"] = 23.0 -------------------------------------------------------------- -- Scene 3 -------------------------------------------------------------- CONSTANTS["SCENE_3_VALID_ACTORS"] = {3235, 3607, 2666, 2652, 2653, 3608, 3405, 3605, 3606, 3214, 3614} CONSTANTS["SCENE_3_MISSION_1_ID"] = 174 CONSTANTS["SCENE_3_MISSION_2_ID"] = 175 CONSTANTS["SCENE_3_MISSION_3_ID"] = 176 CONSTANTS["SCENE_3_MISSION_4_ID"] = 178 CONSTANTS["SCENE_3_MISSION_4_READY_COMPLETE_TEXT"] = Localize("NP_SCENE_3_MISSION_4_READY_COMPLETE_TEXT") CONSTANTS["SCENE_3_BBOY_DANCE_DELAY"] = 5.0 CROWD_TEXT = {} CROWD_TEXT[1] = Localize("NP_CROWD_BORED_TEXT_1") CROWD_TEXT[2] = Localize("NP_CROWD_BORED_TEXT_2") CROWD_TEXT[3] = Localize("NP_CROWD_BORED_TEXT_3") CONSTANTS["CROWD_NO_MISSION_TEXT"] = CROWD_TEXT CROWD_TEXT = {} CROWD_TEXT[1] = Localize("NP_CROWD_HAPPY_TEXT_1") CROWD_TEXT[2] = Localize("NP_CROWD_HAPPY_TEXT_2") CROWD_TEXT[3] = Localize("NP_CROWD_HAPPY_TEXT_3") CONSTANTS["CROWD_YES_MISSION_TEXT"] = CROWD_TEXT CONSTANTS["CROWD_PROX_CHANCE"] = 45 -- whole number % CONSTANTS["SCENE_3_CROWD_EFFECT_ID"] = 274 CONSTANTS["SCENE_3_CROWD_EFFECT_TYPE"] = "bored" -------------------------------------------------------------- -- Scene 4 -------------------------------------------------------------- CONSTANTS["COURSE_STARTER_LOT"] = 3004 CONSTANTS["COUNTDOWN_TIME"] = 3.0 CONSTANTS["COURSE_STARTER_OFFER_TEXT"] = Localize("NP_COURSE_STARTER_OFFER_TEXT") CONSTANTS["COURSE_STARTER_ACTIVE_TEXT"] = Localize("NP_COURSE_STARTER_ACTIVE_TEXT") CONSTANTS["COURSE_OUT_OF_RANGE_TEXT"] = Localize("NP_COURSE_OUT_OF_RANGE_TEXT") CONSTANTS["COURSE_OUT_OF_RANGE_MSG_SHOW_TIME"] = 4000 CONSTANTS["COURSE_FINISH_TEXT"] = Localize("NP_COURSE_FINISH_TEXT") CONSTANTS["COURSE_FINISH_TEXT2"] = Localize("NP_COURSE_FINISH_TEXT2") CONSTANTS["COURSE_FINISH_MSG_SHOW_TIME"] = 4000 CONSTANTS["CollectableTemplate"] = 3609 CONSTANTS["BigCollectableTemplate"] = 3610 CONSTANTS["CollectablePath"] = "CourseCollectables" CONSTANTS["BigCollectablePath"] = "BigCourseCollectables" CONSTANTS["CollectableTimeAdded"] = 100 CONSTANTS["BigCollectableTimeAdded"] = 1000 -------------------------------------------------------------- -- Scene 5 -------------------------------------------------------------- CONSTANTS["SCENE_5_MISSION_1_ID"] = 130 CONSTANTS["SCENE_5_MISSION_2_ID"] = 129 -------------------------------------------------------------- -- Scene 6 -------------------------------------------------------------- -- Server only constants, see ai/NP/L_NP_SERVER_CONSTANTS.lua -------------------------------------------------------------- -- Scene 7 -------------------------------------------------------------- -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- Pads a number with zeros on the left, to fill a field of the specified -- length. -------------------------------------------------------------- function ZeroPad(number, length) return string.rep("0", length - #tostring(number)) .. tostring(number) end -------------------------------------------------------------- -- parses time to a string -------------------------------------------------------------- function ParseTime(numTime) local newTime = tonumber(numTime) local min = math.floor(newTime / 1000 / 60) newTime = newTime - (min * 1000 * 60) local sec = math.floor(newTime / 1000) newTime = newTime - (sec * 1000) local msec = math.floor(newTime) local strTime = "" if (min > 0) then strTime = ZeroPad(min,2) .. ":" .. ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) else strTime = ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) end return strTime end-------------------------------------------------------------- -- Constants/Settings for Zorillo Scripts -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- CONSTANTS = {} -------------------------------------------------------------- -- Other -------------------------------------------------------------- CONSTANTS["NO_OBJECT"] = "0" CONSTANTS["EMPTY_ID_NAME"] = "|" .. CONSTANTS["NO_OBJECT"] CONSTANTS["LOT_NULL"] = -1 -------------------------------------------------------------- -- Skills -------------------------------------------------------------- CONSTANTS["SKUNK_STINK_SKILL"] = 33 CONSTANTS["DESTINK_SKILL"] = 116 CONSTANTS["REMOVE_STINK_SKILL"] = 124 -------------------------------------------------------------- -- Special LOTs -------------------------------------------------------------- CONSTANTS["SINGLE_LAMP_LOT"] = 3180 -- the LOT for the single lamp posts CONSTANTS["SPOUT_LOT"] = 3283 -- the LOT for the double lamp posts CONSTANTS["LAMP_DETECTOR_LOT"] = 3434 -- the LOT for the skunk detectors that pop out of the lamp posts CONSTANTS["EARTHQUAKE_CENTER_LOT"] = 3378 -- the LOT for the skunk statue in the center of town. The earthquake radius goes out from here. CONSTANTS["FOUNTAIN_ALERT_LOT"] = 3674 -- the LOT for the fountain base with the status alert indicator CONSTANTS["INVASION_STINK_CLOUD_LOT"] = 3851 -- the LOT for invasion stink clouds CONSTANTS["INVENTOR_BUILDING_LOT"] = 3172 -- the LOT for the inventor building CONSTANTS["SWITCH_THROWER_LOT"] = 3923 -- the LOT for the switch thrower CONSTANTS["HAZMAT_VAN_LOT"] = 3472 -- the LOT for the animating hazmat van CONSTANTS["HAZMAT_REBUILD_VAN_LOT"] = 3717 -- the LOT for the hazmat rebuild van CONSTANTS["BUBBLE_BLOWER_LOT"] = 3928 -- the LOT for the bubble blower CONSTANTS["AIR_STINK_LOT"] = 3645 -- the LOT for the mid-air stink effects CONSTANTS["SPAWNED_HAZMAT_NPC"] = 3553 -- the LOT for the spawned hazmat npcs CONSTANTS["POLE_SLIDE_NPC"] = 3954 -- the LOT for the spawned window washer CONSTANTS["BALLOON_LOT"] = 3433 -- the LOT for the balloon CONSTANTS["FLOWER_LOT"] = 3646 -- the LOT for the flowers CONSTANTS["INVASION_SKUNK_LOT"] = {3279, 3930, 3931} -- the LOTs for invasion skunks CONSTANTS["INVASION_PANIC_ACTORS"] = {3268, 3269, 3270, 3271, 3272} -------------------------------------------------------------- -- Invasion Constants -------------------------------------------------------------- -- States CONSTANTS["ZONE_STATE_NO_INFO"] = -1 -- we have not been given state information yet CONSTANTS["ZONE_STATE_NO_INVASION"] = 0 -- no invasion CONSTANTS["ZONE_STATE_TRANSITION"] = 1 -- transition into the invasion CONSTANTS["ZONE_STATE_HIGH_ALERT"] = 2 -- invasion at high alert CONSTANTS["ZONE_STATE_MEDIUM_ALERT"] = 3 -- invasion at medium alert CONSTANTS["ZONE_STATE_LOW_ALERT"] = 4 -- invasion at low alert CONSTANTS["ZONE_STATE_DONE_TRANSITION"] = 5 -- transition to no invasion -- Scoring CONSTANTS["CLEANING_POINTS_TOTAL"] = 50 -- number of cleaning points to stop invasion CONSTANTS["CLEANING_POINTS_MEDIUM"] = 20 -- number of cleaning points to move to medium alert CONSTANTS["CLEANING_POINTS_LOW"] = 40 -- number of cleaning points to move to low alert CONSTANTS["POINT_VALUE_SKUNK"] = 1 -- the point value for cleaning a skunk CONSTANTS["POINT_VALUE_STINK_CLOUD"] = 1 -- the point value for cleaning a stink cloud CONSTANTS["POINT_VALUE_BROOMBOT"] = 3 -- the point value for repairing a broombot CONSTANTS["POINT_VALUE_HAZMAT"] = 2 -- the point value for cleaning a hazmat CONSTANTS["REWARD_MULTIPLIER"] = 10 -- multiplied by the number of points a player has for reward in coins -- Skunks / Stink Clouds CONSTANTS["NUM_SKUNKS"] = 10 -- number of skunks to spawn during invasion CONSTANTS["SKUNK_PATH_PREFIX"] = "skunkWP_" -- prefix for skunk paths CONSTANTS["SKUNK_ROAM_PATH_SUFFIX"] = "a" -- suffix appended to the previous path for a roaming path CONSTANTS["NUM_STINK_CLOUDS"] = 10 -- number of stink clouds to spawn during invasion CONSTANTS["STINK_CLOUD_PATH"] = "StinkCloudSpawnLocations" CONSTANTS["SKUNK_RESPAWN_TIMER_MIN"] = 5 -- min seconds to respawn CONSTANTS["SKUNK_RESPAWN_TIMER_MAX"] = 10 -- max seconds to respawn -- Hazmat Van / Hazmat NPCs CONSTANTS["HAZMAT_REBUILD_VAN_SPAWN_PATH"] = "HazmatRebuildSpawnPath" -- path to spawn the hazmat van on (first waypoint) CONSTANTS["HAZMAT_NPC_PATH_PREFIX"] = "hazmatWP_" -- prefix for hazmat npc paths CONSTANTS["NUM_HAZMAT_NPCS"] = 4 -- number of hazmat npcs to spawn during invasion CONSTANTS["TIME_BETWEEN_HAZMAT_SPAWNS"] = 4.0 -- time in between hazmat NPC spawns CONSTANTS["HAZMAT_REBUILD_RESET_TIME"] = 20.0 -- time until rebuild van breaks -------------------------------------------------------------- -- Invasion Timings -------------------------------------------------------------- CONSTANTS["PEACE_TIME_DURATION"] = 5 * 60 -- duration of peace in town, event starts afterwards CONSTANTS["INVASION_TRANSITION_DURATION"]= 12.0 -- Duration of the transition to the invasion CONSTANTS["DONE_TRANSITION_DURATION"] = 5.0 -- Duration of the transition from the invasion CONSTANTS["MAX_INVASION_DURATION"] = 5 * 60.0 -- maximum duration of the invasion regardless of cleaning points CONSTANTS["EARTHQUAKE_DURATION"] = 2.5 -- Time from start of event to do things after earthquake CONSTANTS["FOUNTAIN_ALERT_TIMING"] = 4.0 -- Time from start of event to trigger fountain alert CONSTANTS["SKUNK_SPAWN_TIMING"] = 10.0 -- Time from start of event to trigger skunk spawns and sky CONSTANTS["HAZMAT_VAN_TIMING"] = 11.0 -- Time from start of event to trigger van animations CONSTANTS["POLE_SLIDE_TIMING"] = 11.0 -- Time from start of event to trigger pole slide animations CONSTANTS["HAZMAT_NPC_SPAWN_TIMER"] = 1.0 -- Time from buildable van spawning to start Hazmat NPCs -------------------------------------------------------------- -- Dynamic Skybox Information -------------------------------------------------------------- CONSTANTS["STINKY_SKYBOX"] = "mesh/env/env_sky_won_yore_skunk-stink.nif" CONSTANTS["NORMAL_SKYBOX"] = "mesh/env/challenge_sky_light_2awesome.nif" CONSTANTS["SKYLAYER"] = "(invalid)" CONSTANTS["RINGLAYER0"] = "(invalid)" CONSTANTS["RINGLAYER1"] = "(invalid)" CONSTANTS["RINGLAYER2"] = "(invalid)" CONSTANTS["RINGLAYER3"] = "(invalid)" -------------------------------------------------------------- -- General Bouncer Information -------------------------------------------------------------- CONSTANTS["HF_NODE_BOUNCER"] = 7 CONSTANTS["HF_SUB_ITEM_SEP_STRING"] = "\x1F" -------------------------------------------------------------- -- Spout Information -------------------------------------------------------------- CONSTANTS["SPOUT_RADIUS"]= 2.0 -- do not increase this or the spout won't realize it has become temporarily unplugged if a player jumps while standing on it CONSTANTS["SPOUT_GROUP_NAME"] = "spoutGroup" CONSTANTS["FOUNTAIN_GROUP_NAME"] = "fountainGroup" CONSTANTS["SPOUT_BOUNCER_SPEED"] = 100.0 CONSTANTS["SPOUT_BOUNCER_DEST"] = {x = -12.88, y = 318.21, z = -124.52} -------------------------------------------------------------- -- Bubble Statue Information -------------------------------------------------------------- CONSTANTS["BUBBLE_STATUE_RADIUS"] = 10.0 -------------------------------------------------------------- -- Inventor's Balloon Information -------------------------------------------------------------- CONSTANTS["LAST_BALLOON_WAYPOINT"] = 11 -------------------------------------------------------------- -- general -------------------------------------------------------------- CONSTANTS["radius"] = 3.0 local function shift(fn) coroutine.yield(fn) end local function proc(fn) local coro = coroutine.wrap(fn) local cont = function (...) local cb = coro(unpack(arg)) if cb then cb() end end cont(cont) end Delay = { proc = proc, shift = shift, } --This script is an empty placeholder --It is typically used to force an object to use the regular shader instead of the smashable shader --Right now, objects that don't have scripts attached to them use the smashable shader by default. require('EquipmentScripts/SpawnPowerupsOnTimerThenDie') function onStartup(self) self:SetVar( "numCycles", 8) self:SetVar( "secPerCycle", 25) self:SetVar( "delayToFirstCycle", 1.5) self:SetVar( "deathDelay", 3) self:SetVar( "numberOfPowerups", 4) self:SetVar( "LootLOT" , 6431) onTemplateStartup(self) end require('EquipmentScripts/SpawnPowerupsOnTimerThenDie') function onStartup(self) self:SetVar( "numCycles", 10) self:SetVar( "secPerCycle", 20) self:SetVar( "delayToFirstCycle", 1.5) self:SetVar( "deathDelay", 3) self:SetVar( "numberOfPowerups", 3) self:SetVar( "LootLOT" , 177) onTemplateStartup(self) end -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) for i, skill in ipairs(self:GetSkills().skills) do self:CastSkill{skillID = skill } end end -------------------------------------------------------------- -- Startup of the object -------------------------------------------------------------- function onStartup(self) for i, skill in ipairs(self:GetSkills().skills) do self:CastSkill{skillID = skill, bLocalCastOnly = true} end end -------------------------------------------- -- Server Side script for the Rank 1 Daredevil First Aid Kit -- used to allow the player to click on the object to grant a heal and keeps track of heal "charges" it is allowed -------------------------------------------- function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 30 , "DieTime" , self ) self:SetVar("charges", 4) end ------------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end end -- when used, check if the player needs health and then cast the skill the kit has function onUse(self, msg) if msg.user:GetHealth{}.health < msg.user:GetMaxHealth{}.health then local skill = self:GetSkills{}.skills self:CastSkill{skillID = skill[1], optionalTargetID = msg.user} self:SetVar("charges", self:GetVar("charges")-1) if self:GetVar("charges") < 1 then self:RequestDie() end end end----------------------------------------------- -- Server Side script for the Rank 1 Daredevil First Aid Kit -- Let's the server script know when the object was used ----------------------------------------------- --[[ function onClientUse(self, msg) -- senderID should be the player self:FireEventServerSide{ senderID = msg.user} end --]] -------------------------------------------------------------- -- override pick type to be interactive -------------------------------------------------------------- function onGetOverridePickType(self, msg) msg.ePickType = 14 --interactive type return msg end function onCheckUseRequirements(self, msg) msg.bCanUse = false if msg.objIDUser:GetHealth{}.health < msg.objIDUser:GetMaxHealth{}.health then msg.bCanUse = true end return msg end require('EquipmentScripts/SpawnPowerupsOnTimerThenDie') function onStartup(self) self:SetVar( "numCycles", 6) self:SetVar( "secPerCycle", 30) self:SetVar( "delayToFirstCycle", 1.5) self:SetVar( "deathDelay", 3) self:SetVar( "numberOfPowerups", 5) self:SetVar( "LootLOT" , 935) onTemplateStartup(self) endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 1 local iplayer = "" function onStartup(self) self:SetVar("DieTime", 30) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } self:CastSkill{skillID = 656} GAMEOBJ:GetTimer():CancelAllTimers(self) self:SetVar("DieTime", 12) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end --Gets the player that built the generator -- Commented out for the time being just in case we need it. function onRebuildStart(self, msg) -- storeObjectByName (self, "playerID", msg.userID ) iplayer = msg.userID end ------------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 1 local iplayer = "" function onStartup(self) self:SetVar("DieTime", 30) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } self:CastSkill{skillID = 657} GAMEOBJ:GetTimer():CancelAllTimers(self) self:SetVar("DieTime", 12) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end --Gets the player that built the generator -- Commented out for the time being just in case we need it. function onRebuildStart(self, msg) -- storeObjectByName (self, "playerID", msg.userID ) iplayer = msg.userID end ------------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["EnemySmashableFaction"] = 1 local iplayer = "" function onStartup(self) self:SetVar("DieTime", 30) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes Update -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Set to Darkling hated smashable faction Using PLAYER faction for now. self:SetFaction{ faction = CONSTANTS["EnemySmashableFaction"] } self:CastSkill{skillID = 658} GAMEOBJ:GetTimer():CancelAllTimers(self) self:SetVar("DieTime", 12) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("DieTime") , "DieTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end --Gets the player that built the generator -- Commented out for the time being just in case we need it. function onRebuildStart(self, msg) -- storeObjectByName (self, "playerID", msg.userID ) iplayer = msg.userID end ------------------------- -- Check if the timer for self death is done. ------------------------- onTimerDone = function(self, msg) if msg.name == "DieTime" then self:Die() end endfunction onStartup(self) -- store the caster for use when skill is cast. self:SetVar("PlayerCaster", self:GetParentObj{}) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5, "FireSkill", self ) self:GetParentObj{}.objIDParent:SetStatusImmunity{StateChangeType = "PUSH",bImmuneToKnockback = true, bImmuneToInterrupt = true, bImmuneToSpeed = true, bImmuneToBasicAttack = true, bImmuneToDOT = true, bImmuneToImaginationGain=false, bImmuneToImaginationLoss = true, bImmuneToQuickbuildInterrupt = false, bImmuneToPullToPoint = false} self:GetParentObj{}.objIDParent:SetStunImmunity{StateChangeType = "PUSH", bImmuneToStunMove = true, bImmuneToStunTurn = true, bImmuneToStunAttack = true, bImmuneToStunEquip = true, bImmuneToStunInteract = true} self:GetParentObj{}.objIDParent:SetStunned{StateChangeType = "PUSH", bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true} --print("**************startingup**************") end function onDie(self, msg) self:GetParentObj{}.objIDParent:SetStatusImmunity{StateChangeType = "POP",bImmuneToKnockback = true, bImmuneToInterrupt = true, bImmuneToSpeed = true, bImmuneToBasicAttack = true,bImmuneToDOT = true, bImmuneToImaginationGain = false, bImmuneToImaginationLoss = true, bImmuneToQuickbuildInterrupt = false, bImmuneToPullToPoint = false} self:GetParentObj{}.objIDParent:SetStunImmunity{StateChangeType = "POP", bImmuneToStunMove = true, bImmuneToStunTurn = true, bImmuneToStunAttack = true, bImmuneToStunEquip = true, bImmuneToStunInteract = true} self:GetParentObj{}.objIDParent:SetStunned{StateChangeType = "POP", bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true} --print("**************I can has on die from the fortress?********") --print(self:GetParentObj{}.objIDParent:GetName().name) end function onTimerDone(self, msg) self:CastSkill{skillID = 650, optionalOriginatorID = self:GetVar("PlayerCaster")} endrequire('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) -- store the caster for use when skill is cast. self:SetVar("PlayerCaster", self:GetParentObj{}) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 60 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 20 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} ProximityPuls(self) end -- When hit, cast detonate skill function onOnHit(self, msg) if(self:IsEnemy{targetFaction = msg.attacker:GetFaction{}.faction}.enemy)then local skill = self:GetSkills{}.skills self:CastSkill{skillID = skill[1]}-- optionalOriginatorID = self:GetVar("PlayerCaster")} end if(msg.attacker:GetID() == self:GetID()) then self:RequestDie{} end end require('o_mis') -- Spawns powerups on the object at 3 seconds after startup and every 10 seconds thereafter. Object smashes when it runs out of powerups CONSTANTS = {} CONSTANTS["NO_OBJECT"] = "0" function onTemplateStartup(self) self:SetVar("parentID", self:GetParentObj{}.objIDParent) self:SetVar( "currentCycle", 1) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("delayToFirstCycle") , "TimeToSpawn", self ) end function onTimerDone(self, msg) if msg.name == "TimeToSpawn" then SpawnPowerups(self, self:GetVar("numberOfPowerups"), self:GetVar("LootLOT")) if (self:GetVar("currentCycle") < self:GetVar("numCycles")) then GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar( "secPerCycle" ) , "TimeToSpawn", self ) self:SetVar( "currentCycle", self:GetVar("currentCycle") + 1) end if (self:GetVar("currentCycle") >= self:GetVar("numCycles")) then GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar( "deathDelay" ) , "Die", self ) end end if msg.name == "Die" then self:RequestDie{} end end function SpawnPowerups(self, numPowerups, type) for i = 1, numPowerups do local newID = GAMEOBJ:GenerateSpawnedID() local parentID = GAMEOBJ:GetObjectByID(self:GetVar("parentID")) DoObjectAction(self, "effect", "cast") self:DropLoot{itemTemplate = type,owner = parentID, lootID = newID, rerouteID = parentID, sourceObj = self} end end function onStartup(self) self:SetStunImmunity{StateChangeType = "PUSH", bImmuneToStunAttack = true, bImmuneToInterrupt = true} -- Make immune to stuns self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true } -- Make immune to move/teleport behaviors end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) -- store the caster for use when skill is cast. self:SetVar("PlayerCaster", self:GetParentObj{}) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 60 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 20 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} ProximityPuls(self) end -- When hit, cast detonate skill function onOnHit(self, msg) self:CastSkill{skillID = 643, optionalOriginatorID = self:GetVar("PlayerCaster")} end -- When casting a skill, ensure the player is the caster function onCastSkill(self, msg) optionalOriginatorID = self:GetVar("PlayerCaster") end require('State') require('o_StateCreate') require('o_mis') require('o_Main') function onStartup(self) -- store the caster for use when skill is cast. self:SetVar("PlayerCaster", self:GetParentObj{}) Set = {} --New AI Override ------------------------------------ Set['SuspendLuaAI'] = true -- a state suspending scripted AI Set['SuspendLuaMovementAI'] = true -- a state suspending scripted movement AI ---------------------------------------- --[[ /////////////////////////////////////////////////////////////////////////// ____ _ __ ___ _ _ ____ / ___| | |/ / |_ _| | | | | / ___| \___ \ | ' / | | | | | | \___ \ ___) | | . \ | | | |___ | |___ ___) | |____/ |_|\_\ |___| |_____| |_____| |____/ --]] Set['OverRideHealth'] = false -- Bool Health Overide Set['Health'] = 1 -- Amount of health Set['OverRideImag'] = false -- Bool Imagination Overide Set['Imagination'] = nil -- Amout of Imagination Set['OverRideImmunity'] = false -- Bool Immunity Overide Set['Immunity'] = false -- Bool Set['OverRideName'] = false Set['Name'] = "Master Template" Set['EmoteReact'] = false Set['Emote_Delay'] = 2 Set['React_Set'] = "test" --[[ /////////////////////////////////////////////////////////////////////////// ____ _ ____ ___ _ _ ____ | _ \ / \ | _ \ |_ _| | | | | / ___| | |_) | / _ \ | | | | | | | | | | \___ \ | _ < / ___ \ | |_| | | | | |_| | ___) | |_| \_\ /_/ \_\ |____/ |___| \___/ |____/ --]] Set['aggroRadius'] = 60 -- Aggro Radius Set['conductRadius'] = 15 -- Conduct Radius Set['tetherRadius'] = 50 -- Tether Radius Set['tetherSpeed'] = 20 -- Tether Speed Set['wanderRadius'] = 8 -- Wander Radius --- FOV Radius -- -- Aggro Set['UseAggroFOV'] = false Set['aggroFOV'] = 180 -- Conduct Set['UseConductFOV'] = false Set['conductFOV'] = 180 --[[ //////////////////////////////////////////////////////////////////////////////// _ ____ ____ ____ ___ / \ / ___| / ___| | _ \ / _ \ / _ \ | | _ | | _ | |_) | | | | | / ___ \ | |_| | | |_| | | _ < | |_| | /_/ \_\ \____| \____| |_| \_\ \___/ --]] Set['Aggression'] = "Aggressive" -- [Aggressive]--[Neutral]--[Passive] -- [PassiveAggres]- Set['AggroNPC'] = false Set['AggroDist'] = 5 -- Distance away from target to stop before attacking Set['AggroSpeed'] = 3.5 -- Multiplier of the NPC's base speed to approach while attacking -- Aggro Emote Set['AggroEmote'] = false --Plays Emote on Aggro Set['AggroE_Type'] = "" -- String Name of Emote Set['AggroE_Delay'] = 1 -- Animation Delay Time --[[ /////////////////////////////////////////////////////////////////////////// __ __ ___ __ __ _____ __ __ _____ _ _ _____ | \/ | / _ \ \ \ / / | ____| | \/ | | ____| | \ | | |_ _| | |\/| | | | | | \ \ / / | _| | |\/| | | _| | \| | | | | | | | | |_| | \ V / | |___ | | | | | |___ | |\ | | | |_| |_| \___/ \_/ |_____| |_| |_| |_____| |_| \_| |_| --]] --********************************************************************** Set['MovementType'] = "Wander" --["Guard"],["Wander"] --********************************************************************** -- Attach Way Point Set to NPC -- " this is for NPC's that are not HF placed " Set['WayPointSet'] = nil -- Wander Settings --------------------------------------------------------- Set['WanderChance'] = 100 -- Main Weight Set['WanderDelayMin'] = 5 -- Min Wander Delay Set['WanderDelayMax'] = 5 -- Max Wander Delay Set['WanderSpeed'] = 0.5 -- Move speed -- effect 1 Set['WanderEmote'] = false -- Enable bool Set['WEmote_1'] = 30 -- Weight Set['WEmoteType_1'] = "salute" -- Animation Type ------ Set your Custom ProximityRadius ----------------------------- --self:SetProximityRadius { radius = 40 , name = "CustomRadius" } ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) loadOnce(self) getVarables(self) CreateStates(self) oStart(self) -------------------------------------------------------------------------------- self:OverrideFriction{bEnableOverride = true, fFriction = 40} ProximityPuls(self) end -- When hit, cast detonate skill function onOnHit(self, msg) self:CastSkill{skillID = 644, optionalOriginatorID = self:GetVar("PlayerCaster")} end -- When casting a skill, ensure the player is the caster function onCastSkill(self, msg) optionalOriginatorID = self:GetVar("PlayerCaster") end require('State') require('o_StateCreate') require('o_mis') require('o_Main') CONSTANTS = {} CONSTANTS["RebuildStateOpen"] = 0 CONSTANTS["RebuildStateCompleted"] = 2 CONSTANTS["TickTime"] = 1 CONSTANTS["KillTime"] = 30 function onStartup(self) ---------------------------------- -- Sets the turret's life timer and disables its AI which will only be active after rebuild. self:SetVar("TickTime", 1) self:SetVar("currentTime", 1) --disable AI here: self:EnableCombatAIComponent{bEnable = false} GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) ----------------------------------* self:SetVar("building", 0) self:SetGravityScale{scale = 0.0} self:SetStunImmunity{StateChangeType = "PUSH", bImmuneToStunAttack = true, bImmuneToInterrupt = true} -- Make immune to stuns self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true } -- Make immune to move/teleport behaviors end -------------------------------------------------------------------------------- -- onRebuildNotifyState -- -- Notes: Whenever the rebuild state changes on the robotanist, this is called. -------------------------------------------------------------------------------- function onRebuildNotifyState(self, msg) if (msg.iState == CONSTANTS["RebuildStateCompleted"]) then -- Enable AI here: self:EnableCombatAIComponent{bEnable = true} self:SetVar("building", 0) GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end if (msg.iState == CONSTANTS["RebuildStateOpen"]) then end end ------------------------- -- Tells the turret to die after the timer runs out. ------------------------- function onTimerDone(self, msg) -- 1 second tick timer to increment an overall time (currentTime) if msg.name == "TickTime" then self:SetVar("currentTime", (self:GetVar("currentTime") + 1)) -- When the currentTime exceeds 30 seconds and the player is not currently building, kill the turret if (self:GetVar("currentTime") >= CONSTANTS["KillTime"]) and (self:GetVar("building") == 0)then self:EnableCombatAIComponent{bEnable = false} self:Die() self:SetVar("currentTime", 0) end GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("TickTime") , "TickTime", self ) end end ----------------------------- -- Getting the playerID of the rebuilder and setting new timer for the life of the turret ----------------------------- function onRebuildStart(self, msg) self:LockNodeRotation{nodeName = "base"} storeObjectByName (self, "playerID", msg.userID ) self:SetVar("building", 1) end ----------------------------- -- Reroute Kill credit to the player ----------------------------- function onUpdateMissionTask(self,msg) if msg then local player = getObjectByName(self, "playerID") if player then player:UpdateMissionTask{target = msg.target, value = msg.value, value2 = msg.value2, taskType = msg.taskType} end end end -------------------------------------------------------------- -- X-Marks-The-Spot Rank 1 -- Server script spawns several powerup objects -- Client script animates a chest getting dug up and opening to spawn the items. -------------------------------------------------------------- require('o_mis') local minLife = 1 local maxLife = 3 local minArmor = 0 local maxArmor = 2 local minImagination = 0 local maxImagination = 1 function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.7 , "SpawnGoodies", self ) --parent = self:GetParentObj{}.objIDParent storeObjectByName(self, "parent", self:GetParentObj{}.objIDParent) end onTimerDone = function(self, msg) if msg.name == "SpawnGoodies" then SpawnGoodies(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5 , "Die", self ) end if msg.name == "Die" then self:Die{ killType = "SILENT" } end end function SpawnGoodies(self) SpawnPowerups(self, minLife, maxLife, 177) SpawnPowerups(self, minArmor, maxArmor, 6431) SpawnPowerups(self, minImagination, maxImagination, 935) end -- func SpawnGoodies function SpawnPowerups(self, min, max, type) local i = 1 local randomNum = math.random(min,max) while (i <= randomNum) do local newID = GAMEOBJ:GenerateSpawnedID() self:DropLoot{itemTemplate = type,owner = getObjectByName(self, "parent"), lootID = newID, rerouteID = getObjectByName(self, "parent"), sourceObj = self} i = i + 1 end end -------------------------------------------------------------- -- X-Marks-The-Spot Rank 2 -- Server script spawns several powerup objects -- Client script animates a chest getting dug up and opening to spawn the items. -------------------------------------------------------------- require('o_mis') local minLife = 3 local maxLife = 5 local minArmor = 0 local maxArmor = 3 local minImagination = 0 local maxImagination = 3 function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.7 , "SpawnGoodies", self ) --parent = self:GetParentObj{}.objIDParent storeObjectByName(self, "parent", self:GetParentObj{}.objIDParent) end onTimerDone = function(self, msg) if msg.name == "SpawnGoodies" then SpawnGoodies(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5 , "Die", self ) end if msg.name == "Die" then self:Die{ killType = "SILENT" } end end function SpawnGoodies(self) SpawnPowerups(self, minLife, maxLife, 177) SpawnPowerups(self, minArmor, maxArmor, 6431) SpawnPowerups(self, minImagination, maxImagination, 935) end -- func SpawnGoodies function SpawnPowerups(self, min, max, type) local i = 1 local randomNum = math.random(min,max) while (i <= randomNum) do local newID = GAMEOBJ:GenerateSpawnedID() self:DropLoot{itemTemplate = type,owner = getObjectByName(self, "parent"), lootID = newID, rerouteID = getObjectByName(self, "parent"), sourceObj = self} i = i + 1 end end -------------------------------------------------------------- -- X-Marks-The-Spot Rank 3 -- Server script spawns several powerup objects -- Client script animates a chest getting dug up and opening to spawn the items. -------------------------------------------------------------- require('o_mis') local minLife = 5 local maxLife = 8 local minArmor = 0 local maxArmor = 4 local minImagination = 0 local maxImagination = 4 function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 2.7 , "SpawnGoodies", self ) --parent = self:GetParentObj{}.objIDParent storeObjectByName(self, "parent", self:GetParentObj{}.objIDParent) end onTimerDone = function(self, msg) if msg.name == "SpawnGoodies" then SpawnGoodies(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5 , "Die", self ) end if msg.name == "Die" then self:Die{ killType = "SILENT" } end end function SpawnGoodies(self) SpawnPowerups(self, minLife, maxLife, 177) SpawnPowerups(self, minArmor, maxArmor, 6431) SpawnPowerups(self, minImagination, maxImagination, 935) end -- func SpawnGoodies function SpawnPowerups(self, min, max, type) local i = 1 local randomNum = math.random(min,max) while (i <= randomNum) do local newID = GAMEOBJ:GenerateSpawnedID() self:DropLoot{itemTemplate = type,owner = getObjectByName(self, "parent"), lootID = newID, rerouteID = getObjectByName(self, "parent"), sourceObj = self} i = i + 1 end end require('o_mis') function onRenderComponentReady(self, msg) self:PlayAnimation{animationID = "shoveldigup", bPlayImmediate = true} local anim_time = self:GetAnimationTime{ animationID = "shoveldigup" }.time GAMEOBJ:GetTimer():AddTimerWithCancel( anim_time, "ChestDugUp", self ) end onTimerDone = function(self, msg) if msg.name == "ChestDugUp" then self:PlayAnimation{animationID = "open", bPlayImmediate = true} local anim_time = self:GetAnimationTime{ animationID = "open" }.time GAMEOBJ:GetTimer():AddTimerWithCancel( anim_time , "ChestOpened", self ) end if msg.name == "ChestOpened" then self:PlayAnimation{animationID = "death", bPlayImmediate = true} end endrequire('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 394) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 2) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 581) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 3) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 582) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 4) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 394) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 2) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 581) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 3) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 582) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 4) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 394) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 28) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 581) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 29) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 582) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 30) end function onFactionTriggerItemEquipped (self) self:AddStatTrigger{ Name="Low Health", Stat="HEALTH", Operator="LESS_EQUAL", Value=1 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) -- local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) -- local name = msg.Name -- the stat which changed -- local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat -- local totalValue = msg.TotalValue --if name == "Low Heatlh" then if statValue ~= msg.OldValue then parent:CastSkill{skillID = 393} end -- end -- print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger{ Name="Low Health", Stat="HEALTH", Operator="LESS_EQUAL", Value=1 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) -- local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) -- local name = msg.Name -- the stat which changed -- local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat --local totalValue = msg.TotalValue if statValue ~= msg.OldValue then parent:CastSkill{skillID = 503} end endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger{ Name="Low Health", Stat="HEALTH", Operator="LESS_EQUAL", Value=1 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) -- local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) --local name = msg.Name -- the stat which changed -- local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat -- local totalValue = msg.TotalValue if statValue ~= msg.OldValue then parent:CastSkill{skillID = 504} end endrequire('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Armor", Stat="ARMOR", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 559) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 7) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Armor", Stat="ARMOR", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 560) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 8) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Armor", Stat="ARMOR", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 561) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 9) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Armor", Stat="ARMOR", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 562) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 13) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Armor", Stat="ARMOR", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 563) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 14) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Armor", Stat="ARMOR", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 564) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 15) end function onFactionTriggerItemEquipped (self) self:AddStatTrigger(self:GetVar("trigger")) end function onStatEventTriggered(self, msg) if msg.Parent:Exists{} then -- the value of the stat local statValue = msg.StatValue -- Fire the toughness skill if statValue ~= msg.OldValue then --IsItemInSet will give us a list of all the sets an item is in local setInfo = msg.Parent:IsItemInSet{setItem = self} if setInfo.setIDs then checkSetAndCast(self, setInfo.setIDs, msg.Parent) end end end end function checkSetAndCast(self, set, itemParent) for index, skillSetID in ipairs(set) do --verify that we're firing from the right set if skillSetID == self:GetVar("skillSet") then --fetch all the currently equipped items from our set. local equippedItems = itemParent:GetEquippedItemsInSet{setID = skillSetID} if self:GetVar("itemsRequired") <= #equippedItems.setItems then --if we are the first item in the list we're going to cast the skill. --All the items in the set will get this far, but only one of them will have to --actually fire the skill if self:GetID() == equippedItems.setItems[1]:GetID() then itemParent:CastSkill{ skillID = self:GetVar("skillID") } return end end end end endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger { Name="Low Health", Stat="HEALTH", Operator="LESS", Value=3 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) local name = msg.Name -- the stat which changed local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat local totalValue = msg.TotalValue --Fires the skill if the player's armor reaches below zero if statValue ~= msg.OldValue then parent:CastSkill{skillID = 687} end -- print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger { Name="Low Health", Stat="HEALTH", Operator="LESS", Value=3 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) local name = msg.Name -- the stat which changed local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat local totalValue = msg.TotalValue --Fires the skill if the player's armor reaches below zero if statValue ~= msg.OldValue then parent:CastSkill{skillID = 696} end -- print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger { Name="Low Health", Stat="HEALTH", Operator="LESS", Value=3 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) local name = msg.Name -- the stat which changed local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat local totalValue = msg.TotalValue --Fires the skill if the player's armor reaches below zero if statValue ~= msg.OldValue then parent:CastSkill{skillID = 697} end -- print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger { Name="Low Health", Stat="HEALTH", Operator="LESS", Value=3 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) local name = msg.Name -- the stat which changed local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat local totalValue = msg.TotalValue --Fires the skill if the player's armor reaches below zero if statValue ~= msg.OldValue then parent:CastSkill{skillID = 699} end -- print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger { Name="Low Health", Stat="HEALTH", Operator="LESS", Value=3 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) local name = msg.Name -- the stat which changed local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat local totalValue = msg.TotalValue --Fires the skill if the player's armor reaches below zero if statValue ~= msg.OldValue then parent:CastSkill{skillID = 700} end -- print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) endfunction onFactionTriggerItemEquipped (self) self:AddStatTrigger { Name="Low Health", Stat="HEALTH", Operator="LESS", Value=3 } end function onStatEventTriggered(self, msg) -- the Parent of the equipment (the player) local parent = msg.Parent -- the sender of this message (the equipment) local sender = msg.Sender -- the name of the trigger -- this is can be used to identify the trigger to perform the desired action(s) local name = msg.Name -- the stat which changed local stat = msg.Stat -- the value of the stat local statValue = msg.StatValue -- the maximum value of the stat local totalValue = msg.TotalValue --Fires the skill if the player's armor reaches below zero if statValue ~= msg.OldValue then parent:CastSkill{skillID = 701} end -- print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) endrequire('Vector') function onCollision(self, msg) local target = msg.objectID --If I'm facing the opposite direction (180) and I'm below the object then ignore collision? local myPos = Vector.new(self:GetPosition().pos) local hisPos = Vector.new(target:GetPosition().pos) local dist = hisPos - myPos; -- If the colider is lower than I am if (dist.y <= 2) then local myHeading = getHeading(self); local hisHeading = getHeading(target); -- Dot product these? local dot = Vector.__mul(myHeading, hisHeading); --print (dot) if (dot < 0) then msg.ignoreCollision = true return msg end end end function getHeading(obj) local q = obj:GetRotation() return({ x = 2 * q.y * q.w + 2 * q.x * q.x, y = 2 * q.z * q.y - 2 * q.x * q.w, z = q.z*q.z + q.w*q.w - q.x*q.x - q.y*q.y, }) end -------------------------------------------------------------- -- include this script if you care when a group of choicebuilds all are set to the same choice -- the script that includes it will need to: -- call SetGroupName so this script knows what group the choicebuilds are in -- call InitializeIndices any time the choices are all reset -- call SetIndex any time one choice changes. Pass in true if you want to check if they're all alike. -- define function RewardBonus with what you want to happen when all the choicebuilds are the same -------------------------------------------------------------- -------------------------------------------------------------- -- vars -------------------------------------------------------------- local INDICES = nil -- the index of the current choice for each choicebuild -------------------------------------------------------------- -- remember the name of the group that -------------------------------------------------------------- function SetGroupName( self, name ) self:SetVar( "groupName", name ) end -------------------------------------------------------------- -- set the index for every choicebuild in the group to -1 -------------------------------------------------------------- function InitializeIndices( self ) -- create the array to store the indices in INDICES = {} -- get the group of choicebuilds local group = self:GetObjectsInGroup{ group = self:GetVar( "groupName" ), ignoreSpawners = true }.objects -- set the index for each to -1 for i = 1, #group do local buildID = group[i]:GetID() INDICES[buildID] = -1 end end -------------------------------------------------------------- -- returns whether the given choicebuild is in the group -------------------------------------------------------------- function IsValidBuildID( self, checkID ) -- get the group of choicebuilds local group = self:GetObjectsInGroup{ group = self:GetVar( "groupName" ), ignoreSpawners = true }.objects -- check each one's ID against the one passed in for i = 1, #group do local currentID = group[i]:GetID() if ( currentID == checkID ) then return true end end return false end -------------------------------------------------------------- -- sets the index for the given choicebuild to the given value -- if bCheckForBonus is true, then it also checks whether all the choicebuilds in the group match -------------------------------------------------------------- function SetIndex( self, buildID, newIndex, bCheckForBonus ) if ( IsValidBuildID( self, buildID ) == false ) then return end INDICES[buildID] = newIndex if ( bCheckForBonus == true ) then if ( DoAllChoicebuildsMatch( self ) == true ) then local index = GetIndexOfFirstChoicebuild( self ) RewardBonus( self, index ) -- NOTE: the script that includes this one is responsible for defining RewardBonus end end end -------------------------------------------------------------- -- returns the index of the first choicebuild in the group -------------------------------------------------------------- function GetIndexOfFirstChoicebuild( self ) local group = self:GetObjectsInGroup{ group = self:GetVar( "groupName" ), ignoreSpawners = true }.objects if ( #group == 0 ) then return -1 end return INDICES[group[1]:GetID()] end -------------------------------------------------------------- -- returns whether or not all the choicebuilds in the group are set to the same index -------------------------------------------------------------- function DoAllChoicebuildsMatch( self ) -- get the group of choicebuilds local group = self:GetObjectsInGroup{ group = self:GetVar( "groupName" ), ignoreSpawners = true }.objects local numChoicebuilds = #group -- if we didn't find any choicebuilds, return false if ( numChoicebuilds == 0 ) then return false end -- get the index of the first choicebuild in the group. -- we'll compare all the others to that local checkIndex = INDICES[group[1]:GetID()] if ( checkIndex == -1 ) then return false end -- check whether all the choicebuilds are the same for i = 1, numChoicebuilds do local buildID = group[i]:GetID() local choiceIndex = INDICES[buildID] if ( choiceIndex ~= checkIndex ) then return false end end return true endrequire('State') require('o_WayPointEvents') require('o_onEvent') require('o_mis') require("o_Movement") function CreateStates(self) Timers = {} Timers[1] = "blank" self:SetVar("Timers",Timers) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CombatState(self) -- ////////////////////////////////////////////////////////////////////////////////// -- if Way Points if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then UseWayPoints(self) end -- if PetCalss if self:GetVar("Set.Pet_Active") then SetPetClass(self) end -- if Frozen if self:GetVar("Set.MovementType") == "Frozen" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Guard if self:GetVar("Set.MovementType") == "Guard" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Wander if self:GetVar("Set.MovementType") == "Wander" then MeanderState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if follow if self:GetVar("Set.FollowActive") then FollowState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Helper if self:GetVar("Set.Helper") then SetHelper(self) end customState = State.create() customState.onEnter = function(self) if (onTemplateCustomStateEnter) and (onTemplateCustomStateEnter(self, msg) == true ) then return end end customState.onArrived = function(self, msg) if (onTemplateCustomStateArrived) and (onTemplateCustomStateArrived(self, msg) == true ) then return end end -- ////////////////////////////////////////////////////////////////////////////////// -- Idle Idle = State.create() Idle.onEnter = function(self) if self:GetVar("Set.Pet_Active") and not self:GetVar("PetLoaded") then self:SetVar("PetLoaded", true) setState("PetClass",self) end if self:GetVar("RebuildStart") then storeHomePoint(self) self:SetVar("inpursuit",true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Emote_EventDelay") , "rebuildBreak", self ) end end AiDisable = State.create() AiDisable.onEnter = function(self) self:SetVar("myTarget", nil) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CancelTemplateTimers(self) self:SetVar("AiDisabled", true) self:StopPathing() end AiEnable = State.create() AiEnable.onEnter = function(self) self:SetVar("AiDisabled", false) SetResetState(self) end --setState("Dead", self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Death Dead = State.create() Dead.onEnter = function(self) self:SetVar("CurrentState", "Dead") if self:GetVar("I_Have_A_Parent") then local WpSetName = self:GetVar("attached_path") local myParent = getParent(self) local sSplit = split(WpSetName,"_") local xSplit = {} local xSplit= {alpa=sSplit[1] , num=sSplit[2] } myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") setState("DeadChild", myParent) end if self:GetVar("Im_A_Child") then myParent = getParent(self) for i = 1, getParent(self):GetVar("MaxPet") do local myidString = self:GetID() local myfinalID = "|" .. myidString local Pet = getPetID(myParent,i):GetID() if Pet == self:GetID() then myParent:SetVar("StoredPet."..i, "none") myParent:SetVar("Child_Timer."..i, myfinalID ) GAMEOBJ:GetTimer():AddTimerWithCancel( myParent:GetVar("Set.Pet_Respawn") , myfinalID, myParent ) end end end getVarables(self) CancelTemplateTimers(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Tether tether = State.create() tether.onEnter = function(self) self:SetVar("aggrotarget",2) self:SetImmunity{ immunity = true } self:SetVar("myTarget", nil) if self:GetVar("Set.tetherSpeed") ~= nil then local Tspeed = self:GetVar("Set.tetherSpeed") else local Tspeed = 1 end --print("I am tethering") local myPos = getHomePoint(self) self:GoTo { speed = self:GetVar("Set.tetherSpeed"), target = { x = myPos.x, z = myPos.z, y = myPos.y, } } end tether.onArrived = function(self,msg) self:SetVar("CurrentState", "tether") -- print("I have arrived at my home tether point.") self:SetVar("aggrotarget",0) self:SetHealth{ health = self:GetMaxHealth{}.health } self:SetImmunity{ immunity = false } getVarables(self) SetResetState(self) -- Find what state i should reset too end GoHome = State.create() GoHome.onEnter = function(self) self:SetVar("CurrentState", "GoHome") local hpos = getHomePoint(self) --if self:GetVar("Set.FearHP") then -- self:SetVar("FleeStatus",0) -- self:SetVar("FleeDone",true) -- self:SetVar("FleeRetrun",true) -- setState("aggro", self) --else self:GoTo { speed = 1, target = { x =hpos.x ,z =hpos.z ,y =hpos.y } } -- end end GoHome.onArrived = function(self) -- print("I have Arrived at my Home Point") self:SetRotation(self:GetVar("rot")) SetResetState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Aggro function dist(a ,b) local dx = math.abs(b.x - a.x) local dy = math.abs(b.y - a.y) local dz = math.abs(b.z - a.z) local d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) return d end function Distance(point1, point2) local distance = { } distance.x = (point2.x - point1.x) distance.y = (point2.y - point1.y) return distance end --[[ Aggro:: Right away, turn on the heartbeat timer and follow the target. The FollowTarget method will continually follow, face the target, and keep a good attacking distance. When the heartbeat comes back, decide what to do. For now, we just say that we are ready to attack. If you are a given distance from the target and you are facing him, attack. If you cannot attack, wait until onArrived and then attack. --]] function AggroState(self) aggro = State.create() ----------------------------------------------------------------------------- -- Aggro onEnter ----------------------------------------------------------------------------- aggro.onEnter = function(self) self:SetVar("CurrentState", "aggro") local INITIAL_ATTACK_TIME = 1 -- Start the heartbeat self:SetVar("readyToAttack", false) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) local myPos = getHomePoint(self) local target = getObjectByName(self, "AttackingTarget") if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } -- print("Setting Tether Point ") if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end -- end if frozen end -- end else is not dead end -- end function aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = self:GetVar("SkillTime") if (castTime < 1) then print("castTime", castTime) end GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) else onTimerDone(self, msg) end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end -- This will be called if FollowTarget fails. That would only fail because the target has died or logged out. In any case, the target was lost aggro.onCancelled = function(self, msg) self:SetVar("Aggroed", false) --setState("tether",self) ProximityPuls(self) end function DoAttack(self) if (self:GetVar("readyToAttack") == false) then -- print("Not Ready to Attack") return end if CanAttackTarget(self) then -- print("Can Attack") self:SetVar("readyToAttack", false) if self:GetVar("Set.Aggression") == "PassiveAggres" and self:GetVar("AggroOnce") == 0 then self:SetVar("AggroOnce",1) end if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end -- set current skill to max entry in table (default behavior) local attackSkillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] -- look for an attack override skill and use it local bOverrideSkill = self:GetVar("Set.OverRideAttackSkill") local overrideSkillID = self:GetVar("Set.AttackSkill") if (bOverrideSkill and overrideSkillID and bOverrideSkill == true) then attackSkillID = overrideSkillID end -- use an optional target if needed local bUseOptTarget = self:GetVar("Set.UseOptionalTargetOnAttack") if (bUseOptTarget and bUseOptTarget == true) then self:CastSkill{skillID = attackSkillID, optionalTargetID = getObjectByName(self, "AttackingTarget") } else self:CastSkill{skillID = attackSkillID } end end end end -- end create aggro state ----------------------------------------------------------------------------- -- Combat state - native code handling it ----------------------------------------------------------------------------- function CombatState(self) combat = State.create() combat.onEnter = function(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) self:SetVar("CurrentState", "combat") end -- function combat.onEnter end ----------------------------------------------------------------------------- -- CanAttackTarget ----------------------------------------------------------------------------- function CanAttackTarget(self) local myTarget = getObjectByName(self, "AttackingTarget") --local range = self:GetVar("Set.AggroDist") --local myPos = Vector.new(self:GetPosition().pos) --local hisPos = Vector.new(myTarget:GetPosition().pos) --local dist = hisPos - myPos if not myTarget:Exists() or myTarget:IsDead().bDead or not self:IsEnemy{ targetID = myTarget }.enemy then self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) ProximityPuls(self) return false end -- If we are close enough and if the object is in the FOV, then attack --if dist:sqrLength() - range <= range * range then --and (self:IsObjectInFOV { target = myTarget, radius = 5 , minRange = 0, maxRange = 100 }.result) then return true --end --self:SetVar("Aggroed", false) --return false end -- end CanAttackTarget -- Start timer funciton function SetStoreTimmer(intTime, Name, self) -- Start Timer if (intTime) and (Name) and (self) then GAMEOBJ:GetTimer():AddTimerWithCancel( intTime, Name, self ) end -- Store Timer for i = 1, table.maxn(self:GetVar("Timers")) + 1 do if self:GetVar("Timers."..i) == Name then break end if self:GetVar("Timers."..i) == nil then self:SetVar("Timers."..i, Name) end end end function CancelTemplateTimers(self) if self:GetVar("Timers") then for i = 2,table.maxn(self:GetVar("Timers")) do GAMEOBJ:GetTimer():CancelTimer( self:GetVar("Timers."..i), self ) end end end onDie = function(self,msg) if (onTemplateDie) and (onTemplateDie(self, msg) == true ) then return end end require('State') require('o_WayPointEvents') require('o_onEvent') require('o_mis') require("o_Movement") function CreateStates(self) Timers = {} Timers[1] = "blank" self:SetVar("Timers",Timers) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CombatState(self) -- ////////////////////////////////////////////////////////////////////////////////// -- if Way Points if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then UseWayPoints(self) end -- if PetCalss if self:GetVar("Set.Pet_Active") then SetPetClass(self) end -- if Frozen if self:GetVar("Set.MovementType") == "Frozen" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Guard if self:GetVar("Set.MovementType") == "Guard" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Wander if self:GetVar("Set.MovementType") == "Wander" then MeanderState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if follow if self:GetVar("Set.FollowActive") then FollowState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Helper if self:GetVar("Set.Helper") then SetHelper(self) end customState = State.create() customState.onEnter = function(self) if (onTemplateCustomStateEnter) and (onTemplateCustomStateEnter(self, msg) == true ) then return end end customState.onArrived = function(self, msg) if (onTemplateCustomStateArrived) and (onTemplateCustomStateArrived(self, msg) == true ) then return end end -- ////////////////////////////////////////////////////////////////////////////////// -- Idle Idle = State.create() Idle.onEnter = function(self) if self:GetVar("Set.Pet_Active") and not self:GetVar("PetLoaded") then self:SetVar("PetLoaded", true) setState("PetClass",self) end if self:GetVar("RebuildStart") then storeHomePoint(self) self:SetVar("inpursuit",true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Emote_EventDelay") , "rebuildBreak", self ) end end AiDisable = State.create() AiDisable.onEnter = function(self) self:SetVar("myTarget", nil) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CancelTemplateTimers(self) self:SetVar("AiDisabled", true) self:StopPathing() end AiEnable = State.create() AiEnable.onEnter = function(self) self:SetVar("AiDisabled", false) SetResetState(self) end --setState("Dead", self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Death Dead = State.create() Dead.onEnter = function(self) self:SetVar("CurrentState", "Dead") if self:GetVar("I_Have_A_Parent") then local WpSetName = self:GetVar("attached_path") local myParent = getParent(self) local sSplit = split(WpSetName,"_") local xSplit = {} local xSplit= {alpa=sSplit[1] , num=sSplit[2] } myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") setState("DeadChild", myParent) end if self:GetVar("Im_A_Child") then myParent = getParent(self) for i = 1, getParent(self):GetVar("MaxPet") do local myidString = self:GetID() local myfinalID = "|" .. myidString local Pet = getPetID(myParent,i):GetID() if Pet == self:GetID() then myParent:SetVar("StoredPet."..i, "none") myParent:SetVar("Child_Timer."..i, myfinalID ) GAMEOBJ:GetTimer():AddTimerWithCancel( myParent:GetVar("Set.Pet_Respawn") , myfinalID, myParent ) end end end getVarables(self) CancelTemplateTimers(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Tether tether = State.create() tether.onEnter = function(self) self:SetVar("aggrotarget",2) self:SetImmunity{ immunity = false } self:SetVar("myTarget", nil) if self:GetVar("Set.tetherSpeed") ~= nil then local Tspeed = self:GetVar("Set.tetherSpeed") else local Tspeed = 1 end --print("I am tethering") local myPos = getHomePoint(self) self:GoTo { speed = self:GetVar("Set.tetherSpeed"), target = { x = myPos.x, z = myPos.z, y = myPos.y, } } end tether.onArrived = function(self,msg) self:SetVar("CurrentState", "tether") -- print("I have arrived at my home tether point.") self:SetVar("aggrotarget",0) self:SetHealth{ health = self:GetMaxHealth{}.health } self:SetImmunity{ immunity = false } getVarables(self) SetResetState(self) -- Find what state i should reset too end GoHome = State.create() GoHome.onEnter = function(self) self:SetVar("CurrentState", "GoHome") local hpos = getHomePoint(self) --if self:GetVar("Set.FearHP") then -- self:SetVar("FleeStatus",0) -- self:SetVar("FleeDone",true) -- self:SetVar("FleeRetrun",true) -- setState("aggro", self) --else self:GoTo { speed = 1, target = { x =hpos.x ,z =hpos.z ,y =hpos.y } } -- end end GoHome.onArrived = function(self) -- print("I have Arrived at my Home Point") self:SetRotation(self:GetVar("rot")) SetResetState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Aggro function dist(a ,b) local dx = math.abs(b.x - a.x) local dy = math.abs(b.y - a.y) local dz = math.abs(b.z - a.z) local d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) return d end function Distance(point1, point2) local distance = { } distance.x = (point2.x - point1.x) distance.y = (point2.y - point1.y) return distance end --[[ Aggro:: Right away, turn on the heartbeat timer and follow the target. The FollowTarget method will continually follow, face the target, and keep a good attacking distance. When the heartbeat comes back, decide what to do. For now, we just say that we are ready to attack. If you are a given distance from the target and you are facing him, attack. If you cannot attack, wait until onArrived and then attack. --]] function AggroState(self) aggro = State.create() ----------------------------------------------------------------------------- -- Aggro onEnter ----------------------------------------------------------------------------- aggro.onEnter = function(self) self:SetVar("CurrentState", "aggro") local INITIAL_ATTACK_TIME = 1 -- Start the heartbeat self:SetVar("readyToAttack", false) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) local myPos = getHomePoint(self) local target = getObjectByName(self, "AttackingTarget") if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } -- print("Setting Tether Point ") if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end -- end if frozen end -- end else is not dead end -- end function aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = self:GetVar("SkillTime") if (castTime < 1) then print("castTime", castTime) end GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) elseif msg.name == "Bullimmune" then self:SetVar("Stunned", 1 ) print "Bull's Indestructable." ProximityPuls(self) self:SetImmunity{ immunity = true } else onTimerDone(self, msg) end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end -- This will be called if FollowTarget fails. That would only fail because the target has died or logged out. In any case, the target was lost aggro.onCancelled = function(self, msg) self:SetVar("Aggroed", false) --setState("tether",self) ProximityPuls(self) end function DoAttack(self) if (self:GetVar("readyToAttack") == false) then -- print("Not Ready to Attack") return end if CanAttackTarget(self) then -- print("Can Attack") self:SetVar("readyToAttack", false) if self:GetVar("Set.Aggression") == "PassiveAggres" and self:GetVar("AggroOnce") == 0 then self:SetVar("AggroOnce",1) end if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end -- set current skill to max entry in table (default behavior) local attackSkillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] -- look for an attack override skill and use it local bOverrideSkill = self:GetVar("Set.OverRideAttackSkill") local overrideSkillID = self:GetVar("Set.AttackSkill") if (bOverrideSkill and overrideSkillID and bOverrideSkill == true) then attackSkillID = overrideSkillID end -- use an optional target if needed local bUseOptTarget = self:GetVar("Set.UseOptionalTargetOnAttack") if (bUseOptTarget and bUseOptTarget == true) then self:CastSkill{skillID = attackSkillID, optionalTargetID = getObjectByName(self, "AttackingTarget") } else self:CastSkill{skillID = attackSkillID } end end end end -- end create aggro state ----------------------------------------------------------------------------- -- Combat state - native code handling it ----------------------------------------------------------------------------- function CombatState(self) combat = State.create() combat.onEnter = function(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) self:SetVar("CurrentState", "combat") end -- function combat.onEnter end ----------------------------------------------------------------------------- -- CanAttackTarget ----------------------------------------------------------------------------- function CanAttackTarget(self) local myTarget = getObjectByName(self, "AttackingTarget") --local range = self:GetVar("Set.AggroDist") --local myPos = Vector.new(self:GetPosition().pos) --local hisPos = Vector.new(myTarget:GetPosition().pos) --local dist = hisPos - myPos if not myTarget:Exists() or myTarget:IsDead().bDead or not self:IsEnemy{ targetID = myTarget }.enemy then self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) ProximityPuls(self) return false end -- If we are close enough and if the object is in the FOV, then attack --if dist:sqrLength() - range <= range * range then --and (self:IsObjectInFOV { target = myTarget, radius = 5 , minRange = 0, maxRange = 100 }.result) then return true --end --self:SetVar("Aggroed", false) --return false end -- end CanAttackTarget -- Start timer funciton function SetStoreTimmer(intTime, Name, self) -- Start Timer if (intTime) and (Name) and (self) then GAMEOBJ:GetTimer():AddTimerWithCancel( intTime, Name, self ) end -- Store Timer for i = 1, table.maxn(self:GetVar("Timers")) + 1 do if self:GetVar("Timers."..i) == Name then break end if self:GetVar("Timers."..i) == nil then self:SetVar("Timers."..i, Name) end end end function CancelTemplateTimers(self) for i = 2,table.maxn(self:GetVar("Timers")) do GAMEOBJ:GetTimer():CancelTimer( self:GetVar("Timers."..i), self ) end end onDie = function(self,msg) if (onTemplateDie) and (onTemplateDie(self, msg) == true ) then return end end require('State') require('o_WayPointEvents') require('o_onEvent_Motion_Tracker') require('o_mis') require("o_Movement") function CreateStates(self) Timers = {} Timers[1] = "blank" self:SetVar("Timers",Timers) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CombatState(self) -- ////////////////////////////////////////////////////////////////////////////////// -- if Way Points if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then UseWayPoints(self) end -- if PetCalss if self:GetVar("Set.Pet_Active") then SetPetClass(self) end -- if Frozen if self:GetVar("Set.MovementType") == "Frozen" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Guard if self:GetVar("Set.MovementType") == "Guard" then AggroState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Wander if self:GetVar("Set.MovementType") == "Wander" then MeanderState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if follow if self:GetVar("Set.FollowActive") then FollowState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- if Helper if self:GetVar("Set.Helper") then SetHelper(self) end customState = State.create() customState.onEnter = function(self) if (onTemplateCustomStateEnter) and (onTemplateCustomStateEnter(self, msg) == true ) then return end end customState.onArrived = function(self, msg) if (onTemplateCustomStateArrived) and (onTemplateCustomStateArrived(self, msg) == true ) then return end end -- ////////////////////////////////////////////////////////////////////////////////// -- Idle Idle = State.create() Idle.onEnter = function(self) if self:GetVar("Set.Pet_Active") and not self:GetVar("PetLoaded") then self:SetVar("PetLoaded", true) setState("PetClass",self) end if self:GetVar("RebuildStart") then storeHomePoint(self) self:SetVar("inpursuit",true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Emote_EventDelay") , "rebuildBreak", self ) end end AiDisable = State.create() AiDisable.onEnter = function(self) self:SetVar("myTarget", nil) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CancelTemplateTimers(self) self:SetVar("AiDisabled", true) self:StopPathing() end AiEnable = State.create() AiEnable.onEnter = function(self) self:SetVar("AiDisabled", false) SetResetState(self) end end -- ////////////////////////////////////////////////////////////////////////////////// -- Death Dead = State.create() Dead.onEnter = function(self) self:SetVar("CurrentState", "Dead") if self:GetVar("I_Have_A_Parent") then local WpSetName = self:GetVar("attached_path") local myParent = getParent(self) local sSplit = split(WpSetName,"_") local xSplit = {} local xSplit= {alpa=sSplit[1] , num=sSplit[2] } myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") setState("DeadChild", myParent) end if self:GetVar("Im_A_Child") then myParent = getParent(self) for i = 1, getParent(self):GetVar("MaxPet") do local myidString = self:GetID() local myfinalID = "|" .. myidString local Pet = getPetID(myParent,i):GetID() if Pet == self:GetID() then myParent:SetVar("StoredPet."..i, "none") myParent:SetVar("Child_Timer."..i, myfinalID ) GAMEOBJ:GetTimer():AddTimerWithCancel( myParent:GetVar("Set.Pet_Respawn") , myfinalID, myParent ) end end end getVarables(self) CancelTemplateTimers(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Tether tether = State.create() tether.onEnter = function(self) self:SetVar("aggrotarget",2) self:SetVar("myTarget", nil) if self:GetVar("Set.tetherSpeed") ~= nil then local Tspeed = self:GetVar("Set.tetherSpeed") else local Tspeed = 1 end self:SetVar("collideswitch", 1) local myPos = getHomePoint(self) self:GoTo { speed = self:GetVar("Set.tetherSpeed"), target = { x = myPos.x, z = myPos.z, y = myPos.y }} end tether.onArrived = function(self,msg) self:SetVar("CurrentState", "tether") self:SetVar("aggrotarget",0) self:SetHealth{ health = self:GetMaxHealth{}.health } getVarables(self) SetResetState(self) end tether.onCollisionPhantom = function(self,msg) local target = msg.objectID local faction = target:GetFaction() local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z if faction and faction.faction == 1 and playerVelx ~= 0 and playerVely ~= 0 and playerVelz ~= 0 and self:GetVar("collideswitch") == 1 then self:NotifyClientObject{name = "Gotcha"} self:SetVar("collideswitch", 0) local myPos = self:GetPosition().pos local myTarget = msg.objId CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", target) storeHomePoint(self) self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } self:SetVar("aggrotarget",1) self:SetVar("pauseswitch", 1) setState("aggro", self) GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "CheckingforMovement", self ) end end GoHome = State.create() GoHome.onEnter = function(self) self:SetVar("CurrentState", "GoHome") local hpos = getHomePoint(self) self:GoTo { speed = 1, target = { x =hpos.x ,z =hpos.z ,y =hpos.y } } end GoHome.onArrived = function(self) self:SetRotation(self:GetVar("rot")) SetResetState(self) end -- ////////////////////////////////////////////////////////////////////////////////// -- Aggro function dist(a ,b) local dx = math.abs(b.x - a.x) local dy = math.abs(b.y - a.y) local dz = math.abs(b.z - a.z) local d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) return d end function Distance(point1, point2) local distance = { } distance.x = (point2.x - point1.x) distance.y = (point2.y - point1.y) return distance end --[[ Aggro:: Right away, turn on the heartbeat timer and follow the target. The FollowTarget method will continually follow, face the target, and keep a good attacking distance. When the heartbeat comes back, decide what to do. For now, we just say that we are ready to attack. If you are a given distance from the target and you are facing him, attack. If you cannot attack, wait until onArrived and then attack. --]] function AggroState(self) aggro = State.create() ----------------------------------------------------------------------------- -- Aggro onEnter ----------------------------------------------------------------------------- aggro.onEnter = function(self) self:SetVar("CurrentState", "aggro") local INITIAL_ATTACK_TIME = 1 -- Start the heartbeat self:SetVar("readyToAttack", false) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) local myPos = getHomePoint(self) local target = getObjectByName(self, "AttackingTarget") if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } -- print("Setting Tether Point ") if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end -- end if frozen end -- end else is not dead end -- end function aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = self:GetVar("SkillTime") if (castTime < 1) then print("castTime", castTime) end GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) elseif msg.name == "CheckingforMovement" then if self:GetVar("pauseswitch") == 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "CheckingforMovement", self ) local target = getObjectByName(self, "AttackingTarget") local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z if playerVelx == 0 and playerVely == 0 and playerVelz == 0 then self:NotifyClientObject{name = "Lostya"} self:PlayAnimation{ animationID = "looking" } --self:SetVar("AttackingTarget", "NoTarget" ) --self:SetVar("Aggroed", false) self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = 0 , keepFollowing = false } GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0 , "MotionTrackPause", self ) self:SetVar("pauseswitch", 0) self:SetRotation(self:GetVar("rot")) GAMEOBJ:GetTimer():CancelTimer("CheckingforMovement", self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "CheckingforMovementAfterPause", self ) else end end elseif msg.name == "CheckingforMovementAfterPause" then local target = getObjectByName(self, "AttackingTarget") local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z if playerVelx == 0 and playerVelz == 0 then self:PlayAnimation{ animationID = "looking" } --self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = 0 , keepFollowing = false } GAMEOBJ:GetTimer():CancelTimer("CheckingforMovementAfterPause", self) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "CheckingforMovementAfterPause", self ) else self:SetVar("pauseswitch", 1) --ProximityPuls(self) GAMEOBJ:GetTimer():CancelTimer( "MotionTrackPause", self ) self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "CheckingforMovement", self ) GAMEOBJ:GetTimer():CancelTimer("CheckingforMovementAfterPause", self) self:NotifyClientObject{name = "Gotcha"} end elseif msg.name == "MotionTrackPause" then if self:GetVar("pauseswitch") == 0 then self:SetVar("collideswitch", 1) self:SetVar("pauseswitch", 1) self:SetVar("Aggroed", true) setState("tether", self) GAMEOBJ:GetTimer():CancelTimer("MeanderPause", self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "MeanderPause", self ) GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovementAfterPause", self ) end end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end -- This will be called if FollowTarget fails. That would only fail because the target has died or logged out. In any case, the target was lost aggro.onCancelled = function(self, msg) self:SetVar("Aggroed", false) --setState("tether",self) ProximityPuls(self) end function DoAttack(self) if (self:GetVar("readyToAttack") == false) then -- print("Not Ready to Attack") return end if CanAttackTarget(self) then -- print("Can Attack") self:SetVar("readyToAttack", false) if self:GetVar("Set.Aggression") == "PassiveAggres" and self:GetVar("AggroOnce") == 0 then self:SetVar("AggroOnce",1) end if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end -- set current skill to max entry in table (default behavior) local attackSkillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] -- look for an attack override skill and use it local bOverrideSkill = self:GetVar("Set.OverRideAttackSkill") local overrideSkillID = self:GetVar("Set.AttackSkill") if (bOverrideSkill and overrideSkillID and bOverrideSkill == true) then attackSkillID = overrideSkillID end -- use an optional target if needed local bUseOptTarget = self:GetVar("Set.UseOptionalTargetOnAttack") if (bUseOptTarget and bUseOptTarget == true) then self:CastSkill{skillID = attackSkillID, optionalTargetID = getObjectByName(self, "AttackingTarget") } else self:CastSkill{skillID = attackSkillID } end end end end -- end create aggro state ----------------------------------------------------------------------------- -- Combat state - native code handling it ----------------------------------------------------------------------------- function CombatState(self) combat = State.create() combat.onEnter = function(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) self:SetVar("CurrentState", "combat") end -- function combat.onEnter end ----------------------------------------------------------------------------- -- CanAttackTarget ----------------------------------------------------------------------------- function CanAttackTarget(self) local myTarget = getObjectByName(self, "AttackingTarget") --local range = self:GetVar("Set.AggroDist") --local myPos = Vector.new(self:GetPosition().pos) --local hisPos = Vector.new(myTarget:GetPosition().pos) --local dist = hisPos - myPos if not myTarget:Exists() or myTarget:IsDead().bDead or not self:IsEnemy{ targetID = myTarget }.enemy then self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) ProximityPuls(self) return false end -- If we are close enough and if the object is in the FOV, then attack --if dist:sqrLength() - range <= range * range then --and (self:IsObjectInFOV { target = myTarget, radius = 5 , minRange = 0, maxRange = 100 }.result) then return true --end --self:SetVar("Aggroed", false) --return false end -- end CanAttackTarget -- Start timer funciton function SetStoreTimmer(intTime, Name, self) -- Start Timer if (intTime) and (Name) and (self) then GAMEOBJ:GetTimer():AddTimerWithCancel( intTime, Name, self ) end -- Store Timer for i = 1, table.maxn(self:GetVar("Timers")) + 1 do if self:GetVar("Timers."..i) == Name then break end if self:GetVar("Timers."..i) == nil then self:SetVar("Timers."..i, Name) end end end function CancelTemplateTimers(self) for i = 2,table.maxn(self:GetVar("Timers")) do GAMEOBJ:GetTimer():CancelTimer( self:GetVar("Timers."..i), self ) end end onDie = function(self,msg) if (onTemplateDie) and (onTemplateDie(self, msg) == true ) then return end end require('State') require('o_WayPointEvents') require('o_onEvent') require('o_mis') require("o_Movement") function CreateStates(self) Timers = {} Timers[1] = "blank" self:SetVar("Timers",Timers) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CombatState(self) -- if Way Points if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then UseWayPoints(self) end -- if Frozen if self:GetVar("Set.MovementType") == "Frozen" then AggroState(self) end -- if Guard if self:GetVar("Set.MovementType") == "Guard" then AggroState(self) end -- if Wander if self:GetVar("Set.MovementType") == "Wander" then MeanderState(self) end -- if follow if self:GetVar("Set.FollowActive") then FollowState(self) end -- if Helper if self:GetVar("Set.Helper") then SetHelper(self) end customState = State.create() customState.onEnter = function(self) if (onTemplateCustomStateEnter) and (onTemplateCustomStateEnter(self, msg) == true ) then return end end customState.onArrived = function(self, msg) if (onTemplateCustomStateArrived) and (onTemplateCustomStateArrived(self, msg) == true ) then return end end Idle = State.create() Idle.onEnter = function(self) if self:GetVar("Set.Pet_Active") and not self:GetVar("PetLoaded") then print "Pet stuff?" self:SetVar("PetLoaded", true) setState("PetClass",self) end if self:GetVar("RebuildStart") then print "Pet stuff?" storeHomePoint(self) self:SetVar("inpursuit",true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Emote_EventDelay") , "rebuildBreak", self ) end end AiDisable = State.create() AiDisable.onEnter = function(self) print "AI Disabled?" self:SetVar("myTarget", nil) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CancelTemplateTimers(self) self:SetVar("AiDisabled", true) self:StopPathing() end AiEnable = State.create() AiEnable.onEnter = function(self) print "AI Enabled?" self:SetVar("AiDisabled", false) SetResetState(self) end end Dead = State.create() Dead.onEnter = function(self) self:SetVar("CurrentState", "Dead") if self:GetVar("I_Have_A_Parent") then local WpSetName = self:GetVar("attached_path") local myParent = getParent(self) local sSplit = split(WpSetName,"_") local xSplit = {} local xSplit= {alpa=sSplit[1] , num=sSplit[2] } myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") setState("DeadChild", myParent) end if self:GetVar("Im_A_Child") then myParent = getParent(self) for i = 1, getParent(self):GetVar("MaxPet") do local myidString = self:GetID() local myfinalID = "|" .. myidString local Pet = getPetID(myParent,i):GetID() if Pet == self:GetID() then myParent:SetVar("StoredPet."..i, "none") myParent:SetVar("Child_Timer."..i, myfinalID ) GAMEOBJ:GetTimer():AddTimerWithCancel( myParent:GetVar("Set.Pet_Respawn") , myfinalID, myParent ) end end end getVarables(self) CancelTemplateTimers(self) end tether = State.create() tether.onEnter = function(self) --print "I'm a tetherin' fool." self:SetVar("myTarget", nil) if self:GetVar("Set.tetherSpeed") ~= nil then local Tspeed = self:GetVar("Set.tetherSpeed") else local Tspeed = 1 end local myPos = getHomePoint(self) self:GoTo { speed = self:GetVar("Set.tetherSpeed"), target = { x = myPos.x, y = myPos.y, z = myPos.z }} end tether.onArrived = function(self,msg) --print "I have arrived at my home tether point." self:SetHealth{ health = self:GetMaxHealth{}.health } getVarables(self) SetResetState(self) end tether.onCollisionPhantom = function(self,msg) print "Aggro time" setState("aggro", self) end GoHome = State.create() GoHome.onEnter = function(self) --print "I'm going home!" self:SetVar("CurrentState", "GoHome") local hpos = getHomePoint(self) self:GoTo { speed = 1, target = { x =hpos.x ,z =hpos.z ,y =hpos.y } } end GoHome.onArrived = function(self) --print "I'm home!" self:SetRotation(self:GetVar("rot")) SetResetState(self) end function AggroState(self) aggro = State.create() aggro.onCollisionPhantom = function(self, msg) local myPos = getHomePoint(self) local target = msg.objectID local faction = target:GetFaction() local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z self:SetVar("CurrentState", "aggro") self:SetVar("readyToAttack", false) if faction and faction.faction == 1 and playerVelx ~= 0 and playerVely ~= 0 and playerVelz ~= 0 and self:GetVar("switch") == 1 then self:SetVar("switch", 0) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) GAMEOBJ:GetTimer():CancelTimer( "AggroCheck", self ) --print "I see you!" local INITIAL_ATTACK_TIME = 1 GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end end end end aggro.onOffCollisionPhantom = function(self, msg) local myPos = getHomePoint(self) local target = msg.objectID local faction = target:GetFaction() local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z self:SetVar("CurrentState", "aggro") self:SetVar("readyToAttack", false) if faction and faction.faction == 1 and playerVelx ~= 0 and playerVely ~= 0 and playerVelz ~= 0 and self:GetVar("switch") == 1 then self:SetVar("switch", 0) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) GAMEOBJ:GetTimer():CancelTimer( "AggroCheck", self ) --print "I see you!" local INITIAL_ATTACK_TIME = 1 GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end end end end aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = self:GetVar("SkillTime") if (castTime < 1) then print ("castTime", castTime) end GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) elseif msg.name == "CheckingforMovement" then if self:GetVar("pauseswitch") == 1 then GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0 , "CheckingforMovement", self ) local target = getObjectByName(self, "AttackingTarget") local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z if playerVelx == 0 and playerVely == 0 and playerVelz == 0 then print "Where did you go?" self:PlayAnimation{ animationID = "looking" } self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) GAMEOBJ:GetTimer():CancelTimer( "MotionTrackPause", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0 , "MotionTrackPause", self ) self:SetVar("pauseswitch", 0) else print "I see you!" end end elseif msg.name == "AggroCheck" then --self:SetVar("CurrentState", "aggro") --self:SetVar("readyToAttack", false) --self:SetVar("Aggroed", true) SetResetState(self) GAMEOBJ:GetTimer():CancelTimer( "AggroCheck", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "AggroCheck", self ) ProximityPuls(self) print "Aggro stuff" elseif msg.name == "MotionTrackPause" then if self:GetVar("pauseswitch") == 0 then print "Go back to wander." self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) GAMEOBJ:GetTimer():CancelTimer("MeanderPause", self) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "MeanderPause", self ) SetResetState(self) GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) --GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0 , "ResetSeeing", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "AggroCheck", self ) end elseif msg.name == "ResetSeeing" then print "Reset" self:SetVar("pauseswitch", 1) self:SetVar("switch", 1) self:SetVar("Aggroed", false) SetResetState(self) GAMEOBJ:GetTimer():CancelTimer( "AggroCheck", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0, "AggroCheck", self ) end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onOnHit = function(self, msg) local myPos = getHomePoint(self) local target = msg.attacker local faction = target:GetFaction() local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z self:SetVar("CurrentState", "aggro") self:SetVar("readyToAttack", false) if faction and faction.faction == 1 and self:GetVar("switch") == 1 then self:SetVar("switch", 0) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) --print "I see you!" local INITIAL_ATTACK_TIME = 1 GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.0 , "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) --self:SetRotation(self:GetVar("rot")) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end end end end aggro.onEnter = function(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end aggro.onCancelled = function(self, msg) self:SetVar("Aggroed", false) ProximityPuls(self) end function DoAttack(self) if (self:GetVar("readyToAttack") == false) then return end if CanAttackTarget(self) then self:SetVar("readyToAttack", false) if self:GetVar("Set.Aggression") == "PassiveAggres" and self:GetVar("AggroOnce") == 0 then self:SetVar("AggroOnce",1) end if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end local attackSkillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] local bOverrideSkill = self:GetVar("Set.OverRideAttackSkill") local overrideSkillID = self:GetVar("Set.AttackSkill") if (bOverrideSkill and overrideSkillID and bOverrideSkill == true) then attackSkillID = overrideSkillID end local bUseOptTarget = self:GetVar("Set.UseOptionalTargetOnAttack") if (bUseOptTarget and bUseOptTarget == true) then self:CastSkill{skillID = attackSkillID, optionalTargetID = getObjectByName(self, "AttackingTarget") } else self:CastSkill{skillID = attackSkillID } end end end end function CombatState(self) combat = State.create() combat.onEnter = function(self) end end function CanAttackTarget(self) local myTarget = getObjectByName(self, "AttackingTarget") if not myTarget:Exists() or myTarget:IsDead().bDead or not self:IsEnemy{ targetID = myTarget }.enemy then self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) ProximityPuls(self) return false end return true end function SetStoreTimmer(intTime, Name, self) if (intTime) and (Name) and (self) then GAMEOBJ:GetTimer():AddTimerWithCancel( intTime, Name, self ) end for i = 1, table.maxn(self:GetVar("Timers")) + 1 do if self:GetVar("Timers."..i) == Name then break end if self:GetVar("Timers."..i) == nil then self:SetVar("Timers."..i, Name) end end end function CancelTemplateTimers(self) for i = 2,table.maxn(self:GetVar("Timers")) do GAMEOBJ:GetTimer():CancelTimer( self:GetVar("Timers."..i), self ) print "3" end end onDie = function(self,msg) if (onTemplateDie) and (onTemplateDie(self, msg) == true ) then return end end function onTimerDone(self, msg) if msg.name == "AggroCheck" then print "Non aggro stuff" self:SetVar("switch", 1) self:SetVar("pauseswitch", 1) self:SetVar("CurrentState", "aggro") self:SetVar("readyToAttack", false) self:SetVar("Aggroed", true) GAMEOBJ:GetTimer():CancelTimer( "AggroCheck", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 3.0, "AggroCheck", self ) ProximityPuls(self) end endrequire('State') require('o_WayPointEvents') require('o_onEvent') require('o_mis') require("o_Movement") function CreateStates(self) Timers = {} Timers[1] = "blank" self:SetVar("Timers",Timers) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CombatState(self) if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then UseWayPoints(self) end if self:GetVar("Set.Pet_Active") then SetPetClass(self) end if self:GetVar("Set.MovementType") == "Frozen" then AggroState(self) end if self:GetVar("Set.MovementType") == "Guard" then AggroState(self) end if self:GetVar("Set.MovementType") == "Wander" then MeanderState(self) end if self:GetVar("Set.FollowActive") then FollowState(self) end if self:GetVar("Set.Helper") then SetHelper(self) end customState = State.create() customState.onEnter = function(self) if (onTemplateCustomStateEnter) and (onTemplateCustomStateEnter(self, msg) == true ) then return end end customState.onArrived = function(self, msg) if (onTemplateCustomStateArrived) and (onTemplateCustomStateArrived(self, msg) == true ) then return end end Idle = State.create() Idle.onEnter = function(self) if self:GetVar("Set.Pet_Active") and not self:GetVar("PetLoaded") then self:SetVar("PetLoaded", true) setState("PetClass",self) end if self:GetVar("RebuildStart") then storeHomePoint(self) self:SetVar("inpursuit",true) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.Emote_EventDelay") , "rebuildBreak", self ) end end AiDisable = State.create() AiDisable.onEnter = function(self) self:SetVar("myTarget", nil) storeHomePoint(self) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } CancelTemplateTimers(self) self:SetVar("AiDisabled", true) self:StopPathing() end AiEnable = State.create() AiEnable.onEnter = function(self) self:SetVar("AiDisabled", false) SetResetState(self) end end Dead = State.create() Dead.onEnter = function(self) self:SetVar("CurrentState", "Dead") if self:GetVar("I_Have_A_Parent") then local WpSetName = self:GetVar("attached_path") local myParent = getParent(self) local sSplit = split(WpSetName,"_") local xSplit = {} local xSplit= {alpa=sSplit[1] , num=sSplit[2] } myParent:SetVar( self:GetVar("SpawnedVar") , "NotSpawned") setState("DeadChild", myParent) end if self:GetVar("Im_A_Child") then myParent = getParent(self) for i = 1, getParent(self):GetVar("MaxPet") do local myidString = self:GetID() local myfinalID = "|" .. myidString local Pet = getPetID(myParent,i):GetID() if Pet == self:GetID() then myParent:SetVar("StoredPet."..i, "none") myParent:SetVar("Child_Timer."..i, myfinalID ) GAMEOBJ:GetTimer():AddTimerWithCancel( myParent:GetVar("Set.Pet_Respawn") , myfinalID, myParent ) end end end getVarables(self) CancelTemplateTimers(self) end tether = State.create() tether.onEnter = function(self) self:SetVar("aggrotarget",2) self:SetImmunity{ immunity = true } self:SetVar("myTarget", nil) if self:GetVar("Set.tetherSpeed") ~= nil then local Tspeed = self:GetVar("Set.tetherSpeed") else local Tspeed = 1 end local myPos = getHomePoint(self) self:GoTo { speed = self:GetVar("Set.tetherSpeed"), target = { x = myPos.x, y = myPos.y, z = myPos.z } } end tether.onArrived = function(self,msg) self:SetVar("CurrentState", "tether") self:SetVar("aggrotarget",0) self:SetHealth{ health = self:GetMaxHealth{}.health } self:SetImmunity{ immunity = false } getVarables(self) SetResetState(self) end GoHome = State.create() GoHome.onEnter = function(self) self:SetVar("CurrentState", "GoHome") local hpos = getHomePoint(self) self:GoTo { speed = 1, target = { x =hpos.x ,z =hpos.z ,y =hpos.y } } end GoHome.onArrived = function(self) self:SetRotation(self:GetVar("rot")) SetResetState(self) end function dist(a ,b) local dx = math.abs(b.x - a.x) local dy = math.abs(b.y - a.y) local dz = math.abs(b.z - a.z) local d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) return d end function Distance(point1, point2) local distance = { } distance.x = (point2.x - point1.x) distance.y = (point2.y - point1.y) return distance end function AggroState(self) aggro = State.create() aggro.onEnter = function(self) self:SetVar("CurrentState", "aggro") local INITIAL_ATTACK_TIME = 1 self:SetVar("readyToAttack", false) GAMEOBJ:GetTimer():AddTimerWithCancel( INITIAL_ATTACK_TIME , "AttackHeartBeat", self ) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) local myPos = getHomePoint(self) local target = getObjectByName(self, "AttackingTarget") if target:IsDead().bDead then self:SetVar("Aggroed", false) ProximityPuls(self) else if self:GetVar("Set.MovementType") ~= "Frozen" then self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } if self:GetVar("Set.AggroDist") ~= nil and self:GetVar("Set.AggroSpeed") ~= nil then self:FollowTarget { targetID = target, radius = self:GetVar("Set.AggroDist"),speed = self:GetVar("Set.AggroSpeed") * 2 , keepFollowing = true } self:SetVar("Aggroed", true) else self:FollowTarget { targetID = target,radius = 3, speed = 1, keepFollowing = true } end end end end aggro.onTimerDone = function(self, msg) if msg.name == "AttackHeartBeat" then self:SetVar("readyToAttack", true) DoAttack(self); local castTime = self:GetVar("SkillTime") if (castTime < 1) then print("castTime", castTime) end GAMEOBJ:GetTimer():AddTimerWithCancel( castTime , "AttackHeartBeat", self ) end if msg.name == "BeetleFlip" then print "MOVE!" self:SetHealth{ health = 2 } self:AddSkill{ skillID = 134 } end if msg.name == "BullStun" then print "Ready to miss again." self:SetVar("Stunned", 1 ) end end aggro.onArrived = function(self, msg) DoAttack(self) end aggro.onExit = function(self) GAMEOBJ:GetTimer():CancelTimer("AttackHeartBeat", self) end aggro.onCancelled = function(self, msg) self:SetVar("Aggroed", false) ProximityPuls(self) end function DoAttack(self) if (self:GetVar("readyToAttack") == false) then return end if CanAttackTarget(self) then self:SetVar("readyToAttack", false) if self:GetVar("Set.Aggression") == "PassiveAggres" and self:GetVar("AggroOnce") == 0 then self:SetVar("AggroOnce",1) end if self:GetVar("MaxTableSkill") == nil then for i = 1, table.maxn (self:GetSkills().skills) do self:SetVar("MaxTableSkill", i ) end end local attackSkillID = self:GetSkills().skills[self:GetVar("MaxTableSkill")] local bOverrideSkill = self:GetVar("Set.OverRideAttackSkill") local overrideSkillID = self:GetVar("Set.AttackSkill") if (bOverrideSkill and overrideSkillID and bOverrideSkill == true) then attackSkillID = overrideSkillID end local bUseOptTarget = self:GetVar("Set.UseOptionalTargetOnAttack") if (bUseOptTarget and bUseOptTarget == true) then self:CastSkill{skillID = attackSkillID, optionalTargetID = getObjectByName(self, "AttackingTarget") } else self:CastSkill{skillID = attackSkillID } end end end end function CombatState(self) combat = State.create() combat.onEnter = function(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) self:SetVar("CurrentState", "combat") end -- function combat.onEnter end function CanAttackTarget(self) local myTarget = getObjectByName(self, "AttackingTarget") if not myTarget:Exists() or myTarget:IsDead().bDead or not self:IsEnemy{ targetID = myTarget }.enemy then self:SetVar("AttackingTarget", "NoTarget" ) self:SetVar("Aggroed", false) ProximityPuls(self) return false end return true end function SetStoreTimmer(intTime, Name, self) if (intTime) and (Name) and (self) then GAMEOBJ:GetTimer():AddTimerWithCancel( intTime, Name, self ) end for i = 1, table.maxn(self:GetVar("Timers")) + 1 do if self:GetVar("Timers."..i) == Name then break end if self:GetVar("Timers."..i) == nil then self:SetVar("Timers."..i, Name) end end end function CancelTemplateTimers(self) for i = 2,table.maxn(self:GetVar("Timers")) do GAMEOBJ:GetTimer():CancelTimer( self:GetVar("Timers."..i), self ) end end onDie = function(self,msg) if (onTemplateDie) and (onTemplateDie(self, msg) == true ) then return end end function onTimerDone(self, msg) if msg.name == "ToggleRobotReady" then self:SetVar("ICanSee", 1 ) print "I can see again!" end if msg.name == "ToggleRobotNotReady" then self:SetVar("ICantSee", 1 ) print "AGAIN?!" end end require('Vector') function emote(self,target, skillType) self:SetVar("EmbeddedTime", self:GetAnimationTime{ animationID = skillType }.time) self:PlayFXEffect{ priority = 1.5 ,effectType = skillType } end function showemote(self,target, skillID, skillType) -- self:ShowEffect { -- effectID = skillID, -- type = skillType, --} end Emote = { emote = emote} function getVarables(self) self:SetVar("myTarget", nil) self:SetVar("readyToAttack", true) self:SetVar("WPEvent_NUM", 1) self:SetVar("AggroEmoteDelay", true) self:SetVar("delayDone","Start") self:SetVar("aggrotarget",0) self:SetVar("delayDone","Start") self:SetVar("tetherOn",false) self:SetVar("Dead",false) self:SetVar("myTarget",nil) self:SetVar("inpursuit",false) self:SetVar("AggroOnce", 0 ) self:SetVar("HearBeat", false) end function loadOnce(self) self:SetVar("AttackingTarget", "NoTarget" ) -- Lua Attachs Way Point Set if self:GetVar("Set.WayPointSet") ~= nil then self:SetVar("attached_path", self:GetVar("Set.WayPointSet")) end -- Check if NPC is attached to a WP Set. if self:GetVar("Set.SuspendLuaMovementAI") == nil or self:GetVar("Set.SuspendLuaMovementAI") == false then if self:GetVar("attached_path") ~= nil then self:FollowWaypoints() end end self:SetVar("PointInLine",false) self:SetVar("FollowState", "start") --self:SetVar("PointInLine",1) Child_Timer = {} local skill = self:GetSkills().skills[1]; if (skill ~= 0) then self:SetVar("SkillTime", self:GetSkillInfo{skillID = skill}.cooldown) end self:SetVar("Child_Timer", Child_Timer ) self:SetVar("MaxPet", self:GetVar("Set.Pet_Count")) hp = self:GetMaxHealth{}.health self:SetHealth{ health = hp } self:SetVar("inpursuit",false) self:SetVar("aggrotarget",0) if self:GetVar("Set.OverRideName") then self:SetName { name = self:GetVar("Set.Name") } end if self:GetVar("Set.OverRideHealth") then self:SetMaxHealth{ health = self:GetVar("Set.Health") } self:SetHealth{ health = self:GetVar("Set.Health") } end end --/////////////////////////////////////////////////////////////////// -- Delay local function shift(fn) coroutine.yield(fn) end --/////////////////////////////////////////////////////////////////// -- Reset State function SetResetState(self) getVarables(self) self:SetVar("inpursuit",false) self:SetVar("AttackingTarget", "NoTarget" ) self:SetTetherPoint { tetherPt = self:GetPosition().pos,radius = 0 } if self:GetVar("Set.SuspendLuaMovementAI") == nil or self:GetVar("Set.SuspendLuaMovementAI") == false then if self:GetVar("attached_path") ~= nil then self:FollowWaypoints() return end if self:GetVar("Set.MovementType") == "Wander" then setState("Meander", self) return end end if self:GetVar("Set.MovementType") == "Guard" then setState("Idle", self) return end end local function proc(fn) local coro = coroutine.wrap(fn) local cont = function (...) local cb = coro(unpack(arg)) if cb then cb() end end cont(cont) end Delay = { proc = proc, shift = shift, } -- -------------------------------------------------------- -- Targeting / Storing -------------------------------------------------------- Var = {} Var.__index = Var function Var.__G(self,x) self:GetVar(x) return x end function Var.__S(self,x) self:SetVar(x) end function storeTarget(self, target) idString = target:GetID() finalID = "|" .. idString self:SetVar("myTarget", finalID) end function getMyTarget(self) targetID = self:GetVar("myTarget") return GAMEOBJ:GetObjectByID(targetID) end function storePet(self,ID, name , num ) idString = ID:GetID() finalID = "|" .. idString self:SetVar(name..num , finalID) end function getPet(self, name , num ) targetID = self:GetVar(name..num) return GAMEOBJ:GetObjectByID(targetID) end function getIDany(self, string ,holder) targetID = holder:GetVar(string) return GAMEOBJ:GetObjectByID(targetID) end function getParent(self) targetID = self:GetVar("My_Parent_ID") return GAMEOBJ:GetObjectByID(targetID) end function getPetID(self,num) targetID = self:GetVar("StoredPet."..num) return GAMEOBJ:GetObjectByID(targetID) end function storeParent(self, target) idString = self:GetID() finalID = "|" .. idString target:SetVar("My_Parent_ID", finalID) end function storeHomePoint(self) mypos = self:GetPosition().pos myX = self:SetVar("myx", mypos.x) myY = self:SetVar("myy", mypos.y) myZ = self:SetVar("myz", mypos.z) rot = self:GetRotation() self:SetVar("rot",rot) end function getHomePoint(self) pos = {} pos.x = self:GetVar("myx") pos.y = self:GetVar("myy") pos.z = self:GetVar("myz") return pos end function storeMeanderPoint(self) mypos = self:GetPosition().pos myX = self:SetVar("Meadx", mypos.x) myY = self:SetVar("Meady", mypos.y) myZ = self:SetVar("Meadz", mypos.z) end function getMeanderPoint(self) pos = {} pos.x = self:GetVar("Meadx") pos.y = self:GetVar("Meady") pos.z = self:GetVar("Meadz") return pos end -------------------------------------------------------------- -- returns turns a random pos. radius = distance -------------------------------------------------------------- function getRandomPos(self,myPos,radius) PoSSet = radius + radius PoSMin = radius - PoSSet PoSMax = radius PoS = {} PoS.x = myPos.x + math.random (PoSMin, PoSMax) PoS.z = myPos.z + math.random (PoSMin, PoSMax) PoS.y = myPos.y return PoS end function getRandomDelay(self) Min = self:GetVar("Set.WanderDelayMin") Max = self:GetVar("Set.WanderDelayMax") ran = math.random(Min,Max) return ran end -------------------------------------------------------------- -- returns turns a random Flee pos. radius = dis to flee -------------------------------------------------------------- function getRandomFleePos(self,myPos,radius) PoSSet = radius + radius PoSMin = radius - PoSSet PoSMax = radius PoS = {} PoS.x = myPos.x + math.random (PoSMin, PoSMax) PoS.z = myPos.z + radius PoS.y = myPos.y return PoS end -------------------------------------------------------------- -- returns the Heading of an Object -------------------------------------------------------------- function getHeading(obj) local q = obj:GetRotation() return({ x = 2 * q.y * q.w + 2 * q.x * q.x, y = 2 * q.z * q.y - 2 * q.x * q.w, z = q.z*q.z + q.w*q.w - q.x*q.x - q.y*q.y, }) end --[[ -------------------------------------------------------------- -- Splits a string. ## Sample ::: local string = "1,2,Alpah" loacl final = split(string,",") final returns a table with [1] = 1 [2] = 2 [3] = Alpah -------------------------------------------------------------- --]] function split(str, pat) local t = {} -- NOTE: use {n = 0} in Lua-5.0 local fpat = "(.-)" .. pat local last_end = 1 local s, e, cap = str:find(fpat, 1) while s do if s ~= 1 or cap ~= "" then table.insert(t,cap) end last_end = e+1 s, e, cap = str:find(fpat, last_end) end if last_end <= #str then cap = str:sub(last_end) table.insert(t, cap) end return t end -------------------------------------------------------------- -- returns the Distance between A and B -------------------------------------------------------------- function dist(a ,b) local dx = math.abs(b.x - a.x) local dy = math.abs(b.y - a.y) local dz = math.abs(b.z - a.z) local d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2)) return d end -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- register with zone control object -------------------------------------------------------------- function registerWithZoneControlObject(self) -- register with zone control object GAMEOBJ:GetZoneControlID():ObjectLoaded{ objectID = self, templateID = self:GetLOT().objtemplate } end -------------------------------------------------------------- -- play actions on an object --------- CLIENT ONLY -- Must ADD the Following to your Script --CONSTANTS = {} --CONSTANTS["NO_OBJECT"] = "0" -------------------------------------------------------------- function DoObjectAction(actor, type, action) -- spatial chat if (type == "chat") then actor:DisplayChatBubble{wsText = action} -- animation elseif (type == "anim") then local anim_time = actor:GetAnimationTime{ animationID = action }.time if (tonumber(anim_time) > 0) then actor:PlayAnimation{animationID = action} end -- effect elseif (type == "effect") then actor:PlayFXEffect{name = "N_" .. action, effectType = action } elseif (type == "stopeffects") then actor:StopFXEffect{ name = "N_" .. action } end end -------------------------------------------------------------- function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end -------------------------------------------------------------- -------------------------------------------------------------- -- Table to String function implode(d,p) if p ~= nil then local newstr newstr = "" if(#p == 1) then return p[1] end for ii = 1, (#p-1) do newstr = newstr .. p[ii] .. d end newstr = newstr .. p[#p] return newstr end end -------------------------------------------------------------- -------------------------------------------------------------- ---// CHILL CODE //-- -- table.ordered( [sorted reverse], [type] ) v 2 -- Lua 5.x add-on for the table library -- Table using sorted index, with binary table for fast lookup. -- http://lua-users.org/wiki/OrderedTable by PhilippeFremy -- table.ordered( [sorted reverse], [type] ) -- Gives you back a ordered table, can only take entered type -- as index returned by type(index), by default "string" -- sorted reverse, sorts the table in reverse order, else normal -- stype is the deault index type returned by type( index ), -- by default "string", it is only pssible to set one type as index -- will effectively create a binary table, and will always lookup -- through binary when an index is called function table.ordered(ireverse, stype) local newmetatable = {} -- set sort function if ireverse then newmetatable._ireverse = 1 function newmetatable.fcomp(a, b) return b[1] < a[1] end else function newmetatable.fcomp(a, b) return a[1] < b[1] end end -- set type by default "string" newmetatable.stype = stype or "string" -- fcomparevariable function newmetatable.fcompvar(value) return value[1] end -- sorted subtable newmetatable._tsorted = {} -- behaviour on new index function newmetatable.__newindex(t, key, value) if type(key) == getmetatable(t).stype then local fcomp = getmetatable(t).fcomp local fcompvar = getmetatable(t).fcompvar local tsorted = getmetatable(t)._tsorted local ireverse = getmetatable(t)._ireverse -- value is given so either update or insert newly if value then local pos, _ = table.bfind(tsorted, key, fcompvar, ireverse) -- if pos then update the index if pos then tsorted[pos] = {key, value} -- else insert new value else table.binsert(tsorted, {key, value}, fcomp) end -- value is nil so remove key else local pos, _ = table.bfind(tsorted, key, fcompvar, ireverse) if pos then table.remove(tsorted, pos) end end end end -- behavior on index function newmetatable.__index(t, key) if type(key) == getmetatable(t).stype then local fcomp = getmetatable(t).fcomp local fcompvar = getmetatable(t).fcompvar local tsorted = getmetatable(t)._tsorted local ireverse = getmetatable(t)._ireverse -- value if key exists local pos, value = table.bfind(tsorted, key, fcompvar, ireverse) if pos then return value[2] end end end -- set metatable return setmetatable({}, newmetatable) end --// table.binsert( table, value [, comp] ) -- Lua 5.x add-on for the table library -- Binary inserts given value into the table sorted by [,fcomp] -- fcomp is a comparison function that behaves just like -- fcomp in table.sort( table [, comp] ). -- This method is faster than doing a regular -- table.insert(table, value) followed by a table.sort(table [, comp]). function table.binsert(t, value, fcomp) -- Initialize compare function local fcomp = fcomp or function(a, b) return a < b end -- Initialize numbers local iStart, iEnd, iMid, iState = 1, table.getn( t ), 1, 0 -- Get insert position while iStart <= iEnd do -- calculate middle iMid = math.floor((iStart + iEnd) / 2) -- compare if fcomp(value , t[iMid]) then iEnd = iMid - 1 iState = 0 else iStart = iMid + 1 iState = 1 end end local pos = iMid+iState table.insert(t, pos, value) return pos end --// table.bfind(table, value [, compvalue] [, reverse]) -- Lua 5.x add-on for the table library. -- Binary searches the table for value. -- If the value is found it returns the index and the value of -- the table where it was found. -- fcompval, if given, is a function that takes one value and -- returns a second value2 to be compared with the input value, -- e.g. compvalue = function(value) return value[1] end -- If reverse is given then the search assumes that the table -- is sorted with the biggest value on position 1. function table.bfind(t, value, fcompval, reverse) -- Initialize functions fcompval = fcompval or function(value) return value end fcomp = function(a, b) return a < b end if reverse then fcomp = function(a, b) return a > b end end -- Initialize Numbers local iStart, iEnd, iMid = 1, table.getn(t), 1 -- Binary Search while (iStart <= iEnd) do -- calculate middle iMid = math.floor((iStart + iEnd) / 2) -- get compare value local value2 = fcompval(t[iMid]) if value == value2 then return iMid, t[iMid] end if fcomp(value , value2) then iEnd = iMid - 1 else iStart = iMid + 1 end end end -- Iterate in ordered form -- returns 3 values i , index, value -- ( i = numerical index, index = tableindex, value = t[index] ) function orderedPairs(t) return orderedNext, t end function orderedNext(t, i) i = i or 0 i = i + 1 local indexvalue = getmetatable(t)._tsorted[i] if indexvalue then return i, indexvalue[1], indexvalue[2] end end function SecondsToClock(sSeconds) local nSeconds = sSeconds if nSeconds == 0 then return "00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs end end function SendNetWorkVar( actor , name , object1, object2, string1, string2, int1, int2 ) local MSG = {} MSG["name"] = name MSG["Object1"] = object1 MSG["Object2"] = object2 MSG["String1"] = string1 MSG["String2"] = string2 MSG["int1"] = int1 MSG["int2"] = int2 actor:SetNetworkVar(MSG) end -------------------------------------------------------------- -- Mission Helper Functions -------------------------------------------------------------- MISSION_AVAILABLE = 1 MISSION_ACTIVE = 2 MISSION_READY_TO_COMPLETE = 3 MISSION_COMPLETE = 4 MISSION_FAIL = 5 MISSION_READY_TO_COMPLETE_REPORTED = 6 -------------------------------------------------------------- -- Add mission help to the data structure -------------------------------------------------------------- function AddMissionHelp(self, dataTable, missionID, state, myFunc) if (dataTable == nil) then return false end if (dataTable[missionID] == nil) then dataTable[missionID] = {} end if (dataTable[missionID][state] == nil) then MISSION_STATE = {action = myFunc} dataTable[missionID][state] = MISSION_STATE end end -------------------------------------------------------------- -- Bit Checking Functions -------------------------------------------------------------- function bit(p) return 2 ^ (p - 1) -- 1-based indexing end -- Typical call: if hasbit(x, bit(3)) then ... function hasbit(x, p) return x % (p + p) >= p end -------------------------------------------------------------- -- Performs help actions for an object based on missions and mission states -------------------------------------------------------------- function ActivateHelp(self, dataTable, missionID, missionState) if (dataTable[missionID] ~= nil) then -- set the state we are looking for local checkState = 0 if ( hasbit(missionState, bit(MISSION_AVAILABLE)) ) then checkState = MISSION_AVAILABLE elseif ( hasbit(missionState, bit(MISSION_READY_TO_COMPLETE_REPORTED)) ) then checkState = MISSION_READY_TO_COMPLETE_REPORTED elseif ( hasbit(missionState, bit(MISSION_READY_TO_COMPLETE)) ) then checkState = MISSION_READY_TO_COMPLETE elseif ( hasbit(missionState, bit(MISSION_COMPLETE)) ) then checkState = MISSION_COMPLETE elseif ( hasbit(missionState, bit(MISSION_FAIL)) ) then checkState = MISSION_FAIL elseif ( hasbit(missionState, bit(MISSION_ACTIVE)) ) then checkState = MISSION_ACTIVE end -- good state, check state for mission and do action if (checkState ~= 0 and dataTable[missionID][checkState] and dataTable[missionID][checkState].action ~= nil) then dataTable[missionID][checkState].action(self) return true end end return false endfunction MeanderState(self) storeMeanderPoint(self) -- GetPlayAction(self) Meander = State.create() Meander.onEnter = function(self) self:SetVar("CurrentState", "Meander") radius = self:GetVar("Set.wanderRadius") myPos = getMeanderPoint(self) PoS = getRandomPos(self,myPos,radius) self:GoTo { speed = self:GetVar("Set.WanderSpeed"), target = { x = PoS.x , z = PoS.z , y = PoS.y, }, } end Meander.onArrived = function(self) local ran = getRandomDelay(self) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) if ran < 1 then local ran = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( ran, "MeanderPause", self ) if self:GetVar("Set.WanderEmote") then local ranc = math.random(1,100) if ranc <= self:GetVar("Set.WanderChance") then if self:GetVar('Set.WEmote_2') then local ran = math.random(1,100) local effect_2 = 100 - self:GetVar('Set.WEmote_1') if self:GetVar('Set.WEmote_1') < 50 then if ran > 0 and ran <= self:GetVar('Set.WEmote_1') then local oEffect = self:GetVar("Set.WEmoteType_1") local oType = self:GetVar("Set.WEmoteEffe_1") PlayEmote(self,1) else local oEffect = self:GetVar("Set.WEmoteType_2") local oType = self:GetVar("Set.WEmoteEffe_2") PlayEmote(self,2) end elseif effect_2 <= 50 then if ran > effect_2 and ran < 100 then local oEffect = self:GetVar("Set.WEmoteType_1") local oType = self:GetVar("Set.WEmoteEffe_1") PlayEmote(self,1) else local oEffect = self:GetVar("Set.WEmoteType_2") local oType = self:GetVar("Set.WEmoteEffe_2") PlayEmote(self,2) end end end if not self:GetVar('Set.WEmote_2') then local oEffect = self:GwetVar("Set.WEmoteType_1") local oType = self:GetVar("Set.WEmoteEffe_1") Emote.emote(self,self,oEffect) end end end end AggroState(self) end function FollowState(self) Follow = State.create() Follow.onEnter = function(self) self:SetVar("CurrentState", "Follow") local foundObj = self:GetProximityObjects { name = "Followers"}.objects local Found = {} local PointCount = 0 local LineCount = 0 local max = 0 for i = 1, table.maxn (foundObj) do if foundObj[i]:GetFaction().faction == 7 then if foundObj[i]:GetVar("PointInLine") then self:SetVar("PointInLine", true) foundObj[i]:SetVar("PointInLine", false) local idString = foundObj[i]:GetID() local finalID = "|" .. idString self:SetVar("EndOfLineTarget", finalID) end end end self:SetName { name = "scared" } if self:GetVar("EndOfLineTarget") ~= nil then self:SetVar("Imfollowing", true) if GAMEOBJ:GetObjectByID(self:GetVar("EndOfLineTarget")):GetVar("Imfollowing") ~= "done" then emote(self, self , "flip" ) self:FollowTarget { targetID = GAMEOBJ:GetObjectByID( self:GetVar("EndOfLineTarget")) , radius = 3 ,speed = 3, keepFollowing = true } else emote(self, self , "flip" ) self:SetVar("Imfollowing", true) self:FollowTarget { targetID = getMyTarget(self) , radius = 3 ,speed = 3, keepFollowing = true } end else emote(self, self , "flip" ) self:SetVar("PointInLine", true) self:SetVar("Imfollowing", true) self:FollowTarget { targetID = getMyTarget(self) , radius = 3 ,speed = 3, keepFollowing = true } end -- Find all Followers -- Follow last Target -- table.remove (table) end Follow.onArrived = function(self) end AggroState(self) end function PlayEmote(self,i) local oEffect = self:GetVar("Set.WEmoteType_"..i) local oType = self:GetVar("Set.WEmoteEffe_"..i) Emote.emote(self,self,oEffect) end -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end function onProximityUpdate(self, msg) if (onTemplateProximityUpdate) and (onTemplateProximityUpdate(self, msg) == true ) then return end if msg.status == "ENTER" and (isAttackable(self,msg) == true) then if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end local myPos = self:GetPosition().pos local myTarget = msg.objId CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", msg.objId) storeHomePoint(self) self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } self:SetVar("aggrotarget",1) if self:GetVar("Set.AggroEmote") and self:GetVar("AggroEmoteDelay") then -- face Target self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } -- Emote to Target Emote.emote(self,myTarget , self:GetVar("Set.AggroE_Type")) -- Create timer that triggers the follow/attack GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.AggroE_Delay") , "AggroEmote", self ) self:SetVar("AggroEmoteDelay", false) setState("Idle",self) return end setState("aggro", self) end end function ProximityPuls(self) -- print("ProximityPuls") self:SetVar("AttackingTarget", "NoTarget" ) local foundObj = self:GetProximityObjects { name = "aggroRadius"}.objects self:SetVar("ProxFind", false) i = 1 while (i <= table.maxn (foundObj) or (self:GetVar("ProxFind")== true)) do -- print("Found ... "..table.maxn (foundObj).." Objects") if isOBJAttackable(self,foundObj[i]) then self:SetVar("ProxFind", true) local myPos = self:GetPosition().pos local myTarget = foundObj[i] CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", foundObj[i]) --self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } self:SetVar("aggrotarget",1) if self:GetVar("Set.AggroEmote") and self:GetVar("AggroEmoteDelay") then -- face Target self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } -- Emote to Target Emote.emote(self,myTarget , self:GetVar("Set.AggroE_Type")) -- Create timer that triggers the follow/attack GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.AggroE_Delay") , "AggroEmote", self ) self:SetVar("AggroEmoteDelay", false) setState("Idle",self) end end i = i + 1 if (self:GetVar("ProxFind")== true) then if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro", self) break end end if (self:GetVar("ProxFind")== false) then setState("tether", self) end end function onOnHit(self,msg) if (onTemplateHit) and (onTemplateHit(self, msg) == true ) then return end if self:GetVar("Set.SuspendLuaAI") == true then setState("combat", self) return end if self:GetVar("Set.Aggression") ~= "Passive" and not self:GetVar("AiDisabled") then storeObjectByName(self, "AttackingTarget", msg.attacker) if not self:GetVar("inpursuit") and not self:GetVar("AiDisabled") then storeHomePoint(self) self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } end if self:IsEnemy{ targetID = msg.attacker }.enemy == true and not msg.attacker:IsDead().bDead and not self:IsDead{}.bDead and self:GetVar("FleeStatus") ~= 1 and not self:GetVar("AiDisabled") then CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", msg.attacker) local aggroTarget = self:GetVar("aggrotarget") local myPos = self:GetPosition().pos if aggroTarget ~= 2 and not self:IsDead().bDead then if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro", self) end end end end --///////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Timers --//////////////////////////////////////////////////////////////////////////////////////////////////////////// onTimerDone = function(self, msg) local mytarget = getMyTarget(self) if (onTemplateTimerDone and onTemplateTimerDone(self,msg) == true) then return end if not self:GetVar("AiDisabled") then if msg.name == "DealyKillSelf" then if self:GetVar("Set.SuspendLuaMovementAI") == true then return end self:Die{ killerID = self, killType = "SILENT" } --self:KillObj{targetID = self} end if msg.name == "DealyAction" then if self:GetVar("Set.SuspendLuaMovementAI") == true then return end n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) setState("WayPointEvent", self) end if msg.name == "DelayActionEmote" then if self:GetVar("Set.SuspendLuaMovementAI") == true then return end n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) setState("WayPointEvent", self) end if msg.name == "EventMoveToDelete" then local objFound = {} local objFound = self:GetProximityObjects{ name = "KillOBJ" }.objects for i = 1 , table.maxn(objFound) do if objFound[i]:GetFaction().faction ~= 1 then self:Die{ killerID = objFound[i], killType = "SILENT" } --objFound[i]:MoveToDeleteQueue() end end end if msg.name == "FaceDelay" then if self:GetVar("Con_Order") == "before" and self:GetVar("Con_Type") == "face" then setState("Emotes", self) elseif self:GetVar("Con_Order") == "after" and self:GetVar("Con_Type") == "face" then setState("Actionface", self) end end if msg.name == "ActionDelay" then -- follow ---------------------------------------------------------------------------- if self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then if self:GetVar("Con_Order") == "before" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Emotes", self) elseif self:GetVar("Con_Order") == "after" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Actionfollow", self) end end end if msg.name == "EmoteDelay" then -- follow ---------------------------------------------------------------------------- if self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then if self:GetVar("Con_Order") == "before" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Actionfollow",self) elseif self:GetVar("Con_Order") == "after" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Emotes",self) end end end if msg.name == "TimerDeleteObject" then self:Die{ killerID = self, killType = "SILENT" } end if msg.name == "AggroEmote" then self:SetVar("AggroDelayDone", true) if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro",self) end if msg.name == "PatDelay" then -- Path Delay self:SetVar("delayDone",true) setState("patrolBegin", self) end if msg.name == "MeanderPause" then if self:GetVar("Set.SuspendLuaMovementAI") == true then return end setState("Meander", self) end end end --***************** On Die function onLeftTetherRadius(self, msg) if (onTemplateTimerDone and onTemplateTimerDone(self,msg) == true) then return end self:SetVar("AttackingTarget", "NoTarget" ) CancelTemplateTimers(self) getVarables(self) -- Reset all Saved Varables self:SetVar("tetherON", true) hp = self:GetMaxHealth{}.health self:SetHealth{ health = hp } setState("tether",self) end function isAttackable(self,msg) if msg.objType == "Enemies" or msg.objType == "NPC" or msg.objType == "Rebuildables" then if self:IsEnemy{ targetID = msg.objId }.enemy and not msg.objId:IsDead().bDead and msg.name == "aggroRadius" then if self:GetVar("Set.Aggression") == "Aggressive" or self:GetVar("Set.Aggression") == "PassiveAggres" then if self:GetVar("aggrotarget") ~= 2 and self:GetVar("AttackingTarget") == "NoTarget" and not self:GetVar("AiDisabled") then return true end end end end return false end function isOBJAttackable(self,obj) if obj:GetType().objType == "Enemies" or obj:GetType().objType == "NPC" or obj:GetType().objType == "Rebuildables" then if self:IsEnemy{ targetID = obj }.enemy and not obj:IsDead().bDead then if self:GetVar("Set.Aggression") == "Aggressive" or self:GetVar("Set.Aggression") == "PassiveAggres" then if self:GetVar("aggrotarget") ~= 2 and self:GetVar("AttackingTarget") == "NoTarget" and not self:GetVar("AiDisabled") then return true end end end end return false end function onFireEvent(self, msg) local s = msg.args local t = split(s, ',') -- t[1]= name -- t[2]= pathname\ -- t[3]= path num if t[1] == "startpath" then self:SetVar("attached_path", t[2]) self:SetVar("attached_path_start", t[3] ) self:FollowWaypoints{ bUseNewPath = true, newPathName = t[2], newStartingPoint = t[3] } end end function onResetScriptedAIState(self, msg) SetResetState(self) end function onNotifyObject(self, msg) if (onTemplateNotifyObject and onTemplateNotifyObject(self,msg) == true) then return end if msg.name == "GoHome" then setState("GoHome",self) end end -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end --[[ function onProximityUpdate(self, msg) if (onTemplateProximityUpdate) and (onTemplateProximityUpdate(self, msg) == true ) then return end if msg.status == "ENTER" and (isAttackable(self,msg) == true) then if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end local myPos = self:GetPosition().pos local myTarget = msg.objId CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", msg.objId) storeHomePoint(self) self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } self:SetVar("aggrotarget",1) if self:GetVar("Set.AggroEmote") and self:GetVar("AggroEmoteDelay") then -- face Target self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } -- Emote to Target Emote.emote(self,myTarget , self:GetVar("Set.AggroE_Type")) -- Create timer that triggers the follow/attack GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.AggroE_Delay") , "AggroEmote", self ) self:SetVar("AggroEmoteDelay", false) setState("Idle",self) return end setState("aggro", self) end end --]] function onCollisionPhantom(self, msg) local target = msg.objectID local faction = target:GetFaction() local playerVelx = target:GetLinearVelocity().linVelocity.x local playerVely = target:GetLinearVelocity().linVelocity.y local playerVelz = target:GetLinearVelocity().linVelocity.z if faction and faction.faction == 1 and playerVelx ~= 0 and playerVelz ~= 0 and self:GetVar("collideswitch") == 1 then self:NotifyClientObject{name = "Gotcha"} self:SetVar("collideswitch", 0) local myPos = self:GetPosition().pos local myTarget = msg.objId CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", target) storeHomePoint(self) self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } self:SetVar("aggrotarget",1) self:SetVar("pauseswitch", 1) setState("aggro", self) GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "CheckingforMovement", self ) end end function ProximityPuls(self) -- print("ProximityPuls") self:SetVar("AttackingTarget", "NoTarget" ) local foundObj = self:GetProximityObjects { name = "aggroRadius"}.objects self:SetVar("ProxFind", false) i = 1 while (i <= table.maxn (foundObj) or (self:GetVar("ProxFind")== true)) do -- print("Found ... "..table.maxn (foundObj).." Objects") if isOBJAttackable(self,foundObj[i]) then self:SetVar("ProxFind", true) local myPos = self:GetPosition().pos local myTarget = foundObj[i] CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", foundObj[i]) --self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } self:SetVar("aggrotarget",1) if self:GetVar("Set.AggroEmote") and self:GetVar("AggroEmoteDelay") then -- face Target self:FaceTarget{ target = myTarget, degreesOff = 5, keepFacingTarget = true } -- Emote to Target Emote.emote(self,myTarget , self:GetVar("Set.AggroE_Type")) -- Create timer that triggers the follow/attack GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("Set.AggroE_Delay") , "AggroEmote", self ) self:SetVar("AggroEmoteDelay", false) setState("Idle",self) end end i = i + 1 if (self:GetVar("ProxFind")== true) then if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro", self) break end end if (self:GetVar("ProxFind")== false) then setState("tether", self) end end function onOnHit(self,msg) if (onTemplateHit) and (onTemplateHit(self, msg) == true ) then return end if self:GetVar("Set.Aggression") ~= "Passive" and not self:GetVar("AiDisabled") then storeObjectByName(self, "AttackingTarget", msg.attacker) if not self:GetVar("inpursuit") and not self:GetVar("AiDisabled") then storeHomePoint(self) self:SetTetherPoint { tetherPt = myPos,radius = self:GetVar("Set.tetherRadius") } end if self:IsEnemy{ targetID = msg.attacker }.enemy == true and not msg.attacker:IsDead().bDead and not self:IsDead{}.bDead and not self:GetVar("AiDisabled") then CancelTemplateTimers(self) storeObjectByName(self, "AttackingTarget", msg.attacker) local aggroTarget = self:GetVar("aggrotarget") local myPos = self:GetPosition().pos setState("aggro", self) self:SetVar("aggrotarget",1) GAMEOBJ:GetTimer():CancelTimer( "CheckingforMovement", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5 , "CheckingforMovement", self ) end end end --///////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Timers --//////////////////////////////////////////////////////////////////////////////////////////////////////////// onTimerDone = function(self, msg) local mytarget = getMyTarget(self) if (onTemplateTimerDone and onTemplateTimerDone(self,msg) == true) then return end if not self:GetVar("AiDisabled") then if msg.name == "DealyKillSelf" then self:Die{ killerID = self, killType = "SILENT" } --self:KillObj{targetID = self} end if msg.name == "DealyAction" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) setState("WayPointEvent", self) end if msg.name == "DelayActionEmote" then n = self:GetVar("WPEvent_NUM") + 1 self:SetVar("WPEvent_NUM", n ) setState("WayPointEvent", self) end if msg.name == "EventMoveToDelete" then local objFound = {} local objFound = self:GetProximityObjects{ name = "KillOBJ" }.objects for i = 1 , table.maxn(objFound) do if objFound[i]:GetFaction().faction ~= 1 then self:Die{ killerID = objFound[i], killType = "SILENT" } --objFound[i]:MoveToDeleteQueue() end end end if msg.name == "FaceDelay" then if self:GetVar("Con_Order") == "before" and self:GetVar("Con_Type") == "face" then setState("Emotes", self) elseif self:GetVar("Con_Order") == "after" and self:GetVar("Con_Type") == "face" then setState("Actionface", self) end end if msg.name == "ActionDelay" then -- follow ---------------------------------------------------------------------------- if self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then if self:GetVar("Con_Order") == "before" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Emotes", self) elseif self:GetVar("Con_Order") == "after" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Actionfollow", self) end end end if msg.name == "EmoteDelay" then -- follow ---------------------------------------------------------------------------- if self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then if self:GetVar("Con_Order") == "before" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Actionfollow",self) elseif self:GetVar("Con_Order") == "after" and self:GetVar("Con_Type") == "follow" or self:GetVar("Con_Type") == "sneakto" then setState("Emotes",self) end end end if msg.name == "TimerDeleteObject" then self:Die{ killerID = self, killType = "SILENT" } end if msg.name == "AggroEmote" then self:SetVar("AggroDelayDone", true) if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro",self) end if msg.name == "PatDelay" then -- Path Delay self:SetVar("delayDone",true) setState("patrolBegin", self) end if msg.name == "MeanderPause" then setState("Meander", self) end end end --***************** On Die function onLeftTetherRadius(self, msg) if (onTemplateTimerDone and onTemplateTimerDone(self,msg) == true) then return end self:SetVar("AttackingTarget", "NoTarget" ) CancelTemplateTimers(self) getVarables(self) -- Reset all Saved Varables self:SetVar("tetherON", true) hp = self:GetMaxHealth{}.health self:SetHealth{ health = hp } setState("tether",self) end function isAttackable(self,msg) if msg.objType == "Enemies" or msg.objType == "NPC" or msg.objType == "Rebuildables" then if self:IsEnemy{ targetID = msg.objId }.enemy and not msg.objId:IsDead().bDead and msg.name == "aggroRadius" then if self:GetVar("Set.Aggression") == "Aggressive" or self:GetVar("Set.Aggression") == "PassiveAggres" then if self:GetVar("aggrotarget") ~= 2 and self:GetVar("AttackingTarget") == "NoTarget" and not self:GetVar("AiDisabled") then return true end end end end return false end function isOBJAttackable(self,obj) if obj:GetType().objType == "Enemies" or obj:GetType().objType == "NPC" or obj:GetType().objType == "Rebuildables" then if self:IsEnemy{ targetID = obj }.enemy and not obj:IsDead().bDead then if self:GetVar("Set.Aggression") == "Aggressive" or self:GetVar("Set.Aggression") == "PassiveAggres" then if self:GetVar("aggrotarget") ~= 2 and self:GetVar("AttackingTarget") == "NoTarget" and not self:GetVar("AiDisabled") then return true end end end end return false end function onFireEvent(self, msg) local s = msg.args local t = split(s, ',') -- t[1]= name -- t[2]= pathname\ -- t[3]= path num if t[1] == "startpath" then self:SetVar("attached_path", t[2]) self:SetVar("attached_path_start", t[3] ) self:FollowWaypoints{ bUseNewPath = true, newPathName = t[2], newStartingPoint = t[3] } end end function onResetScriptedAIState(self, msg) SetResetState(self) end function onProximityUpdate(self, msg) if msg.objType == "Enemies" or msg.objType == "NPC" then -- Fear Flee onProx if ( self:GetVar("Set.FearPlayer") == true or self:GetVar("Set.FearNPC") == true ) and self:GetVar("inpursuit") == false then -- Chance to Flee -- local ran = math.random(1,100) if ran <= self:GetVar('FearChance') then -- Get Faction List here -- for u = 1,5 do if msg.objId:GetFaction().faction == self:GetVar("FearNPC_"..u) then self:SetVar("FearFound", true) end end if msg.status == "ENTER" and msg.name == "conductRadius" and self:GetVar("FearFlee_CoolDown") == false then local myPos = self:GetPosition().pos self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("Set.tetherRadius") } storeTarget(self, msg.objId) setState("FearFlee",self) end end end if self:GetVar("Set.Conduct_1_Active") and msg.status == "ENTER" and msg.name == "conductRadius" then end ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ --]] if self:IsEnemy{ targetID = msg.objId }.enemy == true and not msg.objId:IsDead().bDead and self:GetVar("FleeActive") == true and self:GetVar("FleeStatus") == 0 and msg.objId:GetVar("inpursuit") == true then health = self:GetHealth{}.health if health <= self:GetVar("FleeHealth") then self:SetVar("FleeStatus",1) setState("Flee",self) end end --------- Helper On Enter if msg ~= nil and checkFaction == 0 then if msg.status == "ENTER" and msg.objId:GetFaction().faction == self:GetVar("HelpFaction") and not msg.objId:IsDead().bDead and msg.name == "HelpRadius" and msg.objId:GetVar("inpursuit") == true and self:GetVar("inpursuit") == false then target = getMyTarget(msg.objId) -- print("My Target is ==="..target) if target ~= nil then storeTarget(self, target) else print("Error i dont have a target") end if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro", self) end end --- Aggro On Enter if msg.status == "ENTER" and self:IsEnemy{ targetID = msg.objId }.enemy and not msg.objId:IsDead().bDead and msg.name == "aggroRadius" and self:GetVar("FleeStatus") ~= 1 then GAMEOBJ:GetTimer():CancelTimer( "PatDelay", self ) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) if self:GetVar("Set.Aggression") == "Aggressive" then storeTarget(self, msg.objId) if self:GetVar("aggrotarget") == 0 then GAMEOBJ:GetTimer():CancelTimer( "Conduct", self ) self:SetVar("inpursuit", true) storeHomePoint(self) local myPos = self:GetPosition().pos self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("Se.tetherRadius") } self:SetVar("aggrotarget",1) end if aggroTarget ~= 2 then if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro", self) end end end --------------------- Conduct if self:GetVar("inpursuit") ~= true and self:GetVar("ConductActive") == true and self:GetVar("ConductStarted") == false and self:GetVar("ConductCooldown") == false then --- Conduct On Enter if msg.status == "ENTER" and msg.objId:GetFaction().faction == 1 and msg.name == "ConductRadius" and not msg.objId:IsDead().bDead and not self:IsDead().bDead then local ranDelay = math.random(self:GetVar("ConductChanceMin"),self:GetVar("ConductChanceMax")) local ran = math.random(1,100) if ran <= self:GetVar("Meander_Chance") then storeTarget(self, msg.objId) storeConductHomePoint(self) self:SetVar("ConductStarted",true) GAMEOBJ:GetTimer():AddTimerWithCancel( ranDelay, "Conduct", self ) end end end --- Conduct On Exit if self:GetVar("ConductActive") == true and self:Exists() and msg ~= nil then if msg.status == "LEAVE" and msg.objId:GetFaction().faction == 1 and msg.name == "ConductRadius" and not msg.objId:IsDead().bDead and self:Exists() and not self:IsDead().bDead then self:SetVar("ConductStarted",false) if self:Exists() then GAMEOBJ:GetTimer():CancelTimer( "Conduct", self ) GAMEOBJ:GetTimer():CancelTimer( "ConductPause", self ) end end end end end --****************************************************************************** -- on Hit function onOnHit(self,msg) if self:GetVar("Set.SuspendLuaAI") == "true" then setState("combat", self) return end if not msg.attacker:IsDead().bDead and self:IsEnemy{ targetID = msg.attacker }.enemy == true and self:GetVar("inpursuit") == true then self:SetVar("FleeStatus",1) setState("Flee",self) end if self:IsEnemy{ targetID = msg.attacker }.enemy == true and not msg.attacker:IsDead().bDead and not self:IsDead{}.bDead then GAMEOBJ:GetTimer():CancelAllTimers( self ) storeTarget(self, msg.attacker) aggroTarget = self:GetVar("aggrotarget") local myPos = self:GetPosition().pos -------------------------------------------------------------- if self:GetVar("isHelper") == true and not msg.attacker:IsDead().bDead and not self:IsDead().bDead then npcs = {} npcs = self:GetProximityObjects { name = "HelpRadius", type = "Enemies" }.objects for u = 1,table.maxn(npcs) do if not msg.attacker:IsDead().bDead and not self:IsDead().bDead and table.maxn(npcs) >= 1 then if not npcs[u]:IsDead{}.bDead and self:GetVar("HelpFaction") == npcs[u]:GetFaction().faction and npcs[u]:GetVar("inpursuit") == false then storeTarget(npcs[u], msg.attacker) storeHomePoint(npcs[u]) if npcs[u]:Exists() and self:Exists() then GAMEOBJ:GetTimer():CancelAllTimers( npcs[u] ) npcs[u]:SetVar("inpursuit", true) npcs[u]:SetState { stateName = "aggro" } end end end end end ----------------------------------------------------------------- if aggroTarget == 0 and not self:IsDead().bDead then storeHomePoint(self) local myPos = getHomePoint(self) GAMEOBJ:GetTimer():CancelTimer( "Conduct", self ) GAMEOBJ:GetTimer():CancelTimer( "MeanderPause", self ) self:SetVar("inpursuit", true) self:SetVar("aggrotarget",1) self:SetTetherPoint { tetherPt = myPos, radius = self:GetVar("tetherRadius") } end if aggroTarget ~= 2 and not self:IsDead().bDead then if self:GetVar("Set.SuspendLuaAI") == true then setState("combat",self) return end setState("aggro", self) end end end-------------------------------------------------------------- -- Helper Functions for Shooting Gallery -------------------------------------------------------------- -------------------------------------------------------------- -- Add a new wave -------------------------------------------------------------- function AddWave(waves, time, text) local num = #waves + 1 waves[num] = { timeLimit = time, waveStr = text } end -------------------------------------------------------------- -- Add a new path -------------------------------------------------------------- function AddPath(paths, text) local num = #paths + 1 paths[num] = text end -------------------------------------------------------------- -- Add a new spawn -------------------------------------------------------------- function AddSpawn(spawn, paths, id, initSpawnTimeMin, initSpawnTimeMax, bRespawn, mintime, maxtime, speed, score, bChangeSpeed, chanceChangeSpeed, minSpeed, maxSpeed, bMovingPlatform, despawnTime, timeScore) local num = #spawn + 1 spawn[num] = { id = id, initSpawnTimeMin = initSpawnTimeMin, initSpawnTimeMax = initSpawnTimeMax, bRespawn = bRespawn, minTime = mintime, maxTime = maxtime, speed = speed, score = score, bChangeSpeed = bChangeSpeed, speedChangeChance = chanceChangeSpeed, minSpeed = minSpeed, maxSpeed = maxSpeed, bMovingPlatform = bMovingPlatform, despawnTime = despawnTime, timeScore = timeScore, path = paths } end -------------------------------------------------------------- -- Add spawns for a wave -------------------------------------------------------------- function AddSpawnsForWave(spawns, spawn) local num = #spawns + 1 spawns[num] = spawn end -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(varName, object) idString = object:GetID() LOCALS[varName] = idString end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(varName) targetID = LOCALS[varName] if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end -------------------------------------------------------------- -- Increment a saved variable and return its new value -------------------------------------------------------------- function IncrementVarAndReturn(varName) local value = LOCALS[varName] if (value) then value = value + 1 end LOCALS[varName] = value return value end function oStart(self) self:SetVar("AiDisabled", false) -- //////////////////////////////////////////////////////////////////////////// -- Aggro if self:GetVar('Set.Aggression') == "Aggressive" then self:SetProximityRadius { radius = self:GetVar("Set.aggroRadius") , name = "aggroRadius" } --if self:GetVar('Set.UseAggroFOV') then -- self:SetProximityRadius { radius = self:GetVar("Set.aggroFOVRadius") , name = "aggroFOVRadius" } --end end self:UseStateMachine{} -- Create States -- //////////////////////////////////////////////////////////////////////////// -- Basic State addState(Dead, "Dead", "Dead", self) addState(Idle, "Idle", "Idle", self) addState(tether, "tether", "tether", self) addState(GoHome, "GoHome" , "GoHome", self) addState(AiDisable, "AiDisable" , "AiDisable", self) addState(AiEnable, "AiEnable" , "AiEnable", self) addState(combat, "combat" , "combat" , self) if (onTemplateCustomStateEnter) or (onTemplateCustomStateArrived) then addState(customState, "customState" , "customState", self) end -- Wander if self:GetVar("Set.SuspendLuaMovementAI") == nil or self:GetVar("Set.SuspendLuaMovementAI") == false then if self:GetVar("Set.MovementType") == "Wander" then addState(Meander, "Meander", "Meander", self) addState(aggro, "aggro", "aggro", self) if self:GetVar("Set.FollowActive") then addState(Follow, "Follow", "Follow", self) end beginStateMachine("Meander", self) end -- Guard if self:GetVar("Set.MovementType") == "Guard" then addState(aggro, "aggro", "aggro", self) if self:GetVar("Set.FollowActive") then addState(Follow, "Follow", "Follow", self) end beginStateMachine("Idle", self) Idle.onEnter(self) end else beginStateMachine("Idle", self) Idle.onEnter(self) end -- end suspend movement AI -- Guard if self:GetVar("Set.MovementType") == "Frozen" then addState(aggro, "aggro", "aggro", self) addSubState(attack, "attack", "attack", self) beginStateMachine("Idle", self) Idle.onEnter(self) end -- Way Point Event --- if self:GetVar("Set.WayPointSet") ~= nil or self:GetVar("attached_path") ~= nil or self:GetVar("groupID") ~= nil then if self:GetVar("Set.SuspendLuaMovementAI") == true then return end addState(WayPointEvent, "WayPointEvent", "WayPointEvent", self) if self:GetVar("groupID") == nil then self:FollowWaypoints() end end end function onArrived(self, msg) if self:GetVar("Set.SuspendLuaMovementAI") == true then return end if not self:GetVar("AiDisabled") then if not msg.isLastPoint then self:SetVar("SavedWP", msg.wayPoint) self:SetVar("PathName", msg.pathName) else self:SetVar("SavedWP", nil) self:SetVar("PathName", nil) self:SetVar("attached_path", nil) end if (msg.actions) and not self:GetVar("AiDisabled") then -- Clear Last Event Set if true if self:GetVar("Act_V") or self:GetVar("Act_N") then for c = 1, table.maxn(self:GetVar("Act_N")) do self:SetVar("Act_N."..c, nil) end for c = 1, table.maxn(self:GetVar("Act_V")) do self:SetVar("Act_V."..c, nil) end end -- Store Events local Act_N = {} local Act_V = {} for i = 1, table.maxn(msg.actions) do Act_N[i] = msg.actions[i].name Act_V[i] = msg.actions[i].value if msg.actions[i].value == nil then Act_V[i] = "noValue" end end self:SetVar("Act_V",Act_V) self:SetVar("Act_N",Act_N) setState("WayPointEvent", self) else self:ContinueWaypoints() end end end -- Event Wp State --- function UseWayPoints(self) if self:GetVar("Set.SuspendLuaMovementAI") == true then return end WayPointEvent = State.create() WayPointEvent.onEnter = function(self) self:SetVar("CurrentState", "WayPointEvent") local o = self:GetVar("WPEvent_NUM") if self:GetVar("WPEvent_NUM") <= table.maxn(self:GetVar("Act_N")) then -- o = o + 1 if self:GetVar("Act_V") == "noValue" then WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")) else WayPointEventFunc(self, self:GetVar("Act_N")[o],self:GetVar("Act_V")[o]) end else self:SetVar("WPEvent_NUM", 1) self:ContinueWaypoints() end end end function WayPointEventFunc(self,name,value) if self:GetVar("Set.SuspendLuaMovementAI") == true then return end if name == "bounce" then local tpos = LEVEL:GetPathWaypoints(self:GetVar("attached_path"))[(self:GetVar("SavedWP") + 2)].pos self:BouncePlayer{ niDestPt = tpos , fSpeed = value , ObjIDBouncer = self } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "stop" then self:StopMoving() end if name == "groupemote" then local s = value local t = split(s, ',') local friends = self:GetObjectsInGroup{ group = t[1] }.objects for i = 1, table.maxn (friends) do for b = 3, table.maxn(t) do if friends[i]:GetLOT().objtemplate == tonumber(t[b]) then -- Mim Emote.emote(friends[i], friends[i], t[2] ) end end end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "setvar" then local s = value local t = split(s, ',') self:SetVar(t[1],t[2]) self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "castskill" then if value ~= "noValue" then self:CastSkill{skillID = value } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) else self:CastSkill{skillID = self:GetSkills().skills[1] } self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end end if name == "eqInvent" then local meItem = self:GetInventoryItemInSlot().itemID self:EquipInventory{ itemtoequip = meItem} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "unInvent" then local meItem = self:GetInventoryItemInSlot().itemID self:UnEquipInventory{ itemtounequip = meItem} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- delay if name == "delay" then self:StopMoving() --GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DealyAction", self ) SetStoreTimmer(value,"DealyAction",self) end ----------------------- emote if name == "femote" then Emote.emote(self, self , value ) self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end if name == "emote" then Emote.emote(self, self , value ) local time = self:GetAnimationTime{ animationID = value }.time if time < 1 then time = 1 end -- GAMEOBJ:GetTimer():AddTimerWithCancel( time , "DelayActionEmote", self ) SetStoreTimmer(time,"DelayActionEmote",self) end ----------------------- teleport if name == "teleport" then local s = value local t = split(s, ',') local xSplit= {x=t[1] , y=t[2] , z=t[3] } self:Teleport{ pos = xSplit} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- walkspeed if name == "pathspeed" then self:SetPathingSpeed{speed = value} self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- removeOBJ if name == "removeNPC" then -- remove Objects in X local foundObj = self:GetProximityObjects { name = "KillOBJS"}.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetFaction().faction == value then foundObj[i]:MoveToDeleteQueue() end end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end ----------------------- - Change WP if name == "changeWP" then-- 1 -- trigger a callback for waypoint changing if (onTemplateChangeWaypoints) and (onTemplateChangeWaypoints(self, msg) == true ) then return end if string.find (value, ",") then self:SetVar("isTable", true ) else self:SetVar("isTable", false ) end if (self:GetVar("isTable")) then local s = value local t = split(s, ',') self:SetVar("WPEvent_NUM", 1) self:SetVar("attached_path", t[1]) self:SetVar("attached_path_start", t[2] ) self:FollowWaypoints{ bUseNewPath = true, newPathName = t[1], newStartingPoint = t[2] } else self:SetVar("WPEvent_NUM", 1) self:SetVar("attached_path", value) self:SetVar("attached_path_start", 0 ) self:FollowWaypoints{ bUseNewPath = true, newPathName = value, newStartingPoint = 0 } end end if name == "DeleteSelf" then GAMEOBJ:DeleteObject(self) end ----------------------- - killSelf if name == "killself" and value == "noValue" then -- 2 - Kill Self self:Die{ killerID = self, killType = "SILENT" } elseif name == "killself" and value >=1 then --GAMEOBJ:GetTimer():AddTimerWithCancel( value , "DealyKillSelf", self ) SetStoreTimmer(value,"DealyKillSelf",self) end ----------------------- - killSelf if name == "removeself" then-- 2 - Kill Self self:MoveToDeleteQueue() end ----------------------- - spawn Object if name == "spawnOBJ" then -- 3 - Spawn Object --RESMGR:LoadObject { objectTemplate = value , x = self:GetPosition().pos.x , y = self:GetPosition().pos.y , z = self:GetPosition().pos.z ,owner = self } local mypos = self:GetPosition().pos local myRot = self:GetRotation() self:Die{killType = "SILENT"} if self:GetVar("pathset") ~= nil then local config = { {"pathset", self:GetVar("pathset") } ,{"SpawnedVar", self:GetVar("SpawnedVar") } } RESMGR:LoadObject { objectTemplate = value, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, configData = config } else RESMGR:LoadObject { objectTemplate = value, x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end self:SetVar("WPEvent_NUM", self:GetVar("WPEvent_NUM") + 1 ) setState("WayPointEvent", self) end end local TELEPORT_POS = { x = 559.55, y = 1700, z = -464.50 } local PARACHUTE = 2867 function onStartup(self) print "hey dummy" end function onCollision(self, msg) local player = msg.objectID; if(player) then -- if the colliding object is a player if(player:GetFaction().faction == 1) then -- if he doesn't already have a parachute if(player:GetInvItemCount{ itemID = PARACHUTE, inventoryType = 0 }.itemCount == 0 ) then player:AddNewItemToInventory{ iObjTemplate = PARACHUTE } end player:Teleport{ pos = TELEPORT_POS, bIgnoreY = false } end end end local cage = { -- import some packages: string = string, --coroutine = coroutine, table = table, math = math, -- some 'global' functions: next = next, ipairs = ipairs, pairs = pairs, require = require, type = type, tonumber = tonumber, tostring = tostring, unpack = unpack, setmetatable = setmetatable, getmetatable = getmetatable, -- modified global functions: --print = myprint, --error = myerror -- my own api: --move = move --kill = kill } local mt = {__index=cage} function scriptLoader (scriptname, envName) local scriptenv = {} setmetatable (scriptenv, mt) local chunk = loadfile (scriptname) setfenv (chunk, scriptenv) chunk() _G[envName] = scriptenv end ----------------------------- To see how to use the state machine, look at -- http://abhoth.netdevil.com/display/LUW/Lua+State+Machine State = {} State.__index = State local g_usedEvents = "" -- Used to store all the events that are use by this state machine -- State constructor function State.create() local newState = {} setmetatable(newState, State) return newState end -- Register all the messages that this state will accept function State.registerEvents(self) local i = next(self,nil) while i do if i ~= "onEnter" and i ~= "onExit" then g_usedEvents = g_usedEvents .. i .. ":" end i = next(self, i) end end -- Add a state to an object's state machine. Takes in the name of the state, -- and a reference to the game object -- Param: -- newState - the table that is the state -- newStateString - the newState in string form. -- name - the name of the state in the state machine -- gameObj - the game object that we are affecting -- EXAMPLE: AttackAggresive = State.create() -- addState(AttackAggresive, "AttackAggressive", "Attack", gameObj) function addState(newState, newStateString, name, gameObj) if newState then gameObj:AddState { functionName = newStateString, stateName = name } newState:registerEvents() else print("--------------SCRIPT ERROR----------------") print("Attempting to register invalid state:" .. name .. "func:" .. newStateString ) end end -- Add a sub-state to an object's state machine. Takes in the name of the state, -- and a reference to the game object function addSubState(newState, newStateString, name, gameObj) if newState then gameObj:AddSubState { functionName = newStateString, subStateName = name } newState:registerEvents() else print("--------------SCRIPT ERROR----------------") print("Attempting to register invalid sub-state" .. name .. "func" .. newStateString ) end end -- Start the state machine at the given inital state function beginStateMachine( initialState, gameObj ) if g_usedEvents == "" then print("--------------SCRIPT ERROR----------------") print("Calling beginStateMachine more than once or") print("creating a state machine that accepts no messages") else gameObj:AddMessage{ messageName = g_usedEvents } gameObj:SetState { stateName = initialState } g_usedEvents = ""; end end -- Utility functions so we don't have to remember the variable name needed for SetState function setState( state, gameObj ) gameObj:SetState { stateName = state } end function setSubState( state, gameObj ) gameObj:SetSubState { subStateName = state } end function resetStateMachineFromError() g_usedEvents = ""; end --------- HOW TO USE STATES ---------------- -- Declare a state by calling State.create() and assigning it -- to your state. -- Ex: attackState = State.create() -- Call HandleEvent. Every state should define HandleEvent. -- This is how you do it. -- attackState = State.create() -- attackState.HandleEvent = function(msg) -- if(msg.name == "Hit") -- DoSomethingAboutIt() -- return 1 -- else if(msg.name == "Dance") -- ... -- else -- return 0 -- Only handle the messages you really care about. -- Return 1 if you handled a message, return 0 if you did not -- NOTE: you can also define HandleEvent like this: -- someGenericFunction(msg) -- ... -- end -- attackState.HandleEvent = someGenericFunction -- You can optionally add the functions Enter and Exit -- These will be called when a state enters or exits --- SETTING UP THE STATE MACHINE --- -- First, create all the states that you will need (see above on how to do that) -- State Machines are created in onStartup -- Call self:UseStateMachine{} -- Then assign the sates as such -- self:AddState { stateName = "stateIdle" } -- self:AddState { stateName = "stateAttack" } -- self:AddSubState { stateName = "stateWin" } -- stateWin is now a substae of stateAttack -- When you are done adding states, call SetState and pass in the name of the first state you -- want to start in. -- self:SetState { stateName = "stateIdle" }module('Suspend', package.seeall) local function makecontinue(coro) return function(...) local ret = { coroutine.resume(coro, ...) } if not ret[1] then error(ret[2]) elseif ret[2] then ret[2](unpack(ret, 3)) end end end function continue() return makecontinue(coroutine.running()) end function suspend(fn) local coro = continue() return coroutine.yield(function() fn(coro) end) end function shift(fn) suspend(function(cont) return cont(fn(cont)) end) end function proc(fn) makecontinue(coroutine.create(fn))() end --L_NPC_GRUMPY-DARKLING require('State') require('Delay') homepoint = {} -------------------------------------------------------- -- PUT THIS IN A UTIL SCRIPT -------------------------------------------------------- function storeTarget(self, target) idString = target:GetID() finalID = "|" .. idString self:SetVar("myTarget", finalID) end function getMyTarget(self) targetID = self:GetVar("myTarget") return GAMEOBJ:GetObjectByID(targetID) end --------------------------------------------------------- -- STATE PATROL --------------------------------------------------------- patrolBegin = State.create() patrolBegin.onEnter = function(self) print("In patrolBegin onEnter") local mypos = self:GetPosition().pos self:GoTo { speed = 0.5, target = { x = mypos.x + math.random(-50,50), z = mypos.z + math.random(-50,50), y = mypos.y, } } end patrolBegin.onArrived = function(self) setState("patrolEnd", self) end patrolEnd = State.create() patrolEnd.onEnter = function(self) print("patrolEnd.onEnter" ) local mypos = self:GetPosition().pos self:GoTo { speed = 0.5, target = homepoint } end patrolEnd.onArrived = function(self) setState("patrolBegin", self) end function onProximityUpdate(self, msg) if msg.status == "ENTER" and self:IsEnemy{ targetID = msg.objId }.enemy == true and not msg.objId:IsDead().bDead then storeTarget(self, msg.objId) setState("aggro", self) end end -------------------------------------------------- -- AGGRO STATE -------------------------------------------------- aggro = State.create() aggro.onEnter = function(self) myTarget = getMyTarget(self) self:FollowTarget { targetID = myTarget, radius = 2, speed = 1 } end aggro.onArrived = function(self) setSubState("attack", self) end aggro.onProximityUpdate = function(self, msg) -- TODO: Handle the target leaving the tether radius end -------------------------------------------------- -- ATTACK SUB-STATE -------------------------------------------------- attack = State.create() attack.onEnter = function(self) print("I'll kill you!") end function onStartup(self) local mypos = self:GetPosition().pos homepoint = mypos -- TODO: Store homepoint in C, not in Lua. All instances of this object will share the same homepoint if the variable is left in Lua self:SetProximityRadius { radius = 15 } self:UseStateMachine{} -- Use curly braces addState(patrolBegin, "patrolBegin", "patrolBegin", self) addState(patrolEnd, "patrolEnd", "patrolEnd", self) addState(aggro, "aggro", "aggro", self) addSubState(attack, "attack", "attack", self) beginStateMachine("patrolBegin", self) patrolBegin.onEnter(self) end--[[ LU Sample Hooks [basic commands] --]] -- Set or get a Varibale from an Object self:SetVar("varibale_name", 22 ) -- saves variable to the object. self:GetVar("variable_name") -- returns the saved varialbe = 22 -- Check to see if an object is a enemy self:IsEnemy{ targetID = objId }.enemy --Returns bool ( true / false ) -- Get the template ID from a Object local TemplateID = object:GetLOT().objtemplate -- TemplateID will the turn a [Int] # exampel 2245 is the object tempalte id of the red ninja -- Check to see if object is Dead objId:IsDead().bDead -- Returns bool ( true / false ) -- Get the x,y,z Position of an object loacl pos = self:GetPosition().pos pos.x = xxx pos.y = xxx pos.z = xxx -- returns a talbe of the x,y,z -- Get the Rotation of an object local myRot = self:GetRotation() myrot.y = -0.4833 myRot.w = 0.8754 -- returns a talbe of the [y],x,[w],z ( note y and w are the only vars you really care about ) -- Get the Faction of an Object object:GetFaction().faction -- Returns the faction of an object ( The player faction will return = 1 ) -- Get/Set NPC stats local hp = self:GetMaxHealth{}.health -- Get the Max heal of an Object object:SetHealth{ health = hp } -- Set the health of an Object local Im = self:GetImagination{}.health -- Get the Max imagination of an Object object:SetImagination{ imagination = Im } -- Set the imagination of an Object object:SetImmunity{ immunity = true } -- Turn immunity On object:SetImmunity{ immunity = false } -- Turn immunity Off -- function onPlayerLoaded(self, msg) local propertyPlaques = GAMEOBJ:GetObjectsByLOT(3315) for i = 1, table.maxn(propertyPlaques) do print("-------- SCRIPT: Property plaque " .. i .. ":" .. propertyPlaques[i]:GetName().name) local propertyData = propertyPlaques[i]:PropertyGetState{} print("---------- SCRIPT: Property ID: " .. propertyData.propertyID:GetID()) print("---------- SCRIPT: Owner ID: " .. propertyData.ownerID:GetID()) print("---------- SCRIPT: Rented: " .. tostring(propertyData.rented)) end end function onZonePropertyRented(self, msg) print("----- SCRIPT: Zone property rented") print("-------- SCRIPT: playerID: " .. msg.playerID:GetID()) print("-------- SCRIPT: propertyID: " .. msg.propertyID:GetID()) end function onZonePropertyModelPlaced(self, msg) print("----- SCRIPT: Zone property model placed") print("-------- SCRIPT: playerID: " .. msg.playerID:GetID()) print("-------- SCRIPT: propertyID: " .. msg.propertyID:GetID()) print("-------- SCRIPT: modelLOT: " .. msg.modelLOT) print("-------- SCRIPT: position x: " .. msg.position.x) print("-------- SCRIPT: position y: " .. msg.position.y) print("-------- SCRIPT: position z: " .. msg.position.z) end function onZonePropertyModelPickedUp(self, msg) print("----- SCRIPT: Zone property model picked up") print("-------- SCRIPT: playerID: " .. msg.playerID:GetID()) print("-------- SCRIPT: propertyID: " .. msg.propertyID:GetID()) print("-------- SCRIPT: modelID: " .. msg.modelID:GetID()) print("-------- SCRIPT: spawnerID: " .. msg.spawnerID:GetID()) end function onZonePropertyModelRemoved(self, msg) print("----- SCRIPT: Zone property model removed") print("-------- SCRIPT: playerID: " .. msg.playerID:GetID()) print("-------- SCRIPT: propertyID: " .. msg.propertyID:GetID()) print("-------- SCRIPT: modelID: " .. msg.modelID:GetID()) print("-------- SCRIPT: spawnerID: " .. msg.spawnerID:GetID()) end function onZonePropertyEditBegin(self, msg) print("----- SCRIPT: Zone property edit begin") print("-------- SCRIPT: playerID: " .. msg.playerID:GetID()) print("-------- SCRIPT: propertyID: " .. msg.propertyID:GetID()) print("-------- SCRIPT: propertyObjectID: " .. msg.propertyObjectID:GetID()) end function onZonePropertyEditEnd(self, msg) print("----- SCRIPT: Zone property edit end") print("-------- SCRIPT: playerID: " .. msg.playerID:GetID()) print("-------- SCRIPT: propertyID: " .. msg.propertyID:GetID()) print("-------- SCRIPT: propertyObjectID: " .. msg.propertyObjectID:GetID()) end function onZonePropertyBehaviorAdded(self, msg) print("----- SCRIPT: Zone property behavior added") print("-------- SCRIPT: modelID: " .. msg.modelID:GetID()) print("-------- SCRIPT: behaviorID: " .. msg.behaviorID:GetID()) print("-------- SCRIPT: numStripsAdded: " .. msg.numStripsAdded) end function onZonePropertyBehaviorRemoved(self, msg) print("----- SCRIPT: Zone property behavior removed") print("-------- SCRIPT: modelID: " .. msg.modelID:GetID()) print("-------- SCRIPT: behaviorID: " .. msg.behaviorID:GetID()) print("-------- SCRIPT: numStripsRemoved: " .. msg.numStripsRemoved) end function onZonePropertyBehaviorAllRemoved(self, msg) print("----- SCRIPT: Zone property behavior all removed") print("-------- SCRIPT: modelID: " .. msg.modelID:GetID()) end function onStartup(self) self:SetMovingPlatformParams{ wsPlatformPath = "MapTour", iStartIndex = 0 } self:SetVisible{ visible = false } CAMERA:ActivateCamera("CAMERA_ATTACHED") CAMERA:AttachCameraToObj("CAMERA_ATTACHED", self, true, true) CAMERA:SetRenderCamera("CAMERA_ATTACHED") end function onPlatformAtLastWaypoint(self, msg) CAMERA:SetToPrevGameCam() end-- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided if msg.objectID then local target = msg.objectID if target:IsDead().bDead == false then print('Killing') target:Die{ killType = "SILENT" } end return msg end end-- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) if msg.objectID:CheckPrecondition{PreconditionID = 33}.bPass == false ) then return end local buildObj = self:GetObjectsInGroup{ group = "Build_Activator" }.objects[1] buildObj:PlayAnimation{animationID = "Activator_to_ClickMe", bPlayImmediate = true} GAMEOBJ:GetTimer():CancelAllTimers( self ) --local animTime = self:GetAnimationTime{animationID = "Activator_to_ClickMe"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.417, "Idle2", self ) end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) if msg.objectID:CheckPrecondition{PreconditionID = 33}.bPass == false ) then return end local buildObj = self:GetObjectsInGroup{ group = "Build_Activator" }.objects[1] buildObj:PlayAnimation{animationID = "ClickMe_to_Activator", bPlayImmediate = true} GAMEOBJ:GetTimer():CancelAllTimers( self ) --local animTime = self:GetAnimationTime{animationID = "ClickMe_to_Activator"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.417, "Idle1", self ) end -- timers... function onTimerDone(self, msg) if msg.name == "Idle1" then local buildObj = self:GetObjectsInGroup{ group = "Build_Activator" }.objects[1] buildObj:PlayAnimation{animationID = "Build_Activator", bPlayImmediate = true} elseif msg.name == "Idle2" then local buildObj = self:GetObjectsInGroup{ group = "Build_Activator" }.objects[1] buildObj:PlayAnimation{animationID = "ClickMe", bPlayImmediate = true} end end-- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) if msg.objectID:CheckPrecondition{PreconditionID = 33}.bPass == false then return end local buildObj = self:GetObjectsInGroup{ group = "Build_Border" }.objects[1] buildObj:PlayAnimation{animationID = "Light_Up", bPlayImmediate = true} GAMEOBJ:GetTimer():CancelAllTimers( self ) --local animTime = self:GetAnimationTime{animationID = "Light_Up"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.417, "Idle2", self ) end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) if msg.objectID:CheckPrecondition{PreconditionID = 33}.bPass == false then return end local buildObj = self:GetObjectsInGroup{ group = "Build_Border" }.objects[1] buildObj:PlayAnimation{animationID = "Dim_Down", bPlayImmediate = true} GAMEOBJ:GetTimer():CancelAllTimers( self ) --local animTime = self:GetAnimationTime{animationID = "Dim_Down"} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.375, "Idle1", self ) end -- timers... function onTimerDone(self, msg) if msg.name == "Idle1" then local buildObj = self:GetObjectsInGroup{ group = "Build_Border" }.objects[1] buildObj:PlayAnimation{animationID = "Dim_Loop", bPlayImmediate = true} elseif msg.name == "Idle2" then local buildObj = self:GetObjectsInGroup{ group = "Build_Border" }.objects[1] buildObj:PlayAnimation{animationID = "Lit_Up_Loop", bPlayImmediate = true} end end-- Modified from origional script L_SPECIAL_FIREPIT.lua, added in puzzle functionality -- Plays effects, disables fire damage, opens door, pirate jumps down and goes back to swinging -- Created: 4/09/09 mrb... local skillid = 43 local ProxRadius = 4 local FIRE_COOLDOWN = 2 local isBurning = false local oPos = { pos = "", rot = ""} local player = '' -- Gets everything setup correctly at startup function onStartup(self) self:SetVar("counter", 0) self:SetProximityRadius{radius = ProxRadius} -- starts fire doEffect(self, true) -- Gets correct pos/rot and spawns the swinging pirate oPos.pos = self:GetPosition().pos oPos.pos.y = oPos.pos.y + 8 oPos.rot = self:GetRotation() swingPirate(self) end -- turns off fire when player uses the squirtgun function onSquirtWithWatergun( self, msg ) if isBurning then doEffect(self, false) player = msg.shooterID end end -- turns fire on/off based on burn variable, needs: obj = LWOOBJID, burn = bool function doEffect(obj, burn) if burn then obj:StopFXEffect{ name = "Off" } obj:PlayFXEffect{ name = "Burn", effectID = 295, effectType = "running"} isBurning = true return end if isBurning and not burn then obj:StopFXEffect{ name = "Burn" } --obj:PlayFXEffect{ name = "Off", effectID = 295, effectType = "end"} -- could be a transitional effect obj:PlayFXEffect{ name = "Off", effectID = 295, effectType = "idle"} GAMEOBJ:GetTimer():AddTimerWithCancel( 28, "FireRestart", obj ) GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "FireIsOut", obj ) isBurning = false return end end -- makes the door move, needs: obj = LWOOBJID, goForward = bool function moveDoor(obj, goForward) local doorObj = obj:GetObjectsInGroup{ group = "Fire_Puzzle_Mover" }.objects for k,v in ipairs(doorObj) do v:StartPathing() end end -- spawns the pirate off the rope needs: obj = LWOOBJID function walkPirate(obj) local pirateObj = obj:GetObjectsInGroup{ group = "Fire_Puzzle_Pirate" }.objects for k,v in ipairs(pirateObj) do GAMEOBJ:DeleteObject(v) end local config = { { "groupID" , "Fire_Puzzle_Pirate"} } RESMGR:LoadObject { objectTemplate = 2416, x= oPos.pos.x, y= oPos.pos.y , z= oPos.pos.z + 2, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = obj, configData = config} --player = msg.shooterID end -- spawns the pirate swinging the rope needs: obj = LWOOBJID function swingPirate(obj) local pirateObj = obj:GetObjectsInGroup{ group = "Fire_Puzzle_Pirate" }.objects for k,v in ipairs(pirateObj) do GAMEOBJ:DeleteObject(v) end local config = { { "groupID" , "Fire_Puzzle_Pirate"} } RESMGR:LoadObject { objectTemplate = 2364, x= oPos.pos.x, y= oPos.pos.y , z= oPos.pos.z, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = obj, configData = config} end function burnPirate(obj) local pirateObj = obj:GetObjectsInGroup{ group = "Fire_Puzzle_Pirate" }.objects[1] pirateObj:SetAnimationSet{strSet = "111"} pirateObj:PlayFXEffect{ name = "PirateBurn", effectID = 111, effectType = "onhit"} pirateObj:PlayAnimation{animationID = "onhit", bPlayImmediate = true} local animTime = obj:GetAnimationTime{animationID = "rebuild-celebrate"} GAMEOBJ:GetTimer():AddTimerWithCancel( animTime.time - 1, "OuchTimer", obj ) end -- fire damage to player while active function onProximityUpdate(self, msg) if not isBurning then return end if msg.status == "ENTER" then local target = msg.objId local faction = target:GetFaction() if faction.faction == 1 then local counter = self:GetVar("counter") counter = counter + 1 self:SetVar("counter", counter) if counter == 1 then self:CastSkill{skillID = skillid } GAMEOBJ:GetTimer():AddTimerWithCancel(FIRE_COOLDOWN, "TimeBetweenCast", self ) print "Set the timer" end -- end if counter == 1 end -- end if faction = 1 else local counter = self:GetVar("counter") if counter > 0 then counter = counter - 1 self:SetVar("counter", counter) if counter == 0 then -- cancelling the timer GAMEOBJ:GetTimer():CancelAllTimers( self ) end end end -- end if msg.status == "ENTER" end -- timers... function onTimerDone(self, msg) if msg.name == "OuchTimer" then swingPirate(self) doEffect(self, true) end if msg.name == "FireIsOut" then moveDoor(self, true) walkPirate(self) --print("Misson Updateed *******************************************************************"..self:GetName().name) --print("Misson Updateed *******************************************************************"..player:GetName().name) player:UpdateMissionTask {target = self, value = 331, value2 = 1, taskType = "complete"} end if msg.name == "FireRestart" then if not isBurning then moveDoor(self, false) burnPirate(self) end end if msg.name == "TimeBetweenCast" then GAMEOBJ:GetTimer():AddTimerWithCancel(FIRE_COOLDOWN, "TimeBetweenCast", self ) self:CastSkill{skillID = skillid} end end local target = '' function onCollisionPhantom(self, msg) target = msg.objectID isColliding = self:GetVar("isColliding") if isColliding or target:IsDead().bDead then return end if isColliding == nil then self:SetVar("isColliding", true) end local scoreObj = self:GetObjectsInGroup{ group = "RespawnPoints" }.objects --print("******** Landed ***********") scoreVal = self:GetVar("ScoreVal") if scoreVal == nil then self:SetVar("ScoreVal", 0) end --Freezes the player, plays an celebration animagion, starts respawn timer target:PlayAnimation{animationID = "rebuild-celebrate"} local animTime = target:GetAnimationTime{animationID = "rebuild-celebrate"} GAMEOBJ:GetTimer():AddTimerWithCancel( animTime.time, "RespawnTimer", self ) -- Set the scores and send them to displayScore() scoreTotal = scoreObj[1]:GetVar("pScoreTotal") if scoreTotal == nil then scoreTotal = scoreVal else scoreTotal = scoreTotal + scoreVal end scoreObj[1]:SetVar("pScoreTotal", scoreTotal) displayScore('You Scored: ' .. scoreVal .. '\nYour Total: ' .. scoreTotal) checkMission(target, scoreTotal) return msg end function displayScore(text) target:DisplayTooltip { bShow = true, strText = text, iTime = 3000 } end function onTimerDone(self, msg) if msg.name == "CollideTimer" then self:SetVar("isColliding", false) return end if not target:IsDead().bDead then --local respawnPoints = self:GetObjectsInGroup{ group = "RespawnPoints" }.objects --local respawnPos = respawnPoints[1]:GetPosition().pos if msg.name == "RespawnTimer" then --target:Teleport{ pos = respawnPos} target:Die() GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "CollideTimer", self ) end end end function checkMission(player, score) local mstate = player:GetMissionState{missionID = 300}.missionState if score == 10 then player:UpdateMissionTask{ value = 300, value2 = score, taskType = "complete" } else player:UpdateMissionTask{ value = 300, value2 = score, taskType = "incomplete" } end endlocal target = '' function onCollisionPhantom(self, msg) target = msg.objectID isColliding = self:GetVar("isColliding") if isColliding == true or target:IsDead().bDead then return end if isColliding == nil then self:SetVar("isColliding", true) end local scoreObj = self:GetObjectsInGroup{ group = "RespawnPoints" }.objects -- freeze the players movement target:SetUserCtrlCompPause{bPaused = true} --LookCameraAtObject(target) -- start respawn timer local animTime = target:GetAnimationTime{animationID = "rebuild-celebrate"} GAMEOBJ:GetTimer():AddTimerWithCancel( animTime.time + 2 , "FreezeTimer", self ) return msg end function LookCameraAtObject(object) local config = { {"objectID", "|" .. object}, {"leadIn", 5}, {"leadOut", 5}, {"lag", 0.9} } GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):AddCameraEffect{ effectType = "lookAt", effectID = "lookitMe!!", duration = 30, configData = config } end function onTimerDone(self, msg) if msg.name == "FreezeTimer" then target:SetUserCtrlCompPause{bPaused = false} self:SetVar("isColliding", false) return end end -- When FireEvent is called on this object create a message box with the given text. -- Trigger format should be: MessageBox, your text here, *optional time in sec* -- Created: 4/07/09 mrb... require('o_mis') -- default values for mBox local mBox = {boxTarget = nil, isDisp = false, isTouch = false, isFirst = true, boxSelf = nil, boxText = '', boxTime = 3 } 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 + 2 GAMEOBJ:GetTimer():AddTimerWithCancel( newTime, "BoxTimer", mBox.boxSelf ) mBox.boxTarget:DisplayTooltip { bShow = true, strText = mBox.boxText, iTime = mBox.boxTime*1000 } end function onFireEvent( self, msg ) -- check to make sure there is a message associated with the FireEvent if not msg.args or mBox.isTouch or mBox.isDisp then return end local fText = split(msg.args, ',') if string.lower(fText[1]) == 'messagebox' then mBox.boxSelf = self if fText[3] then mBox.boxTime = fText[3] end mBox.boxText = fText[2] GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", self ) print('FiredEvent') end end -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided if msg.objectID then mBox.boxTarget = msg.objectID --print('Entering') end end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) -- Says we have finished colliding tries to resetBox() if msg.objectID then mBox.isTouch = false resetBox() --print('Exiting') end end function onTimerDone(self, msg) -- Says we are done with the displaying the message box, tries to resetBox() if msg.name == "BoxTimer" then mBox.isDisp = false resetBox() --print('Box Timer Done') 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 --print('EventTimer not long enough.... running again') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", mBox.boxSelf ) return end --print('EventTimer Done!!!') MakeBox() end end -- resets local data mBox 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 = 3 } end-- Created: 10/21/09 mrb... -- need to put dispText in config data in HF require('o_mis') function onStartup(self) local tempText = self:GetVar('dispText') local tempTime = self:GetVar('dispTime') resetBox(self) if not tempText then self:SetVar('dispText', 'Missing dispText in HF') end if not tempTime then self:SetVar('dispTime', 3) end end function MakeBox(self) -- check to make sure we have a target if self:GetVar('isDisp') and not self:GetVar('isTouch') then return end local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) self:SetVar('isDisp', true) --print('Creating Box') newTime = self:GetVar('dispTime') GAMEOBJ:GetTimer():AddTimerWithCancel( newTime, "BoxTimer", self ) print(Localize(self:GetVar('dispText')) .. ' ' .. self:GetVar('dispTime')) player:DisplayTooltip { bShow = true, strText = Localize(self:GetVar('dispText')), iTime = 100000 } end -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided self:SetVar('isTouch', true) if msg.objectID:GetID() ~= GAMEOBJ:GetLocalCharID() or self:GetVar('isDisp') then return end MakeBox(self) end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) -- Says we have finished colliding tries to resetBox() if msg.objectID then self:SetVar('isTouch', false) --print('Exiting') resetBox(self) end end function onTimerDone(self, msg) -- Says we are done with the displaying the message box, tries to resetBox() if msg.name == "BoxTimer" then local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) self:SetVar('isDisp', false) --print('Box Timer Done') player:DisplayTooltip { bShow = false } resetBox(self) end end -- resets local data mBox function resetBox(self) -- checks to see if we are ready to reset mBox if self:GetVar('isDisp') or self:GetVar('isTouch') then return end -- default values self:SetVar('isDisp', false) self:SetVar('isTouch', false) --print('resetBox') end local iTemplateID = 4717 -- the LOT of the module within the iAssemblyTemplate you are searching for. function onModularBuildEnter(self, msg) print("*******************************") print("**** ModularBuildEnter Called ****") print("**** self name = " .. self:GetName().name .. " ****") print("**** playerID name = " .. msg.playerID:GetName().name .. " ****") print("**** modularBuildID = " .. msg.modularBuildID .. " ****") print("*******************************") end function onModularBuildExit(self, msg) print("*******************************") print("**** ModularBuildExit Called ****") print("**** self name = " .. self:GetName().name .. " ****&&&&****") print("**** self id = " .. self:GetID() .. " ****") print("**** playerID name = " .. msg.playerID:GetName().name .. " ****") print("**** modularBuildID = " .. msg.modularBuildID .. " ****") print("**** bCompleted = " .. tostring(msg.bCompleted) .. " ****") print("**** i64AssemblySubkey = " .. msg.i64modelSubkey:GetID() .. " ****") print("*******************************") -- message params legend: -- iObjTemplate = This is the LOT of the module that you want to search for inside of the completed module assembly (ex. steam cockpit) -- iAssemblyTemplate = This is the LOT of the completed module assembly associated with the object this script is on (ex. rocket) -- i64modelSubkey = This is the unique key of a freshly created rocket (necessary to handle the case when a rocket has been built but may not exist in the inventory yet) -- callbackTarget = This is the object this script is attached to (necessary as we send the message to the player's inventory (server side) and need to get a callback here if(msg.bCompleted == true) then local check = msg.playerID:CheckPlayerAssemblyForUniqueModuleByLOT{iObjTemplate = iTemplateID, iAssemblyTemplate = msg.modularBuildID, i64modelSubkey = msg.i64modelSubkey:GetID(), callbackTarget = self} end print("*******************************") end function onModuleAssemblyDBDataToLua(self, msg) print("*ooo**ooo* bModuleFound = " .. tostring(msg.bModuleFound) .. " *ooo**ooo*") print("*ooo**ooo* bAssemblyFound = " .. tostring(msg.bAssemblyFound) .. " *ooo**ooo*") print("*ooo**ooo* bDataReady = " .. tostring(msg.bDataReady) .. " *ooo**ooo*") end--function onCollisionPhantom(self, msg) -- target = msg.objectID -- if msg.objectID then -- self:PlayEmbeddedEffectOnAllClientsNearObject{ radius = 100.0, fromObjectID = self, effectName = "camshake" } -- target:SetUserCtrlCompPause{bPaused = true} -- end --end --function onOffCollisionPhantom(self, msg ) -- target = msg.objectID -- if msg.objectID then -- target:SetUserCtrlCompPause{bPaused = false} -- end --end function onFireEvent( self, msg ) -- check to make sure there is a message associated with the FireEvent if msg.args == "shake" then local fxName = "camshake-bridge" -- "camshake" -- this one works self:PlayEmbeddedEffectOnAllClientsNearObject{ radius = 100.0, fromObjectID = self, effectName = fxName } end endfunction onObjectActivated(self, msg) print ("You entered") LEVEL:SetLights( true, 0x7F7F7F, --ambient color true, 0x6B6B6B, --directional color true, 0xFFFE87, --specular color true, 0xFFFFFF, --upper Hemi color true, { 0.60, -0.75, 0.10 }, --directional direction true, 0x5BAAFF, --fog color true, --modifying draw distances (all of them) 60.0, 60.0, --fog near min/max 500.0, 500.0, --fog far min/max 10000.0, 10000.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\challenge_sky_light_2awesome.nif" ) local tObjs = self:GetObjectsInGroup{ group = "Swap" }.objects --print(#tObjs) for k,v in ipairs(tObjs) do local objLot = v:GetLOT().objtemplate --print(objLot) if objLot == 4712 then --print('die') v:Die() else if objLot == 6450 then local oPos = {pos = v:GetPosition().pos} local oScale = v:GetObjectScale().scale oPos.rot = v:GetRotation() --print("setting scale: " .. oScale) local config = { {"newScale", oScale} } RESMGR:LoadObject{ objectTemplate = 2445, x= oPos.pos.x, y= oPos.pos.y , z= oPos.pos.z, rw = oPos.rot.w, rx = oPos.rot.x, ry = oPos.rot.y, rz = oPos.rot.z, owner = self, configData = config} end --print('delete') GAMEOBJ:DeleteObject(v) end end end function onChildLoaded(self, msg) if msg.templateID == 2445 then --print('scale child by: ' .. self:GetVar('newScale')) msg.childID:SetObjectScale{scale = 0.5} end end --function onChildRenderComponentReady(self, msg) -- print('child ready') -- if msg.childLOT == 2445 then -- msg.childID:SetObjectScale{scale = self:GetVar('newScale')} -- end --end require('TestAndExample/MessageNotification/cagedGuy_common') function onStartupComplete(self) self:DisplayChatBubble{ wsText = "Help! I'm trapped!" } end function onCageDied(self,savior) self:DisplayChatBubble{ wsText = "Thanks for saving me, " .. savior:GetName().name .. "!" } end function onBridgeBuilt(self,builder) self:DisplayChatBubble{ wsText = "Phear " .. builder:GetName().name .. "'s leet bridge-building skillz!" } end function onBbqBuilt(self,builder) self:DisplayChatBubble{ wsText = "OMGBBQ!\nOM nom nom nom!\nThis BBQ is so tasty I...\nI could just..." } end require('TestAndExample/MessageNotification/notificationDemoHelpers') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel(8, "delayedStartup", self) end function onDelayedStartup(self) local cage = self:GetObjectsInGroup{group = "cage", ignoreSpawners = true}.objects[1] local bridge = self:GetObjectsInGroup{group = "bridge", ignoreSpawners = true}.objects[1] local bbq = self:GetObjectsInGroup{group = "bbq", ignoreSpawners = true}.objects[1] storeObjectByName(self,"cage",cage) storeObjectByName(self,"bridge",bridge) storeObjectByName(self,"bbq",bbq) self:SendLuaNotificationRequest{requestTarget=cage, messageName="Die"} self:SendLuaNotificationRequest{requestTarget=bridge, messageName="RebuildNotifyState"} self:SendLuaNotificationRequest{requestTarget=bbq, messageName="RebuildNotifyState"} if( onStartupComplete ) then onStartupComplete(self) end end function notifyDie(self,other,msg) local cage = getObjectByName(self,"cage") if( other:GetID() == cage:GetID() ) then self:SendLuaNotificationCancel{requestTarget=cage, messageName="Die"} onCageDied(self,msg.killerID) end end function notifyRebuildNotifyState(self,other,msg) -- note: rebuild state 2 is REBUILD_STATE_COMPLETED if( msg.iState == 2 ) then local bridge = getObjectByName(self,"bridge") local bbq = getObjectByName(self,"bbq") if( other:GetID() == bridge:GetID() ) then self:SendLuaNotificationCancel{requestTarget=bridge, messageName="RebuildNotifyState"} onBridgeBuilt(self,msg.player) elseif( other:GetID() == bbq:GetID() ) then self:SendLuaNotificationCancel{requestTarget=bbq, messageName="RebuildNotifyState"} onBbqBuilt(self,msg.player) end end end function onTimerDone(self, msg) if( msg.name == "delayedStartup" ) then onDelayedStartup(self) elseif( msg.name == "bbqReact" ) then -- server only onBbqReact(self) end end require('TestAndExample/MessageNotification/cagedGuy_common') function onCageDied(self,savior) self:FollowWaypoints{ bUseNewPath=true, newPathName="LeaveCage" } end function onBridgeBuilt(self,builder) self:FollowWaypoints{ bUseNewPath=true, newPathName="CrossBridge" } end function onBbqBuilt(self,builder) GAMEOBJ:GetTimer():AddTimerWithCancel(4, "bbqReact", self) end function onBbqReact(self) self:Die{killerID=self, directionRelative_Force = 20} end function storeObjectByName(self, varName, object) local finalID = nil if( object ) then idString = object:GetID() finalID = "|" .. idString end self:SetVar(varName, finalID) end function getObjectByName(self, varName) targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end function dumpVar(name,var,indent) if( indent == nil ) then indent = "" end if( type(var) == "table" ) then print( indent .. name .. " is a table with " .. #var .. " entries:" ) local i,v = next(var) while i do dumpVar(i,v,indent .. " ") i, v = next(var, i) end else local startOfLine = indent .. name .. " is " if( type(var) == "userdata" ) then if( type(var.GetID) == "function" ) then print( startOfLine .. "an object proxy with ID = " .. var:GetID() ) else print( startOfLine .. "unknown userdata" ) end elseif( var == nil ) then print( startOfLine .. "nil" ) else print( startOfLine .. "a(n) " .. type(var) .. " with value = " .. var ) end end end require('o_mis') function onStartup(self) self:SetProximityRadius { radius = 20 ,name = "misArrows" } end onDie = function(self,msg) local foundObj = self:GetProximityObjects{ name = "misArrows" }.objects for i = 1, table.maxn (foundObj) do if foundObj[i]:GetLOT().objtemplate == 4639 then --storeObjectByName(missionObj[i], "missionArrow", self) foundObj[i]:NotifyObject{ name = "removeArrow" } break end end end -- Object gets hit onOnHit = function(self,msg) local = objThatHitMe = msg.attacker end -- When a object spawn another object useing the RESMGR:LoadObject { objectTemplate = 2497 , x= , y= , z= , owner = self } -- Student 1 -- the onChildLoaded with be triggered onChildLoaded = function(self,msg) local = myChildObj = msg.childID end -- onTimmerDone is triggerd from GAMEOBJ:GetTimer():AddTimerWithCancel( 15.33 , "bow2", self ) onTimerDone = function(self, msg) if msg.name == "Timer_String_Name" then end end -- When a rebuild state is changed event will trigger onRebuildNotifyState = function(self, msg) if (msg.iState) == 4 then -- Cancle end end -- When an object enters or exits a Radius onProximityUpdate is triggered onProximityUpdate = function (self, msg) if msg.objId:GetFaction().faction == 1 and msg.status == "ENTER" and msg.name == "aggroRadius" then end end -- when the player/object leaves the TetherRadius onLeftTetherRadius = function(self, msg) end -- Custom Event between two objects. object1:NotifyObject{ name = "Notify_String_Name" } onNotifyObject = function(self, msg) -- object1 if msg.name == "Notify_String_Name" then end end -- Triggered when player chick on a messged box button function onMessageBoxRespond(self, msg) if (msg.iButton == 1) then end end -- Triggered when player click on 3d /clickable object function onUse(self, msg) local Obj_that_pressed_Ok = msg.user end --[[ **** Client Side only Events **** **** Client Side only Events **** --]] onClientUse = function(self, msg) local targetID = msg.user end -- When FireEvent is called on this object create a message box with the given text. -- Trigger format should be: MessageBox, your text here, *optional time in sec* -- Created: 5/26/09 mrb... local textVar = "Script Working" require('o_mis') -- default values for mBox local mBox = {boxTarget = nil, isDisp = false, isTouch = false, isFirst = true, boxSelf = nil, boxText = '', boxTime = 3 } 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 -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided if msg.objectID then mBox.boxTarget = msg.objectID --print('Entering') end if not msg.objectID or mBox.isTouch or mBox.isDisp then return end --print('starting EventTimer') mBox.boxSelf = self mBox.isTouch = true mBox.boxText = textVar GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", self ) end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) -- Says we have finished colliding tries to resetBox() if msg.objectID then mBox.isTouch = false resetBox() --print('Exiting') end end function onTimerDone(self, msg) -- Says we are done with the displaying the message box, tries to resetBox() if msg.name == "BoxTimer" then mBox.isDisp = false resetBox() --print('Box Timer Done') 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 --print('EventTimer not long enough.... running again') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", mBox.boxSelf ) return end --print('EventTimer Done!!!') MakeBox() end end -- resets local data mBox 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 = 3 } endlocal count = 1 function onCheckUseRequirements(self, msg) if count == 1 then UI:SendMessage( "pushGameState", {{"state", "Instance_Loading"}} ) count = count + 1 elseif count == 2 then UI:SendMessage("InstanceLoading", {{"numOfPlayers", 4}, {"Type", "Race"}, {"Player_1", "John"}} ) count = count + 1 elseif count == 3 then UI:SendMessage("InstanceLoading", {{"numOfPlayers", 4}, {"Type", "Race"}, {"Player_1", "John"}, {"Player_2", "Mike"}, {"Player_3", "Keith"}, {"Player_4", "Bob"}} ) count = count + 1 elseif count == 4 then UI:SendMessage("InstanceLoading", {{"numOfPlayers", 5}, {"Type", "Race"}, {"Player_1", "John"}, {"Player_2", "Mike"}, {"Player_3", "Keith"}, {"Player_4", "Bob"}} ) count = count + 1 elseif count == 5 then UI:SendMessage("InstanceLoading", {{"numOfPlayers", 5}, {"Type", "Race"}, {"Player_1", "John"}, {"Player_2", "Mike"}, {"Player_3", "Keith"}, {"Player_4", "Bob"}, {"Player_5", "Win"}} ) count = count + 1 else UI:SendMessage( "popGameState", {{"state", "Instance_Loading"}} ) count = 1 end --print('send Instance_Loading to UI') msg.bCanUse = false return msg end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function onCollisionPhantom (self,msg) local player = msg.objectID for i =1, player:GetInventorySize{inventoryType = 1 }.size do if player:GetInventoryItemInSlot{slot = i }.itemID:Exists() then player:RemoveItemFromInventory{ iObjTemplate = player:GetInventoryItemInSlot{slot = i}.itemID:GetLOT{}.objtemplate } end end end require('o_mis') function onStartup(self) end onNotifyObject = function(self, msg) if msg.name == "removeArrow" then local myParent = self:GetParentObj().objIDParent myParent:NotifyObject{ name="Arrow" } end end require('o_mis') function onStartup(self) self:SetVar("Trg.1", 0 ) end function onArrived(self, msg) local mypos = self:GetPosition().pos local myRot = self:GetRotation() RESMGR:LoadObject { objectTemplate = 4639 , x= mypos.x, y= mypos.y , z= mypos.z, owner = self, rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z } end onChildLoaded = function(self,msg) local t = self:GetVar("Trg") -- Save Target ID's/ for i = 1, table.maxn( t ) do if self:GetVar("Trg."..i) == nil or self:GetVar("Trg."..i) == 0 then storeChild(self, msg.childID , i) self:SetVar("Trg."..i+1, 0 ) end end end onDie = function(self,msg) for i = 1, table.maxn( self:GetVar("Trg")) do local child = getChild(self, i) if child:Exists() then child:Die{killType = "SILENT"} end end end function getChild(self, num) targetID = self:GetVar("Trg."..num ) return GAMEOBJ:GetObjectByID(targetID) end function storeChild(self, target, num) idString = target:GetID() finalID = "|" .. idString self:SetVar("Trg."..num , finalID) end onPlatformAtLastWaypoint = function (self, msg) self:SetPlatformIdleState() end onNotifyObject = function(self, msg) if msg.name == "Arrow" then self:Die{killType = "SILENT"} end end local pos = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetPosition{}.pos local rot = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetRotation() local char = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local effectDuration = 5.5 CAMERA:AttachCameraEffectNVMsg("lookAt","lookatCelebrateFX1", effectDuration, { --{"objectID", GAMEOBJ:GetLocalCharID()}, {"leadIn", 0.1}, {"leadOut", 0.5}, {"xPos", pos.x}, {"yPos", pos.y + 3.0}, {"zPos", pos.z}, {"FOV", 54.4}}) CAMERA:AttachCameraEffectNVMsg("celebrate","celebrateFX1", effectDuration, { {"objectID", GAMEOBJ:GetLocalCharID()}, {"startOffsetX", -5}, {"startOffsetY", 0}, {"startOffsetZ", 12}, {"endOffsetX", 5}, {"endOffsetY", 0}, {"endOffsetZ", 12}, {"leadIn", .75}, {"leadOut", .5}, {"FOV", 54.4}}) RESMGR:LoadObject{ objectTemplate = 11164, x = pos.x, y = pos.y, z = pos.z, rw = rot.w, rx = rot.x, ry = rot.y, rz = rot.z, owner = char, configData = config} char:PlayAnimation{ animationID = "celebrate-newitem" } local pos = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetPosition{}.pos local effectDuration = 5.5 CAMERA:AttachCameraEffectNVMsg("lookAt","lookatCelebrateFX1", effectDuration, { --{"objectID", GAMEOBJ:GetLocalCharID()}, {"leadIn", 0.1}, {"leadOut", 0.5}, {"xPos", pos.x}, {"yPos", pos.y + 3.0}, {"zPos", pos.z}, {"FOV", 54.4}}) CAMERA:AttachCameraEffectNVMsg("celebrate","celebrateFX1", effectDuration, { {"objectID", GAMEOBJ:GetLocalCharID()}, {"startOffsetX", -5}, {"startOffsetY", 0}, {"startOffsetZ", 12}, {"endOffsetX", 5}, {"endOffsetY", 0}, {"endOffsetZ", 12}, {"leadIn", .75}, {"leadOut", .5}, {"FOV", 54.4}}) function onFactionTriggerItemEquipped(self, msg) --self:AddStatTrigger { Name="Low Health", Stat="HEALTH", Operator="LESS_EQUAL", Value=1 } self:AddStatTrigger { Name="Half Health", Stat="HEALTH", Operator="LESS_EQUAL", Value=50, IsPercent=true } self:AddStatTrigger { Name="Low Armor", Stat="ARMOR", Operator="LESS", Value=1 } --self:AddStatTrigger { Name="Half Armor", Stat="ARMOR", Operator="LESS_EQUAL", Value=50, IsPercent=true } --self:AddStatTrigger { Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1 } --self:AddStatTrigger { Name="Half Imagination", Stat="IMAGINATION", Operator="LESS", Value=0, IsPercent=true } --print("Breastplate of scripting armed: "..self:GetID()) end function onFactionTriggerItemUnequipped(self, msg) -- this item doesn't do anything on unequip end function onStatEventTriggered(self, msg) local parent = msg.Parent local sender = msg.Sender local name = msg.Name local stat = msg.Stat local statValue = msg.StatValue local totalValue = msg.TotalValue --print("StatEventTriggered: Name=" .. name .. ", stat=" .. stat .. ", value=" .. tostring(statValue) .. "/" .. tostring(totalValue)) if name == "Half Health" then msg.StatValue = 10 --print("Fixed health = 10") end if name == "Low Armor" then msg.StatValue = 1 --print("Fixed armor = 1") end if name == "Low Imagination" then msg.StatValue = 1 --print("Fixed imagination = 1") end return msg endrequire('TestAndExample/test_equipped_to_player') -- apply any benefits for this item's faction function onFactionTriggerItemStartup(self, msg) --print("Applying faction benefits") local parent = msg.playerID parent:ModifyMaxArmor{ amount=1 } --print("Max armor="..parent:GetMaxArmor{}.armor) if parent:GetImagination{}.imagination < 1 then parent:SetImagination { imagination = 1 } --print("Set initial imagination = 1") end end -- remove any benefits for this item's faction function onFactionTriggerItemShutdown(self, msg) --print("Removing faction benefits") local parent = msg.playerID parent:ModifyArmor{ amount=-1 } -- make 'em recollect armor when they reequip parent:ModifyMaxArmor{ amount=-1 } --print("Max armor="..parent:GetMaxArmor{}.armor) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') function onStartup(self) --[[ MobWaves = {} Con["Darkling_01"] = 4712 Con["Blue_Spawners"] = 1 Con["rSpawn"] = 0 self:SetVar("Con",Con) UI:SendMessage( "pushGameState", {{"state", "Siege" }} ) UI:SendMessage("ShowUI", { {"show", true } }) PHYSICS:SetCanCollide(10, 10, true) ]]-- end function onNotifyClientZoneObject(self,msg) --these pushes are questionable, is this a workaround from the old system? --UI:SendMessage( "pushGameState", {{"state", "Siege" }} ) --[[ if msg.name == "ShowText" then UI:SendMessage("SiegeBigTxt", {{"bigtxtVisible", "hide" }} ) UI:SendMessage("SiegeText", {{"Text", " " }} ) UI:SendMessage("SiegeText", {{"UI", "show" }} ) elseif msg.name == "SetGameState" then UI:SendMessage( "pushGameState", {{"state", "Siege" }} ) elseif msg.name == "nubOfPlayers" then UI:SendMessage("SiegeJoin", {{"nubOfPlayers", msg.paramStr} }) elseif msg.name == "HideUI" then UI:SendMessage("SiegeUI", { {"UI", "hide"} }) elseif msg.name == "HideText" then UI:SendMessage("SiegeText", {{"UI", "hide" }} ) elseif msg.name == "OverHeadText" then UI:SendMessage("SiegeText", {{"Text", msg.paramStr }} ) elseif msg.name == "ShowPlayButton" then UI:SendMessage("SiegeJoin", {{"sgPlayShow", true }} ) ]]-- end end function onTimerDone(self,msg) end require('o_mis') function onStartup(self) Set = {} -- Basic Game Settings -- self:SetActivityParams{activityID = 43, activityActive = true , modifyMaxUsers = true, maxUsers = 8, } RESMGR:LoadObject { objectTemplate = 4712, x = -140, y = 200, z = 579, owner = self } --(((((((((((( 1. Enter Level: wait for init ))))))))))))) Set['GameState'] = "Starting" -- Do Not Change -- Set['Rounds_To_Play'] = 3 -- INT ( Set the number of rounds to play ) Set['RespawnTime'] = 8 -- INT ( Player Respawn Time after being smashed ) Set['Game_Type'] = "TOWER_DEFENSE" -- INT ( Game Type ) MobWaves = {} MobWaves[1] = 4712 -- LOT of darkling 1 -- End Game Timers --Set['WonLostMatchTimer'] = 5 -- Show Txt Won Lost timer --Set['ScoreBoardTimer'] = 5 -- Show Score Board Timer --Set['LeaderBoardTimer'] = 5 -- Siege Points -- All Vars are * 1 Set['CapturObj'] = 10 Set['PickUpObj'] = 5 Set['Enemies'] = 0 Set['Lives'] = 10 Set['Tokens'] = 0 --(((((((((((( 2. Notify Team Objectives: ))))))))))))) -- Set['Notify_Txt'] = "Defend the Rocket Fuel!" Set['Info_Text_1'] = " smashed " --- Game Object Lots --- Set['Number_of_Spawn_Groups'] = 1 --INT ---Set['DefendTarget'] = 4847 ------ Do not change ---------------------------------------------------------- self:SetVar("Set",Set) self:SetNetworkVar("Set",Set) end function notifyArrived(self,msg) -- this will only get called by npcs on paths, so self is not zone in this case --if(msg.actions) then -- if (msg.actions[1] == "killme") then self:Die{} -- end --end end function onNotifyObject(self, msg) --mainNotifyObject(self, msg) end function onObjectLoaded(self, msg) --if (msg) then -- mainObjectLoaded(self, msg) --end end function onChildLoaded(self, msg) --mainChildLoaded(self, msg) --msg.lotID self:SendLuaNotificationRequest{requestTarget=msg.childID, messageName="OnArrived"} msg.childID:FollowWaypoints{bPaused = false, bUseNewPath = true, newPathName = "Badguys", newStartingPoint = 1} end ----------------------------------------------------------------------------------spinner test -- old --[[ function onObjectActivated(self, msg) local path = self:GetPathName{}.pathName msg.activatorID:SetRailMovement{pathName=path} print(path) end --]] -- new ---[[ function onObjectActivated(self, msg) local path = self:GetRailInfo{} msg.activatorID:SetRailMovement{pathName=path.pathName, pathStart=path.pathStart, pathGoForward=path.pathGoForward} end --]]--Globals used to check when functions are called require('State') calledStartup = false; globalsWork=true; calledArrived=false; calledCancelled=false; function onStartup(self) calledStartup = true; end function onArrived(self, msg) calledArrived = true; end function onCancelled(self,msg) calledCancelled = true; end -- state machine test -- Test One calledTestOneArrived = false; calledTestOneOnExit = false; testOne = State.create() testOne.onArrived = function(self,msg) calledTestOneArrived = true; end testOne.onExit = function(self,msg) calledTestOneOnExit = true; end calledTestTwoArrived = false; calledTestTwoOnEnter = false; testTwo = State.create() testTwo.onEnter = function(self) calledTestTwoOnEnter = true; end testTwo.onArrived = function(self,msg) calledTestTwoArrived = true; end function TestStateMachine(self) print("***************************************************"); print("Adding states"); print(self:GetID()); addState(testOne, "testOne", "testOne", self); addState(testTwo, "testTwo", "testTwo", self); beginStateMachine("testOne", self); end function SetStateToTestTwo(self) setState("testTwo", self); end function TestFail() ThisWillFailNow(); end function TestInfiniteLoop() local i = 0 while i < 2 do i = i end end function TestRecursionFail() TestRecursionFail(); end -- constructor Vector = {} Vector.__index = Vector function Vector.new(x,y,z) local newobj if type(x) == 'table' then newobj = x else newobj = { x = x, y = y, z = z } end setmetatable(newobj, Vector) return(newobj) end function Vector.__add(a,b) return Vector.new(a.x + b.x, a.y + b.y, a.z + b.z) end function Vector.__sub(a,b) return Vector.new(a.x - b.x, a.y - b.y, a.z - b.z) end function Vector.__unm(a) return Vector.new(-a.x, -a.y, -a.z) end function Vector.__mul(a,b) if type(a) == 'table' then if type(b) == 'table' then -- dot product return a.x * b.x + a.y * b.y + a.z * b.z; else -- scalar product return Vector.new(a.x * b, a.y * b, a.z * b) end else -- scalar product return Vector.new(a * b.x, a * b.y, a * b.z) end end function Vector.__div(self, a) if type(a) == 'number' then return Vector.new(self.x / a, self.y / a, self.z / a) end end function Vector.length(self) return math.sqrt(self:sqrLength()) end function Vector.sqrLength(self) return self.x * self.x + self.y * self.y + self.z * self.z end function Vector.normalize(self) return self / self:length() end function Vector.__eq(a, b) return (a.x == b.x and a.y == b.y and a.z == b.z) end function Vector.__newindex(self, key, value) print("ERROR - do not assign values to a vector other than x, y, or z") end function Vector.print(self) print(self.x, self.y, self.z) end function onFireEventServerSide(self, msg) --print('onFireEventServerSide ' .. msg.args .. ' ' .. msg.senderID:GetName().name .. ' ' .. msg.param1) if msg.args == "TransferToInstance" then msg.senderID:TransferToZone{ zoneID = msg.param1, ucInstanceType = 1 } --instance type single end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartupBurno( self ) self:SetVar( "bLoadedHotdogCart", false ) end -------------------------------------------------------------- -- When objects are loaded via zone notification -------------------------------------------------------------- function onObjectLoadedBurno( self, msg ) if ( msg.templateID == CONSTANTS["LOT_PATH_UNDER_BURNO"] ) then storeObjectByName( self, "PathUnderBurno", msg.objectID ) checkIfReadyForHotdogCart( self ) elseif ( msg.templateID == CONSTANTS["LOT_BURNO"] ) then storeObjectByName( self, "Burno", msg.objectID ) checkIfReadyForHotdogCart( self ) end end -------------------------------------------------------------- -- checks if both Burno and the path under him are loaded -- if so, we can tell Burno to go ahead and spawn the hotdog cart -------------------------------------------------------------- function checkIfReadyForHotdogCart( self ) if ( self:GetVar( "bLoadedHotdogCart" ) == true ) then return end local burno = getObjectByName( self, "Burno" ) local path = getObjectByName( self, "PathUnderBurno" ) if (burno ~= nil and path ~= nil ) then self:SetVar( "bLoadedHotdogCart", true ) burno:NotifyObject{ name="loadCart" } end end -------------------------------------------------------------- -- includes -------------------------------------------------------------- require('c_AvantGardens') -------------------------------------------------------------- -- vars -------------------------------------------------------------- INSTRUMENTS = {} -- stores all 4 instruments -------------------------------------------------------------- -- When objects are loaded via zone notification -------------------------------------------------------------- function onObjectLoadedInstruments( self, msg ) if ( IsValidInstrument( msg.templateID ) ) then local nextInstrument = #INSTRUMENTS + 1 INSTRUMENTS[nextInstrument] = msg.objectID:GetID() end end -------------------------------------------------------------- -- checks whether the given LOT is one of the instrument quickbuilds -------------------------------------------------------------- function IsValidInstrument( LOT ) return ( LOT == CONSTANTS["INSTRUMENT_LOT_GUITAR"] or LOT == CONSTANTS["INSTRUMENT_LOT_BASS"] or LOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] or LOT == CONSTANTS["INSTRUMENT_LOT_DRUM"] ) end -------------------------------------------------------------- -- player left zone -------------------------------------------------------------- function onPlayerExitInstruments( self, msg ) for index = 1, #INSTRUMENTS do local instrument = GAMEOBJ:GetObjectByID(INSTRUMENTS[index]) instrument:NotifyObject{ ObjIDSender = msg.playerID, name = "playerExit" } end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/AG/L_ZONE_AG_BURNO') require('zone/AG/L_ZONE_AG_STAGE_PLATFORMS') require('zone/AG/L_ZONE_AG_INSTRUMENTS') require('zone/AG/L_ZONE_AG_STAGE_CHOICEBUILDS') -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup( self ) onStartupBurno( self ) end function onNotifyObject(self, msg) onNotifyObjectStageChoicebuilds(self, msg) end -------------------------------------------------------------- -- When objects are loaded via zone notification -------------------------------------------------------------- function onObjectLoaded( self, msg ) onObjectLoadedBurno( self, msg ) onObjectLoadedStagePlatforms( self, msg ) onObjectLoadedInstruments( self, msg ) end -------------------------------------------------------------- -- player left zone -------------------------------------------------------------- function onPlayerExit( self, msg ) onPlayerExitInstruments( self, msg ) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/L_ACTIVITY_MANAGER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables local waveTime = 5 -- how often to spawn a new wave of mobs local rewardInterval = 5 -- how many waves to wait to drop a reward and give the player a coolDownTime local coolDownTime = 10 -- how long to wait between waves of rewardInterval local startTier2Waves = 6 -- wave number to start spawning tier 2 mobs local startTier3Waves = 12 -- wave number to start spawning tier 3 mobs local displayCoolDown = false -- Spawn Networks local spawnerNetworks = { --**********************************tier1 {spawnerName = 'hordespawner', -- name of the tier 1 spawner network without the #'s from HF spawnerNum = 2, lastRand = 0} } -- Reward Networks local rewardNetworks = { --********************************Reward1 {spawnerName = 'Rewards_', -- name of the reward 1 spawner network without the #'s from HF spawnerNum = 2, lastRand = 0},} --*************************************** -- Script only local variables local timerTick = 0 -- tick variable local coolDownTick = 10 -- cool down tick variable local waveNum = 1 -- current wave number local rewardTick = 1 -- number of rewards given local tPlayers = {} local totalSpawned = 0 --////////////////////////////////////////////////////////////////////////////////// ---------------------------------------------------------------- -- Startup of the object ----------------------------------------------------------------. function onStartup(self) -- Initialize the pseudo random number generator and return --self:SetVar('isCoolDown', false) math.randomseed( os.time() ) self:SetVar('playersAccepted', 0) self:SetVar('playersReady', false) end function onPlayerLoaded(self, msg) table.insert(tPlayers, msg.playerID:GetID()) msg.playerID:SetUserCtrlCompPause{bPaused = true} self:NotifyClientZoneObject{name = 'Reset_Timer'} self:Help{rerouteID = msg.playerID, iHelpID = 0} playerLocationTransfer(self) end function onPlayerExit(self, msg) local playerNum = 0 for i = 1, table.maxn(tPlayers) do if tPlayers[i] == msg.playerID:GetID() then playerNum = i end end if playerNum ~= 0 then table.remove(tPlayers, playerNum) end end function onFireEventServerSide(self, msg) if msg.args == 'start' then --print('start') PlayerAccepted(self) elseif msg.args == 'exit' then --print('exit') for k,v in ipairs(tPlayers) do GAMEOBJ:GetObjectByID(v):TransferToZone{ zoneID = 22, pos_x = 125, pos_y = 376, pos_z = -175 } --, rot_x = 0, rot_y = 0, rot_z = 0, rot_w = 0 end end end function onFireEvent(self,msg) if msg.args == 'start' then StartWaves(self) elseif msg.args == 'front' and self:GetVar('playersReady') then playerLocationTransfer(self) elseif msg.args == 'back' then playerLocationTransfer(self, true) end end function onPlayerDied(self, msg) --print('player died ***********') GameOver(self, msg.playerID) end function onNotifyObject(self, msg) local player = msg.ObjIDSender --if not IsPlayerInActivity(player) then return end --print('Scored - ' .. msg.name .. ' - ' .. msg.param1) -- If the Quickbuild is done if (msg.name == "built") then local hordeSpawner = LEVEL:GetSpawnerByName("hordespawner") if hordeSpawner then hordeSpawner:SpawnerActivate() end end if (msg.name == "qbdead") then local hordeSpawner = LEVEL:GetSpawnerByName("hordespawner") if hordeSpawner then hordeSpawner:SpawnerDeactivate() end end -- update smash count UpdateActivityValue(player, 1, 1) -- update kill score UpdateActivityValue(player, 2, msg.param1) end function playerLocationTransfer(self, bToBack) local playerCount = self:GetVar('playerCountFront') if not playerCount then playerCount = 1 self:SetVar('spawnFrontOnly', true) print('firstTime') print('# of players: ' .. playerCount) self:SetVar('playerCountFront', playerCount) return end if bToBack and playerCount > 0 then playerCount = playerCount - 1 self:SetVar('playerCountFront', playerCount) if playerCount == 0 then print('reset spawns to back ** spawnBackOnly ' .. playerCount) self:SetVar('spawnBackOnly', true) self:SetVar('spawnFrontOnly', false) end elseif not bToBack and playerCount < table.maxn(tPlayers) then playerCount = playerCount + 1 self:SetVar('playerCountFront', playerCount) print('# of players in front' .. playerCount) if playerCount == table.maxn(tPlayers) and not bToBack then print('reset spawns to front ** spawnFrontOnly ' .. playerCount) self:SetVar('spawnFrontOnly', true) self:SetVar('spawnBackOnly', false) end end if playerCount > 0 and playerCount < table.maxn(tPlayers) then print('spawnBoth ' .. playerCount) self:SetVar('spawnFrontOnly', false) self:SetVar('spawnBackOnly', false) else --spawnMobs(self) end print('# of players in table: ' .. tostring(table.maxn(tPlayers)) .. ' players in front: ' .. playerCount) end function PlayerAccepted(self) self:SetVar('playersAccepted', self:GetVar('playersAccepted') + 1) if self:GetVar('playersAccepted') >= table.maxn(tPlayers) then print('All players have accepted') StartWaves(self) end end function StartWaves(self) SetupActivity(4) self:SetVar('playersReady', true) self:SetVar('playersAccepted', 0) for k,v in ipairs(tPlayers) do UpdatePlayer(GAMEOBJ:GetObjectByID(v)) GAMEOBJ:GetObjectByID(v):SetUserCtrlCompPause{bPaused = false} GetLeaderboardData(self, GAMEOBJ:GetObjectByID(v), 5) -- start the music GAMEOBJ:GetObjectByID(v):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = 'AG_Horde'} -- set music to cooldown the music --GAMEOBJ:GetObjectByID(v):SetNDAudioMusicParameter{m_NDAudioMusicParameterName = 'Intensity', m_Value = 3.0} end --self:NotifyClientZoneObject{name = 'Start_Timer', param1 = timerTick} self:SetVar('wavesStarted', true) if displayCoolDown then GAMEOBJ:GetTimer():AddTimerWithCancel(1, "CoolDownTick", self ) else self:NotifyClientZoneObject{name = 'Start_Wave_Message', paramStr = "Start!"} GAMEOBJ:GetTimer():AddTimerWithCancel(3, "StartDelay", self ) end end -- exit function GameOver(self, player) GAMEOBJ:GetTimer():CancelAllTimers(self) KillMobs(self) for k,v in ipairs(tPlayers) do local smashVar = GetActivityValue(GAMEOBJ:GetObjectByID(v), 2)--/totalSpawned local scoreVar = GetActivityValue(GAMEOBJ:GetObjectByID(v), 1) -- StopActivity(GAMEOBJ:GetObjectByID(v), timerTick, smashVar, scoreVar) --print('smashed = ' .. GetActivityValue(GAMEOBJ:GetObjectByID(v), 2) .. ' out of ' .. totalSpawned .. ' for ' .. smashVar .. ' score = ' .. scoreVar) -- stop the music GAMEOBJ:GetObjectByID(v):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = 'AG_Horde'} end -- reset ticks timerTick = 0 -- tick variable coolDownTick = coolDownTime -- cool down tick variable waveNum = 1 -- current wave number rewardTick = 1 -- number of rewards given self:SetVar('wavesStarted', false) end function newRand(oldNum, maxRand) if maxRand == 1 then return '01', '01' end local randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end while randNum == oldNum do --print('found same') randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end end return randNum, randNum end function spawnerResetT(spawnNetwork, bMaintainSpawnNum) for k,v in ipairs(spawnNetwork) do for i = 1, v.spawnerNum do --print('kill: ' .. v.spawnerName .. '0' .. i) local spawner = LEVEL:GetSpawnerByName(v.spawnerName .. '0' .. i) if spawner then --track total mobs spawned totalSpawned = totalSpawned + spawner:SpawnerGetTotalSpawned().iSpawned if not bMaintainSpawnNum then spawner:SpawnerDestroyObjects() spawner:SpawnerSetNumToMaintain{uiNum = 1} end spawner:SpawnerDeactivate() end end end end function KillMobs(self) --print('Kill Mobs ***') spawnerResetT(spawnerNetworks) spawnerResetT(rewardNetworks) end --[[ function spawnMobs(self) if not self:GetVar('wavesStarted') then return end local spawnNum = waveNum if spawnNum > rewardInterval then spawnNum = spawnNum - (rewardTick-1) end updateSpawner(self, spawnerNetworks[1], spawnNum) if waveNum >= startTier2Waves and spawnNum - startTier2Waves > 0 then updateSpawner(self, spawnerNetworks[2], spawnNum - startTier2Waves) end if waveNum >= startTier3Waves and spawnNum - startTier3Waves > 0 then updateSpawner(self, spawnerNetworks[3], spawnNum - startTier3Waves) end end --]] --[[ function waveReward(self) --print('Cool Down') updateSpawner(self, rewardNetworks[1], 1) rewardTick = rewardTick + 1 end --]] function onPlayerResurrected(self, msg) --print('resurrected') self:NotifyClientZoneObject{name = 'Reset_Timer'} for i = 1, table.maxn(tPlayers) do self:Help{rerouteID = GAMEOBJ:GetObjectByID(tPlayers[i]), iHelpID = 0} end end -- timers... function onTimerDone(self, msg) if msg.name == "StartDelay" then GAMEOBJ:GetTimer():AddTimerWithCancel(1, "ClockTick", self ) end if msg.name == "ClockTick" then timerTick = timerTick + 1 --print('Wave: ' .. waveNum .. ' Tick: ' .. timerTick .. ' : ' .. ((waveTime * (waveNum-1)) + (coolDownTime * (rewardTick-1)))) if timerTick >= ((waveTime * (waveNum-1)) + (coolDownTime * (rewardTick-1))) or timerTick == 1 then -- spawnMobs(self) --print('spawn number: ' .. waveNum .. ' @ ' .. timerTick) if waveNum == rewardInterval * rewardTick then -- set music to cooldown the music for k,v in ipairs(tPlayers) do GAMEOBJ:GetObjectByID(v):SetNDAudioMusicParameter{m_NDAudioMusicParameterName = 'Intensity', m_Value = 0.0} end -- waveReward(self) --print('stopping clock tick') GAMEOBJ:GetTimer():CancelTimer( "ClockTick", self ) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "CoolDownTick", self ) spawnerResetT(spawnerNetworks, true) --waveNum = waveNum + 1 return end waveNum = waveNum + 1 end --print('clock tick starting clock tick') GAMEOBJ:GetTimer():AddTimerWithCancel(1, "ClockTick", self ) self:NotifyClientZoneObject{name = 'Update_Timer', param1 = timerTick} end if msg.name == "CoolDownTick" then --print('cooldown ' .. coolDownTick) coolDownTick = coolDownTick - 1 if not displayCoolDown then timerTick = timerTick + 1 self:NotifyClientZoneObject{name = 'Update_Timer', param1 = timerTick} end if coolDownTick <= 1 then --self:SetVar('isCoolDown', false) --print('cool down starting clock tick') GAMEOBJ:GetTimer():AddTimerWithCancel(1, "ClockTick", self ) coolDownTick = coolDownTime local iValue = 1.0 if rewardTick == 2 then iValue = 2.0 elseif rewardTick > 2 then iValue = 3.0 end -- set music to cooldown the music for k,v in ipairs(tPlayers) do GAMEOBJ:GetObjectByID(v):SetNDAudioMusicParameter{m_NDAudioMusicParameterName = 'Intensity', m_Value = iValue} end return end GAMEOBJ:GetTimer():AddTimerWithCancel(1, "CoolDownTick", self ) if displayCoolDown then if coolDownTick > coolDownTime/2 and coolDownTick > 0 then self:NotifyClientZoneObject{name = 'Wave_Message', paramStr = rewardTick} elseif coolDownTick == 0 then self:NotifyClientZoneObject{name = 'Start_Wave_Message', paramStr = "Start!"} else self:NotifyClientZoneObject{name = 'Update_Timer', param1 = coolDownTick} end end end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') --------------------------------------------------------------- -- Startup of the object ----------------------------------------------------------------. function onStartup(self) -- -- add ui timer end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function onNotifyClientZoneObject(self, msg) if msg.name == "Start_Timer" then -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) --UI:SendMessage( "ToggleGenericTextField", {{"visible", false }}) end if msg.name == "Update_Timer" then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", SecondsToClock( msg.param1 ) } }) --UI:SendMessage( "ToggleGenericTextField", {{"visible", false }}) end if msg.name == "Kill_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) UI:SendMessage( "popGameState", {{"state", "Survival" }} ) --UI:SendMessage( "ToggleGenericTextField", {{"visible", false }}) end if msg.name == "Reset_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) end if msg.name == "Wave_Message" then UI:SendMessage( "ToggleGenericTextField", {{"visible", true }, {"text", "Wave: " .. msg.paramStr } }) end if msg.name == "Start_Wave_Message" then GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ShowActivityCountdown() UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) --UI:SendMessage( "ToggleGenericTextField", {{"visible", true }, {"text", msg.paramStr } }) end end ---------------------------------------------------------------- -- Server sends us a notification to do help, show dialogs ---------------------------------------------------------------- function onHelp(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (msg.iHelpID == 0) then player:DisplayMessageBox{bShow = true, imageID = 1, text = "Click Ok To Defend Against The Endless Horde!!!, cancel to exit.", callbackClient = self, identifier = "exit_screen"} end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- Response to Exit activity dialog and user pressed OK if msg.identifier == "exit_screen" and msg.iButton == 1 then -- restart waves self:FireEventServerSide{senderID = msg.sender, args = 'start'} -- Response to Start activity dialog and ok is pressed and player is not in activity elseif msg.identifier == "exit_screen" and msg.iButton == 0 then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) -- exit instance self:FireEventServerSide{senderID = msg.sender, args = 'exit'} end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] n = 1 b = 1 q = 1 d = 1 tableValues = {} storedScore = {} finalTable = {} name_value = 0 score_value = 0 name = 0 score = 0 for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Score"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("LeaderTable", tableValues) leaderboardDataForUI = implode(",",self:GetVar("LeaderTable")) self:SetVar("LeaderString", leaderboardDataForUI) UI:SendMessage("UpdateSurvivalScoreboard", { {"inextbestname", leaderboardDataForUI} } ) for j = 1, #tableValues do if tableValues[j] == player:GetName().name then name = j score = (j + 1) if name ~= 1 then name_value = (j - 2) score_value = (j - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif j == 1 then name_value = 1 score_value = 2 end self:SetVar("FoundPlayer", true ) break end end self:SetVar("name",name ) self:SetVar("score",score ) self:SetVar("tableValues",tableValues ) self:SetVar("name_value",name_value ) self:SetVar("score_value",score_value ) if self:GetVar("FoundPlayer") and self:GetVar("FoundFriendGuild") then UI:SendMessage("UpdateSurvivalScoreboard", { {"inextbesttime", tostring(tableValues[score_value]) }, {"inextbestname", tostring(tableValues[name_value]) } } ) elseif not self:GetVar("FoundFriendGuild") and self:GetVar("FoundPlayer") then UI:SendMessage("UpdateSurvivalScoreboard", { {"inextbesttime", tostring(tableValues[self:GetVar("score")]) }, {"inextbestname", tostring(tableValues[ self:GetVar("name")]) } } ) end UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", tostring(tableValues[ self:GetVar("name")]) } } ) --UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", tostring(tableValues[score_value]) }, {"inextbestname", tostring(tableValues[name_value]) } } ) self:SetVar("NextBest", tostring(tableValues[score_value]) ) end end function onNotifyObjectStageChoicebuilds(self, msg) if msg.name == "ChoicebuildChanged" then getObjectByName( self, "Stage" ):NotifyObject{name = msg.name, param1 = msg.param1, ObjIDSender = msg.ObjIDSender} elseif msg.name == "ChoicebuildSmashed" then getObjectByName( self, "Stage" ):NotifyObject{name = msg.name, ObjIDSender = msg.ObjIDSender} end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('c_AvantGardens') -------------------------------------------------------------- -- When objects are loaded via zone notification -------------------------------------------------------------- function onObjectLoadedStagePlatforms( self, msg ) -- also look for the concert_stage and pass these ID's on to it if ( msg.templateID == CONSTANTS["LOT_STAGE_PLATFORM_LARGE"] ) then storeObjectByName( self, "LargeStagePlatform", msg.objectID ) SendPlatformIDsToStage( self ) elseif ( msg.templateID == CONSTANTS["LOT_STAGE_PLATFORM_SMALL"] ) then storeObjectByName( self, "SmallStagePlatform", msg.objectID ) SendPlatformIDsToStage( self ) elseif ( msg.templateID == CONSTANTS["LOT_STAGE"] ) then storeObjectByName( self, "Stage", msg.objectID ) SendPlatformIDsToStage( self ) end end -------------------------------------------------------------- -- if the stage is loaded and so are the 2 stage platforms, -- send the ID's of the platforms to the stage -- and the ID of the stage to the platforms -------------------------------------------------------------- function SendPlatformIDsToStage( self ) local stage = getObjectByName( self, "Stage" ) local largePlatform = getObjectByName( self, "LargeStagePlatform" ) local smallPlatform = getObjectByName( self, "SmallStagePlatform" ) if ( stage ~= nil and largePlatform ~= nil and smallPlatform ~= nil ) then stage:NotifyObject{ name = "StoreLargePlatform", ObjIDSender = largePlatform } stage:NotifyObject{ name = "StoreSmallPlatform", ObjIDSender = smallPlatform } largePlatform:NotifyObject{ name = "StoreStage", ObjIDSender = stage } smallPlatform:NotifyObject{ name = "StoreStage", ObjIDSender = stage } end end -------------------------------------------------------------- -- AG Survival Instance Server Zone Script: Including this -- file lets you set the custom variables for the Survival game. -- updated mrb... 1/7/10 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/MINIGAME/Survival/BASE_SURVIVAL_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables local gConstants = { acceptedDelay = 60, -- how long to wait after one person has presed start to start the match startDelay = 2, -- how long to wait after all the players have accepted before starting the game. waveTime = 7, -- how often to spawn a new wave of mobs rewardInterval = 5, -- how many waves to wait to drop a reward and give the player a gConstants.coolDownTime coolDownTime = 10, -- how long to wait between waves of gConstants.rewardInterval startMobSet2 = 5, -- wave number to start spawning set 2 startMobSet3 = 15, -- wave number to start spawning set 3 unlockNetwork3 = 10, bUseMobLots = true, iLotPhase = 1, baseMobsStartTierAt = { 8, 13, 18, 23, 28, 32, }, -- wave number to start spawning tier mobs randMobsStartTierAt = { 2, 10, 15, 20, 25, 30, }, -- wave number to start spawning tier mobs returnZone = 1100, -- map number the player will return to on exit returnLoc = { x = 125, y = 376, z = -175} -- {x,y,z} location that the player will be teleported to in the returnZone on exit } --============================================================ -- Mob Sets local tMobSets = { mobLots = { MobA = {6351, 8088, 8089}, MobB = {6668, 8090, 8091}, MobC = {6454, 8096, 8097}, }, -- these will always spawn ************************************************************************* -- ** format ** tier# = {{Mob1, Mob2, Mob3},}, baseMobSet = -- tMobSets.baseMobSet { tier1 = { {3, 0, 0}, }, tier2 = { {2, 1, 0}, }, tier3 = { {4, 1, 0}, }, tier4 = { {1, 2, 0}, }, tier5 = { {0, 1, 1}, }, tier6 = { {0, 2, 2}, }, }, -- randomly pick from these sets to spawn along with the base set ********************************** -- ** format ** tier# = {{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3}}, randMobSet = -- tMobSets.randMobSet { tier1 = { {4, 0, 0},{4, 0, 0},{4, 0, 0},{4, 0, 0},{3, 1, 0} }, tier2 = { {4, 1, 0},{4, 1, 0},{4, 1, 0},{4, 1, 0},{2, 1, 1} }, tier3 = { {1, 2, 0},{1, 2, 0},{1, 2, 0},{1, 2, 0},{0, 1, 1} }, tier4 = { {1, 2, 1},{1, 2, 1},{1, 2, 1},{0, 2, 1},{0, 2, 2} }, tier5 = { {0, 1, 2},{0, 1, 2},{0, 1, 2},{0, 1, 3},{0, 1, 3} }, tier6 = { {0, 2, 3},{0, 2, 3},{0, 2, 3},{0, 2, 3},{0, 2, 3} }, }, } --============================================================ -- Spawn Networks local tSpawnerNetworks = { baseNetworks = -- tSpawnerNetworks.baseNetworks { set = 'baseMobSet', { spawnerName = {'Base_MobA', 'Base_MobB','Base_MobC'}, -- name of base spawner network without from HF spawnerNum = '', bIsLocked = false, bIsActive = false, }, }, --*************************************** randNetworks = -- tSpawnerNetworks.randNetworks { set = 'randMobSet', --********************************** Spawner 1 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '01', -- number of MobB spawner networks bIsLocked = false, bIsActive = false, }, --********************************** Spawner 2 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '02', -- number of MobB spawner networks bIsLocked = false, bIsActive = false, }, --********************************** Spawner 3 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '03', -- number of MobB spawner networks bIsLocked = true, bIsActive = false, }, }, --*************************************** -- Reward Networks rewardNetworks = -- tSpawnerNetworks.rewardNetworks { { --******************************** Rewards 1 spawnerName = {'Rewards_'}, -- name of the reward 1 spawner network without the #'s from HF spawnerNum = '01', bIsLocked = false, }, }, -- Smashable Networks smashNetworks = -- tSpawnerNetworks.smashNetworks { { --******************************** Smashables 1 spawnerName = {'Smash_'}, -- name of the reward 1 spawner network without the #'s from HF spawnerNum = '01', bIsLocked = false, }, } , } --============================================================ -- Game messages sent to the BASE_SURVIVAL_SERVER.lua file, these -- must be in this script. Only change to add custom functionality, -- but leav e the base*message*(self, msg, newMsg) in the function. --============================================================ ---------------------------------------------------------------- -- Received when the script is loaded ---------------------------------------------------------------- function onStartup(self) -- send the configured variables to the base script setGameVariables(gConstants,tMobSets,tSpawnerNetworks) baseStartup(self, newMsg) end ---------------------------------------------------------------- -- Player is fully loaded and has completed the load handshake process. ---------------------------------------------------------------- function onPlayerReady(self, msg) basePlayerReady(self, msg, newMsg) end ---------------------------------------------------------------- -- Player has loaded into the map ---------------------------------------------------------------- function onPlayerLoaded(self, msg) basePlayerLoaded(self, msg, newMsg) end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function onPlayerExit(self, msg) basePlayerExit(self, msg, newMsg) end ---------------------------------------------------------------- -- Received a fire event messaged from the client ---------------------------------------------------------------- function onFireEventServerSide(self, msg) baseFireEventServerSide(self, msg, newMsg) end ---------------------------------------------------------------- -- Received a fire event messaged from someplace on the server ---------------------------------------------------------------- function onFireEvent(self,msg) baseFireEvent(self, msg, newMsg) end ---------------------------------------------------------------- -- A player had died ---------------------------------------------------------------- function onPlayerDied(self, msg) basePlayerDied(self, msg, newMsg) end ---------------------------------------------------------------- -- A player has respawned ---------------------------------------------------------------- function onPlayerResurrected(self, msg) basePlayerResurrected(self, msg, newMsg) end ---------------------------------------------------------------- -- Received a notify object message ---------------------------------------------------------------- function onNotifyObject(self, msg) baseNotifyObject(self, msg, newMsg) end ---------------------------------------------------------------- -- This is called when players hit the UI to exit or stop the game. ---------------------------------------------------------------- function onMessageBoxRespond(self,msg) baseMessageBoxRespond(self, msg, newMsg) end ---------------------------------------------------------------- -- Notification that a ui element used. ---------------------------------------------------------------- function onActivityStateChangeRequest(self,msg) baseActivityStateChangeRequest(self, msg, newMsg) end function onCollisionPhantom(self, msg) local player = msg.objectID if( player:CheckPrecondition{PreconditionID = 60}.bPass == true ) then local object = self:GetObjectsInGroup{group = "switchValley", ignoreSpawners = true}.objects[1] if object then local tele = object:GetPosition().pos player:Teleport {pos = {x = tele.x + 4, y = tele.y - 10, z = tele.z + 4}, bIgnoreY = false} print("x = 783, y = 200 z = 123") --object:PlayFXEffect{name = "febuildpop", effectID = 105, effectType = "create"} end end end function onCollisionPhantom(self, msg) local player = msg.objectID -- print("player id" .. player) local object = self:GetObjectsInGroup{group = "switchTree", ignoreSpawners = true}.objects[1] if object then local tele = object:GetPosition().pos player:Teleport {pos = {x = tele.x + 4, y = tele.y - 10, z = tele.z + 4}, bIgnoreY = false} --object:PlayFXEffect{name = "febuildpop", effectID = 105, effectType = "create"} end end -------------------------------------------------------------- -- GF Survival Instance Server Zone Script: Including this -- file lets you set the custom variables for the Survival game. -- updated mrb... 1/7/10 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/MINIGAME/Survival/BASE_SURVIVAL_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables local gConstants = { acceptedDelay = 2, -- how long to wait after all the players have accepted before starting the game. startDelay = 2, -- how long to wait after all the players have accepted before starting the game. waveTime = 5, -- how often to spawn a new wave of mobs rewardInterval = 5, -- how many waves to wait to drop a reward and give the player a gConstants.coolDownTime coolDownTime = 10, -- how long to wait between waves of gConstants.rewardInterval startMobSet2 = 5, -- wave number to start spawning set 2 startMobSet3 = 6, -- wave number to start spawning set 3 unlockNetwork3 = 10, -- wave number to unlock the 3rd random spawn network bUseMobLots = false, iLotPhase = 1, baseMobsStartTierAt = { 8, 18, 28, }, -- wave number to start spawning tier mobs randMobsStartTierAt = { 5, 10, 20, }, -- wave number to start spawning tier mobs returnZone = 1300, -- map number the player will return to on exit returnLoc = { x = -431.59, y = 315.01, z = 53.03 } -- {x,y,z} location that the player will be teleported to in the returnZone on exit } --============================================================ -- Mob Sets local tMobSets = { -- these will always spawn ************************************************************************* -- ** format ** tier# = {{Mob1, Mob2, Mob3},}, baseMobSet = -- tMobSets.baseMobSet { tier1 = { {3, 0, 1}, }, tier2 = { {3, 0, 2}, }, tier3 = { {1, 1, 3}, }, }, -- randomly pick from these sets to spawn along with the base set ********************************** -- ** format ** tier# = {{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3}}, randMobSet = -- tMobSets.randMobSet { tier1 = { {1, 0, 0},{2, 0, 0},{3, 0, 0},{0, 1, 0},{1, 1, 0},{0, 0, 1},{1, 0, 1},{0, 1, 1},{1, 1, 1} }, tier2 = { {1, 0, 1},{2, 0, 1},{3, 0, 1},{0, 1, 1},{1, 1, 1},{0, 0, 2},{1, 0, 2},{0, 1, 2},{1, 1, 2} }, tier3 = { {1, 1, 2},{2, 1, 2},{3, 1, 2},{0, 2, 2},{1, 2, 2},{0, 1, 3},{1, 1, 3},{0, 2, 3},{1, 2, 3} }, }, } --============================================================ -- Game messages sent to the BASE_SURVIVAL_SERVER.lua file, these -- must be in this script. Only change to add custom functionality, -- but leav e the base*message*(self, msg, newMsg) in the function. --============================================================ -- Spawn Networks local tSpawnerNetworks = { baseNetworks = -- tSpawnerNetworks.baseNetworks { set = 'baseMobSet', { spawnerName = {'Base_MobA', 'Base_MobB','Base_MobC'}, -- name of base spawner network without from HF spawnerNum = '', bIsLocked = false, bIsActive = false, }, }, --*************************************** randNetworks = -- tSpawnerNetworks.randNetworks { set = 'randMobSet', --********************************** Spawner 1 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '01', -- number of MobB spawner networks bIsLocked = false, bIsActive = false, }, --********************************** Spawner 2 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '02', -- number of MobB spawner networks bIsLocked = false, bIsActive = false, }, --********************************** Spawner 3 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '03', -- number of MobB spawner networks bIsLocked = true, bIsActive = false, }, }, --*************************************** -- Reward Networks rewardNetworks = -- tSpawnerNetworks.rewardNetworks { { --******************************** Rewards 1 spawnerName = {'Rewards_'}, -- name of the reward 1 spawner network without the #'s from HF spawnerNum = '01', bIsLocked = false, }, }, -- Smashable Networks smashNetworks = -- tSpawnerNetworks.smashNetworks { { --******************************** Smashables 1 spawnerName = {'Smash_'}, -- name of the reward 1 spawner network without the #'s from HF spawnerNum = '01', bIsLocked = false, }, } , } --============================================================ -- Game messages sent to the BASE_SURVIVAL_SERVER.lua file, these -- must be in this script. Only change to add custom functionality, -- but leav e the base*message*(self, msg, newMsg) in the function. --============================================================ ---------------------------------------------------------------- -- Received when the script is loaded ---------------------------------------------------------------- function onStartup(self) -- send the configured variables to the base script setGameVariables(gConstants,tMobSets,tSpawnerNetworks) baseStartup(self, newMsg) end ---------------------------------------------------------------- -- Player is fully loaded and has completed the load handshake process. ---------------------------------------------------------------- function onPlayerReady(self, msg) basePlayerReady(self, msg, newMsg) end ---------------------------------------------------------------- -- Player has loaded into the map ---------------------------------------------------------------- function onPlayerLoaded(self, msg) basePlayerLoaded(self, msg, newMsg) end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function onPlayerExit(self, msg) basePlayerExit(self, msg, newMsg) end ---------------------------------------------------------------- -- Received a fire event messaged from the client ---------------------------------------------------------------- function onFireEventServerSide(self, msg) baseFireEventServerSide(self, msg, newMsg) end ---------------------------------------------------------------- -- Received a fire event messaged from someplace on the server ---------------------------------------------------------------- function onFireEvent(self,msg) baseFireEvent(self, msg, newMsg) end ---------------------------------------------------------------- -- A player had died ---------------------------------------------------------------- function onPlayerDied(self, msg) basePlayerDied(self, msg, newMsg) end ---------------------------------------------------------------- -- A player has respawned ---------------------------------------------------------------- function onPlayerResurrected(self, msg) basePlayerResurrected(self, msg, newMsg) end ---------------------------------------------------------------- -- Received a notify object message ---------------------------------------------------------------- function onNotifyObject(self, msg) baseNotifyObject(self, msg, newMsg) end ---------------------------------------------------------------- -- This is called when players hit the UI to exit or stop the game. ---------------------------------------------------------------- function onMessageBoxRespond(self,msg) baseMessageBoxRespond(self, msg, newMsg) end ---------------------------------------------------------------- -- Notification that a ui element used. ---------------------------------------------------------------- function onActivityStateChangeRequest(self,msg) baseActivityStateChangeRequest(self, msg, newMsg) end-------------------------------------------------------------- -- Generic Survival Instance Server Zone Script: Including this -- file gives the custom functions for the Survival game. -- updated mrb... 9/26/09 -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/L_ACTIVITY_MANAGER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables local gConstants = { acceptedDelay = 2, -- how long to wait after all the players have accepted before starting the game. waveTime = 5, -- how often to spawn a new wave of mobs rewardInterval = 5, -- how many waves to wait to drop a reward and give the player a gConstants.coolDownTime coolDownTime = 10, -- how long to wait between waves of gConstants.rewardInterval startMobSet2 = 5, -- wave number to start spawning set 2 startMobSet3 = 15, -- wave number to start spawning set 3 unlockMobSet3 = 5, baseMobsStartTier2 = 10, -- wave number to start spawning tier 2 mobs baseMobsStartTier3 = 20, -- wave number to start spawning tier 3 mobs randMobsStartTier2 = 6, -- wave number to start spawning tier 2 mobs randMobsStartTier3 = 12, -- wave number to start spawning tier 3 mobs } --============================================================ -- Mob Sets local tMobSets = { -- these will always spawn ************************************************************************* -- ** format ** tier# = {{Mob1, Mob2, Mob3},}, baseMobSet = -- tMobSets.baseMobSet { tier1 = { {5, 0, 0}, }, tier2 = { {0, 5, 0}, }, tier3 = { {0, 0, 5}, }, }, -- randomly pick from these sets to spawn along with the base set ********************************** -- ** format ** tier# = {{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3},{Mob1, Mob2, Mob3}}, randMobSet = -- tMobSets.randMobSet { tier1 = { {5, 0, 0},{5, 0, 0},{5, 0, 0},{5, 0, 0},{4, 1, 0} }, tier2 = { {0, 5, 0},{0, 5, 0},{0, 5, 0},{1, 4, 0},{0, 4, 1} }, tier3 = { {0, 2, 3},{0, 1, 4},{0, 1, 4},{0, 1, 4},{0, 0, 5} }, }, } --============================================================ -- Spawn Networks local tSpawnerNetworks = { baseNetworks = -- tSpawnerNetworks.baseNetworks { set = 'baseMobSet', { spawnerName = {'Base_MobA', 'Base_MobB','Base_MobC'}, -- name of base spawner network without from HF spawnerNum = '', bIsLocked = false, bIsActive = false, }, }, --*************************************** randNetworks = -- tSpawnerNetworks.randNetworks { set = 'randMobSet', --********************************** Spawner 1 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '01', -- number of MobB spawner networks bIsLocked = false, bIsActive = false, }, --********************************** Spawner 2 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '02', -- number of MobB spawner networks bIsLocked = false, bIsActive = false, }, --********************************** Spawner 3 { spawnerName = {'MobA_','MobB_','MobC_'}, -- name of the MobA spawner networks without the #'s from HF spawnerNum = '03', -- number of MobB spawner networks bIsLocked = true, bIsActive = false, }, }, --*************************************** -- Reward Networks rewardNetworks = -- tSpawnerNetworks.rewardNetworks { { --******************************** Rewards 1 spawnerName = {'Rewards_'}, -- name of the reward 1 spawner network without the #'s from HF spawnerNum = '01', bIsLocked = false, }, }, -- Smashable Networks smashNetworks = -- tSpawnerNetworks.smashNetworks { { --******************************** Smashables 1 spawnerName = {'Smash_'}, -- name of the reward 1 spawner network without the #'s from HF spawnerNum = '01', bIsLocked = false, }, } , } --============================================================ -- Script only local variables local gGamestate = { tPlayers = {}, -- players who have entered the game tWaitingPlayers = {}, -- players who haven't accepted yet iTotalSpawned = 0, -- total number of spawned mobs iWaveNum = 1, -- current wave number iRewardTick = 1, -- number of rewards given } --////////////////////////////////////////////////////////////////////////////////// -- helper function dumpVar(name,var,indent) if( indent == nil ) then indent = "" end if( type(var) == "table" ) then print( indent .. name .. " is a table with " .. #var .. " entries:" ) local i,v = next(var) while i do dumpVar(i,v,indent .. " ") i, v = next(var, i) end else local startOfLine = indent .. name .. " is " if( type(var) == "userdata" ) then if( type(var.GetID) == "function" ) then print( startOfLine .. "an object proxy with ID = " .. var:GetID() ) else print( startOfLine .. "unknown userdata" ) end elseif( var == nil ) then print( startOfLine .. "nil" ) elseif( var == true ) then print( startOfLine .. "true" ) elseif( var == false ) then print( startOfLine .. "false" ) else print( startOfLine .. "a(n) " .. type(var) .. " with value = " .. var ) end end end ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function onStartup(self) -- Initialize the pseudo random number generator and return math.randomseed( os.time() ) self:SetVar('playersAccepted', 0) self:SetVar('playersReady', false) -- print('*****************************************************') -- dumpVar('tSpawnerNetworks', tSpawnerNetworks, ' ') -- print('*****************************************************') end ---------------------------------------------------------------- -- Player has loaded into the map ---------------------------------------------------------------- function onPlayerLoaded(self, msg) -- adding the players to the gGamestate tables table.insert(gGamestate.tPlayers, msg.playerID:GetID()) table.insert(gGamestate.tWaitingPlayers, msg.playerID:GetID()) -- freeze the player movement/controls msg.playerID:SetUserCtrlCompPause{bPaused = true} -- updating the scoreboard for the new players for k,v in ipairs(gGamestate.tPlayers) do self:NotifyClientZoneObject{name = 'Update_ScoreBoard', paramObj = GAMEOBJ:GetObjectByID(v), paramStr = "0", param1 = 0, param2 = 0} end self:NotifyClientZoneObject{name = 'Define_Player_To_UI', paramObj = msg.playerID, rerouteID = msg.playerID} self:NotifyClientZoneObject{name = 'Show_ScoreBoard'} end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function onPlayerExit(self, msg) local playerNum = 0 for i = 1, table.maxn(gGamestate.tPlayers) do if gGamestate.tPlayers[i] == msg.playerID:GetID() then playerNum = i end end if playerNum ~= 0 then table.remove(gGamestate.tPlayers, playerNum) -- set player to not auto-respawn msg.playerID:SetPlayerAllowedRespawn{dontPromptForRespawn=false} end end ---------------------------------------------------------------- -- Received a fire event messaged from the client ---------------------------------------------------------------- function onFireEventServerSide(self, msg) if msg.args == 'start' then --print('start') PlayerAccepted(self) elseif msg.args == 'exit' then --print('exit') for k,v in ipairs(gGamestate.tPlayers) do GAMEOBJ:GetObjectByID(v):TransferToZone{ zoneID = 1100, pos_x = 125, pos_y = 376, pos_z = -175 } --, rot_x = 0, rot_y = 0, rot_z = 0, rot_w = 0 end end end ---------------------------------------------------------------- -- Received a fire event messaged from someplace on the server ---------------------------------------------------------------- function onFireEvent(self,msg) if msg.args == 'start' then StartWaves(self) end end ---------------------------------------------------------------- -- A player had died ---------------------------------------------------------------- function onPlayerDied(self, msg) local finalTime = ActivityTimerGetCurrentTime('ClockTick') SetActivityValue(msg.playerID, 0, finalTime) GameOver(self, msg.playerID) end ---------------------------------------------------------------- -- Received a notify object message ---------------------------------------------------------------- function onNotifyObject(self, msg) local player = msg.ObjIDSender -- check to make sure the player is in the activity if not IsPlayerInActivity(player) then return end -- update smash count UpdateActivityValue(player, 1, 1) -- update kill score UpdateActivityValue(player, 2, msg.param1) end ---------------------------------------------------------------- -- This is called when players hit the UI to exit or stop the game. ---------------------------------------------------------------- function onMessageBoxRespond(self,msg) if (msg.identifier == "RePlay" ) then print("************* RePlay *************"..msg.sender:GetName().name) self:NotifyClientZoneObject{name = 'PlayerConfirm_ScoreBoard', paramObj = msg.sender} PlayerAccepted(self, msg.sender) elseif (msg.identifier == "Exit" ) then print("************* Exit *************"..msg.sender:GetName().name) self:NotifyClientZoneObject{name = 'Exit_Waves'} -- exit level msg.sender:TransferToZone{ zoneID = 1100, pos_x = 125, pos_y = 376, pos_z = -175 } --, rot_x = 0, rot_y = 0, rot_z = 0, rot_w = 0 end end -- Custom Functions ---------------------------------------------------------------- -- Custom function: Checks to see if all players have accepted, -- if they have then the game is started. ---------------------------------------------------------------- function PlayerAccepted(self, playerID) local playerNum = 0 for k,v in ipairs(gGamestate.tWaitingPlayers) do if playerID:GetID() == v then playerNum = k end end if playerNum == 0 then return end table.remove(gGamestate.tWaitingPlayers, playerNum) if table.maxn(gGamestate.tWaitingPlayers) == 0 then --print('All players have accepted') ActivityTimerStart('AcceptedDelay', gConstants.acceptedDelay, gConstants.acceptedDelay) --(timerName, updateTime, stopTime) end end ---------------------------------------------------------------- -- Custom function: Starts the game. ---------------------------------------------------------------- function StartWaves(self) SetupActivity(4) self:SetVar('playersReady', true) self:SetVar('baseMobSetNum', 1) self:SetVar('randMobSetNum', 1) for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end table.insert(gGamestate.tWaitingPlayers, v) UpdatePlayer(playerID) playerID:SetUserCtrlCompPause{bPaused = false} GetLeaderboardData(self, playerID, 5) -- start the music playerID:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = 'AG_Horde'} --set player stats to max playerID:SetHealth{health = playerID:GetMaxHealth{}.health} playerID:SetArmor{armor = playerID:GetMaxArmor{}.armor} playerID:SetImagination{imagination = playerID:GetMaxImagination{}.imagination} end --print('start smashables') activateSpawnerNetwork(tSpawnerNetworks.smashNetworks) self:SetVar('wavesStarted', true) self:NotifyClientZoneObject{name = 'Start_Wave_Message', paramStr = "Start!"} ActivityTimerStart('StartDelay', 3, 3) --(timerName, updateTime, stopTime) end ---------------------------------------------------------------- -- Custom function: Checks to see if all the players are dead, -- then stops the game. ---------------------------------------------------------------- function checkAllPlayersDead() local deadPlayers = 0 for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end if playerID:IsDead().bDead then deadPlayers = deadPlayers + 1 end end if deadPlayers == table.maxn(gGamestate.tPlayers) then return true end return false end ---------------------------------------------------------------- -- Custom function: Happens when all players have died, this -- stops all running processes and resets gGamestate variables ---------------------------------------------------------------- function GameOver(self, player) if not checkAllPlayersDead() then return end local finalTime = ActivityTimerGetCurrentTime('ClockTick') ActivityTimerStop('StartDelay') ActivityTimerStop('CoolDownTick') ActivityTimerStop('ClockTick') --print('Kill Mobs ***') spawnerResetT(tSpawnerNetworks.baseNetworks) spawnerResetT(tSpawnerNetworks.randNetworks) spawnerResetT(tSpawnerNetworks.rewardNetworks) for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end local timeVar = GetActivityValue(playerID, 0) local smashVar = GetActivityValue(playerID, 1)--/gGamestate.iTotalSpawned local scoreVar = GetActivityValue(playerID, 2) local respawnPoint = self:GetObjectsInGroup{ group = 'P' .. k .. '_Spawn', ignoreSpawners = true }.objects[1]:GetPosition().pos self:NotifyClientZoneObject{name = 'Update_ScoreBoard', paramObj = playerID, paramStr = tostring(scoreVar), param1 = timeVar, param2 = smashVar} playerID:Teleport{pos = respawnPoint} playerID:Resurrect() playerID:SetUserCtrlCompPause{bPaused = true} --print('smashed = ' .. smashVar .. ' out of ' .. gGamestate.iTotalSpawned .. ' for ' .. ' score = ' .. scoreVar) -- stop the music playerID:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = 'AG_Horde'} -- needed to get rewards playerID:UpdateMissionTask{ taskType = "performact_time", target = GAMEOBJ:GetZoneControlID():GetObjectsInGroup{ group = 'instance_manager', ignoreSpawners = true }.objects[1]:GetActivityID().activityID, value = 392, value2 = timeVar } end for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end StopActivity(playerID, finalTime, smashVar, scoreVar) end --print('smashed = ' .. GetActivityValue(player, 2) .. ' score = ' .. GetActivityValue(player, 1)) self:NotifyClientZoneObject{name = 'Show_ScoreBoard', paramObj = playerID} -- reset ticks gGamestate.iWaveNum = 1 -- current wave number gGamestate.iRewardTick = 1 -- number of rewards given self:SetVar('wavesStarted', false) end ---------------------------------------------------------------- -- Custom function: Gets a random number that is not the old number ---------------------------------------------------------------- function newRand(oldNum, maxRand) if maxRand == 1 then return '01', '01' end local randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end while randNum == oldNum do --print('found same') randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end end return randNum end ---------------------------------------------------------------- -- Custom function: Starts a spawner network ---------------------------------------------------------------- function activateSpawnerNetwork(spawnNetwork) for k,v in ipairs(spawnNetwork) do for i = 1, v.spawnerNum do --print('activateSpawnerNetwork: ' .. v.spawnerName .. '0' .. i) local spawner = LEVEL:GetSpawnerByName(v.spawnerName[i] .. v.spawnerNum) if spawner then --print('activateSpawnerNetwork --> ' .. v.spawnerName .. '0' .. i) if not spawner:SpawnerIsActive().bActive then --print('activate now') spawner:SpawnerActivate() end --print('reset now') spawner:SpawnerReset() end end end end ---------------------------------------------------------------- -- Custom function: Resets a spawner network ---------------------------------------------------------------- function spawnerResetT(spawnNetwork, bMaintainSpawnNum, iNumToMaintain) --dumpVar('resetTable', spawnNetwork, ' ') for k,v in ipairs(spawnNetwork) do for i = 1, table.maxn(v.spawnerName) do local spawner = LEVEL:GetSpawnerByName(v.spawnerName[i] .. v.spawnerNum) if spawner then --print('reset: ' .. v.spawnerName[i] .. v.spawnerNum) --track total mobs spawned gGamestate.iTotalSpawned = gGamestate.iTotalSpawned + spawner:SpawnerGetTotalSpawned().iSpawned v.bIsActive = false if not bMaintainSpawnNum then spawner:SpawnerDestroyObjects() spawner:SpawnerSetNumToMaintain{uiNum = numToMaintain} end if iNumToMaintain then spawner:SpawnerSetNumToMaintain{uiNum = iNumToMaintain} end spawner:SpawnerDeactivate() end end end end ---------------------------------------------------------------- -- Custom function: Spawns mobs on a spawner network, Now... ---------------------------------------------------------------- function spawnNow(spawner, spawnNum) --print('* inside spawnNow') if spawner then --print('*** Spawn Now!!') if not spawner:SpawnerIsActive().bActive then spawner:SpawnerSetNumToMaintain{uiNum = spawnNum} spawner:SpawnerActivate() else spawner:SpawnerSetNumToMaintain{uiNum = spawnNum} spawner:SpawnerReset() end end end ---------------------------------------------------------------- -- Custom function: Returns a random spawn set from tMobSets or false ---------------------------------------------------------------- function getRandomSet(setName, setNum) local randNum = math.random(1, #tMobSets[setName]['tier' .. setNum]) local randSet = tMobSets[setName]['tier' .. setNum][randNum] --dumpVar('** ' .. setName .. ' using: ' .. randNum, randSet) if randSet then return randSet end return false end ---------------------------------------------------------------- -- Custom function: Returns a random spawner number from the given -- spawner table or false ---------------------------------------------------------------- function getRandomSpawnerNum(tSpawner) local randNum = 0 local bValid = false while not bValid do randNum = 0 for k,v in ipairs(tSpawner) do if v.bIsLocked == false then randNum = randNum + 1 end end randNum = math.random(1, randNum) if randNum == 1 then bValid = true elseif not tSpawner[randNum].bIsActive then bValid = true tSpawner[randNum].bIsActive = true end end if randNum ~= 0 then return randNum end return false end ---------------------------------------------------------------- -- Custom function: Update the spawner in the specified way ---------------------------------------------------------------- function updateSpawner(self, tSpawner, spawnNum) if not tSpawner then return end if spawnNum then --print('Spawner: ' .. tSpawner.spawnerName[1] .. tSpawner.spawnerNum .. ' spawn: ' .. spawnNum) local spawner = LEVEL:GetSpawnerByName(tSpawner.spawnerName[1] .. tSpawner.spawnerNum) spawnNow(spawner, spawnNum) return end local newSet = getRandomSet(tSpawner.set, self:GetVar(tSpawner.set .. 'Num')) if newSet then local newSpawner = getRandomSpawnerNum(tSpawner) for k,v in ipairs(newSet) do if v ~= 0 then --print('Spawner: ' .. tSpawner[newSpawner].spawnerName[k] .. tSpawner[newSpawner].spawnerNum .. ' spawn: ' .. tSpawner[newSpawner].spawnerNum) local spawner = LEVEL:GetSpawnerByName(tSpawner[newSpawner].spawnerName[k] .. tSpawner[newSpawner].spawnerNum) spawnNow(spawner, v) end end end end ---------------------------------------------------------------- -- Custom function: Decides how to spawne mobs ---------------------------------------------------------------- function spawnMobs(self) if not self:GetVar('wavesStarted') then return end local spawnNum = gGamestate.iWaveNum if spawnNum > gConstants.rewardInterval then spawnNum = spawnNum - (gGamestate.iRewardTick-1) end if gGamestate.iWaveNum == gConstants.baseMobsStartTier2 then self:SetVar('baseMobSetNum', 2) elseif gGamestate.iWaveNum == gConstants.baseMobsStartTier3 then self:SetVar('baseMobSetNum', 3) end if gGamestate.iWaveNum == gConstants.randMobsStartTier2 then self:SetVar('randMobSetNum', 2) elseif gGamestate.iWaveNum == gConstants.randMobsStartTier3 then self:SetVar('randMobSetNum', 3) end if gGamestate.iWaveNum == gConstants.unlockMobSet3 then tSpawnerNetworks.randNetworks[3].bIsLocked = false end updateSpawner(self, tSpawnerNetworks.baseNetworks) --print('**** Spawn Tier' .. self:GetVar('baseMobSetNum') .. ' BaseMobs @ ' .. spawnNum .. '****') if gGamestate.iWaveNum >= gConstants.startMobSet2 and spawnNum > gConstants.startMobSet2 then --print('**** Spawn Tier' .. self:GetVar('randMobSetNum') .. ' RandMobs1 @ ' .. spawnNum .. '****') updateSpawner(self, tSpawnerNetworks.randNetworks) end if gGamestate.iWaveNum >= gConstants.startMobSet3 and spawnNum > gConstants.startMobSet3 then --print('**** Spawn Tier' .. self:GetVar('randMobSetNum') .. ' RandMobs2 ' .. spawnNum .. '****') updateSpawner(self, tSpawnerNetworks.randNetworks) end end -- Notify messages from Activity Manager ---------------------------------------------------------------- -- notify from activity mng: When activity is stopped this is -- needed to update the leaderboard. ---------------------------------------------------------------- function notifyDoCalculateActivityRating(self,other,msg) -- get the time for the player print('Time = ' .. msg.fValue1) print('Smash = ' .. msg.fValue2) print('Score = ' .. msg.fValue3) msg.outActivityRating = msg.fValue1 self:SendLuaNotificationCancel{requestTarget=cage, messageName="Die"} return msg end -- activity timers ---------------------------------------------------------------- -- notify from activity mng: When ActivityTimerUpdate is sent, -- basically when a timer hits it updateInterval. ---------------------------------------------------------------- function notifyActivityTimerUpdate(self, other, msg) if msg.name == "ClockTick" then self:NotifyClientZoneObject{name = 'Update_Timer', param1 = msg.timeElapsed} --print('Wave: ' .. gGamestate.iWaveNum .. ' Tick: ' .. msg.timeElapsed} .. ' : ' .. ((gConstants.waveTime * (gGamestate.iWaveNum-1)) + (gConstants.coolDownTime * (gGamestate.iRewardTick-1)))) if msg.timeElapsed >= ((gConstants.waveTime * (gGamestate.iWaveNum-1)) + (gConstants.coolDownTime * (gGamestate.iRewardTick-1))) or msg.timeElapsed == 1 then spawnMobs(self) --print('spawn number: ' .. gGamestate.iWaveNum .. ' @ ' .. msg.timeElapsed) if gGamestate.iWaveNum == gConstants.rewardInterval * gGamestate.iRewardTick then -- set music to cooldown the music for k,v in ipairs(gGamestate.tPlayers) do GAMEOBJ:GetObjectByID(v):SetNDAudioMusicParameter{m_NDAudioMusicParameterName = 'Intensity', m_Value = 0.0} end --print('**** Reward ****') updateSpawner(self, tSpawnerNetworks.rewardNetworks[1], 1) gGamestate.iRewardTick = gGamestate.iRewardTick + 1 --print('stopping clock tick') ActivityTimerStart('CoolDownTick', 1, gConstants.coolDownTime) --(timerName, updateTime, stopTime) spawnerResetT(tSpawnerNetworks.baseNetworks, true, 0) spawnerResetT(tSpawnerNetworks.randNetworks, true, 0) return end gGamestate.iWaveNum = gGamestate.iWaveNum + 1 end end end ---------------------------------------------------------------- -- notify from activity mng: When ActivityTimerDone is sent, -- basically when the activity timer has reached it's duration. ---------------------------------------------------------------- function notifyActivityTimerDone(self, other, msg) if msg.name == "AcceptedDelay" then self:NotifyClientZoneObject{name = 'Kill_ScoreBoard'} self:NotifyClientZoneObject{name = 'Reset_Timer'} StartWaves(self) elseif msg.name == "StartDelay" then ActivityTimerStart('ClockTick', 1) --(timerName, updateTime, stopTime) elseif msg.name == "CoolDownTick" then local iValue = 1.0 if gGamestate.iRewardTick == 2 then iValue = 2.0 elseif gGamestate.iRewardTick > 2 then iValue = 3.0 end -- set music to cooldown the music for k,v in ipairs(gGamestate.tPlayers) do GAMEOBJ:GetObjectByID(v):SetNDAudioMusicParameter{m_NDAudioMusicParameterName = 'Intensity', m_Value = iValue} end end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') --------------------------------------------------------------- -- Startup of the object ----------------------------------------------------------------. --function onStartup(self) -- -- add ui timer -- UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"text", "00:00"}} ) --end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function onNotifyClientZoneObject(self, msg) if msg.name == "Start_Timer" then -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) --UI:SendMessage( "ToggleGenericTextField", {{"visible", false }}) end if msg.name == "Update_Timer" then UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", SecondsToClock( msg.param1 ) } }) --UI:SendMessage( "ToggleGenericTextField", {{"visible", false }}) end if msg.name == "Kill_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) --UI:SendMessage( "ToggleGenericTextField", {{"visible", false }}) end if msg.name == "Reset_Timer" then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) end if msg.name == "Wave_Message" then UI:SendMessage( "ToggleGenericTextField", {{"visible", true }, {"text", "Wave: " .. msg.paramStr } }) end if msg.name == "Start_Wave_Message" then GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ShowActivityCountdown() UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) --UI:SendMessage( "ToggleGenericTextField", {{"visible", true }, {"text", msg.paramStr } }) end end ---------------------------------------------------------------- -- Server sends us a notification to do help, show dialogs ---------------------------------------------------------------- function onHelp(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if (msg.iHelpID == 0) then player:DisplayMessageBox{bShow = true, imageID = 1, text = "Click Ok To Defend Against The Endless Horde!!!, cancel to exit.", callbackClient = self, identifier = "exit_screen"} end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- Response to Exit activity dialog and user pressed OK if msg.identifier == "exit_screen" and msg.iButton == 1 then -- restart waves self:FireEventServerSide{senderID = msg.sender, args = 'start'} -- Response to Start activity dialog and ok is pressed and player is not in activity elseif msg.identifier == "exit_screen" and msg.iButton == 0 then -- remove ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) -- exit instance self:FireEventServerSide{senderID = msg.sender, args = 'exit'} end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] n = 1 b = 1 q = 1 d = 1 tableValues = {} storedScore = {} finalTable = {} name_value = 0 score_value = 0 name = 0 score = 0 for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Score"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("LeaderTable", tableValues) leaderboardDataForUI = implode(",",self:GetVar("LeaderTable")) self:SetVar("LeaderString", leaderboardDataForUI) UI:SendMessage("UpdateSurvivalScoreboard", { {"inextbestname", leaderboardDataForUI} } ) for j = 1, #tableValues do if tableValues[j] == player:GetName().name then name = j score = (j + 1) if name ~= 1 then name_value = (j - 2) score_value = (j - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif j == 1 then name_value = 1 score_value = 2 end self:SetVar("FoundPlayer", true ) break end end self:SetVar("name",name ) self:SetVar("score",score ) self:SetVar("tableValues",tableValues ) self:SetVar("name_value",name_value ) self:SetVar("score_value",score_value ) if self:GetVar("FoundPlayer") and self:GetVar("FoundFriendGuild") then UI:SendMessage("UpdateSurvivalScoreboard", { {"inextbesttime", tostring(tableValues[score_value]) }, {"inextbestname", tostring(tableValues[name_value]) } } ) elseif not self:GetVar("FoundFriendGuild") and self:GetVar("FoundPlayer") then UI:SendMessage("UpdateSurvivalScoreboard", { {"inextbesttime", tostring(tableValues[self:GetVar("score")]) }, {"inextbestname", tostring(tableValues[ self:GetVar("name")]) } } ) end UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", tostring(tableValues[ self:GetVar("name")]) } } ) --UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", tostring(tableValues[score_value]) }, {"inextbestname", tostring(tableValues[name_value]) } } ) self:SetVar("NextBest", tostring(tableValues[score_value]) ) end end-------------------------------------------------------------- -- *********************************************************** -- -- PVP Arena for Team Challenge. -- -- Author: Erik Urdang -- -- Team: Directrons -- -- *********************************************************** -------------------------------------------------------------- require('o_ShootingGallery') -------------------------------------------------------------- -- *********************************************************** -- ********************* Functions *************************** -- *********************************************************** -------------------------------------------------------------- -------------------------------------------------------------- -- Show socres to player -- currently not used -------------------------------------------------------------- function DisplayPlayerScores(self) local player1 = getObjectByName(self, "activityPlayer1") local player2 = getObjectByName(self, "activityPlayer2") local score1 = self:GetVar("Score1") local score2 = self:GetVar("Score2") end -------------------------------------------------------------- -- reset the scores to zero -------------------------------------------------------------- function resetScores(self) self:SetVar("Score1",0) self:SetVar("Score2",0) end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self, winner) -- get players local player1 = getObjectByName(self, "activityPlayer1") local player2 = getObjectByName(self, "activityPlayer2") -- get the player's scores local score1 = self:GetVar("Score1") local score2 = self:GetVar("Score2") local strText = "" local name1 = "Player 1 Unknown" local name2 = "Player 2 Unknown" if (player1) then name1 = player1:GetName().name end if (player2) then name2 = player2:GetName().name end strText = name1 .. ": " .. score1 .. " -- " .. name2 .. ": " .. score2 .. " -- " if (winner) then strText = strText .. "The WINNER: " .. winner:GetName().name .. "!" end -- show the summary message box to each player showScore(self, player1, strText) showScore(self, player2, strText) end -------------------------------------------------------------- -- Send the score to any player -------------------------------------------------------------- function showScore(self, player, strText) if (player) then player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Arena_Summary"} end end -------------------------------------------------------------- -- *********************************************************** -- ***************** Message Handlers ************************ -- *********************************************************** -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) resetScores(self) end -------------------------------------------------------------- -- Called when anyone dies -------------------------------------------------------------- function onPlayerDied (self, msg) print ("Someone died!!!") -- if player 1 died, add 1 to player 2's score, and vice versa local player1 = getObjectByName(self, "activityPlayer1") local player2 = getObjectByName(self, "activityPlayer2") local winner = nil --print ("Player1: " .. player1:GetID() .. " Player 2: " .. player2:GetID() .. " ID = " .. msg.playerID) local id = msg.playerID if (id:GetID() == player1:GetID()) then self:SetVar("Score2", tonumber(self:GetVar("Score2")) + 1) else self:SetVar("Score1", tonumber(self:GetVar("Score1")) + 1) end local score1 = tonumber(self:GetVar("Score1")) local score2 = tonumber(self:GetVar("Score2")) -- DisplayPlayerScores(self) local winningScore = 5 if (score1 >= winningScore) then print ("Player 1 wins!") showVictory (self, player1) winner = player1 elseif (score2 >= winningScore) then print ("Player 2 wins!") showVictory (self, player2) winner = player2 end showSummaryDialog(self, winner) if (winner) then -- Someone already won, so reset the scores to 0 for -- a new game. resetScores(self) end end -------------------------------------------------------------- -- Play fireworks when player wins -------------------------------------------------------------- function showVictory(self, player) player:ShowEmbeddedEffect{type = "fireworks"} player:ShowEmbeddedEffect{type = "rebuild-celebrate"} end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) -- print ("Player Entered: " .. msg.playerID:GetName().name) local player = msg.playerID local player1 = getObjectByName(self, "activityPlayer1") -- Assume this is either the first or second player. No others -- are allowed: if (player1 == nil or player == player1) then -- this is player 1 storeObjectByName(self, "activityPlayer1", msg.playerID) else -- this is player 2 storeObjectByName(self, "activityPlayer2", msg.playerID) -- Pick a new faction to be safe (no collisions with -- other NPC factions etc.). -- -- Note: 101 is being used to make sure that this script: -- -- ...\scripts\ai\CRATER\L_KILL_PLAYER_CONTEST_CREATURE.lua -- -- works. player:SetFaction {faction = 101} end showSummaryDialog(self, nil) end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_START_POS"] = {x = -15.711255, y = 276.552267, z = -13.312634} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} CONSTANTS["NPC_START_POS"] = { x = 156.0, y = 270.06, z = 145.0 } -- Other constants CONSTANTS["PLAYER_FACTION"] = 1 CONSTANTS["REBUILD_1_TEMPLATEID"] = 2451 CONSTANTS["REBUILD_NPC_TEMPLATEID"] = 2502 -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- try to show rebuild activator -------------------------------------------------------------- function showRebuildActivator(self) -- get the cannon local rebuild = getObjectByName(self, "rebuildObject") -- get the player local npc = getObjectByName(self, "rebuildNPCObject") -- if we have both show it if ((rebuild) and (npc)) then -- show the rebuild activator rebuild:DisplayRebuildActivator{bShow = true} end end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Rebuild Object Loaded if (msg.templateID == CONSTANTS["REBUILD_1_TEMPLATEID"]) then -- store the rebuild object for use later storeObjectByName(self, "rebuildObject", msg.objectID) elseif (msg.templateID == CONSTANTS["REBUILD_NPC_TEMPLATEID"]) then -- store the rebuild npc object for use later storeObjectByName(self, "rebuildNPCObject", msg.objectID) showRebuildActivator(self) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_START_POS"] = {x = -15.711255, y = 276.552267, z = -13.312634} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} CONSTANTS["NPC_START_POS"] = { x = 156.0, y = 270.06, z = 145.0 } -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 0, y = 0, z = 0} CONSTANTS["CANNON_VELOCITY"] = 100.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} CONSTANTS["CANNON_TIMEOUT"] = 60.0 -- Other constants CONSTANTS["FLOATING_TARGET"] = 2565 CONSTANTS["FLOATING_PATH_NAME"] = "TestPath" CONSTANTS["FLOATING_TARGET_SPAWN_TIME"] = 5.0 -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self, bSendRequest) -- get the cannon local cannon = getObjectByName(self, "cannonObject") -- get the player local player = getObjectByName(self, "activityPlayer") -- if we have both start it if ((cannon) and (player)) then -- send request to start cannon if needed if (bSendRequest == true) then cannon:RequestActivityStartStop{bStart = true, userID = player} end end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bSendRequest) -- get the cannon local cannon = getObjectByName(self, "cannonObject") -- get the player local player = getObjectByName(self, "activityPlayer") -- if we have both stop it if we need to if ((bSendRequest == true) and (cannon) and (player)) then cannon:RequestActivityStartStop{bStart = false, userID = player} end DoGameShutdown(self) end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars self:SetVar("GameStarted", true) self:SetVar("GameScore",0) self:SetVar("GameTime",0) -- spawn floating thing GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FLOATING_TARGET_SPAWN_TIME"], "SpawnFloater",self ) end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) self:SetVar("GameStarted", false) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self) -- get player local player = getObjectByName(self, "activityPlayer") if (player) then -- get the player's score and time local score = self:GetVar("GameScore") local time = self:GetVar("GameTime") local strText = "" if (score and time) then strText = "Your Score is " .. score .. ".

Retry?" else strText = "Retry?" end -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Summary"} end end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state self:SetVar("GameStarted", false) self:SetVar("GameScore",0) self:SetVar("GameTime",0) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if msg.name == "SpawnFloater" then RESMGR:LoadObject { objectTemplate = CONSTANTS["FLOATING_TARGET"], bIsSmashable = true, x = 32, y = 290, z = 32, owner = self } -- spawn more GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FLOATING_TARGET_SPAWN_TIME"], "SpawnFloater",self ) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) if msg.templateID == CONSTANTS["FLOATING_TARGET"] then -- set the path msg.childID:SetMovingPlatformParams{ wsPlatformPath = "TestPath", iStartIndex = 0 } end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) -- stun and move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not..... local player = msg.playerID player:ServerSetUserCtrlCompPause{bPaused = true} player:Teleport{pos = CONSTANTS["PLAYER_START_POS"], x = CONSTANTS["PLAYER_START_ROT"].x, y = CONSTANTS["PLAYER_START_ROT"].y, z = CONSTANTS["PLAYER_START_ROT"].z, w = CONSTANTS["PLAYER_START_ROT"].w, bSetRotation = true} if (self:GetVar("GameStarted") == false) then -- get the player local player = getObjectByName(self, "activityPlayer") -- store the player for later use if (player == nil) then storeObjectByName(self, "activityPlayer", msg.playerID) end -- try to start the game startGame(self, true) end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Cannon Object Loaded if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then -- Override the cannon shooting parameters msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- store the cannon object for use later storeObjectByName(self, "cannonObject", msg.objectID) if (self:GetVar("GameStarted") == false) then -- try to start the game startGame(self, true) end end end -------------------------------------------------------------- -- Sent from the cannon when a player starts or stops the activity -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- if the user quit, stop the game if (msg.bStart == false) then stopGame(self, false) showSummaryDialog(self) elseif (msg.bStart == true) then -- get the player local player = getObjectByName(self, "activityPlayer") -- store the player just in case if (player == nil) then player = msg.userID storeObjectByName(self, "activityPlayer", player) end -- start the game startGame(self,false) DoGameStartup(self) end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- save the score and time for later use self:SetVar("GameScore",msg.fValue1) self:SetVar("GameTime",msg.fValue2) -- also return the score as the result for the activity msg.outActivityRating = msg.fValue1 return msg end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this is the right player local player = getObjectByName(self, "activityPlayer") if (player:GetID() == msg.sender:GetID()) then -- User wants to retry if (msg.iButton == 1 and msg.identifier == "Shooting_Gallery_Summary") then startGame(self,true) -- User wants to quit elseif (msg.iButton == 0 and msg.identifier == "Shooting_Gallery_Summary") then -- go back to the other zone player:ServerSetUserCtrlCompPause{bPaused = false} player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_START_POS"] = {x = -15.711255, y = 276.552267, z = -13.312634} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} CONSTANTS["NPC_START_POS"] = { x = 156.0, y = 270.06, z = 145.0 } -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 0, y = 0, z = 0} CONSTANTS["CANNON_VELOCITY"] = 100.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} CONSTANTS["CANNON_TIMEOUT"] = -1.0 -- Other constants CONSTANTS["PLAYER_FACTION"] = 1 -------------------------------------------------------------- -- Zone Waypoints -------------------------------------------------------------- waypoints = {} -- first waypoint = {} waypoint[1] = { x = 171.3 , y= 270.0 , z= 92.79 } waypoint[2] = { x = 154.1 , y= 270.0 , z= 112.9 } waypoint[3] = { x = 141.9 , y= 270.0 , z= 131.3 } waypoint[4] = { x = 126.4 , y= 270.0 , z= 147.7 } waypoint[5] = { x = 113.6 , y= 270.0 , z= 163.8 } waypoints[1] = waypoint -- second waypoint = {} waypoint[1] = { x = 102.5 , y= 270.0 , z= 43.9 } waypoint[2] = { x = 89.7 , y= 270.0 , z= 60.8 } waypoint[3] = { x = 74.5 , y= 270.0 , z= 71.8 } waypoint[4] = { x = 60.8 , y= 270.0 , z= 85.9 } waypoint[5] = { x = 50.5 , y= 270.0 , z= 98.4 } waypoints[2] = waypoint -- third waypoint = {} waypoint[1]= { x = 33.48 , y= 270.0 , z= -7.9 } waypoint[2]= { x = 20.6 , y= 270.0 , z= 4.9 } waypoint[3]= { x = 8.2 , y= 270.0 , z= 17.8 } waypoint[4]= { x = -3.5 , y= 270.0 , z= 28.0 } waypoint[5]= { x = -11.0 , y= 270.0 , z= 37.0 } waypoints[3] = waypoint -------------------------------------------------------------- -- Spawn Data -------------------------------------------------------------- spawns = {} spawn = {} spawn[1] = { id = 2390, time = 1.0, speed = 3.0, score = 50, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[2] = { id = 2390, time = 2.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[3] = { id = 2390, time = 3.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[4] = { id = 2390, time = 1.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[5] = { id = 2390, time = 2.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[6] = { id = 2390, time = 3.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[7] = { id = 2390, time = 1.0, speed = 3.0, score = 50, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[8] = { id = 2390, time = 2.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[9] = { id = 2390, time = 3.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[10]= { id = 2390, time = 1.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawns[1] = spawn spawn = {} spawn[1] = { id = 2390, time = 1.0, speed = 4.0, score = 75, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[2] = { id = 2390, time = 2.0, speed = 6.0, score = 125, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[3] = { id = 2390, time = 3.0, speed = 8.0, score = 175, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[4] = { id = 2390, time = 1.0, speed = 4.0, score = 125, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[5] = { id = 2390, time = 2.0, speed = 8.0, score = 175, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[6] = { id = 2390, time = 3.0, speed = 6.0, score = 125, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[7] = { id = 2390, time = 1.0, speed = 4.0, score = 75, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[8] = { id = 2390, time = 2.0, speed = 6.0, score = 125, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[9] = { id = 2390, time = 3.0, speed = 8.0, score = 175, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[10]= { id = 2390, time = 1.0, speed = 6.0, score = 125, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawns[2] = spawn spawn = {} spawn[1] = { id = 2390, time = 1.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[2] = { id = 2390, time = 2.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[3] = { id = 2390, time = 3.0, speed = 9.0, score = 200, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[4] = { id = 2390, time = 1.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[5] = { id = 2390, time = 2.0, speed = 9.0, score = 200, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[6] = { id = 2390, time = 3.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[7] = { id = 2390, time = 1.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[8] = { id = 2390, time = 2.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[9] = { id = 2390, time = 3.0, speed = 9.0, score = 200, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawn[10]= { id = 2390, time = 1.0, speed = 7.0, score = 150, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawns[3] = spawn healthSpawns = {} healthSpawns[1] = { x = 34.33 , y= 270.0 , z= -12.23 } healthSpawns[2] = { x = 30.33 , y= 270.0 , z= -7.87 } healthSpawns[3] = { x = 25.29 , y= 270.0 , z= -2.68 } healthSpawns[4] = { x = 18.94 , y= 270.0 , z= 3.85 } healthSpawns[5] = { x = 12.46 , y= 270.0 , z= 10.52 } healthSpawns[6] = { x = 6.47 , y= 270.0 , z= 16.68 } healthSpawns[7] = { x = 0.49 , y= 270.0 , z= 22.83 } healthSpawns[8] = { x = -4.74 , y= 270.0 , z= 28.22 } healthSpawns[9] = { x = -9.64 , y= 270.0 , z= 33.57 } healthSpawns[10]= { x = -13.04, y= 270.0 , z= 37.57 } -------------------------------------------------------------- -- Activity Constants -------------------------------------------------------------- CONSTANTS["MAX_HEALTH"] = #healthSpawns CONSTANTS["NUM_WAVES"] = #waypoints CONSTANTS["HEALTH_TEMPLATEID"] = 2018 CONSTANTS["FIRST_WAVE_START_TIME"] = 8.0 CONSTANTS["TIME_BETWEEN_WAVES"] = 5.0 -------------------------------------------------------------- -- String Table -------------------------------------------------------------- strings = {} strings["WAVE_TEXT"] = "Wave " strings["LIFE_LOST"] = "BBQ Lost!" -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self, bSendRequest) -- get the cannon local cannon = getObjectByName(self, "cannonObject") -- get the player local player = getObjectByName(self, "activityPlayer") -- if we have both start it if ((cannon) and (player)) then -- send request to start cannon if needed if (bSendRequest == true) then cannon:RequestActivityStartStop{bStart = true, userID = player} end end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bSendRequest) -- get the cannon local cannon = getObjectByName(self, "cannonObject") -- get the player local player = getObjectByName(self, "activityPlayer") -- if we have both stop it if we need to if ((bSendRequest == true) and (cannon) and (player)) then cannon:RequestActivityStartStop{bStart = false, userID = player} end DoGameShutdown(self) end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars self:SetVar("SpawnNum", 0) self:SetVar("Health", CONSTANTS["MAX_HEALTH"]) self:SetVar("DisplayWaveNum", 0) self:SetVar("CurSpawnNum", 0) self:SetVar("CurSpawnHealthNum", 0) self:SetVar("GameStarted", true) self:SetVar("NumDeadSpawns", 0) self:SetVar("NextWave", 0) self:SetVar("GameScore",0) self:SetVar("GameTime",0) self:SetVar("GameWave",0) -- spawn the health objects print ("Spawning Health Items") for k,v in pairs(healthSpawns) do SpawnHealth(k,v,self) end -- start the first wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FIRST_WAVE_START_TIME"], "SpawnWave1",self ) end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) self:SetVar("GameStarted", false) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self) -- get the current spawn number local spawnNum = IncrementVarAndReturn(self,"SpawnNum") -- save the spawn data for the object when it is loaded local SpawnData = {sdTemplate = spawn.id, sdSpeed = spawn.speed, sdScore = spawn.score, sdUseRandomPath = spawn.bwpRan, sdWP1 = spawn.w1, sdWP2 = spawn.w2, sdWP3 = spawn.w3} -- store the data self:SetVar("SpawnData" .. spawnNum, SpawnData) -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum GAMEOBJ:GetTimer():AddTimerWithCancel( spawn.time, timerName, self ) end -------------------------------------------------------------- -- spawns the health objects -------------------------------------------------------------- function SpawnHealth(num, spawn, self) -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["HEALTH_TEMPLATEID"], bIsSmashable = true, x = spawn.x, y = spawn.y, z = spawn.z, owner = self } end -------------------------------------------------------------- -- destroys all health objects and spawns -------------------------------------------------------------- function DestroyAllSpawns(self) for health = 1, CONSTANTS["MAX_HEALTH"] do local healthObject = getObjectByName(self, "healthSpawn" .. health) if (healthObject) then print("removing health item " .. health) if (healthObject:IsDead().bDead == false) then healthObject:Die{killerID = healthObject} end end end local maxSpawnNum = self:GetVar("CurSpawnNum") for spawn = 1, maxSpawnNum do local spawnObject = getObjectByName(self, "spawnObject" .. spawn) if (spawnObject) then print("removing spawn object " .. spawn) if (spawnObject:IsDead().bDead == false) then spawnObject:Die{killerID = spawnObject} end end end end -------------------------------------------------------------- -- sends a message to display the current wave number to player -------------------------------------------------------------- function DisplayWaveNumberToPlayer(self) local player = getObjectByName(self, "activityPlayer") if (player) then local displayWave = IncrementVarAndReturn(self,"DisplayWaveNum") local textString = strings["WAVE_TEXT"] .. displayWave end end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self) -- get player local player = getObjectByName(self, "activityPlayer") if (player) then -- get the player's score and time local score = self:GetVar("GameScore") local time = self:GetVar("GameTime") local wave = self:GetVar("GameWave") local strText = "" if (score and time and wave) then strText = "Score/Wave: " .. score .. "/" .. wave .. ", Retry?" else strText = "Retry?" end -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Summary"} end end -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end -------------------------------------------------------------- -- Increment a saved variable and return its new value -------------------------------------------------------------- function IncrementVarAndReturn(self,varName) local value = self:GetVar(varName) if (value) then value = value + 1 end self:SetVar(varName,value) return value end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state self:SetVar("GameStarted", false) self:SetVar("CurSpawnNum", 0) self:SetVar("NumDeadSpawns", 0) self:SetVar("CurSpawnHealthNum", 0) self:SetVar("NextWave", 0) self:SetVar("Health", CONSTANTS["MAX_HEALTH"]) self:SetVar("GameScore",0) self:SetVar("GameTime",0) self:SetVar("GameWave",0) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- parse the name to get out the wave number -- use the wave number to select the spawns -- of format "SpawnWaveXXX" where XXX is the spawn number if (string.starts(msg.name,"SpawnWave")) then if (self:GetVar("GameStarted") == true) then -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,10) print("Spawning Wave " .. waveNum) self:SetVar("GameWave", waveNum) -- display wave number to player DisplayWaveNumberToPlayer(self) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self) end -- move to the next wave waveNum = waveNum + 1 -- repeat the last wave if we are at the max if (waveNum > CONSTANTS["NUM_WAVES"]) then waveNum = CONSTANTS["NUM_WAVES"]; end -- store next wave number self:SetVar("NextWave", waveNum) -- setup next wave -- GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["TIME_BETWEEN_WAVES"], "SpawnWave" .. waveNum,self ) end end -- parse the name to get out the spawn number -- use the spawn number to select the template id -- load the object -- of format "DoSpawnXXX" where XXX is the spawn number if (string.starts(msg.name,"DoSpawn")) then if (self:GetVar("GameStarted") == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = self:GetVar("SpawnData" .. spawnNum) local templateID = SpawnData.sdTemplate -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = CONSTANTS["NPC_START_POS"].x, y = CONSTANTS["NPC_START_POS"].y, z = CONSTANTS["NPC_START_POS"].z, owner = self } end end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- check for health spawns, MUST BE FIRST if msg.templateID == CONSTANTS["HEALTH_TEMPLATEID"] then -- set the health spawn faction to same as a player msg.childID:SetFaction{faction = CONSTANTS["PLAYER_FACTION"]} -- get current spawn health number and increment local healthSpawnNum = IncrementVarAndReturn(self,"CurSpawnHealthNum") -- store health spawn for use later storeObjectByName(self, "healthSpawn" .. healthSpawnNum, msg.childID) else -- get the current spawn number and increment it local spawnNum = IncrementVarAndReturn(self,"CurSpawnNum") -- get the template out of the spawn data local SpawnData = self:GetVar("SpawnData" .. spawnNum) -- check for the right template if msg.templateID == SpawnData.sdTemplate then -- store spawn for use later storeObjectByName(self, "spawnObject" .. spawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child msg.childID:SetVar("SpawnData", SpawnData) -- store the waypoint data in the child if (SpawnData.sdUseRandomPath == true) then -- do random waypoints local wp1 = math.random(1,5) local wp2 = math.random(1,5) local wp3 = math.random(1,5) msg.childID:SetVar("Waypoint1",waypoints[1][wp1]) msg.childID:SetVar("Waypoint2",waypoints[2][wp2]) msg.childID:SetVar("Waypoint3",waypoints[3][wp3]) else -- do normal waypoints msg.childID:SetVar("Waypoint1",waypoints[1][SpawnData.sdWP1]) msg.childID:SetVar("Waypoint2",waypoints[2][SpawnData.sdWP2]) msg.childID:SetVar("Waypoint3",waypoints[3][SpawnData.sdWP3]) end end end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) -- move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not..... local player = msg.playerID player:ServerSetUserCtrlCompPause{bPaused = true} player:Teleport{pos = CONSTANTS["PLAYER_START_POS"], x = CONSTANTS["PLAYER_START_ROT"].x, y = CONSTANTS["PLAYER_START_ROT"].y, z = CONSTANTS["PLAYER_START_ROT"].z, w = CONSTANTS["PLAYER_START_ROT"].w, bSetRotation = true} if (self:GetVar("GameStarted") == false) then -- get the player local player = getObjectByName(self, "activityPlayer") -- store the player for later use if (player == nil) then storeObjectByName(self, "activityPlayer", msg.playerID) end -- try to start the game startGame(self, true) end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Cannon Object Loaded if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then -- Override the cannon shooting parameters msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- store the cannon object for use later storeObjectByName(self, "cannonObject", msg.objectID) if (self:GetVar("GameStarted") == false) then -- try to start the game startGame(self, true) end end end -------------------------------------------------------------- -- Sent from a ninja when he gets to his final waypoint -------------------------------------------------------------- function onArrived(self, msg) if (self:GetVar("GameStarted") == true) then -- get the health left local health = self:GetVar("Health") if (health > 0) then -- tell the player they lost a life local player = getObjectByName(self, "activityPlayer") -- remove health newhealth = health - 1 self:SetVar("Health", newhealth) -- destroy a health object local healthObject = getObjectByName(self, "healthSpawn" .. health) if (healthObject) then healthObject:Die{killerID = healthObject} end -- game over if (newhealth <= 0) then print("health empty, game over") stopGame(self, true) end end end end -------------------------------------------------------------- -- Sent from the cannon when a player starts or stops the activity -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- if the user quit, stop the game if (msg.bStart == false) then stopGame(self, false) showSummaryDialog(self) elseif (msg.bStart == true) then -- get the player local player = getObjectByName(self, "activityPlayer") -- store the player just in case if (player == nil) then player = msg.userID storeObjectByName(self, "activityPlayer", player) end -- start the game startGame(self,false) DoGameStartup(self) end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- save the score and time for later use self:SetVar("GameScore",msg.fValue1) self:SetVar("GameTime",msg.fValue2) -- wave should already be set -- also return the score as the result for the activity msg.outActivityRating = msg.fValue1 return msg end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this is the right player local player = getObjectByName(self, "activityPlayer") if (player:GetID() == msg.sender:GetID()) then -- User wants to retry if (msg.iButton == 1 and msg.identifier == "Shooting_Gallery_Summary") then startGame(self,true) -- User wants to quit elseif (msg.iButton == 0 and msg.identifier == "Shooting_Gallery_Summary") then -- go back to the other zone player:ServerSetUserCtrlCompPause{bPaused = false} player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end end end -------------------------------------------------------------- -- Sent from the spawn objects on death -------------------------------------------------------------- function onUpdateMissionTask(self, msg) local numDeadSpawns = IncrementVarAndReturn(self,"NumDeadSpawns") local maxSpawnNum = self:GetVar("CurSpawnNum") -- if all the spawns are dead or gone if (numDeadSpawns == maxSpawnNum) then -- spawn the next wave local waveNum = self:GetVar("NextWave") -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["TIME_BETWEEN_WAVES"], "SpawnWave" .. waveNum,self ) end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') -- @TODO: Add Path Changing on waypoint, need to get [Closest Waypoint on New Path] -- Also need [Number of Waypoints on Path] -- @TODO: Optimize -------------------------------------------------------------- -- Locals and Constants LOCALS = {} CONSTANTS = {} -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS["PLAYER_START_POS"] = {x = -908.542480, y = 229.773178, z = -7.577438} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -1.188} CONSTANTS["CANNON_VELOCITY"] = 160.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} CONSTANTS["CANNON_TIMEOUT"] = -1 CONSTANTS["CANNON_FOV"] = 58.6 CONSTANTS["CANNON_USE_LEADERBOARDS"] = true -- for Animations CONSTANTS["VALID_ACTORS"] = {3109, 3110, 3111, 3112, 3125, 3126} ACTORS = {} -- stores actors for the instance -- for Effects CONSTANTS["VALID_EFFECTS"] = {3122} EFFECTS = {} -- stores effects for the instance -- cannon impact skills --CONSTANTS["CANNON_IMPACT_SKILL"] = {34, 34, 61, 62} --CONSTANTS["CANNON_RETICULE_EFFECT"] = {"inRange", "inRange", "inRange2", "inRange3"} -------------------------------------------------------------- -- Wave Data waves = {} PLAYER_SCORE = {} -------------------------------------------------------------- -- Syntax: [Time] [Text to Show Player] -------------------------------------------------------------- AddWave(waves, 5.0, "Wave;One" ) AddWave(waves, 5.0, "Wave;Two" ) AddWave(waves, 5.0, "Wave;Three" ) -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 self:SetVar("NumOfWaves", #waves ) self:SetVar("Wave1", 5 ) self:SetVar("Wave2", 5 ) self:SetVar("Wave3", 5 ) end -- wave constants CONSTANTS["NUM_WAVES"] = #waves CONSTANTS["FIRST_WAVE_START_TIME"] = 4.0 CONSTANTS["IN_BETWEEN_WAVE_PAUSE"] = 7.0 -------------------------------------------------------------- -- Spawn Data spawns = {} SPAWN_DATA = {} -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- AddSpawn - configures data for the spawn and adds it. Can -- only have one. -- Syntax: AddSpawn(spawn, paths, [Template ID], -- [Initial Spawn Time Min], [Initial Spawn Time Max], [Does Respawn], -- [Respawn Time Min], [Respawn Time Max], -- [Initial Speed], [Score], [Change Speed at Waypoints], -- [Chance to Change Speed], [Min Speed], [Max Speed], -- [Is Moving Platform], [Despawn On Last Waypoint], [Time Score]) -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -------------------------------------------------------------- -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_2") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 100, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_3") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 100, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Sub -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 2983, 0.0, 2.0, true, 0, 2, 10.0, 100, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 250, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ness_1") AddPath(paths, "Wave_1_Ness_2") AddSpawn(spawn,paths, 2565, 10.0, 15.0, true, 10.0, 15.0, 2.0, 500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Pearl -------------------------------------------------------------- --paths = {} -------------------------------------------------------------- --AddPath(paths, "Pearl") --AddPath(paths, "Pearl_2") --AddPath(paths, "Pearl_3") --AddSpawn(spawn,paths, -- 2976, 5.0, 10.0, true, 5.0, 10.0, 2.0, 500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 2 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_2") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 200, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_3") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 200, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 200, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 2983, 0.0, 2.0, true, 0, 2, 2.0, 200, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 2983, 0.0, 2.0, true, 0, 2, 2.0, 200, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddPath(paths, "Wave_2_Duck_1") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 500, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ness_1") AddPath(paths, "Wave_1_Ness_2") AddPath(paths, "Wave_2_Ness_1") AddSpawn(spawn,paths, 2565, 10.0, 15.0, true, 10.0, 15.0, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Pearl -------------------------------------------------------------- --paths = {} -------------------------------------------------------------- --AddPath(paths, "Pearl") --AddPath(paths, "Pearl_2") --AddPath(paths, "Pearl_3") --AddSpawn(spawn,paths, -- 2976, 5.0, 10.0, true, 5.0, 10.0, 2.0, 500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 3 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_2") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 300, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_3") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 300, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 300, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ship 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_1") AddPath(paths, "Wave_3_Ship_2") AddSpawn(spawn,paths, 2974, 0.0, 2.0, true, 0, 2, 2.0, 300, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 2983, 0.0, 2.0, true, 0, 2, 2.0, 300, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 2983, 0.0, 2.0, true, 0, 2, 2.0, 300, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Sub_1") AddPath(paths, "Wave_3_Sub_2") AddSpawn(spawn,paths, 2983, 0.0, 2.0, true, 0, 2, 2.0, 300, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddPath(paths, "Wave_2_Duck_1") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 750, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ness_1") AddPath(paths, "Wave_1_Ness_2") AddPath(paths, "Wave_2_Ness_1") AddSpawn(spawn,paths, 2565, 10.0, 15.0, true, 10.0, 15.0, 2.0, 1500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Pearl -------------------------------------------------------------- --paths = {} -------------------------------------------------------------- --AddPath(paths, "Pearl") --AddPath(paths, "Pearl_2") --AddPath(paths, "Pearl_3") --AddSpawn(spawn,paths, -- 2976, 5.0, 10.0, true, 5.0, 10.0, 2.0, 500, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- play effects on all effects in the scene -------------------------------------------------------------- function PlaySceneEffect(effectName) -- trigger effects on effect objects for effectID = 1, #EFFECTS do local effect = GAMEOBJ:GetObjectByID(EFFECTS[effectID]) effect:PlayFXEffect{ effectType = effectName } end end -------------------------------------------------------------- -- play animations on all actors in the scene, and others -------------------------------------------------------------- function PlaySceneAnimation(anim, bPlayCannon, bPlayPlayer) -- play animation on actors for actorID = 1, #ACTORS do local actor = GAMEOBJ:GetObjectByID(ACTORS[actorID]) actor:PlayAnimation{ animationID = anim } end -- play on cannon if (bPlayCannon == true) then local cannon = getObjectByName("cannonObject") cannon:PlayAnimation{ animationID = anim } end -- play on player if (bPlayPlayer == true) then local player = getObjectByName("activityPlayer") player:PlayAnimation{ animationID = anim } end end -------------------------------------------------------------- -- return if template is a valid actor -------------------------------------------------------------- function IsValidActor(templateID) for actors = 1, #CONSTANTS["VALID_ACTORS"] do if (templateID == CONSTANTS["VALID_ACTORS"][actors]) then return true end end return false end -------------------------------------------------------------- -- return if template is a valid effect -------------------------------------------------------------- function IsValidEffect(templateID) for effects = 1, #CONSTANTS["VALID_EFFECTS"] do if (templateID == CONSTANTS["VALID_EFFECTS"][effects]) then return true end end return false end -------------------------------------------------------------- -- put the player in the cannon, does not start the cannon -------------------------------------------------------------- function enterCannon(self) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both start it if ((cannon) and (player)) then cannon:RequestActivityEnter{bStart = false, userID = player} end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both start it if ((cannon) and (player)) then -- put the player in if we have to, otherwise start if ((cannon:GetActivityUser().userID):GetID() ~= player:GetID()) then print("wrong player") cannon:RequestActivityEnter{bStart = true, userID = player} else print("starting game") getObjectByName( "Cannon_Timer"):NotifyObject{ name = "Start" } cannon:ActivityStart{ rerouteID = player } end DoGameStartup(self) end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bCanceling) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both stop it if we need to, but dont exit if ((cannon) and (player)) then print("stopping game") getObjectByName( "Cannon_Timer"):NotifyObject{ name = "Stop" } cannon:ActivityStop{rerouteID = player, bExit = false, bUserCanceled = bCanceling} DoGameShutdown(self) -- if we are not exiting, shwo the summary and allow for retry if (bCanceling == false) then showSummaryDialog(self) end end end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 LOCALS["GameStarted"] = true LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 -- reset scores for waveNum = 1, tonumber(CONSTANTS["NUM_WAVES"]) do PLAYER_SCORE[waveNum] = 0 end -- start the first wave LOCALS["ThisWave"] = 1 if CONSTANTS["FIRST_WAVE_START_TIME"] < 1 then CONSTANTS["FIRST_WAVE_START_TIME"] = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FIRST_WAVE_START_TIME"], "SpawnWave1",self ) -- Scene animations and wave number DISABLED for start, we use 3/2/1/Go instead -- play wave animation on actors, cannon, and player --PlaySceneAnimation("wave" .. LOCALS["ThisWave"], true, true) -- display wave number to player --DisplayWaveNumberToPlayer(self, LOCALS["ThisWave"]) -- set the cannon reticule back to start setCannonReticuleSize(self, 1) end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) print("game shutdown") LOCALS["GameStarted"] = false -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- Remove the player from the zone -------------------------------------------------------------- function RemovePlayerFromZone(self, player) player:ServerSetUserCtrlCompPause{bPaused = false} -- UNCOMMENT to go back to the other zone player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end -------------------------------------------------------------- -- Get a random path -------------------------------------------------------------- function GetRandomPath(spawn) -- pick a random local ran = math.random(1,#spawn.path) return spawn.path[ran] end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self, bSpawnNow) -- get the current spawn number local spawnNum = IncrementVarAndReturn("SpawnNum") -- save the spawn data for the object when it is loaded local SpawnData = {sdTemplate = spawn.id, sdRespawn = spawn.bRespawn, sdSpeed = spawn.speed, sdScore = spawn.score, sdPath = GetRandomPath(spawn), sdnum = num, sdChangeSpeed = spawn.bChangeSpeed, sdSpeedChance = spawn.speedChangeChance, sdMinSpeed = spawn.minSpeed, sdMaxSpeed = spawn.maxSpeed, sdMovingPlat = spawn.bMovingPlatform, sdDespawnTime = spawn.despawnTime, sdTimeScore = spawn.timeScore, bSpawned = false} -- store the data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum -- spawn now and use initial spawn times if (bSpawnNow == true) then if (spawn.initSpawnTimeMin > 0 and spawn.initSpawnTimeMax > 0) then local ranSpawnTime = (math.random() * (spawn.initSpawnTimeMax - spawn.initSpawnTimeMin)) + spawn.initSpawnTimeMin print ("init spawning with time " .. ranSpawnTime) if ranSpawnTime < 1 then ranSpawnTime = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( ranSpawnTime, timerName, self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 1, timerName, self ) end -- respawn, use respawn times elseif (spawn.bRespawn == true) then -- pick a random spawn time local ranSpawnTime = (math.random() * (spawn.maxTime - spawn.minTime)) + spawn.minTime if ranSpawnTime < 1 then ranSpawnTime = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( ranSpawnTime, timerName, self ) end end -------------------------------------------------------------- -- destroys all spawns -------------------------------------------------------------- function DestroyAllSpawns(self) local maxSpawnNum = LOCALS["CurSpawnNum"] for spawn = 1, maxSpawnNum do -- @TODO: (Optimize this) local spawnObject = getObjectByName("spawnObject" .. spawn) if (spawnObject) then if (spawnObject:Exists() and not spawnObject:IsDead().bDead) then print("removing spawn object " .. spawn) spawnObject:Die{killerID = spawnObject, killType = "SILENT"} end end end -- reset vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 end -------------------------------------------------------------- -- sends a message to display the current wave text to player -------------------------------------------------------------- function DisplayWaveNumberToPlayer(self, waveNum) -- @TODO: (Optimize) local player = getObjectByName("activityPlayer") if (player) then UI:SendMessage("ToggleFlashingText", { {"visible", true }, {"text", waves[tonumber(waveNum)].waveStr}}) end end -------------------------------------------------------------- -- look through spawn data to find the most recent data -- that matches the template, returns nil or data -------------------------------------------------------------- function GetLatestSpawnDataByTemplate(self,templateID) local spawnNum = LOCALS["SpawnNum"] while (spawnNum > 0) do -- get the data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] -- check spawn flag and template if (SpawnData.bSpawned == false and templateID == SpawnData.sdTemplate) then -- set spawned flag SpawnData.bSpawned = true -- re-save data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- return the good data return SpawnData end -- try prev spawn data spawnNum = spawnNum - 1 end return nil end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self) -- get player local player = getObjectByName("activityPlayer") if (player) then -- do summary dialog -- Wave Score local score = LOCALS["GameScore"] --local strText = "Score:\n\n" --for wavenum = 1, tonumber(CONSTANTS["NUM_WAVES"]) do -- strText = strText .. "Wave " .. wavenum .. " = " .. PLAYER_SCORE[tonumber(wavenum)] .. "\n" --end -- Total Score --strText = strText .. "\nTotal: " .. score .. "\n" -- Accuracy --strText = strText .. "\nAccuracy: " .. LOCALS["NumKills"] .. "/" .. LOCALS["NumShots"] .. "\n" -- Highest Streak --strText = strText .. "\Highest Streak: " .. LOCALS["MaxStreak"] .. "\n" local cannon = getObjectByName("cannonObject") local msgReward = cannon:GetActivityReward{ playerID = player } print("rewardMoney = " .. tostring(msgReward.rewardMoney)) player:ShowActivitySummary{ totalScore = score, waveScore1 = PLAYER_SCORE[1], waveScore2 = PLAYER_SCORE[2], waveScore3 = PLAYER_SCORE[3], waveScore4 = PLAYER_SCORE[4], numShots = LOCALS["NumShots"], numKills = LOCALS["NumKills"], longestStreak = LOCALS["MaxStreak"], leaderboard_yourRank = 1, --@TODO: We don't have leaderboards, replace this when we do! leaderboard_topScore = 100, --@TODO: We don't have leaderboards, replace this when we do! leaderboard_yourTopScore= 100, --@TODO: We don't have leaderboards, replace this when we do! rewardMoney = msgReward.rewardMoney, rewardItem1Name = msgReward.rewardItem1Name, rewardItem1Image = msgReward.rewardItem1Image, rewardItem1StackSize = msgReward.rewardItem1StackSize, rewardItem2Name = msgReward.rewardItem2Name, rewardItem2Image = msgReward.rewardItem2Image, rewardItem2StackSize = msgReward.rewardItem2StackSize, callbackObj = GAMEOBJ:GetZoneControlID()} if (cannon) then cannon:RequestActivitySummaryLeaderboardData{ user = player } end end end -------------------------------------------------------------- -- set the cannon's reticule size and skill based on wave -------------------------------------------------------------- function setCannonReticuleSize(self, waveNum) -- Disabled 6-11-08 : vtran ---- get the cannon --local cannon = getObjectByName("cannonObject") -- --if (cannon) then -- --cannon:SetActiveProjectileSkill{ skillID = CONSTANTS["CANNON_IMPACT_SKILL"][tonumber(waveNum)] } --cannon:SetVar("ImpactSkillID",CONSTANTS["CANNON_IMPACT_SKILL"][tonumber(waveNum)]) --cannon:SetShootingGalleryReticuleEffect{ type = CONSTANTS["CANNON_RETICULE_EFFECT"][tonumber(waveNum)] } -- --end -- end -------------------------------------------------------------- -- Add more time to the current wave timer -------------------------------------------------------------- function AddTimeToWave(self, timeToAdd) -- get wave number local waveNum = LOCALS["ThisWave"] -- check on next wave waveNum = waveNum + 1 -- get correct timer name local timerName = "GameOver" if (waveNum <= CONSTANTS["NUM_WAVES"]) then timerName = "SpawnWave" .. waveNum end -- get the time left local theTime = GAMEOBJ:GetTimer():GetTime(timerName,self ) if (theTime > 0.0) then -- cancel timer and add a new one with more time GAMEOBJ:GetTimer():CancelTimer(timerName, self) theTime = theTime + timeToAdd if theTime < 1 then theTime = 1 end GAMEOBJ:GetTimer():AddTimerWithCancel( theTime, timerName, self ) -- get the cannon local cannon = getObjectByName("cannonObject") cannon:AddActivityTime{ rerouteID = getObjectByName("activityPlayer"), timeToAdd = timeToAdd } end end function RecordPlayerWaveScore(self) -- get wave number local waveNum = tonumber(LOCALS["ThisWave"]) -- get the cannon local cannon = getObjectByName("cannonObject") if (waveNum) and (waveNum > 0) and (cannon) then -- get total current score local score = tonumber(cannon:GetActivityPoints().points) -- to get the wave score we must subtract prior waves from it for waves = 1, waveNum - 1 do score = score - PLAYER_SCORE[waves] end -- store the new score PLAYER_SCORE[waveNum] = score end end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- parse the name to get out the wave number -- use the wave number to select the spawns -- of format "SpawnWaveXXX" where XXX is the spawn number if (string.starts(msg.name,"SpawnWave")) then if (LOCALS["GameStarted"] == true) then -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- store this wave number waveNum = LOCALS["ThisWave"] print("Spawning Wave " .. waveNum) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self,true) end -- move to the next wave --waveNum = waveNum + 1 -- there are no more waves left -- so stop game after this wave if (tonumber(waveNum) >= CONSTANTS["NUM_WAVES"]) then print("****************************** asdfaaaaaaaa") -- setup next wave if waves[tonumber(waveNum)].timeLimit < 1 then myTimer = 1 else myTimer = waves[tonumber(waveNum)].timeLimit end GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "GameOver", self ) else local myTimer = waves[tonumber(waveNum)].timeLimit -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( myTimer, "EndWave" .. waveNum,self ) end local cannon = getObjectByName("cannonObject") local player = getObjectByName("activityPlayer") if cannon and player then cannon:StartActivityTime{ rerouteID = player, startTime = waves[tonumber(waveNum)].timeLimit } cannon:ActivityPause{ rerouteID = player, bPause = false } end end end -- called when a wave ends, contains the number of the next wave if (string.starts(msg.name,"EndWave")) then if (LOCALS["GameStarted"] == true) then -- get rid of current spawns DestroyAllSpawns(self) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- record the score RecordPlayerWaveScore(self) -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,8) -- store the next wave number waveNum = tonumber(waveNum) + 1 LOCALS["ThisWave"] = waveNum -- @TODO: Do whatever we need to during the pause, wave begins after pause -- play wave animation on actors, cannon, and player PlaySceneAnimation("wave" .. LOCALS["ThisWave"], true, true) -- display wave number to player DisplayWaveNumberToPlayer(self, waveNum) -- there are no more waves left -- so stop game after this wave if (waveNum > CONSTANTS["NUM_WAVES"]) then -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "GameOver", self ) else -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["IN_BETWEEN_WAVE_PAUSE"], "SpawnWave" .. waveNum,self ) end local player = getObjectByName("activityPlayer") local cannon = getObjectByName("cannonObject") if player and cannon then cannon:ActivityPause{rerouteID = player, bPause = true} end end end -- parse the name to get out the spawn number -- use the spawn number to select the template id -- load the object -- of format "DoSpawnXXX" where XXX is the spawn number if (string.starts(msg.name,"DoSpawn")) then if (LOCALS["GameStarted"] == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] local templateID = SpawnData.sdTemplate print("spawning " .. spawnNum) -- get the position of the first waypoint local startPos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = startPos.x, y = startPos.y, z = startPos.z, owner = self } end end -- end the game if (msg.name == "GameOver") then RecordPlayerWaveScore(self) stopGame(self, false) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- look through spawn data to find the most recent data -- that matches the template local SpawnData = GetLatestSpawnDataByTemplate(self,msg.templateID) if (SpawnData) then local curSpawnNum = IncrementVarAndReturn("CurSpawnNum") -- store spawn for use later storeObjectByName("spawnObject" .. curSpawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child (@TODO: Need to Optimize) msg.childID:SetVar("SpawnData", SpawnData) if (SpawnData.sdMovingPlat == true) then msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } msg.childID:SetMovingPlatformParams{ wsPlatformPath = SpawnData.sdPath, iStartIndex = 0 } else -- assign child's waypoint msg.childID:SetVar("attached_path",SpawnData.sdPath) msg.childID:SetVar("attached_path_start",0) -- start child on path msg.childID:FollowWaypoints() msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } end else -- error print("Error: Spawned object " .. msg.templateID .. " but saved data not found for it!") end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) -- stun and move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not.....ghosting distance? local player = msg.playerID player:ServerSetUserCtrlCompPause{bPaused = true} player:CancelMission{ missionID = 30 } -- player:Teleport{pos = CONSTANTS["PLAYER_START_POS"], -- x = CONSTANTS["PLAYER_START_ROT"].x, -- y = CONSTANTS["PLAYER_START_ROT"].y, -- z = CONSTANTS["PLAYER_START_ROT"].z, -- w = CONSTANTS["PLAYER_START_ROT"].w, -- bSetRotation = true} if (LOCALS["GameStarted"] == false) then -- get the player local player = getObjectByName("activityPlayer") -- store the player for later use if (player == nil) then storeObjectByName("activityPlayer", msg.playerID) end -- put the player in the cannon enterCannon(self) end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Cannon Object Loaded if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then -- Override the cannon shooting parameters msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"], cameraFOV = CONSTANTS["CANNON_FOV"], bUseLeaderboards = CONSTANTS["CANNON_USE_LEADERBOARDS"]} -- store the cannon object for use later storeObjectByName("cannonObject", msg.objectID) if (LOCALS["GameStarted"] == false) then -- try to put hte player in the cannon enterCannon(self) end -- check for actors elseif ( IsValidActor(msg.templateID) == true ) then -- store the actor local nextActor = #ACTORS + 1 ACTORS[nextActor] = msg.objectID:GetID() -- check for effects elseif ( IsValidEffect(msg.templateID) == true ) then -- store the actor local nextEffect = #EFFECTS + 1 EFFECTS[nextEffect] = msg.objectID:GetID() end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- save the score and time for later use LOCALS["GameScore"] = msg.fValue1 LOCALS["GameTime"] = msg.fValue2 LOCALS["NumShots"] = msg.fValue3 -- shots fired LOCALS["NumKills"] = msg.fValue4 -- targets hit LOCALS["MaxStreak"] = msg.fValue5 -- max streak -- also return the score as the result for the activity msg.outActivityRating = msg.fValue1 return msg end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this is the right player local player = getObjectByName("activityPlayer") if (player:GetID() == msg.sender:GetID()) then if msg.identifier == "Shooting_Gallery_Summary" then strText = "Retry?" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Retry"} else -- User wants to retry or is closing the big help to start the game if ((msg.iButton == 1 and msg.identifier == "Shooting_Gallery_Retry") or (msg.identifier == "SG1")) then startGame(self) -- User wants to quit elseif (msg.iButton == 0 and msg.identifier == "Shooting_Gallery_Retry") then -- called before we leave the cannon, so we can trigger a loading screen -- as soon as possible. Should still remove player from cannon on server RemovePlayerFromZone(self, player) -- get the cannon and exit local cannon = getObjectByName("cannonObject") if (cannon) then cannon:RequestActivityExit{userID = player, bUserCancel = false} end end end end end -------------------------------------------------------------- -- Sent from the spawn objects on death -------------------------------------------------------------- function onUpdateMissionTask(self, msg) -- get this wave number local waveNum = tonumber(LOCALS["ThisWave"]) if (LOCALS["GameStarted"] == true) and (waveNum) and (waveNum > 0) then -- get the spawn data (@TODO: Need to Optimize) local spawnData = msg.target:GetVar("SpawnData") -- spawn the right object if (spawnData) and (spawnData.sdRespawn == true) then SpawnObject(spawnData.sdnum,spawns[waveNum][spawnData.sdnum],self,false) end -- check for time adding, disregard if death was SILENT if (spawnData.sdTimeScore > 0.0 and msg.taskType ~= "SILENT") then AddTimeToWave(self,spawnData.sdTimeScore) end end end -------------------------------------------------------------- -- User is exiting via cancel -------------------------------------------------------------- function onRequestActivityExit(self, msg) if (msg.bUserCancel == true) then stopGame(self,msg.bUserCancel) RemovePlayerFromZone(self, msg.userID) end end -------------------------------------------------------------- -- Cannon is firing -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- play fire animation on actors PlaySceneAnimation("fire", false, false) PlaySceneEffect("fire") end function onNotifyObject(self, msg) if msg.name == "Cannon_Timer" then storeObjectByName( "Cannon_Timer", msg.ObjIDSender ) end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') -- @TODO: Add Path Changing on waypoint, need to get [Closest Waypoint on New Path] -- Also need [Number of Waypoints on Path] -- @TODO: Optimize -------------------------------------------------------------- -- Locals and Constants LOCALS = {} CONSTANTS = {} -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS["PLAYER_START_POS"] = {x = -908.542480, y = 229.773178, z = -7.577438} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -1.188} CONSTANTS["CANNON_VELOCITY"] = 160.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} CONSTANTS["CANNON_TIMEOUT"] = -1 CONSTANTS["CANNON_FOV"] = 58.6 CONSTANTS["CANNON_USE_LEADERBOARDS"] = true -- for Animations CONSTANTS["VALID_ACTORS"] = {3109, 3110, 3111, 3112, 3125, 3126} ACTORS = {} -- stores actors for the instance -- for Effects CONSTANTS["VALID_EFFECTS"] = {3122} EFFECTS = {} -- stores effects for the instance -- cannon impact skills --CONSTANTS["CANNON_IMPACT_SKILL"] = {34, 34, 61, 62} --CONSTANTS["CANNON_RETICULE_EFFECT"] = {"inRange", "inRange", "inRange2", "inRange3"} -------------------------------------------------------------- -- Wave Data waves = {} PLAYER_SCORE = {} -------------------------------------------------------------- -- Syntax: [Time] [Text to Show Player] -------------------------------------------------------------- AddWave(waves, 30.0, "Wave;One" ) AddWave(waves, 30.0, "Wave;Two" ) AddWave(waves, 30.0, "Wave;Three" ) -- wave constants CONSTANTS["NUM_WAVES"] = #waves CONSTANTS["FIRST_WAVE_START_TIME"] = 4.0 CONSTANTS["IN_BETWEEN_WAVE_PAUSE"] = 7.0 -------------------------------------------------------------- -- Spawn Data spawns = {} SPAWN_DATA = {} -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- AddSpawn - configures data for the spawn and adds it. Can -- only have one. -- Syntax: AddSpawn(spawn, paths, [Template ID], -- [Initial Spawn Time Min], [Initial Spawn Time Max], [Does Respawn], -- [Respawn Time Min], [Respawn Time Max], -- [Initial Speed], [Score], [Change Speed at Waypoints], -- [Chance to Change Speed], [Min Speed], [Max Speed], -- [Is Moving Platform], [Despawn On Last Waypoint], [Time Score]) -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} -------------------------------------------------------------- -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_1-2") AddSpawn(spawn,paths, 2970, 0.0, 0.0, true, 0, 0, 2.0, 100, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ship -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddSpawn(spawn,paths, 2974, 0.0, 0.0, true, 0, 0, 2.0, 250, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Sub -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_1-2") AddSpawn(spawn,paths, 2972, 0.0, 0.0, true, 0, 0, 2.0, 500, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ness_1") AddPath(paths, "Wave_1_Ness_1-2") AddSpawn(spawn,paths, 2166, 0.0, 0.0, true, 0, 0, 2.0, 1000, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Pearl -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Pearl") AddSpawn(spawn,paths, 2976, 9.0, 29.0, false, 0, 0, 2.0, 0, false, 0.0, 1.0, 1.0, true, true, 5.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 2 Spawns spawn = {} -------------------------------------------------------------- -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_1-2") AddSpawn(spawn,paths, 2970, 0.0, 0.0, true, 0, 4.0, 1, 200, true, 0.50, 1.0, 2, false, false, 0.0) -- Duck Fast -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Duck_2") AddSpawn(spawn,paths, 2969, 0.0, 0.0, true, 0, 4.0, 2, 400, true, 0.50, 2, 3.5, false, false, 0.0) -- Ship -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_1") AddSpawn(spawn,paths, 2974, 0.0, 0.0, true, 0, 4.0, 1, 300, true, 0.50, 1.0, 2, false, false, 0.0) -- Ship Fast -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_2") AddSpawn(spawn,paths, 2973, 0.0, 0.0, true, 0, 4.0, 2, 750, true, 0.50, 2, 3.50, false, false, 0.0) -- Sub -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Sub_1") AddSpawn(spawn,paths, 2972, 0.0, 0.0, true, 0, 4.0, 1, 400, true, 0.50, 1.0, 2, false, false, 0.0) -- Sub Fast -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Sub_2") AddSpawn(spawn,paths, 2971, 0.0, 0.0, true, 0, 4.0, 2, 1250, true, 0.50, 2, 3.5, false, false, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ness_1") AddPath(paths, "Wave_3_Ness_1-2") AddSpawn(spawn,paths, 2565, 0.0, 0.0, true, 0, 4.0, 4, 5000, true, 0.50, 4, 6, true, true, 0.0) -- Pearl -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Pearl") AddSpawn(spawn,paths, 2976, 5.0, 55.0, false, 0, 0, 2.0, 0, false, 0.0, 1.0, 1.0, true, true, 5.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 3 Spawns spawn = {} -------------------------------------------------------------- -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Duck_1") AddSpawn(spawn,paths, 2970, 0.0, 0.0, true, 0, 4.0, 1.0, 200, true, 0.50, 1.0, 1.75, false, false, 0.0) -- Duck Fast -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Duck_2") AddSpawn(spawn,paths, 2969, 0.0, 0.0, true, 0, 4.0, 1.75, 400, true, 0.50, 1.75, 2.50, false, false, 0.0) -- Ship -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_1") AddSpawn(spawn,paths, 2974, 0.0, 0.0, true, 0, 4.0, 1.0, 1000, true, 0.50, 1.0, 1.75, false, false, 0.0) -- Ship Fast -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_2") AddSpawn(spawn,paths, 2973, 0.0, 0.0, true, 0, 4.0, 1.75, 1500, true, 0.50, 1.75, 2.50, false, false, 0.0) -- Sub -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_4_Sub_1") AddPath(paths, "Wave_4_Sub_1-2") AddSpawn(spawn,paths, 2984, 0.0, 0.0, true, 0, 4.0, 1.0, 2500, true, 0.50, 1.0, 1.75, true, true, 0.0) -- Sub Fast -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_4_Sub_2") AddPath(paths, "Wave_4_Sub_2-2") AddSpawn(spawn,paths, 2983, 0.0, 0.0, true, 0, 4.0, 2, 5000, true, 0.50, 2, 3, true, true, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_4_Ness_1") AddPath(paths, "Wave_4_Ness_2") AddPath(paths, "Wave_4_Ness_3") AddPath(paths, "Wave_4_Ness_4") AddPath(paths, "Wave_4_Ness_5") AddPath(paths, "Wave_4_Ness_6") AddPath(paths, "Wave_4_Ness_7") AddPath(paths, "Wave_4_Ness_8") AddPath(paths, "Wave_4_Ness_9") AddSpawn(spawn,paths, 3118, 0.0, 0.0, true, 0, 0, 1.0, 10000, false, 0, 0, 0, true, true, 0.0) -- Pearl -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Pearl") AddSpawn(spawn,paths, 2976, 5.0, 55.0, false, 0, 0, 2.0, 0, false, 0.0, 1.0, 1.0, true, true, 5.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- play effects on all effects in the scene -------------------------------------------------------------- function PlaySceneEffect(effectName) -- trigger effects on effect objects for effectID = 1, #EFFECTS do local effect = GAMEOBJ:GetObjectByID(EFFECTS[effectID]) effect:PlayFXEffect{ effectType = effectName } end end -------------------------------------------------------------- -- play animations on all actors in the scene, and others -------------------------------------------------------------- function PlaySceneAnimation(anim, bPlayCannon, bPlayPlayer) -- play animation on actors for actorID = 1, #ACTORS do local actor = GAMEOBJ:GetObjectByID(ACTORS[actorID]) actor:PlayAnimation{ animationID = anim } end -- play on cannon if (bPlayCannon == true) then local cannon = getObjectByName("cannonObject") cannon:PlayAnimation{ animationID = anim } end -- play on player if (bPlayPlayer == true) then local player = getObjectByName("activityPlayer") player:PlayAnimation{ animationID = anim } end end -------------------------------------------------------------- -- return if template is a valid actor -------------------------------------------------------------- function IsValidActor(templateID) for actors = 1, #CONSTANTS["VALID_ACTORS"] do if (templateID == CONSTANTS["VALID_ACTORS"][actors]) then return true end end return false end -------------------------------------------------------------- -- return if template is a valid effect -------------------------------------------------------------- function IsValidEffect(templateID) for effects = 1, #CONSTANTS["VALID_EFFECTS"] do if (templateID == CONSTANTS["VALID_EFFECTS"][effects]) then return true end end return false end -------------------------------------------------------------- -- put the player in the cannon, does not start the cannon -------------------------------------------------------------- function enterCannon(self) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both start it if ((cannon) and (player)) then cannon:RequestActivityEnter{bStart = false, userID = player} end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both start it if ((cannon) and (player)) then -- put the player in if we have to, otherwise start if ((cannon:GetActivityUser().userID):GetID() ~= player:GetID()) then print("wrong player") cannon:RequestActivityEnter{bStart = true, userID = player} else print("starting game") cannon:ActivityStart{ rerouteID = player } end DoGameStartup(self) end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bCanceling) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both stop it if we need to, but dont exit if ((cannon) and (player)) then print("stopping game") cannon:ActivityStop{rerouteID = player, bExit = false, bUserCanceled = bCanceling} DoGameShutdown(self) -- if we are not exiting, shwo the summary and allow for retry if (bCanceling == false) then showSummaryDialog(self) end end end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 LOCALS["GameStarted"] = true LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 -- reset scores for waveNum = 1, tonumber(CONSTANTS["NUM_WAVES"]) do PLAYER_SCORE[waveNum] = 0 end -- start the first wave LOCALS["ThisWave"] = 1 GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FIRST_WAVE_START_TIME"], "SpawnWave1",self ) -- Scene animations and wave number DISABLED for start, we use 3/2/1/Go instead -- play wave animation on actors, cannon, and player --PlaySceneAnimation("wave" .. LOCALS["ThisWave"], true, true) -- display wave number to player --DisplayWaveNumberToPlayer(self, LOCALS["ThisWave"]) -- set the cannon reticule back to start setCannonReticuleSize(self, 1) end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) print("game shutdown") LOCALS["GameStarted"] = false -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- Remove the player from the zone -------------------------------------------------------------- function RemovePlayerFromZone(self, player) player:ServerSetUserCtrlCompPause{bPaused = false} -- UNCOMMENT to go back to the other zone player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end -------------------------------------------------------------- -- Get a random path -------------------------------------------------------------- function GetRandomPath(spawn) -- pick a random local ran = math.random(1,#spawn.path) return spawn.path[ran] end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self, bSpawnNow) -- get the current spawn number local spawnNum = IncrementVarAndReturn("SpawnNum") -- save the spawn data for the object when it is loaded local SpawnData = {sdTemplate = spawn.id, sdRespawn = spawn.bRespawn, sdSpeed = spawn.speed, sdScore = spawn.score, sdPath = GetRandomPath(spawn), sdnum = num, sdChangeSpeed = spawn.bChangeSpeed, sdSpeedChance = spawn.speedChangeChance, sdMinSpeed = spawn.minSpeed, sdMaxSpeed = spawn.maxSpeed, sdMovingPlat = spawn.bMovingPlatform, sdDespawnTime = spawn.despawnTime, sdTimeScore = spawn.timeScore, bSpawned = false} -- store the data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum -- spawn now and use initial spawn times if (bSpawnNow == true) then if (spawn.initSpawnTimeMin > 0 and spawn.initSpawnTimeMax > 0) then local ranSpawnTime = (math.random() * (spawn.initSpawnTimeMax - spawn.initSpawnTimeMin)) + spawn.initSpawnTimeMin print ("init spawning with time " .. ranSpawnTime) GAMEOBJ:GetTimer():AddTimerWithCancel( ranSpawnTime, timerName, self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, timerName, self ) end -- respawn, use respawn times elseif (spawn.bRespawn == true) then -- pick a random spawn time local ranSpawnTime = (math.random() * (spawn.maxTime - spawn.minTime)) + spawn.minTime GAMEOBJ:GetTimer():AddTimerWithCancel( ranSpawnTime, timerName, self ) end end -------------------------------------------------------------- -- destroys all spawns -------------------------------------------------------------- function DestroyAllSpawns(self) local maxSpawnNum = LOCALS["CurSpawnNum"] for spawn = 1, maxSpawnNum do -- @TODO: (Optimize this) local spawnObject = getObjectByName("spawnObject" .. spawn) if (spawnObject) then if (spawnObject:Exists() and not spawnObject:IsDead().bDead) then print("removing spawn object " .. spawn) spawnObject:Die{killerID = spawnObject, killType = "SILENT"} end end end -- reset vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 end -------------------------------------------------------------- -- sends a message to display the current wave text to player -------------------------------------------------------------- function DisplayWaveNumberToPlayer(self, waveNum) -- @TODO: (Optimize) local player = getObjectByName("activityPlayer") if (player) then UI:SendMessage("ToggleFlashingText", { {"visible", true }, {"text", waves[tonumber(waveNum)].waveStr}}) end end -------------------------------------------------------------- -- look through spawn data to find the most recent data -- that matches the template, returns nil or data -------------------------------------------------------------- function GetLatestSpawnDataByTemplate(self,templateID) local spawnNum = LOCALS["SpawnNum"] while (spawnNum > 0) do -- get the data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] -- check spawn flag and template if (SpawnData.bSpawned == false and templateID == SpawnData.sdTemplate) then -- set spawned flag SpawnData.bSpawned = true -- re-save data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- return the good data return SpawnData end -- try prev spawn data spawnNum = spawnNum - 1 end return nil end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self) -- get player local player = getObjectByName("activityPlayer") if (player) then -- do summary dialog -- Wave Score local score = LOCALS["GameScore"] --local strText = "Score:\n\n" --for wavenum = 1, tonumber(CONSTANTS["NUM_WAVES"]) do -- strText = strText .. "Wave " .. wavenum .. " = " .. PLAYER_SCORE[tonumber(wavenum)] .. "\n" --end -- Total Score --strText = strText .. "\nTotal: " .. score .. "\n" -- Accuracy --strText = strText .. "\nAccuracy: " .. LOCALS["NumKills"] .. "/" .. LOCALS["NumShots"] .. "\n" -- Highest Streak --strText = strText .. "\Highest Streak: " .. LOCALS["MaxStreak"] .. "\n" local cannon = getObjectByName("cannonObject") local msgReward = cannon:GetActivityReward{ playerID = player } print("rewardMoney = " .. tostring(msgReward.rewardMoney)) player:ShowActivitySummary{ totalScore = score, waveScore1 = PLAYER_SCORE[1], waveScore2 = PLAYER_SCORE[2], waveScore3 = PLAYER_SCORE[3], waveScore4 = PLAYER_SCORE[4], numShots = LOCALS["NumShots"], numKills = LOCALS["NumKills"], longestStreak = LOCALS["MaxStreak"], leaderboard_yourRank = 1, --@TODO: We don't have leaderboards, replace this when we do! leaderboard_topScore = 100, --@TODO: We don't have leaderboards, replace this when we do! leaderboard_yourTopScore= 100, --@TODO: We don't have leaderboards, replace this when we do! rewardMoney = msgReward.rewardMoney, rewardItem1Name = msgReward.rewardItem1Name, rewardItem1Image = msgReward.rewardItem1Image, rewardItem1StackSize = msgReward.rewardItem1StackSize, rewardItem2Name = msgReward.rewardItem2Name, rewardItem2Image = msgReward.rewardItem2Image, rewardItem2StackSize = msgReward.rewardItem2StackSize, callbackObj = GAMEOBJ:GetZoneControlID()} if (cannon) then cannon:RequestActivitySummaryLeaderboardData{ user = player } end end end -------------------------------------------------------------- -- set the cannon's reticule size and skill based on wave -------------------------------------------------------------- function setCannonReticuleSize(self, waveNum) -- Disabled 6-11-08 : vtran ---- get the cannon --local cannon = getObjectByName("cannonObject") -- --if (cannon) then -- --cannon:SetActiveProjectileSkill{ skillID = CONSTANTS["CANNON_IMPACT_SKILL"][tonumber(waveNum)] } --cannon:SetVar("ImpactSkillID",CONSTANTS["CANNON_IMPACT_SKILL"][tonumber(waveNum)]) --cannon:SetShootingGalleryReticuleEffect{ type = CONSTANTS["CANNON_RETICULE_EFFECT"][tonumber(waveNum)] } -- --end -- end -------------------------------------------------------------- -- Add more time to the current wave timer -------------------------------------------------------------- function AddTimeToWave(self, timeToAdd) -- get wave number local waveNum = LOCALS["ThisWave"] -- check on next wave waveNum = waveNum + 1 -- get correct timer name local timerName = "GameOver" if (waveNum <= CONSTANTS["NUM_WAVES"]) then timerName = "SpawnWave" .. waveNum end -- get the time left local theTime = GAMEOBJ:GetTimer():GetTime(timerName,self ) if (theTime > 0.0) then -- cancel timer and add a new one with more time GAMEOBJ:GetTimer():CancelTimer(timerName, self) theTime = theTime + timeToAdd GAMEOBJ:GetTimer():AddTimerWithCancel( theTime, timerName, self ) -- get the cannon local cannon = getObjectByName("cannonObject") cannon:AddActivityTime{ rerouteID = getObjectByName("activityPlayer"), timeToAdd = timeToAdd } end end function RecordPlayerWaveScore(self) -- get wave number local waveNum = tonumber(LOCALS["ThisWave"]) -- get the cannon local cannon = getObjectByName("cannonObject") if (waveNum) and (waveNum > 0) and (cannon) then -- get total current score local score = tonumber(cannon:GetActivityPoints().points) -- to get the wave score we must subtract prior waves from it for waves = 1, waveNum - 1 do score = score - PLAYER_SCORE[waves] end -- store the new score PLAYER_SCORE[waveNum] = score end end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- parse the name to get out the wave number -- use the wave number to select the spawns -- of format "SpawnWaveXXX" where XXX is the spawn number if (string.starts(msg.name,"SpawnWave")) then if (LOCALS["GameStarted"] == true) then -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- store this wave number waveNum = LOCALS["ThisWave"] print("Spawning Wave " .. waveNum) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self,true) end -- move to the next wave --waveNum = waveNum + 1 -- there are no more waves left -- so stop game after this wave if (tonumber(waveNum) >= CONSTANTS["NUM_WAVES"]) then -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( waves[tonumber(waveNum)].timeLimit, "GameOver", self ) else -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( waves[tonumber(waveNum)].timeLimit, "EndWave" .. waveNum,self ) end local cannon = getObjectByName("cannonObject") local player = getObjectByName("activityPlayer") if cannon and player then cannon:StartActivityTime{ rerouteID = player, startTime = waves[tonumber(waveNum)].timeLimit } cannon:ActivityPause{ rerouteID = player, bPause = false } end end end -- called when a wave ends, contains the number of the next wave if (string.starts(msg.name,"EndWave")) then if (LOCALS["GameStarted"] == true) then -- get rid of current spawns DestroyAllSpawns(self) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- record the score RecordPlayerWaveScore(self) -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,8) -- store the next wave number waveNum = tonumber(waveNum) + 1 LOCALS["ThisWave"] = waveNum -- @TODO: Do whatever we need to during the pause, wave begins after pause -- play wave animation on actors, cannon, and player PlaySceneAnimation("wave" .. LOCALS["ThisWave"], true, true) -- display wave number to player DisplayWaveNumberToPlayer(self, waveNum) -- there are no more waves left -- so stop game after this wave if (waveNum > CONSTANTS["NUM_WAVES"]) then -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "GameOver", self ) else -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["IN_BETWEEN_WAVE_PAUSE"], "SpawnWave" .. waveNum,self ) end local player = getObjectByName("activityPlayer") local cannon = getObjectByName("cannonObject") if player and cannon then cannon:ActivityPause{rerouteID = player, bPause = true} end end end -- parse the name to get out the spawn number -- use the spawn number to select the template id -- load the object -- of format "DoSpawnXXX" where XXX is the spawn number if (string.starts(msg.name,"DoSpawn")) then if (LOCALS["GameStarted"] == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] local templateID = SpawnData.sdTemplate print("spawning " .. spawnNum) -- get the position of the first waypoint local startPos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = startPos.x, y = startPos.y, z = startPos.z, owner = self } end end -- end the game if (msg.name == "GameOver") then RecordPlayerWaveScore(self) stopGame(self, false) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- look through spawn data to find the most recent data -- that matches the template local SpawnData = GetLatestSpawnDataByTemplate(self,msg.templateID) if (SpawnData) then local curSpawnNum = IncrementVarAndReturn("CurSpawnNum") -- store spawn for use later storeObjectByName("spawnObject" .. curSpawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child (@TODO: Need to Optimize) msg.childID:SetVar("SpawnData", SpawnData) if (SpawnData.sdMovingPlat == true) then msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } msg.childID:SetMovingPlatformParams{ wsPlatformPath = SpawnData.sdPath, iStartIndex = 0 } else -- assign child's waypoint msg.childID:SetVar("attached_path",SpawnData.sdPath) msg.childID:SetVar("attached_path_start",0) -- start child on path msg.childID:FollowWaypoints() msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } end else -- error print("Error: Spawned object " .. msg.templateID .. " but saved data not found for it!") end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) -- stun and move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not.....ghosting distance? local player = msg.playerID --player:ServerSetUserCtrlCompPause{bPaused = true} player:CancelMission{ missionID = 30 } -- player:Teleport{pos = CONSTANTS["PLAYER_START_POS"], -- x = CONSTANTS["PLAYER_START_ROT"].x, -- y = CONSTANTS["PLAYER_START_ROT"].y, -- z = CONSTANTS["PLAYER_START_ROT"].z, -- w = CONSTANTS["PLAYER_START_ROT"].w, -- bSetRotation = true} if (LOCALS["GameStarted"] == false) then -- get the player local player = getObjectByName("activityPlayer") -- store the player for later use if (player == nil) then storeObjectByName("activityPlayer", msg.playerID) end -- put the player in the cannon enterCannon(self) end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Cannon Object Loaded if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then -- Override the cannon shooting parameters msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"], cameraFOV = CONSTANTS["CANNON_FOV"], bUseLeaderboards = CONSTANTS["CANNON_USE_LEADERBOARDS"]} -- store the cannon object for use later storeObjectByName("cannonObject", msg.objectID) if (LOCALS["GameStarted"] == false) then -- try to put hte player in the cannon enterCannon(self) end -- check for actors elseif ( IsValidActor(msg.templateID) == true ) then -- store the actor local nextActor = #ACTORS + 1 ACTORS[nextActor] = msg.objectID:GetID() -- check for effects elseif ( IsValidEffect(msg.templateID) == true ) then -- store the actor local nextEffect = #EFFECTS + 1 EFFECTS[nextEffect] = msg.objectID:GetID() end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- save the score and time for later use LOCALS["GameScore"] = msg.fValue1 LOCALS["GameTime"] = msg.fValue2 LOCALS["NumShots"] = msg.fValue3 -- shots fired LOCALS["NumKills"] = msg.fValue4 -- targets hit LOCALS["MaxStreak"] = msg.fValue5 -- max streak -- also return the score as the result for the activity msg.outActivityRating = msg.fValue1 return msg end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this is the right player local player = getObjectByName("activityPlayer") if (player:GetID() == msg.sender:GetID()) then if msg.identifier == "Shooting_Gallery_Summary" then strText = "Retry?" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Retry"} else -- User wants to retry or is closing the big help to start the game if ((msg.iButton == 1 and msg.identifier == "Shooting_Gallery_Retry") or (msg.identifier == "SG1")) then startGame(self) -- User wants to quit elseif (msg.iButton == 0 and msg.identifier == "Shooting_Gallery_Retry") then -- called before we leave the cannon, so we can trigger a loading screen -- as soon as possible. Should still remove player from cannon on server RemovePlayerFromZone(self, player) -- get the cannon and exit local cannon = getObjectByName("cannonObject") if (cannon) then cannon:RequestActivityExit{userID = player, bUserCancel = false} end end end end end -------------------------------------------------------------- -- Sent from the spawn objects on death -------------------------------------------------------------- function onUpdateMissionTask(self, msg) -- get this wave number local waveNum = tonumber(LOCALS["ThisWave"]) if (LOCALS["GameStarted"] == true) and (waveNum) and (waveNum > 0) then -- get the spawn data (@TODO: Need to Optimize) local spawnData = msg.target:GetVar("SpawnData") -- spawn the right object if (spawnData) and (spawnData.sdRespawn == true) then SpawnObject(spawnData.sdnum,spawns[waveNum][spawnData.sdnum],self,false) end -- check for time adding, disregard if death was SILENT if (spawnData.sdTimeScore > 0.0 and msg.taskType ~= "SILENT") then AddTimeToWave(self,spawnData.sdTimeScore) end end end -------------------------------------------------------------- -- User is exiting via cancel -------------------------------------------------------------- function onRequestActivityExit(self, msg) if (msg.bUserCancel == true) then stopGame(self,msg.bUserCancel) RemovePlayerFromZone(self, msg.userID) end end -------------------------------------------------------------- -- Cannon is firing -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- play fire animation on actors PlaySceneAnimation("fire", false, false) PlaySceneEffect("fire") end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') -- @TODO: deal with players logging out in middle of race -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_ZONEIN_POS"] = {x = 122.854, y = 278.0, z = -343.110} CONSTANTS["PLAYER_ZONEIN_ROT"] = {w = 0.722735, x = 0, y = 0.691124, z = 0} --CONSTANTS["PLAYER_ZONEIN_POS"] = {x = -688.0, y = 201.0, z = -147.0} --CONSTANTS["PLAYER_ZONEIN_ROT"] = {w = 0.722735, x = 0, y = 0.691124, z = 0} -- --CONSTANTS["PLAYER_START_POS1"] = {x = -604.0, y = 186.0, z = -154.0} --CONSTANTS["PLAYER_START_ROT1"] = {w = 0.287, x = 0, y = 0.957, z = 0} -- --CONSTANTS["PLAYER_START_POS2"] = {x = -601.0, y = 186.0, z = -150.0} --CONSTANTS["PLAYER_START_ROT2"] = {w = 0.287, x = 0, y = 0.957, z = 0} -- CONSTANTS["PLAYER_START_POS1"] = { x = -258.739, y = 210.0, z = -457.921 } CONSTANTS["PLAYER_START_POS2"] = { x = -254.554, y = 210.0, z = -462.901 } CONSTANTS["PLAYER_START_POS3"] = { x = -250.512, y = 210.0, z = -467.708 } CONSTANTS["PLAYER_START_POS4"] = { x = -245.919, y = 210.0, z = -473.172 } CONSTANTS["PLAYER_START_POS5"] = { x = -241.867, y = 210.0, z = -477.991 } CONSTANTS["PLAYER_START_POS6"] = { x = -237.412, y = 210.0, z = -483.290 } CONSTANTS["PLAYER_START_POS7"] = { x = -233.087, y = 210.0, z = -488.434 } CONSTANTS["PLAYER_START_POS8"] = { x = -228.770, y = 210.0, z = -493.569 } CONSTANTS["PLAYER_START_POS9"] = { x = -224.724, y = 210.0, z = -498.382 } CONSTANTS["PLAYER_START_POS10"]= { x = -220.404, y = 210.0, z = -503.520 } CONSTANTS["PLAYER_START_ROT"] = {w = -0.45988774, x = 0, y = 0.88797706, z = 0} CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -5.716} --@todo port back CONSTANTS["CANNON_VELOCITY"] = 160.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 1000.0 CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} CONSTANTS["CANNON_TIMEOUT"] = -1 CONSTANTS["CANNON_IMPACT_SKILL"] = 73 CONSTANTS["GOAL_LINE_LOT"] = 2717 CONSTANTS["CHECKPOINT_LOT"] = 2718 CONSTANTS["BOARD_LOT"] = 2250 CONSTANTS["RACE_MISSION_ID"] = 31 CONSTANTS["CANNON_MISSION_ID"] = 57 CONSTANTS["TURN_SPEED_MULT"] = 0.4 -- turn speed multiplier for track CONSTANTS["MAX_PLAYERS"] = 10 -- number of players max CONSTANTS["MIN_PLAYERS"] = 1 -- number of players min CONSTANTS["MAX_LAPS"] = 3 -- number of laps for race CONSTANTS["NUM_CHECKPOINTS"] = 0 -- this should Auto Update CONSTANTS["NUM_CANNONS"] = 0 -- this should Auto Update CONSTANTS["COUNTDOWN_TIME"] = 3.0 CONSTANTS["RACE_TIMEOUT"] = 20.0 --60.0 -- time until race auto quits with less then min players CONSTANTS["RACE_START_TIME"] = 25.0--30.0 --30.0 -- time until race starts after min player reached CONSTANTS["RACE_FINISH_TIME"] = 40.0 --60.0 -- time until race finishes BOARDS = {2851, 2852, 2853, 2854} CONSTANTS["NUM_BOARDS"] = #BOARDS PLAYERS = {} CHECKPOINTS = {} CANNONS = {} -- stores player in cannon and the cannon itself PLAYERS_TO_REMOVE = {} -- stores players that need to be removed from the cannon -- local vars LOCALS = {} LOCALS["bWaitingForPlayers"] = false -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- Pads a number with zeros on the left, to fill a field of the specified -- length. -------------------------------------------------------------- function ZeroPad(number, length) return string.rep("0", length - #tostring(number)) .. tostring(number) end -------------------------------------------------------------- -- parses time to a string -------------------------------------------------------------- function ParseTime(numTime) local newTime = tonumber(numTime) local min = math.floor(newTime / 1000 / 60) newTime = newTime - (min * 1000 * 60) local sec = math.floor(newTime / 1000) newTime = newTime - (sec * 1000) local msec = math.floor(newTime) local strTime = "" if (min > 0) then strTime = ZeroPad(min,2) .. ":" .. ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) else strTime = ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) end return strTime end -------------------------------------------------------------- -- checks to see if the checkPoint ID is valid, -- returns > 0 if valid -------------------------------------------------------------- function IsValidCheckpoint(self, checkPoint) for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do if (checkPoint == CHECKPOINTS[chkp]) then return chkp end end return 0 end -------------------------------------------------------------- -- checks to see if the cannon ID is valid and empty, -- returns cannonid if valid, 0 otherwise -------------------------------------------------------------- function GetValidCannon(self) for chkp = 1, CONSTANTS["NUM_CANNONS"] do if (CANNONS[chkp]["Player"] == 0) then return CANNONS[chkp]["Cannon"] end end return 0 end -------------------------------------------------------------- -- returns true if game is going -------------------------------------------------------------- function IsGameStarted(self) return (LOCALS["GameStarted"] == true) end -------------------------------------------------------------- -- returns player num -- returns > 0 if valid -------------------------------------------------------------- function GetPlayerNum(self, player) for pnum = 1, #PLAYERS do if (player:GetID() == PLAYERS[pnum]) then return pnum end end return 0 end -------------------------------------------------------------- -- checks to see if a player has hit all checkpoints -------------------------------------------------------------- function HasPlayerHitAllCheckpoints(self, player) local playerData = self:GetVar(player:GetID()) if (playerData) then for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do if (playerData["chkpStatus" .. chkp] == false) then return false end end else return false end -- all checkpoints good, no failures return true end -------------------------------------------------------------- -- sends a message to display checkpoint info to the player -------------------------------------------------------------- function DisplayCheckpointTimeToPlayer(self, player) if ( (player) and (IsGameStarted(self)) ) then -- get player data local playerData = self:GetVar(player:GetID()) if (playerData) then -- get current time local theTime = GAMEOBJ:GetSystemTime() local strTime = tonumber(theTime) - tonumber(playerData["curLapTime"]) end end end -------------------------------------------------------------- -- sets the place data member for a player -------------------------------------------------------------- function SetPlayerPlace(self, player, place) if (player) then local playerData = self:GetVar(player:GetID()) if (playerData) then playerData["place"] = place self:SetVar(player:GetID(), playerData) end end end -------------------------------------------------------------- -- flags a lap for a player and displays any information -------------------------------------------------------------- function FlagLap(self, player) -- try to get player data local playerData = self:GetVar(player:GetID()) -- has the player hit all the checkpoints? if ( (IsGameStarted(self)) and (playerData) and ( HasPlayerHitAllCheckpoints(self,player) == true ) ) then print("Goal Hit!") local theTime = GAMEOBJ:GetSystemTime() local strTime = tonumber(theTime) - tonumber(playerData["curLapTime"]) -- set this player's lap time playerData["lapTime" .. playerData["curLap"]] = strTime -- reset current lapTime playerData["curLapTime"] = theTime -- move the player to the next lap playerData["curLap"] = tonumber(playerData["curLap"]) + 1 -- reset checkpoint flags for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do playerData["chkpStatus" .. chkp] = false end -- store the data self:SetVar(player:GetID(), playerData) -- show player the lap number or end game if (tonumber(playerData["curLap"]) <= CONSTANTS["MAX_LAPS"]) then player:PlaySound{ strSoundName = "lap_complete" } else -- done with race (someone finished) local numFinishedPlayers = IncrementVarAndReturn("NumPlayersFinished") -- set to first place SetPlayerPlace(self, player, numFinishedPlayers) -- -- stun player because he is done with race -- player:SetStunned -- { -- StateChangeType = PUSH, -- bCantMove = true, -- bCantTurn = true, -- bCantAttack = true, -- bCantEquip = true, -- bCantInteract = true -- } -- -- stop the race when we are totally done if (numFinishedPlayers >= #PLAYERS) then StopGame(self) -- first player across the line starts the timeout timer elseif (numFinishedPlayers == 1) then DoFinishRaceTimer(self,player) end end end end -------------------------------------------------------------- -- being end race timer -------------------------------------------------------------- function DoFinishRaceTimer(self,winner) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) local winnerName = winner:GetName().name -- display tooltip to all players in race for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if ((winner:GetID() == PLAYERS[pnum])) then -- show tooltip to winner player:DisplayTooltip{ bShow = true, strText = "You Win!\n Waiting for other players." } player:PlayFXEffect{effectType = "fireworks"} elseif (player and playerData) then -- show tooltip to others player:DisplayTooltip{ bShow = true, strText = "Winner: " .. winnerName .. "\nRace ends in " .. CONSTANTS["RACE_FINISH_TIME"] .. " seconds.", iTime = 5000 } end end -- start timer for game start GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["RACE_FINISH_TIME"], "EndGame", self ) end -------------------------------------------------------------- -- flags a checkpoint for a player and displays any information -------------------------------------------------------------- function FlagCheckpoint(self, player, checkPoint) -- try to get player data and checkpoint data local playerData = self:GetVar(player:GetID()) local chkp = tonumber(IsValidCheckpoint(self,checkPoint)) -- are the vars valid? if ( (IsGameStarted(self)) and (playerData) and ( chkp > 0) and tonumber(playerData["curLap"]) <= CONSTANTS["MAX_LAPS"]) then print("Checkpoint " .. chkp .. " Hit!") -- show the checkpoint time to player if (playerData["chkpStatus" .. chkp] == false) then player:PlaySound{ strSoundName = "checkpoint" } DisplayCheckpointTimeToPlayer(self, player) end -- set this checkpoint to true for player playerData["chkpStatus" .. chkp] = true -- store the data self:SetVar(player:GetID(), playerData) end end -------------------------------------------------------------- -- get place string -------------------------------------------------------------- function GetPlaceString(place) if (tonumber(place) == 1) then return "1st" elseif (tonumber(place) == 2) then return "2nd" elseif (tonumber(place) == 3) then return "3rd" else return (place.."th") end end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self, player) if (player) then local playerData = self:GetVar(player:GetID()) -- close any tooltip player:DisplayTooltip{ bShow = false, strText = "..." } -- setup summary text local strText = "" strText = strText .. "Race Over!\n\n" -- show place local place = GetPlaceString(playerData["place"]) if (playerData["place"] == 0) then strText = strText .. "Not Finished!\n\n" else strText = strText .. "" .. place .. " Place!\n\n" end -- lap times local totalTime = 0 local bNotFinished = false for lap = 1, CONSTANTS["MAX_LAPS"] do -- if no lap time, exit early if (tonumber(playerData["lapTime" .. lap]) <= 0) then bNotFinished = true break else strText = strText .. "Lap " .. lap .. ": " .. ParseTime(playerData["lapTime" .. lap]) .. "\n" totalTime = totalTime + tonumber(playerData["lapTime" .. lap]) end end -- show total time if finished if (bNotFinished == false) then strText = strText .. "Total: " .. ParseTime(totalTime) .. "\n" end -- ask for retry strText = strText .. "\nRetry?" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Racing_Summary"} end end -------------------------------------------------------------- -- remove boards from a player -------------------------------------------------------------- function RemoveBoardsFromPlayer(self, player) if (player) then for board = 1, CONSTANTS["NUM_BOARDS"] do -- unequip and remove the item player:RemoveItemFromInventory{ iObjTemplate = BOARDS[board] } end end end -------------------------------------------------------------- -- adds a random board to the player -------------------------------------------------------------- function AddRandomBoardToPlayer(self, player) if (player) then -- remove all current boards RemoveBoardsFromPlayer(self, player) local board = math.random(1,CONSTANTS["NUM_BOARDS"]) -- add item local item = player:AddNewItemToInventory{ iObjTemplate = BOARDS[board] } -- equip item player:EquipInventory{ itemtoequip = item.newObjID } end end -------------------------------------------------------------- -- remove player from game -------------------------------------------------------------- function RemovePlayerFromGame(self, player) if (player) then local playerNum = GetPlayerNum(self, player) -- reset data PLAYERS[playerNum] = -1 local NoData = {} self:SetVar(player:GetID(), NoData) -- remove all boards RemoveBoardsFromPlayer(self, player) player:Teleport{pos = CONSTANTS["PLAYER_ZONEIN_POS"], bSetRotation = false} end end -------------------------------------------------------------- -- add new player for the race -------------------------------------------------------------- function AddNewPlayerToGame(self, player) if (player) then local playerNum = IncrementVarAndReturn("PlayerNum") ----------------------------------------------------- -- store player data local PlayerData = {} PlayerData["startTime"] = 0 PlayerData["curLapTime"] = 0 PlayerData["curLap"] = 1 PlayerData["place"] = 0 for lap = 1, CONSTANTS["MAX_LAPS"] do PlayerData["lapTime" .. lap] = -1 end for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do PlayerData["chkpStatus" .. chkp] = false end self:SetVar(player:GetID(), PlayerData) ----------------------------------------------------- -- store id in local array PLAYERS[playerNum] = player:GetID() -- put player in right spot player:Teleport{pos = CONSTANTS["PLAYER_START_POS" .. playerNum], x = CONSTANTS["PLAYER_START_ROT"].x, y = CONSTANTS["PLAYER_START_ROT"].y, z = CONSTANTS["PLAYER_START_ROT"].z, w = CONSTANTS["PLAYER_START_ROT"].w, bSetRotation = true} -- paused wait for game start player:ServerSetUserCtrlCompPause{bPaused = true} -- add board to player AddRandomBoardToPlayer(self, player) -- Try to start the game (next frame) local curplayers = LOCALS["PlayerNum"] if (tonumber(curplayers) == CONSTANTS["MAX_PLAYERS"]) then LOCALS["bWaitingForPlayers"] = false GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "StartGame", self ) else -- begin timer for game start if we have the min players if (tonumber(curplayers) == CONSTANTS["MIN_PLAYERS"]) then print("minplayers") BeginRaceStartJoinTimer(self) player:DisplayTooltip{ bShow = true, strText = "Waiting for players...", iTime = 0 } elseif (tonumber(curplayers) < CONSTANTS["MIN_PLAYERS"]) then -- start timeout timer if (LOCALS["bWaitingForPlayers"] == false) then GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["RACE_TIMEOUT"], "TimeOut", self ) LOCALS["bWaitingForPlayers"] = true end -- inform player about wait with tooltip player:DisplayTooltip{ bShow = true, strText = "Waiting for players...", iTime = 0 } end end end end -------------------------------------------------------------- -- being the race join timer -------------------------------------------------------------- function BeginRaceStartJoinTimer(self) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- display tooltip to all players in race for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if (player and playerData) then -- show tooltip player:DisplayTooltip{ bShow = true, strText = "Race begins in " .. CONSTANTS["RACE_START_TIME"] .. " seconds. \nWaiting for more players." } end end -- start timer for game start GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["RACE_START_TIME"], "StartGame", self ) end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function StartGame(self) print("Game Started") LOCALS["bWaitingForPlayers"] = false LOCALS["GameStarted"] = true -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if (player and playerData) then -- close any tooltip player:DisplayTooltip{ bShow = false, strText = "..." } -- trigger the Countdown on all clients player:ShowActivityCountdown { bPlayCountdownSound = false, bPlayAdditionalSound = true, sndName = "metallica - fuel", stateToPlaySoundOn = 1 } end end -- set a timer to Unpause and Go GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["COUNTDOWN_TIME"], "Go", self ) end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function StopGame(self) print("Game Stopped") LOCALS["bWaitingForPlayers"] = false GAMEOBJ:GetTimer():CancelAllTimers( self ) LOCALS["GameStarted"] = false -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) if (player) then showSummaryDialog(self,player) RemovePlayerFromGame(self, player) -- -- unstun player because he is done with race -- player:RemoveStun -- { -- bCantMove = false, -- bCantTurn = false, -- bCantAttack = false, -- bCantEquip = false, -- bCantInteract = false -- } -- end end LOCALS["PlayerNum"] = 0 LOCALS["NumPlayersFinished"] = 0 end -------------------------------------------------------------- -- try to stop the game that hasn't started yet -------------------------------------------------------------- function AbortGame(self) print("Game Aborted") LOCALS["bWaitingForPlayers"] = false GAMEOBJ:GetTimer():CancelAllTimers( self ) LOCALS["GameStarted"] = false -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) if (player) then RemovePlayerFromGame(self, player) player:ServerSetUserCtrlCompPause{bPaused = false} player:DisplayTooltip{ bShow = true, strText = "Game stopped, not enough players found.", iTime = 5000 } end end LOCALS["PlayerNum"] = 0 LOCALS["NumPlayersFinished"] = 0 end -------------------------------------------------------------- -- Get cannon number from player id -------------------------------------------------------------- function GetCannonNumFromPlayer(self, player) if (player) then local playerID = player:GetID() -- loop through cannons and find it for cnum = 1, #CANNONS do if (CANNONS[cnum]["Player"] == playerID) then return cnum end end end return 0 end -------------------------------------------------------------- -- Get cannon number from cannon id -------------------------------------------------------------- function GetCannonNumFromCannon(self, cannon) if (cannon) then local cannonID = cannon:GetID() -- loop through cannons and find it for cnum = 1, #CANNONS do if (CANNONS[cnum]["Cannon"] == cannonID) then return cnum end end end return 0 end -------------------------------------------------------------- -- Remove player from cannon -------------------------------------------------------------- function RemovePlayerFromCannon(self, player) if (player) then local cannonNum = GetCannonNumFromPlayer(self,player) if (cannonNum > 0) then CANNONS[cannonNum]["Player"] = 0 self:PlayerLoaded{ playerID = player } player:SetFaction{ faction = 1 } --player:ServerSetUserCtrlCompPause{bPaused = false} end end end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state LOCALS["PlayerNum"] = 0 LOCALS["NumPlayersFinished"] = 0 LOCALS["CheckpointNum"] = 0 LOCALS["CannonNum"] = 0 LOCALS["GameStarted"] = false end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "StartGame") then StartGame(self) end if (msg.name == "TimeOut") then AbortGame(self) end if (msg.name == "EndGame") then StopGame(self) end if (string.starts(msg.name,"RemovePlayerFromCannon")) then local numPlayers = #PLAYERS_TO_REMOVE if (numPlayers > 0) then local player = GAMEOBJ:GetObjectByID(PLAYERS_TO_REMOVE[numPlayers]) if (player) then PLAYERS_TO_REMOVE[numPlayers] = nil -- remove the player from the cannon RemovePlayerFromCannon(self,player) end end end if (msg.name == "Go") then -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if (player and playerData) then -- get start time local theTime = GAMEOBJ:GetSystemTime() -- set times in data playerData["startTime"] = theTime playerData["curLapTime"] = theTime self:SetVar(PLAYERS[pnum], playerData) -- unpause player:ServerSetUserCtrlCompPause{bPaused = false} end end end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) local player = msg.playerID -- move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not..... player:Teleport{pos = CONSTANTS["PLAYER_ZONEIN_POS"], bSetRotation = false} player:SetRacingParameters{ fTurnSpeedMult = CONSTANTS["TURN_SPEED_MULT"] } -- unpause player player:ServerSetUserCtrlCompPause{bPaused = false} -- remove all current boards RemoveBoardsFromPlayer(self, player) end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- checkpoint Loaded if (msg.templateID == CONSTANTS["CHECKPOINT_LOT"]) then -- store it local chkpNum = IncrementVarAndReturn("CheckpointNum") CHECKPOINTS[chkpNum] = msg.objectID:GetID() -- update constant CONSTANTS["NUM_CHECKPOINTS"] = #CHECKPOINTS end if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then print ("cannon added") -- Override the cannon shooting parameters msg.objectID:SetVar("ImpactSkillID",CONSTANTS["CANNON_IMPACT_SKILL"]) msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- store it local chkpNum = IncrementVarAndReturn("CannonNum") local CannonData = {} CannonData["Cannon"] = msg.objectID:GetID() CannonData["Player"] = 0 CANNONS[chkpNum] = CannonData -- update constant CONSTANTS["NUM_CANNONS"] = #CANNONS end end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- get player local player = msg.sender -- cancel the missions on the player for now player:CancelMission{ missionID = CONSTANTS["RACE_MISSION_ID"] } player:CancelMission{ missionID = CONSTANTS["CANNON_MISSION_ID"] } -- User wants to retry or start new race if ((msg.iButton == 1 and msg.identifier == "Racing_Summary") or (msg.iButton == 1 and msg.identifier == "Race_Mission")) then print("trigger restart") if (IsGameStarted(self)) then print("ERROR: game is not over yet!") player:DisplayTooltip{ bShow = true, strText = "The race is still running, try again after the race is over.", iTime = 5000 } player:ServerSetUserCtrlCompPause{bPaused = false} return end -- get current players local curplayers = LOCALS["PlayerNum"] if (tonumber(curplayers) < CONSTANTS["MAX_PLAYERS"]) then -- get the player Data local playerData = self:GetVar(player:GetID()) -- store the *new* player data for later use if (not playerData) then AddNewPlayerToGame(self, player) -- we used to be a player so we have player data but -- it should contain nothing elseif (not playerData["ShouldBeEmpty"]) then AddNewPlayerToGame(self, player) else print("ERROR: Player already exists in game!") end else player:DisplayTooltip{ bShow = true, strText = "The race is full, try again after the race is over.", iTime = 5000 } end -- User wants to quit Racing elseif (msg.iButton == 0 and msg.identifier == "Racing_Summary") then print("trigger leave") -- unpause player player:ServerSetUserCtrlCompPause{bPaused = false} -- User wants to shoot cannons elseif (msg.iButton == 1 and msg.identifier == "Race_Cannon_Mission") then print("cannon trigger") -- find an unused cannon local cannonID = GetValidCannon(self) -- no cannons available if (tonumber(cannonID) <= 0) then player:DisplayTooltip{ bShow = true, strText = "All cannons are full, try again later.", iTime= 5000 } print ("no cannons found") return end -- pause player player:ServerSetUserCtrlCompPause{bPaused = true} -- setup cannon vars local cannon = GAMEOBJ:GetObjectByID(cannonID) local cannonNum = GetCannonNumFromCannon(self, cannon) CANNONS[cannonNum]["Player"] = player:GetID() player:SetFaction{ faction = 2 } -- put the player in the cannon cannon:RequestActivityEnter{bStart = true, userID = player} end end -------------------------------------------------------------- -- Sent from checkpoints when a player passes them -------------------------------------------------------------- function onCollision(self, msg) FlagCheckpoint(self, msg.objectID, msg.senderID:GetID()) end -------------------------------------------------------------- -- Sent from goals when a player passes them -------------------------------------------------------------- function onOffCollision(self, msg) FlagLap(self, msg.objectID) end -------------------------------------------------------------- -- Sent from the cannon when a player starts or stops the cannon -------------------------------------------------------------- function onRequestActivityExit(self, msg) -- if the user quit, port him back -- store the player for transport at the end of the timer local numPlayers = #PLAYERS_TO_REMOVE + 1 PLAYERS_TO_REMOVE[numPlayers] = msg.userID:GetID() -- start timer for game start GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0, "RemovePlayerFromCannon" .. msg.userID:GetID(), self ) end-- Shamelessly stolen from L_ZONE_ACT_SHOOTING_GALLERY_1.lua -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} -- Cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 1864 CONSTANTS["CANNONREBUILD_TEMPLATEID"] = 2781 CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -5.716} CONSTANTS["CANNON_VELOCITY"] = 175.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 30.0 CONSTANTS["CANNON_REFIRE_RATE"] = 1500.0 CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 0, z = 0} CONSTANTS["CANNON_TIMEOUT"] = 60.0 -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Cannon rebuild loaded -- For some reason the platform rebuild doesn't break if we tell it to here? if (msg.templateID == CONSTANTS["CANNONREBUILD_TEMPLATEID"]) then msg.objectID:RebuildReset() end -- Cannon Object Loaded if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) or (msg.templateID == CONSTANTS["CANNONREBUILD_TEMPLATEID"]) then -- Override the cannon shooting parameters msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"]} end end -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_START_POS"] = {x = -500.542480, y = 229.773178, z = -900.577438} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} -- cannon constants CONSTANTS["PINBALL_TEMPLATEID"] = 2706 CONSTANTS["PINBALL_PLAYER_OFFSET"] = {x = 6.652, y = 0, z = -5.716} CONSTANTS["PINBALL_VELOCITY"] = 160.0 CONSTANTS["PINBALL_TIMEOUT"] = -1 -- cannon impact skills CONSTANTS["CANNON_IMPACT_SKILL"] = {34, 34, 61, 62} -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self, bSendRequest) -- get the cannon local cannon = getObjectByName(self, "cannonObject") -- get the player local player = getObjectByName(self, "activityPlayer") -- if we have both start it if ((cannon) and (player)) then -- send request to start cannon if needed if (bSendRequest == true) then cannon:RequestActivityStartStop{bStart = true, userID = player} end end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bSendRequest) -- get the cannon local cannon = getObjectByName(self, "cannonObject") -- get the player local player = getObjectByName(self, "activityPlayer") -- if we have both stop it if we need to if ((bSendRequest == true) and (cannon) and (player)) then cannon:RequestActivityStartStop{bStart = false, userID = player} end DoGameShutdown(self) end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars self:SetVar("SpawnNum", 0) self:SetVar("CurSpawnNum", 0) self:SetVar("GameStarted", true) self:SetVar("ThisWave", 0) self:SetVar("GameScore",0) self:SetVar("GameTime",0) -- start the first wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FIRST_WAVE_START_TIME"], "SpawnWave1",self ) -- set the cannon reticule back to start setCannonReticuleSize(self, 1) end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) self:SetVar("GameStarted", false) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- Get a random path -------------------------------------------------------------- function GetRandomPath(spawn) -- pick a random local ran = math.random(1,#spawn.path) return spawn.path[ran] end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self, bSpawnNow) -- get the current spawn number local spawnNum = IncrementVarAndReturn(self,"SpawnNum") -- save the spawn data for the object when it is loaded local SpawnData = {sdTemplate = spawn.id, sdRespawn = spawn.bRespawn, sdSpeed = spawn.speed, sdScore = spawn.score, sdPath = GetRandomPath(spawn), sdnum = num, sdChangeSpeed = spawn.bChangeSpeed, sdSpeedChance = spawn.speedChangeChance, sdMinSpeed = spawn.minSpeed, sdMaxSpeed = spawn.maxSpeed, sdMovingPlat = spawn.bMovingPlatform, sdDespawnTime = spawn.despawnTime, sdTimeScore = spawn.timeScore, bSpawned = false} -- store the data self:SetVar("SpawnData" .. spawnNum, SpawnData) -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum if (bSpawnNow == true) then if (spawn.initSpawnTime > 0) then print ("spawning with time " .. spawn.initSpawnTime) GAMEOBJ:GetTimer():AddTimerWithCancel( spawn.initSpawnTime, timerName, self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, timerName, self ) end elseif (spawn.bRespawn == true) then -- pick a random spawn time local ranSpawnTime = (math.random() * (spawn.maxTime - spawn.minTime)) + spawn.minTime GAMEOBJ:GetTimer():AddTimerWithCancel( ranSpawnTime, timerName, self ) end end -------------------------------------------------------------- -- destroys all spawns -------------------------------------------------------------- function DestroyAllSpawns(self) local maxSpawnNum = self:GetVar("CurSpawnNum") for spawn = 1, maxSpawnNum do local spawnObject = getObjectByName(self, "spawnObject" .. spawn) if (spawnObject) then if (spawnObject:Exists() and not spawnObject:IsDead().bDead) then print("removing spawn object " .. spawn) -- @TODO: need a better way to clear a wave, deletequeue message -- creates tons of other crap messages spawnObject:Die{killerID = spawnObject} --spawnObject:MoveToDeleteQueue{} end end end -- reset vars self:SetVar("SpawnNum", 0) self:SetVar("CurSpawnNum", 0) end -------------------------------------------------------------- -- look through spawn data to find the most recent data -- that matches the template, returns nil or data -------------------------------------------------------------- function GetLatestSpawnDataByTemplate(self,templateID) local spawnNum = self:GetVar("SpawnNum") while (spawnNum > 0) do -- get the data local SpawnData = self:GetVar("SpawnData" .. spawnNum) -- check spawn flag and template if (SpawnData.bSpawned == false and templateID == SpawnData.sdTemplate) then -- set spawned flag SpawnData.bSpawned = true -- re-save data self:SetVar("SpawnData" .. spawnNum, SpawnData) -- return the good data return SpawnData end -- try prev spawn data spawnNum = spawnNum - 1 end return nil end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self) -- get player local player = getObjectByName(self, "activityPlayer") -- TODO: Customize score window if (player) then -- get the player's score and time local score = self:GetVar("GameScore") local time = self:GetVar("GameTime") local strText = "" if (score and time) then strText = "Score: " .. score .. ", Retry?" else strText = "Retry?" end -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Summary"} end end -------------------------------------------------------------- -- Add more time to the current wave timer -------------------------------------------------------------- function AddTimeToWave(self, timeToAdd) -- get wave number local waveNum = self:GetVar("ThisWave") -- check on next wave waveNum = waveNum + 1 -- get correct timer name local timerName = "GameOver" if (waveNum <= CONSTANTS["NUM_WAVES"]) then timerName = "SpawnWave" .. waveNum end -- get the time left local theTime = GAMEOBJ:GetTimer():GetTime(timerName,self ) if (theTime > 0.0) then -- cancel timer and add a new one with more time GAMEOBJ:GetTimer():CancelTimer(timerName, self) theTime = theTime + timeToAdd GAMEOBJ:GetTimer():AddTimerWithCancel( theTime, timerName, self ) end end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state self:SetVar("GameStarted", false) self:SetVar("CurSpawnNum", 0) self:SetVar("ThisWave", 0) self:SetVar("GameScore",0) self:SetVar("GameTime",0) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- parse the name to get out the wave number -- use the wave number to select the spawns -- of format "SpawnWaveXXX" where XXX is the spawn number if (string.starts(msg.name,"SpawnWave")) then if (self:GetVar("GameStarted") == true) then -- get rid of current spawns DestroyAllSpawns(self) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,10) print("Spawning Wave " .. waveNum) -- store this wave number self:SetVar("ThisWave", waveNum) -- display wave number to player -- change cannon reticule setCannonReticuleSize(self, waveNum) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self,true) end -- move to the next wave waveNum = waveNum + 1 -- there are no more waves left -- so stop game after this wave if (waveNum > CONSTANTS["NUM_WAVES"]) then -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( waves[tonumber(waveNum) - 1].timeLimit, "GameOver", self ) else -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( waves[tonumber(waveNum) - 1].timeLimit, "SpawnWave" .. waveNum,self ) end end end -- parse the name to get out the spawn number -- use the spawn number to select the template id -- load the object -- of format "DoSpawnXXX" where XXX is the spawn number if (string.starts(msg.name,"DoSpawn")) then if (self:GetVar("GameStarted") == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = self:GetVar("SpawnData" .. spawnNum) local templateID = SpawnData.sdTemplate print("spawning " .. spawnNum) -- get the position of the first waypoint local startPos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = startPos.x, y = startPos.y, z = startPos.z, owner = self } end end -- end the game if (msg.name == "GameOver") then stopGame(self, true) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- look through spawn data to find the most recent data -- that matches the template local SpawnData = GetLatestSpawnDataByTemplate(self,msg.templateID) if (SpawnData) then local curSpawnNum = IncrementVarAndReturn(self,"CurSpawnNum") -- store spawn for use later storeObjectByName(self, "spawnObject" .. curSpawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child msg.childID:SetVar("SpawnData", SpawnData) msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } if (SpawnData.sdMovingPlat == true) then msg.childID:SetMovingPlatformParams{ wsPlatformPath = SpawnData.sdPath, iStartIndex = 0 } else -- assign child's waypoint msg.childID:SetVar("attached_path",SpawnData.sdPath) msg.childID:SetVar("attached_path_start",0) -- start child on path msg.childID:FollowWaypoints() end else -- error print("Error: Spawned object " .. msg.templateID .. " but saved data not found for it!") end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) -- stun and move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not..... local player = msg.playerID player:ServerSetUserCtrlCompPause{bPaused = true} -- player:Teleport{pos = CONSTANTS["PLAYER_START_POS"], -- x = CONSTANTS["PLAYER_START_ROT"].x, -- y = CONSTANTS["PLAYER_START_ROT"].y, -- z = CONSTANTS["PLAYER_START_ROT"].z, -- w = CONSTANTS["PLAYER_START_ROT"].w, -- bSetRotation = true} if (self:GetVar("GameStarted") == false) then -- get the player local player = getObjectByName(self, "activityPlayer") -- store the player for later use if (player == nil) then storeObjectByName(self, "activityPlayer", msg.playerID) end -- try to start the game startGame(self, true) end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Cannon Object Loaded if (msg.templateID == CONSTANTS["PINBALL_TEMPLATEID"]) then -- Override the cannon shooting parameters msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["PINBALL_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["PINBALL_VELOCITY"], timeLimit = CONSTANTS["PINBALL_TIMEOUT"]} -- store the cannon object for use later storeObjectByName(self, "cannonObject", msg.objectID) if (self:GetVar("GameStarted") == false) then -- try to start the game startGame(self, true) end end end -------------------------------------------------------------- -- Sent from the cannon when a player starts or stops the activity -------------------------------------------------------------- function onRequestActivityStartStop(self, msg) -- if the user quit, stop the game if (msg.bStart == false) then stopGame(self, false) showSummaryDialog(self) elseif (msg.bStart == true) then -- get the player local player = getObjectByName(self, "activityPlayer") -- store the player just in case if (player == nil) then player = msg.userID storeObjectByName(self, "activityPlayer", player) end -- start the game startGame(self,false) DoGameStartup(self) end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- save the score and time for later use self:SetVar("GameScore",msg.fValue1) self:SetVar("GameTime",msg.fValue2) -- also return the score as the result for the activity msg.outActivityRating = msg.fValue1 return msg end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this is the right player local player = getObjectByName(self, "activityPlayer") if (player:GetID() == msg.sender:GetID()) then -- User wants to retry if (msg.iButton == 1 and msg.identifier == "Shooting_Gallery_Summary") then startGame(self,true) -- User wants to quit elseif (msg.iButton == 0 and msg.identifier == "Shooting_Gallery_Summary") then -- go back to the other zone player:ServerSetUserCtrlCompPause{bPaused = false} --player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end end end -------------------------------------------------------------- -- Sent from the spawn objects on death -------------------------------------------------------------- function onUpdateMissionTask(self, msg) -- get this wave number local waveNum = self:GetVar("ThisWave") if (self:GetVar("GameStarted") == true) and (waveNum) and (waveNum > 0) then -- get the spawn data local spawnData = msg.target:GetVar("SpawnData") -- spawn the right object if (spawnData) and (spawnData.sdRespawn == true) then SpawnObject(spawnData.sdnum,spawns[waveNum][spawnData.sdnum],self,false) end -- check for time adding if (spawnData.sdTimeScore > 0.0) then AddTimeToWave(self,spawnData.sdTimeScore) end end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_START_POS"] = {x = -908.542480, y = 229.773178, z = -7.577438} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} CONSTANTS["REBUILD_1_TEMPLATEID"] = 2451 CONSTANTS["BOUNCER_TEMPLATE_ID"] = 2687 CONSTANTS["BOUNCER2_TEMPLATE_ID"] = 2975 CONSTANTS["BOX_TEMPLATE_ID"] = 2700 CONSTANTS["BOX2_TEMPLATE_ID"] = 2791 CONSTANTS["WALL_TEMPLATE_ID"] = 2695 CONSTANTS["PLATFORM_TEMPLATE_ID"] = 2700 CONSTANTS["DARKGEN_TEMPLATE_ID"] = 173 CONSTANTS["BOUNCERSTRING1"] = "197.31" .. '\031' .. "695.12" .. '\031' .. "-573.18" .. "#95" CONSTANTS["BOUNCERSTRING2"] = "198.66" .. '\031' .. "695.13" .. '\031' .. "-582.34" .. "#76" CONSTANTS["BOUNCERSTRING3"] = "159.29" .. '\031' .. "759.92" .. '\031' .. "-393.84" .. "#55" CONSTANTS["BOUNCERSTRING4"] = "348.87" .. '\031' .. "721.97" .. '\031' .. "-79.95" .. "#91" CONSTANTS["BOUNCERSTRING5"] = "393.97" .. '\031' .. "735.42" .. '\031' .. "-115.38" .. "#60" --TEST --CONSTANTS = {} CONSTANTS["CONTROLLER_LOT"] = 2873 CONTROLLER = {} --0END TEST -------------------------------------------------------------- -- Zone Variables -------------------------------------------------------------- --Variables shared throughout zone local numPlayers = 0 local playerIDs = {} --########################################################################################################## -- Helper Functions --########################################################################################################## -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end -------------------------------------------------------------- -- Increment a saved variable and return its new value -------------------------------------------------------------- function IncrementVarAndReturn(self,varName) local value = self:GetVar(varName) if (value) then value = value + 1 end self:SetVar(varName,value) return value end --############################################################################################################### -- Game Messages --############################################################################################################### function onObjectLoaded(self, msg) -- controller object loaded if (msg.templateID == CONSTANTS["CONTROLLER_LOT"]) then CONTROLLER = msg.objectID end end -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state self:SetVar("GameStarted", false) self:SetVar("GameScore",0) self:SetVar("GameTime",0) print("Zone contol starting up.") for i=1, 20 do self:SetVar("switch" .. tostring(i), false) end self:SetVar("bouncerSpawned", false) self:SetVar("currentBox", 0) self:SetVar("boxSpawned", false) self:SetVar("currentPlatform", 0) self:SetVar("platformSpawned", false) self:SetVar("BoxCounter", 1) self:SetVar("WallCounter", 1) self:SetVar("SmashBox1", 0) self:SetVar("SmashBox2", 0) self:SetVar("SmashBox3", 0) self:SetVar("SmashWall1", 0) self:SetVar("SmashWall2", 0) self:SetVar("CanRespawn456", 0) self:SetVar("CanRespawn1011", 0) self:SetVar("DarklingsStarted", false) self:SetVar("currentBouncerCoord", "") -------------------------------------------------------------- -- spawn initial objects -------------------------------------------------------------- RESMGR:LoadObject { objectTemplate = CONSTANTS["BOX2_TEMPLATE_ID"], bIsSmashable = true, x = 194.72, y = 695.94, z = -473.53, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["BOX2_TEMPLATE_ID"], bIsSmashable = true, x = 176.25, y = 694.54, z = -505.29, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["BOX2_TEMPLATE_ID"], bIsSmashable = true, x = 155.62, y = 695.84, z = -471.22, owner = self } print("Spawning wall") RESMGR:LoadObject { objectTemplate = CONSTANTS["WALL_TEMPLATE_ID"], bIsSmashable = true, x = 145.77, y = 755.25, z = -234.21, rw = 0.0, rx = 0.0, ry = 0.0, rz = 1.0, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["WALL_TEMPLATE_ID"], bIsSmashable = true, x = 157.15, y = 755.25, z = -234.21, rw = 0.0, rx = 0.0, ry = 0.0, rz = 1.0, owner = self } end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if msg.name == "InitBouncer" then getObjectByName(self, "currentBouncer"):EmotePlayed{emoteID = self:GetVar("currentBouncerCoord")} elseif msg.name == "InitBouncer2" then getObjectByName(self, "Bouncer2"):EmotePlayed{emoteID = self:GetVar("Bouncer2Coord")} elseif msg.name == "killBox" then getObjectByName(self, "currentBox"):Die{killerID = self} self:SetVar("boxSpawned", false) print("Deleting current Box, ID: " .. self:GetVar("currentBox")) elseif msg.name == "killBouncer" then print("Deleting current Bouncer, ID: " .. self:GetVar("currentBouncer")) getObjectByName(self, "currentBouncer"):Die{killerID = self} self:SetVar("bouncerSpawned", false) elseif msg.name == "killBouncer2" then print("Deleting current Bouncer, ID: " .. self:GetVar("Bouncer2")) getObjectByName(self, "Bouncer2"):Die{killerID = self} self:SetVar("bouncer2Spawned", false) elseif msg.name =="killPlatform" then print("Deleting current Platform, ID: " .. self:GetVar("currentPlatform")) getObjectByName(self, "currentPlatform"):Die{killerID = self} self:SetVar("platformSpawned", false) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) if msg.templateID == CONSTANTS["BOUNCER_TEMPLATE_ID"] then storeObjectByName(self, "currentBouncer", msg.childID) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "InitBouncer", self ) elseif msg.templateID == CONSTANTS["BOUNCER2_TEMPLATE_ID"] then storeObjectByName(self, "Bouncer2", msg.childID) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "InitBouncer2", self ) elseif msg.templateID == CONSTANTS["BOX_TEMPLATE_ID"] then storeObjectByName(self, "currentBox", msg.childID) print("Box loaded. Spawn state: " .. tostring(self:GetVar("boxSpawned"))) if not self:GetVar("boxSpawned") then print("Box killed before it was loaded!!------------------------- ") end elseif msg.templateID == CONSTANTS["BOX2_TEMPLATE_ID"] then if self:GetVar("BoxCounter") == 1 then self:SetVar("BoxCounter", 2) storeObjectByName(self, "SmashBox1", msg.childID) elseif self:GetVar("BoxCounter") == 2 then self:SetVar("BoxCounter", 3) storeObjectByName(self, "SmashBox2", msg.childID) elseif self:GetVar("BoxCounter") == 3 then self:SetVar("BoxCounter", 0) storeObjectByName(self, "SmashBox3", msg.childID) end elseif msg.templateID == CONSTANTS["WALL_TEMPLATE_ID"] then if self:GetVar("WallCounter") == 1 then self:SetVar("WallCounter", 2) storeObjectByName(self, "SmashWall1", msg.childID) elseif self:GetVar("WallCounter") == 2 then self:SetVar("WallCounter", 0) storeObjectByName(self, "SmashWall2", msg.childID) end elseif msg.templateID == CONSTANTS["PLATFORM_TEMPLATE_ID"] then storeObjectByName(self, "currentPlatform", msg.childID) elseif msg.templateID == CONSTANTS["DARKGEN_TEMPLATE_ID"] then self:SetVar("DarklingsStarted", true) end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) end -------------------------------------------------------------- -- Sent from the rebuilds and switches -------------------------------------------------------------- function onUpdateMissionTask(self, msg) -- Handle zone game events if string.starts(msg.taskType, "switchon") then print(msg.taskType .. " triggered!") i, j = string.find(msg.taskType, "switchon") local switchID = string.sub(msg.taskType, j+1, j+2) self:SetVar("switch" .. switchID, true) chooseGroup(self, switchID) elseif string.starts(msg.taskType, "switchoff") then print(msg.taskType .. " un-triggered!") i, j = string.find(msg.taskType, "switchoff") local switchID = string.sub(msg.taskType, j+1, j+2) self:SetVar("switch" .. switchID, false) chooseGroup(self, switchID) else print("Zone object detected unhandled mission task " .. msg.taskType .. " occured.") end end function chooseGroup(self, switchID) if switchID == "1" then print("switch group 1 activated") switchEffectsGroup1(self) elseif switchID == "2" then print("switch group 2 activated") switchEffectsGroup2(self) elseif switchID == "3" then switchEffectsGroup3(self) elseif switchID == "4" or switchID == "5" or switchID == "6" then print("SwitchID " .. switchID .. "activated - switch group 456 called") switchEffectsGroup456(self) elseif switchID == "7" or switchID == "8" or switchID == "9" then switchEffectsGroup789(self) elseif switchID == "10" or switchID == "11" then switchEffectsGroup1011(self) elseif switchID == "12" or switchID == "13" or switchID == "14" then switchEffectsGroup121314(self) elseif switchID == "15" then switchEffectsGroup15(self) elseif switchID == "16" or switchID == "17" or switchID == "18" then switchEffectsGroup161718(self) else print("WARNING: UNHANDLED SWICTH HIT!!!!!!!!!! switchID = " .. switchID) end end function switchEffectsGroup1(self) if self:GetVar("switch1") then if not self:GetVar("boxSpawned") then self:SetVar("boxSpawned", true) print("Box Spawned. Spawn state: " .. tostring(self:GetVar("boxSpawned"))) -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["BOX_TEMPLATE_ID"], bIsSmashable = true, x = 244.38, y = 651.31, z = -561.80, owner = self } end else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "killBox", self ) end end function switchEffectsGroup2(self) if self:GetVar("switch2") then if not self:GetVar("bouncerSpawned") then print("spawning bouncer 2") self:SetVar("currentBouncerCoord", CONSTANTS["BOUNCERSTRING1"]) self:SetVar("bouncerSpawned", true) -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER_TEMPLATE_ID"], bIsSmashable = true, x = 275, y = 652.49, z = -519, owner = self } end else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "killBouncer", self ) end end function switchEffectsGroup3(self) if self:GetVar("switch3") then if not self:GetVar("bouncer2Spawned") then self:SetVar("Bouncer2Coord", CONSTANTS["BOUNCERSTRING2"]) self:SetVar("bouncer2Spawned", true) -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER2_TEMPLATE_ID"], bIsSmashable = true, x = 237.7, y = 661.91, z = -570.28, owner = self } end else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "killBouncer2", self ) end end function switchEffectsGroup456(self) if self:GetVar("switch4") and self:GetVar("switch5") and self:GetVar("switch6") then self:SetVar("BoxCounter", 1) self:SetVar("CanRespawn456", 1) print("Deleting current Box, ID: " .. self:GetVar("SmashBox1")) getObjectByName(self, "SmashBox1"):Die{killerID = self} print("Deleting current Box, ID: " .. self:GetVar("SmashBox2")) getObjectByName(self, "SmashBox2"):Die{killerID = self} print("Deleting current Box, ID: " .. self:GetVar("SmashBox3")) getObjectByName(self, "SmashBox3"):Die{killerID = self} else if (self:GetVar("CanRespawn456") == 1) then print("creating box") self:SetVar("CanRespawn456", 0) -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["BOX2_TEMPLATE_ID"], bIsSmashable = true, x = 194.72, y = 695.94, z = -473.53, owner = self } print("creating box") -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["BOX2_TEMPLATE_ID"], bIsSmashable = true, x = 176.25, y = 694.54, z = -505.29, owner = self } print("creating box") -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["BOX2_TEMPLATE_ID"], bIsSmashable = true, x = 155.62, y = 695.84, z = -471.22, owner = self } end end end function switchEffectsGroup789(self) if self:GetVar("switch7") and self:GetVar("switch8") and self:GetVar("switch9") then if not self:GetVar("bouncerSpawned") then self:SetVar("currentBouncerCoord", CONSTANTS["BOUNCERSTRING3"]) self:SetVar("bouncerSpawned", true) RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER_TEMPLATE_ID"], bIsSmashable = true, x = 167.7, y = 750.59, z = -408.28, owner = self } end elseif getObjectByName(self, "currentBouncer") ~= 0 then if self:GetVar("bouncerSpawned") then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "killBouncer", self ) end end end function switchEffectsGroup1011(self) if self:GetVar("switch10") and self:GetVar("switch11") then self:SetVar("WallCounter", 1) self:SetVar("CanRespawn1011", 1) print("Deleting current Wall, ID: " .. self:GetVar("SmashWall1")) getObjectByName(self, "SmashWall1"):Die{killerID = self} print("Deleting current Wall, ID: " .. self:GetVar("SmashWall2")) getObjectByName(self, "SmashWall2"):Die{killerID = self} elseif (self:GetVar("CanRespawn1011") == 1) then print("creating walls") self:SetVar("CanRespawn1011", 0) -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["WALL_TEMPLATE_ID"], bIsSmashable = true, x = 145.77, y = 755.25, z = -234.21, rw = 0.0, rx = 0.0, ry = 0.0, rz = 1.0, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["WALL_TEMPLATE_ID"], bIsSmashable = true, x = 157.15, y = 755.25, z = -234.21, rw = 0.0, rx = 0.0, ry = 0.0, rz = 1.0, owner = self } end end function switchEffectsGroup121314(self) if self:GetVar("switch12") and self:GetVar("switch13") and self:GetVar("switch14") then if not self:GetVar("platformSpawned") then self:SetVar("platformSpawned", true) RESMGR:LoadObject { objectTemplate = CONSTANTS["PLATFORM_TEMPLATE_ID"], bIsSmashable = true, x = 241.96, y = 739.43, z = -212.13, owner = self } end elseif getObjectByName(self, "currentPlatform") ~= 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "killPlatform", self ) end end function switchEffectsGroup15(self) if self:GetVar("switch15") then if not self:GetVar("bouncerSpawned") then self:SetVar("currentBouncerCoord", CONSTANTS["BOUNCERSTRING4"]) self:SetVar("bouncerSpawned", true) RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER_TEMPLATE_ID"], bIsSmashable = true, x = 276.55, y = 743.37, z = -212.13, owner = self } end elseif getObjectByName(self, "currentBouncer") ~= 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "killBouncer", self ) end end function switchEffectsGroup161718(self) if self:GetVar("switch16") and self:GetVar("switch17") and self:GetVar("switch18") then if not self:GetVar("bouncerSpawned") then self:SetVar("currentBouncerCoord", CONSTANTS["BOUNCERSTRING5"]) self:SetVar("bouncerSpawned", true) RESMGR:LoadObject { objectTemplate = CONSTANTS["BOUNCER_TEMPLATE_ID"], bIsSmashable = true, x = 388.58, y = 722.52, z = -98.23, owner = self } end if not self:GetVar("DarklingsStarted") then RESMGR:LoadObject { objectTemplate = CONSTANTS["DARKGEN_TEMPLATE_ID"], bIsSmashable = true, x = 407.30, y = 722.52, z = -62.06, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["DARKGEN_TEMPLATE_ID"], bIsSmashable = true, x = 384.67, y = 722.52, z = -74.34, owner = self } RESMGR:LoadObject { objectTemplate = CONSTANTS["DARKGEN_TEMPLATE_ID"], bIsSmashable = true, x = 366.31, y = 722.52, z = -57.13, owner = self } end elseif getObjectByName(self, "currentBouncer") ~= 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "killBouncer", self ) end end function killObj(obj) obj:Die{killerID = self} end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_START_POS"] = {x = -2.4, y = 153, z = -63.1} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} CONSTANTS["NPC_START_POS"] = { x = 17.6, y = 153, z = -84 } -- Other constants CONSTANTS["PLAYER_FACTION"] = 1 CONSTANTS["INITIAL_PATH"] = "TestPath" CONSTANTS["PHLEGMING"] = 2711 CONSTANTS["PHLEGMING_SAVE"] = 0.50 CONSTANTS["PLAYER_SKILL"] = 68 CONSTANTS["PLAYER_SKILL2"] = 74 -------------------------------------------------------------- -- Spawn Data -------------------------------------------------------------- spawns = {} spawn = {} spawn[1] = { id = CONSTANTS["PHLEGMING"], time = 1.0, speed = 3.0, score = 50, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } --spawn[2] = { id = 2711, time = 2.0, speed = 5.0, score = 100, bwpRan = true, w1 = 1, w2 = 1, w3 = 1 } spawns[1] = spawn spawns[2] = spawn spawns[3] = spawn spawns[4] = spawn spawns[5] = spawn healthSpawns = {} --healthSpawns[1] = { x = 34.33 , y= 270.0 , z= -12.23 } --healthSpawns[2] = { x = 30.33 , y= 270.0 , z= -7.87 } --healthSpawns[3] = { x = 25.29 , y= 270.0 , z= -2.68 } --healthSpawns[4] = { x = 18.94 , y= 270.0 , z= 3.85 } --healthSpawns[5] = { x = 12.46 , y= 270.0 , z= 10.52 } -------------------------------------------------------------- -- Activity Constants -------------------------------------------------------------- CONSTANTS["MAX_HEALTH"] = #healthSpawns CONSTANTS["NUM_WAVES"] = #spawns CONSTANTS["HEALTH_TEMPLATEID"] = 2018 CONSTANTS["FIRST_WAVE_START_TIME"] = 15.0 CONSTANTS["TIME_BETWEEN_WAVES"] = 3.0 -------------------------------------------------------------- -- String Table -------------------------------------------------------------- strings = {} strings["WAVE_TEXT"] = "Monkey " strings["LIFE_LOST"] = "BBQ Lost!" -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self, bSendRequest) -- get the cannon --local cannon = getObjectByName(self, "cannonObject") -- get the player --local player = getObjectByName(self, "activityPlayer") -- if we have both start it --if (player) then -- RESMGR:LoadObject { objectTemplate = 2711, -- bIsSmashable = true, -- x = CONSTANTS["NPC_START_POS"].x, -- y = CONSTANTS["NPC_START_POS"].y, -- z = CONSTANTS["NPC_START_POS"].z, -- owner = self } -- send request to start cannon if needed -- if (bSendRequest == true) then -- cannon:RequestActivityStartStop{bStart = true, userID = player} -- end --end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bSendRequest) -- get the cannon local cannon = getObjectByName(self, "cannonObject") -- get the player local player = getObjectByName(self, "activityPlayer") -- if we have both stop it if we need to if ((bSendRequest == true) and (cannon) and (player)) then cannon:RequestActivityStartStop{bStart = false, userID = player} end DoGameShutdown(self) end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars self:SetVar("SpawnNum", 0) self:SetVar("Health", CONSTANTS["MAX_HEALTH"]) self:SetVar("DisplayWaveNum", 0) self:SetVar("CurSpawnNum", 0) self:SetVar("CurSpawnHealthNum", 0) self:SetVar("GameStarted", true) self:SetVar("NumDeadSpawns", 0) self:SetVar("NextWave", 0) self:SetVar("GameScore",0) self:SetVar("GameTime",0) self:SetVar("GameWave",0) -- spawn the health objects print ("Spawning Health Items") for k,v in pairs(healthSpawns) do SpawnHealth(k,v,self) end local player = getObjectByName(self, "activityPlayer") -- start the first wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FIRST_WAVE_START_TIME"], "SpawnWave1",self ) end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) self:SetVar("GameStarted", false) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self) -- get the current spawn number local spawnNum = IncrementVarAndReturn(self,"SpawnNum") -- save the spawn data for the object when it is loaded local SpawnData = {sdTemplate = spawn.id, sdSpeed = spawn.speed, sdScore = spawn.score, sdUseRandomPath = spawn.bwpRan, sdWP1 = spawn.w1, sdWP2 = spawn.w2, sdWP3 = spawn.w3} -- store the data self:SetVar("SpawnData" .. spawnNum, SpawnData) -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum GAMEOBJ:GetTimer():AddTimerWithCancel( spawn.time, timerName, self ) end -------------------------------------------------------------- -- spawns the health objects -------------------------------------------------------------- function SpawnHealth(num, spawn, self) -- load the object in the world RESMGR:LoadObject { objectTemplate = CONSTANTS["HEALTH_TEMPLATEID"], bIsSmashable = true, x = spawn.x, y = spawn.y, z = spawn.z, owner = self } end -------------------------------------------------------------- -- destroys all health objects and spawns -------------------------------------------------------------- function DestroyAllSpawns(self) for health = 1, CONSTANTS["MAX_HEALTH"] do local healthObject = getObjectByName(self, "healthSpawn" .. health) if (healthObject) then print("removing health item " .. health) if (healthObject:IsDead().bDead == false) then healthObject:Die{killerID = healthObject} end end end local maxSpawnNum = self:GetVar("CurSpawnNum") for spawn = 1, maxSpawnNum do local spawnObject = getObjectByName(self, "spawnObject" .. spawn) if (spawnObject) then print("removing spawn object " .. spawn) if (spawnObject:IsDead().bDead == false) then spawnObject:Die{killerID = spawnObject} end end end end -------------------------------------------------------------- -- sends a message to display the current wave number to player -------------------------------------------------------------- function DisplayWaveNumberToPlayer(self) local player = getObjectByName(self, "activityPlayer") if (player) then local displayWave = IncrementVarAndReturn(self,"DisplayWaveNum") local textString = strings["WAVE_TEXT"] .. displayWave end end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self) -- get player local player = getObjectByName(self, "activityPlayer") if (player) then -- get the player's score and time local score = self:GetVar("GameScore") local time = self:GetVar("GameTime") local wave = self:GetVar("GameWave") local strText = "" if (score and time and wave) then strText = "Score/Wave: " .. score .. "/" .. wave .. ", Retry?" else strText = "Retry?" end -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Summary"} end end -------------------------------------------------------------- -- check to see if a string starts with a substring -------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end -------------------------------------------------------------- -- Increment a saved variable and return its new value -------------------------------------------------------------- function IncrementVarAndReturn(self,varName) local value = self:GetVar(varName) if (value) then value = value + 1 else value = 1 end self:SetVar(varName,value) return value end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state self:SetVar("GameStarted", false) self:SetVar("CurSpawnNum", 0) self:SetVar("NumDeadSpawns", 0) self:SetVar("CurSpawnHealthNum", 0) self:SetVar("NextWave", 0) self:SetVar("Health", CONSTANTS["MAX_HEALTH"]) self:SetVar("GameScore",0) self:SetVar("GameTime",0) self:SetVar("GameWave",0) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- parse the name to get out the wave number -- use the wave number to select the spawns -- of format "SpawnWaveXXX" where XXX is the spawn number if (string.starts(msg.name,"SpawnWave")) then if (self:GetVar("GameStarted") == true) then -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,10) DisplayWaveNumberToPlayer(self) print("Spawning Wave " .. waveNum) self:SetVar("GameWave", waveNum) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self) end -- move to the next wave waveNum = waveNum + 1 -- repeat the last wave if we are at the max if (waveNum <= CONSTANTS["NUM_WAVES"]) then --waveNum = CONSTANTS["NUM_WAVES"]; -- store next wave number self:SetVar("NextWave", waveNum) -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["TIME_BETWEEN_WAVES"], "SpawnWave" .. waveNum,self ) end end end -- parse the name to get out the spawn number -- use the spawn number to select the template id -- load the object -- of format "DoSpawnXXX" where XXX is the spawn number if (string.starts(msg.name,"DoSpawn")) then if (self:GetVar("GameStarted") == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = self:GetVar("SpawnData" .. spawnNum) local templateID = SpawnData.sdTemplate -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = CONSTANTS["NPC_START_POS"].x, y = CONSTANTS["NPC_START_POS"].y, z = CONSTANTS["NPC_START_POS"].z, owner = self } end end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- check for health spawns, MUST BE FIRST if msg.templateID == CONSTANTS["HEALTH_TEMPLATEID"] then -- set the health spawn faction to same as a player msg.childID:SetFaction{faction = CONSTANTS["PLAYER_FACTION"]} -- get current spawn health number and increment local healthSpawnNum = IncrementVarAndReturn(self,"CurSpawnHealthNum") -- store health spawn for use later storeObjectByName(self, "healthSpawn" .. healthSpawnNum, msg.childID) else -- get the current spawn number and increment it local spawnNum = IncrementVarAndReturn(self,"CurSpawnNum") -- get the template out of the spawn data local SpawnData = self:GetVar("SpawnData" .. spawnNum) -- check for the right template if msg.templateID == CONSTANTS["PHLEGMING"] then -- store spawn for use later storeObjectByName(self, "spawnObject" .. spawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child msg.childID:SetVar("SpawnData", SpawnData) -- store the waypoint data in the child msg.childID:FollowWaypoints{bPaused=true} msg.childID:SetCurrentPath{pathName=CONSTANTS["INITIAL_PATH"]} -- if (SpawnData.sdUseRandomPath == true) then -- -- do random waypoints -- local wp1 = math.random(1,5) -- local wp2 = math.random(1,5) -- local wp3 = math.random(1,5) -- -- msg.childID:SetVar("Waypoint1",waypoints[1][wp1]) -- msg.childID:SetVar("Waypoint2",waypoints[2][wp2]) -- msg.childID:SetVar("Waypoint3",waypoints[3][wp3]) -- else -- -- do normal waypoints -- msg.childID:SetVar("Waypoint1",waypoints[1][SpawnData.sdWP1]) -- msg.childID:SetVar("Waypoint2",waypoints[2][SpawnData.sdWP2]) -- msg.childID:SetVar("Waypoint3",waypoints[3][SpawnData.sdWP3]) -- end end end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) -- move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not..... local player = msg.playerID -- store the player for later use local storedPlayer = getObjectByName(self, "activityPlayer") if (storedPlayer == nil) then storeObjectByName(self, "activityPlayer", player) end --player:ServerSetUserCtrlCompPause{bPaused = true} player:Teleport{pos = CONSTANTS["PLAYER_START_POS"], x = CONSTANTS["PLAYER_START_ROT"].x, y = CONSTANTS["PLAYER_START_ROT"].y, z = CONSTANTS["PLAYER_START_ROT"].z, w = CONSTANTS["PLAYER_START_ROT"].w, bSetRotation = true} player:AddSkill{skillID = CONSTANTS["PLAYER_SKILL"], temporary = true, temporaryReplaceAttack=false} player:AddSkill{skillID = CONSTANTS["PLAYER_SKILL2"], temporary = true, temporaryReplaceAttack=false} player:MapSkill{skillID = CONSTANTS["PLAYER_SKILL"], slot = 3} player:MapSkill{skillID = CONSTANTS["PLAYER_SKILL2"], slot = 4} if (self:GetVar("GameStarted") == false) then -- get the player -- try to start the game --startGame(self, true) player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = "Save the monkeys! They're about to run! You need to save " .. (CONSTANTS["PHLEGMING_SAVE"]*100) .. "% of the monkeys. Are you ready?", identifier = "PhlegmingMap"}--Shooting_Gallery_Summary"} end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- --function onObjectLoaded(self, msg) -- -- -- Cannon Object Loaded -- if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then -- -- -- Override the cannon shooting parameters -- msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], -- projectileVelocity = CONSTANTS["CANNON_VELOCITY"], -- cooldown = CONSTANTS["CANNON_REFIRE_RATE"], -- muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], -- minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], -- timeLimit = CONSTANTS["CANNON_TIMEOUT"]} -- -- -- store the cannon object for use later -- storeObjectByName(self, "cannonObject", msg.objectID) -- -- if (self:GetVar("GameStarted") == false) then -- -- try to start the game -- startGame(self, true) -- end -- -- end -- --end -------------------------------------------------------------- -- Sent from a ninja when he gets to his final waypoint -------------------------------------------------------------- --function onArrived(self, msg) -- -- if (self:GetVar("GameStarted") == true) then -- -- -- get the health left -- local health = self:GetVar("Health") -- -- if (health > 0) then -- -- -- tell the player they lost a life -- local player = getObjectByName(self, "activityPlayer") -- -- -- remove health -- newhealth = health - 1 -- self:SetVar("Health", newhealth) -- -- -- destroy a health object -- local healthObject = getObjectByName(self, "healthSpawn" .. health) -- if (healthObject) then -- healthObject:Die{killerID = healthObject} -- end -- -- -- game over -- if (newhealth <= 0) then -- print("health empty, game over") -- stopGame(self, true) -- end -- -- end -- -- end --end -------------------------------------------------------------- -- Sent from the cannon when a player starts or stops the activity -------------------------------------------------------------- --function onRequestActivityStartStop(self, msg) -- -- -- if the user quit, stop the game -- if (msg.bStart == false) then -- -- stopGame(self, false) -- -- showSummaryDialog(self) -- -- elseif (msg.bStart == true) then -- -- -- get the player -- local player = getObjectByName(self, "activityPlayer") -- -- -- store the player just in case -- if (player == nil) then -- player = msg.userID -- storeObjectByName(self, "activityPlayer", player) -- end -- -- -- start the game -- startGame(self,false) -- -- DoGameStartup(self) -- -- end -- --end -- -- ---------------------------------------------------------------- ---- Sent from the cannon to get a score for the player ---------------------------------------------------------------- --function onDoCalculateActivityRating(self, msg) -- -- -- save the score and time for later use -- self:SetVar("GameScore",msg.score) -- self:SetVar("GameTime",msg.time) -- -- -- wave should already be set -- -- -- also return the score as the result for the activity -- msg.outActivityRating = msg.score -- return msg -- --end -- -- ---------------------------------------------------------------- ---- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this is the right player local player = getObjectByName(self, "activityPlayer") if (player:GetID() == msg.sender:GetID()) then -- -- User wants to retry if (msg.iButton == 1 and msg.identifier == "PhlegmingMap") then DoGameStartup(self) -- startGame(self,true) -- -- -- User wants to quit elseif (msg.iButton == 0 and msg.identifier == "PhlegmingMap") then -- -- -- go back to the other zone player:ServerSetUserCtrlCompPause{bPaused = false} player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } -- end -- end end -- -- ---------------------------------------------------------------- ---- Sent from the spawn objects on death ---------------------------------------------------------------- function onUpdateMissionTask(self, msg) local player = getObjectByName(self, "activityPlayer") local dead = self:GetVar("NumDeadSpawns") local win = self:GetVar("NumFinishedSpawns") if (dead == nil) then dead = 0 end if (win == nil) then win = 0 end if (msg.taskType == "phlegming_die") then dead = IncrementVarAndReturn(self,"NumDeadSpawns") end if (msg.taskType == "phlegming_win") then win = IncrementVarAndReturn(self,"NumFinishedSpawns") msg.target:FollowWaypoints{bPaused=true} msg.target:PlayEmote{ emoteID = "cheer" } end -- -- local numDeadSpawns = IncrementVarAndReturn(self,"NumDeadSpawns") -- -- -- if all the spawns are dead or gone -- if (numDeadSpawns == maxSpawnNum) then -- -- -- spawn the next wave -- local waveNum = self:GetVar("NextWave") -- -- -- setup next wave -- GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["TIME_BETWEEN_WAVES"], "SpawnWave" .. waveNum,self ) -- end -- endrequire('o_mis') require('o_ShootingGallery') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["PLAYER_ZONEIN_POS"] = {x = -127, y = 184.4, z = -531} CONSTANTS["PLAYER_ZONEIN_ROT"] = {w = 1, x = 0, y = 0, z = 0} CONSTANTS["GOAL_LINE_LOT"] = 6283 CONSTANTS["CHECKPOINT_LOT"] = 6281 CONSTANTS["BOARD_LOT"] = 2250 CONSTANTS["RACE_MISSION_ID"] = 31 CONSTANTS["TURN_SPEED_MULT"] = 0.4 -- turn speed multiplier for track CONSTANTS["PLAYER_START_POS1"] = { x = -52, y = 185.8, z = -461.1 } CONSTANTS["PLAYER_START_POS2"] = { x = -57, y = 185.8, z = -461.1 } CONSTANTS["PLAYER_START_POS3"] = { x = -62, y = 185.8, z = -461.1 } CONSTANTS["PLAYER_START_POS4"] = { x = -67, y = 185.8, z = -461.1 } CONSTANTS["PLAYER_START_ROT"] = {w = 1, x = 0, y = 0, z = 0} CONSTANTS["MAX_PLAYERS"] = 4 -- number of players max CONSTANTS["MIN_PLAYERS"] = 1 -- number of players min CONSTANTS["MAX_LAPS"] = 3 -- number of laps for race CONSTANTS["NUM_CHECKPOINTS"] = 0 -- this should Auto Update CONSTANTS["COUNTDOWN_TIME"] = 3.0 CONSTANTS["RACE_TIMEOUT"] = 20.0 -- time until race auto quits with less then min players CONSTANTS["RACE_START_TIME"] = 10.0 -- time until race starts after min player reached CONSTANTS["RACE_FINISH_TIME"] = 40.0 -- time until race finishes BOARDS = {6301, 6302, 6303, 6304} CONSTANTS["NUM_BOARDS"] = #BOARDS PLAYERS = {} CHECKPOINTS = {} LOCALS = {} LOCALS["bWaitingForPlayers"] = false -------------------------------------------------------------- -- Pads a number with zeros on the left, to fill a field of the specified -- length. -------------------------------------------------------------- function ZeroPad(number, length) return string.rep("0", length - #tostring(number)) .. tostring(number) end -------------------------------------------------------------- -- parses time to a string -------------------------------------------------------------- function ParseTime(numTime) local newTime = tonumber(numTime) local min = math.floor(newTime / 1000 / 60) newTime = newTime - (min * 1000 * 60) local sec = math.floor(newTime / 1000) newTime = newTime - (sec * 1000) local msec = math.floor(newTime) local strTime = "" if (min > 0) then strTime = ZeroPad(min,2) .. ":" .. ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) else strTime = ZeroPad(sec,2) .. "." .. ZeroPad(msec,3) end return strTime end -------------------------------------------------------------- -- checks to see if the checkPoint ID is valid, -- returns > 0 if valid -------------------------------------------------------------- function IsValidCheckpoint(self, checkPoint) for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do if (checkPoint == CHECKPOINTS[chkp]) then return chkp end end return 0 end -------------------------------------------------------------- -- returns true if game is going -------------------------------------------------------------- function IsGameStarted(self) return (LOCALS["GameStarted"] == true) end -------------------------------------------------------------- -- returns player num -- returns > 0 if valid -------------------------------------------------------------- function GetPlayerNum(self, player) for pnum = 1, #PLAYERS do if (player:GetID() == PLAYERS[pnum]) then print "Valid!" return pnum end end return 0 end -------------------------------------------------------------- -- checks to see if a player has hit all checkpoints -------------------------------------------------------------- function HasPlayerHitAllCheckpoints(self, player) local playerData = self:GetVar(player:GetID()) if (playerData) then for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do if (playerData["chkpStatus" .. chkp] == false) then return false end end else return false end -- all checkpoints good, no failures return true end -------------------------------------------------------------- -- sends a message to display checkpoint info to the player -------------------------------------------------------------- function DisplayCheckpointTimeToPlayer(self, player) if ( (player) and (IsGameStarted(self)) ) then -- get player data local playerData = self:GetVar(player:GetID()) if (playerData) then -- get current time local theTime = GAMEOBJ:GetSystemTime() local strTime = tonumber(theTime) - tonumber(playerData["curLapTime"]) end end end -------------------------------------------------------------- -- sets the place data member for a player -------------------------------------------------------------- function SetPlayerPlace(self, player, place) if (player) then local playerData = self:GetVar(player:GetID()) if (playerData) then playerData["place"] = place self:SetVar(player:GetID(), playerData) end end end -------------------------------------------------------------- -- flags a lap for a player and displays any information -------------------------------------------------------------- function FlagLap(self, player) -- try to get player data local playerData = self:GetVar(player:GetID()) -- has the player hit all the checkpoints? if ( (IsGameStarted(self)) and (playerData) and ( HasPlayerHitAllCheckpoints(self,player) == true ) ) then print("Goal Hit!") local theTime = GAMEOBJ:GetSystemTime() local strTime = tonumber(theTime) - tonumber(playerData["curLapTime"]) -- set this player's lap time playerData["lapTime" .. playerData["curLap"]] = strTime -- reset current lapTime playerData["curLapTime"] = theTime -- move the player to the next lap playerData["curLap"] = tonumber(playerData["curLap"]) + 1 -- reset checkpoint flags for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do playerData["chkpStatus" .. chkp] = false end -- store the data self:SetVar(player:GetID(), playerData) -- show player the lap number or end game if (tonumber(playerData["curLap"]) <= CONSTANTS["MAX_LAPS"]) then player:PlaySound{ strSoundName = "lap_complete" } else -- done with race (someone finished) local numFinishedPlayers = IncrementVarAndReturn("NumPlayersFinished") -- set to first place SetPlayerPlace(self, player, numFinishedPlayers) -- stop the race when we are totally done if (numFinishedPlayers >= #PLAYERS) then StopGame(self) -- first player across the line starts the timeout timer elseif (numFinishedPlayers == 1) then DoFinishRaceTimer(self,player) end end end end -------------------------------------------------------------- -- being end race timer -------------------------------------------------------------- function DoFinishRaceTimer(self,winner) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) local winnerName = winner:GetName().name -- display tooltip to all players in race for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if ((winner:GetID() == PLAYERS[pnum])) then -- show tooltip to winner player:DisplayTooltip{ bShow = true, strText = "You Win!\n Waiting for other players." } player:PlayFXEffect{effectType = "fireworks"} elseif (player and playerData) then -- show tooltip to others player:DisplayTooltip{ bShow = true, strText = "Winner: " .. winnerName .. "\nRace ends in " .. CONSTANTS["RACE_FINISH_TIME"] .. " seconds.", iTime = 5000 } end end -- start timer for game start GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["RACE_FINISH_TIME"], "EndGame", self ) end -------------------------------------------------------------- -- flags a checkpoint for a player and displays any information -------------------------------------------------------------- function FlagCheckpoint(self, player, checkPoint) -- try to get player data and checkpoint data local playerData = self:GetVar(player:GetID()) local chkp = tonumber(IsValidCheckpoint(self,checkPoint)) -- are the vars valid? if ( (IsGameStarted(self)) and (playerData) and ( chkp > 0) and tonumber(playerData["curLap"]) <= CONSTANTS["MAX_LAPS"]) then print("Checkpoint " .. chkp .. " Hit!") -- show the checkpoint time to player if (playerData["chkpStatus" .. chkp] == false) then player:PlaySound{ strSoundName = "checkpoint" } DisplayCheckpointTimeToPlayer(self, player) end -- set this checkpoint to true for player playerData["chkpStatus" .. chkp] = true -- store the data self:SetVar(player:GetID(), playerData) end end -------------------------------------------------------------- -- get place string -------------------------------------------------------------- function GetPlaceString(place) if (tonumber(place) == 1) then return "1st" elseif (tonumber(place) == 2) then return "2nd" elseif (tonumber(place) == 3) then return "3rd" else return (place.."th") end end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self, player) if (player) then local playerData = self:GetVar(player:GetID()) -- close any tooltip player:DisplayTooltip{ bShow = false, strText = "..." } -- setup summary text local strText = "" strText = strText .. "Race Over!\n\n" -- show place local place = GetPlaceString(playerData["place"]) if (playerData["place"] == 0) then strText = strText .. "Not Finished!\n\n" else strText = strText .. "" .. place .. " Place!\n\n" end -- lap times local totalTime = 0 local bNotFinished = false for lap = 1, CONSTANTS["MAX_LAPS"] do -- if no lap time, exit early if (tonumber(playerData["lapTime" .. lap]) <= 0) then bNotFinished = true break else strText = strText .. "Lap " .. lap .. ": " .. ParseTime(playerData["lapTime" .. lap]) .. "\n" totalTime = totalTime + tonumber(playerData["lapTime" .. lap]) end end -- show total time if finished if (bNotFinished == false) then strText = strText .. "Total: " .. ParseTime(totalTime) .. "\n" end -- ask for retry strText = strText .. "\nRetry?" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Racing_Summary"} end end -------------------------------------------------------------- -- remove boards from a player -------------------------------------------------------------- function RemoveBoardsFromPlayer(self, player) if (player) then for board = 1, CONSTANTS["NUM_BOARDS"] do -- unequip and remove the item player:RemoveItemFromInventory{ iObjTemplate = BOARDS[board] } player:RemoveItemFromInventory{ iObjTemplate = 6305 } player:RemoveItemFromInventory{ iObjTemplate = 6306 } player:RemoveItemFromInventory{ iObjTemplate = 6307 } player:SetAnimationSet{strSet = ""} player:RemoveSkill{ skillID = 66 } end end end -------------------------------------------------------------- -- adds a random board to the player -------------------------------------------------------------- function AddRandomBoardToPlayer(self, player) if (player) then -- remove all current boards RemoveBoardsFromPlayer(self, player) local board = math.random(1,CONSTANTS["NUM_BOARDS"]) -- add item local item = player:AddNewItemToInventory{ iObjTemplate = BOARDS[board] } player:EquipInventory{ itemtoequip = item.newObjID } local item = player:AddNewItemToInventory{ iObjTemplate = 6305 } player:EquipInventory{ itemtoequip = item.newObjID } local item = player:AddNewItemToInventory{ iObjTemplate = 6306 } player:EquipInventory{ itemtoequip = item.newObjID } local item = player:AddNewItemToInventory{ iObjTemplate = 6307 } player:EquipInventory{ itemtoequip = item.newObjID } player:PlayAnimation{animationID = "getin-racecar"} end end -------------------------------------------------------------- -- remove player from game -------------------------------------------------------------- function RemovePlayerFromGame(self, player) if (player) then local playerNum = GetPlayerNum(self, player) -- reset data PLAYERS[playerNum] = -1 local NoData = {} self:SetVar(player:GetID(), NoData) -- remove all boards RemoveBoardsFromPlayer(self, player) player:Teleport{pos = CONSTANTS["PLAYER_ZONEIN_POS"], bSetRotation = false} end end -------------------------------------------------------------- -- add new player for the race -------------------------------------------------------------- function AddNewPlayerToGame(self, player) if (player) then local playerNum = IncrementVarAndReturn("PlayerNum") ----------------------------------------------------- -- store player data local PlayerData = {} PlayerData["startTime"] = 0 PlayerData["curLapTime"] = 0 PlayerData["curLap"] = 1 PlayerData["place"] = 0 for lap = 1, CONSTANTS["MAX_LAPS"] do PlayerData["lapTime" .. lap] = -1 end for chkp = 1, CONSTANTS["NUM_CHECKPOINTS"] do PlayerData["chkpStatus" .. chkp] = false end self:SetVar(player:GetID(), PlayerData) ----------------------------------------------------- -- store id in local array PLAYERS[playerNum] = player:GetID() -- put player in right spot if self:GetVar("FinishThere") == 1 then if self:GetVar("Finishrot_y") == 1 then player:Teleport{pos = {x = self:GetVar("Finishpos_x") - 5 + (playerNum * 2), y = self:GetVar("Finishpos_y"), z = self:GetVar("Finishpos_z") + 2}, x = 0, y = 1, z = 0, w = 0, bSetRotation = true} elseif self:GetVar("Finishrot_y") > 0.7 and self:GetVar("Finishrot_y") < 0.8 then player:Teleport{pos = {x = self:GetVar("Finishpos_x") + 2, y = self:GetVar("Finishpos_y"), z = self:GetVar("Finishpos_z") - 5 + (playerNum * 2)}, x = 0, y = 0.707, z = 0, w = 0.707, bSetRotation = true} elseif self:GetVar("Finishrot_y") == 0 then player:Teleport{pos = {x = self:GetVar("Finishpos_x") + 5 - (playerNum * 2), y = self:GetVar("Finishpos_y"), z = self:GetVar("Finishpos_z") - 2}, x = 0, y = 0, z = 0, w = 1, bSetRotation = true} elseif self:GetVar("Finishrot_y") < -0.7 and self:GetVar("Finishrot_y") > -0.8 then player:Teleport{pos = {x = self:GetVar("Finishpos_x") - 2, y = self:GetVar("Finishpos_y"), z = self:GetVar("Finishpos_z") + 5 - (playerNum * 2)}, x = 0, y = -0.707, z = 0, w = 0.707, bSetRotation = true} end else print "No Finish Line!" player:Teleport{pos =CONSTANTS["PLAYER_START_POS" .. playerNum], x = CONSTANTS["PLAYER_START_ROT"].x, y = CONSTANTS["PLAYER_START_ROT"].y, z = CONSTANTS["PLAYER_START_ROT"].z, w = CONSTANTS["PLAYER_START_ROT"].w, bSetRotation = true} end -- paused wait for game start player:PlayCinematic { pathName = "Camera_End" } player:ServerSetUserCtrlCompPause{bPaused = true} -- add board to player AddRandomBoardToPlayer(self, player) -- Try to start the game (next frame) local curplayers = LOCALS["PlayerNum"] if (tonumber(curplayers) == CONSTANTS["MAX_PLAYERS"]) then LOCALS["bWaitingForPlayers"] = false GAMEOBJ:GetTimer():CancelAllTimers( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "StartGame", self ) else -- begin timer for game start if we have the min players if (tonumber(curplayers) == CONSTANTS["MIN_PLAYERS"]) then print("minplayers") BeginRaceStartJoinTimer(self) player:DisplayTooltip{ bShow = true, strText = "Waiting for players...", iTime = 0 } elseif (tonumber(curplayers) < CONSTANTS["MIN_PLAYERS"]) then -- start timeout timer if (LOCALS["bWaitingForPlayers"] == false) then GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["RACE_TIMEOUT"], "TimeOut", self ) LOCALS["bWaitingForPlayers"] = true end -- inform player about wait with tooltip player:DisplayTooltip{ bShow = true, strText = "Waiting for players...", iTime = 0 } end end end end -------------------------------------------------------------- -- being the race join timer -------------------------------------------------------------- function BeginRaceStartJoinTimer(self) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- display tooltip to all players in race for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if (player and playerData) then -- show tooltip player:DisplayTooltip{ bShow = true, strText = "Race begins in " .. CONSTANTS["RACE_START_TIME"] .. " seconds. \nWaiting for more players." } end end -- start timer for game start GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["RACE_START_TIME"], "StartGame", self ) end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function StartGame(self) print("Game Started") LOCALS["bWaitingForPlayers"] = false LOCALS["GameStarted"] = true -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if (player and playerData) then -- close any tooltip player:DisplayTooltip{ bShow = false, strText = "..." } -- trigger the Countdown on all clients player:ShowActivityCountdown { bPlayCountdownSound = false, bPlayAdditionalSound = true, sndName = "metallica - fuel", stateToPlaySoundOn = 1 } end end -- set a timer to Unpause and Go GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["COUNTDOWN_TIME"], "Go", self ) end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function StopGame(self) print("Game Stopped") LOCALS["bWaitingForPlayers"] = false GAMEOBJ:GetTimer():CancelAllTimers( self ) LOCALS["GameStarted"] = false -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) if (player) then showSummaryDialog(self,player) RemovePlayerFromGame(self, player) end end LOCALS["PlayerNum"] = 0 LOCALS["NumPlayersFinished"] = 0 end -------------------------------------------------------------- -- try to stop the game that hasn't started yet -------------------------------------------------------------- function AbortGame(self) print("Game Aborted") LOCALS["bWaitingForPlayers"] = false GAMEOBJ:GetTimer():CancelAllTimers( self ) LOCALS["GameStarted"] = false -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) if (player) then RemovePlayerFromGame(self, player) player:ServerSetUserCtrlCompPause{bPaused = false} player:DisplayTooltip{ bShow = true, strText = "Game stopped, not enough players found.", iTime = 5000 } end end LOCALS["PlayerNum"] = 0 LOCALS["NumPlayersFinished"] = 0 end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state LOCALS["PlayerNum"] = 0 LOCALS["NumPlayersFinished"] = 0 LOCALS["CheckpointNum"] = 0 LOCALS["GameStarted"] = false self:SetVar("Finishpos_x", 0) self:SetVar("Finishpos_y", 0) self:SetVar("Finishpos_z", 0) self:SetVar("Finishrotx", 0) self:SetVar("Finishroty", 0) self:SetVar("Finishrotz", 0) self:SetVar("Finishrotw", 0) self:SetVar("FinishThere", 0) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) if (msg.name == "StartGame") then StartGame(self) end if (msg.name == "TimeOut") then AbortGame(self) end if (msg.name == "EndGame") then StopGame(self) end if (msg.name == "Go") then -- iterate through players for pnum = 1, #PLAYERS do local player = GAMEOBJ:GetObjectByID(PLAYERS[pnum]) local playerData = self:GetVar(PLAYERS[pnum]) if (player and playerData) then -- get start time local theTime = GAMEOBJ:GetSystemTime() -- set times in data playerData["startTime"] = theTime playerData["curLapTime"] = theTime self:SetVar(PLAYERS[pnum], playerData) -- unpause player:ServerSetUserCtrlCompPause{bPaused = false} end end end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) local player = msg.playerID -- move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not..... player:Teleport{pos = CONSTANTS["PLAYER_ZONEIN_POS"], bSetRotation = false} player:SetRacingParameters{ fTurnSpeedMult = CONSTANTS["TURN_SPEED_MULT"] } -- unpause player player:ServerSetUserCtrlCompPause{bPaused = false} -- remove all current boards RemoveBoardsFromPlayer(self, player) end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- checkpoint Loaded if (msg.templateID == CONSTANTS["CHECKPOINT_LOT"]) then -- store it local chkpNum = IncrementVarAndReturn("CheckpointNum") CHECKPOINTS[chkpNum] = msg.objectID:GetID() -- update constant CONSTANTS["NUM_CHECKPOINTS"] = #CHECKPOINTS end end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- get player local player = msg.sender -- cancel the missions on the player for now player:CancelMission{ missionID = CONSTANTS["RACE_MISSION_ID"] } -- User wants to retry or start new race if ((msg.iButton == 1 and msg.identifier == "Racing_Summary") or (msg.iButton == 1 and msg.identifier == "Race_Mission")) then print("trigger restart") if (IsGameStarted(self)) then print("ERROR: game is not over yet!") player:DisplayTooltip{ bShow = true, strText = "The race is still running, try again after the race is over.", iTime = 5000 } player:ServerSetUserCtrlCompPause{bPaused = false} return end -- get current players local curplayers = LOCALS["PlayerNum"] if (tonumber(curplayers) < CONSTANTS["MAX_PLAYERS"]) then -- get the player Data local playerData = self:GetVar(player:GetID()) -- store the *new* player data for later use if (not playerData) then AddNewPlayerToGame(self, player) -- we used to be a player so we have player data but -- it should contain nothing elseif (not playerData["ShouldBeEmpty"]) then AddNewPlayerToGame(self, player) else print("ERROR: Player already exists in game!") end else player:DisplayTooltip{ bShow = true, strText = "The race is full, try again after the race is over.", iTime = 5000 } end -- User wants to quit Racing elseif (msg.iButton == 0 and msg.identifier == "Racing_Summary") then print("trigger leave") -- unpause player player:ServerSetUserCtrlCompPause{bPaused = false} end end -------------------------------------------------------------- -- Sent from checkpoints when a player passes them -------------------------------------------------------------- function onCollisionPhantom(self, msg) FlagCheckpoint(self, msg.objectID, msg.senderID:GetID()) end -------------------------------------------------------------- -- Sent from goals when a player passes them -------------------------------------------------------------- function onOffCollisionPhantom(self, msg) FlagLap(self, msg.objectID) end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- function Scene3Startup(self) --moved to CONCERT_STAGE.lua --LoadChoiceBuild(self, 4029, "Concert_Prop_1") --LoadChoiceBuild(self, 4030, "Concert_Prop_2") --LoadChoiceBuild(self, 4031, "Concert_Prop_3") --LoadChoiceBuild(self, 4032, "Concert_Prop_4") end function onScene3OnNotifyObject(self,msg) if msg.name == "Dance_Emote" then end end function LoadChoiceBuild(self, templateID, pathname) --print ("inside Load Choice Build Function------------------") local pathMsg = LEVEL:GetPathWaypoints (pathname) if (tostring(type(pathMsg)) == "table") then for i, v in pairs(pathMsg) do --print ("loading object") RESMGR:LoadObject { objectTemplate = templateID, x = v.pos.x, y = v.pos.y, z = v.pos.z, rw = v.rot.w, rx = v.rot.x, ry = v.rot.y, rz = v.rot.z, owner = self } end end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') --require('L_ZONE_NP_SCENE_1') --require('/zone/NP/L_ZONE_NP_SCENE_3') -------------------------------------------------------------- -- Constants -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS = {} CONSTANTS["NUM_SCENES"] = 4 -------------------------------------------------------------- -- Clears all actors data -------------------------------------------------------------- function ClearActorsData() ACTORS = {} for sceneNum = 1, CONSTANTS["NUM_SCENES"] do ACTORS[sceneNum] = {} end end -------------------------------------------------------------- -- play actions on an object -------------------------------------------------------------- function DoObjectAction(actor, type, action) -- spatial chat if (type == "chat") then actor:DisplayChatBubble{wsText = action} -- animation elseif (type == "anim") then local anim_time = actor:GetAnimationTime{ animationID = action }.time if (tonumber(anim_time) > 0) then actor:PlayAnimation{animationID = action} end -- effect elseif (type == "effect") then actor:PlayFXEffect{name = "N_" .. action, effectType = action } elseif (type == "stopeffects") then actor:StopFXEffect{ name = "N_" .. action } end end -------------------------------------------------------------- -- play actions on all actors in the scene -------------------------------------------------------------- function DoSceneAction(scene, type, action) for actorID = 1, #ACTORS[scene] do -- get the actor out of the scene local actor = GAMEOBJ:GetObjectByID(ACTORS[scene][actorID]) -- perform the action if (actor and actor:Exists()) then DoObjectAction(actor,type,action) end end end -------------------------------------------------------------- -- return if template is a valid actor -------------------------------------------------------------- function IsValidActor(scene, templateID) local sceneStr = "SCENE_" .. scene .. "_VALID_ACTORS" -- list of actors does not exist if (CONSTANTS[sceneStr] == nil) then return false end -- look for a valid actor for actors = 1, #CONSTANTS[sceneStr] do if (templateID == CONSTANTS[sceneStr][actors]) then return true end end return false end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- Scene Specific --Scene1Startup(self) --Scene2Startup(self) --Scene3Startup(self) --Scene4Startup(self) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- Scene Specific --Scene1OnTimerDone(self, msg) --Scene2OnTimerDone(self, msg) --Scene3OnTimerDone(self, msg) --Scene4OnTimerDone(self, msg) end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) end -------------------------------------------------------------- -- Generic notification message -------------------------------------------------------------- function onNotifyObject(self, msg) -- Scene Specific --Scene1OnNotifyObject(self,msg) --Scene2OnNotifyObject(self,msg) --Scene3OnNotifyObject(self,msg) --Scene4OnNotifyObject(self, msg) end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- check for actors within each scene for scene = 1, CONSTANTS["NUM_SCENES"] do if ( IsValidActor(scene, msg.templateID) == true ) then -- store the actor local nextActor = #ACTORS[scene] + 1 ACTORS[scene][nextActor] = msg.objectID:GetID() --print("------------------- Adding Actor(" .. nextActor .. ") ID: " .. msg.objectID:GetID() .. " To scene " .. scene .. " template: " .. msg.templateID) break end end end function onFireEventServerSide(self, msg) --print('onFireEventServerSide ' .. msg.args .. ' ' .. msg.senderID:GetName().name .. ' ' .. msg.param1) if msg.args == "TransferToInstance" then msg.senderID:TransferToZone{ zoneID = msg.param1, ucInstanceType = 1 } --instance type single end end ---------------------------------------------------------------- -- level specific Server script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB -- updated 6/18/10 added tutorial mission stuff ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "ClaimMarker", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "maelstrom", -- the damaging maelstrom cloud FX around the property Enemies = "strombies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXObject", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "StrombieWander","Strombies" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "ClaimMarker", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "MaelstromFX", -- the spawner network for the damaging maelstrom clouds FXSpots = "MaelstromSpots", -- the spawner network for the non-damaging fx spots PropMG = "PropertyGuard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXObject", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "BirdFX","SunBeam" } -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 71, -- when the player builds the claim marker, this flag is set placedModel = 73, -- when a player places a model for the first time, this flag is set guardMission = 891, -- last mission for the guard password = "s3kratK1ttN", -- behavior password build qb object with behaviors generatorID = 10118, --lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 10445 -- lot id of the behavior platform quickbuild } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) if msg.playerID:GetFlag{iFlagID = 108}.bFlag == false then msg.playerID:SetFlag{iFlagID = 108, bFlag = true} end end ---------------------------------------------------------------- -- called when the player places a model ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) local player = msg.playerID --the player placed their first model, set the flag to true if player:GetFlag{iFlagID = 101}.bFlag == false then baseZonePropertyModelPlaced(self,msg,newMsg) --it turns off the spots and sets a player flag player:SetFlag{iFlagID = 101, bFlag = true} -- if they are one the place 4 models mission, update the tutorial if player:GetMissionState{missionID = 871}.missionState == 2 then self:SetNetworkVar("Tooltip","AnotherModel") end -- the player placed a second model, set the flag elseif player:GetFlag{iFlagID = 102}.bFlag == false then player:SetFlag{iFlagID = 102, bFlag = true} -- if they are one the place 4 models mission, update the tutorial if player:GetMissionState{missionID = 871}.missionState == 2 then self:SetNetworkVar("Tooltip","TwoMoreModels") end -- the player placed a third model, set the flag elseif player:GetFlag{iFlagID = 103}.bFlag == false then player:SetFlag{iFlagID = 103, bFlag = true} -- the player placed a third model, set the flag elseif player:GetFlag{iFlagID = 104}.bFlag == false then --tell the client to close a tooltip, if it isnt open, it shouldnt do anything self:SetNetworkVar("Tooltip","TwoMoreModelsOff") player:SetFlag{iFlagID = 104, bFlag = true} --the player has a tooltip telling them to place a model, which they just placed, so it needs to close it elseif self:GetVar("tutorial") == "placeModel" then self:SetVar("tutorial","TutorialOver") self:SetNetworkVar("Tooltip","PutAway") end end ---------------------------------------------------------------- -- called when the player picks up a model ---------------------------------------------------------------- function onZonePropertyModelPickedUp(self, msg) local player = msg.playerID -- first time the player picked up a model, set their flag if player:GetFlag{iFlagID = 109}.bFlag == false then player:SetFlag{iFlagID = 109, bFlag = true} -- if they are on the mission to pick up a model, update the tutorial if player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","Rotate") end end -- if the player has already picked up a model, is on the mission, but hasnt rotated a model, update the tutorial if player:GetFlag{iFlagID = 110}.bFlag == false and player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","Rotate") -- if the player is on the mission, but has done the other to parts, then just turn the tooltip off elseif player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","PickUpModelOff") end end ---------------------------------------------------------------- -- called when the player removes a model from their property ---------------------------------------------------------------- function onZonePropertyModelRemoved(self, msg) local player = msg.playerID -- if this is the first time they have done it, set a flag if player:GetFlag{iFlagID = 111}.bFlag == false then player:SetFlag{iFlagID = 111, bFlag = true} end end ---------------------------------------------------------------- -- called when the player removes a model from their property while its equipped ---------------------------------------------------------------- function onZonePropertyModelRemovedWhileEquipped(self, msg) local player = msg.playerID -- if this is the first time they have done it, set a flag if player:GetFlag{iFlagID = 111}.bFlag == false then player:SetFlag{iFlagID = 111, bFlag = true} end end ---------------------------------------------------------------- -- called when the player enters property edit mode ---------------------------------------------------------------- function onZonePropertyEditBegin(self, msg) -- tell the client the player entered edit mode self:SetNetworkVar("PlayerAction","Enter") end ---------------------------------------------------------------- -- called when the player equips a model ---------------------------------------------------------------- function onZonePropertyModelEquipped(self,msg) -- tell the client the player equipped a model self:SetNetworkVar("PlayerAction","ModelEquipped") end ---------------------------------------------------------------- -- called when the player rotates a model ---------------------------------------------------------------- function onZonePropertyModelRotated(self,msg) local player = msg.playerID -- if the player hasnt rotated a model before, set a flag if player:GetFlag{iFlagID = 110}.bFlag == false then player:SetFlag{iFlagID = 110, bFlag = true} -- if they are on the mission to rotate a model, update the tutorial if player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","PlaceModel") -- used in pickupmodel to close the tooltip self:SetVar("tutorial","placeModel") end end end ---------------------------------------------------------------- -- called when the player leaves property edit mode ---------------------------------------------------------------- function onZonePropertyEditEnd(self, msg) self:SetNetworkVar("PlayerAction","Exit") end ---------------------------------------------------------------- -- called from the generator object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the orb when something collides with it ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) -- send from the guard when the player accepts the mission to rotate, pick up and put away if msg.name == "LastMissionAccepted" then local player = msg.ObjIDSender --check to see if the player already did all the stuff in the tutorial, then skip it if player:GetMissionState{missionID = 891}.missionState ~= 4 then self:SetNetworkVar("Tooltip","ThinkingHat") end end end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end---------------------------------------------------------------- -- level specific Server script for Property Pushback in NS small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "Platform", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "Clouds", -- the damaging maelstrom cloud FX around the property Enemies = "Enemies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "RoninWander","RoninGen","HorsemenGen" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "Platform", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "Clouds", -- the spawner network for the damaging maelstrom clouds FXSpots = "Spots", -- the spawner network for the non-damaging fx spots PropMG = "Guard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "Ash","FX","Fog"} -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 99, -- when the player builds the claim marker, this flag is set placedModel = 107, -- when a player places a model for the first time, this flag is set guardMission = 874, -- last mission for the guard password = "s3kratK1ttN", -- behavior password build qb object with behaviors generatorID = 11023, --lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 11011 -- lot id of the behavior platform quickbuild } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player places a model, the first time it turns off the spots and sets a player flag ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) baseZonePropertyModelPlaced(self,msg,newMsg) end ---------------------------------------------------------------- -- called from the generator object and the claimmarker object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when orb is collided with ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) baseNotifyObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end---------------------------------------------------------------- -- level specific Server script for Property Pushback in NS small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "BehavQB", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "Clouds", -- the damaging maelstrom cloud FX around the property Enemies = "Enemies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "PiratesWander","PiratesGen","AdmiralsWander","AdmiralsGen" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "BehavPlat", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "Clouds", -- the spawner network for the damaging maelstrom clouds FXSpots = "Spots", -- the spawner network for the non-damaging fx spots PropMG = "Guard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "Birds","Falls"}, -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned BehaviorObjs = { "TrappedPlatform", "IceBarrier","FireBeast" } -- Behavior scenerio object } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 98, -- when the player builds the claim marker, this flag is set placedModel = 106, -- when a player places a model for the first time, this flag is set guardMission = 873, -- last mission for the guard password = "s3kratK1ttN", -- behavior password build qb object with behaviors generatorID = 11109, --lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 11001 -- lot id of the behavior platform quickbuild } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player places a model, the first time it turns off the spots and sets a player flag ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) baseZonePropertyModelPlaced(self,msg,newMsg) end ---------------------------------------------------------------- -- called from the generator object and the claimmarker object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when orb is collided with ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) baseNotifyObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end---------------------------------------------------------------- -- Base Server script for property pushback. -- this script is required from a level specific script -- this script will only work with the client script as well ---------------------------------------------------------------- local OwnerChecked = false local GUIDMaelstrom = "{7881e0a1-ef6d-420c-8040-f59994aa3357}" -- ambient sounds for when the Maelstrom is on local GUIDPeaceful = "{c5725665-58d0-465f-9e11-aeb1d21842ba}" -- happy ambient sounds when no maestrom is preset ---------------------------------------------------------------- -- Define empty tables that will be set from the level specific script ---------------------------------------------------------------- local Group = {} local Spawners = {} local Flags = {} ---------------------------------------------------------------- -- variables passed of the level specific script that are used throughout the base script ---------------------------------------------------------------- function setGameVariables(passedGroups,passedSpawners,passedFlags) Group = passedGroups Spawners = passedSpawners Flags = passedFlags end ---------------------------------------------------------------- -- ---------------------------------------------------------------- function checkForOwner(self) -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PropertyPlaque, ignoreSpawners = true }.objects if not propertyPlaques or #propertyPlaques == 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "runPlayerLoadedAgain", self ) return end -- table for property data to be filled out by the for loop below for i = 1, table.maxn(propertyPlaques) do -- check to see if there is more than on object in the property plaque group, if there is, it can seriously break stuff if i > 1 then print("WARNING -- YOU HAVE TO MANY PROPERTY PLAQUES IN THIS LEVEL. Please make sure you only have 1!") break end local propertyData = propertyPlaques[i]:PropertyGetState{} self:SetVar("PropertyOwner",propertyData.ownerID:GetID()) OwnerChecked = true end end ---------------------------------------------------------------- -- ---------------------------------------------------------------- function basePlayerLoaded(self, msg) if OwnerChecked == false then -- only check for owner when the first player enters property checkForOwner(self) end local propertyOwner = self:GetVar("PropertyOwner") -- returns true or false if the property is rented or not local rented = false if propertyOwner ~= 0 then rented = true end local player = msg.playerID -- if the property is rented, delete all the objects that may be on the property if rented == true then -- kill the tornado effect object GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "killFXObject", self ) player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDPeaceful} -- check to see if the player standing on the property is the person who owns the property if player:GetID() ~= propertyOwner then return end -- tell the client script that the property is rented and who the renter is self:SetNetworkVar("renter",propertyOwner) -- flag for if the player has placed a model on this property yet local spotsflag = player:GetFlag{ iFlagID = Flags.placedModel }.bFlag -- check to see if the player has placed a model before, if not spawn the maelstrom spots if spotsflag == false then SpawnSpots(self) end -- if the property hasnt been rented, then assume that this is the players property to rent (if this is broken, it is through code) else -- flag for if the player has defeated the maelstrom property yet local defeatedflag = player:GetFlag{ iFlagID = Flags.defeatedProperty }.bFlag -- tell the client script that the property is not rented self:SetNetworkVar("unclaimed",true) --spawn the spots SpawnSpots(self) self:SetVar("playerID",player:GetID()) -- check to see if the player has defeated the maelstrom before (they could defeat it and leave without renting it) if defeatedflag == false then -- custom function that starts all teh maelstrom StartMaelstrom(self) self:SetVar("playerID",player:GetID()) player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDMaelstrom} else player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDPeaceful} GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "killFXObject", self ) end end if msg.playerID:GetMissionState{missionID = Flags.guardMission}.missionState ~= 8 then ActivateSpawner(self,Spawners.PropMG) -- spawn guard end end ---------------------------------------------------------------- -- returned from the server when the property is rented ---------------------------------------------------------------- function baseZonePropertyRented(self, msg) -- show cinematic of the property bounds being turned on GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "PlayCinematic", paramStr = "ShowProperty" } --msg.playerID:PlayCinematic { pathName = "ShowProperty" } -- delay the property border from being animatated until the camera is looking at it GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "BoundsVisOn",self ) -- delay deleting the guard until the camera isnt looking at him --GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "GuardFlyAway",self ) self:SetVar("PropertyOwner",msg.playerID:GetID()) end ---------------------------------------------------------------- -- message sent when a model is placed on the property ---------------------------------------------------------------- function baseZonePropertyModelPlaced(self, msg) -- check the flag to see if the player has placed a model before, if they haven't deleted the maelstrom spots and set the flag to say they have placed a model if msg.playerID:GetFlag{ iFlagID = Flags.placedModel }.bFlag == false then KillSpots(self) msg.playerID:SetFlag{iFlagID = Flags.placedModel, bFlag=true} end end ---------------------------------------------------------------- -- deletes the maelstrom damaging clouds ---------------------------------------------------------------- function KillClouds(self) DeactivateSpawner(self,Spawners.DamageFX) DestroySpawner(self,Spawners.DamageFX) end ---------------------------------------------------------------- -- activates the spawner for the maelstrom spots ---------------------------------------------------------------- function SpawnSpots(self) ActivateSpawner(self,Spawners.FXSpots) end ---------------------------------------------------------------- -- deactive the spawner for the maelstrom spots and then delete them ---------------------------------------------------------------- function KillSpots(self) DeactivateSpawner(self,Spawners.FXSpots) --DestroySpawner(self,Spawners.FXSpots) local spots = self:GetObjectsInGroup{ group = Group.Spots, ignoreSpawners = true }.objects ObjectRequestDie(self,spots) end ---------------------------------------------------------------- -- turns all the maelstrom on if the player hasn't defeated the maelstrom for this property yet ---------------------------------------------------------------- function StartMaelstrom(self,msg) -- pause the behaviors on the property --local plaque = self:GetObjectsInGroup{ group = Group.PropertyPlaque, ignoreSpawners = true }.objects[1] --plaque:TogglePropertyBehaviors{ bPaused = true} -- activate all the enemy spawners for k,v in ipairs(Spawners.Enemy) do ActivateSpawner(self,v) end if Spawners.BehaviorObjs then for k,v in ipairs(Spawners.BehaviorObjs) do ActivateSpawner(self,v) end end --activate the damaging clouds spawner ActivateSpawner(self,Spawners.DamageFX) -- activeate the spawner for the generator ActivateSpawner(self,Spawners.Generator) ActivateSpawner(self,Spawners.GeneratorFX) ActivateSpawner(self,Spawners.FXManager) ActivateSpawner(self,Spawners.ImagOrb) ActivateSpawner(self,Spawners.Smashables) -- make sure the spawner for the claimmarker is off DeactivateSpawner(self,Spawners.ClaimMarker) ResetSpawner(self,Spawners.ClaimMarker) if Spawners.AmbientFX then for k,v in ipairs(Spawners.AmbientFX) do DeactivateSpawner(self,v) DestroySpawner(self,v) ResetSpawner(self,v) end end -- find the fx manager and turn on the tornado and the clouds local fx = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects[1] if fx then fx:PlayFXEffect{name = "TornadoDebris", effectType = "debrisOn"} fx:PlayFXEffect{name = "TornadoVortex", effectType = "VortexOn"} fx:PlayFXEffect{name = "silhouette", effectType = "onSilhouette"} else print("Warning: No object found in the group "..Group.FXManager) end -- notify the client to change the env settings self:NotifyClientObject{ name = "maelstromSkyOn" } -- have the generator tell the script when it dies sendNotification(self,Group.Generator,"Die","startGenerator") sendNotification(self,Group.ImagOrb,"CollisionPhantom","startOrb") end ---------------------------------------------------------------- -- called when the claim marker and the generator die ---------------------------------------------------------------- function baseNotifyDie(self,other,msg) -- the object that sent the notification local deadObj = other:GetLOT().objtemplate -- the generator died if deadObj == Flags.generatorID then -- spawn the claimmarker quickbuild and tell it to notify when it is rebuilt ActivateSpawner(self,Spawners.ClaimMarker) sendNotification(self,Group.ClaimMarker,"RebuildComplete","startQuickbuild") -- stop the enemies from spawning anymore for k,v in ipairs(Spawners.Enemy) do DeactivateSpawner(self,v) end -- stop the generator spawner from spawning again DeactivateSpawner(self,Spawners.Generator) end end ---------------------------------------------------------------- -- the orb notifies when it have been collided with ---------------------------------------------------------------- function baseNotifyCollisionPhantom(self,other,msg) if other:GetLOT().objtemplate == Flags.orbID then if msg.objectID:GetFaction().faction == 1 then KillClouds(self) --deactivate the generator and claimmarker spawners DeactivateSpawner(self,Spawners.Generator) --DeactivateSpawner(self,Spawners.GeneratorFX) --DeactivateSpawner(self,Spawners.ClaimMarker) local objNotify = self:GetObjectsInGroup{ group = Group.ImagOrb, ignoreSpawners = true }.objects[1] if objNotify then self:SendLuaNotificationCancel{requestTarget= objNotify, messageName="CollisionPhantom"} end for k,v in ipairs(Spawners.Enemy) do DeactivateSpawner(self,v) end DestroySpawner(self,Spawners.GeneratorFX) local player = GAMEOBJ:GetObjectByID(self:GetVar("playerID")) -- start the camera that shows the maelstrom dying GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "PlayCinematic", paramStr = "DestroyMaelstrom" } --player:PlayCinematic { pathName = "DestroyMaelstrom" } -- set the flage that player defeated the maelstrom on this property player:SetFlag{iFlagID = Flags.defeatedProperty, bFlag=true} -- start the timer for the next part GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "tornadoOff",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.7, "KillMarker", self ) end end end ---------------------------------------------------------------- -- the quickbuild spawned from the generator tells this when it is done building ---------------------------------------------------------------- function baseNotifyRebuildComplete(self,other,msg) if msg.rebuildID:GetLOT().objtemplate == Flags.behavQBID then -- the quickbuild has behaviors on it that are looking for this password before they will start self:ChatMessageForZone{strMessage=Flags.password, senderID = 0 } end end ---------------------------------------------------------------- -- when the player leaves the zone, destroy everything to reset the map ---------------------------------------------------------------- function basePlayerExit(self,other,msg) if self:GetNetworkVar("unclaimed") == true then if msg.playerID:GetID() == self:GetVar("playerID") then for k,v in pairs(Spawners) do if type(v) == "table" then for y,z in ipairs(v) do DeactivateSpawner(self,z) DestroySpawner(self,z) ResetSpawner(self,z) end else DeactivateSpawner(self,v) DestroySpawner(self,v) ResetSpawner(self,v) end end end end end ---------------------------------------------------------------- -- tell the generator to notify the script when it dies ---------------------------------------------------------------- function sendNotification(self,obj,msgName,timer) -- grab the generator by its group set in happy flower, assume there is only one generator in the group local objNotify = self:GetObjectsInGroup{ group = obj, ignoreSpawners = true }.objects[1] -- make sure the script got an object if objNotify then -- send the message to the generator object to tell the script when it dies self:SendLuaNotificationRequest{requestTarget= objNotify, messageName=msgName} else -- if the generator doesn't exist yet, try again GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, timer, self ) end end ---------------------------------------------------------------- -- deletes the guard ---------------------------------------------------------------- function KillGuard(self) local Guard = self:GetObjectsInGroup{ group = Group.Guard, ignoreSpawners = true }.objects ObjectRequestDie(self,Guard) DeactivateSpawner(self,Spawners.PropMG) end ---------------------------------------------------------------- -- requests dies for objects ---------------------------------------------------------------- function ObjectRequestDie(self,objTable) if objTable then for k,v in ipairs(objTable) do v:RequestDie{ killerID = self, killtype = "VIOLENT" } end end end ---------------------------------------------------------------- -- activates spawners ---------------------------------------------------------------- function DestroySpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerDestroyObjects() else print('WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- activates spawners ---------------------------------------------------------------- function ActivateSpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerActivate() else print('WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- deactivates spawners ---------------------------------------------------------------- function DeactivateSpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerDeactivate() else print('WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- resets spawners ---------------------------------------------------------------- function ResetSpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerReset() else print('WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- called when a timer is done ---------------------------------------------------------------- function baseTimerDone(self,msg) if msg.name == "startGenerator" then -- tell the generator to notify the script when it dies sendNotification(self,Group.Generator,"Die","startGenerator") elseif msg.name == "startOrb" then -- tell the generator to notify the script when it dies sendNotification(self,Group.ImagOrb,"CollisionPhantom","startOrb") elseif msg.name == "startQuickbuild" then -- tell the generator to notify the script when it dies sendNotification(self,Group.ClaimMarker,"RebuildComplete","startQuickbuild") elseif msg.name == "GuardFlyAway" then -- the guard is "flying" away, delete him and turn the boundry animation on if LEVEL:GetCurrentZoneID() ~= 1150 then local Guard = self:GetObjectsInGroup{ group = Group.Guard, ignoreSpawners = true }.objects[1] GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "GuardChat", paramObj = Guard } GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "KillGuard", self ) end -- tell the client script to play the animation on the boundry asset elseif msg.name == "KillGuard" then KillGuard(self) elseif msg.name == "tornadoOff" then -- finds the fx manager local fx = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects[1] -- turn the tornado and vortex fx off if fx then fx:StopFXEffect{name = "TornadoDebris"} fx:StopFXEffect{name = "TornadoVortex"} fx:StopFXEffect{name = "silhouette"} else print("Warning: No object found in the group "..Group.FXManager) end GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "ShowClearEffects", self ) elseif msg.name == "ShowClearEffects" then -- finds the fx manager local fx = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects[1] -- play the light in the center of the property to show the maelstrom being defeated if fx then fx:PlayFXEffect{name = "beam", effectType = "beamOn"} else print("Warning: No object found in the group "..Group.FXManager) end GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "killStrombies", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5, "turnSkyOff", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 8, "killFXObject", self ) elseif msg.name == "turnSkyOff" then GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "SkyOff" } elseif msg.name == "killStrombies" then -- kill all the enemies local enemies = self:GetObjectsInGroup{ group = Group.Enemies }.objects ObjectRequestDie(self,enemies) -- finds the fx manager DeactivateSpawner(self,Spawners.Smashables) DestroySpawner(self,Spawners.Smashables) local player = GAMEOBJ:GetObjectByID(self:GetVar("playerID")) player:Stop2DAmbientSound{m_NDAudioEventGUID = GUIDMaelstrom } -- kill the maelstrom windy sound player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDPeaceful}-- start the happy bird sounds -- tell the client script to turn on the normal property env settings GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "ShowVendor", self ) elseif msg.name == "KillMarker" then -- kill the claimmarker DeactivateSpawner(self,Spawners.ClaimMarker) DestroySpawner(self,Spawners.ClaimMarker) if Spawners.BehaviorObjs then for k,v in ipairs(Spawners.BehaviorObjs) do DeactivateSpawner(self,v) DestroySpawner(self,v) end end --DestroySpawner(self,Spawners.ClaimMarker) local orb = self:GetObjectsInGroup{ group = Group.ImagOrb }.objects ObjectRequestDie(self,orb) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "ShowVendor", self ) elseif msg.name == "ShowVendor" then -- tell the client script to show the vendor GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "vendorOn" } if Spawners.AmbientFX then for k,v in ipairs(Spawners.AmbientFX) do ActivateSpawner(self,v) end end elseif msg.name == "BoundsVisOn" then -- tell the client script to turn the boundry on --GAMEOBJ:GetZoneControlID():NotifyClientObject{name = "boundsOn" } GAMEOBJ:GetZoneControlID():NotifyClientObject{name = "boundsAnim" } elseif msg.name == "runPlayerLoadedAgain" then checkForOwner(self) elseif msg.name == "killFXObject" then local fxT = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects local fx = fxT[1] --stop the light fx if fx then fx:StopFXEffect{name = "beam"} -- kill the fx object DestroySpawner(self,Spawners.FXManager) else print("Warning: No object found in the group "..Group.FXManager) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "killFXObject", self ) end end end---------------------------------------------------------------- -- level specific Server script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "ClaimMarker", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "maelstrom", -- the damaging maelstrom cloud FX around the property Enemies = "strombies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXObject" -- the hidden object underground (small yellow box) that controls all the env fx for the map } --Spawner networks, set in happy flower local Spawners = { enemy = { "StrombieWander","Strombies" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed claimMarker = "ClaimMarker", --the spawner network for the claim marker, should only be one node generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "MaelstromFX", -- the spawner network for the damaging maelstrom clouds FXSpots = "MaelstromSpots", -- the spawner network for the non-damaging fx spots PropMG = "PropertyGuard" -- spawns the mission giver for this property } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 71, -- when the player builds the claim marker, this flag is set placedModel = 73 -- when a player places a model for the first time, this flag is set } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- function onStartup(self) setGameVariables(Group,Spawners,flags) baseStartup(self,msg,newMsg) end ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player places a model, the first time it turns off the spots and sets a player flag ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) baseZonePropertyModelPlaced(self,msg,newMsg) end ---------------------------------------------------------------- -- called from the generator object and the claimmarker object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) baseNotifyObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end---------------------------------------------------------------- -- level specific Server script for Property Pushback in NS small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "Rhino", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "Clouds", -- the damaging maelstrom cloud FX around the property Enemies = "Enemies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "StrombieWander","StrombieGen","PirateWander","PirateGen","RoninGen" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "ClaimMarker", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "MSClouds", -- the spawner network for the damaging maelstrom clouds FXSpots = "Spots", -- the spawner network for the non-damaging fx spots PropMG = "Guard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "Rockets"}, -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned BehaviorObjs = { "Cage", "Platform","Door" } -- Behavior scenerio object } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 97, -- when the player builds the claim marker, this flag is set placedModel = 105, -- when a player places a model for the first time, this flag is set guardMission = 872, -- last mission for the guard password = "s3kratK1ttN", -- behavior password build qb object with behaviors generatorID = 11031, --lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 11009 -- lot id of the behavior platform quickbuild } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player places a model, the first time it turns off the spots and sets a player flag ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) baseZonePropertyModelPlaced(self,msg,newMsg) end ---------------------------------------------------------------- -- called from the generator object and the claimmarker object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when orb is collided with ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) baseNotifyObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end function onFireEvent(self,msg) if msg.args == 'fireEvent' then print('fire event') end endlocal waveTime = 20.0 local waveNum = 1 --local timeSurvived = 0 function onStartup(self) print("starting up") end function onRebuildNotifyState(self, msg) if (msg.iState == 2) then print("Wave " .. tostring(waveNum) .. " GO!") GAMEOBJ:GetTimer():AddTimerWithCancel(waveTime, "WaveTimer", self) --local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) end end function onPlayerDied(self) GAMEOBJ:GetTimer():CancelAllTimers(self) --timeSurvived = waveNum * 20 - waveTime print("You survived for " .. tostring(waveNum - 1) .. " waves!") end function onTimerDone(self, msg) waveNum = waveNum + 1 print("Wave " .. tostring(waveNum) .. " GO!") GAMEOBJ:GetTimer():AddTimerWithCancel(waveTime, "WaveTimer", self) --[[if waveTime == 10.0 then print("Only 10 seconds left in the wave!") end--]] end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') -- @TODO: Add Path Changing on waypoint, need to get [Closest Waypoint on New Path] -- Also need [Number of Waypoints on Path] -- @TODO: Optimize -------------------------------------------------------------- -- Locals and Constants LOCALS = {} CONSTANTS = {} -------------------------------------------------------------- -- Start Location for the Zone CONSTANTS["PLAYER_START_POS"] = {x = -905.00, y = 234, z = 2.31} CONSTANTS["PLAYER_START_ROT"] = {w = 0.91913521289825, x = 0, y = 0.39394217729568, z = 0} CONSTANTS["SPAWN_PATH_NAME"] = "skunknodes" SPAWNPOINTS = {} -- cannon constants CONSTANTS["CANNON_TEMPLATEID"] = 3879 CONSTANTS["CANNON_PLAYER_OFFSET"] = {x = -5.624, y = 0, z = -2.451} CONSTANTS["CANNON_VELOCITY"] = 80.0 CONSTANTS["CANNON_MIN_DISTANCE"] = 10.0 CONSTANTS["CANNON_REFIRE_RATE"] = 800.0 CONSTANTS["CANNON_BARREL_OFFSET"] = {x = 0, y = 4.3, z = 9} CONSTANTS["CANNON_TIMEOUT"] = -1 CONSTANTS["CANNON_FOV"] = 58.6 CONSTANTS["CANNON_USE_LEADERBOARDS"] = true -- for Animations CONSTANTS["VALID_ACTORS"] = {3109, 3110, 3111, 3112, 3125, 3126} ACTORS = {} -- stores actors for the instance -- for Effects CONSTANTS["VALID_EFFECTS"] = {3122} EFFECTS = {} -- stores effects for the instance -- cannon impact skills --CONSTANTS["CANNON_IMPACT_SKILL"] = {34, 34, 61, 62} --CONSTANTS["CANNON_RETICULE_EFFECT"] = {"inRange", "inRange", "inRange2", "inRange3"} -------------------------------------------------------------- -- Wave Data waves = {} PLAYER_SCORE = {} -------------------------------------------------------------- -- Syntax: [Time] [Text to Show Player] -------------------------------------------------------------- AddWave(waves, 30.0, "Wave;One" ) AddWave(waves, 45.0, "Wave;Two" ) AddWave(waves, 45.0, "Wave;Three" ) AddWave(waves, 60.0, "Wave;Four" ) -- wave constants CONSTANTS["NUM_WAVES"] = #waves CONSTANTS["FIRST_WAVE_START_TIME"] = 4.0 CONSTANTS["IN_BETWEEN_WAVE_PAUSE"] = 3.0 CONSTANTS["STREAK_MOD"] = 2 CONSTANTS["STREAK_BONUS"] = {1,2,5,10} -------------------------------------------------------------- -- Spawn Data spawns = {} SPAWN_DATA = {} -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- AddSpawn - configures data for the spawn and adds it. Can -- only have one. -- Syntax: AddSpawn(spawn, paths, [Template ID], -- [Initial Spawn Time Min], [Initial Spawn Time Max], [Does Respawn], -- [Respawn Time Min], [Respawn Time Max], -- [Initial Speed], [Score], [Change Speed at Waypoints], -- [Chance to Change Speed], [Min Speed], [Max Speed], -- [Is Moving Platform], [Despawn On Last Waypoint], [Time Score]) -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} -------------------------------------------------------------- -- Medium Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Medium Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 2 Spawns spawn = {} -------------------------------------------------------------- -- Medium Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Medium Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk5 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk6 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 3 Spawns spawn = {} -------------------------------------------------------------- -- Medium Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Medium Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Mama Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "MamaSkunk1") AddPath(paths, "MamaSkunk2") AddPath(paths, "MamaSkunk3") AddSpawn(spawn,paths, 3898, 5, 15, true, 5, 15, 4.0, 100, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk5 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk6 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk7 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 4 Spawns spawn = {} -------------------------------------------------------------- -- Medium Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Medium Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Skunk1") AddPath(paths, "Skunk2") AddSpawn(spawn,paths, 3719, 4, 10, true, 4, 10, 4.0, 50, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Mama Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "MamaSkunk1") AddPath(paths, "MamaSkunk2") AddPath(paths, "MamaSkunk3") AddSpawn(spawn,paths, 3898, 5, 15, true, 5, 15, 4.0, 100, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Mama Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "MamaSkunk1") AddPath(paths, "MamaSkunk2") AddPath(paths, "MamaSkunk3") AddSpawn(spawn,paths, 3898, 5, 15, true, 5, 15, 4.0, 100, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk5 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk6 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk7 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk8 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk9 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Baby Skunk10 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "BabySkunk1") AddPath(paths, "BabySkunk2") AddPath(paths, "BabySkunk3") AddPath(paths, "BabySkunk4") AddPath(paths, "BabySkunk5") AddPath(paths, "BabySkunk6") AddPath(paths, "BabySkunk7") AddSpawn(spawn,paths, 3899, 0.1, 0.1, true, 0.1, 0.1, 4.0, 25, false, 0.0, 1.0, 1.0, false, false, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Helper Functions -------------------------------------------------------------- -------------------------------------------------------------- -- play effects on all effects in the scene -------------------------------------------------------------- function PlaySceneEffect(effectName) -- trigger effects on effect objects for effectID = 1, #EFFECTS do local effect = GAMEOBJ:GetObjectByID(EFFECTS[effectID]) effect:PlayFXEffect{ effectType = effectName } end end -------------------------------------------------------------- -- play animations on all actors in the scene, and others -------------------------------------------------------------- function PlaySceneAnimation(anim, bPlayCannon, bPlayPlayer) -- play animation on actors for actorID = 1, #ACTORS do local actor = GAMEOBJ:GetObjectByID(ACTORS[actorID]) actor:PlayAnimation{ animationID = anim } end -- play on cannon if (bPlayCannon == true) then local cannon = getObjectByName("cannonObject") cannon:PlayAnimation{ animationID = anim } end -- play on player if (bPlayPlayer == true) then local player = getObjectByName("activityPlayer") player:PlayAnimation{ animationID = anim } end end -------------------------------------------------------------- -- return if template is a valid actor -------------------------------------------------------------- function IsValidActor(templateID) for actors = 1, #CONSTANTS["VALID_ACTORS"] do if (templateID == CONSTANTS["VALID_ACTORS"][actors]) then return true end end return false end -------------------------------------------------------------- -- return if template is a valid effect -------------------------------------------------------------- function IsValidEffect(templateID) for effects = 1, #CONSTANTS["VALID_EFFECTS"] do if (templateID == CONSTANTS["VALID_EFFECTS"][effects]) then return true end end return false end -------------------------------------------------------------- -- put the player in the cannon, does not start the cannon -------------------------------------------------------------- function enterCannon(self) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both start it if ((cannon) and (player)) then cannon:RequestActivityEnter{bStart = false, userID = player} end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both start it if ((cannon) and (player)) then -- put the player in if we have to, otherwise start if ((cannon:GetActivityUser().userID):GetID() ~= player:GetID()) then print("wrong player") cannon:RequestActivityEnter{bStart = true, userID = player} else print("starting game") cannon:ActivityStart{ rerouteID = player } end DoGameStartup(self) end end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bCanceling) -- get the cannon local cannon = getObjectByName("cannonObject") -- get the player local player = getObjectByName("activityPlayer") -- if we have both stop it if we need to, but dont exit if ((cannon) and (player)) then print("stopping game") cannon:ActivityStop{rerouteID = player, bExit = false, bUserCanceled = bCanceling} DoGameShutdown(self) -- if we are not exiting, shwo the summary and allow for retry if (bCanceling == false) then showSummaryDialog(self) end end end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 LOCALS["GameStarted"] = true LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 -- reset scores for waveNum = 1, tonumber(CONSTANTS["NUM_WAVES"]) do PLAYER_SCORE[waveNum] = 0 end -- start the first wave LOCALS["ThisWave"] = 1 GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["FIRST_WAVE_START_TIME"], "SpawnWave1",self ) -- Scene animations and wave number DISABLED for start, we use 3/2/1/Go instead -- play wave animation on actors, cannon, and player --PlaySceneAnimation("wave" .. LOCALS["ThisWave"], true, true) -- display wave number to player --DisplayWaveNumberToPlayer(self, LOCALS["ThisWave"]) -- set the cannon reticule back to start setCannonReticuleSize(self, 1) end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) print("game shutdown") LOCALS["GameStarted"] = false -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- Remove the player from the zone -------------------------------------------------------------- function RemovePlayerFromZone(self, player) player:ServerSetUserCtrlCompPause{bPaused = false} -- UNCOMMENT to go back to the other zone player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end -------------------------------------------------------------- -- Get a random path -------------------------------------------------------------- function GetRandomPath(spawn) -- pick a random local ran = math.random(1,#spawn.path) return spawn.path[ran] end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self, bSpawnNow) -- get the current spawn number local spawnNum = IncrementVarAndReturn("SpawnNum") -- save the spawn data for the object when it is loaded local SpawnData = {sdTemplate = spawn.id, sdRespawn = spawn.bRespawn, sdSpeed = spawn.speed, sdScore = spawn.score, sdPath = GetRandomPath(spawn), sdnum = num, sdChangeSpeed = spawn.bChangeSpeed, sdSpeedChance = spawn.speedChangeChance, sdMinSpeed = spawn.minSpeed, sdMaxSpeed = spawn.maxSpeed, sdMovingPlat = spawn.bMovingPlatform, sdDespawnTime = spawn.despawnTime, sdTimeScore = spawn.timeScore, bSpawned = false} -- store the data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum -- spawn now and use initial spawn times if (bSpawnNow == true) then if (spawn.initSpawnTimeMin > 0 and spawn.initSpawnTimeMax > 0) then local ranSpawnTime = (math.random() * (spawn.initSpawnTimeMax - spawn.initSpawnTimeMin)) + spawn.initSpawnTimeMin print ("init spawning with time " .. ranSpawnTime) GAMEOBJ:GetTimer():AddTimerWithCancel( ranSpawnTime, timerName, self ) else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, timerName, self ) end -- respawn, use respawn times elseif (spawn.bRespawn == true) then -- pick a random spawn time local ranSpawnTime = (math.random() * (spawn.maxTime - spawn.minTime)) + spawn.minTime GAMEOBJ:GetTimer():AddTimerWithCancel( ranSpawnTime, timerName, self ) end end -------------------------------------------------------------- -- destroys all spawns -------------------------------------------------------------- function DestroyAllSpawns(self) local maxSpawnNum = LOCALS["CurSpawnNum"] for spawn = 1, maxSpawnNum do -- @TODO: (Optimize this) local spawnObject = getObjectByName("spawnObject" .. spawn) if (spawnObject) then if (spawnObject:Exists() and not spawnObject:IsDead().bDead) then print("removing spawn object " .. spawn) spawnObject:Die{killerID = spawnObject, killType = "SILENT"} end end end -- reset vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 end -------------------------------------------------------------- -- sends a message to display the current wave text to player -------------------------------------------------------------- function DisplayWaveNumberToPlayer(self, waveNum) -- @TODO: (Optimize) local player = getObjectByName("activityPlayer") if (player) then UI:SendMessage("ToggleFlashingText", { {"visible", true }, {"text", waves[tonumber(waveNum)].waveStr}}) end end -------------------------------------------------------------- -- look through spawn data to find the most recent data -- that matches the template, returns nil or data -------------------------------------------------------------- function GetLatestSpawnDataByTemplate(self,templateID) local spawnNum = LOCALS["SpawnNum"] while (spawnNum > 0) do -- get the data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] -- check spawn flag and template if (SpawnData.bSpawned == false and templateID == SpawnData.sdTemplate) then -- set spawned flag SpawnData.bSpawned = true -- re-save data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- return the good data return SpawnData end -- try prev spawn data spawnNum = spawnNum - 1 end return nil end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self) -- get player local player = getObjectByName("activityPlayer") if (player) then -- do summary dialog -- Wave Score local score = LOCALS["GameScore"] --local strText = "Score:\n\n" --for wavenum = 1, tonumber(CONSTANTS["NUM_WAVES"]) do -- strText = strText .. "Wave " .. wavenum .. " = " .. PLAYER_SCORE[tonumber(wavenum)] .. "\n" --end -- Total Score --strText = strText .. "\nTotal: " .. score .. "\n" -- Accuracy --strText = strText .. "\nAccuracy: " .. LOCALS["NumKills"] .. "/" .. LOCALS["NumShots"] .. "\n" -- Highest Streak --strText = strText .. "\Highest Streak: " .. LOCALS["MaxStreak"] .. "\n" local cannon = getObjectByName("cannonObject") local msgReward = cannon:GetActivityReward{ playerID = player } --print("rewardMoney = " .. tostring(msgReward.rewardMoney)) player:ShowActivitySummary{ totalScore = score, waveScore1 = PLAYER_SCORE[1], waveScore2 = PLAYER_SCORE[2], waveScore3 = PLAYER_SCORE[3], waveScore4 = PLAYER_SCORE[4], numShots = LOCALS["NumShots"], numKills = LOCALS["NumKills"], longestStreak = LOCALS["MaxStreak"], leaderboard_yourRank = 1, --@TODO: We don't have leaderboards, replace this when we do! leaderboard_topScore = 100, --@TODO: We don't have leaderboards, replace this when we do! leaderboard_yourTopScore= 100, --@TODO: We don't have leaderboards, replace this when we do! rewardMoney = msgReward.rewardMoney, rewardItem1Name = msgReward.rewardItem1Name, rewardItem1Image = msgReward.rewardItem1Image, rewardItem1StackSize = msgReward.rewardItem1StackSize, rewardItem2Name = msgReward.rewardItem2Name, rewardItem2Image = msgReward.rewardItem2Image, rewardItem2StackSize = msgReward.rewardItem2StackSize, callbackObj = GAMEOBJ:GetZoneControlID()} if (cannon) then cannon:RequestActivitySummaryLeaderboardData{ user = player } end end end -------------------------------------------------------------- -- set the cannon's reticule size and skill based on wave -------------------------------------------------------------- function setCannonReticuleSize(self, waveNum) local cannon = getObjectByName("cannonObject") cannon:SetShootingGalleryReticuleEffect{ inRangeType = "SkunkSG" } end -------------------------------------------------------------- -- Add more time to the current wave timer -------------------------------------------------------------- function AddTimeToWave(self, timeToAdd) -- get wave number local waveNum = LOCALS["ThisWave"] -- check on next wave waveNum = waveNum + 1 -- get correct timer name local timerName = "GameOver" if (waveNum <= CONSTANTS["NUM_WAVES"]) then timerName = "SpawnWave" .. waveNum end -- get the time left local theTime = GAMEOBJ:GetTimer():GetTime(timerName,self ) if (theTime > 0.0) then -- cancel timer and add a new one with more time GAMEOBJ:GetTimer():CancelTimer(timerName, self) theTime = theTime + timeToAdd GAMEOBJ:GetTimer():AddTimerWithCancel( theTime, timerName, self ) -- get the cannon local cannon = getObjectByName("cannonObject") cannon:AddActivityTime{ rerouteID = getObjectByName("activityPlayer"), timeToAdd = timeToAdd } end end function RecordPlayerWaveScore(self) -- get wave number local waveNum = tonumber(LOCALS["ThisWave"]) -- get the cannon local cannon = getObjectByName("cannonObject") if (waveNum) and (waveNum > 0) and (cannon) then -- get total current score local score = tonumber(cannon:GetActivityPoints().points) -- to get the wave score we must subtract prior waves from it for waves = 1, waveNum - 1 do score = score - PLAYER_SCORE[waves] end -- store the new score PLAYER_SCORE[waveNum] = score end end function LoadSpawnPoints(self) local pathMsg = LEVEL:GetPathWaypoints(CONSTANTS["SPAWN_PATH_NAME"]) if (tostring(type(pathMsg)) == "table") then for i, v in pairs(pathMsg) do SPAWNPOINTS[i] = v end end end -------------------------------------------------------------- -- Game Message Handlers -------------------------------------------------------------- -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 print("Starting up") --LoadSpawnPoints(self) end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- onTimerDone = function(self, msg) -- parse the name to get out the wave number -- use the wave number to select the spawns -- of format "SpawnWaveXXX" where XXX is the spawn number if (string.starts(msg.name,"SpawnWave")) then if (LOCALS["GameStarted"] == true) then setCannonReticuleSize(self, 1) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- store this wave number waveNum = LOCALS["ThisWave"] print("Spawning Wave " .. waveNum) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self,true) end -- move to the next wave --waveNum = waveNum + 1 -- there are no more waves left -- so stop game after this wave if (tonumber(waveNum) >= CONSTANTS["NUM_WAVES"]) then -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( waves[tonumber(waveNum)].timeLimit, "GameOver", self ) else -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( waves[tonumber(waveNum)].timeLimit, "EndWave" .. waveNum,self ) end local cannon = getObjectByName("cannonObject") local player = getObjectByName("activityPlayer") if cannon and player then cannon:StartActivityTime{ rerouteID = player, startTime = waves[tonumber(waveNum)].timeLimit } cannon:ActivityPause{ rerouteID = player, bPause = false } end end end -- called when a wave ends, contains the number of the next wave if (string.starts(msg.name,"EndWave")) then if (LOCALS["GameStarted"] == true) then -- get rid of current spawns DestroyAllSpawns(self) -- cancel all timers GAMEOBJ:GetTimer():CancelAllTimers( self ) -- record the score RecordPlayerWaveScore(self) -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,8) -- store the next wave number waveNum = tonumber(waveNum) + 1 LOCALS["ThisWave"] = waveNum -- @TODO: Do whatever we need to during the pause, wave begins after pause -- play wave animation on actors, cannon, and player PlaySceneAnimation("skunkwave" .. LOCALS["ThisWave"], true, true) -- display wave number to player DisplayWaveNumberToPlayer(self, waveNum) -- there are no more waves left -- so stop game after this wave if (waveNum > CONSTANTS["NUM_WAVES"]) then -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "GameOver", self ) else -- setup next wave GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["IN_BETWEEN_WAVE_PAUSE"], "SpawnWave" .. waveNum,self ) end local player = getObjectByName("activityPlayer") local cannon = getObjectByName("cannonObject") if player and cannon then cannon:ActivityPause{rerouteID = player, bPause = true} end end end -- parse the name to get out the spawn number -- use the spawn number to select the template id -- load the object -- of format "DoSpawnXXX" where XXX is the spawn number if (string.starts(msg.name,"DoSpawn")) then if (LOCALS["GameStarted"] == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] local templateID = SpawnData.sdTemplate --print("spawning " .. spawnNum) -- get the position of the first waypoint local startPos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) local config = {{"spawndata", SpawnData}, {"streakmod", CONSTANTS["STREAK_MOD"]}, {"streakbonus", CONSTANTS["STREAK_BONUS"]}} -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = startPos.x, y = startPos.y, z = startPos.z, owner = self, configData = config} end end -- end the game if (msg.name == "GameOver") then RecordPlayerWaveScore(self) stopGame(self, false) end end -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- look through spawn data to find the most recent data -- that matches the template --local SpawnData = GetLatestSpawnDataByTemplate(self,msg.templateID) local SpawnData = msg.childID:GetVar("spawndata") if (SpawnData) then local curSpawnNum = IncrementVarAndReturn("CurSpawnNum") -- store spawn for use later storeObjectByName("spawnObject" .. curSpawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child (@TODO: Need to Optimize) msg.childID:SetVar("SpawnData", SpawnData) if (SpawnData.sdMovingPlat == true) then msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } msg.childID:SetMovingPlatformParams{ wsPlatformPath = SpawnData.sdPath, iStartIndex = 0 } else -- assign child's waypoint msg.childID:SetVar("attached_path",SpawnData.sdPath) msg.childID:SetVar("attached_path_start",0) -- start child on path msg.childID:FollowWaypoints() msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } end else -- error print("Error: Spawned object " .. msg.templateID .. " but saved data not found for it!") end end -------------------------------------------------------------- -- Called when Player Loads into Zone -------------------------------------------------------------- function onPlayerLoaded(self, msg) print ("Player Entered: " .. msg.playerID:GetName().name) -- stun and move player to level start location -- @TODO: Sometimes this teleport works and sometimes it does not.....ghosting distance? local player = msg.playerID player:ServerSetUserCtrlCompPause{bPaused = true} player:CancelMission{ missionID = 30 } -- player:Teleport{pos = CONSTANTS["PLAYER_START_POS"], -- x = CONSTANTS["PLAYER_START_ROT"].x, -- y = CONSTANTS["PLAYER_START_ROT"].y, -- z = CONSTANTS["PLAYER_START_ROT"].z, -- w = CONSTANTS["PLAYER_START_ROT"].w, -- bSetRotation = true} if (LOCALS["GameStarted"] == false) then -- get the player local player = getObjectByName("activityPlayer") -- store the player for later use if (player == nil) then storeObjectByName("activityPlayer", msg.playerID) end -- put the player in the cannon enterCannon(self) end end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- function onObjectLoaded(self, msg) -- Cannon Object Loaded if (msg.templateID == CONSTANTS["CANNON_TEMPLATEID"]) then -- Override the cannon shooting parameters msg.objectID:SetShootingGalleryParams{playerPosOffset = CONSTANTS["CANNON_PLAYER_OFFSET"], projectileVelocity = CONSTANTS["CANNON_VELOCITY"], cooldown = CONSTANTS["CANNON_REFIRE_RATE"], muzzlePosOffset = CONSTANTS["CANNON_BARREL_OFFSET"], minDistance = CONSTANTS["CANNON_MIN_DISTANCE"], timeLimit = CONSTANTS["CANNON_TIMEOUT"], cameraFOV = CONSTANTS["CANNON_FOV"], bUseLeaderboards = CONSTANTS["CANNON_USE_LEADERBOARDS"]} -- store the cannon object for use later storeObjectByName("cannonObject", msg.objectID) if (LOCALS["GameStarted"] == false) then -- try to put hte player in the cannon enterCannon(self) end -- check for actors elseif ( IsValidActor(msg.templateID) == true ) then -- store the actor local nextActor = #ACTORS + 1 ACTORS[nextActor] = msg.objectID:GetID() -- check for effects elseif ( IsValidEffect(msg.templateID) == true ) then -- store the actor local nextEffect = #EFFECTS + 1 EFFECTS[nextEffect] = msg.objectID:GetID() end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- save the score and time for later use LOCALS["GameScore"] = msg.fValue1 LOCALS["GameTime"] = msg.fValue2 LOCALS["NumShots"] = msg.fValue3 -- shots fired LOCALS["NumKills"] = msg.fValue4 -- targets hit LOCALS["MaxStreak"] = msg.fValue5 -- max streak -- also return the score as the result for the activity msg.outActivityRating = msg.fValue1 return msg end -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- make sure this is the right player local player = getObjectByName("activityPlayer") if (player:GetID() == msg.sender:GetID()) then if msg.identifier == "Shooting_Gallery_Summary" then strText = "Retry?" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Retry"} else -- User wants to retry or is closing the big help to start the game if ((msg.iButton == 1 and msg.identifier == "Shooting_Gallery_Retry") or (msg.identifier == "SkunkSG")) then startGame(self) -- User wants to quit elseif (msg.iButton == 0 and msg.identifier == "Shooting_Gallery_Retry") then -- called before we leave the cannon, so we can trigger a loading screen -- as soon as possible. Should still remove player from cannon on server RemovePlayerFromZone(self, player) -- get the cannon and exit local cannon = getObjectByName("cannonObject") if (cannon) then cannon:RequestActivityExit{userID = player, bUserCancel = false} end end end end end -------------------------------------------------------------- -- Sent from the spawn objects on death -------------------------------------------------------------- function onUpdateMissionTask(self, msg) if msg.taskType ~= "kill" then -- get this wave number local waveNum = tonumber(LOCALS["ThisWave"]) if (LOCALS["GameStarted"] == true) and (waveNum) and (waveNum > 0) then -- get the spawn data (@TODO: Need to Optimize) local spawnData = msg.target:GetVar("SpawnData") -- spawn the right object if (spawnData) and (spawnData.sdRespawn == true) then SpawnObject(spawnData.sdnum,spawns[waveNum][spawnData.sdnum],self,false) end -- check for time adding, disregard if death was SILENT if (spawnData.sdTimeScore > 0.0 and msg.taskType ~= "SILENT") then AddTimeToWave(self,spawnData.sdTimeScore) end end end end -------------------------------------------------------------- -- User is exiting via cancel -------------------------------------------------------------- function onRequestActivityExit(self, msg) if (msg.bUserCancel == true) then stopGame(self,msg.bUserCancel) RemovePlayerFromZone(self, msg.userID) end end -------------------------------------------------------------- -- Cannon is firing -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- play fire animation on actors PlaySceneAnimation("fire", false, false) PlaySceneEffect("fire") end function onNotifyObject(self, msg) if msg.name == "escaped" then --skunk has escaped, penalize player local score = msg.ObjIDSender:GetActivityPoints() score.points = score.points * -1 msg.ObjIDSender:NotifyObject{name = "setpoints", param1 = score.points, param2 = score.addTime} getObjectByName("cannonObject"):UpdateMissionTask{target = msg.ObjIDSender, taskType = "kill"} end end------------------------------------------------------------------------------ --paradox refinery pipe quickbuilds that update the mission once all are built -- --Created by SY 7/28/10 ------------------------------------------------------------------------------ function onRebuildComplete(self, msg) local myGroup = "AllPipes" local groupObjs = self:GetObjectsInGroup{ group = myGroup, ignoreSpawners = true }.objects local indexCount = 0 self:SetVar("PlayerID", "|" .. msg.userID:GetID()) for k,v in ipairs(groupObjs) do if v:GetRebuildState().iState == 2 then indexCount = indexCount + 1 end end if indexCount >= 2 then local refinery = self:GetObjectsInGroup{ group = "Paradox", ignoreSpawners = true }.objects[1] if refinery then refinery:PlayFXEffect{name = "pipeFX", effectID = 3999, effectType = "create"} end for k,v in ipairs(groupObjs) do local player = GAMEOBJ:GetObjectByID(v:GetVar("PlayerID")) if player and player:Exists() then player:UpdateMissionTask{taskType = "complete", value = 769, value2 = 1, target = self} player:PlayCinematic{pathName = "ParadoxPipeFinish", leadIn = 2.0} end v:SetVar("PlayerID", false) end end end function onRebuildNotifyState(self, msg) if msg.iState == 4 then local refinery = self:GetObjectsInGroup{ group = "Paradox", ignoreSpawners = true }.objects[1] if refinery then refinery:StopFXEffect{name = "pipeFX"} end end end -------------------------------------------------------------- -- Base Server side Foot Race script -- updated mrb... 9/1/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') function onStartup(self) local zControl = GAMEOBJ:GetZoneControlID() self:AddObjectToGroup{group = "FootRaceStarter"} self:SendLuaNotificationRequest{requestTarget = zControl, messageName = "PlayerExit"} end function onShutdown(self) self:SendLuaNotificationCancel{requestTarget = zControl, messageName = "PlayerExit"} end function onFireEventServerSide(self, msg) --print('onFireEventServerSide ' .. msg.args) local tArgs = split(msg.args, "_") local player = false if tArgs[2] then player = GAMEOBJ:GetObjectByID(tArgs[2]) end if player then if tArgs[1] == "updatePlayer" then UpdatePlayer(self, player) --UpdatePlayer(self, player, removePlayer) elseif IsPlayerInActivity(self, player) then if tArgs[1] == "initialActivityScore" then -- turn on the player flag for is player in foot race player:SetFlag{iFlagID = 115, bFlag = true} InitialActivityScore(self, player, 1, msg.param1) --InitialActivityScore(self, player, scoreVar) --print('found player ' .. player:GetName().name .. ' ********') elseif tArgs[1] == "updatePlayerTrue" then -- turn off the player flag for is player in foot race player:SetFlag{iFlagID = 115, bFlag = false} UpdatePlayer(self, player, true) --UpdatePlayer(self, player, removePlayer) elseif tArgs[1] == "PlayerWon" then if msg.param2 then player:SetFlag{iFlagID = msg.param2, bFlag = true} end -- turn off the player flag for is player in foot race player:SetFlag{iFlagID = 115, bFlag = false} StopActivity(self, player, 0, msg.param1 ) --StopActivity(self, player, scoreVar, value1Var, value2Var, quit ) end end elseif tArgs[1] == "setupActivity" then SetupActivity(self, 9999, true) end end function notifyPlayerExit(self, other, msg) if not IsPlayerInActivity(self, msg.playerID) then return end UpdatePlayer(self, msg.playerID, true) -- if player logs out remove them from the activity end ---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 71 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } local GUIDPeaceful3D = {} GUIDPeaceful3D["Audio-Birds"] = "{0bb36c9c-e631-459a-8e55-11d8b186a805}" GUIDPeaceful3D["Audio-Wind"] = "{7af26988-1438-497a-88e8-8e423a6f977a}" ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) -- this section only happens on AG Small property and it handles all the bobtooltips for the tutorial missions. local player = GAMEOBJ:GetControlledID() -- scroll through all the messages in the table of vars for k,v in pairs(msg.tableOfVars) do if k == "PlayerAction" then -- the player entered the property edit mode if v == "Enter" then -- they havent placed a model before, and they are on the place 4 models mission if player:GetFlag{iFlagID = 101}.bFlag == false and player:GetMissionState{missionID = 871}.missionState == 2 then player:DisplayTooltip{ bShow = true, id = "PropTutModelOut", strText = Localize("TOOLTIP_PROPERTY_MODEL_EQUIP_A"), iTime = 214748 } -- the player is on the second tutorial mission elseif player:GetMissionState{missionID = 891}.missionState == 2 then -- turn off the put on thinking hat tooltip player:DisplayTooltip{ bShow = false, id = "PropTutThinkingHat" } -- if the player hasnt picked up a model or hasnt rotated a model, tell them to pick up a model if player:GetFlag{iFlagID = 109}.bFlag == false or player:GetFlag{iFlagID = 110}.bFlag == false then player:DisplayTooltip{ bShow = true, id = "PropTutPickUpModel", strText = Localize("TOOLTIP_PROPERTY_MODEL_PICK_UP"), iTime = 214748 } --if the player has picked up and rotated a model, then start the put a model away tutorial elseif player:GetFlag{iFlagID = 109}.bFlag == true or player:GetFlag{iFlagID = 110}.bFlag == true then UI:SendMessage( "DisplayTutorial", { {"type","propertyEdit"} , {"subType","putAway"} } ) end end -- the player equipped a model from their backpack elseif v == "ModelEquipped" then -- they havent placed a model before, and they are on the place 4 models mission if player:GetFlag{iFlagID = 101}.bFlag == false and player:GetMissionState{missionID = 871}.missionState == 2 then -- hide the take a model out tooltip and show press shift tooltip player:DisplayTooltip{ bShow = false, id = "PropTutPropTutModelOut"} player:DisplayTooltip{ bShow = true, id = "PropTutPropTutPressShift", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_A"), iTime = 214748 } end -- if the player exited property edit mode elseif v == "Exit" then -- close any tooltips this tutorial might have opened player:DisplayTooltip{ bShow = false, id = "PropTut" } end elseif k == "Tooltip" then -- display tooltip for place a model if v == "PlaceModel" then player:DisplayTooltip{ bShow = true, id = "PropTutPlaceModel", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_A"), iTime = 214748 } -- display tooltip for put thinking hat on elseif v == "ThinkingHat" then player:DisplayTooltip{ bShow = true, id = "PropTutThinkingHat", strText = Localize("TOOLTIP_PROPERTY_THINKING_CAP"), iTime = 214748 } -- turn off tooltip for pick up a model elseif v == "PickUpModelOff" then player:DisplayTooltip{ bShow = false, id = "PropTutPickUpModel" } -- turn off tooltip for pick up a model, and start the rotate ui tutorial elseif v == "Rotate" then player:DisplayTooltip{ bShow = false, id = "PropTutPickUpModel" } UI:SendMessage( "DisplayTutorial", { {"type","propertyEdit"} , {"subType","rotate"} } ) -- turn off tooltip for place a model and start ui tutorial for put away a model elseif v == "PutAway" then player:DisplayTooltip{ bShow = false, id = "PropTutPlaceModel"} UI:SendMessage( "DisplayTutorial", { {"type","propertyEdit"} , {"subType","putAway"} } ) -- turn off tooltip for two more models elseif v == "TwoMoreModelsOff" then player:DisplayTooltip{ bShow = false, id = "PropTutTwoMoreModels"} -- turn off tooltip for another model and display tooltip for 2 more models elseif v == "TwoMoreModels" then player:DisplayTooltip{ bShow = false, id = "PropTutAnotherModel"} player:DisplayTooltip{ bShow = true, id = "PropTutTwoMoreModels", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_C"), iTime = 214748 } -- turn off tooltip for press shift and display tool tip for place another model elseif v == "AnotherModel" then player:DisplayTooltip{ bShow = false, id = "PropTutPressShift"} player:DisplayTooltip{ bShow = true, id = "PropTutAnotherModel", strText = Localize("TOOLTIP_PROPERTY_MODEL_PLACE_B"), iTime = 214748 } end end end end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- Statrup, Sets up us some variables ---------------------------------------------------------------- function onStartup(self) self:SetVar("GUIDPeaceful3D", GUIDPeaceful3D) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 3200.0, 3200.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/env_sky_won_ag_property.nif") LEVEL:SetLights( true, 0x3e7891, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color true, 0xC9E5FF, --upper Hemi color true, { 0.6, -0.8, -0.02 }, --directional direction true, 0x8fd1e6, --fog color true, --modifying draw distances (all of them) 50.0, 50.0, --fog near min/max 350.0, 350.0, --fog far min/max 100.0, 100.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 1000.0, 1000.0, --static object cutoff min/max 350.0, 350.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_ag_property.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end-------------------------------------------------------------- -- Mail Box Script -- created mrb... 4/30/10 -- updated releaseVersion to 184 -------------------------------------------------------------- local releaseVersion = 184 -- which version release # the content should be made available ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local verInfo = msg.objIDUser:GetVersioningInfo() if not verInfo.bIsInternal and verInfo.iMajorRelease < 1 and verInfo.iVersionRelease < releaseVersion then if ( msg.isFromUI ) then -- This MUST be set to true, otherwise all requirements from this script will be ignored msg.HasReasonFromScript = true msg.Script_Failed_Requirement = true msg.Script_Reason = Localize("MAIL_UNAVAILABLE") end msg.bCanUse = false end return msg end ---------------------------------------------- -- sent when the local player interacts with the -- object ---------------------------------------------- function onClientUse(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check to see if we are the correct player if playerID ~= msg.user:GetID() or self:GetVar('isInUse') then return end local player = GAMEOBJ:GetObjectByID(playerID) -- tell the Story Box UI element to open and what to display, then turn off the interaction icon UI:SendMessage( "pushGameState", {{"state", "Mail"}} ) toggleActivatorIcon(self, true) end function onTerminateInteraction(self,msg) -- player was hit close the UI element and turn on the icon --looks like this was relying on the UI to send the callback to terminate interaction, that is no longer the case --toggling the mail UI will result in poping the mail game state --we are relying on UI to terminate the interaction when there is a player initiated close UI:SendMessage( "ToggleMail", {{"visible", false}} ) toggleActivatorIcon(self, false, true) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- sent when the requested local player is hit -- by something, this is used to close the story box ---------------------------------------------- function notifyOnHit(self, other, msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleMail", {{"visible", false}} ) toggleActivatorIcon(self) end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide, bFromTerminate) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not bHide then -- show the icon, cancel notification, set isInUse to false bHide = false self:SetVar('isInUse', false) self:SendLuaNotificationCancel{requestTarget=player, messageName="OnHit"} if not bFromTerminate then player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="OnHit"} end -- request the interaction update self:RequestPickTypeUpdate() end --------------------------------------------------------------------------------------------------------- -- Server-side script for Concert instrument Quick Builds. -- -- updated mrb... 8/30/10 - added check to see if player is dead on rebuild complete --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- constants for the musical instruments quickbuilds -------------------------------------------------------------- local CONSTANTS = {} -- the object template for each instrument CONSTANTS["INSTRUMENT_LOT_GUITAR"] = 4039 CONSTANTS["INSTRUMENT_LOT_BASS"] = 4040 CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] = 4041 CONSTANTS["INSTRUMENT_LOT_DRUM"] = 4042 -- the anim used to show the player playing each instrument CONSTANTS["INSTRUMENT_ANIM"] = {} CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "drums" -- the anim used to show the player smashing each instrument CONSTANTS["INSTRUMENT_SMASH_ANIM"] = {} CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = -1 -- has no smashing anim -- the music used for each instrument CONSTANTS["INSTRUMENT_MUSIC"] = {} CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Guitar" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Bass" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Keys" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Drums" -- path set up through Happy Flower for the cinematic for each instrument CONSTANTS["INSTRUMENT_CINEMATIC"] = {} CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Cam_G" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Cam_B" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Cam_K" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Cam_D" -- the LOT for the left hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 4991 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 4992 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- no equippable used CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4995 -- the LOT for the right hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4996 -- whether or not to hide the completed quickbuild while the player is playing the instrument CONSTANTS["INSTRUMENT_HIDE"] = {} CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = false CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = false -- once the smash anim starts playing, how long to wait before unequipping the instrument CONSTANTS["INSTRUMENT_UNEQUIP_TIME"] = {} CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 1.033 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 0.75 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- has no equippables CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 0 -- has no smash anim, unequip immediately -- how much imagination is repeatedly drained while the instrument is being played CONSTANTS["INSTRUMENT_IMAGINATION_COST"] = 2 -- how often imagination is drained while playing the instrument CONSTANTS["INSTRUMENT_COST_FREQUENCY"] = 4.0 -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- copied from enum ERebuildChallengeState in lwoGame \ include \ LWORebuild.h CONSTANTS["REBUILD_STATE_OPEN"] = 0 CONSTANTS["REBUILD_STATE_COMPLETED"] = 2 CONSTANTS["REBUILD_STATE_RESETTING"] = 4 -- copied from enum ERebuildChallengeState in lwoGame \ include \ LWORebuild.h CONSTANTS["REBUILD_STATE_COMPLETED"] = 2 -- Challenge complete CONSTANTS["UPDATE_FREQUENCY"] = 0.1 -- while playing the instrument, how often we check whether the player hit a movement key to stop playing -------------------------------------------------------------- -- startup -------------------------------------------------------------- function onStartup( self, msg ) -- needs to register with the server-side zone script -- in case the player exits, logs out, etc. while playing an instrument. -- the server-side zone script receives a PlayerExit msg, which it can then pass on to the instruments local zControl = GAMEOBJ:GetZoneControlID() self:SendLuaNotificationRequest{requestTarget = zControl, messageName = "PlayerExit"} self:SendLuaNotificationRequest{requestTarget = zControl, messageName = "PlayerResurrected"} -- from client self:SetVar( "bBeingPlayed", false ) self:SetVar( "activePlayer", nil ) -- reset the object ID's of the equippable items self:SetVar( "equippableLeft", nil ) self:SetVar( "equippableRight", nil ) self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) self:SetVar( "leftInventoryLOT", -1 ) self:SetVar( "rightInventoryLOT", -1 ) self:SetVar( "reequipPlayer", nil ) end -------------------------------------------------------------- -- called anytime the rebuild object's state changes -------------------------------------------------------------- function onRebuildNotifyState( self, msg ) local playerID = msg.player:GetID() if ( msg.iState == CONSTANTS["REBUILD_STATE_RESETTING"] or msg.iState == CONSTANTS["REBUILD_STATE_OPEN"] ) then -- clear the active player if the quickbuild state is being reset or not even started yet self:SetVar( "activePlayer", nil ) --print("Clearing active player, state="..msg.iState) else -- set the active player in all other states self:SetVar( "activePlayer", playerID ) self:SendLuaNotificationRequest{requestTarget = msg.player, messageName = "Die"} --print("Setting active player: "..playerID..", state="..msg.iState) end -- When the Quick Build is completed, the player gets to play it if they have any imagination if ( msg.iState == CONSTANTS["REBUILD_STATE_COMPLETED"] ) and not msg.player:IsDead().bDead then storeObjectByName( self, "activePlayer", msg.player ) QuickBuildWasBuilt( self ) end end -------------------------------------------------------------- -- Event from client-side -------------------------------------------------------------- function onFireEventServerSide( self, msg ) if ( msg.args == "stopPlaying" ) then StopPlayingInstrument(self) end end -------------------------------------------------------------- -- Start or stop the given the music -------------------------------------------------------------- function AlterMusic( self, szMusicName, bActivate ) local soundRepeaters = self:GetObjectsInGroup{ group = "Audio-Concert", ignoreSpawners = true }.objects for i = 1, table.maxn (soundRepeaters) do if ( bActivate ) then soundRepeaters[i]:ActivateNDAudioMusicCue{ m_NDAudioMusicCueName = szMusicName } else soundRepeaters[i]:DeactivateNDAudioMusicCue{ m_NDAudioMusicCueName = szMusicName } end end end function stopPlayerInteraction(self, player) if ( player ) then CancelMusicIfPlayerLeft( self, player ) StopPlayingInstrument( self ) local activePlayerID = self:GetVar( "activePlayer" ) -- if there is an active player, check if it is the player who just exited if ( activePlayerID ) then --print("Player exited: "..msg.playerID:GetID()..", active="..activePlayerID) if ( player:GetID() == activePlayerID ) then -- If the build is complete, kill it when the active player exits. The logic behind -- this decision is that if the player has exited and the QB is complete, they bailed -- while building (or animating post-build) and the server has finally finished building -- and determined the player is gone on the server side. Now the build needs to be -- smashed so a new one will spawn. if ( self:GetRebuildState().iState == CONSTANTS["REBUILD_STATE_COMPLETED"] ) then self:RequestDie{killerID = self, killType = "VIOLENT"} end end end end end -------------------------------------------------------------- -- object notification from server-side zone script -------------------------------------------------------------- function notifyPlayerExit(self, other, msg) if msg.playerID:Exists() then self:NotifyClientObject{ name = "playerLeft", paramObj = msg.playerID, rerouteID = msg.playerID } CancelMusicIfPlayerLeft( self, msg.playerID ) local activePlayerID = self:GetVar( "activePlayer" ) -- if there is an active player, check if it is the player who just exited if ( activePlayerID ) then --print("Player exited: "..msg.playerID:GetID()..", active="..activePlayerID) if ( msg.playerID:GetID() == activePlayerID ) then -- If the build is complete, kill it when the active player exits. The logic behind -- this decision is that if the player has exited and the QB is complete, they bailed -- while building (or animating post-build) and the server has finally finished building -- and determined the player is gone on the server side. Now the build needs to be -- smashed so a new one will spawn. if ( self:GetRebuildState().iState == CONSTANTS["REBUILD_STATE_COMPLETED"] ) then self:RequestDie{killerID = self, killType = "VIOLENT"} end end end end end -------------------------------------------------------------- -- object notification from server-side zone script -------------------------------------------------------------- function notifyDie(self, other, msg) if not other:Exists() then return end -- stop checking to see if the player finished playing the instrument self:SetVar( "bBeingPlayed", false ) -- make sure the cinematic is stopped other:EndCinematic{ leadOut = 1.0 } -- Needs to be on Client -- don't want to hear this instrument anymore AffectMusic( self, self:GetLOT().objtemplate, false ) -- cancel timers that may be running GAMEOBJ:GetTimer():CancelAllTimers(self) CancelMusicIfPlayerLeft( self, other ) self:NotifyClientObject{ name = "playerLeft", paramObj = other, rerouteID = other } self:SendLuaNotificationCancel{requestTarget=other, messageName="Die"} GAMEOBJ:GetTimer():AddTimerWithCancel( 3 , "resetRebuild", self ) end -------------------------------------------------------------- -- object notification from server-side zone script -------------------------------------------------------------- function notifyPlayerResurrected(self, other, msg) if not msg.playerID:Exists() then return end -- set the playerID that needs to get it's items reequipped self:SetVar("reequipPlayer", "|" .. msg.playerID:GetID()) -- see if the player is ready yet GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "TryResurrected", self ) -- reset animations for the player that died self:NotifyClientObject{ name = "ResetAnim", paramObj = msg.playerID, rerouteID = msg.playerID } end -------------------------------------------------------------- -- a player left the zone -- they could have exited via the x, the menu, or slash command -- or logged out via the menu or slash command -- or gone back to Character Select via the menu -- or had a client crash -- or the map could have been reloaded -- check if the player that left was the one playing this instrument -- if so, stop the music -------------------------------------------------------------- function CancelMusicIfPlayerLeft( self, exitPlayer ) local musicPlayer = getObjectByName( self, "musicPlayer" ) if ( not musicPlayer or not exitPlayer) then return end -- if the player that left was the one playing this instrument, stop the music if ( self:GetVar( "musicPlayer" ) == exitPlayer:GetID() ) then local myLOT = self:GetLOT{}.objtemplate AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][myLOT], false ) -- also, make sure that if the player who left logs back in, -- other clients don't see it come in doing the instrument animation musicPlayer:PlayAnimation{ animationID = "ben_is_king", fPriority = 4.0 } self:SetVar( "musicPlayer", nil ) end end -------------------------------------------------------------- -- a player left the zone -- they could have exited via the x, the menu, or slash command -- or logged out via the menu or slash command -- or gone back to Character Select via the menu -- or had a client crash -- or the map could have been reloaded -------------------------------------------------------------- function StopPlayingIfPlayerLeft( self, exitPlayer ) self:NotifyClientObject{ name = "playerLeft", paramObj = exitPlayer, rerouteID = exitPlayer} end -------------------------------------------------------------- -- takes some imagination away from the player -------------------------------------------------------------- function DecreasePlayersImagination( self ) -- update their imagination local player = GetActivePlayer( self ) if ( player ~= nil ) then player:ModifyImagination{ amount = -CONSTANTS["INSTRUMENT_IMAGINATION_COST"] } end -- start a new timer for when to decrease their imagination next StartImaginationCostTimer( self ) end -------------------------------------------------------------- -- returns whether the player has run out of imagination -------------------------------------------------------------- function IsPlayerOutOfImagination( self ) return ( GetPlayersImagination( self ) <= 0 ) end -------------------------------------------------------------- -- returns how much imagination the player currently has -------------------------------------------------------------- function GetPlayersImagination( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return 0 else return player:GetImagination{}.imagination end end -------------------------------------------------------------- -- start a timer for when to check whether the player is still playing the instrument -------------------------------------------------------------- function StartUpdateTimer( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["UPDATE_FREQUENCY"], "CheckOnPlayer", self ) end -------------------------------------------------------------- -- start a timer for when to decrease the player's imagination -------------------------------------------------------------- function StartImaginationCostTimer( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( CONSTANTS["INSTRUMENT_COST_FREQUENCY"], "DecreaseImagination", self ) end -------------------------------------------------------------- -- timers -------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "Hide" ) then RepositionPlayer( self, self:GetLOT().objtemplate ) if CONSTANTS["INSTRUMENT_HIDE"][self:GetLOT().objtemplate] then self:SetNetworkVar("Hide", true) end elseif ( msg.name == "Play" ) then PlayInstrument( self ) elseif ( msg.name == "resetRebuild" ) then self:RequestDie{killerID = self, killType = "VIOLENT"} elseif ( msg.name == "CheckOnPlayer" ) then if ( self:GetVar( "bBeingPlayed" ) == false ) then return end self:NotifyClientObject{ name = "checkMovement", paramObj = GetActivePlayer(self), rerouteID = GetActivePlayer(self)} -- check whether the player as run out of imagination local bOutOfImagination = IsPlayerOutOfImagination( self ) if ( bOutOfImagination ) then -- the player has run out of imagination or hit a movement key, then kick them off the instrument StopPlayingInstrument(self) else -- otherwise, set a new timer to check again StartUpdateTimer( self ) end elseif ( msg.name == "DecreaseImagination" ) then DecreasePlayersImagination( self ) elseif ( msg.name == "EndPlayer" ) then EndActivePlayer( self ) elseif ( msg.name == "Unequip" ) then UnequipEquippables( self ) elseif ( msg.name == "TryResurrected" ) then local player = getObjectByName( self, "reequipPlayer" ) if player then if player:GetStunned().bCanEquip then UnequipEquippables( self, true ) ReequipInventoryItems(self) else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "TryResurrected", self ) end end elseif ( msg.name == "AchievementTimer" ) then local player = GetActivePlayer( self ) if ( player ) then player:UpdateMissionTask{taskType = "complete", value = 602, value2 = 1, target = self} end elseif ( msg.name == "AchievementTimer_20" ) then local player = GetActivePlayer( self ) if ( player ) then player:UpdateMissionTask{taskType = "complete", value = 302, value2 = 1, target = self} GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "AchievementTimer", self ) end end end -------------------------------------------------------------- -- have the player stop playing the instrument -------------------------------------------------------------- function StopPlayingInstrument( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end if player:GetMissionState{missionID = 176}.missionState == 2 then player:UpdateMissionTask{taskType = "complete", value = 176, value2 = 1, target = self} end -- stop checking to see if the player finished playing the instrument self:SetVar( "bBeingPlayed", false ) -- stop keeping track of movement key presses self:NotifyClientObject{ name = "stopCheckingMovement", paramObj = player, rerouteID = player} -- make sure the cinematic is stopped player:EndCinematic{ leadOut = 1.0 } -- Needs to be on Client -- don't want to hear this instrument anymore AffectMusic( self, self:GetLOT().objtemplate, false ) -- cancel timers that may be running GAMEOBJ:GetTimer():CancelAllTimers(self) -- show the player smashing the instrument -- and plan when to unequip any equippables for this instrument -- get the name of the anim local instrumentLOT = self:GetLOT().objtemplate local szAnimName = CONSTANTS["INSTRUMENT_SMASH_ANIM"][instrumentLOT] if ( szAnimName ~= -1 ) then player:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_SMASH_ANIM"][instrumentLOT], fPriority = 4.0 } -- find out how long the anim is local animLength = player:GetAnimationTime{ animationID = szAnimName }.time -- set a timer for when to reset the quickbuild GAMEOBJ:GetTimer():AddTimerWithCancel( animLength, "EndPlayer", self ) end -- unequip equippable items and restore player control -- or set a timer to do it partway through the smash anim local unequipTime = CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][instrumentLOT] if ( unequipTime == 0 ) then UnequipEquippables( self ) elseif unequipTime ~= -1 then GAMEOBJ:GetTimer():AddTimerWithCancel( unequipTime, "Unequip", self ) end -- if there is no smashing anim, reset the quickbuild now if ( szAnimName == -1 ) then EndActivePlayer( self ) end end -------------------------------------------------------------- -- start the process of seeing the player playing the instrument -------------------------------------------------------------- function PlayInstrument( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end local instrumentLOT = self:GetLOT().objtemplate -- remember that someone is using this instrument self:SetVar( "bBeingPlayed", true ) -- load any related equippables (guitar, bass, drumsticks), which will equip onto the player LoadEquippables( self ) -- start keeping track of movement key presses long enough to know if the player wants to break out of playing the instument self:NotifyClientObject{ name = "startPlaying", paramObj = player, rerouteID = player} -- show the cinematic PlayCinematic( self, instrumentLOT ) -- play the animation of the mini-fig playing the given instrument PlayInstrumentAnim( self, instrumentLOT ) -- start the appropriate music AffectMusic( self, instrumentLOT, true ) -- start a timer for when to check whether the instrument is still being played StartUpdateTimer( self ) -- start a timer for decreasing the player's imagination StartImaginationCostTimer( self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 20, "AchievementTimer_20", self ) end -------------------------------------------------------------- -- add or remove music according to which instrument someone just started or stopped playing -- pass true to bActivate to turn the music on, or false to turn it off. -------------------------------------------------------------- function AffectMusic( self, instrumentLOT, bActivate) local szMusicName = CONSTANTS["INSTRUMENT_MUSIC"][instrumentLOT] local player = GetActivePlayer(self) if ( player ~= nil ) then local instrumentLOT = self:GetLOT().objtemplate if ( bActivate ) then AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][instrumentLOT], true ) storeObjectByName( self, "musicPlayer", player ) else AlterMusic( self, CONSTANTS["INSTRUMENT_MUSIC"][instrumentLOT], false ) self:SetVar("musicPlayer", false) end end end -------------------------------------------------------------- -- play the animation of the mini-fig playing the given instrument -------------------------------------------------------------- function PlayInstrumentAnim( self, instrumentLOT ) -- start the animation local player = GetActivePlayer( self ) if ( player ~= nil ) then player:PlayAnimation{ animationID = CONSTANTS["INSTRUMENT_ANIM"][instrumentLOT], fPriority = 4.0 } end end -------------------------------------------------------------- -- show the camera panning around the concert area -- Needs to be on Client -------------------------------------------------------------- function PlayCinematic( self, instrumentLOT ) local player = GetActivePlayer( self ) if ( player ~= nil ) then local szPathName = CONSTANTS["INSTRUMENT_CINEMATIC"][instrumentLOT] player:PlayCinematic { pathName = szPathName } end end function QuickBuildWasBuilt( self ) -- set timers for when to hide the completed quickbuild and show the player playing the instrument -- do this quicky so we don't have to watch the finished quickbuild model to slam into place -- but we have to wait slightly first or get overridden by the quickbuild code GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "Hide", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Play", self ) end -------------------------------------------------------------- -- unequip the instrument equippables from the player -------------------------------------------------------------- function UnequipEquippables( self, bRespawning ) local player = GetActivePlayer( self ) if bRespawning then player = getObjectByName( self, "reequipPlayer" ) end if ( player == nil ) then return end -- find out the LOT's of the items in the mini-fig's hands local leftLOT = player:GetEquippedItemType{ slot = "special_l" }.lotID local rightLOT = player:GetEquippedItemType{ slot = "special_r" }.lotID -- check which hand(s) this instrument needs to add equippables to local leftObj = false local rightObj = false -- go through each inventory slot to find the items already in-hand and store out the LOTs for i = 0, player:GetInventorySize{ inventoryType = 4 }.size do local checkItem = player:GetInventoryItemInSlot{ slot = i, inventoryType = 4 }.itemID if ( checkItem:Exists() ) then local checkLOT = checkItem:GetLOT().objtemplate if ( checkLOT == leftLOT ) then leftObj = checkItem elseif ( checkLOT == rightLOT ) then rightObj = checkItem end if leftObj and rightObj then break end end end -- if this instrument added any equippables, unequip them and -- start a timer to keep checking when they're gone and the inventory items can be re-equipped -- find out the LOT's of the items in the mini-fig's hands if leftObj then player:UnEquipInventory{itemtounequip = leftObj } player:RemoveItemFromInventory{eInvType = 4, iObjID = leftObj } end if rightObj then player:UnEquipInventory{itemtounequip = rightObj } player:RemoveItemFromInventory{eInvType = 4, iObjID = rightObj } end -- break the quickbuild self:Smash{killerID = player} end -------------------------------------------------------------- -- once the anim of the player smashing the instrument finishes, forget about our active player -------------------------------------------------------------- function EndActivePlayer( self ) local player = GetActivePlayer( self ) if ( player ~= nil ) then storeObjectByName( self, "reequipPlayer", player ) end -- re-equip any inventory items the player had in-hand before playing the instrument ReequipInventoryItems( self ) -- forget about the active player self:SetVar( "activePlayer", nil ) self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) -- reset the quickbuild self:RebuildReset{} self:NotifyClientObject{ name = "stopPlaying", paramObj = player } end -------------------------------------------------------------- -- move the player to the best looking position to play this particular instrument -------------------------------------------------------------- function RepositionPlayer( self, instrumentLOT ) local player = GetActivePlayer( self ) if not player then return end -- get the quickbuild's position and rotation local qbPos = self:GetPosition().pos local qbRot = self:GetRotation() local playerPos = qbPos local playerRot = qbRot -- special case: the player pos needs to be adjusted a little for the drums to put the player behind the drumset -- and for the guitar and bass because they are located right on the edge of the state in Happy Flower if ( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_DRUM"] ) then local posOffset = { x = 0.0, y = 0.0, z = -0.5 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = posOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_BASS"] ) then local posOffset = { x = 5.0, y = 0.0, z = 0.0 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = posOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_GUITAR"] ) then local posOffset = { x = 5.0, y = 0.0, z = 0.0 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = posOffset }.newPosition elseif( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] ) then local posOffset = { x = -0.45, y = 0.0, z = 0.75 } playerPos = self:GetParallelPosition{ referenceObject = self, offset = posOffset }.newPosition end player:SetRotation{ w = playerRot.w, x = playerRot.x, y = playerRot.y, z = playerRot.z } player:Teleport{ pos = playerPos, bSetRotation, bIgnoreY = false, w = playerRot.w, x = playerRot.x, y = playerRot.y, z = playerRot.z } -- special case: the player's rotation needs to be adjusted a little for the keyboard if ( instrumentLOT == CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] ) then player:OrientToAngle{fAngle = -0.8, bRelativeToCurrent = true} end self:SetVar( "targetPositionX", playerPos.x ) self:SetVar( "targetPositionZ", playerPos.z ) end -------------------------------------------------------------- -- give the player the items and equip them -------------------------------------------------------------- function LoadEquippables( self ) local player = GetActivePlayer(self) if not player then return end -- find which instruments we need to equip local instrumentLOT = self:GetLOT().objtemplate local leftInstrumentLOT = CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][instrumentLOT] or -1 local rightInstrumentLOT = CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][instrumentLOT] or -1 -- find out the LOT's of the items in the mini-fig's hands local leftLOT = player:GetEquippedItemType{ slot = "special_l" }.lotID local rightLOT = player:GetEquippedItemType{ slot = "special_r" }.lotID -- check which hand(s) this instrument needs to add equippables to local leftObj = false local rightObj = false -- go through each inventory slot to find the items already in-hand and store out the LOTs for i = 0, player:GetInventorySize{ inventoryType = 1 }.size do local checkItem = player:GetInventoryItemInSlot{ slot = i }.itemID if ( checkItem:Exists() ) then local checkLOT = checkItem:GetLOT().objtemplate if ( checkLOT == leftLOT ) then self:SetVar( "leftInventoryLOT", leftLOT ) leftObj = checkItem elseif ( checkLOT == rightLOT ) then self:SetVar( "rightInventoryLOT", rightLOT ) rightObj = checkItem end if leftObj and rightObj then break end end end -- check if we have a left instrument to equip -- and unequip any that go onto a hand that this instrument doesn't use if leftInstrumentLOT ~= -1 then local newItem = player:AddNewItemToInventory{ showFlyingLoot = false, invType = 4, iObjTemplate = leftInstrumentLOT } storeObjectByName( self, "equippableLeft", newItem.newObjID ) if rightObj then player:UnEquipInventory{ itemtounequip = rightObj } end player:EquipInventory{ itemtoequip = newItem.newObjID } elseif rightObj then player:UnEquipInventory{ itemtounequip = rightObj } end -- check if we have a left instrument to equip -- and unequip any that go onto a hand that this instrument doesn't use if rightInstrumentLOT ~= -1 then local newItem = player:AddNewItemToInventory{ showFlyingLoot = false, invType = 4, iObjTemplate = rightInstrumentLOT } storeObjectByName( self, "equippableLeft", newItem.newObjID ) if leftObj then player:UnEquipInventory{ itemtounequip = leftObj } end player:EquipInventory{ itemtoequip = newItem.newObjID } elseif leftObj then player:UnEquipInventory{ itemtounequip = leftObj } end end -------------------------------------------------------------- -- the player had inventory items in-hand before playing the instrument. -- re-equip them. -------------------------------------------------------------- function ReequipInventoryItems( self ) local player = getObjectByName( self, "reequipPlayer" ) -- only allow the local player to re-equip its own inventory items if player == nil or player:IsDead().bDead then return end -- remember the LOT's of the inventory items that we unequipped earlier local leftLOT = self:GetVar( "leftInventoryLOT" ) local rightLOT = self:GetVar( "rightInventoryLOT" ) -- re-equip the left-hand item, if there was one if ( leftLOT ~= -1) then local itemToEquip = player:GetFirstInventoryItemByLOT{iObjTemplate = leftLOT}.itemID if itemToEquip then player:EquipInventory{ itemtoequip = itemToEquip } end end -- re-equip the right-hand item, if there was one if ( rightLOT ~= -1) then local itemToEquip = player:GetFirstInventoryItemByLOT{iObjTemplate = rightLOT}.itemID if itemToEquip then player:EquipInventory{ itemtoequip = itemToEquip } end end self:SetVar( "leftInventoryLOT", -1 ) self:SetVar( "rightInventoryLOT", -1 ) self:SetVar( "reequipPlayer", nil ) end -------------------------------------------------------------- -- returns the ID of the active player -------------------------------------------------------------- function GetActivePlayer( self ) local player = getObjectByName(self, "activePlayer") if player then if player:Exists() then return player end end return nil end -------------------------------------------------------------- -- returns the ID of the active player -------------------------------------------------------------- function GetActivePlayerID( self ) local player = GetActivePlayer( self ) if player then return player:GetID() end return nil end -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) if not object:Exists() or not varName then return end local idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) if not varName then return end local targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end -------------------------------------------------------------- -- Universal server script for all pet digs. -- -- created by brandi 3/2/10 -- updated by brandi 3/9/10 -------------------------------------------------------------- --require('o_mis') -- For faction checks -- each type of pet dig has a unique object ID local normalPDLOT = 3495 local PetCovePDLOT = 7612 local GFFlagPDLOT = 7410 local AGMisPDLOT = 9307 local GFCrabLot = 9308 local AGBouncePDLOT = 7559 function onStartup(self) -- NodeClaimed gets set to true when a pet claims the pet treasure node, and it check before another pet can claim it self:SetVar("NodeClaimed", false) local objLot = self:GetLOT().objtemplate -- if the treasure node is either of the ones spawned from the X build, then add a timer to kill it if objLot == GFFlagPDLOT or objLot == AGMisPDLOT then GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "KillChest", self ) else -- if the treause node is one that digs up a pet bouncer if objLot == AGBouncePDLOT then local bouncerNumber = self:GetVar("BouncerNumber") -- set in HF local petbouncer = LEVEL:GetSpawnerByName("PetBouncer"..bouncerNumber) local petbouncerswitch = LEVEL:GetSpawnerByName("PetBouncerSwitch"..bouncerNumber) -- on startup, deactivate and reset the spawner networks for the pet bouncer and pet switch petbouncer:SpawnerDeactivate() petbouncerswitch:SpawnerDeactivate() petbouncer:SpawnerReset() petbouncerswitch:SpawnerReset() end end end function onCollisionPhantom(self, msg) -- when something enters the collision of the node, see if the node has already been claimed and that it is actually alive if ( self:GetVar("NodeClaimed") == false) and self:IsDead().bDead ~= true then -- target is the pet or player or npc that collided with the node volume local target = msg.senderID if not target then return end -- check to see if target Is a player, if so notify pet to go to switch if (target:IsCharacter().isChar == true) then -- see if player has a pet local Pet = target:GetPetID().objID if Pet:Exists() then -- check if pet is currently using an ability if ( Pet:GetPetAbilityObject{}.bHasAbilityObj == false ) then -- send message to owner's pet Pet:NotifyPet{ ObjIDSource = target , ObjToNotifyPetAbout = self , iPetNotificationType = 12 } end end else -- get if the target is a pet local isPet = target:GetIsPet() -- check to see if the target is a pet and if its is a wild pet if ( isPet.bIsPet == true and isPet.bIsWild == false) then -- i think this checks to see if the pet is already using an ability if ( target:GetPetAbilityObject{}.bHasAbilityObj == false ) then -- checks to see if this node was spawned by a X build if self:GetVar("builder") then -- set on load from the X build -- already made sure that target is a pet, so get the pets owner local petOwner = target:GetParentObj().objIDParent:GetID() -- this is the player that built the Xbuild that spawned the pet node local player = self:GetVar("builder") --print("petOwner is "..petOwner) --print("builder is "..player) -- if the pet owner isn't the player who built the X build, their pet can't dig the pet dig, and therefore cant claim the node if (petOwner ~= player) then return end end -- pet has claimed the node self:SetVar("NodeClaimed", true) -- notify pet that they can dig here target:NotifyPet{ ObjIDSource = target , ObjToNotifyPetAbout = self , iPetNotificationType = 6 } --set the pet ID as the pet who activated this node self:SetVar("activator", target:GetID()) end end end end end function onOffCollisionPhantom(self, msg) -- target is the pet or player or npc that un-collided with the node volume local target = msg.senderID -- get if the target is a pet local isPet = target:GetIsPet() -- check to see if the target is a pet and if its is a wild pet AND if the node was already claimed if (isPet.bIsPet == true and isPet.bIsWild == false) and ( self:GetVar("NodeClaimed") == true) then -- activator is the pet that claimed the node in onCollision local activator = self:GetVar("activator") -- check to see if a pet was set as activator and if that pet is the pet that just un- collided with the node if ( activator and ( target:GetID() == activator ) ) then -- if the pet that claimed the node is the pet that uncollided with the node, set node claimed to false self:SetVar("NodeClaimed", false) -- Notify pet they've left the pet node and set their state back to normal target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 7 } end end end function onNotifyObject(self, msg) -- If treasure node receives notification a pet is digging it up if ( msg.name == "petdughere" ) then -- check to see if the node was clamed first if ( self:GetVar("NodeClaimed") == true) then -- convoluted way of getting the pet owner based on the message sender local petOwner = msg.ObjIDSender:GetParentObj().objIDParent -- get the object LOT of the treasure node local lot = self:GetLOT().objtemplate -- if the lot is the crab dig lot, go to the crab dig function if lot == GFCrabLot then SpawnCrab(self,petOwner) -- if the lot is the pet cove pet dig node, go to the achievement function elseif self:GetVar("PetDig") then PetDigAchievement(self,petOwner) -- if the lot is the AG Xbuild elseif lot == AGMisPDLOT then -- get the ID of the player who built the X local player = self:GetVar("builder") -- if the player that tried to dig up the pet dig is not the player who built the X, skip the rest of the script if (petOwner:GetID() ~= player) then return end -- if the lot is the lot of the flag digs in GF, go to the X build function elseif lot == GFFlagPDLOT then Xbuild(self,petOwner) return -- skip the rest of this function -- if the lot is one of the pet bouncer digs, then go to the bouncer dig function elseif lot == AGBouncePDLOT then BouncerDig(self,petOwner) end -- check to see if the player has completed with pet dig acheivement local DigMissionState = petOwner:GetMissionState{ missionID = 843 }.missionState -- if the player has not completed with mission if (DigMissionState == 2) then petOwner:UpdateMissionTask{taskType = "complete", value = 843, value2 = 1, target = self} end --tells the client side script that the treasure was dub up self:SetNetworkVar("treasure_dug", true) -- killing the treasure node with violent is what spits out the loot, and the loot shows up for the pet owner self:RequestDie{ killType = "VIOLENT" , killerID = petOwner } -- Ability is done being used, remove using-ability state from pet msg.ObjIDSender:RemovePetState{iStateType = 9} -- check to see if their is a quick build X, and kills it too if self:GetVar("X") then GAMEOBJ:GetObjectByID(self:GetVar("X")):RequestDie{ killType = "VIOLENT" } end end end end -- function to spawn a crab on pet dig function SpawnCrab(self,petOwner) -- get the location of the pet dig to spawn the crab there local mypos = self:GetPosition().pos local myRot = self:GetRotation() -- set the config data with the tamer as the pet Owner so only the person who dug the crab can tame it, and add it to a group -- with the pet tamer's ID built in to the name of the group so the crab can be found through script local config = { { "tamer", petOwner:GetID() } , { "groupID", "crab"..petOwner:GetID()} } -- spawn a crab RESMGR:LoadObject { objectTemplate = 7694 , x = mypos.x , y = mypos.y , z = mypos.z , rw= myRot.w, rx= myRot.x, ry= myRot.y, rz = myRot.z, owner = self, configData = config } end -- function to update achievements for doing all the pet digs in Pet Cove function PetDigAchievement(self,petOwner) -- check to see if the player has completed with pet dig acheivement local AchievementState = petOwner:GetMissionState{ missionID = 505 }.missionState -- if the player has not completed with mission if (AchievementState < 4) then local digNum = self:GetVar('PetDig') -- set in HF -- use the number of the pet dig to get the player flag number for that pet dig local flagNumber = tonumber("126"..digNum) -- check to see if the player has already dug that particular pet dig before if (petOwner:GetFlag{iFlagID = flagNumber}.bFlag == false ) then --set flag to true so we know the player has alread done this petOwner:SetFlag{iFlagID = flagNumber, bFlag = true} -- update the player's achievement for digging a new pet dig petOwner:UpdateMissionTask{taskType = "complete", value = 505, value2 = 1, target = self} end end end -- function for the flag pet digs in GF function Xbuild(self,petOwner) local player = GAMEOBJ:GetObjectByID(self:GetVar("builder")) -- check to make sure the pet owner is still the player who built the X, just another check if (petOwner:GetID() == player:GetID()) then -- set variable for player flag num local PlayerFlagNum = 0 local groupID = self:GetVar("groupID") -- set in HF --set the flag number to check/set on the player based on which flag in GF it is. --player flag number set in the database if (groupID == "Flag1") then PlayerFlagNum = 61 elseif (groupID == "Flag2") then PlayerFlagNum = 62 elseif (groupID == "Flag3") then PlayerFlagNum = 63 end --check to see if they player has dug the flag up before if not petOwner:GetFlag{iFlagID = PlayerFlagNum}.bFlag then -- Ability is done being used, remove using-ability state from pet player:GetPetID().objID:RemovePetState{iStateType = 9} --get the flag based on the group, to change the collision group and visiblity on those scripts --assume only one object in group local flag = self:GetObjectsInGroup{ group = groupID, ignoreSpawners = true }.objects[1] --notifies script on the flag L_GF_DUG_FLAG_CLIENT flag:NotifyClientObject{ name = "changePhysics" , paramObj = player , rerouteID = player }--NotifyObject{ name = "flagDugUp", paramObj = petOwner } --set the player flag for this collectible flag so next time the player digs it, he'll get generic pet loot instead petOwner:SetFlag{iFlagID = PlayerFlagNum, bFlag = true} -- it's ok to use Deleteobject because we know this node was spawned through script, and this is a server script GAMEOBJ:DeleteObject(self) -- if the player has already gotten this flag, then have the pet dig drop normal pet dig loot else --remove the dig state from the pet petOwner:GetPetID().objID:RemovePetState{iStateType = 9} -- killing the treasure node with violent is what spits out the loot, and the loot shows up for the pet owner self:RequestDie{ killType = "VIOLENT" , killerID = petOwner } end --cancel the timer to kill the treasure chest, and kill it early GAMEOBJ:GetTimer():CancelTimer("KillChest", self); --smash the built X if it is still built GAMEOBJ:GetObjectByID(self:GetVar("X")):RequestDie{ killType = "VIOLENT" } end end -- function for the pet dig that digs up a pet bouncer and switch function BouncerDig(self,petOwner) local bouncerNumber = self:GetVar("BouncerNumber") -- set in HF -- check so script doesnt crash because there's no config data set if bouncerNumber then -- spawner networks for the bouncer and switch must be set up like this to work local bouncerSpawner = LEVEL:GetSpawnerByName("PetBouncer"..bouncerNumber) local switchSpawner = LEVEL:GetSpawnerByName("PetBouncerSwitch"..bouncerNumber) -- check that there is a spawner network with that name before activating it if bouncerSpawner then -- activating the spawner network spawns the bouncer bouncerSpawner:SpawnerActivate() end -- check that there is a spawner network with that name before activating it if switchSpawner then -- activating the spawner network spawns the switch switchSpawner:SpawnerActivate() end end end function onTimerDone(self, msg) -- the timer is set on start up with the node is spawned from an X build if ( msg.name == "KillChest" ) then -- get the pet who claimed the treasure node local target = GAMEOBJ:GetObjectByID(self:GetVar("activator")) --check to make sure the pet actually existing, if no pet, then just kill the node if target then target:RemovePetState{iStateType = 9} target:NotifyPet{ ObjIDSource = target, ObjToNotifyPetAbout = self, iPetNotificationType = 7 } end -- die silent so there is no loot self:RequestDie{ killType = "SILENT" } end end -------------------------------------------------------------- -- Server side script on the console behind the paradox rep. -- this script takes infected bricks and give the player faction tokens -- the use conditions are all handled in the client script -- client script is located scripts\client\ai\NS\L_NS_TOKEN_CONSOLE_CLIENT.lua -- updated brandi 6/23/10 added update misson to complete the misson from the paradox rep to use the console -------------------------------------------------------------- -- Variables pulled out to make tweaking the numbers easier for systems local bricksToTake = 25 -- the maelstrom infected bricks this interaction cost -- MAKE SURE THIS MATCHES THE CLIENT SIDE SCRIPT local maxTokens = 5 -- for the randomizer, this is the max number of tokens the console will give out -- when the player interact with the console function onUse(self,msg) -- to make sure the player isn't interacting with the object just to quickbuild it -- state 2 means the quickbuild is complete if self:GetRebuildState{}.iState == 2 then local player = msg.user local missionState = player:GetMissionState{missionID = 863}.missionState local number = maxTokens -- the number of token the player will get -- player is on the mission to interact with the console, or has completed it if missionState > 1 then -- makes sure the player has the required amount of infected bricks, they shouldnt get past -- the CheckUseRequirements, but just in case if player:GetInvItemCount{ iObjTemplate = 6194}.itemCount >= bricksToTake then --remove the bricks from the players inventory player:RemoveItemFromInventory{iObjTemplate = 6194, iStackCount = bricksToTake } -- checks to see which faction the player is a part of, then gives them the correct tokens if player:GetFlag{iFlagID = 46}.bFlag then -- venture player:AddItemToInventory{iObjTemplate = 8321, itemCount = number} elseif player:GetFlag{iFlagID = 47}.bFlag then -- Assembly player:AddItemToInventory{iObjTemplate = 8318, itemCount = number} elseif player:GetFlag{iFlagID = 48}.bFlag then -- Paradox player:AddItemToInventory{iObjTemplate = 8320, itemCount = number} elseif player:GetFlag{iFlagID = 49}.bFlag then -- Sentinel player:AddItemToInventory{iObjTemplate = 8319, itemCount = number} end end --if the player is on the mission to use the console, complete their mission if missionState == 2 then player:UpdateMissionTask{taskType = "complete", value = 863, value2 = 1, target = self} end end -- be sure to ternimate the interaction so the shift icon comes up again. player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) self:SetVar("TotalScore", 0 ) self:SetVar("rewardModels", {} ) UI:SendMessage( "MinimizeChat", {} ) UI:SendMessage( "DisableSpeedChat", {} ) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) end function onPlayerReady(self) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) self:SetVar("PlayerReady", true) checkEverythingReady(self) end function checkEverythingReady(self) local cannonclient = self:GetVar("Cannon_ClientOBJ") local ready = self:GetVar("PlayerReady") if (cannonclient ~= nil and ready ~= nil and ready == true) then self:ActivityStateChangeRequest{wsStringValue='clientready'} --Notify the server we're ready to enter the activity end end function onNotifyClientObject(self,msg) if msg.name == "storeCannonClient" then self:SetVar("Cannon_ClientOBJ", msg.paramObj:GetID()) checkEverythingReady(self) end end function onShutdown(self, msg) UI:SendMessage( "EnableSpeedChat", {} ) UI:SendMessage( "popGameState", { {"state", "shootinggallery" } } ) endrequire('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 394) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 28) -- Confirms that this is a faction set skill trigger self:SetVar("isFactionSkill", true) -- Set the faction skill as ready to fire self:SetVar("factionSkillReady", true) -- The time the faction skill has for its "cooldown" self:SetVar("factionCooldownTime", 11) end ---------------------------------------------------------------- -- level specific Server script for Property Pushback in NS small property -- this script requires a base script -- this script should be in the zone script in the DB -- updated mrb... 9/7/10 - added brickLinkMissionID ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "Platform", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "Clouds", -- the damaging maelstrom cloud FX around the property Enemies = "Enemies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "RoninWander","RoninGen","HorsemenGen" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "Platform", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "Clouds", -- the spawner network for the damaging maelstrom clouds FXSpots = "Spots", -- the spawner network for the non-damaging fx spots PropMG = "Guard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "Ash","FX","Fog"} -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 99, -- when the player builds the claim marker, this flag is set placedModel = 107, -- when a player places a model for the first time, this flag is set guardMission = 874, -- last mission for the guard password = "s3kratK1ttN", -- behavior password build qb object with behaviors generatorID = 11023, --lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 11011, -- lot id of the behavior platform quickbuild brickLinkMissionID = 950 -- Achievement ID to complete on property rental } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player places a model, the first time it turns off the spots and sets a player flag ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) baseZonePropertyModelPlaced(self,msg,newMsg) end ---------------------------------------------------------------- -- called from the generator object and the claimmarker object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when orb is collided with ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) baseNotifyObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) endfunction onMissionDialogueOK(self,msg) --print('onMissionDialogueOK ' .. msg.iMissionState .. ' - ' .. msg.missionID) if msg.missionID == 228 and msg.bIsComplete == true then local player = msg.responder --"Collect Imagination to use as AMMO for your pistol." player:DisplayTooltip{ bShow = true, strText = Localize("HELP_FIRST_GUN"), iTime = 3000 } end end-------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') CONSTANTS = {} CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"] = 3 CONSTANTS["HELP_SCREEN_TEXT"] = "fdsa" -- was "SG1" but ths was causing the game to start onStartup --[[ UISendMessage switchGameState("pushGameState"); switchGameState.args["state"] = "shootinggallery"; LWOSENDMESSAGE(LWO_MAIN_INTERFACE_UI, &switchGameState); This turns it off: UISendMessage switchGameState("pushGameState"); switchGameState.args["state"] = "gameplay"; // Or previous state LWOSENDMESSAGE(LWO_MAIN_INTERFACE_UI, &switchGameState); --]] -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) self:SetVar("TotalScore", 0 ) self:SetVar("rewardModels", {} ) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) end function onPlayerReady(self) UI:SendMessage( "pushGameState", {{"state", "shootinggallery" }} ) self:SetVar("PlayerReady", true) -- get local player local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID() ) player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Intro" } -- check the tooltip flag local tooltipMsg = player:GetTooltipFlag{iToolTip = CONSTANTS["TOOLTIP_ACTIVITY_SHOOTING_GALLERY_HELP_BIT"]} if (tooltipMsg.bFlag == false) then -- set the tooltip? else -- fake the msgbox close to start the activity GAMEOBJ:GetZoneControlID():MessageBoxRespond{ identifier = CONSTANTS["HELP_SCREEN_TEXT"], sender = player } end checkEverythingReady(self) end function checkEverythingReady(self) local cannonclient = getObjectByName(self, "Cannon_ClientOBJ") local ready = self:GetVar("PlayerReady") if (cannonclient ~= nil and ready ~= nil and ready == true) then self:ActivityStateChangeRequest{wsStringValue='clientready'} --Notify the server we're ready to enter the activity end end function onNotifyClientObject(self,msg) if msg.name == "storeCannonClient" then storeObjectByName(self,"Cannon_ClientOBJ", msg.paramObj ) checkEverythingReady(self) end end function onNotifyClientZoneObject(self,msg) if msg.name == "game_timelimit" then self:SetVar("timelimit", msg.param1 ) elseif msg.name == "ClientZone_SetNextBest" then self:SetVar("NextBest", msg.paramStr) elseif msg.name == "beatHighScore" then if self:GetVar("NextBest") ~= "nil" then --print("next Best **************** ".. self:GetVar("NextBest").." My Score: ==== "..tonumber(msg.paramStr)) --[[ if tonumber(msg.paramStr) > tonumber(self:GetVar("NextBest")) then ----print("Sending msg to Cannon Client") local cannonclient = getObjectByName(self, "Cannon_ClientOBJ") --print("Name of cannonclient"..tostring(cannonclient)) cannonclient:NotifyObject{ name = "beatHighScore" ,ObjIDSender = self} end --]] end elseif msg.name == "UI_Score" then -- Update the end score board local var = split(msg.paramStr, ",") UI:SendMessage( "ScoreUI", {{"totalScore", var[1] } , {"waveScore1", var[2] } ,{"waveScore2", var[3] }, {"waveScore3", var[4] },{"numShots", var[5] } ,{"numKills", var[6] } ,{"longestStreak", var[7] }} ) elseif msg.name =="UI_Rewards" then local var = split(msg.paramStr, ",") ----print("Money>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "..var[1]) UI:SendMessage("SetRewards", {{"money", var[1]},{"item1Name", var[2]} ,{"item1Image", var[3]} ,{"item1StackSize", ""} ,{"item2Name", var[5]} ,{"item2Image", var[6]} ,{"item2StackSize", ""} } ) UI:SendMessage( "ToggleScore", {{"toggleMenu", true }} ) self:SetVar("TotalScore", 0 ) elseif msg.name == "Clear" then UI:SendMessage("ResetUI", { {"reseting", true } }) UI:SendMessage("StreakUI", { {"sgHideStreak", true } ,{"sgStreak", "0" }}) elseif msg.name == "wave" then UI:SendMessage("ChageUI", { {"sgWave", tostring(msg.param1) } }) elseif msg.name =="updatescore" then --print("Z Client ".. tostring(msg.param1)) local cannonclient = getObjectByName(self, "Cannon_ClientOBJ") cannonclient:NotifyObject{ name = "currentScore" , param2 = msg.param1} self:SetVar("TotalScore", tostring(msg.param1)) UI:SendMessage("ChageUI", { {"sgScore", tostring(msg.param1) } }) elseif msg.name == "exit" then UI:SendMessage( "popGameState", {{"state", "shootinggallery" }} ) UI:SendMessage("ToggleScore", { {"ToggleScore", true } }) UI:SendMessage("HideScoreBoard", { {"sgHide", true } }) elseif msg.name == "showloadingUI" then UI:SendMessage("ToggleInstanceStart", { {"visible", true } }) elseif msg.name == "ShowStreak" then UI:SendMessage("StreakUI", { {"sgStreak", msg.paramStr } ,{"sgHideStreak", false }}) elseif msg.name == "HideStreak" then UI:SendMessage("StreakUI", {{"sgHideStreak", true }} ) elseif msg.name == "Audio_Start_Intro" then GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Game-Over" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Intro" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Core" } UI:SendMessage("HideUI", { {"sgHide", false }}) self:FireEventServerSide{args = "CannonStored"} elseif msg.name == "Audio_Final_Wave_Done" then UI:SendMessage("HideUI", { {"sgHide", true }}) GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Core" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Game-Over" } elseif msg.name == "Audio_Exit" then GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Game-Over" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Intro" } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "GF_SG_Core" } elseif msg.name == "SuperChargeBar" then UI:SendMessage("SuperChargUI", { {"scBar", msg.paramStr } } ) elseif msg.name == "charge_counting" then UI:SendMessage("SuperChargUI", { {"scDeCharge", tostring(msg.param1) } } ) elseif msg.name == "mHit" then -- mulit hIt -- params.multiHit Boolean UI:SendMessage("UpdateSG", { {"multiHit", true } } ) elseif msg.name == "hitFriend" then -- Hit Friend params.friendlyHit Boolean UI:SendMessage("UpdateSG", { {"friendlyHit", true } } ) elseif msg.name == "targetEscaped" then -- target escaped play area, used for Duck SG: params.targetEscaped Boolean; mrb... UI:SendMessage("UpdateSG", { {"targetEscaped", true } } ) elseif msg.name == "cStreak" then -- current Streak params.streakCoun UI:SendMessage("UpdateSG", { {"streakCount", msg.paramStr } } ) elseif msg.name == "Mark1" then UI:SendMessage("ChageUI", { {"sgFeedBack1", true } } ) elseif msg.name == "Mark2" then UI:SendMessage("ChageUI", { {"sgFeedBack2", true } } ) elseif msg.name == "Mark3" then UI:SendMessage("ChageUI", { {"sgFeedBack3", true } } ) elseif msg.name == "UnMarkAll" then UI:SendMessage("ChageUI", { {"sgFeedBackUnMark", true } } ) elseif msg.name == "HideScoreBoard" then --UI:SendMessage("HideUI", { {"sgHide", true } }) UI:SendMessage("HideUI", { {"sgHide", true } }) UI:SendMessage("ChageUI", { {"sgTimer", " " } }) elseif msg.name == "modelPercent" then UI:SendMessage("UpdateSG", { {"modelPercent", msg.paramStr } } ) elseif msg.name == "rewardAdded" then local rewards = self:GetVar("rewardModels") if rewards then table.insert(rewards, msg.param1) else rewards = {msg.param1} end self:SetVar("rewardModels", rewards) end end function onShutdown(self, msg) self:SetVar("TotalScore", 0 ) UI:SendMessage( "popGameState", {{"state", "shootinggallery" }} ) UI:SendMessage("ToggleScore", { {"ToggleScore", true } }) UI:SendMessage("HideUI", { {"sgHide", true } }) UI:SendMessage("EmbedUI", { {"sgembed", true } } ) end function onStartModelVisualization(self, msg) self:SetVar("modelVisIndex", 1) self:SetVar("modelPosX", msg.x1) self:SetVar("bagPosX", msg.x2) self:SetVar("modelPosY", msg.y1) self:SetVar("bagPosY", msg.y2) self:SetVar("modelWidth", msg.width1) self:SetVar("bagWidth", msg.width2) local rewards = self:GetVar("rewardModels") if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) end end function onChildRenderComponentReady(self, msg) if self:GetVar("currentDisplayModelLOT") and msg.childLOT == self:GetVar("currentDisplayModelLOT") then msg.childID:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("modelPosX"), y = self:GetVar("modelPosY")}, effectType = "flytoscreen", effectID = 595, boxExtents = self:GetVar("modelWidth")} GAMEOBJ:GetTimer():AddTimerWithCancel( 4 , "flytimer", self ) playChestAnimation(self) storeObjectByName(self, "currentDisplayModel", msg.childID) end end function onTimerDone(self, msg) if msg.name == "flytimer" then local visObj = getObjectByName(self, "currentDisplayModel") visObj:SetPosition{pos = visObj:GetSubNodePosition{}.pos} visObj:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("bagPosX"), y = self:GetVar("bagPosY")}, effectType = "flytobag", effectID = 595, boxExtents = self:GetVar("bagWidth"), bUseInitialScale = true} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.25 , "endTimer", self ) elseif msg.name == "endTimer" then removeFXObject(self) if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) self:SetVar("rewardModels", nil) local test = self:GetVar("rewardModels") for i =1, #test do self:SetVar("rewardModels."..i.."", nil) end end end end function removeFXObject(self) if self:GetVar("currentDisplayModel") ~= "0" then GAMEOBJ:DeleteObject(getObjectByName(self, "currentDisplayModel")) self:SetVar("currentDisplayModel", "0") end end function createNextVisObject(self) local rewards = self:GetVar("rewardModels") local index = self:GetVar("modelVisIndex") if rewards and index <= #rewards then local grp = self:GetObjectsInGroup{ignoreSpawners=true,group = "ChestGroup" }.objects for i, obj in pairs(grp) do local pos = obj:GetPosition().pos self:SetVar("currentDisplayModelLOT", rewards[index]) RESMGR:LoadObject{ objectTemplate = rewards[index], x = pos.x, y = pos.y, z = pos.z, owner = self} self:SetVar("modelVisIndex", self:GetVar("modelVisIndex") + 1) end else return false end return true end function playChestAnimation(self) local chestObjects = self:GetObjectsInGroup{group = "ChestGroup", ignoreSpawners = true}.objects if #chestObjects > 0 then for index, chest in pairs(chestObjects) do chest:PlayAnimation{animationID = "open"} end else print("ERROR: Failed to find chest object.") end end-- ================================================ -- L_ACT_CANNON.lua -- Client Side -- updated 9/1/10 mrb... - removed extra update network var call -- ================================================ require('o_mis') -- global vars ------------------------------- local tMedals = { {name = Localize("Missions_102_name"), score = 50000}, -- 102; High Scoring Pirate 1 {name = Localize("Missions_338_name"), score = 125000}, -- 339; High Scoring Pirate 2 {name = Localize("Missions_339_name"), score = 250000}, -- 339; High Scoring Pirate 3 {name = Localize("Missions_340_name"), score = 500000}, } -- 340; High Scoring Pirate local audioVars = { Intro = "GF_SG_Intro", GameOver = "GF_SG_Game-Over", Core = "GF_SG_Core", SuperCharge = "GF_SG_Super-Cannon", ChestOpening = "{7e264cc1-5524-4f79-8c70-00df13756f1b}", } function StartLuaNotify(self) local player = GAMEOBJ:GetZoneControlID() if player:Exists() then self:SendLuaNotificationRequest{requestTarget=player, messageName="StartModelVisualization"} end end function StopLuaNotify(self) local player = GAMEOBJ:GetZoneControlID() if player:Exists() then self:SendLuaNotificationCancel{requestTarget=player, messageName="StartModelVisualization"} end end function onStartup(self) -- Load client side parameters Here self:SetColor{ iLEGOColorID = 0 } self:SetVar("OverRideScore", true) self:SetVar("FoundFriendGuild", false) myTotalScore = 0 self:SetVar("mySCORE", 0) self:SetVar("Started", false) self:SetVar("Time", 1) GAMEOBJ:GetZoneControlID():NotifyClientObject{ name ="storeCannonClient" , paramObj = self} StartLuaNotify(self) end function onScriptNetworkVarUpdate(self,msg) for k,v in pairs(msg.tableOfVars) do --print ("k: " .. tostring(k)) --print ("v: " ..tostring(v)) if k == "initialskill" then self:SetVar("CBSkill", v) elseif k == "currentScore" then self:SetVar("mySCORE", v) elseif k == "count" then self:SetVar("Time", v) self:SetVar("Started", true) self:SetVar("TotalTime", v) UI:SendMessage("UpdateSG", { {"sgTimer", tostring(v) } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Count", self ) elseif k == "Stop" then GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar("Started", false) UI:SendMessage("UpdateSG", { {"sgTimer", " " } }) self:SetVar("Time", GAMEOBJ:GetZoneControlID():GetVar("timelimit")) elseif k == "cbskill" then self:SetVar("CBSkill", v) elseif k == "updateScore" then if self:GetVar("HoldingTopScore") then UI:SendMessage( "UpdateSG", {{"opponentScore", tostring(v) }, {"opponentName", msg.paramObj:GetName().name } } ) else self:SetVar("TotalScore", v) UI:SendMessage( "UpdateSG", {{"opponentScore", self:GetVar("NextBest") }, {"opponentName", self:GetVar("NextBestName") }, {"sgScore", v} } ) checkNextHighScore(self, v) end elseif k == "ShowStreak" then UI:SendMessage("UpdateSG", { {"sgStreak", v } ,{"sgHideStreak", false }}) elseif k == "HideStreak" then UI:SendMessage("UpdateSG", {{"sgHideStreak", true }} ) elseif k == "charge_counting" then UI:SendMessage("UpdateSG", { {"scDeCharge", v } } ) elseif k == "mHit" then -- mulit hIt UI:SendMessage("UpdateSG", { {"multiHit", true } } ) elseif k == "cStreak" then -- current Streak UI:SendMessage("UpdateSG", { {"streakCount", v } } ) elseif k == "Mark1" then UI:SendMessage("UpdateSG", { {"sgFeedBack1", true } } ) elseif k == "Mark2" then UI:SendMessage("UpdateSG", { {"sgFeedBack2", true } } ) elseif k == "Mark3" then UI:SendMessage("UpdateSG", { {"sgFeedBack3", true } } ) elseif k == "UnMarkAll" then UI:SendMessage("UpdateSG", { {"sgFeedBackUnMark", true } } ) elseif k == "game_timelimit" then self:SetVar("timelimit", v ) elseif k == "ClientZone_SetNextBest" then self:SetVar("NextBest", v) elseif k == "Clear" then UI:SendMessage("UpdateSG", { {"sgHideStreak", true } ,{"sgStreak", "0" }, {"reseting", true } }) UI:SendMessage("ToggleScoreboardinfo", {{"visible", false }} ) elseif k == "wave.waveStr" then UI:SendMessage("ToggleFlashingText", {{"visible", true}, {"text", v}}) elseif k == "wave.waveNum" then UI:SendMessage("UpdateSG", { {"sgWave", tostring(v) } }) elseif k == "showLoadingUI" then UI:SendMessage("ToggleInstanceStart", { {"visible", true} }) GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Intro } GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()):SetEmotesEnabled{ bEnableEmotes = false } elseif k == "Audio_Start_Intro" then local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) UI:SendMessage("Togglesg_scoreboard", { {"visible", true }}) -- audio player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.GameOver } player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Intro } player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Core } elseif k == "Audio_Final_Wave_Done" then local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) UI:SendMessage("Togglesg_scoreboard", { {"visible", false }}) -- audio player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.Core } player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.SuperCharge } player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.GameOver } elseif k == "SuperChargeBar" then UI:SendMessage("UpdateSG", { {"scBar", v } } ) local player = GAMEOBJ:GetObjectByID( GAMEOBJ:GetLocalCharID()) if v == 100 then player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.SuperCharge } else player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = audioVars.SuperCharge } end elseif k == "hitFriend" then -- Hit Friend params.friendlyHit - Boolean UI:SendMessage("UpdateSG", { {"friendlyHit", true } } ) elseif k == "HideScoreBoard" then UI:SendMessage("Togglesg_scoreboard", { {"visible", false } }) UI:SendMessage("UpdateSG", { {"sgTimer", " " } }) elseif k == "modelPercent" then UI:SendMessage("UpdateSG", { {"modelPercent", v } } ) elseif k == "rewardAdded" then local rewards = self:GetVar("rewardModels") if rewards then table.insert(rewards, v) else rewards = {v} end self:SetVar("rewardModels", rewards) elseif k == "UI_Rewards" then local var = split(v, "_") UI:SendMessage("ToggleScoreboardinfo", {{"visible", true }, {"totalScore", var[1] }, {"numShots", var[5] }, {"numKills", var[6] }, {"longestStreak", var[7]}} ) UI:SendMessage("Togglesg_scoreboard", { {"visible", false }}) UI:SendMessage("ToggleInstanceRewards", {{"visible", true},{"bHasModelDisplay", true} }) UI:SendMessage("ToggleLeaderboard", { {"id", self:GetActivityID().activityID} } ) self:SetVar("TotalScore", 0 ) --print("totalScore: " .. var[1] .. "numShots: " .. var[5] .. "numKills: " .. var[6] .. "longestStreak: " .. var[7]) end end end function addTimer(self) if self:GetVar("Started") and self:GetVar("Time") then local cTimer = self:GetVar("Time") -1 if cTimer < 0 then GAMEOBJ:GetTimer():CancelAllTimers(self) self:SetVar("Started", false) UI:SendMessage("UpdateSG", { {"sgTimer", " " } }) self:SetVar("Time", GAMEOBJ:GetZoneControlID():GetVar("timelimit")) return end self:SetVar("Time", cTimer) UI:SendMessage("UpdateSG", { {"sgTimer", tostring(cTimer) } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "Count", self ) end end function onTimerDone(self,msg) if msg.name =="Count" then addTimer(self) elseif msg.name == "flytimer" then local visObj = getObjectByName(self, "currentDisplayModel") visObj:SetPosition{pos = visObj:GetSubNodePosition{}.pos} visObj:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("bagPosX"), y = self:GetVar("bagPosY")}, effectType = "flytobag", effectID = 595, boxExtents = self:GetVar("bagWidth"), bUseInitialScale = true} visObj:SetVisible{fadeTime = 0.2, visible = false} GAMEOBJ:GetTimer():AddTimerWithCancel( 0.25 , "endTimer", self ) elseif msg.name == "endTimer" then removeFXObject(self) if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) self:SetVar("rewardModels", nil) local test = self:GetVar("rewardModels") for i =1, #test do self:SetVar("rewardModels."..i.."", nil) end end end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] local n = 1 local tableValues = {} for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Score"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("bShowedPlayer", false) self:SetVar("NextBest", false) self:SetVar("NextBestName", false) self:SetVar("LeaderTable", tableValues) setNextHighScore(self, iScore) end end function setNextHighScore(self, iScore) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local name_value = 0 local score_value = 0 local name = 0 local score = 0 local tableValues = self:GetVar("LeaderTable") or {} local curName = self:GetVar("NextBestName") local playerScore = 0 if not curName then curName = player:GetName().name end for testName = 1, #tableValues do if tableValues[testName] == curName then name = testName score = (testName + 1) if name ~= 1 then name_value = (testName - 2) score_value = (testName - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif name_value == 1 then name_value = 1 score_value = 2 end end if tableValues[testName] == player:GetName().name then self:SetVar("FoundPlayer", true ) playerScore = tableValues[(testName + 1)] end end local uiName = tableValues[name] or player:GetName().name local uiScore = tableValues[score] or playerScore local uiNextName = tableValues[name_value] or player:GetName().name local uiNextScore = tableValues[score_value] or playerScore if not self:GetVar("bShowedPlayer") then uiNextName = uiName uiNextScore = uiScore end if not iScore then iScore = 0 end local highestScore = tableValues[2] or 0 if iScore >= math.floor(highestScore) or not self:GetVar("FoundPlayer") then local pass = false for k,v in ipairs(tMedals) do if iScore < v.score then uiNextName = v.name uiNextScore = v.score pass = true break end end if not pass then self:SetVar("HoldingTopScore", true) uiNextName = player:GetName().name uiNextScore = iScore end end UI:SendMessage("UpdateSG", {{"opponentScore", tostring(uiNextScore) }, {"opponentName", tostring(uiNextName) } } ) self:SetVar("NextBest", math.floor(uiNextScore) ) self:SetVar("NextBestName", uiNextName ) self:SetVar("bShowedPlayer", true) --GAMEOBJ:GetZoneControlID():NotifyClientZoneObject{ name= "ClientZone_SetNextBest", paramStr = tostring(tableValues[score_value]) } end function checkNextHighScore(self, iScore) if not iScore or not self:GetVar('NextBest') then return end if iScore >= self:GetVar('NextBest') then setNextHighScore(self, iScore) end end function onShootingGalleryFire(self, msg) local CBskillID = self:GetVar("CBSkill") self:CastSkill{skillID = CBskillID, lastClickedPosit=msg.targetPos, bUsedMouse=true}--, optionalTargetID = msg.objId} self:PlayFXEffect{effectType = "onfire"} self:PlayFXEffect{effectType = "onfire2"} if getActivityUser(self):Exists() then getActivityUser(self):PlayFXEffect{effectType = "SG-fire"} end end function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end ------------------------------------------------------------------- from client zone script function onShutdown(self, msg) self:SetVar("TotalScore", 0 ) StopLuaNotify(self) local player = GAMEOBJ:GetControlledID() if player:Exists() then player:SetEmotesEnabled{ bEnableEmotes = true } end UI:SendMessage( "EnableSpeedChat", {} ) UI:SendMessage( "ToggleScoreboardinfo", { {"visible", false } } ) UI:SendMessage( "popGameState", { {"state", "shootinggallery" } } ) end function notifyStartModelVisualization(self, other, msg) self:SetVar("modelVisIndex", 1) self:SetVar("modelPosX", msg.x1) self:SetVar("bagPosX", msg.x2) self:SetVar("modelPosY", msg.y1) self:SetVar("bagPosY", msg.y2) self:SetVar("modelWidth", msg.width1) self:SetVar("bagWidth", msg.width2) local rewards = self:GetVar("rewardModels") if not createNextVisObject(self) then UI:SendMessage( "EndModelVisualization", {{"done", true}} ) end end function onChildRenderComponentReady(self, msg) if self:GetVar("currentDisplayModelLOT") and msg.childLOT == self:GetVar("currentDisplayModelLOT") then msg.childID:AttachFlytoScreenPos{screenDestination = {x = self:GetVar("modelPosX"), y = self:GetVar("modelPosY")}, effectType = "flytoscreen", effectID = 595, boxExtents = self:GetVar("modelWidth")} GAMEOBJ:GetTimer():AddTimerWithCancel( 2 , "flytimer", self ) playChestAnimation(self) storeObjectByName(self, "currentDisplayModel", msg.childID) end end function removeFXObject(self) if self:GetVar("currentDisplayModel") ~= "0" then GAMEOBJ:DeleteObject(getObjectByName(self, "currentDisplayModel")) self:SetVar("currentDisplayModel", "0") end end function createNextVisObject(self) local rewards = self:GetVar("rewardModels") if not rewards then return false end local index = self:GetVar("modelVisIndex") if index <= #rewards then local grp = self:GetObjectsInGroup{ignoreSpawners=true,group = "ChestGroup" }.objects for i, obj in pairs(grp) do local pos = obj:GetPosition().pos self:SetVar("currentDisplayModelLOT", rewards[index]) RESMGR:LoadObject{ objectTemplate = rewards[index], x = pos.x, y = pos.y, z = pos.z, owner = self} self:SetVar("modelVisIndex", self:GetVar("modelVisIndex") + 1) end else return false end return true end function playChestAnimation(self) local chestObjects = self:GetObjectsInGroup{group = "ChestGroup", ignoreSpawners = true}.objects if #chestObjects > 0 then for index, chest in pairs(chestObjects) do chest:PlayNDAudioEmitter{m_NDAudioEventGUID = audioVars.ChestOpening} -- play sound for chest opening chest:PlayAnimation{animationID = "open"} end else print("ERROR: Failed to find chest object.") end end -------------------------------------------------------------- -- Generic Story Box Interaction script, opens/closes the story -- box UI based on the config data set in HF on the object running -- this script. -- updated mrb... 5/04/10 -- added altFlagID to fix PC issue -------------------------------------------------------------- -- *********************************************************** -- HF config data format -- storyText -> 0:stringName -- needed to work -- altFlagID -> 1:flagID -- if the flag is different from 10000 + mapNum + storyText number use this -- *********************************************************** -- turning on the effects on the binoculars based on whether the player has looked through -- them before or not function onRenderComponentReady(self,msg) local player = GAMEOBJ:GetControlledID() -- make sure the player is ready if player:Exists() then if self:GetVar('storyText') then --make sure the script doesnt fail if the binoc doesnt have config data local flagNumber = self:GetVar('altFlagID') or (10000 + LEVEL:GetCurrentZoneID() + tonumber(string.sub(self:GetVar('storyText'), -2))) --make player flag number if (player:GetFlag{iFlagID = flagNumber}.bFlag == false) then --if the player flag is false, the player hasnt looked though the binocs before -- turn on the binocular effect self:PlayFXEffect{ name = "plaque_attract" , effectType = "attract" } else self:PlayFXEffect{ name = "plaquefx" , effectType = "display" } end end else -- if the player isnt fully loaded to check the player flag status, create 'heartbeat timer' GAMEOBJ:GetTimer():AddTimerWithCancel(1.0, "CheckPlayer", self) end end ---------------------------------------------- -- sent when the local player interacts with the -- object ---------------------------------------------- function onClientUse(self, msg) local player = GAMEOBJ:GetControlledID() -- check to see if we are the correct player if player:GetID() ~= msg.user:GetID() or self:GetVar('isInUse') then return end -- tell the Story Box UI element to open and what to display, then turn off the interaction icon UI:SendMessage("pushGameState", {{"state", "Story"}, {"context", {{"visible", true }, {"text", getText(self) }, {"senderID", player}, {"callbackObj", self}}} }) toggleActivatorIcon(self, true) player:UsedInformationPlaque{i64Plaque = self} -- check to see if there is a valid achievement mission set in HF config data, then UpdateMissionTask if needed. if getMission(self) then local boxFlag = self:GetVar('altFlagID') or (10000 + LEVEL:GetCurrentZoneID() + tonumber(string.sub(self:GetVar('storyText'), -2))) if (player:GetFlag{iFlagID = boxFlag}.bFlag == false) then player:SetFlag{iFlagID = boxFlag, bFlag = true} self:StopFXEffect{name = "plaque_attract" } self:PlayFXEffect{ name = "plaquefx" , effectType = "display" } end end end function onTerminateInteraction(self,msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleStoryBox", {{"visible", false }} ) toggleActivatorIcon(self, false, true) end ---------------------------------------------- -- sent when the object story box is closed; -- this can be done by hitting the x, esc or enter ---------------------------------------------- function onMessageBoxRespond(self, msg) -- UI element has been closed turn on the icon toggleActivatorIcon(self) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- sent when the requested local player is hit -- by something, this is used to close the story box ---------------------------------------------- function notifyOnHit(self, other, msg) -- player was hit close the UI element and turn on the icon UI:SendMessage( "ToggleStoryBox", {{"visible", false }} ) toggleActivatorIcon(self) end ---------------------------------------------- -- checks to see if there is config data set in -- HF, if not this returns the default message ---------------------------------------------- function getText(self) local textVar = self:GetVar('storyText') -- default story box text message, tells the developer how to put in the localization string if not textVar then return [[Missing story text, set the correctly localization string in HF configdata. Format = storyText -> 0:stringName]] end return Localize(textVar) end ---------------------------------------------- -- checks to see if there is config data set in -- HF, if not this returns -1 ---------------------------------------------- function getMission(self) local missVar = self:GetVar('storyText') -- check if there is a mission set in HF config data and return the correct info if not missVar then missVar = -1 end return missVar end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide, bFromTerminate) local player = GAMEOBJ:GetControlledID() if not bHide then -- show the icon, cancel notification, set isInUse to false bHide = false self:SetVar('isInUse', false) self:SendLuaNotificationCancel{requestTarget=player, messageName="OnHit"} if not bFromTerminate then player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="OnHit"} end -- request the interaction update self:RequestPickTypeUpdate() end function onTimerDone (self,msg) if (msg.name == "CheckPlayer") then onRenderComponentReady(self,msg) end end-- Script for the golem QB which will need to be completed to expose the Maelstrom Dragon's weak point to the player function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 10.5 , "GolemBreakTimer", self ) end function onRebuildNotifyState(self, msg) local Dragon = self:GetParentObj().objIDParent self:SetVar("userID", msg.player:GetID()) if( Dragon == nil or Dragon:Exists() == false ) then return end -- a player just did the quickbuild. if (msg.iState == 2) then -- Notify the Dragon that the build is done and using the player as the sender so we can update missions. Dragon:NotifyObject{ ObjIDSender = msg.player, name = "rebuildDone" } GAMEOBJ:GetTimer():CancelTimer("GolemBreakTimer", self); -- Cancel the revive timer to restart it GAMEOBJ:GetTimer():AddTimerWithCancel( 10.5 , "GolemBreakTimer", self ) --self:PlayAnimation{ animationID = "dragonsmash1" } self:PlayAnimation{ animationID = "dragonsmash" } -- GAMEOBJ:GetTimer():AddTimerWithCancel( 3.667 , "loopingTimer", self ) end -- the rebuild was cancelled if (msg.iState == 4) then Dragon:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } end end function onDie(self, msg) local Dragon = self:GetParentObj().objIDParent if( Dragon == nil or Dragon:Exists() == false ) then return end Dragon:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } end onTimerDone = function(self, msg) if msg.name == "GolemBreakTimer" then self:RebuildCancel{bEarlyRelease = true, userID = GAMEOBJ:GetObjectByID(self:GetVar("userID"))} self:RequestDie{} end -- if msg.name == "loopingTimer" then -- self:PlayAnimation{ animationID = "dragonsmash2" } -- GAMEOBJ:GetTimer():AddTimerWithCancel( 9, "endTimer", self ) -- end -- if msg.name == "endTimer" then -- self:PlayAnimation{ animationID = "dragonsmash3" } -- end end -------------------------------------------------------------- -- LEGO Club door Client Script -- updated mrb... 6/15/10 -- added updated UI -------------------------------------------------------------- local instanceIcon = 87 -- npcIcon out of db function onStartup(self) -- set up the two proximity radius for icon display self:SetProximityRadius{iconID = instanceIcon, radius = 75, name = "Icon_Display_Distance"} end ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local verify = msg.objIDUser:GetLegoClubMembershipStatus() if not verify.bCountryEligible then if msg.isFromUI then -- This MUST be set to true, otherwise all requirements from this script will be ignored msg.HasReasonFromScript = true msg.Script_Failed_Requirement = true msg.Script_Reason = Localize("LEGO_CLUB_DOOR_MEMBERSHIP_UNAVAILABLE") --"Sorry LEGO Club is not available in your country." msg.Script_IconID = 3633 end msg.bCanUse = false end return msg end --------------------------------------------------- -- this gets called if you have the scripted -- interaction icon attached to the object through -- the mapicon db table, set icon and text --------------------------------------------------- function onGetInteractionDetails(self, msg) local verify = GAMEOBJ:GetControlledID():GetLegoClubMembershipStatus().bMember local uiText = Localize("LEGO_CLUB_DOOR_MEMBERSHIP_VERIFIED") --"Membership verified, interact to enter LEGO Club World." local mapID = self:GetVar("transferZoneID") if mapID == "1200" then uiText = Localize("LEGO_CLUB_DOOR_RETURN_TO_NS") --"Interact to return to Nimbus Station." elseif not verify then -- if we're not a member do this text uiText = Localize("LEGO_CLUB_DOOR_MEMBERSHIP_FAILED") --"You need to be a LEGO Club member to use this, interact to learn how to join." end msg.TextDetails = uiText return msg end ---------------------------------------------- -- sent when the local player interacts with the -- object ---------------------------------------------- function onClientUse(self, msg) if GAMEOBJ:GetLocalCharID() ~= msg.user:GetID() then return end local mapID = self:GetVar("transferZoneID") if mapID == "1200" then self:FireEventServerSide{args = tostring(GAMEOBJ:GetLocalCharID())} return end local verify = msg.user:GetLegoClubMembershipStatus().bMember local uiType = "Lego_Club_Valid" -- if not a member then use this UI type if not verify then uiType = "Lego_Club_Invalid" end msg.user:LegoClubAccessResult{ result = verify } -- send message to the UI to open the lobby UI:SendMessage("pushGameState", { {"state", "Lobby"}, {"context", {{"user", msg.user}, {"callbackObj", self}, {"HelpVisible", "show" }, {"type", uiType}} }}) self:SetVar("uiOpen", true) end ---------------------------------------------- -- sent when the object story box is closed; -- this can be done by hitting the x, esc or enter ---------------------------------------------- function onMessageBoxRespond(self, msg) -- UI element has been closed turn on the icon if msg.identifier == "PlayButton" then if msg.iButton == 1 then self:FireEventServerSide{args = tostring(GAMEOBJ:GetLocalCharID())} end end -- terminate interaction so the icon will come back GAMEOBJ:GetControlledID():TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end function onTerminateInteraction(self,msg) -- check to see if the help window is open if not self:GetVar("uiOpen") then return end local player = GAMEOBJ:GetControlledID() -- close the UI window because the interaction was terminated should return iButton -1 UI:SendMessage("ToggleInstanceEnter", {{"visible", false}}) UI:SendMessage( "popGameState", {{"state", "Lobby"}} ) self:SetVar("uiOpen", false) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end ------------------------------------------------------------- --Ronin script that kills them after a certain time ------------------------------------------------------------- function onStartup(self) self:SetVar("Set.SuspendLuaMovementAI", true) -- a state suspending scripted movement AI self:SetVar("Set.MovementType", "Wander") -- this is how the NPC will behave when not on a path. -- Wander Settings --------------------------------------------------------- self:SetVar("Set.WanderChance",100) -- Main Weight self:SetVar("Set.WanderDelayMin",5) -- Min Wander Delay self:SetVar("Set.WanderDelayMax", 5) -- Max Wander Delay self:SetVar("Set.WanderSpeed",1) -- Move speed self:SetVar("Set.wanderRadius",5) -- Move radius self:AddObjectToGroup{group = "RoninEnemies"} GAMEOBJ:GetTimer():AddTimerWithCancel( 60 , "Dead", self ) end function onTimerDone(self, msg) if msg.name == "Dead" then self:RequestDie{killType = SILENT} end end-------------------------------------------------------------- -- Description: Client side script to hide pedestals on -- external builds, qa/beta/live -- -- Created 4/27/10 mrb... -------------------------------------------------------------- function onStartup(self) local verInfo = self:GetVersioningInfo() -- check to see if the object is supposed to be blocked for beta if not verInfo.bIsInternal then self:SetVisible{visible = false, fadeTime = 0} end end -------------------------------------------------------------- -- Script to change the fog settings in Forbidden Valley as the player moves up the tree -- -- updated Brandi... 2/8/10 -------------------------------------------------------------- function onCollisionPhantom(self, msg) --print ("You entered") LEVEL:SetLights( true, 0x476A72, --ambient color false, 0xFFFFFF, --directional color false, 0xFFFFFF, --specular color false, 0x6B6B6B, --upper Hemi color false, { 0.84, -0.54, -0.08 }, --directional direction true, 0x0f2430, --fog color true, --modifying draw distances (all of them) 25.0, 50.0, --fog near min/max 150.0, 300.0, --fog far min/max 100.0, 100.0, --post fog solid min/max 100.0, 700.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh\env\fv_tree_scene-skybox.nif", 3.0 -- blend time ) end----------------------------------------------------------- -- this script is on the property guard in the ag property -- he needs to go away after the player completes the last mission in this property -- THIS SCRIPT NEEDS COMMENTING -- brandi 6/3/10 -- updated brandi 6/18/10 added notify object for accpeting the last mission -------------------------------- local flag = { misID872 = 97, misID873 = 98, misID874 = 99 } function onMissionDialogueOK(self,msg) local player = msg.responder local missionID = msg.missionID local mission = "misID"..missionID -- the player accepts the mission to touch the orb, and hasnt touched the orb yet, so the mission cam if msg.iMissionState == 1 then if player:GetFlag{iFlagID = flag[mission]}.bFlag == false then player:PlayCinematic{ pathName = "MissionCam" } end --if the player completes the last mission, the guard should teleport away elseif msg.iMissionState == 4 then GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "GuardChat", paramObj = Guard } GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "SelfDie",self ) end end function onTimerDone(self,msg) if msg.name == "SelfDie" then self:RequestDie{ killerID = self, killtype = "VIOLENT" } LEVEL:GetSpawnerByName("Guard"):SpawnerDeactivate() end end-------------------------------------------------------------- -- (SERVER SIDE) Obstacle Course Starter NPC -- -- Starts the course for the player -- updated 9/28/10 - check if player is in prox -------------------------------------------------------------- ---------------------------------------------------------------- -- Includes ---------------------------------------------------------------- require('ai/AG/L_AG_SCENE_2_INCLUDE') MS_IN_SEC = 1000 ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function onStartup(self) -- set max users to something high self:SetActivityParams{ modifyActivityActive=true, activityActive = true, maxUsers = 9999, modifyMaxUsers = true } self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="PlayerExit"} self:SetProximityRadius{radius = self:GetInteractionDistance().fDistance + 10, name = "Interaction_Distance"} end ---------------------------------------------------------------- -- Returns true/false if a player is in the activity -- takes SELF and a PLAYER object ---------------------------------------------------------------- function IsPlayerInActivity(self, player) -- check if player is in activity local existMsg = self:ActivityUserExists{ userID = player } if (existMsg) then return existMsg.bExists end return false end ---------------------------------------------------------------- -- Happens on interaction for server ---------------------------------------------------------------- function onUse(self, msg) -- get player who clicked on us local player = msg.user if not checkInProximity(self, player) then return end if player:GetFlag{iFlagID = 115}.bFlag then player:DisplayMessageBox{bShow = true, imageID = 1, callbackClient = self, text = "FOOT_RACE_STOP_QUESTION", identifier = "FootRaceCancel"} else -- check if player is in course if ( IsPlayerInActivity(self, player) == true ) then -- offer exit self:Help{rerouteID = player, iHelpID = 0} else -- offer start activity self:Help{rerouteID = player, iHelpID = 1} end end end function checkInProximity(self, player) local proxObjects = self:GetProximityObjects{name = "Interaction_Distance"}.objects for k,v in ipairs(proxObjects) do if v:GetID() == player:GetID() then return true end end return false end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) -- Response to Exit activity dialog and user pressed OK if ( msg.identifier == "player_dialog_cancel_course" and msg.iButton == 1) then -- remove the user self:RemoveActivityUser{ userID = msg.sender } self:NotifyClientObject{name = "cancel_timer", rerouteID = msg.sender} -- Response to Start activity dialog and ok is pressed and player is not in activity elseif (msg.identifier == "player_dialog_start_course" and msg.iButton == 1 and IsPlayerInActivity(self, msg.sender) == false) then if not checkInProximity(self, msg.sender) then self:NotifyClientObject{name = "out_of_bounds", rerouteID = msg.sender} return end -- add the new user self:AddActivityUser{ userID = msg.sender } -- start the activity for the new user StartActivity(self, msg.sender) elseif msg.identifier == "FootRaceCancel" and msg.iButton == 1 then local tFootRaceStarters = self:GetObjectsInGroup{ group = 'FootRaceStarter', ignoreSpawners = true }.objects for k,v in ipairs(tFootRaceStarters) do -- remove the user if IsPlayerInActivity(v, msg.sender) then v:NotifyClientObject{name = "stop_timer" , rerouteID = msg.senderID} break end end -- check if player is in course if ( IsPlayerInActivity(self, msg.sender) == true ) then -- offer exit self:Help{rerouteID = msg.sender, iHelpID = 0} else -- offer start activity self:Help{rerouteID = msg.sender, iHelpID = 1} end -- turn off the player flag for is player in foot race msg.sender:SetFlag{iFlagID = 115, bFlag = false} end end ---------------------------------------------------------------- -- Stores the start time for the player in the activity and -- sends messages to start it ---------------------------------------------------------------- function StartActivity(self, player) -- get the current time in sec local startTime = (GAMEOBJ:GetSystemTime() / MS_IN_SEC) + 4 self:NotifyClientObject{name = "start_timer" , rerouteID = player} self:SetActivityUserData{ userID = player, typeIndex = 1, value = tonumber(startTime) } end ---------------------------------------------------------------- -- Handle FireEvent message ---------------------------------------------------------------- function onFireEvent(self, msg) -- user is trying to cancel if ( msg.args == "course_cancel" and IsPlayerInActivity(self, msg.senderID) == true ) then --print(msg.senderID:GetName().name .. ' canceled the race') self:NotifyClientObject{name = "cancel_timer", rerouteID = msg.senderID} -- remove the user from activity self:RemoveActivityUser{ userID = msg.senderID } -- notify user of remove self:Help{rerouteID = msg.senderID, iHelpID = 2} elseif ( msg.args == "course_finish" and IsPlayerInActivity(self, msg.senderID) == true ) then -- store the finish time in sec local endTime = GAMEOBJ:GetSystemTime() / MS_IN_SEC -- store the time as activity rating [1] self:SetActivityUserData{ userID = msg.senderID, typeIndex = 2, value = tonumber(endTime) } -- distribute rewards self:DistributeActivityRewards{ userID = msg.senderID, bAutoAddCurrency = true, bAutoAddItems = true } -- do complete activity events --self:CompleteActivity{ userID = msg.senderID } self:CompleteActivity{ userID = msg.senderID} -- remove the user from activity self:RemoveActivityUser{ userID = msg.senderID } end end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function notifyPlayerExit(self, other, msg) if IsPlayerInActivity(self, msg.playerID) then -- remove the user from activity self:RemoveActivityUser{ userID = msg.playerID } end end -------------------------------------------------------------- -- Passes start/end time and gets the total time -------------------------------------------------------------- function GetTotalTime(startTime, endTime) -- calculate total time (subtract countdown and cap at 0) local totalTime = tonumber(endTime) - tonumber(startTime) --totalTime = totalTime -- - CONSTANTS["COUNTDOWN_DELAY_SEC"] if (totalTime < 0) then totalTime = 0 end return math.floor(totalTime) end -------------------------------------------------------------- -- Called when the activity is trying to calculate final rating -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- get the time for the player local totalTime = GetTotalTime(msg.fValue2, msg.fValue3) msg.outActivityRating = totalTime return msg end -------------------------------------------------------------- -- Called when the activity is trying to complete -------------------------------------------------------------- function onDoCompleteActivityEvents(self, msg) -- get the time for the player local totalTime = GetTotalTime(msg.fValue2, msg.fValue3) self:SetActivityUserData{ userID = msg.userID, typeIndex = 1, value = tonumber(totalTime) } --print(msg.userID:GetName().name .. " Total Time" .. msg.fValue2 .. " - " .. msg.fValue3 .. " = " .. totalTime) -- complete mission 286 if it's not already complete if msg.userID:GetMissionState{missionID = 286}.missionState < 8 then msg.userID:UpdateMissionTask{taskType = "complete", value = 286, value2 = 1, target = self} end -- complete activities (Note: negate time to work with perform activity task types / convert back to ms) totalTime = totalTime -- * MS_IN_SEC --total time has to be negative for perform activity task to function properly msg.userID:UpdateMissionTask{ taskType = "performact_time", value2 = self:GetActivityID().activityID, value = totalTime * -1 } -- Update Leaderboards for this user (Note: negate time to work with perform activity task types) self:UpdateActivityLeaderboard{ userID = msg.userID } local actID = self:GetActivityID().activityID -- get the leaderboard data for the user and update summary screen if it exists msg.userID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = actID } self:NotifyClientObject{name = "ToggleLeaderBoard", param1 = actID, paramObj = msg.userID , rerouteID = msg.userID} --print(msg.senderID:GetName().name .. ' finished the race') self:NotifyClientObject{name = "stop_timer" , param1 = 1, param2 = totalTime, rerouteID = msg.userID} -- notify user of remove self:Help{rerouteID = msg.userID, iHelpID = 3} end ---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 99 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } local GUIDPeaceful3D = {} GUIDPeaceful3D["Audio-Birds"] = "{2db8a5cc-851d-4ec3-bdb9-be1b3c8376e1}" GUIDPeaceful3D["Audio-Wind"] = "{17e24329-697a-4890-b7d4-0e59a04aa7f2}" GUIDPeaceful3D["2D Ambience"] = "{afac2aa2-6123-4128-a9ef-1ada8074912d}" ---------------------------------------------------------------- -- Statrup, Sets up us some variables ---------------------------------------------------------------- function onStartup(self) self:SetVar("GUIDPeaceful3D", GUIDPeaceful3D) end ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 200.0, 400.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/PP_PlayerProperty/M_Medium/env_sky_fv_property.nif") LEVEL:SetLights( true, 0xD8E9FF, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color true, 0xADADAD, --upper Hemi color true, { 0.09, -0.91, -0.40 }, --directional direction true, 0x244959, --fog color true, --modifying draw distances (all of them) 1.0, 100.0, --fog near min/max 265.0, 265.0, --fog far min/max 100.0, 100.0, --post fog solid min/max 100.0, 700.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_ag_property.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end--------------------------------------------------------------- --right console to be rebuilt to cause the blue brick to become available --------------------------------------------------------------- function onStartup(self) self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then --print("console built") self:SetVar("IAmBuilt", true) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console built, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleRightUp", ObjIDSender = self} end elseif msg.iState == 4 then self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console destroyed, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleRightDown", ObjIDSender = self} end end end function onUse(self, msg) --print("console being used") if self:GetVar("AmActive") == true then return end if self:GetVar("IAmBuilt") == true then self:SetVar("AmActive", true) --print("the console has been activated") local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console activated") object:NotifyObject{name = "ConsoleRightActive", ObjIDSender = self} end end msg.user:TerminateInteraction{type = "fromInteraction", ObjIDTerminator = self} endrequire('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 581) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 29) -- Confirms that this is a faction set skill trigger self:SetVar("isFactionSkill", true) -- Set the faction skill as ready to fire self:SetVar("factionSkillReady", true) -- The time the faction skill has for its "cooldown" self:SetVar("factionCooldownTime", 11) end -------------------------------------------------------------- -- Server side script for the lootable chest for the dragon fight. -- -- updated by mrb... 8/30/10 - added network var from server so -- that only one person can use the chest, but all clients get the animations -------------------------------------------------------------- --------------------------------------------------------- -- ON START UP --------------------------------------------------------- function onStartup(self) -- set up the activity self:SetActivityParams{ modifyMaxUsers = true, maxUsers = 4, modifyActivityActive = true, activityActive = true} end function onUse(self,msg) local player = msg.user -- send network var down to the clients that the chest is used if not self:GetNetworkVar("bUsed") then self:SetNetworkVar("bUsed", true) else return end -- if the player isn't in the activity then add them if not self:ActivityUserExists{userID = player}.bExists then self:AddActivityUser{ userID = player } end spawnLoot(self, player) end function spawnLoot(self, player, matrix) -- give out activity rewards self:DistributeActivityRewards{userID = player, bAutoAddCurrency = false, bAutoAddItems = false, bUseTeam = true} -- remove the player from the activity self:RemoveActivityUser{userID = player} end -------------------------------------------------------------- -- Calculate an activity rating for this object -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) local iPlayers = msg.userID:TeamGetSize().size -- if the team size is 0 there's only one player in the instance if iPlayers == 0 then iPlayers = 1 end --print("# of players: " .. iPlayers) msg.outActivityRating = iPlayers return msg end -------------------------------------------------------------- -- Client side script for the lootable chest for the dragon fight. -- -- updated by mrb... 8/30/10 - added network var from server so -- that only one person can use the chest, but all clients get the animations -------------------------------------------------------------- -- local constants local sOpenFX = "glow" local sIdleFX = "idiot" local sInteractAnim = "open" local sDeathAnim = "death" local sCreateAnim = "create" function onRenderComponentReady(self, msg) -- play the spawn animation and idle fx self:PlayAnimation{animationID = sCreateAnim, bPlayImmediate = true} self:PlayFXEffect{name = "onCreate", effectType = sIdleFX} end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') or self:GetNetworkVar("bUsed") then -- dont show the icon if it's in use msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if not bHide then -- show the icon, cancel notification, set isInUse to false self:SetVar('isInUse', false) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) end -- request the interaction update self:RequestPickTypeUpdate() end function onCheckUseRequirements(self, msg) -- only let the player use the chest one time if self:GetVar("isInUse") or self:GetNetworkVar("bUsed") then msg.bCanUse = false end return msg end function onScriptNetworkVarUpdate(self,msg) for k,v in pairs(msg.tableOfVars) do if k == "bUsed" then closeChest(self) --print("local player = " .. GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetName().name) end end end function closeChest(self) -- get the animation time for the timers local animTime = self:GetAnimationTime{animationID = sInteractAnim}.time -- turn off the interaction icon toggleActivatorIcon(self, true) -- play the open fx/animation self:PlayFXEffect{name = "openFX", effectType = sOpenFX} self:PlayAnimation{animationID = sInteractAnim, bPlayImmediate = true} -- add in timers to stop fx and remove the chest GAMEOBJ:GetTimer():AddTimerWithCancel(animTime, "killChest", self) GAMEOBJ:GetTimer():AddTimerWithCancel(2, "StopFX", self) end function onTimerDone(self, msg) if msg.name == "killChest" then -- get the animation time for the timers local animTime = self:GetAnimationTime{animationID = sDeathAnim}.time -- add timer to hide the chest GAMEOBJ:GetTimer():AddTimerWithCancel(animTime - 0.2, "HideChest", self) -- play death anim and stop the idle fx self:PlayAnimation{animationID = sDeathAnim, bPlayImmediate = true} self:StopFXEffect{name = "onCreate"} elseif msg.name == "StopFX" then --toggleActivatorIcon(self) -- stop the open fx self:StopFXEffect{name = "openFX"} elseif msg.name == "HideChest" then -- hide the chest self:SetVisible{visible = false, fadeTime = 0.2} end end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 394) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 2) -- Confirms that this is a faction set skill trigger self:SetVar("isFactionSkill", true) -- Set the faction skill as ready to fire self:SetVar("factionSkillReady", true) -- The time the faction skill has for its "cooldown" self:SetVar("factionCooldownTime", 11) end ---------------------------------------------------------------- -- level specific Server script for Property Pushback in NS small property -- this script requires a base script -- this script should be in the zone script in the DB -- updated mrb... 9/7/10 - added brickLinkMissionID ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "BehavQB", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "Clouds", -- the damaging maelstrom cloud FX around the property Enemies = "Enemies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "PiratesWander","PiratesGen","AdmiralsWander","AdmiralsGen" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "BehavPlat", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "Clouds", -- the spawner network for the damaging maelstrom clouds FXSpots = "Spots", -- the spawner network for the non-damaging fx spots PropMG = "Guard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "Birds","Falls"}, -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned BehaviorObjs = { "TrappedPlatform", "IceBarrier","FireBeast" } -- Behavior scenerio object } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 98, -- when the player builds the claim marker, this flag is set placedModel = 106, -- when a player places a model for the first time, this flag is set guardMission = 873, -- last mission for the guard password = "s3kratK1ttN",-- behavior password build qb object with behaviors generatorID = 11109, -- lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 11001, -- lot id of the behavior platform quickbuild brickLinkMissionID = 949 -- Achievement ID to complete on property rental } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player places a model, the first time it turns off the spots and sets a player flag ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) baseZonePropertyModelPlaced(self,msg,newMsg) end ---------------------------------------------------------------- -- called from the generator object and the claimmarker object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when orb is collided with ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) baseNotifyObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end-------------------------------------------------------------- -- Client side script on the console behind the paradox rep. -- this script checks to see if the player can use the console, and if not -- it shows them and tells them why not -- server script is located scripts\ai\NS\L_NS_TOKEN_CONSOLE_SERVER.lua -------------------------------------------------------------- -- Variables pulled out to make tweaking the numbers easier for systems local bricksToTake = 25 -- the maelstrom infected bricks this interaction cost -- MAKE SURE THIS MATCHES THE SERVER SIDE SCRIPT -- REMEMBER TO CHANGE STRING IN LOCALIZATION TABLE REQUIRED_MAELSTROM_BRICKS -- checks to see if the player is eligible to use the console function onCheckUseRequirements(self,msg) -- to make sure the player isn't interacting with the object just to quickbuild it -- state 2 means the quickbuild is complete if self:GetRebuildState{}.iState == 2 then local player = msg.objIDUser -- has the player joined a faction if player:GetMissionState{missionID = 474}.missionState < 8 then msg.HasReasonFromScript = true msg.Script_IconID = 3275 msg.Script_Reason = Localize("NS_FACTION_REPS") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false -- mission on Paradox Rep to get the hammer from FV elseif player:GetMissionState{missionID = 509}.missionState < 8 then msg.HasReasonFromScript = true msg.Script_IconID = 2867 msg.Script_Reason = Localize("NEED_HAMMER") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false -- mission on the paradox rep to interact with the console elseif player:GetMissionState{missionID = 781}.missionState < 8 or player:GetMissionState{missionID = 863}.missionState < 2 then msg.HasReasonFromScript = true msg.Script_IconID = 2983 msg.Script_Reason = Localize("TALK_PARADOX_REP") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false -- need to have certain number of maelstrom bricks elseif player:GetInvItemCount{ iObjTemplate = 6194}.itemCount < bricksToTake then msg.HasReasonFromScript = true msg.Script_IconID = 2926 msg.Script_Reason = Localize("REQUIRED_MAELSTROM_BRICKS") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false end return msg end end -- This function is called when the object starts up or someone requests a pick type update -- Handling this to set pick type on an object, which makes it able to be interactive function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type (Setting to -1 makes something non-interactive) end return msg end ---------------------------------------------------------------- --Base Client script for property pushback. --this script is required from a level specific script -- this script will only work with the server script as well ---------------------------------------------------------------- ---------------------------------------------------------------- -- Define empty tables that will be set from the level specific script ---------------------------------------------------------------- local Group = {} local Flags = {} local GUIDMaelstrom3D = {} GUIDMaelstrom3D["Audio-Birds"] = "{333e951e-c0af-4e16-955a-c5348b948b4a}" GUIDMaelstrom3D["Audio-Wind"] = "{4f9cc3d8-01a9-41c4-a078-a238cf1bc99b}" ---------------------------------------------------------------- -- variables passed of the level specific script that are used throughout the base script ---------------------------------------------------------------- function setGameVariables(passedGroups,passedFlags) Group = passedGroups Flags = passedFlags end ---------------------------------------------------------------- -- called when the server script sets a network var ---------------------------------------------------------------- function baseScriptNetworkVarUpdate(self,msg) local player = GAMEOBJ:GetControlledID() -- the property is unclaimed, turn the visiblity on the border and the vendor off if msg.tableOfVars["unclaimed"] then borderOff(self) if player:GetFlag{ iFlagID = Flags.defeatedPropFlag }.bFlag == false then vendorOff(self) else if not self:GetVar("hasPlayedPeaceful") then self:SetVar("hasPlayedPeaceful", true) --Peaceful sounds will change from map to map, so a child script will have to set the sounds as a var if(self:GetVar("GUIDPeaceful3D")) then handle3DSounds(self, self:GetVar("GUIDPeaceful3D"), true) end SOUND:ActivateNDAudioMusicCue("Property_Peaceful") end end -- the property is rented elseif msg.tableOfVars["renter"] then -- if the local player is not the renter, turn the border off if msg.tableOfVars["renter"] ~= player:GetID() then borderOff(self) end --Peaceful sounds will change from map to map, so a child script will have to set the sounds as a var if(self:GetVar("GUIDPeaceful3D")) then handle3DSounds(self, self:GetVar("GUIDPeaceful3D"), true) end SOUND:ActivateNDAudioMusicCue("Property_Peaceful") end end ---------------------------------------------------------------- -- turns the visiblity on the property off ---------------------------------------------------------------- function borderOff(self) -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PlaqueGroup, ignoreSpawners = true }.objects -- make sure it got something from the group if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do -- use the property plaque to turn the visiblility of the border asset off propertyPlaques[i]:SetPropertyBoundsVisibility{visible = false} end else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkBorderAgain", self ) end end ---------------------------------------------------------------- -- turns the visiblity on the property off ---------------------------------------------------------------- function vendorOff(self) -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PlaqueGroup, ignoreSpawners = true }.objects -- make sure it got something from the group if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do -- use the property plaque to turn the visiblility of the vendor asset off propertyPlaques[i]:SetPropertyVendorVisibility{visible = false} end else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "checkVendorAgain", self ) end end ---------------------------------------------------------------- -- called when the script is sent messages from the server script ---------------------------------------------------------------- function baseNotifyClientObject(self,msg) -- turn the normal property sky on if msg.name == "SkyOff" then maelstromSkyOff(self) --print("skyoff") --Peaceful sounds will change from map to map, so a child script will have to set the sounds as a var if(self:GetVar("GUIDPeaceful3D")) then handle3DSounds(self, self:GetVar("GUIDPeaceful3D"), true) end SOUND:ActivateNDAudioMusicCue("Property_Peaceful") -- turn the maelstrom sky on elseif msg.name == "maelstromSkyOn" then maelstromSkyOn(self) handle3DSounds(self, GUIDMaelstrom3D, true) SOUND:ActivateNDAudioMusicCue("Property_Maelstrom") else -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PlaqueGroup, ignoreSpawners = true }.objects -- turn the visiblity on the vendor asset on if msg.name == "vendorOn" then if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do propertyPlaques[i]:SetPropertyVendorVisibility{visible = true} end end -- turn the property border on elseif msg.name == "boundsOn" then if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do propertyPlaques[i]:SetPropertyBoundsVisibility{visible = true, fadeTime=0.5} end end -- play the turn on animation for the border elseif msg.name == "boundsAnim" then if propertyPlaques then for i = 1, table.maxn(propertyPlaques) do propertyPlaques[i]:SetPropertyBoundsVisibility{visible = true}--, animationName = "BorderIn"} end end elseif msg.name == "GuardChat" then local Guard = self:GetObjectsInGroup{ group = Group.Guard, ignoreSpawners = true }.objects[1] Guard:DisplayChatBubble{wsText = Localize("PROPERTY_GUARD") } --"I need to go help other minifigures secure their properties. Have fun." elseif msg.name == "PlayCinematic" then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage( "pushGameState", {{"state", "cinematic" }} ) player:PlayCinematic { pathName = msg.paramStr } local cineTime = tonumber(LEVEL:GetCinematicInfo(msg.paramStr)) GAMEOBJ:GetTimer():AddTimerWithCancel( cineTime, "cinematicTimer",self ) if msg.paramStr == "DestroyMaelstrom" then --turn off the maelstrom ambients handle3DSounds(self, GUIDMaelstrom3D, false) SOUND:DeactivateNDAudioMusicCue("Property_Maelstrom") SOUND:FlashNDAudioMusicCue("Property_Cinematic") end end end end function handle3DSounds(self, sounds, startSound) --iterate through all our 3D sounds, find the object group that they need to be played on for groupName, GUID in pairs(sounds) do local emitters = self:GetObjectsInGroup{ group = groupName, ignoreSpawners = true }.objects for index, emitter in ipairs(emitters) do if(startSound) then emitter:Play3DAmbientSound{m_NDAudioEventGUID = GUID} else emitter:Stop3DAmbientSound{m_NDAudioEventGUID = GUID} end end end end ---------------------------------------------------------------- -- called when the map shuts down ---------------------------------------------------------------- function baseShutdown(self) DisableLUT(self) end ---------------------------------------------------------------- -- set the LUT back to normal ---------------------------------------------------------------- function DisableLUT(self) LEVEL:CLUTEffect( "(none)", 0.0, 1.0, 0.0, false ) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function baseTimerDone(self,msg) -- set the LUT back to normal if msg.name == "DisableLUT" then DisableLUT(self) elseif msg.name == "checkBorderAgain" then borderOff(self) elseif msg.name == "checkVendorAgain" then vendorOff(self) elseif msg.name == "cinematicTimer" then UI:SendMessage( "popGameState", {{"state", "cinematic"}} ) end end-------------------------------------------------------------- -- Description: -- -- Client script for playing effect on battlefield outpost console -- created mrb... 1/22/10 -- modified by brandi 9/8/10.. took out the picktype stuff, since the console is a mission giver, that system handles all of it -------------------------------------------------------------- function onClientUse(self, msg) local playerID = GAMEOBJ:GetLocalCharID() -- check if this is the local palyer or not if playerID ~= msg.user:GetID() then return end self:PlayFXEffect{name = "onInteract",effectType = "interact"} end function onTerminateInteraction(self,msg) self:StopFXEffect{name = "onInteract"} end -------------------------------------------------------- --horsemen 1 script -------------------------------------------------------- function onStartup(self) self:SetVar("Set.SuspendLuaMovementAI", true) -- a state suspending scripted movement AI self:SetVar("Set.MovementType", "Wander") -- this is how the NPC will behave when not on a path. -- Wander Settings --------------------------------------------------------- self:SetVar("Set.WanderChance",100) -- Main Weight self:SetVar("Set.WanderDelayMin",5) -- Min Wander Delay self:SetVar("Set.WanderDelayMax", 5) -- Max Wander Delay self:SetVar("Set.WanderSpeed",1) -- Move speed self:SetVar("Set.wanderRadius",5) -- Move radius --print("horseman 1 starting up") --print( tostring(self:GetVar("groupID")) ) for groupName in string.gmatch(self:GetVar("groupID"), "%w+;") do -------------------------------------------------------------- --get the name of the group that the object is in and trim off the ';'s -------------------------------------------------------------- groupName = string.sub(groupName, 1, -2) local mygroup = self:GetObjectsInGroup{group = groupName, ignoreSpawners = true}.objects -------------------------------------------------------------- --for the object in my group with ID 8551, tell it I spawned -------------------------------------------------------------- for i, object in ipairs(mygroup) do if object:GetLOT().objtemplate == 8551 then object:FireEvent{args = "ISpawned", senderID = self} --print("telling the turret I spawned") end end end end -- on horseman death function onDie(self,msg) -- if Brick Fury killed the horseman if msg.killerID:GetLOT().objtemplate == 8665 then -- get the mission update volume by group name, tell it Brick fury killed the horseman local volume = self:GetObjectsInGroup{group = "HorsemenTrigger", ignoreSpawners = true}.objects[1] --I'm assuming there is only one volume if volume then volume:FireEvent{senderID = self; args = "HorsemanDeath"} end end end-------------------------------------------------------------- -- Description: Base Client script for Shooting Gallery NPC -- in GF area. Lets client know the object can be interacted with -- players are stored as a table with the playerID as a key and -- the readyState as a value. -- -- ALSO: Add L_BASE_DRAG_INTERACT_INSTANCER_SERVER.lua -- to server side to make instancer use drag to interact -- and double click functionality (racing) -- -- updated mrb... 9/10/10 -- checkInProximity function and check onCheckUseRequirements if itemType -------------------------------------------------------------- local tVars = {} local tLobby = {} ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local verInfo = msg.objIDUser:GetVersioningInfo() -- check to see if the instancer is supposed to be blocked for beta if not verInfo.bIsInternal and verInfo.iMajorRelease < 1 and verInfo.iVersionRelease < tVars.releaseVersion then local actNameKey = Localize("Activities_".. self:GetVar('ActivityTable').ActivityID .. "_ActivityName") msg.objIDUser:DisplayTooltip { bShow = true, strText = actNameKey .. " " .. Localize("MINIGAME_LOBBY_BETA_CLOSED_MESSAGE"), iTime = 3000 } msg.bCanUse = false else msg.bCanUse = checkChatServer(msg.objIDUser) end -- if this is an item interaction and they havent build a car/modular obj do this stuff if tVars.itemType then if not checkInProximity(self, msg.objIDUser:GetID()) then msg.bCanUse = false elseif msg.objIDUser:GetInvItemCount{iObjTemplate = tVars.itemType}.itemCount < 1 then msg.HasReasonFromScript = true msg.Script_IconID = 3140 msg.Script_Reason = Localize("MINIGAME_LOBBY_RACE_BUILD_A_CAR_FAIL") -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false end end local preConVar = self:GetVar("CheckPrecondition") if preConVar and preConVar ~= "" then local check = msg.objIDUser:CheckListOfPreconditionsFromLua{PreconditionsToCheck = preConVar, requestingID = self} if not check.bPass then msg.HasReasonFromScript = true msg.Script_IconID = check.IconID msg.Script_Reason = check.FailedReason msg.Script_Failed_Requirement = true msg.bCanUse = false end end return msg end function onProximityUpdate(self, msg) -- if the player is using a racing instancer and they entered into the interaction range then set lua notification if msg.name == "Interaction_Distance" and tVars.itemType then if msg.status == "ENTER" then self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetControlledID(), messageName="RequestUseItemOn"} else self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetControlledID(), messageName="RequestUseItemOn"} end end end function notifyRequestUseItemOn(self, other, msg) if tVars.itemType ~= msg.itemToUse:GetLOT().objtemplate then return end -- set the object that was double clicked if other:GetID() == GAMEOBJ:GetControlledID():GetID() then self:SetVar("UseObjectID", "|" .. msg.itemToUse:GetID()) --print(msg.itemToUse:GetName().name) end end function onGetInteractionDetails(self, msg) local instanceType = split(tVars.UI_Type, "_")[2] if instanceType == "Race" then msg.TextDetails = Localize("MINIGAME_LOBBY_RACE_DRAG_A_CAR_INTERACT") -- needs localization end return msg end function baseSetVars(self, table) tVars = table local actNum = self:GetActivityID().activityID -- 5 -- -- save out the activity table self:SetVar('ActivityTable', GAMEOBJ:GetDBTable{table='Activities',keyname='ActivityID',key=actNum}) -- we notify the game object system so it can predownload our zone assets GAMEOBJ:NotifyOfZoneTransferObject( self, actNum, 0 ) local instanceIcon = 78 local instanceType = split(tVars.UI_Type, "_")[2] if instanceType == "Survival" then instanceIcon = 79 elseif instanceType == "Dragon" then instanceIcon = 91 elseif instanceType == "SG" then instanceIcon = 81 end -- set up the two proximity radius for icon display self:SetProximityRadius{iconID = instanceIcon, radius = 35, name = "Icon_Display_Distance"} self:SetProximityRadius{radius = self:GetVar("interaction_distance"), name = "Interaction_Distance"} end function checkChatServer(player) -- check to see if the chat server is down if not player:GetServerState().bChatServerOnline then player:DisplayTooltip { bShow = true, strText = Localize("MINIGAME_LOBBY_CHAT_SERVER_DOWN"), iTime = 3000 } return false end return true end function showFirstScreen(self, player) -- if help window is open or chat server is down dont showFirstScreen if self:GetVar("helpOpen") or not checkChatServer(player) then return end -- check if the this object has been unlocked. if tVars.misID and player:GetMissionState{missionID = tVars.misID}.missionState < tVars.missionState then player:DisplayTooltip { bShow = true, strText = tVars.failText, iTime = 3000 } return end -- send message to the UI to open the lobby UI:SendMessage("pushGameState", {{"state", "Lobby"}, {"context", {{"user", player}, {"callbackObj", self}, {"HelpVisible", "show" }, {"type", tVars.UI_Type}} } }) self:SetVar("helpOpen", true) end function onClientUse(self, msg) local player = GAMEOBJ:GetControlledID() -- check if this is the local palyer or not if player:GetID() ~= msg.user:GetID() or self:GetVar('LobbyOpen') then return end -- see if this is an item interaction or a normal interaction if tVars.itemType then local modObj = player:GetFirstInventoryItemByLOT{ iObjTemplate = tVars.itemType, inventoryType = 5 }.itemID -- if we have an obj use it to interact or display the fail text if modObj then itemInteract(self, tVars.itemType, modObj) else player:DisplayTooltip { bShow = true, strText = tVars.failItem, iTime = 3000 } end else showFirstScreen(self, player) end end function checkInProximity(self, playerID) -- do we have the required variables passed to us? if not playerID then return end -- see if the player is within the client side interaction proximity for k,v in ipairs(self:GetProximityObjects{name = "Interaction_Distance"}.objects) do if v:GetID() == playerID then return true end end -- if not then return false return false end function checkDoubleClickInteract(self, playerID, objID) -- do we have the required variables passed to us? if not playerID or not objID or not checkInProximity(self, playerID) then return end local player = GAMEOBJ:GetControlledID() -- check to make sure we have the correct player and that the object double clicked was the correct LOT if playerID ~= player:GetID() or GAMEOBJ:GetObjectByID(objID):GetLOT().objtemplate ~= tVars.itemType then return end -- find the first LOT in the players inventory local modObj = player:GetFirstInventoryItemByLOT{ iObjTemplate = tVars.itemType, inventoryType = 5 }.itemID -- if we have an obj then sen the interaction if modObj then -- set the player interaction player:SetPlayerInteraction{interaction = self} -- send message to use the obj as the drag interaction itemInteract(self, tVars.itemType, modObj) end end function onScriptNetworkVarUpdate(self, msg) local player = GAMEOBJ:GetControlledID() -- check to see if we have the correct message and deal with it if msg.tableOfVars["bPassedCheck.1"] == player:GetID() then checkDoubleClickInteract(self, msg.tableOfVars["bPassedCheck.1"], msg.tableOfVars["bPassedCheck.2"]) end end function onUseItemOnClient(self,msg) -- if we aren't an item interaction return out of this function if not tVars.itemType then return end -- set the player interaction msg.playerID:SetPlayerInteraction{interaction = self} itemInteract(self, msg.itemLOT, msg.itemToUse) end function itemInteract(self, itemLOT, itemToUse) -- check to see if the itemLOT matches the interaction item in tVars if itemLOT == tVars.itemType then -- open the help window showFirstScreen(self, GAMEOBJ:GetControlledID()) -- Store the item they dropped on us self:SetVar(GAMEOBJ:GetControlledID():GetID(), itemToUse:GetID()) else GAMEOBJ:GetControlledID():DisplayTooltip { bShow = true, strText = tVars.failItem, iTime = 3000 } end end function onTerminateInteraction(self,msg) -- check to see if the help window is open if not self:GetVar("helpOpen") then return end local player = GAMEOBJ:GetControlledID() -- see if the player fails the mission state check if tVars.misID and player:GetMissionState{missionID = tVars.misID}.missionState < tVars.missionState then return end -- close the UI window because the interaction was terminated should return iButton -1 UI:SendMessage("ToggleInstanceEnter", {{"visible", false}}) UI:SendMessage( "popGameState", {{"state", "Lobby"}} ) self:SetVar("helpOpen", false) end function onMessageBoxRespond(self, msg) -- when the player hit's ok or hits enter transfer to new zone local player = GAMEOBJ:GetControlledID() --print(msg.identifier .. " : " .. msg.iButton) -- handle UI button responses if msg.iButton == 1 then if msg.identifier == "PlayButton" and not self:GetVar('LobbyOpen')then self:SetVar("helpOpen", false) EnterLobby(self, player) elseif msg.identifier == "LobbyReady" then player:MatchRequest{type = 1, value = 1} -- type: 1 = REQUEST_READY; value = (1 = ready, 0 = notready) elseif msg.identifier == "LobbyUnready" then player:MatchRequest{type = 1, value = 0} end elseif msg.iButton == -1 then if msg.identifier == "CloseButton" then self:SetVar("helpOpen", false) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end end if msg.identifier == "LobbyExit" and msg.iButton ~= -1 then LeaveLobby(self,player) end end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 -- set the pick type if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority msg.ePickType = 14 -- Interactive pick type end return msg end function notifyServerStateNotify(self, other, msg) -- check to see if the chat server is online if not bChatServerOnline then -- close the UI window because the interaction was terminated should return iButton -1 GAMEOBJ:GetTimer():CancelAllTimers(self) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) LeaveLobby(self,other) other:DisplayTooltip { bShow = true, strText = Localize("MINIGAME_LOBBY_CHAT_SERVER_DOWN"), iTime = 3000 } end end function notifyDie(self, other, msg) -- if the player dies leave the lobby LeaveLobby(self,other) end function notifyMatchUpdate(self,other,msg) -- check to make sure we were sent a msg and the lobby is open if not msg or not self:GetVar('LobbyOpen') then return end if msg.data.player then if msg.type == 0 then --print('MatchUpdate - ' .. msg.type .. ' = ' .. GAMEOBJ:GetObjectByID(msg.data.player):GetName().name) local tempTable = self:GetVar('tLobbyPlayers') local tempTable2 = self:GetVar('tLobbyPlayerNames') local bAdd = true -- create a tempTable if there isn't tLobbyPlayers in GetVar if not tempTable then tempTable = {} end -- create a tempTable2 if there isn't tLobbyPlayerNames in GetVar if not tempTable2 then tempTable2 = {} end -- add the player sent to tempTable if tempTable[msg.data.player] ~= nil then bAdd = false end -- add all this data, save the vars and update the lobby if bAdd then tempTable[msg.data.player] = 0 tempTable2[msg.data.player] = GAMEOBJ:GetObjectByID(msg.data.player):GetDisplayName().name self:SetVar('tLobbyPlayers', tempTable) self:SetVar('tLobbyPlayerNames', tempTable2) UpdateLobby(self) end elseif msg.type == 1 then local actTable = self:GetVar('ActivityTable') local NumOfPlayers = self:GetVar("NumberOfPlayers") or 1 -- check and see if there are not enough players to start if (NumOfPlayers - 1) < (actTable.minTeamSize * actTable.minTeams) then GAMEOBJ:GetTimer():CancelAllTimers(self) end LeaveLobby(self,GAMEOBJ:GetObjectByID(msg.data.player)) elseif msg.type == 5 then -- player ready ReadyInstance(self, msg.data.player, true) UpdateLobby(self) elseif msg.type == 6 then -- player not ready ReadyInstance(self, msg.data.player, false) UpdateLobby(self) end elseif msg.data.time then -- update the time and UI local player = GAMEOBJ:GetControlledID() local countdownTime = math.floor(msg.data.time) GAMEOBJ:GetTimer():CancelAllTimers(self) if msg.type == 2 then if not self:GetVar("bOpenedLobbyOnce") then --print('first time') self:SetVar("bOpenedLobbyOnce", true) else --print('lost a player') self:SetVar("resetWaitingForPlayers", true) UI:SendMessage("UpdateInstanceLobby", {{"user", player}, {"callbackObj", self}, {"resetWaitingForPlayers", true}} ) end UpdateLobby(self) else if countdownTime > 0 then if self:GetVar("resetWaitingForPlayers") then self:SetVar("resetWaitingForPlayers", false) UI:SendMessage("UpdateInstanceLobby", {{"user", player}, {"callbackObj", self}, {"resetWaitingForPlayers", false}} ) end self:SetVar('CountdownTick', countdownTime - 1) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) UpdateLobby(self, countdownTime) else self:SetVar('CountdownTick', countdownTime) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) UpdateLobby(self, self:GetVar('ActivityTable').waitTime) end end end end function UpdateLobby(self, optionalTime) local player = GAMEOBJ:GetControlledID() local playerID = player:GetID() local actTable = self:GetVar('ActivityTable') local tPlayers = self:GetVar('tLobbyPlayers') local tPlayerNames = self:GetVar('tLobbyPlayerNames') local minigameVars = {{"user", player}, {"callbackObj", self}} -- if tPlayers doens't exist then create a new table with the nessessary variables if not tPlayers then tPlayers = {} tPlayers[playerID] = 0 self:SetVar('tLobbyPlayers', tPlayers) tPlayerNames = {} tPlayerNames[playerID] = player:GetDisplayName().name self:SetVar('tLobbyPlayerNames', tPlayerNames) end local count = 1 -- loop through all the players in the tPlayers and update the settings for k,v in pairs(tPlayers) do local name = tPlayerNames[k] -- Use Unknown Player if we cannot find the player name if name ~= nil and name ~= "" then table.insert(minigameVars, {"p".. count .. "_name", name}) else table.insert(minigameVars, {"p".. count .. "_name", Localize("MINGAME_LOBBY_UNKNOWN_PLAYER")}) --shouldn't ever get this case end -- if the player is in the ready state then check the box if v == 0 then table.insert(minigameVars, {"p"..count.."_check", false}) else table.insert(minigameVars, {"p"..count.."_check", true}) end count = count + 1 end for i = count, actTable.maxTeamSize*actTable.maxTeams do table.insert(minigameVars, {"p".. i .. "_name", Localize("MINIGAME_LOBBY_WAITING_FOR_PLAYER") .. "..."}) table.insert(minigameVars, {"p".. i .."_check", false}) end local playersNeeded = (actTable.minTeamSize*actTable.minTeams) - (count - 1) if playersNeeded >= 0 then table.insert(minigameVars, {"updatePlayersNeeded", playersNeeded}) end if optionalTime then table.insert(minigameVars, {"countdownTime", optionalTime}) end self:SetVar("NumberOfPlayers", count - 1) -- send message to UI to update the lobby UI:SendMessage("UpdateInstanceLobby", minigameVars ) end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetControlledID() local eChangeType = "POP" local bVisible = true -- freeze and hide the player if bFreeze is true if bFreeze then eChangeType = "PUSH" bVisible = false end -- update the player stunned/visible state playerID:SetVisible{visible = bVisible, fadeTime = 2} playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } end function EnterLobby(self, player) -- check to see if the chat server is down if not checkChatServer(player) then return end local actTable = self:GetVar('ActivityTable') local playerID = player:GetID() local item = self:GetVar("UseObjectID") -- if they didn't double-click a car, use their default if item == nil or item == 0 then item = self:GetVar(playerID) end -- check for item interaction and send appropriate requests if not item then player:MatchRequest{type = 0, value = actTable.ActivityID } -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) else player:MatchRequest{type = 0, value = actTable.ActivityID, activator=self, playerChoices={droppedItem=item} } -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) end -- freeze and hide player freezePlayer(self, true) local actNameKey = Localize("Activities_".. actTable.ActivityID .. "_ActivityName") -- if max num of players is 1 transfer straight into mini game if actTable.maxTeamSize == 1 and actTable.maxTeams == 1 then player:DisplayTooltip { bShow = true, NoRevive = true, strText = Localize("MINIGAME_LOBBY_WAIT_MESSAGE_START") .. " " .. actNameKey .. " " .. Localize("MINIGAME_LOBBY_WAIT_MESSAGE_END"), iTime = 100000 } else -- send Lua notifications, open and update lobby self:SetVar('LobbyOpen', true) self:SendLuaNotificationRequest{requestTarget=player, messageName="MatchUpdate"} self:SendLuaNotificationRequest{requestTarget=player, messageName="ServerStateNotify"} self:SendLuaNotificationRequest{requestTarget=player, messageName="Die"} UI:SendMessage("ToggleInstanceLobby", {{"visible", true}, {"callbackObj", self}, {"type", tVars.UI_Type}, {"minPlayersRequired", (actTable.minTeamSize * actTable.minTeams)},{"activityName", actNameKey}}) UpdateLobby(self) end end function ReadyInstance(self, playerID, ready) local tempTable = self:GetVar('tLobbyPlayers') -- make a new table if it didn't exist if not tempTable then tempTable = {} end local findplayer = tempTable[playerID] -- if there is a player then set the appropriate ready state if findplayer ~= nil then if not ready then tempTable[playerID] = 0 else tempTable[playerID] = ready end self:SetVar('tLobbyPlayers', tempTable) end end function LeaveLobby(self,player) -- if this is the local player then reset everything back to beginning state if player:GetID() == GAMEOBJ:GetControlledID():GetID() then GAMEOBJ:GetTimer():CancelAllTimers(self) player:MatchRequest{type = 0, value = 0} -- type: 0 = REQUEST_JOIN; value = (0 = exit, any other # = activityID) self:SetVar('LobbyOpen', false) self:SetVar("helpOpen", false) self:SetVar('tLobbyPlayers', {}) self:SetVar('tLobbyPlayerNames', {}) UI:SendMessage("UpdateInstanceLobby", {{"user", GAMEOBJ:GetControlledID()}, {"callbackObj", self}, {"countdownTime", self:GetVar('ActivityTable').waitTime}} ) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) self:SendLuaNotificationCancel{requestTarget=player, messageName="MatchUpdate"} self:SendLuaNotificationCancel{requestTarget=player, messageName="ServerStateNotify"} self:SendLuaNotificationCancel{requestTarget=player, messageName="Die"} freezePlayer(self) player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} self:SetVar("bOpenedLobbyOnce", false) else -- not local player so just update the lobby and remove the player from the table removePlayerFromLobby(self,player) UpdateLobby(self) end end function removePlayerFromLobby(self,player) local tempTable = self:GetVar('tLobbyPlayers') local tempTable2 = self:GetVar('tLobbyPlayerNames') -- clear the player from the tables tempTable[player:GetID()] = nil tempTable2[player:GetID()] = nil -- update the tables self:SetVar('tLobbyPlayers', tempTable) self:SetVar('tLobbyPlayerNames', tempTable2) end function split(str, pat) local t = {} -- splits a string based on the given pattern and returns a table string.gsub(str .. pat, "(.-)" .. pat, function(result) table.insert(t, result) end) return t end function onTimerDone(self, msg) -- todo: need to break out the timers into start and wait, so if there is network lag it wont close ui on first timer; or a bool if ( msg.name == "StartTimer" ) then local countdownTime = self:GetVar('CountdownTick') -- update the UI with the new time UI:SendMessage("UpdateInstanceLobby", {{"user", GAMEOBJ:GetControlledID()}, {"callbackObj", self}, {"countdownTime", countdownTime}} ) if countdownTime > 0 then -- start another 1 sec timer self:SetVar('CountdownTick', countdownTime - 1) GAMEOBJ:GetTimer():AddTimerWithCancel(1, "StartTimer", self ) else -- all done close out the lobby UI and pop up the waiting message local player = GAMEOBJ:GetControlledID() local actNameKey = Localize("Activities_".. self:GetVar('ActivityTable').ActivityID .. "_ActivityName") GAMEOBJ:GetTimer():CancelAllTimers(self) UI:SendMessage("ToggleInstanceLobby", {{"visible", false}}) player:DisplayTooltip { bShow = true, NoRevive = true, strText = Localize("MINIGAME_LOBBY_WAIT_MESSAGE_START") .. " " .. actNameKey .. " " .. Localize("MINIGAME_LOBBY_WAIT_MESSAGE_END"), iTime = 100000 } end end end -------------------------------------------------------------- -- Server-side script for the monument elevators -- -- mrb... 8/24/09 -- added in qb smash fx -------------------------------------------------------------- -- constants local endTime = 4 local startTime = 8 local killTime = 10 local proxRadius = 5 -- when the QB is finished being built by a player function onRebuildComplete( self, msg ) -- start the proximity radius to watch for players getting on the elevator self:SetProximityRadius{name = "elevatorProx", radius = proxRadius} -- set the player who built the QB self:SetVar("qbPlayer", "|" .. msg.userID:GetID()) local delayTime = killTime - endTime if delayTime < 1 then delayTime = 1 end -- add a timer that will kill the QB if no players get on in the killTime GAMEOBJ:GetTimer():AddTimerWithCancel(killTime, "startKillTimer", self ) self:StopPathing() end function onProximityUpdate(self, msg) -- make sure we haven't already started pathing. if self:GetVar("qbPlayerRdy") then return end if msg.status == "ENTER" then local player = msg.objId --print('player entered') -- If a player collided with me, then do our stuff if player:IsCharacter().isChar and not self:GetVar("qbPlayerRdy") then local qbPlayer = self:GetVar("qbPlayer") or "" GAMEOBJ:GetTimer():CancelTimer('KillTimer', self) if player:GetID() == qbPlayer then -- the builder has entered so cancel the start timer and just start moving --print('Builder entered') self:SetVar("qbPlayerRdy", true) GAMEOBJ:GetTimer():CancelAllTimers(self) self:UnsetProximityRadius{name = "elevatorProx"} self:StartPathing() elseif not self:GetVar("StartTimer") then -- non-builder player entered so fire off the start timer incase the builder doesn't get on self:SetVar("StartTimer", true) GAMEOBJ:GetTimer():AddTimerWithCancel(startTime, "StartElevator", self ) end end end end function onPlatformAtLastWaypoint(self, msg) -- moving platform reached the end of the path so start the kill timer killTimerStartup(self) end function killTimerStartup(self) GAMEOBJ:GetTimer():CancelAllTimers(self) GAMEOBJ:GetTimer():AddTimerWithCancel(endTime, "KillTimer", self ) -- start the blink effect by sending to the client self:SetNetworkVar("startEffect", endTime) end -- timers... function onTimerDone(self, msg) if msg.name == "StartElevator" then -- start pathing the builder isn't coming GAMEOBJ:GetTimer():CancelAllTimers(self) self:UnsetProximityRadius{name = "elevatorProx"} self:StartPathing() elseif msg.name == "startKillTimer" then -- start the kill timer, the objects been around too long killTimerStartup(self) elseif msg.name == "KillTimer" then -- destroy the mover self:Die{killerID = self} end end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 582) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 30) -- Confirms that this is a faction set skill trigger self:SetVar("isFactionSkill", true) -- Set the faction skill as ready to fire self:SetVar("factionSkillReady", true) -- The time the faction skill has for its "cooldown" self:SetVar("factionCooldownTime", 11) end --require('o_mis') function onStartup(self) GAMEOBJ:GetTimer():AddTimerWithCancel( 10, "DoneRolling", self ) local player = self:GetParentObj().objIDParent local animationMsg = player:GetAnimationTime{ animationID = "dice-roll" } GAMEOBJ:GetTimer():AddTimerWithCancel( animationMsg.time, "ThrowDice", self ) end function onTimerDone(self, msg) if msg.name == "DoneRolling" then self:RequestDie{killerID = self, killType = "SILENT"} elseif msg.name == "ThrowDice" then -- Choose a random number from 1 - 6. local dieRoll = math.random(1,6) local Anim= { "Die-Roll-1", "Die-Roll-2", "Die-Roll-3", "Die-Roll-4", "Die-Roll-5", "Die-Roll-6" } -- put any world messages concerning the die roll here self:PlayFXEffect {effectType = Anim[dieRoll], priority = 1.3, name = "diceroll" } local player = self:GetParentObj().objIDParent if dieRoll == 6 then player:UpdateMissionTask{taskType = "complete", value = 756, value2 = 1, target = self} end end end -- When FireEvent is called on this object create a message box with the given text. -- Trigger format should be: MessageBox, your text here, *optional time in sec* -- Created: 5/26/09 mrb... local textVar = "%[SPIDER_CAVE_MESSAGE]" require('o_mis') -- default values for mBox local mBox = {boxTarget = nil, isDisp = false, isTouch = false, isFirst = true, boxSelf = nil, boxText = '', boxTime = 1 } 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 -- OnEnter in HF Trigger system function onCollisionPhantom(self, msg) -- Gets the target id that has collided if msg.objectID then local dir = self:GetObjectDirectionVectors().forward mBox.boxTarget = msg.objectID -- push-back effect 1378 -- PlayFXEffect msg.objectID:PlayFXEffect{name = "pushBack", effectID = 1378, effectType = "create"}--effectID = 1378, effectType = "push-back"} msg.objectID:PlayAnimation{ animationID = "knockback-recovery" } dir.y = dir.y + 15 dir.x = dir.x * 100 dir.z = dir.z * 100 msg.objectID:Knockback { vector = dir } end if not msg.objectID or mBox.isTouch or mBox.isDisp then return end --print('starting EventTimer') mBox.boxSelf = self mBox.isTouch = true mBox.boxText = textVar GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", self ) end -- OnExit in HF Trigger system function onOffCollisionPhantom(self, msg ) -- Says we have finished colliding tries to resetBox() if msg.objectID then mBox.isTouch = false resetBox() --print('Exiting') end end function onTimerDone(self, msg) -- Says we are done with the displaying the message box, tries to resetBox() if msg.name == "BoxTimer" then mBox.isDisp = false resetBox() --print('Box Timer Done') 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 --print('EventTimer not long enough.... running again') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "EventTimer", mBox.boxSelf ) return end --print('EventTimer Done!!!') MakeBox() end end -- resets local data mBox 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-------------------------------------------------------------------------- --Brick Fury chat bubble text on proximity script -------------------------------------------------------------------------- -- Proximity speech local chat = {Localize("NPC_BRICK_FURY_1"), Localize("NPC_BRICK_FURY_2"), Localize("NPC_BRICK_FURY_3")} --1 = I love the smell of Maelstrom in the morning! --2 = You want the Maelstrom? YOU CAN'T HANDLE THE MAELSTROM!! --3 = I'm Brick Fury, Mitch! function onStartup(self) self:SetProximityRadius{radius = 30} self:ShowHealthBar{bShow = false} end function onProximityUpdate(self, msg) local player = GAMEOBJ:GetControlledID() if msg.status == "ENTER" and msg.objId:GetID() == player:GetID() then local chatNum = math.random(1 , #chat) self:DisplayChatBubble{wsText = chat[chatNum]} end end-------------------------------------------------------------- -- Transfers player to last known non instance -- -- updated mrb... 8/25/10 -- added localization key and proximity to close the messagebox -------------------------------------------------------------- function onStartup(self) self:SetProximityRadius{radius = self:GetInteractionDistance().fDistance, name = "interactionProx"} end function onUse(self, msg) if not msg.user:Exists() then return end -- if there is a config data variable for the text on the object use it otherwise use the dragon instance. local sText = self:GetVar("transferText") or "DRAGON_EXIT_QUESTION" -- display confirmation tool tip to player msg.user:DisplayMessageBox{ bShow = true, imageID = 1, callbackClient = self, text = sText, identifier = "Instance_Exit"} end function onMessageBoxRespond(self, msg) if not msg.sender:Exists() then return end -- transfer player to last non instance if msg.identifier == "Instance_Exit" and msg.iButton == 1 then msg.sender:TransferToLastNonInstance{ playerID = msg.sender, bUseLastPosition = true } end -- terminate the interaction so the shift icon will come back. msg.sender:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end function onProximityUpdate(self, msg) if msg.name == "interactionProx" and msg.status == "LEAVE" then -- display confirmation tool tip to player msg.objId:DisplayMessageBox{ bShow = false, imageID = 1, callbackClient = self, text = sText, identifier = "Instance_Exit"} end end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 581) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 3) -- Confirms that this is a faction set skill trigger self:SetVar("isFactionSkill", true) -- Set the faction skill as ready to fire self:SetVar("factionSkillReady", true) -- The time the faction skill has for its "cooldown" self:SetVar("factionCooldownTime", 11) end -------------------------------------------------------------- -- LEGO Club door Script to transfer the player -- updated mrb... 6/10/10 -- sends player to zones based on transferZoneID -------------------------------------------------------------- function onFireEventServerSide(self, msg) local mapID = self:GetVar("transferZoneID") or "1700" -- if we have a map to send the player if mapID then if mapID == "1200" then -- if we're going to NS then send them to the correct respawn point GAMEOBJ:GetObjectByID(msg.args):TransferToZone{ zoneID = mapID, spawnPoint = "NS_LEGO_Club" } else GAMEOBJ:GetObjectByID(msg.args):TransferToZone{ zoneID = mapID } end else local pos = self:GetPosition().pos print(self:GetName() .. " is missing transferZoneID in config data @ x: " .. pos.x .. " y: " .. pos.y .. " z: " .. pos.z) end end -------------------------------------------------------------- -- Base Foot Race script that handlese the client side logic -- updated mrb... 9/1/10 - interaction icon bug fix and -- added support for other foot races running -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('client/ai/AG/L_AG_NPC_NO_INTERACT') local gVars = {} local tGoalpostVars = {} ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function baseStartup(self) self:FireEventServerSide{senderID = self, args = "setupActivity"} -- send message to the server script to set up the activity math.randomseed( os.time() ) -- get random seed for randomizing numbers --set the vars for interaction. NOTE: any/all of thses are optional SetProximityDistance(self, 30) self:AddObjectToGroup{group = "FootRaceStarter"} -- Proximity speech AddInteraction(self, "proximityText", Localize("CHAT_FOOTRACE_A")) AddInteraction(self, "proximityText", Localize("CHAT_FOOTRACE_B")) AddInteraction(self, "proximityText", Localize("CHAT_FOOTRACE_C")) AddInteraction(self, "proximityAnim", "prox") end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function baseShutdown(self) -- turn of the generic UI timer if the script shuts down -- UI:SendMessage( "UdpateFootRaceScoreboard", {{"visible", false }} ) --we might want to throw the leaderboard up in this fail case so users can return to gameplay mode --from my understanding of the scripts this will shutdown when the race ends - which would be when we want the leaderboards anyway end ---------------------------------------------------------------- -- sets the local constants for this script ---------------------------------------------------------------- function setLocalVars(self, var1, var2) for k,v in pairs(var1) do self:SetVar(tostring(k), v) end self:SetVar("tGoalpostVars", var2) end ---------------------------------------------- -- sent when the object checks it's pick type ---------------------------------------------- function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority if self:GetVar('isInUse') then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------- -- sent when the local player interacts with the -- object before ClientUse, checks to see if we -- in a beta 1 and sends a fail message. ---------------------------------------------- function onCheckUseRequirements(self, msg) local preConVar = self:GetVar("CheckPrecondition") -- if we dont have CheckPreconditions set in HF then return out of this function if not preConVar then return msg end -- TODO: need new tech to check all preconditions or need to redo and/or logic in Lua local tPreconditions = split(preConVar, ";") for k,v in ipairs(tPreconditions) do local check = msg.objIDUser:CheckPrecondition{PreconditionID = v} if not check.bPass then msg.HasReasonFromScript = true msg.Script_IconID = check.IconID msg.Script_Reason = check.FailedReason -- needs localization msg.Script_Failed_Requirement = true msg.bCanUse = false break end end return msg end ---------------------------------------------- -- Message sent from some server object ---------------------------------------------- function onNotifyClientObject(self, msg) if msg.name == "ToggleLeaderBoard" then UI:SendMessage("pushGameState", {{"state", "TimedRaceLeaderboard"}}) UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true}, {"hideReplay", true} } ) elseif msg.name == "stop_timer" then UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) StopFootRace(self, GAMEOBJ:GetControlledID()) end end ---------------------------------------------- -- Message sent from some client object ---------------------------------------------- function onNotifyObject(self, msg) if msg.name == "stop_timer" then UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) StopFootRace(self, GAMEOBJ:GetControlledID()) end end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function baseClientUse(self, msg) local playerID = GAMEOBJ:GetControlledID():GetID() -- check to see if we are the correct player if playerID ~= msg.user:GetID() or self:GetVar('isInUse') then return end local player = GAMEOBJ:GetObjectByID(playerID) local displayText = self:GetVar("sStopGoalText") or Localize("FOOT_RACE_START_QUESTION") local boxIdentifier = "Foot_Race_Start" -- tell the object to do what it's supposed to, then turn off the interaction icon toggleActivatorIcon(self, true) -- if player is in activity ask to stop other wise ask to start the foot race if IsPlayerInActivity(self, player) then displayText = self:GetVar("sStopGoalText") or Localize("FOOT_RACE_STOP_QUESTION") boxIdentifier = "Foot_Race_Stop" elseif player:GetFlag{iFlagID = 115}.bFlag then displayText = self:GetVar("sStopGoalText") or Localize("FOOT_RACE_STOP_QUESTION") boxIdentifier = "Foot_Race_Cancel" end player:DisplayMessageBox{bShow = true, imageID = 1, callbackClient = self, text = displayText, identifier = boxIdentifier} end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function baseTerminateInteraction(self, msg) msg.ObjIDTerminator:DisplayMessageBox{bShow = false} if msg.type ~= "user" then -- tell the object to do what it's supposed to, then turn off the interaction icon toggleActivatorIcon(self) end end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function baseMessageBoxRespond(self, msg) if not msg then return end local player = GAMEOBJ:GetControlledID() if msg.identifier == "Foot_Race_Stop" then if msg.iButton == 1 then ---------------------------------------------------------------------------------------------------------------------- --You respond in the positive to "I would like to stop playing the foot race" ---------------------------------------------------------------------------------------------------------------------- UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) StopFootRace(self, player) end -- tell the object to do what it's supposed to, then turn off the interaction icon player:TerminateInteraction{ type="fromInteraction", ObjIDTerminator=self } toggleActivatorIcon(self) -- turn off the player flag for is player in foot race player:SetFlag{iFlagID = 115, bFlag = false} elseif msg.identifier == "Foot_Race_Start" then if msg.iButton == 1 and not IsPlayerInActivity(self, player) then -- add the new user self:FireEventServerSide{senderID = player, args = "updatePlayer_" .. player:GetID()} -- start the activity for the new user self:FireEventServerSide{senderID = player, args = "initialActivityScore_" .. player:GetID(), param1 = self:GetVar("startTime")} StartFootRace(self, player) else player:TerminateInteraction{ type="fromInteraction", ObjIDTerminator=self } toggleActivatorIcon(self) end elseif msg.identifier == "Foot_Race_Cancel" then -- check to see if the player wants to stop the other foot race they are currently in local tFootRaceStarters = self:GetObjectsInGroup{ group = 'FootRaceStarter', ignoreSpawners = true }.objects local starterObj = false for k,v in ipairs(tFootRaceStarters) do -- remove the user if IsPlayerInActivity(v, player) then starterObj = v break end end if msg.iButton == 1 then -- player hit yes so ask if they want to start this foot race local displayText = self:GetVar("sStopGoalText") or Localize("FOOT_RACE_START_QUESTION") local boxIdentifier = "Foot_Race_Start" if starterObj then starterObj:NotifyObject{name = "stop_timer" , rerouteID = player} end player:DisplayMessageBox{bShow = true, imageID = 1, callbackClient = self, text = displayText, identifier = boxIdentifier} -- turn off the player flag for is player in foot race player:SetFlag{iFlagID = 115, bFlag = false} else -- player hit the X so clean up player:TerminateInteraction{ type="fromInteraction", ObjIDTerminator=self } toggleActivatorIcon(self) end end end ---------------------------------------------- -- toggles the activator Icon based on bHide, -- to toggle it on you dont have to pass bHide ---------------------------------------------- function toggleActivatorIcon(self, bHide) local player = GAMEOBJ:GetControlledID() if not bHide then -- show the icon, cancel notification, set isInUse to false bHide = false self:SetVar('isInUse', false) else -- hide the icon, request notification, set isInUse to true self:SetVar('isInUse', true) end -- request the interaction update self:RequestPickTypeUpdate() end ---------------------------------------------- -- get a random obsticle based on the -- self:GetVar("obsticleLot") table and return it ---------------------------------------------- function getRandObsticles(self) local obsticleTable = self:GetVar("obsticleLot") if not obsticleTable then return {} end local obsticlePoints = {} local totalNodes = self:GetVar("total_spawner_nodes") -- if we want a finishline remove 1 from the total nodes if self:GetVar("finalGoalObsticleLot") > 0 then totalNodes = totalNodes - 1 end -- run through the total nodes and obsticle Lot table, then make a table of the resulting random objects/points. for i = 1, self:GetVar("numOfObsticles") do local pass = false while not pass do local rand = math.random(1,totalNodes) if not obsticlePoints[rand] then obsticlePoints[rand] = obsticleTable[math.random(1,#obsticleTable)] pass = true end end end return obsticlePoints end ---------------------------------------------- -- spawn in the goals and start the activity ---------------------------------------------- function StartFootRace(self, player) if self:GetVar('bRaceStarted') then return end self:SetVar('bRaceStarted', true) local path = LEVEL:GetPathWaypoints(self:GetVar("pathName")) self:SetVar('total_spawner_nodes', #path) local randObsticles = getRandObsticles(self) for k,v in ipairs(path) do -- set up the config data for each goal and load the object local config = { {"custom_script_client", "scripts/ai/ACT/FootRace/L_ACT_FOOT_RACE_GOAL.lua" }, {"groupID", "Goals;Goals_" .. k}, {"total_spawner_nodes", self:GetVar("total_spawner_nodes")}, {"node_number", k}, {"tGoalpostVars", self:GetVar("tGoalpostVars")}, {"renderDisabled", true}, } if randObsticles[k] then -- insert an obsticle in to the config data if appropriate table.insert(config, {"spawnObsticle", randObsticles[k]}) end if k == #path and self:GetVar("finalGoalObsticleLot") > 0 then -- insert the finish line in to the config data if appropriate table.insert(config, {"finalGoalObsticleLot", self:GetVar("finalGoalObsticleLot")}) end RESMGR:LoadObject{ objectTemplate = tostring(self:GetVar("goalLot")), x= v.pos.x, y= v.pos.y , z= v.pos.z, rw = v.rot.w, rx = v.rot.x, ry = v.rot.y, rz = v.rot.z, owner = self, configData = config} end freezePlayer(self, true) --freezePlayer(self, bFreeze) player:ShowActivityCountdown() ActivityTimerStart(self, "Start_Timer_Delay", -1, 3) --ActivityTimerStart(self, timerName, updateTime, stopTime) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function baseFireEvent(self, msg) if not msg then return end local tArgs = split(msg.args, "_") -- seperate out the objID and the message name local player = false local curTime = ActivityTimerGetRemainingTime(self, "Foot_Race_Timer") local displayText = false -- if we have an objID then get the lwoobj if tArgs[2] then -- if we dont have the local player return if tArgs[2] ~= GAMEOBJ:GetControlledID():GetID() then return else player = GAMEOBJ:GetObjectByID(tArgs[2]) end end -- send the correct message to the server side script and display the correct message based on tArgs[1] if curTime then if tArgs[1] == "PlayerHitGoal" then ActivityTimerAddTime(self, "Foot_Race_Timer", self:GetVar("addTime")) --ActivityTimerAddTime(self, timerName, addTime) UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", curTime + self:GetVar("addTime")}} ) elseif tArgs[1] == "PlayerHitFirstGoal" then --[[ if self:GetVar("sFirstGoalText") then displayText = self:GetVar("sFirstGoalText") else displayText = Localize("FOOT_RACE_FIRST_GOAL") end ]]-- ActivityTimerAddTime(self, "Foot_Race_Timer", self:GetVar("addTime")) --ActivityTimerAddTime(self, timerName, addTime) UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", curTime + self:GetVar("addTime")}} ) elseif tArgs[1] == "PlayerWon" and player then ---------------------------------------------------------------------------------------------------------------------- --pretty sure that this is the case where the player finishes the race and the leaderboard will get called --at this point the UI should be informed to stop updating the clock / what the final time is ---------------------------------------------------------------------------------------------------------------------- if ActivityTimerGetRemainingTime(self, "Foot_Race_Timer") < 1 then return end ActivityTimerStopAllTimers(self) if self:GetVar("sFinalGoalText") then displayText = self:GetVar("sFinalGoalText") .. ' ' .. SecondsToClock(curTime) else displayText = Localize("FOOT_RACE_FINAL_GOAL") .. ' ' .. SecondsToClock(curTime) end freezePlayer(self, true) --freezePlayer(self, bFreeze) player:PlayAnimation{animationID = "happy2", bPlayImmediate = true} local animTime = player:GetAnimationTime{animationID = "happy2"}.time self:SetVar("finalTime", curTime) UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", curTime}, {"raceComplete", true}} ) --ActivityTimerStart(self, timerName, updateTime, stopTime) ActivityTimerStart(self, "Finish_Anim_Timer", animTime, animTime) end end if displayText then UI:SendMessage( "UpdateFootRaceScoreboard", {{"message", displayText}} ) end end ---------------------------------------------- -- Shuts down the foot race ---------------------------------------------- function StopFootRace(self, sender) local player = GAMEOBJ:GetControlledID() local killObjs = self:GetObjectsInGroup{ group = 'Goals', ignoreSpawners = true }.objects if sender then player = sender end if IsPlayerInActivity(self, player) then -- remove the user self:FireEventServerSide{senderID = self, args = "updatePlayerTrue_" .. player:GetID()} end ActivityTimerStopAllTimers(self) for k,v in ipairs(killObjs) do GAMEOBJ:DeleteObject( v ) end self:SetVar('bRaceStarted', false) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function baseActivityTimerUpdate(self, msg) -- update the ui with the current time if msg.name == "Foot_Race_Timer" then UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", msg.timeRemaining}} ) end end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function baseActivityTimerDone(self, msg) if msg.name == "Start_Timer_Delay" then ---------------------------------------------------------------------------------------------------------------------- --The flow from accepting the footrace eventually gets to this statement after countdowns and animations ---------------------------------------------------------------------------------------------------------------------- ActivityTimerStart(self, "Foot_Race_Timer", 0.20, self:GetVar("startTime")) --ActivityTimerStart(self, timerName, updateTime, stopTime) ActivityTimerStart(self, "Foot_Race_Reset_Icon", 2, 2) --ActivityTimerStart(self, timerName, updateTime, stopTime) UI:SendMessage( "ToggleFootRaceScoreboard", {{"visible", true }, {"time", self:GetVar("startTime") }} ) freezePlayer(self) --freezePlayer(self, bFreeze) elseif msg.name == "Foot_Race_Reset_Icon" then -- tell the object to do what it's supposed to, then turn off the interaction icon toggleActivatorIcon(self) elseif msg.name == "Foot_Race_Timer" then ---------------------------------------------------------------------------------------------------------------------- --If the foot race timer dies, you failed to finish the footrace, no leaderboard displays, footrace widget needs to die ---------------------------------------------------------------------------------------------------------------------- UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) GAMEOBJ:GetControlledID():DisplayTooltip{ bShow = true, strText = Localize("FOOT_RACE_FAIL"), iTime = 1 } StopFootRace(self) elseif msg.name == "Finish_Anim_Timer" then ---------------------------------------------------------------------------------------------------------------------- --we reach here when the player successfully finished the footrace and the celebration animation ends ---------------------------------------------------------------------------------------------------------------------- local player = GAMEOBJ:GetControlledID() freezePlayer(self) if self:GetVar("completedFireEventGroup") then for k,v in ipairs(self:GetObjectsInGroup{ group = self:GetVar("completedFireEventGroup"), ignoreSpawners = true}.objects) do v:FireEventServerSide{senderID = self, args = "Foot_Race_Completed", param1 = player:GetID()} end end self:FireEventServerSide{senderID = self, args = "PlayerWon_" .. player:GetID(), param1 = self:GetVar("finalTime"), param2 = self:GetVar("completedSetFlagNum")} self:SetVar("finalTime", 0) StopFootRace(self, player) end end ---------------------------------------------------------------- -- Base Server script for property pushback. -- this script is required from a level specific script -- this script will only work with the client script as well -- updated mrb... 9/7/10 - added brickLinkMissionID updateMissionTask -- updated brandi.. 9/10/10 - put variable in to keep from getting in infinate loop, and added function to keep prints from printing externally ---------------------------------------------------------------- local OwnerChecked = false local GUIDMaelstrom = "{7881e0a1-ef6d-420c-8040-f59994aa3357}" -- ambient sounds for when the Maelstrom is on local GUIDPeaceful = "{c5725665-58d0-465f-9e11-aeb1d21842ba}" -- happy ambient sounds when no maestrom is preset ---------------------------------------------------------------- -- Define empty tables that will be set from the level specific script ---------------------------------------------------------------- local Group = {} local Spawners = {} local Flags = {} ---------------------------------------------------------------- -- variables passed of the level specific script that are used throughout the base script ---------------------------------------------------------------- function setGameVariables(passedGroups,passedSpawners,passedFlags) Group = passedGroups Spawners = passedSpawners Flags = passedFlags end ---------------------------------------------------------------- -- ---------------------------------------------------------------- function checkForOwner(self) -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PropertyPlaque, ignoreSpawners = true }.objects if not propertyPlaques or #propertyPlaques == 0 then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "runPlayerLoadedAgain", self ) return end -- table for property data to be filled out by the for loop below for i = 1, table.maxn(propertyPlaques) do -- check to see if there is more than on object in the property plaque group, if there is, it can seriously break stuff if i > 1 then WarningPrint(self,"WARNING -- YOU HAVE TO MANY PROPERTY PLAQUES IN THIS LEVEL. Please make sure you only have 1!") break end local propertyData = propertyPlaques[i]:PropertyGetState{} self:SetVar("PropertyOwner",propertyData.ownerID:GetID()) OwnerChecked = true end end ---------------------------------------------------------------- -- ---------------------------------------------------------------- function basePlayerLoaded(self, msg) if OwnerChecked == false then -- only check for owner when the first player enters property checkForOwner(self) end local propertyOwner = self:GetVar("PropertyOwner") -- returns true or false if the property is rented or not local rented = false if propertyOwner ~= 0 then rented = true end local player = msg.playerID self:SetVar("IsInternal", player:GetVersioningInfo().bIsInternal) WarningPrint(self,"WARNING -- TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST !") -- if the property is rented, delete all the objects that may be on the property if rented == true then -- kill the tornado effect object if not self:GetVar("FXObjectGone") then GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "killFXObject", self ) end player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDPeaceful} -- check to see if the player standing on the property is the person who owns the property if player:GetID() ~= propertyOwner then return end -- tell the client script that the property is rented and who the renter is self:SetNetworkVar("renter",propertyOwner) -- flag for if the player has placed a model on this property yet local spotsflag = player:GetFlag{ iFlagID = Flags.placedModel }.bFlag -- check to see if the player has placed a model before, if not spawn the maelstrom spots if spotsflag == false then SpawnSpots(self) end -- if the property hasnt been rented, then assume that this is the players property to rent (if this is broken, it is through code) else -- flag for if the player has defeated the maelstrom property yet local defeatedflag = player:GetFlag{ iFlagID = Flags.defeatedProperty }.bFlag -- tell the client script that the property is not rented self:SetNetworkVar("unclaimed",true) --spawn the spots SpawnSpots(self) self:SetVar("playerID",player:GetID()) -- check to see if the player has defeated the maelstrom before (they could defeat it and leave without renting it) if defeatedflag == false then -- custom function that starts all teh maelstrom StartMaelstrom(self) self:SetVar("playerID",player:GetID()) player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDMaelstrom} else player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDPeaceful} GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "killFXObject", self ) end end if msg.playerID:GetMissionState{missionID = Flags.guardMission}.missionState ~= 8 then ActivateSpawner(self,Spawners.PropMG) -- spawn guard end end ---------------------------------------------------------------- -- returned from the server when the property is rented ---------------------------------------------------------------- function baseZonePropertyRented(self, msg) -- show cinematic of the property bounds being turned on GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "PlayCinematic", paramStr = "ShowProperty" } --msg.playerID:PlayCinematic { pathName = "ShowProperty" } -- delay the property border from being animatated until the camera is looking at it GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "BoundsVisOn",self ) -- delay deleting the guard until the camera isnt looking at him --GAMEOBJ:GetTimer():AddTimerWithCancel( 3, "GuardFlyAway",self ) self:SetVar("PropertyOwner",msg.playerID:GetID()) if Flags.brickLinkMissionID then -- get the property plaque by group set in happy flower, the property plaque is coded to share certain information with LUA local propertyPlaques = self:GetObjectsInGroup{ group = Group.PropertyPlaque, ignoreSpawners = true }.objects for k,v in ipairs(propertyPlaques) do msg.playerID:UpdateMissionTask{taskType = "complete", value = Flags.brickLinkMissionID, value2 = 1, target = v} break end end end ---------------------------------------------------------------- -- message sent when a model is placed on the property ---------------------------------------------------------------- function baseZonePropertyModelPlaced(self, msg) -- check the flag to see if the player has placed a model before, if they haven't deleted the maelstrom spots and set the flag to say they have placed a model if msg.playerID:GetFlag{ iFlagID = Flags.placedModel }.bFlag == false then KillSpots(self) msg.playerID:SetFlag{iFlagID = Flags.placedModel, bFlag=true} end end ---------------------------------------------------------------- -- deletes the maelstrom damaging clouds ---------------------------------------------------------------- function KillClouds(self) DeactivateSpawner(self,Spawners.DamageFX) DestroySpawner(self,Spawners.DamageFX) end ---------------------------------------------------------------- -- activates the spawner for the maelstrom spots ---------------------------------------------------------------- function SpawnSpots(self) ActivateSpawner(self,Spawners.FXSpots) end ---------------------------------------------------------------- -- deactive the spawner for the maelstrom spots and then delete them ---------------------------------------------------------------- function KillSpots(self) DeactivateSpawner(self,Spawners.FXSpots) --DestroySpawner(self,Spawners.FXSpots) local spots = self:GetObjectsInGroup{ group = Group.Spots, ignoreSpawners = true }.objects ObjectRequestDie(self,spots) end ---------------------------------------------------------------- -- turns all the maelstrom on if the player hasn't defeated the maelstrom for this property yet ---------------------------------------------------------------- function StartMaelstrom(self,msg) -- pause the behaviors on the property --local plaque = self:GetObjectsInGroup{ group = Group.PropertyPlaque, ignoreSpawners = true }.objects[1] --plaque:TogglePropertyBehaviors{ bPaused = true} -- activate all the enemy spawners for k,v in ipairs(Spawners.Enemy) do ActivateSpawner(self,v) end if Spawners.BehaviorObjs then for k,v in ipairs(Spawners.BehaviorObjs) do ActivateSpawner(self,v) end end --activate the damaging clouds spawner ActivateSpawner(self,Spawners.DamageFX) -- activeate the spawner for the generator ActivateSpawner(self,Spawners.Generator) ActivateSpawner(self,Spawners.GeneratorFX) ActivateSpawner(self,Spawners.FXManager) ActivateSpawner(self,Spawners.ImagOrb) ActivateSpawner(self,Spawners.Smashables) -- make sure the spawner for the claimmarker is off DeactivateSpawner(self,Spawners.ClaimMarker) ResetSpawner(self,Spawners.ClaimMarker) if Spawners.AmbientFX then for k,v in ipairs(Spawners.AmbientFX) do DeactivateSpawner(self,v) DestroySpawner(self,v) ResetSpawner(self,v) end end -- find the fx manager and turn on the tornado and the clouds local fx = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects[1] if fx then fx:PlayFXEffect{name = "TornadoDebris", effectType = "debrisOn"} fx:PlayFXEffect{name = "TornadoVortex", effectType = "VortexOn"} fx:PlayFXEffect{name = "silhouette", effectType = "onSilhouette"} else WarningPrint(self,"Warning: No object found in the group "..Group.FXManager) end -- notify the client to change the env settings self:NotifyClientObject{ name = "maelstromSkyOn" } -- have the generator tell the script when it dies sendNotification(self,Group.Generator,"Die","startGenerator") sendNotification(self,Group.ImagOrb,"CollisionPhantom","startOrb") end ---------------------------------------------------------------- -- called when the claim marker and the generator die ---------------------------------------------------------------- function baseNotifyDie(self,other,msg) -- the object that sent the notification local deadObj = other:GetLOT().objtemplate -- the generator died if deadObj == Flags.generatorID then -- spawn the claimmarker quickbuild and tell it to notify when it is rebuilt ActivateSpawner(self,Spawners.ClaimMarker) sendNotification(self,Group.ClaimMarker,"RebuildComplete","startQuickbuild") -- stop the enemies from spawning anymore for k,v in ipairs(Spawners.Enemy) do DeactivateSpawner(self,v) end -- stop the generator spawner from spawning again DeactivateSpawner(self,Spawners.Generator) end end ---------------------------------------------------------------- -- the orb notifies when it have been collided with ---------------------------------------------------------------- function baseNotifyCollisionPhantom(self,other,msg) if other:GetLOT().objtemplate == Flags.orbID then if msg.objectID:GetFaction().faction == 1 then KillClouds(self) --deactivate the generator and claimmarker spawners DeactivateSpawner(self,Spawners.Generator) --DeactivateSpawner(self,Spawners.GeneratorFX) --DeactivateSpawner(self,Spawners.ClaimMarker) local objNotify = self:GetObjectsInGroup{ group = Group.ImagOrb, ignoreSpawners = true }.objects[1] if objNotify then self:SendLuaNotificationCancel{requestTarget= objNotify, messageName="CollisionPhantom"} end for k,v in ipairs(Spawners.Enemy) do DeactivateSpawner(self,v) end DestroySpawner(self,Spawners.GeneratorFX) local player = GAMEOBJ:GetObjectByID(self:GetVar("playerID")) -- start the camera that shows the maelstrom dying GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "PlayCinematic", paramStr = "DestroyMaelstrom" } --player:PlayCinematic { pathName = "DestroyMaelstrom" } -- set the flage that player defeated the maelstrom on this property player:SetFlag{iFlagID = Flags.defeatedProperty, bFlag=true} -- start the timer for the next part GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, "tornadoOff",self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 0.7, "KillMarker", self ) end end end ---------------------------------------------------------------- -- the quickbuild spawned from the generator tells this when it is done building ---------------------------------------------------------------- function baseNotifyRebuildComplete(self,other,msg) if msg.rebuildID:GetLOT().objtemplate == Flags.behavQBID then -- the quickbuild has behaviors on it that are looking for this password before they will start self:ChatMessageForZone{strMessage=Flags.password, senderID = 0 } end end ---------------------------------------------------------------- -- when the player leaves the zone, destroy everything to reset the map ---------------------------------------------------------------- function basePlayerExit(self,other,msg) if self:GetNetworkVar("unclaimed") == true then if msg.playerID:GetID() == self:GetVar("playerID") then for k,v in pairs(Spawners) do if type(v) == "table" then for y,z in ipairs(v) do DeactivateSpawner(self,z) DestroySpawner(self,z) ResetSpawner(self,z) end else DeactivateSpawner(self,v) DestroySpawner(self,v) ResetSpawner(self,v) end end end end end ---------------------------------------------------------------- -- tell the generator to notify the script when it dies ---------------------------------------------------------------- function sendNotification(self,obj,msgName,timer) -- grab the generator by its group set in happy flower, assume there is only one generator in the group local objNotify = self:GetObjectsInGroup{ group = obj, ignoreSpawners = true }.objects[1] -- make sure the script got an object if objNotify then -- send the message to the generator object to tell the script when it dies self:SendLuaNotificationRequest{requestTarget= objNotify, messageName=msgName} else -- if the generator doesn't exist yet, try again GAMEOBJ:GetTimer():AddTimerWithCancel( 0.5, timer, self ) end end ---------------------------------------------------------------- -- deletes the guard ---------------------------------------------------------------- function KillGuard(self) local Guard = self:GetObjectsInGroup{ group = Group.Guard, ignoreSpawners = true }.objects ObjectRequestDie(self,Guard) DeactivateSpawner(self,Spawners.PropMG) end ---------------------------------------------------------------- -- requests dies for objects ---------------------------------------------------------------- function ObjectRequestDie(self,objTable) if objTable then for k,v in ipairs(objTable) do v:RequestDie{ killerID = self, killtype = "VIOLENT" } end end end ---------------------------------------------------------------- -- activates spawners ---------------------------------------------------------------- function DestroySpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerDestroyObjects() else WarningPrint(self,'WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- activates spawners ---------------------------------------------------------------- function ActivateSpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerActivate() else WarningPrint(self,'WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- deactivates spawners ---------------------------------------------------------------- function DeactivateSpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerDeactivate() else WarningPrint(self,'WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- resets spawners ---------------------------------------------------------------- function ResetSpawner(self,spawnerName) local spawnerID = LEVEL:GetSpawnerByName(spawnerName) if spawnerID then spawnerID:SpawnerReset() else WarningPrint(self,'WARNING: No Spawner found for spawner named ' .. spawnerName) end end ---------------------------------------------------------------- -- print custom function to keep prints from showing up externally ---------------------------------------------------------------- function WarningPrint(self,msg) if self:GetVar("IsInternal") then print(self,msg) end end ---------------------------------------------------------------- -- called when a timer is done ---------------------------------------------------------------- function baseTimerDone(self,msg) if msg.name == "startGenerator" then -- tell the generator to notify the script when it dies sendNotification(self,Group.Generator,"Die","startGenerator") elseif msg.name == "startOrb" then -- tell the generator to notify the script when it dies sendNotification(self,Group.ImagOrb,"CollisionPhantom","startOrb") elseif msg.name == "startQuickbuild" then -- tell the generator to notify the script when it dies sendNotification(self,Group.ClaimMarker,"RebuildComplete","startQuickbuild") elseif msg.name == "GuardFlyAway" then -- the guard is "flying" away, delete him and turn the boundry animation on if LEVEL:GetCurrentZoneID() ~= 1150 then local Guard = self:GetObjectsInGroup{ group = Group.Guard, ignoreSpawners = true }.objects[1] GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "GuardChat", paramObj = Guard } GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "KillGuard", self ) end -- tell the client script to play the animation on the boundry asset elseif msg.name == "KillGuard" then KillGuard(self) elseif msg.name == "tornadoOff" then -- finds the fx manager local fx = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects[1] -- turn the tornado and vortex fx off if fx then fx:StopFXEffect{name = "TornadoDebris"} fx:StopFXEffect{name = "TornadoVortex"} fx:StopFXEffect{name = "silhouette"} else WarningPrint(self,"Warning: No object found in the group "..Group.FXManager) end GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "ShowClearEffects", self ) elseif msg.name == "ShowClearEffects" then -- finds the fx manager local fx = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects[1] -- play the light in the center of the property to show the maelstrom being defeated if fx then fx:PlayFXEffect{name = "beam", effectType = "beamOn"} else WarningPrint(self,"Warning: No object found in the group "..Group.FXManager) end GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "killStrombies", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5, "turnSkyOff", self ) GAMEOBJ:GetTimer():AddTimerWithCancel( 8, "killFXObject", self ) elseif msg.name == "turnSkyOff" then GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "SkyOff" } elseif msg.name == "killStrombies" then -- kill all the enemies local enemies = self:GetObjectsInGroup{ group = Group.Enemies }.objects ObjectRequestDie(self,enemies) -- finds the fx manager DeactivateSpawner(self,Spawners.Smashables) DestroySpawner(self,Spawners.Smashables) local player = GAMEOBJ:GetObjectByID(self:GetVar("playerID")) player:Stop2DAmbientSound{m_NDAudioEventGUID = GUIDMaelstrom } -- kill the maelstrom windy sound player:Play2DAmbientSound{m_NDAudioEventGUID = GUIDPeaceful}-- start the happy bird sounds -- tell the client script to turn on the normal property env settings GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "ShowVendor", self ) elseif msg.name == "KillMarker" then -- kill the claimmarker DeactivateSpawner(self,Spawners.ClaimMarker) DestroySpawner(self,Spawners.ClaimMarker) if Spawners.BehaviorObjs then for k,v in ipairs(Spawners.BehaviorObjs) do DeactivateSpawner(self,v) DestroySpawner(self,v) end end --DestroySpawner(self,Spawners.ClaimMarker) local orb = self:GetObjectsInGroup{ group = Group.ImagOrb }.objects ObjectRequestDie(self,orb) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "ShowVendor", self ) elseif msg.name == "ShowVendor" then -- tell the client script to show the vendor GAMEOBJ:GetZoneControlID():NotifyClientObject{ name = "vendorOn" } if Spawners.AmbientFX then for k,v in ipairs(Spawners.AmbientFX) do ActivateSpawner(self,v) end end elseif msg.name == "BoundsVisOn" then -- tell the client script to turn the boundry on --GAMEOBJ:GetZoneControlID():NotifyClientObject{name = "boundsOn" } GAMEOBJ:GetZoneControlID():NotifyClientObject{name = "boundsAnim" } elseif msg.name == "runPlayerLoadedAgain" then checkForOwner(self) elseif msg.name == "killFXObject" then local fxT = self:GetObjectsInGroup{ group = Group.FXManager, ignoreSpawners = true }.objects local fx = fxT[1] --stop the light fx if fx then fx:StopFXEffect{name = "beam"} -- kill the fx object DestroySpawner(self,Spawners.FXManager) self:SetVar("FXObjectGone", true) else WarningPrint(self,"Warning: No object found in the group "..Group.FXManager) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "killFXObject", self ) end end end--------------------------------------------------------------------------------------------------------- -- Client-side script for Concert instrument Quick Builds. -- When an instrument is built, it locks the mini-fig into an imagination-draining animation. -- This lasts until the player runs out of imagination or moves voluntarily. -- Players will hear different music depending on which instruments are currently being played. -- -- updated mrb... 8/23/10 - refactored to not send/recieve so many messages to the server --------------------------------------------------------------------------------------------------------- -------------------------------------------------------------- -- constants for the musical instruments quickbuilds -------------------------------------------------------------- local CONSTANTS = {} -- the object template for each instrument CONSTANTS["INSTRUMENT_LOT_GUITAR"] = 4039 CONSTANTS["INSTRUMENT_LOT_BASS"] = 4040 CONSTANTS["INSTRUMENT_LOT_KEYBOARD"] = 4041 CONSTANTS["INSTRUMENT_LOT_DRUM"] = 4042 -- the anim used to show the player playing each instrument CONSTANTS["INSTRUMENT_ANIM"] = {} CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard" CONSTANTS["INSTRUMENT_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "drums" -- the anim used to show the player smashing each instrument CONSTANTS["INSTRUMENT_SMASH_ANIM"] = {} CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "guitar-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "bass-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "keyboard-smash" CONSTANTS["INSTRUMENT_SMASH_ANIM"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = -1 -- has no smashing anim -- the music used for each instrument CONSTANTS["INSTRUMENT_MUSIC"] = {} CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Guitar" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Bass" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Keys" CONSTANTS["INSTRUMENT_MUSIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Drums" -- path set up through Happy Flower for the cinematic for each instrument CONSTANTS["INSTRUMENT_CINEMATIC"] = {} CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = "Concert_Cam_G" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = "Concert_Cam_B" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = "Concert_Cam_K" CONSTANTS["INSTRUMENT_CINEMATIC"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = "Concert_Cam_D" -- the LOT for the left hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 4991 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 4992 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- no equippable used CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_LEFT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4995 -- the LOT for the right hand equippable item used for each instrument CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"] = {} CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 CONSTANTS["INSTRUMENT_EQUIPPABLE_LOT_RIGHT"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 4996 -- whether or not to hide the completed quickbuild while the player is playing the instrument CONSTANTS["INSTRUMENT_HIDE"] = {} CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = true CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = false CONSTANTS["INSTRUMENT_HIDE"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = false -- once the smash anim starts playing, how long to wait before unequipping the instrument CONSTANTS["INSTRUMENT_UNEQUIP_TIME"] = {} CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_GUITAR"]] = 1.033 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_BASS"]] = 0.75 CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_KEYBOARD"]] = -1 -- has no equippables CONSTANTS["INSTRUMENT_UNEQUIP_TIME"][CONSTANTS["INSTRUMENT_LOT_DRUM"]] = 0 -- has no smash anim, unequip immediately -- how much imagination is repeatedly drained while the instrument is being played CONSTANTS["INSTRUMENT_IMAGINATION_COST"] = 2 -- how often imagination is drained while playing the instrument CONSTANTS["INSTRUMENT_COST_FREQUENCY"] = 4.0 -------------------------------------------------------------- -- constants -------------------------------------------------------------- -- copied from enum ERebuildChallengeState in lwoGame \ include \ LWORebuild.h CONSTANTS["REBUILD_STATE_COMPLETED"] = 2 -- Challenge complete CONSTANTS["UPDATE_FREQUENCY"] = 0.1 -- while playing the instrument, how often we check whether the player hit a movement key to stop playing -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup( self ) self:SetVar( "bBeingPlayed", false ) self:SetVar( "activePlayer", nil ) --ResetEquippableIDs( self ) self:SetVar( "checkingInstrumentAnim", false ) self:SetVar( "targetPositionX", nil ) self:SetVar( "targetPositionZ", nil ) self:SetVar( "leftInventoryLOT", -1 ) self:SetVar( "rightInventoryLOT", -1 ) self:SetVar( "reequipPlayer", nil ) end -------------------------------------------------------------- -- called anytime the rebuild object's state changes -------------------------------------------------------------- function onRebuildNotifyState( self, msg ) if msg.iState == CONSTANTS["REBUILD_STATE_COMPLETED"] then self:SetVar("renderReady", true) end end function onSetVisible(self, msg) if msg.visible then self:SetVisible{ visible = false, fadeTime = 0.0 } end end ---------------------------------------------------------------- ---- timers ---------------------------------------------------------------- function onTimerDone( self, msg ) if ( msg.name == "Hide" ) then if self:GetVar("renderReady") then self:SetVisible{ visible = false, fadeTime = 0.0 } else GAMEOBJ:GetTimer():AddTimerWithCancel( 0.2, "Hide", self ) end end end ---------------------------------------------------------------- ---- variables serialized from the server ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self, msg) local player = GAMEOBJ:GetControlledID() for k,v in pairs(msg.tableOfVars) do -- check to see if we have the correct message and deal with it if k == "Hide" then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Hide", self ) end end end -------------------------------------------------------------- -- notification received from server-side script --------------------------------------------------sss------------ function onNotifyClientObject( self, msg ) if ( msg.name == "stopPlaying" ) then StopPlayingInstrument( self ) SetPlayerControl( self, true ) elseif ( msg.name == "startPlaying" ) then self:SetVar( "bBeingPlayed", true ) self:SetVar( "activePlayer", msg.paramObj:GetID() ) TrackRecentMovementKeys( self, true ) SetPlayerControl( self ) elseif ( msg.name == "checkMovement" ) then UpdateBeingPlayed( self ) elseif ( msg.name == "stopCheckingMovement" ) then TrackRecentMovementKeys( self, false ) elseif ( msg.name == "playerLeft" ) then if ( self:GetVar( "activePlayer" ) == msg.paramObj:GetID() ) then self:SetVar( "bBeingPlayed", false ) self:SetVar( "activePlayer", nil ) TrackRecentMovementKeys( self, false ) end elseif ( msg.name == "ResetAnim" ) then local player = GAMEOBJ:GetControlledID() --Reset Players Anims player:ChangeIdleFlags{on = 1} player:ResetPrimaryAnimation{} player:ResetSecondaryAnimation{} end end -------------------------------------------------------------- -- have the player stop playing the instrument -------------------------------------------------------------- function StopPlayingInstrument( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- stop checking to see if the player finished playing the instrument self:SetVar( "bBeingPlayed", false ) if ( IsLocalPlayerActive( self ) == true ) then -- stop keeping track of movement key presses TrackRecentMovementKeys( self, false ) --Reset Players Anims player:ChangeIdleFlags{on = 1} player:ResetPrimaryAnimation{} player:ResetSecondaryAnimation{} end end -------------------------------------------------------------- -- check whether the intrument is still being played -- this stops if the player runs out of imagination or takes control by moving -------------------------------------------------------------- function UpdateBeingPlayed( self ) if ( self:GetVar( "bBeingPlayed" ) == false ) then return end -- if not, check whether the player hit a movement key local bMovement = DidPlayerHitMovementKey( self ) -- if the player has run out of imagination or hit a movement key, then kick them off the instrument if ( bMovement ) then -- bOutOfImagination or self:FireEventServerSide{ args = "stopPlaying", senderID = player } end end -------------------------------------------------------------- -- returns the ID of the active player -------------------------------------------------------------- function GetActivePlayer( self ) return getObjectByName(self, "activePlayer") end -------------------------------------------------------------- -- returns whether the player hit one of the movement keys -------------------------------------------------------------- function DidPlayerHitMovementKey( self ) local player = GetActivePlayer( self ) if ( player == nil ) then return false end if ( IsLocalPlayerActive( self ) == false ) then return false end local keysMsg = player:GetRecentMovementKeys{} return ( keysMsg.bForwardPressed or keysMsg.bReversePressed or keysMsg.bLeftPressed or keysMsg.bRightPressed or keysMsg.bJumpPressed ) end -------------------------------------------------------------- -- takes away or gives back player control -- (pass in false to take it away, true to turn it back on) -- Make sure you match calls to this carefully because the "PUSH" and "POP" sent to SetStunned -- increment or decrement the control's corresponding variable. -- (Each "true" sent to SetStunned below is used to know which controls' variables to adjust.) -- You can see how this works at LwoGame \ source \ LWOControllablePhysComponent.cpp in method msgSetStunned -------------------------------------------------------------- function SetPlayerControl( self, bRestore ) local player = GetActivePlayer( self ) if ( player == nil ) then return end if ( IsLocalPlayerActive( self ) == false ) then return end -- note: we can't use SetUserCtrlCompPause because -- we still need to receive player movement values in order to know -- if they want to break out of the instrument before running out of imagination. -- So we use SetStunned instead. -- SetStunned also lets the player move the camera up and down, -- which is consistent with what is allowed while they buid the quickbuild. local eChangeType = "PUSH" if ( bRestore == true ) then eChangeType = "POP" end player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true } end -------------------------------------------------------------- -- check whether the active player is also the local player -------------------------------------------------------------- function IsLocalPlayerActive( self ) local player = GetActivePlayer( self ) return ( player ~= nil and self:GetVar( "activePlayer" ) == GAMEOBJ:GetControlledID():GetID() ) end -------------------------------------------------------------- -- tell the player's LWOUserControlComponent to start or stop tracking recent presses. -- When off, it only knows which key presses occurred that frame. -- If we turn on this tracking, it will rememeber key presses long enough for us to send a query several frames later and -- still find out if they key was pressed recently. -- We need to use this since our timer allows us to send queries every so often - not every frame. -------------------------------------------------------------- function TrackRecentMovementKeys( self, bTrack ) local player = GetActivePlayer( self ) if ( player == nil ) then return end -- only let the active player turn his own tracking on or off if ( IsLocalPlayerActive( self ) == false ) then return end player:TrackRecentMovementKeys{ bTrackForward = bTrack, bTrackReverse = bTrack, bTrackLeft= bTrack, bTrackRight = bTrack, bTrackJump = bTrack } end -------------------------------------------------------------- -- store an object by name -------------------------------------------------------------- function storeObjectByName(self, varName, object) if not object:Exists() or not varName then return end local idString = object:GetID() finalID = "|" .. idString self:SetVar(varName, finalID) end -------------------------------------------------------------- -- get an object by name -------------------------------------------------------------- function getObjectByName(self, varName) if not varName then return end local targetID = self:GetVar(varName) if (targetID) then return GAMEOBJ:GetObjectByID(targetID) else return nil end end local localskillID = 585 function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end --local target = msg.objectID --target:RacingPlayerEvent{ eventType="POWERUP_IMAGINATION", playerID=target, objectID=self } --local driver = target:GetPossessor().possessorID --driver:UpdatePlayerStatistic{ updateID = 21 } --target:CastSkill{skillID = localskillID, optionalTargetID = target} --self:Die{ killerID = msg.playerID, killType = "SILENT" } --self:SetVar("bIsDead", true) end-------------------------------------------------------------- -- Generic Survival Instance Client Zone Script: Including this -- file gives the custom functions for the Survival game. -- updated mrb... 9/27/10 -- updated messaging -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('ai/L_ACTIVITY_MANAGER') --////////////////////////////////////////////////////////////////////////////////// -- local variables local teamScoreBoard = {} local tMedalsSolo = { {name = Localize("Missions_479_name"), score = 60}, {name = Localize("Missions_398_name"), score = 600},} local tMedals = { {name = Localize("Missions_479_name"), score = 60}, {name = Localize("Missions_398_name"), score = 600},} local bFirstTime = true --------------------------------------------------------------- -- Startup of the object --------------------------------------------------------------- function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end function playerInit(self) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) UI:SendMessage( "pushGameState", {{"state", "Survival"}}) -- set player to auto-respawn player:SetPlayerAllowedRespawn{dontPromptForRespawn=true} -- add player to the ui UI:SendMessage( "UpdateSurvivalSummary", {{"user", player }} ) freezePlayer(player) UI:SendMessage( "ToggleActivityCloseButton", { {"bShow", true}, {"GameObject", self}, {"MessageName", "toLua"}, {"senderID", player} } ) local tempTable = { nameVar = player:GetName().name, timeVar = 0, scoreVar = 0, bConfirm = false } self:SetVar("bInit", true) teamScoreBoard = checkScoreBoardTable(self, tempTable) showScoreBoard(self) UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) end function onPlayerReady(self) --print('onPlayerReady ' .. tostring(GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetPlayerReady().bIsReady)) if not GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):GetPlayerReady().bIsReady then --print('Try_Ready_Again') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Ready_Again", self ) else playerInit(self) end end function checkScoreBoardTable(self, tScoreBoard, bRemoveTable) local tTemp = {} local isUsed = false for k,v in ipairs(teamScoreBoard) do if v.nameVar ~= Localize("SURVIVAL_NO_PLAYER") and v.nameVar ~= tScoreBoard.nameVar and v.nameVar ~= '' then table.insert(tTemp,v) --print('add old player to used table ' .. v.nameVar) end if v.nameVar == tScoreBoard.nameVar then if not bRemoveTable then for key,val in pairs(tScoreBoard) do if tostring(val) == tostring(-1) then tScoreBoard[key] = v[key] end end else isUsed = true end end end if not isUsed then table.insert(tTemp,tScoreBoard) --print('add new player to used table ' .. tScoreBoard.nameVar) end table.sort(tTemp, function(a,b) return a.nameVarb.timeVar end) end self:SetVar("playerNum", table.maxn(tTemp)) while table.maxn(tTemp) < 4 do local tempName = "" if table.maxn(tTemp) < self:GetNetworkVar("NumberOfPlayers") then tempName = Localize("SURVIVAL_NO_PLAYER") end table.insert(tTemp, { nameVar = "", timeVar = 0, scoreVar = 0, bConfirm = false}) end --print('***************') --for k,v in ipairs(tTemp) do -- print('*** player ' .. k .. ' ***') -- print(tTemp[k].nameVar .. ' time: ' .. tTemp[k].timeVar .. ' score: ' .. tTemp[k].scoreVar) -- print('***************') --end return tTemp end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 or nSeconds == nil then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function numToString(iNum) if bFirstTime and (iNum == 0 or iNum == nil) then return "--" end return tostring(iNum) end function showScoreBoard(self, bUpdateOnly) p = teamScoreBoard if not p or not self:GetVar("bInit") then return end local messageName = "UpdateSurvivalSummary" local messageArgs = {{ "p1_check", p[1].bConfirm }, -- checkmarks { "p2_check", p[2].bConfirm }, { "p3_check", p[3].bConfirm }, { "p4_check", p[4].bConfirm }, { "p1_name", p[1].nameVar }, -- names { "p2_name", p[2].nameVar }, { "p3_name", p[3].nameVar }, { "p4_name", p[4].nameVar }, { "p1_time", SecondsToClock(p[1].timeVar) }, -- times { "p2_time", SecondsToClock(p[2].timeVar) }, { "p3_time", SecondsToClock(p[3].timeVar) }, { "p4_time", SecondsToClock(p[4].timeVar) }, { "p5_time", SecondsToClock(p[1].timeVar) }, { "p1_score", numToString(p[1].scoreVar) }, -- score { "p2_score", numToString(p[2].scoreVar) }, { "p3_score", numToString(p[3].scoreVar) }, { "p4_score", numToString(p[4].scoreVar) }, { "p5_score", numToString(p[1].scoreVar + p[3].scoreVar + p[2].scoreVar + p[4].scoreVar) }} --for k,v in ipairs(p) do print("**"..p[k].nameVar) end if not bUpdateOnly then -- Hide timer ui UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }}) messageName = "ToggleSurvivalSummary" table.insert(messageArgs, { "visible", true }) end -- Show UI UI:SendMessage(messageName, messageArgs ) end function freezePlayer(self, bFreeze) local playerID = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local eChangeType = "POP" if bFreeze then if playerID:IsDead().bDead then --print('frozen') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Freeze_Again", self ) return elseif not playerID:GetStunned().bCanMove then return end eChangeType = "PUSH" end playerID:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true } --print('Player ' .. playerID:GetName().name .. ' ' .. eChangeType .. ' is frozen: ' .. tostring(self:GetVar('frozen')) .. ' ' .. tostring(playerID:GetStunned().bCanMove)) if playerID:GetStunned().bCanMove and eChangeType == "PUSH" then --print(playerID:GetName().name .. ' is still able to move') GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1, "Try_Freeze_Again", self ) end end function onNotifyClientObject(self, msg) if msg.name == "ToggleLeaderBoard" and msg.paramObj:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true}, {"nextOnly", true} } ) end end ---------------------------------------------------------------- ---- variables serialized from the server ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) -- these need to happen first for k,v in pairs(msg.tableOfVars) do -- check to see if we have the correct message and deal with it if string.starts(k,"Update_ScoreBoard_Players") then local tempPlayer = GAMEOBJ:GetObjectByID(v) if tempPlayer:Exists() then --print("** Update_ScoreBoard_Players " .. tempPlayer:GetName().name) local tempTable = { nameVar = tempPlayer:GetName().name, timeVar = 0, scoreVar = 0, bConfirm = false } teamScoreBoard = checkScoreBoardTable(self, tempTable) UI:SendMessage( "UpdateSurvivalSummary", {{"countdownTime", " " }} ) end elseif string.starts(k,"PlayerConfirm_ScoreBoard") then local tempPlayer = GAMEOBJ:GetObjectByID(v) if tempPlayer:Exists() then --print("** PlayerConfirm_ScoreBoard " .. tempPlayer:GetName().name) local tempTable = { nameVar = tempPlayer:GetName().name, timeVar = -1, scoreVar = -1, bConfirm = true } teamScoreBoard = checkScoreBoardTable(self, tempTable) showScoreBoard(self, true) end elseif k == "Update_Default_Start_Timer" then if self:GetVar("displayDeath") then UI:SendMessage( "UpdateSurvivalScoreboard", {{"iplayerName", "Next Round In"}, {"itime", SecondsToClock( v )} } ) end UI:SendMessage( "UpdateSurvivalSummary", {{"visible", true}, {"countdownTime", v }} ) elseif k == "Update_Timer" then if self:GetVar("displayDeath") then UI:SendMessage( "UpdateSurvivalScoreboard", {{"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( v )} } ) else if self:GetVar("HoldingTopScore") then UI:SendMessage( "UpdateSurvivalScoreboard", {{"itime", SecondsToClock( v ) }, {"inextbesttime", SecondsToClock(v) }, {"inextbestname", player:GetName().name } } ) else UI:SendMessage( "UpdateSurvivalScoreboard", {{"itime", SecondsToClock( v ) } }) checkNextHighScore(self, v) end end end end for k,v in pairs(msg.tableOfVars) do -- check to see if we have the correct message and deal with it if k == "Show_ScoreBoard" then if bFirstTime then --print("--> Show_ScoreBoard " .. player:GetName().name) showScoreBoard(self) player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Pre-Game"} else player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_2"} player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_3"} player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Post-Game"} end freezePlayer(self, true) -- clear game vars self:SetVar("HoldingTopScore", false) self:SetVar("NextBest", false ) self:SetVar("NextBestName", false) self:SetVar("bShowedPlayer", false) self:SetVar("FoundPlayer", false ) elseif k == "Exit_Waves" then local tempPlayer = GAMEOBJ:GetObjectByID(v) local tempTable = { nameVar = tempPlayer:GetName().name, timeVar = 0, scoreVar = 0, bConfirm = false} if player:GetID() == v then break end if #teamScoreBoard > 0 then teamScoreBoard = checkScoreBoardTable(self, tempTable, true) showScoreBoard(self, true) end elseif k == "Start_Wave_Message" then self:SetVar("displayDeath", false) UI:SendMessage("ToggleLeaderboard", { {"id", v},{"visible", false} } ) player:ShowActivityCountdown() UI:SendMessage( "UpdateSurvivalScoreboard", {{"itime", "00:00"}} ) bFirstTime = false freezePlayer(self) player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Post-Game"} player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Pre-Game"} player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_1"} elseif k == "Spawn_Mob" then if v == "2" then player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_1"} player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_2"} elseif v == "3" then player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_2"} player:ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_3"} end elseif k == "Clear_Scoreboard" then UI:SendMessage( "UpdateSurvivalSummary", { {"countdownTime", " " }, {"p1_check", false }, {"p2_check", false }, {"p3_check", false }, {"p4_check", false }} ) -- remove ui timer UI:SendMessage( "ToggleSurvivalSummary", { {"visible", false },} ) -- add ui timer UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", true }, {"itime", "00:00"}} ) teamScoreBoard = {} end end end function onNotifyClientZoneObject(self, msg) if msg.name == "Player_Died" then -- add ui timer UI:SendMessage( "UpdateSurvivalScoreboard", {{"iplayerName", Localize("SURVIVAL_DEAD_LEFT_SIDE_NAME_PLATE")}, {"itime", SecondsToClock( msg.param1 ) }, {"inextbesttime", SecondsToClock(msg.param1) }, {"inextbestname", Localize("SURVIVAL_DEAD_RIGHT_SIDE_NAME_PLATE") } } ) self:SetVar("displayDeath", true) if msg.paramStr == "false" then UI:SendMessage( "UpdateSurvivalScoreboard", { {"survivalNote", Localize("SURVIVAL_DEAD_TOOL_TIP_MESSAGE")} } ) end UI:SendMessage("pushGameState", { {"state", "SurvivalLeaderboard" } }) elseif msg.name == "Update_ScoreBoard" then if not msg.paramObj:Exists() then return end --print('update player ' .. msg.paramObj:GetName().name) local tempTable = { nameVar = msg.paramObj:GetName().name, timeVar = msg.param1, scoreVar = tonumber(msg.paramStr), bConfirm = false } teamScoreBoard = checkScoreBoardTable(self, tempTable) end end function ExitBox(self, player) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then -- display exit box player:DisplayMessageBox{bShow = true, imageID = 1, text = Localize("SURVIVAL_EXIT_QUESTION"), callbackClient = self, identifier = "Exit_Question"} end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) if msg.identifier == "LeaderboardNext" then -- when the player hits the next button on the survival leaderboard UI:SendMessage( "popGameState", {{"state", "SurvivalLeaderboard"}}) self:SetVar("displayDeath", false) GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Post-Game"} GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()):ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Survival_Pre-Game"} showScoreBoard(self) elseif msg.identifier == "ActivityCloseButtonPressed" and msg.iButton == -1 then -- when the player hits the activity close button, the x in the top right ExitBox(self, player) elseif msg.identifier == "Exit" and msg.iButton == 1 then -- when the player hits the exit button on the survival summary UI ExitBox(self, player) elseif msg.identifier == "Exit_Question" and msg.iButton == 1 then -- when the player hit's the check box on the exit question message box clear all the survival UI elements UI:SendMessage( "ToggleActivityCloseButton", {{"bShow", false}} ) UI:SendMessage("ToggleSurvivalSummary", {{"visible", false }}) UI:SendMessage( "ToggleSurvivalScoreboard", {{"visible", false }} ) UI:SendMessage("ToggleLeaderboard", { {"id", msg.identifier},{"visible", false} } ) UI:SendMessage( "popGameState", {{"state", "Survival"}} ) UI:SendMessage( "popGameState", {{"state", "SurvivalLeaderboard"}}) end end function onSendActivitySummaryLeaderboardData(self, msg) --print('Activity Summary Sent to client Zone') if (msg) then self:SetVar("HoldingTopScore", false) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local MaxCount = msg.leaderboardData["Result[0].RowCount"] local n = 1 local tableValues = {} for i = 0, MaxCount do tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].name"] n = n + 1 tableValues[(n)] = msg.leaderboardData["Result[0].Row["..i.."].Time"] n = n + 1 if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] then if msg.leaderboardData["Result[0].Row["..i.."].Relationship"] ~= 0 then self:SetVar("FoundFriendGuild", true ) end end end self:SetVar("bShowedPlayer", false) self:SetVar("NextBest", false) self:SetVar("NextBestName", false) self:SetVar("LeaderTable", tableValues) setNextHighScore(self, iScore) end end function setNextHighScore(self, iScore) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) local name_value = 0 local score_value = 0 local name = 0 local score = 0 local tableValues = self:GetVar("LeaderTable") or {} local curName = self:GetVar("NextBestName") local playerScore = 0 if not curName then curName = player:GetName().name end for testName = 1, #tableValues do if tableValues[testName] == curName then name = testName score = (testName + 1) if name ~= 1 then name_value = (testName - 2) score_value = (testName - 1) elseif name_value == 3 then name_value = 1 score_value = 2 elseif name_value == 1 then name_value = 1 score_value = 2 end end if tableValues[testName] == player:GetName().name then self:SetVar("FoundPlayer", true ) playerScore = tableValues[(testName + 1)] end end local uiName = tableValues[name] or player:GetName().name local uiScore = tableValues[score] or playerScore local uiNextName = tableValues[name_value] or player:GetName().name local uiNextScore = tableValues[score_value] or playerScore if not self:GetVar("bShowedPlayer") then uiNextName = uiName uiNextScore = uiScore end if not iScore then iScore = 0 end local tempMedals = tMedals if self:GetVar("playerNum") == 1 then tempMedals = tMedalsSolo end local highestScore = tableValues[2] or 0 if iScore >= math.floor(highestScore) or not self:GetVar("FoundPlayer") then local pass = false for k,v in ipairs(tempMedals) do if iScore < v.score then uiNextName = v.name uiNextScore = v.score pass = true break end end if not pass then self:SetVar("HoldingTopScore", true) uiNextName = player:GetName().name uiNextScore = iScore end end if not self:GetVar("displayDeath") then UI:SendMessage("UpdateSurvivalScoreboard", { {"iplayerName", player:GetName().name}, {"inextbesttime", SecondsToClock(uiNextScore) }, {"inextbestname", tostring(uiNextName) } } ) end self:SetVar("NextBest", math.floor(uiNextScore) ) self:SetVar("NextBestName", uiNextName ) self:SetVar("bShowedPlayer", true) end function checkNextHighScore(self, iScore) if not iScore or not self:GetVar('NextBest') then return end if iScore >= self:GetVar('NextBest') then setNextHighScore(self, iScore) end end function onTimerDone(self, msg) if msg.name == "Try_Freeze_Again" then freezePlayer(self, true) elseif msg.name == "Try_Ready_Again" then PlayerReady(self) end end-------------------------------------------------------------- -- Generic Survival Instance Server Zone Script: requiring this -- file gives the custom functions for the Survival game. -- updated mrb... 9/23/10 -- updated messaging -------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') --////////////////////////////////////////////////////////////////////////////////// local gConstants = {} local tMobSets = {} local tSpawnerNetworks = {} --============================================================ -- Script only local variables local gGamestate = { tPlayers = {}, -- players who have entered the game tWaitingPlayers = {}, -- players who haven't accepted yet iTotalSpawned = 0, -- total number of spawned mobs iWaveNum = 1, -- current wave number iRewardTick = 1, -- number of rewards given iNumberOfPlayers = 0, -- number of players given from ZoneLoadedInfo } --////////////////////////////////////////////////////////////////////////////////// -- helper function that prints out a variable to the log function dumpVar(name,var,indent) if( indent == nil ) then indent = "" end if( type(var) == "table" ) then print( indent .. name .. " is a table with " .. #var .. " entries:" ) local i,v = next(var) while i do dumpVar(i,v,indent .. " ") i, v = next(var, i) end else local startOfLine = indent .. name .. " is " if( type(var) == "userdata" ) then if( type(var.GetID) == "function" ) then print( startOfLine .. "an object proxy with ID = " .. var:GetID() ) else print( startOfLine .. "unknown userdata" ) end elseif( var == nil ) then print( startOfLine .. "nil" ) elseif( var == true ) then print( startOfLine .. "true" ) elseif( var == false ) then print( startOfLine .. "false" ) else print( startOfLine .. "a(n) " .. type(var) .. " with value = " .. var ) end end end function onZoneLoadedInfo(self, msg) self:SetNetworkVar('NumberOfPlayers', msg.maxPlayersSoft) end function basePlayerReady(self, msg, newMsg) if not self:GetVar('SurvivalStartupComplete') then self:SetVar('SurvivalStartupComplete', true) end end ---------------------------------------------------------------- -- Startup of the object ---------------------------------------------------------------- function baseStartup(self, newMsg) -- Initialize the pseudo random number generator and return math.randomseed( os.time() ) self:SetVar('playersAccepted', 0) self:SetVar('playersReady', false) self:MiniGameSetParameters{numTeams = 1, playersPerTeam = 4} -- print('*****************************************************') -- dumpVar('tSpawnerNetworks', tSpawnerNetworks, ' ') -- print('*****************************************************') end function playerConfirmed(self) local playersConfirmed = {} for k,v in ipairs(gGamestate.tPlayers) do local bPass = false for key,value in ipairs(gGamestate.tWaitingPlayers) do if value == v then bPass = true end end if not bPass then table.insert(playersConfirmed, v) end end self:SetNetworkVar('PlayerConfirm_ScoreBoard', playersConfirmed) end ---------------------------------------------------------------- -- Player has loaded into the map ---------------------------------------------------------------- function basePlayerLoaded(self, msg, newMsg) -- adding the players to the gGamestate tables table.insert(gGamestate.tPlayers, msg.playerID:GetID()) table.insert(gGamestate.tWaitingPlayers, msg.playerID:GetID()) -- adding player to mini game team self:MiniGameAddPlayer{playerID = msg.playerID} self:MiniGameSetTeam{playerID = msg.playerID, teamID = 1} --print('my team is ' .. self:MiniGameGetTeam{ playerID = msg.playerID}.teamID) -- setting up player ui self:SetNetworkVar('Define_Player_To_UI', msg.playerID:GetID()) -- freeze the player movement/controls if not self:GetVar('wavesStarted') then -- updating the scoreboard for the new players self:SetNetworkVar('Update_ScoreBoard_Players', gGamestate.tPlayers) self:SetNetworkVar('Show_ScoreBoard', true) end -- move players to correct spawn locations SetPlayerSpawnPoints(self) if not self:GetVar('wavesStarted') then playerConfirmed(self) else local playerID = msg.playerID if not playerID then return end table.insert(gGamestate.tWaitingPlayers, v) UpdatePlayer(self, playerID) --playerID:SetUserCtrlCompPause{bPaused = false} GetLeaderboardData(self, playerID, 5) --set player stats to max playerID:SetHealth{health = playerID:GetMaxHealth{}.health} --print('max health = ' .. playerID:GetMaxHealth{}.health) playerID:SetArmor{armor = playerID:GetMaxArmor{}.armor} playerID:SetImagination{imagination = playerID:GetMaxImagination{}.imagination} end end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function basePlayerExit(self, msg, newMsg) local playerNum = 0 --print('player ' .. msg.playerID:GetName().name .. ' has exited') for i = 1, table.maxn(gGamestate.tPlayers) do if gGamestate.tPlayers[i] == msg.playerID:GetID() then playerNum = i end end if playerNum ~= 0 then table.remove(gGamestate.tPlayers, playerNum) -- set player to not auto-respawn msg.playerID:SetPlayerAllowedRespawn{dontPromptForRespawn=false} end playerNum = 0 for k,v in ipairs(gGamestate.tWaitingPlayers) do if msg.playerID:GetID() == v then playerNum = k end end if playerNum ~= 0 then table.remove(gGamestate.tWaitingPlayers, playerNum) end if not self:GetVar('wavesStarted') then playerConfirmed(self) --print('num of players left waiting: ' .. #gGamestate.tWaitingPlayers) if #gGamestate.tPlayers == 0 then return end if table.maxn(gGamestate.tWaitingPlayers) == 0 then --print('All players have accepted') ActivityTimerStopAllTimers(self) ActivityTimerStart(self, 'AllAcceptedDelay', 1, gConstants.startDelay) --(timerName, updateTime, stopTime) elseif #gGamestate.tPlayers > #gGamestate.tWaitingPlayers then if not self:GetVar('AcceptedDelayStarted') then self:SetVar('AcceptedDelayStarted', true) ActivityTimerStart(self, 'AcceptedDelay', 1, gConstants.acceptedDelay ) --(timerName, updateTime, stopTime) end end else UpdatePlayer(self, msg.playerID, true) if checkAllPlayersDead() then GameOver(self, msg.playerID) end end SetActivityValue(self, msg.playerID, 1, 0) local numPlayers = self:GetNetworkVar('NumberOfPlayers') self:SetNetworkVar('NumberOfPlayers', numPlayers - 1) end ---------------------------------------------------------------- -- Received a fire event messaged from someplace on the server ---------------------------------------------------------------- function baseFireEvent(self,msg, newMsg) if msg.args == 'start' then StartWaves(self) elseif msg.args == 'DeactivateRewards' then --print('fireevent DeactivateRewards') spawnerResetT(tSpawnerNetworks.rewardNetworks) end end ---------------------------------------------------------------- -- A player had died ---------------------------------------------------------------- function basePlayerDied(self, msg, newMsg) local finalTime = ActivityTimerGetCurrentTime(self, 'ClockTick') SetActivityValue(self, msg.playerID, 1, finalTime) self:NotifyClientZoneObject{name = 'Player_Died', paramObj = msg.playerID, rerouteID = msg.playerID, param1 = finalTime, paramStr = tostring(checkAllPlayersDead())} -- GameOver(self, msg.playerID) end ---------------------------------------------------------------- -- Received a notify object message ---------------------------------------------------------------- function baseNotifyObject(self, msg, newMsg) local player = msg.ObjIDSender -- check to make sure the player is in the activity if not IsPlayerInActivity(self, player) then return end -- update kill score UpdateActivityValue(self, player, 0, msg.param1) end ---------------------------------------------------------------- -- This is called when players hit the UI to exit or stop the game. ---------------------------------------------------------------- function baseMessageBoxRespond(self, msg, newMsg) if (msg.identifier == "RePlay" ) then --print("************* RePlay *************"..msg.sender:GetName().name) PlayerAccepted(self, msg.sender) playerConfirmed(self) elseif (msg.identifier == "Exit_Question" ) and msg.iButton == 1 then --print("************* Exit *************"..msg.sender:GetName().name) ResetStats(msg.sender) self:SetNetworkVar('Exit_Waves', msg.sender:GetID()) -- send player to a specific location msg.sender:TransferToLastNonInstance{ playerID = msg.sender, bUseLastPosition = false, pos_x = 131.83, pos_y = 376, pos_z = -180.31, rot_x = 0, rot_y = -0.268720, rot_z = 0, rot_w = 0.963218} end end -- Custom Functions function setGameVariables(passedConstants, passedMobSets, passedSpawnerNetworks) --print('updated') gConstants = passedConstants tMobSets = passedMobSets tSpawnerNetworks = passedSpawnerNetworks end ---------------------------------------------------------------- -- Custom function: Checks to see if all players have accepted, -- if they have then the game is started. ---------------------------------------------------------------- function PlayerAccepted(self, playerID) local playerNum = 0 for k,v in ipairs(gGamestate.tWaitingPlayers) do if playerID:GetID() == v then playerNum = k end end if playerNum == 0 then return end table.remove(gGamestate.tWaitingPlayers, playerNum) --print('num of players left waiting: ' .. #gGamestate.tWaitingPlayers) if table.maxn(gGamestate.tWaitingPlayers) == 0 and #gGamestate.tPlayers >= self:GetNetworkVar('NumberOfPlayers') then --print('All players have accepted') ActivityTimerStopAllTimers(self) ActivityTimerStart(self, 'AllAcceptedDelay', 1, gConstants.startDelay) --(timerName, updateTime, stopTime) else if not self:GetVar('AcceptedDelayStarted') then self:SetVar('AcceptedDelayStarted', true) ActivityTimerStart(self, 'AcceptedDelay', 1, gConstants.acceptedDelay) --(timerName, updateTime, stopTime) end end end function ResetStats(playerID) -- set the player's imag, health and armor to full if playerID:Exists() then --set player stats to max --print('health = ' .. playerID:GetHealth{}.health) --print('armor = ' .. playerID:GetArmor{}.armor) --print('imagination = ' .. playerID:GetImagination{}.imagination) playerID:SetHealth{health = playerID:GetMaxHealth{}.health} playerID:SetArmor{armor = playerID:GetMaxArmor{}.armor} playerID:SetImagination{imagination = playerID:GetMaxImagination{}.imagination} --print('new health = ' .. playerID:GetHealth{}.health) --print('new armor = ' .. playerID:GetArmor{}.armor) --print('new imagination = ' .. playerID:GetImagination{}.imagination) --print('new imagination = ' .. playerID:GetImagination{}.imagination) end end ---------------------------------------------------------------- -- Custom function: Starts the game. ---------------------------------------------------------------- function StartWaves(self) SetupActivity(self, 4) self:SetVar('playersReady', true) self:SetVar('baseMobSetNum', 1) self:SetVar('randMobSetNum', 1) self:SetVar('AcceptedDelayStarted', false) gGamestate.tWaitingPlayers = {} for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end table.insert(gGamestate.tWaitingPlayers, v) UpdatePlayer(self, playerID) GetLeaderboardData(self, playerID, 5) ResetStats(playerID) end -- needed to get rewards -- taskType = DB name for series of achievments, target = activityID, value1 = what it will evaluate local sTaskType = 'survival_time_team' if #gGamestate.tPlayers == 1 then sTaskType = 'survival_time_solo' end self:SetVar('missionType', sTaskType) --print('start smashables') activateSpawnerNetwork(tSpawnerNetworks.smashNetworks) self:SetVar('wavesStarted', true) self:SetNetworkVar('Start_Wave_Message', "Start!") end ---------------------------------------------------------------- -- Custom function: Checks to see if all the players are dead, -- then stops the game. ---------------------------------------------------------------- function checkAllPlayersDead() local deadPlayers = 0 for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end if playerID:IsDead().bDead then deadPlayers = deadPlayers + 1 end end if deadPlayers == table.maxn(gGamestate.tPlayers) then return true end return false end function SetPlayerSpawnPoints(self) for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end local spawnObj = self:GetObjectsInGroup{ group = 'P' .. k .. '_Spawn', ignoreSpawners = true }.objects[1] if spawnObj then local pos = spawnObj:GetPosition().pos local rot = spawnObj:GetRotation() playerID:Teleport{pos = pos, x = rot.x, y = rot.y, z = rot.z, w = rot.w, bSetRotation = true} end end end ---------------------------------------------------------------- -- Custom function: Happens when all players have died, this -- stops all running processes and resets gGamestate variables ---------------------------------------------------------------- function GameOver(self, player) if not checkAllPlayersDead() then return end local finalTime = ActivityTimerGetCurrentTime(self, 'ClockTick') ActivityTimerStopAllTimers(self) --print('Kill Mobs ***') spawnerResetT(tSpawnerNetworks.baseNetworks) spawnerResetT(tSpawnerNetworks.randNetworks) spawnerResetT(tSpawnerNetworks.rewardNetworks) for k,v in ipairs(gGamestate.tPlayers) do local playerID = GAMEOBJ:GetObjectByID(v) if not playerID then return end local timeVar = GetActivityValue(self, playerID, 1) local scoreVar = GetActivityValue(self, playerID, 0) self:NotifyClientZoneObject{name = 'Update_ScoreBoard', paramObj = playerID, paramStr = tostring(scoreVar), param1 = timeVar} playerID:Resurrect() --print('smashed = ' .. smashVar .. ' out of ' .. gGamestate.iTotalSpawned .. ' for ' .. ' score = ' .. scoreVar .. ' @ %' .. math.floor((smashVar/gGamestate.iTotalSpawned)*100) ) local sTaskType = self:GetVar('missionType') or 'survival_time_team' playerID:UpdateMissionTask{ taskType = sTaskType, value = timeVar, value2 = self:GetActivityID().activityID} -- target = self, -- update mission 479 if the player is on it and has lasted 60 seconds local misState = playerID:GetMissionState{missionID = 479}.missionState if misState > 1 and misState < 4 and timeVar >= 60 then playerID:UpdateMissionTask{taskType = "complete", value = 479, value2 = 1, target = self} end -- this is to have everyone get their own time at the end of the match StopActivity(self, playerID, scoreVar, timeVar) --print('***************************') --print('send update mission task') --print(playerID:GetName().name .. ' ' .. self:GetName().name) --print(sTaskType) --print(self:GetLOT().objtemplate) --print(timeVar) --print('***************************') end -- this is to have everyone get the same time at the end of the match --for k,v in ipairs(gGamestate.tPlayers) do -- local playerID = GAMEOBJ:GetObjectByID(v) -- if not playerID then return end -- StopActivity(self, playerID, scoreVar, finalTime) --end --print('smashed = ' .. GetActivityValue(self, player, 2) .. ' score = ' .. GetActivityValue(self, player, 1)) -- reset ticks gGamestate.iWaveNum = 1 -- current wave number gGamestate.iRewardTick = 1 -- number of rewards given gGamestate.iTotalSpawned = 0 -- number of mobs smashed self:SetVar('wavesStarted', false) -- set the spawner networks back to the origional LOT's if gConstants.bUseMobLots then gConstants.iLotPhase = 1 -- put LotPhase back to 1 updateMobLots(self, tSpawnerNetworks.baseNetworks) updateMobLots(self, tSpawnerNetworks.randNetworks) end SetPlayerSpawnPoints(self) end function basePlayerResurrected(self, msg, newMsg) self:SetNetworkVar('Show_ScoreBoard', true) end ---------------------------------------------------------------- -- Custom function: Gets a random number that is not the old number ---------------------------------------------------------------- function newRand(oldNum, maxRand) if maxRand == 1 then return '01', '01' end local randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end while randNum == oldNum do --print('found same') randNum = math.random(1, maxRand) if randNum < 10 then randNum = '0' .. randNum end end return randNum end ---------------------------------------------------------------- -- Custom function: Starts a spawner network ---------------------------------------------------------------- function activateSpawnerNetwork(spawnNetwork) for k,v in ipairs(spawnNetwork) do for i = 1, v.spawnerNum do --print('activateSpawnerNetwork: ' .. v.spawnerName .. '0' .. i) local spawner = LEVEL:GetSpawnerByName(v.spawnerName[i] .. v.spawnerNum) if spawner then --print('activateSpawnerNetwork --> ' .. v.spawnerName .. '0' .. i) if not spawner:SpawnerIsActive().bActive then --print('activate now') spawner:SpawnerActivate() end --print('reset now') spawner:SpawnerReset() end end end end ---------------------------------------------------------------- -- Custom function: Resets a spawner network ---------------------------------------------------------------- function spawnerResetT(spawnNetwork, bMaintainSpawnNum, iNumToMaintain) local TotalSpawned = 0 --dumpVar('resetTable', spawnNetwork, ' ') for k,v in ipairs(spawnNetwork) do for i = 1, table.maxn(v.spawnerName) do local spawner = LEVEL:GetSpawnerByName(v.spawnerName[i] .. v.spawnerNum) if spawner then --print('reset: ' .. v.spawnerName[i] .. v.spawnerNum) local numSpawned = spawner:SpawnerGetTotalSpawned() if numSpawned then --track total mobs spawned TotalSpawned = TotalSpawned + numSpawned.iSpawned end v.bIsActive = false if not bMaintainSpawnNum then spawner:SpawnerDestroyObjects() end if iNumToMaintain then spawner:SpawnerSetNumToMaintain{uiNum = iNumToMaintain} --print('set spawn number to ' .. iNumToMaintain) end spawner:SpawnerDeactivate() end end end if TotalSpawned > gGamestate.iTotalSpawned then gGamestate.iTotalSpawned = TotalSpawned end end ---------------------------------------------------------------- -- Custom function: Spawns mobs on a spawner network, Now... ---------------------------------------------------------------- function spawnNow(spawner, spawnNum) if spawner then --print('*** Spawn Now!!') if not spawner:SpawnerIsActive().bActive then spawner:SpawnerSetNumToMaintain{uiNum = spawnNum} spawner:SpawnerActivate() else spawner:SpawnerSetNumToMaintain{uiNum = spawnNum} spawner:SpawnerReset() end end end ---------------------------------------------------------------- -- Custom function: Returns a random spawn set from tMobSets or false ---------------------------------------------------------------- function getRandomSet(setName, setNum) local randNum = math.random(1, #tMobSets[setName]['tier' .. setNum]) local randSet = tMobSets[setName]['tier' .. setNum][randNum] --dumpVar('** ' .. setName .. ' using: ' .. randNum, randSet) if randSet then return randSet end return false end ---------------------------------------------------------------- -- Custom function: Returns a random spawner number from the given -- spawner table or false ---------------------------------------------------------------- function getRandomSpawnerNum(tSpawner) local randNum = 0 local bValid = false while not bValid do randNum = 0 for k,v in ipairs(tSpawner) do if v.bIsLocked == false then randNum = randNum + 1 end end randNum = math.random(1, randNum) if randNum == 1 then bValid = true elseif not tSpawner[randNum].bIsActive then bValid = true tSpawner[randNum].bIsActive = true end end if randNum ~= 0 then return randNum end return false end ---------------------------------------------------------------- -- Custom function: Update the spawner in the specified way ---------------------------------------------------------------- function updateSpawner(self, tSpawner, spawnNum) if not tSpawner then return end if spawnNum then --print('Spawner: ' .. tSpawner.spawnerName[1] .. tSpawner.spawnerNum .. ' spawn: ' .. spawnNum) local spawner = LEVEL:GetSpawnerByName(tSpawner.spawnerName[1] .. tSpawner.spawnerNum) spawnNow(spawner, spawnNum) return end local newSet = getRandomSet(tSpawner.set, self:GetVar(tSpawner.set .. 'Num')) if newSet then local newSpawner = getRandomSpawnerNum(tSpawner) for k,v in ipairs(newSet) do if v ~= 0 then --print('Spawner: ' .. tSpawner[newSpawner].spawnerName[k] .. tSpawner[newSpawner].spawnerNum .. ' spawn: ' .. tSpawner[newSpawner].spawnerNum) local spawner = LEVEL:GetSpawnerByName(tSpawner[newSpawner].spawnerName[k] .. tSpawner[newSpawner].spawnerNum) spawnNow(spawner, v) end end end end ---------------------------------------------------------------- -- Custom function: Update the objects that are being spawned on -- a spawner network based on the LotPhase of the game. ---------------------------------------------------------------- function updateMobLots(self, tSpawner) local iPhase = gConstants.iLotPhase -- search through the given table to find the spanwer network for k,v in ipairs(tSpawner) do for i,name in ipairs(v.spawnerName) do if name ~= nil then local spawner = LEVEL:GetSpawnerByName(name .. v.spawnerNum) local tempName = split(name, "_") local lotName = tempName[2] if not lotName then lotName = tempName[1] end if spawner then -- Update the spawn set template ID based on the new LOT spawner:SpawnerSetSpawnTemplateID{iObjTemplate = tMobSets.mobLots[lotName][iPhase]} --print('swapped ' .. name .. v.spawnerNum .. ' for: ' .. tMobSets.mobLots[lotName][iPhase]) end end end end end ---------------------------------------------------------------- -- Custom function: splits a string based on patern and returns a table ---------------------------------------------------------------- function split(str, pat) local t = {} -- NOTE: use {n = 0} in Lua-5.0 local fpat = "(.-)" .. pat local last_end = 1 local s, e, cap = str:find(fpat, 1) while s do if s ~= 1 or cap ~= "" then table.insert(t,cap) end last_end = e+1 s, e, cap = str:find(fpat, last_end) end if last_end <= #str then cap = str:sub(last_end) table.insert(t, cap) end return t end ---------------------------------------------------------------- -- Custom function: Decides how to spawne mobs ---------------------------------------------------------------- function spawnMobs(self) if not self:GetVar('wavesStarted') then return end gGamestate.iWaveNum = gGamestate.iWaveNum + 1 local spawnNum = gGamestate.iWaveNum if spawnNum > gConstants.rewardInterval then spawnNum = spawnNum - (gGamestate.iRewardTick-1) end for k,v in ipairs(gConstants.baseMobsStartTierAt) do if spawnNum == v then --print('************** Base Tier ' .. v .. ' **************') self:SetVar('baseMobSetNum', k) end end for k,v in ipairs(gConstants.randMobsStartTierAt) do if spawnNum == v then self:SetVar('randMobSetNum', k) --print('************** Random Tier ' .. v .. ' **************') end end if gGamestate.iWaveNum == gConstants.unlockNetwork3 then tSpawnerNetworks.randNetworks[3].bIsLocked = false end spawnerResetT(tSpawnerNetworks.baseNetworks, true, 0) spawnerResetT(tSpawnerNetworks.randNetworks, true, 0) updateSpawner(self, tSpawnerNetworks.baseNetworks) --print('**** Spawn Tier' .. self:GetVar('baseMobSetNum') .. ' BaseMobs @ ' .. spawnNum .. '****') if spawnNum >= gConstants.startMobSet2 then -- gGamestate.iWaveNum >= gConstants.startMobSet2 and if spawnNum == gConstants.startMobSet2 then --print('************** Start Random Mobs Set 2 **************') self:SetNetworkVar('Spawn_Mob', "2") end --print('**** Spawn Tier' .. self:GetVar('randMobSetNum') .. ' RandMobs1 @ ' .. spawnNum .. '****') updateSpawner(self, tSpawnerNetworks.randNetworks) end if spawnNum >= gConstants.startMobSet3 then --gGamestate.iWaveNum >= gConstants.startMobSet3 and if spawnNum == gConstants.startMobSet3 then --print('************** Start Random Mobs Set 3 **************') self:SetNetworkVar('Spawn_Mob', "3") end --print('**** Spawn Tier' .. self:GetVar('randMobSetNum') .. ' RandMobs2 ' .. spawnNum .. '****') updateSpawner(self, tSpawnerNetworks.randNetworks) end -- check if we need to update the spawner network template ID, if we have reached the end of our spawn pattern and we want to use lots if gConstants.bUseMobLots and gConstants.iLotPhase < #tSpawnerNetworks.baseNetworks[1].spawnerName then if spawnNum >= gConstants.baseMobsStartTierAt[#gConstants.baseMobsStartTierAt] then gConstants.iLotPhase = gConstants.iLotPhase + 1 gGamestate.iWaveNum = 1 updateMobLots(self, tSpawnerNetworks.baseNetworks) updateMobLots(self, tSpawnerNetworks.randNetworks) --print('updating to next phase ' .. gConstants.iLotPhase) end end end ---------------------------------------------------------------- -- When activity is stopped this is needed to update the leaderboard. ---------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- get the time for the player --print('Score = ' .. msg.fValue1) --print('Time = ' .. msg.fValue2) msg.outActivityRating = msg.fValue2 return msg end -- activity timers ---------------------------------------------------------------- -- When ActivityTimerUpdate is sent, basically when a timer hits it updateInterval. ---------------------------------------------------------------- function onActivityTimerUpdate(self, msg) if msg.name == "AcceptedDelay" then --print('update delay timer to ' .. math.ceil(msg.timeRemaining)) self:SetNetworkVar('Update_Default_Start_Timer', math.ceil(msg.timeRemaining)) elseif msg.name == "ClockTick" then self:SetNetworkVar('Update_Timer', msg.timeElapsed) elseif msg.name == "SpawnTick" and not self:GetVar('isCoolDown') then spawnMobs(self) end end ---------------------------------------------------------------- -- When ActivityTimerDone is sent, basically when the activity timer has reached it's duration. ---------------------------------------------------------------- function onActivityTimerDone(self, msg) if msg.name == "AcceptedDelay" then --or msg.name == "AllAcceptedDelay" --print('update delay timer to 0') self:SetNetworkVar('Update_Default_Start_Timer', 0) ActivityTimerStart(self, 'AllAcceptedDelay', 1, 1) elseif msg.name == "AllAcceptedDelay" then --or msg.name == "AllAcceptedDelay" --print('accepted delay *******************************') self:SetNetworkVar('Clear_Scoreboard', true) ActivityTimerStart(self, 'StartDelay', 3, 3) --(timerName, updateTime, stopTime) StartWaves(self) elseif msg.name == "StartDelay" then --print('adding in timers *******************************') ActivityTimerStart(self, 'ClockTick', 1) --(timerName, updateTime, stopTime) ActivityTimerStart(self, 'SpawnTick', gConstants.waveTime) --(timerName, updateTime, stopTime) spawnMobs(self) ActivityTimerStart(self, 'CoolDownStart', (gConstants.rewardInterval*gConstants.waveTime), (gConstants.rewardInterval*gConstants.waveTime)) --(timerName, updateTime, stopTime) ActivityTimerStart(self, 'PlaySpawnSound', 3, 3) --(timerName, updateTime, stopTime) elseif msg.name == "CoolDownStart" then --print('cool down start timer *******************************') self:SetVar('isCoolDown', true) ActivityTimerStop(self, 'SpawnTick') ActivityTimerStart(self, 'CoolDownStop', gConstants.coolDownTime, gConstants.coolDownTime) --print('**** Reward ****') updateSpawner(self, tSpawnerNetworks.rewardNetworks[1], 1) gGamestate.iRewardTick = gGamestate.iRewardTick + 1 --print('stopping clock tick') ActivityTimerStart(self, 'CoolDownTick', 1, gConstants.coolDownTime) --(timerName, updateTime, stopTime) spawnerResetT(tSpawnerNetworks.baseNetworks, true, 0) spawnerResetT(tSpawnerNetworks.randNetworks, true, 0) elseif msg.name == "CoolDownStop" then --print('cool down stop timer *******************************') self:SetVar('isCoolDown', false) ActivityTimerStart(self, 'SpawnTick', gConstants.waveTime) --(timerName, updateTime, stopTime) ActivityTimerStart(self, 'CoolDownStart', (gConstants.rewardInterval*gConstants.waveTime), (gConstants.rewardInterval*gConstants.waveTime)) --(timerName, updateTime, stopTime) spawnMobs(self) ActivityTimerStart(self, 'PlaySpawnSound', 3, 3) --(timerName, updateTime, stopTime) elseif msg.name == "PlaySpawnSound" then -- play war horn sound for k,v in ipairs(gGamestate.tPlayers) do GAMEOBJ:GetObjectByID(v):PlayNDAudioEmitter{m_NDAudioEventGUID = '{ca36045d-89df-4e96-a317-1e152d226b69}'} end end end function baseActivityStateChangeRequest(self, msg, newMsg) end require('equipmenttriggers/skillSetTriggerTemplate') function onStartup(self) --conditions for firing the trigger self:SetVar("trigger", {Name="Low Imagination", Stat="IMAGINATION", Operator="LESS", Value=1} ) --skill to fire self:SetVar("skillID", 582) --how many items from a given set they must have equipped before the skill fires. self:SetVar("itemsRequired", 4) --ID of the skill set they have to have equipped self:SetVar("skillSet", 4) -- Confirms that this is a faction set skill trigger self:SetVar("isFactionSkill", true) -- Set the faction skill as ready to fire self:SetVar("factionSkillReady", true) -- The time the faction skill has for its "cooldown" self:SetVar("factionCooldownTime", 11) end -------------------------------------------------------------------- --script to turn the effects on and off for the gate -------------------------------------------------------------------- function onStartup(self) self:AddObjectToGroup{group = "Gate"} self:SetVar("AmPlayingFX", false) end function onNotifyObject(self, msg) if msg.name == "GateActive" and self:GetVar("AmPlayingFX") == false then --print("playing FX") self:SetVar("AmPlayingFX", true) self:PlayFXEffect{effectID = 2988, name = "GateSpawn", effectType = "create"} GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "StartFX", self ) elseif msg.name == "GateDown" and self:GetVar("AmPlayingFX") then --print("shutting off FX") self:SetVar("AmPlayingFX", false) self:StopFXEffect{name = "GateEnergy"} self:StopFXEffect{name = "GateEnergy2"} --self:StopFXEffect{name = "GateSpawn"} end end function onTimerDone(self, msg) if msg.name == "StartFX" then self:PlayFXEffect{effectID = 2242, name = "GateEnergy2", effectType = "create"} self:PlayFXEffect{effectID = 2243, name = "GateEnergy", effectType = "create"} end end-------------------------------------------------------------- -- Foot Race script that -- updated mrb... 2/17/10 -------------------------------------------------------------- require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') require('ai/ACT/FootRace/L_ACT_BASE_FOOT_RACE_CLIENT') local gVars = { pathName = "Foot_Race_Path_01", goalLot = 8575, obsticleLot = {--[[8572, 8578, 8579, 6214,--]]}, --6215, 8576, numOfObsticles = 0, finalGoalObsticleLot = 6216, sStopTooltipText = Localize("FOOT_RACE_STOP_QUESTION"), sStartTooltipText = Localize("FOOT_RACE_START_QUESTION"), sFirstGoalText = Localize("FOOT_RACE_FIRST_GOAL"), sFinalGoalText = Localize("FOOT_RACE_FINAL_GOAL"), startTime = 15, -- amount of time the player should start the race with addTime = 5, -- amount of time to add when the player hits a goal completedSetFlagNum = 85, -- sets the specified flag when the race is completed completedFireEventGroup = nil,} -- -ie- "PandaGroup" - calls FireEventServerSide message named Foot_Race_Completed to the group with the playerID as param1 -- these variabls are for setting up the goal posts only local tGoalpostVars = { goalpostLot = 3890, goalpostOffset = 5.2, -- how far right and left of the object to spawn in the goal posts. nextEffectID = 503, nextEffectType = "create",} ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the script starts up; setup activity and randomseed ---------------------------------------------------------------- function onStartup(self) setLocalVars(self, gVars, tGoalpostVars) baseStartup(self) end ---------------------------------------------------------------- -- called when the script is shut down; clears out the UI ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self) end ---------------------------------------------- -- sent when the local player interacts with the object ---------------------------------------------- function onClientUse(self, msg) baseClientUse(self, msg) end ---------------------------------------------- -- sent when the local player terminates an interacts with the object ---------------------------------------------- function onTerminateInteraction(self, msg) baseTerminateInteraction(self, msg) end ---------------------------------------------- -- sent when the player responds to the message box ---------------------------------------------- function onMessageBoxRespond(self, msg) baseMessageBoxRespond(self, msg) end ---------------------------------------------- -- fire event sent from another client object ---------------------------------------------- function onFireEvent(self, msg) baseFireEvent(self, msg) end ---------------------------------------------- -- called when an activity timer is updated ---------------------------------------------- function onActivityTimerUpdate(self, msg) baseActivityTimerUpdate(self, msg) end ---------------------------------------------- -- called when an activity timer is finished ---------------------------------------------- function onActivityTimerDone(self, msg) baseActivityTimerDone(self, msg) end function onStartup(self) -- store the caster for use when skill is cast. GAMEOBJ:GetTimer():AddTimerWithCancel( 1.5, "FireSkill", self ) self:GetParentObj{}.objIDParent:SetStatusImmunity{StateChangeType = "PUSH",bImmuneToKnockback = true, bImmuneToInterrupt = true, bImmuneToSpeed = true, bImmuneToBasicAttack = true, bImmuneToDOT = true, bImmuneToImaginationGain=false, bImmuneToImaginationLoss = true, bImmuneToQuickbuildInterrupt = false, bImmuneToPullToPoint = false} self:GetParentObj{}.objIDParent:SetStunImmunity{StateChangeType = "PUSH", bImmuneToStunMove = true, bImmuneToStunTurn = true, bImmuneToStunAttack = true, bImmuneToStunEquip = true, bImmuneToStunInteract = true} self:GetParentObj{}.objIDParent:SetStunned{StateChangeType = "PUSH", bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true} --print("**************startingup**************") end function onDie(self, msg) self:GetParentObj{}.objIDParent:SetStatusImmunity{StateChangeType = "POP",bImmuneToKnockback = true, bImmuneToInterrupt = true, bImmuneToSpeed = true, bImmuneToBasicAttack = true,bImmuneToDOT = true, bImmuneToImaginationGain = false, bImmuneToImaginationLoss = true, bImmuneToQuickbuildInterrupt = false, bImmuneToPullToPoint = false} self:GetParentObj{}.objIDParent:SetStunImmunity{StateChangeType = "POP", bImmuneToStunMove = true, bImmuneToStunTurn = true, bImmuneToStunAttack = true, bImmuneToStunEquip = true, bImmuneToStunInteract = true} self:GetParentObj{}.objIDParent:SetStunned{StateChangeType = "POP", bCantMove = true, bCantTurn = true, bCantAttack = true, bCantEquip = true, bCantInteract = true} --print("**************I can has on die from the fortress?********") --print(self:GetParentObj{}.objIDParent:GetName().name) end function onTimerDone(self, msg) if msg.name == "FireSkill" then self:CastSkill{skillID = 650, optionalOriginatorID = self:GetParentObj{}.objIDParent} end end------------------------------------------------------------------------- --spawns in the monster at the FV gate ------------------------------------------------------------------------- function onStartup(self) self:SetVar("HaveSpawned", false) self:AddObjectToGroup{group = "MonsterSpawnVolume"} end function onCollisionPhantom(self, msg) --print("collided") if self:GetVar("HaveSpawned") == false then self:SetVar("HaveSpawned", true) local spawnerobj = self:GetObjectsInGroup{group = "MonsterSpawn", ignoreSpawners = true}.objects[1] if spawnerobj then local pos = spawnerobj:GetPosition().pos local rot = spawnerobj:GetRotation() local config = {{"groupID", "Monster" }} RESMGR:LoadObject { objectTemplate = 9503 , x = pos.x , y = pos.y , z = pos.z , rw = rot.w, rx = rot.x , ry = rot.y , rz = rot.z , owner = self,configData = config } end local gate = self:GetObjectsInGroup{group = "Gate", ignoreSpawners = true}.objects[1] if gate then gate:NotifyObject{name = "GateDown"} end end end function onNotifyObject(self, msg) if msg.name == "MonsterDespawned" then self:SetVar("HaveSpawned", false) end end-------------------------------------------------------------- -- Script on the FV Pet Red Dragons -- sets the pets as untamable, and allows them to be tamed after spraying them with the watergun -- -- created by Michael Edwards -- updated Brandi... 2/4/10 -- Updated Medwards 3/3/10 -- Updated Medwards 8/25/10 ----------------------------------------------------------- function onStartup(self,msg) if self:IsPetWild().bIsPetWild == true then MakeUntameable(self) else -- change faction self:SetFaction{faction = 99} -- clear threat list self:ClearThreatList{} end end -- When the player squirts the skunk with the water gun function onSkillEventFired( self, msg ) if msg.wsHandle == "waterspray" then -- Check if the pet has been tamed and, if so, don't do this if self:IsPetWild().bIsPetWild == false then return end -- Check if the skunk has been sprayed by seeing if it's on a non pet faction if self:GetFaction{}.faction ~= 99 then -- change faction self:SetFaction{faction = 99} -- clear threat list self:ClearThreatList{} -- start a timer that will turn the skunk untamable and aggro GAMEOBJ:GetTimer():AddTimerWithCancel( 30, "GoEvil", self ) -- turn off stink fx self:StopFXEffect{name = "burning1"} self:StopFXEffect{name = "burning2"} -- Send a network valriable to the client script to change picktype. self:SetNetworkVar("bIAmTamable", true) end end end function onTimerDone(self, msg) --Did the timer to see if the skunk needs to go aggro again fire? if msg.name == "GoEvil" then MakeUntameable(self) end end --Checking the state of the pet taming minigame. If start, cancel timers. If quit, start short "go evil" timer function onNotifyPetTamingMinigame(self, msg) if msg.notifyType == "BEGIN" then GAMEOBJ:GetTimer():CancelAllTimers(self) elseif msg.notifyType == "FAILED" or msg.notifyType == "QUIT" then GAMEOBJ:GetTimer():AddTimerWithCancel( 5, "GoEvil", self ) end end -- used to remove taming faction and send a variable to the client script to make unpickable function MakeUntameable(self) -- check the skunks taming state. 5 means the pet is currently being tamed. This checks if that is false if self:GetPetHasState{iStateType = 5}.bHasState == false then --make the pet non tamable -- change faction self:SetFaction{faction = 114} -- refill health self:SetHealth{health = 5} -- play the Burn effect self:PlayFXEffect{name = "burning1", effectID = 3170, effectType = "create"} self:PlayFXEffect{name = "burning2", effectID = 4058, effectType = "create"} self:SetNetworkVar("bIAmTamable", false) return end end-------------------------------------------------------------- -- Server side script on the panda pet -- this script control the pandas life before he is tamed by a player -- created by Steve... -- created from Brandi's Lion script... 2/17/10 -- updated by Dallas 7/29/10 - fixed 'or' statement -------------------------------------------------------------- function onStartup(self) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local player = self:GetVar("tamer") self:SetNetworkVar("pandatamer", player) --kill the panda after 2 minutes if the player who spawned it doesn't tame it GAMEOBJ:GetTimer():AddTimerWithCancel( 45, "killSelf",self ) --print("panda pet server script starting up") end function onNotifyPetTamingMinigame(self,msg) --if the player begins the taming minigame, cancel the timer that kills the panda if msg.notifyType == "BEGIN" then GAMEOBJ:GetTimer():CancelTimer("killSelf",self) --if the player fails or quits the minigame, kill the panda elseif msg.notifyType == ("QUIT") or msg.notifyType == ("FAILED") then self:Die{killerID = self, killType = "SILENT"} --if the player succeeds in the minigame, command the panda to go to the player, otherwise he could teleport off -- because the minigame tells him to go to his spawn point, and he doesnt have one elseif msg.notifyType == "SUCCESS" then local player = msg.PlayerTamingID self:CommandPet{iPetCommandType = 6} local pandas = self:GetObjectsInGroup{ group = "pandas", ignoreSpawners = true }.objects --print("before "..#pandas) --print("remove object from group panda"..player:GetID()) self:RemoveObjectFromGroup{group = "pandas"} self:RemoveObjectFromGroup{group = "panda"..player:GetID()} local pandas2 = self:GetObjectsInGroup{ group = "pandas", ignoreSpawners = true }.objects --print("after "..#pandas2) player:SetFlag{iFlagID = 82, bFlag = true} end end function onTimerDone (self,msg) --print("panda server timer done") -- kill the panda if he's been alive for too long. pandas have a very short life span if (msg.name == "killSelf") then --print("panda timer finished, killSelf") --double check not to kill a panda that is actually someones pet if self:IsPetWild{}.bIsPetWild == false then --print("pet is wild") return end self:Die{killerID = self, killType = "SILENT"} end end function onStartup(self) self:SetVar("Collider", 0) local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then HeroShip[i]:PreloadAnimation{animationID = "lap_02", respondObjID = self} break elseif HeroShip[i]:GetLOT().objtemplate == 10002 then HeroShip[i]:PreloadAnimation{animationID = "lap_02", respondObjID = self} break end end end function onCollisionPhantom(self, msg) local player = msg.objectID local lap = player:VehicleGetCurrentLap{}.uiCurLap if player:GetID() == GAMEOBJ:GetControlledID():GetID() and self:GetVar("Collider") == 0 then if lap == 2 then self:SetVar("Collider", 1) local HeroShip = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (HeroShip) do if HeroShip[i]:GetLOT().objtemplate == 9529 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_02"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} break elseif HeroShip[i]:GetLOT().objtemplate == 10002 then local Ship = HeroShip[i] Ship:PlayAnimation{animationID = "lap_02"} Ship:SetOffscreenAnimation{bAnimateOffscreen = true} -- Adding timer to remove chevron at appropriate time during animation --print "Start timer" GAMEOBJ:GetTimer():AddTimerWithCancel( 1.6, "DeleteChevron", self ) break end end end end end function onTimerDone(self, msg) if msg.name == "DeleteChevron" then --print "Not finding chevron" local Chevron = self:GetObjectsInGroup{ group = "GoodShip"}.objects for i = 1, table.maxn (Chevron) do if Chevron[i]:GetLOT().objtemplate == 10003 then local Chevy = Chevron[i] --print "Deleting Chevron" GAMEOBJ:DeleteObject(Chevy) break end end end end ----------------------------------------------------------------------- --volume that destroys the monster ----------------------------------------------------------------------- function onCollisionPhantom(self, msg) --print("collided") local playerID = GAMEOBJ:GetControlledID():GetID() if (msg.objectID:GetID() == playerID) then GAMEOBJ:GetTimer():AddTimerWithCancel( 1 , "killMonster", self ) local volume = self:GetObjectsInGroup{group = "MonsterSpawnVolume", ignoreSpawners = true}.objects[1] if volume then volume:NotifyObject{name = "MonsterDespawned"} end local gate = self:GetObjectsInGroup{group = "Gate", ignoreSpawners = true}.objects[1] if gate then gate:NotifyObject{name = "GateActive"} end end end function onTimerDone(self, msg) if msg.name == "killMonster" then monster = self:GetObjectsInGroup{group = "Monster"}.objects[1] if monster then monster:Die() end end end-- ================================================ -- L_ACT_CANNON.lua -- Server Side -- updated 9/1/10 mrb... - changed the way ships were being scored -- ================================================ -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('o_mis') require('o_ShootingGallery') require('ai/ACT/L_ACT_GENERIC_ACTIVITY_MGR') spawns = {} SPAWN_DATA = {} CONSTANTS = {} waves = {} PLAYER_SCORE = {} EFFECTS = {} ACTORS = {} LOCALS = {} local m_totalScore = 0 local g_const = {} -------------------------------------------------------------- -- target Settings -------------------------------------------------------------- function targetSettings(self) -- AddPath - adds a path to a spawn. Can have one or more. -- Syntax: AddPath(paths, "[Path Name]") -- AddSpawn - configures data for the spawn and adds it. Can -- only have one. -- Syntax: AddSpawn(spawn, paths, [Template ID], -- [Initial Spawn Time Min], [Initial Spawn Time Max], [Does Respawn], -- [Respawn Time Min], [Respawn Time Max], -- [Initial Speed], [Score], [Change Speed at Waypoints], -- [Chance to Change Speed], [Min Speed], [Max Speed], -- [Is Moving Platform], [Despawn On Last Waypoint], [Time Score]) -- -- NOTE: All times are in Seconds (i.e. 3.50 = 3 and a half seconds) -------------------------------------------------------------- -- Wave 1 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 10.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 2 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 5000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) -------------------------------------------------------------- -- Wave 3 Spawns spawn = {} -------------------------------------------------------------- -- Ship 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_1") AddPath(paths, "Wave_1_Ship_3") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ship_2") AddPath(paths, "Wave_1_Ship_4") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Ship_1") AddPath(paths, "Wave_2_Ship_2") AddSpawn(spawn,paths, 6015, 0.0, 2.0, true, 0, 2, 2.0, 500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ship 4 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Ship_1") AddPath(paths, "Wave_3_Ship_2") AddSpawn(spawn,paths, 6300, 0.0, 2.0, true, 0, 2, 2.0, 1500, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Sub 1 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Sub_1") AddPath(paths, "Wave_1_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_2_Sub_1") AddPath(paths, "Wave_2_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Sub 3 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_Sub_1") AddPath(paths, "Wave_3_Sub_2") AddSpawn(spawn,paths, 6016, 0.0, 2.0, true, 0, 2, 2.0, 1000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Duck -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Duck_1") AddPath(paths, "Wave_1_Duck_2") AddSpawn(spawn,paths, 5946, 5.0, 10.0, true, 5.0, 10.0, 4.0, 5000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Ness -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_1_Ness_1") AddPath(paths, "Wave_1_Ness_2") AddPath(paths, "Wave_2_Ness_1") AddSpawn(spawn,paths, 2565, 10.0, 15.0, true, 10.0, 15.0, 2.0, 10000, false, 0.0, 1.0, 1.0, true, true, 0.0) -- Friendly -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_1") AddPath(paths, "Wave_3_FShip_2") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Friendly 2 -------------------------------------------------------------- paths = {} -------------------------------------------------------------- AddPath(paths, "Wave_3_FShip_3") AddPath(paths, "Wave_3_FShip_4") AddSpawn(spawn,paths, 2168, 0.0, 5.0, true, 2.0, 5.0, 1.0, -1000, false, 0.0, 1.0, 1.0, false, true, 0.0) -- Add the spawns for the wave AddSpawnsForWave(spawns,spawn) end function StartLuaNotify(self) self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ActivityStateChangeRequest"} self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="MessageBoxRespond"} self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="NotifyObject"} self:SendLuaNotificationRequest{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ObjectLoaded"} end function StopLuaNotify(self) self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ActivityStateChangeRequest"} self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="MessageBoxRespond"} self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="NotifyObject"} self:SendLuaNotificationCancel{requestTarget=GAMEOBJ:GetZoneControlID(), messageName="ObjectLoaded"} end -------------------------------------------------------------- -- Startup -------------------------------------------------------------- function onStartup(self) -- set game state targetSettings(self) resetVars(self) LOCALS["GameStarted"] = false m_totalScore = 0 math.randomseed( os.time() ) -- default the instance vars self:SetVar("initVelVec",{x = 0, y = 0, z = 0}) -- send an object loaded message to the ZoneControl object GAMEOBJ:GetZoneControlID():ObjectLoaded{objectID = self, templateID = self:GetLOT().objtemplate} StartLuaNotify(self) -------------------------------------------------------------- -- Constants -------------------------------------------------------------- local zoneID = GAMEOBJ:GetZoneControlID() g_const = zoneID:GetVar("CONSTANTS") self:SetVar("ImpactSkillID",g_const.IMPACT_SKILLID) local startObj = self:GetObjectsInGroup{ignoreSpawners=true,group = "start_pos" }.objects[1] if startObj then local selfPos = self:GetPosition().pos local startPos = startObj:GetPosition().pos local pos = {x = 0, y = 0, z = 0} -- z and x must be switched and negative when sending to the SetShootingGalleryParams pos.z = -(startPos.x - selfPos.x) pos.y = startPos.y - selfPos.y pos.x = -(startPos.z - selfPos.z) g_const["CANNON_PLAYER_OFFSET"] = pos end self:SetShootingGalleryParams{playerPosOffset = g_const.CANNON_PLAYER_OFFSET, projectileVelocity = g_const.CANNON_VELOCITY, cooldown = g_const.CANNON_REFIRE_RATE, muzzlePosOffset = g_const.CANNON_BARREL_OFFSET, minDistance = g_const.CANNON_MIN_DISTANCE, timeLimit = g_const.CANNON_TIMEOUT, cameraFOV = g_const.CANNON_FOV, bUseLeaderboards = g_const.CANNON_USE_LEADERBOARDS } self:SetVar("TIME_LIMIT", zoneID:GetVar("timelimit")) -- for Animations self:SetVar("VALID_ACTORS", {3109, 3110, 3111, 3112, 3125, 3126}) self:SetVar("VALID_EFFECTS", {3122}) self:SetVar("STREAK_BONUS", {1,2,5,10}) self:SetVar("mHit", 0) self:SetVar("Super_Charge_Active", false) self:SetVar("Matrix", 1) -- set game state LOCALS["GameStarted"] = false LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["NumShots"] = 0 LOCALS["NumKills"] = 0 LOCALS["MaxStreak"] = 0 resetVars(self) end function onShutDown(self) StopLuaNotify(self) end function resetVars(self) LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 LOCALS["ThisWave"] = 0 LOCALS["GameScore"] = 0 LOCALS["GameTime"] = 0 LOCALS["GameStarted"] = false self:SetVar("m_shotsFired",0) self:SetVar("m_maxStreak",0) self:SetVar("m_misses",0) self:SetVar("m_curStreak",0) --self:SetVar("m_targetsHit",0) --self:SetVar("m_killsSinceLastShot",0) self:SetVar("Current_Super_Charged_Time", 0) self:SetVar("StreakBonus",0) self:SetVar("LastSuperTotal", nil ) self:SetVar("currentReward", -1) self:SetVar("rewards", {-1}) --print('*******************************************') --print('stop super charge from resetVars') toggleSuperCharge(self, false) self:SetVar("ImpactSkillID",g_const.IMPACT_SKILLID) -- reset scores if g_const.NUM_WAVES then for waveNum = 1, tonumber(g_const.NUM_WAVES) do PLAYER_SCORE[waveNum] = 0 end end ActivityTimerStopAllTimers(self) end -------------------------------------------------------------- -- Gets the current activity user or returns nil -------------------------------------------------------------- function getActivityUser(self) local targetID = self:GetActivityUser().userID if (targetID == 0 or targetID == nil) then return nil else return targetID end end -------------------------------------------------------------- -- Called after loading a projectile -------------------------------------------------------------- function onChildLoaded(self, msg) -- if we loaded a projectile, fire it if msg.templateID == g_const.PROJECTILE_TEMPLATEID then local ballObj = msg.childID -- get the skill for the projectile local skill = self:GetVar("ImpactSkillID") -- store who the parent is self:SetVar("parent", msg.childID) -- TODO: this should probably be setting the childs parent to self, fix or remove if (ballObj) and (getActivityUser(self)) and (skill) then -- store values in the projectile ballObj:SetVar("My_Faction", getActivityUser(self):GetFaction().faction) storeObjectByName("Player", getActivityUser(self)) -- set the skill ballObj:SetActiveProjectileSkill{ skillID = skill } -- store the velocity local vec = self:GetVar("initVelVec") -- set projectile params if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then ballObj:SetProjectileParams{initVel = vec, iProjectileType = 1, fLifeTime = 10.0, owner = self} end end end end -------------------------------------------------------------- -- play animations on all actors in the scene, and others -------------------------------------------------------------- function PlaySceneAnimation(self, anim, bPlayCannon, bPlayPlayer) -- play animation on actors local friends = self:GetObjectsInGroup{ group = "cannongroup" }.objects for i = 1, table.maxn (friends) do if friends[i] then friends[i]:PlayAnimation{ animationID = anim, fPriority = 1.07 } end end -- play on cannon if (bPlayCannon == true) then self:PlayAnimation{ animationID = anim, fPriority = 1.07 } end -- play on player if (bPlayPlayer == true) then local player = getObjectByName("activityPlayer") player:PlayAnimation{ animationID = anim, fPriority = 1.07 } end end -------------------------------------------------------------- -- play effects on all effects in the scene -------------------------------------------------------------- function PlaySceneEffect(effectName) -- trigger effects on effect objects for k,v in ipairs(EFFECTS) do local effect = GAMEOBJ:GetObjectByID(v) effect:PlayFXEffect{ effectType = effectName } end end -------------------------------------------------------------- -- Called when the client wants to fire -------------------------------------------------------------- function onShootingGalleryFire(self, msg) -- calculate firing parameters local params = self:CalculateFiringParameters{targetPos = msg.targetPos, bUseHighArc = false} local vec = params.outVelVector if (vec.x ~= 0 and vec.y ~= 0 and vec.z ~= 0) then -- save off the velocity self:SetVar("initVelVec",vec) self:SetVar("m_shotsFired", self:GetVar("m_shotsFired") + 1) local player = getActivityUser(self) self:PlayFXEffect{effectType = "onfire", ignoreID = player} self:PlayFXEffect{effectType = "onfire2", ignoreID = player} player:PlayFXEffect{effectType = "SG-fire", ignoreID = player} -- Tell the zone control we just fired GAMEOBJ:GetZoneControlID():ShootingGalleryFire() end -- play fire animation on actors PlaySceneAnimation(self, "fire", false, false) PlaySceneEffect("fire") end -------------------------------------------------------------- -- Called when getting the cannon's faction -------------------------------------------------------------- function onGetFaction(self, msg) -- return the user's faction if (getActivityUser(self)) then msg.faction = getActivityUser(self):GetFaction().faction return msg end end function toggleSuperCharge(self, enable) local iSkillID = g_const.CANNON_SKILL local iCooldown = g_const.CANNON_REFIRE_RATE local bSetChargedState = false local meItem1 = self:GetInventoryItemInSlot{slot = 0}.itemID local meItem2 = self:GetInventoryItemInSlot{slot = 1}.itemID if enable and self:GetVar("Super_Charge_Active") then return elseif enable and not self:GetVar("Super_Charge_Active") then self:EquipInventory{ itemtoequip = meItem1} self:EquipInventory{ itemtoequip = meItem2} iSkillID = g_const.CANNON_SUPERCHARGE_SKILL iCooldown = 400 bSetChargedState = true --print('enable super charge') else self:UnEquipInventory{ itemtounequip = meItem1} self:UnEquipInventory{ itemtounequip = meItem2} self:SetVar("NumberOfCharges", 0 ) --print('stop super charge') end self:SetShootingGalleryParams{ playerPosOffset = g_const.CANNON_PLAYER_OFFSET, projectileVelocity = g_const.CANNON_VELOCITY, cooldown = iCooldown, muzzlePosOffset = g_const.CANNON_BARREL_OFFSET, minDistance = g_const.CANNON_MIN_DISTANCE, cameraFOV = g_const.CANNON_FOV, bUseLeaderboards = g_const.CANNON_USE_LEADERBOARDS, timeLimit = -1 } self:SetNetworkVar("cbskill", iSkillID) self:SetVar("Super_Charge_Active", bSetChargedState) --print("Charge State = " .. tostring(bSetChargedState)) end function TimerToggle(self, bStart) if bStart then local wave = GAMEOBJ:GetZoneControlID():GetVar("ThisWave") self:SetNetworkVar("count", self:GetVar("TIME_LIMIT")) self:SetVar("Started", true) else -- Stop Timer on Client self:SetNetworkVar("Stop", true) end end function pauseChargeCannon(self) local superChargeTime = math.ceil(ActivityTimerGetRemainingTime(self, "Super_Charge_Timer")) if superChargeTime < 1 and superChargeTime > 0 then superChargeTime = 1 end self:SetVar("Super_Charge_Paused", true) self:SetVar("Current_Super_Charged_Time", superChargeTime) self:SetNetworkVar("charge_counting", math.ceil(superChargeTime)) --print('** Pause Super Charge Timer (time remaining = ' .. superChargeTime .. ') **') ActivityTimerStop(self, "Super_Charge_Timer") end function StartChargedCannon(self, optionalTime) local iTime = optionalTime if not iTime then iTime = g_const.ChargedTime end self:SetVar("Super_Charge_Paused", false) toggleSuperCharge(self, true) ActivityTimerStart(self, "Super_Charge_Timer", 1, iTime) if not self:GetVar("WaveStatus") then pauseChargeCannon(self) end end function intdiv(a,b) return math.floor(a/b) end function getCurrentBonus(self) local streak = self:GetVar("m_curStreak") -- Cap the streak if (streak > 12) then streak = 12 end local res = intdiv(streak, 3) return res end function updateStreak(self) local streakBonus = getCurrentBonus(self) local curStreak = self:GetVar("m_curStreak") local marks = math.mod(curStreak, 3) self:SetNetworkVar("cStreak", curStreak) -- Update the marks if curStreak >= 0 and curStreak < 13 then -- Mark 1 if marks == 1 then self:SetNetworkVar("Mark1", true) elseif marks == 2 then self:SetNetworkVar("Mark2", true) elseif marks == 0 and curStreak > 0 then self:SetVar("StreakBonus", streakBonus) self:SetNetworkVar("ShowStreak", streakBonus + 1) self:SetNetworkVar("Mark3", true) else self:SetVar("StreakBonus", streakBonus) self:SetNetworkVar("UnMarkAll", true) end end end -- activity timers ii ---------------------------------------------------------------- -- When ActivityTimerUpdate is sent, basically when a timer hits it updateInterval. ---------------------------------------------------------------- function onActivityTimerUpdate(self, msg) --print('** ActivityTimerUpdate: ' .. msg.name) if msg.name == "Super_Charge_Timer" and not self:GetVar("Super_Charge_Paused") then --print('update super charge timer to: ' .. msg.timeRemaining) self:SetNetworkVar("charge_counting", msg.timeRemaining) end end ---------------------------------------------------------------- -- When ActivityTimerDone is sent, basically when the activity timer has reached it's duration. ---------------------------------------------------------------- function onActivityTimerDone(self, msg) --print('** ActivityTimerDone: ' .. msg.name) if msg.name == "Super_Charge_Timer" and not self:GetVar("Super_Charge_Paused") then if self:GetVar("WaveStatus") or self:GetVar("Current_Super_Charged_Time") < 1 then --print('super charge timer finished') self:SetNetworkVar("charge_counting", 999) self:SetNetworkVar("SuperChargeBar", 0) toggleSuperCharge(self, false) end elseif (string.starts(msg.name,"SpawnWave")) then -- parse the name to get out the wave number if (LOCALS["GameStarted"] == true) then local waveNum = LOCALS["ThisWave"] local player = getObjectByName("activityPlayer") -- store this wave number self:SetVar("WaveStatus", true) self:SetVar("ThisWave", waveNum) if waveNum ~= 1 and self:GetVar("Super_Charge_Paused") then --print('****') --print('start super charge from SpawnWave Current time: ' .. self:GetVar("Current_Super_Charged_Time")) StartChargedCannon(self, self:GetVar("Current_Super_Charged_Time")) self:SetVar("Current_Super_Charged_Time", 0) end TimerToggle(self, true) -- setup spawns for wave for k,v in pairs(spawns[tonumber(waveNum)]) do SpawnObject(k,v,self,true) end -- there are no more waves left so stop game after this wave if (tonumber(waveNum) >= g_const.NUM_WAVES) then ActivityTimerStart(self, "GameOver", self:GetVar("TIME_LIMIT"), self:GetVar("TIME_LIMIT")) else -- setup next wave ActivityTimerStart(self, "EndWave" .. waveNum, self:GetVar("TIME_LIMIT"), self:GetVar("TIME_LIMIT")) end if player then self:StartActivityTime{ rerouteID = player, startTime = self:GetVar("TIME_LIMIT") } self:ActivityPause{ rerouteID = player, bPause = false } end end elseif (string.starts(msg.name,"EndWave")) then -- called when a wave ends, contains the number of the next wave if (LOCALS["GameStarted"] == true) then self:SetVar("WaveStatus", false) -- get rid of current spawns TimerToggle(self) -- record the score RecordPlayerWaveScore(self) -- get the wave number from the rest of the string local waveNum = string.sub(msg.name,8) -- store the next wave number waveNum = tonumber(waveNum) + 1 LOCALS["ThisWave"] = waveNum -- Do whatever we need to during the pause, wave begins after pause -- play wave animation on actors, cannon, and player PlaySceneAnimation(self, "wave" .. LOCALS["ThisWave"], true, true) -- display wave number to player DisplayWaveNumberToPlayer(self, waveNum) -- there are no more waves left so stop game after this wave if (waveNum > g_const.NUM_WAVES) then -- Game Over ActivityTimerStart(self, "GameOver", 0.1, 0.1) else -- setup next wave ActivityTimerStart(self, "SpawnWave" .. waveNum, g_const.IN_BETWEEN_WAVE_PAUSE, g_const.IN_BETWEEN_WAVE_PAUSE) end local player = getObjectByName("activityPlayer") if player then self:ActivityPause{rerouteID = player, bPause = true} end if self:GetVar("Super_Charge_Active") and not self:GetVar("Super_Charge_Paused") then pauseChargeCannon(self) end end elseif (msg.name == "GameOver") then -- Send buffer timer here local player = getObjectByName("activityPlayer") local cannonballs = self:GetObjectsInGroup{ group = "cannonball" }.objects self:ActivityPause{ rerouteID = player, bPause = true } if #cannonballs >= 1 then --print('start endGameBuffer') ActivityTimerStart(self, "endGameBuffer", 1, #cannonballs) else --print('stopGame now') RecordPlayerWaveScore(self) stopGame(self, false) end TimerToggle(self) elseif (string.starts(msg.name,"DoSpawn")) then if (LOCALS["GameStarted"] == true) then -- get the spawn number from the rest of the string local spawnNum = string.sub(msg.name,8) -- get the template out of the spawn data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] local templateID = SpawnData.sdTemplate -- get the position of the first waypoint local startPos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) local config = {{"spawndata", SpawnData},{"streakmod", g_const.STREAK_MOD}, {"streakbonus", self:GetVar("STREAK_BONUS")}, {"wave", LOCALS["ThisWave"]}, {"custom_script_server", "scripts/ai/ACT/SG_TARGET.lua" }, {"custom_script_client", "scripts/client/ai/SG_TARGET_CLIENT.lua" }} -- load the object in the world RESMGR:LoadObject { objectTemplate = templateID, bIsSmashable = true, x = startPos.x, y = startPos.y, z = startPos.z, owner = self, configData = config} end elseif msg.name == "endGameBuffer" then RecordPlayerWaveScore(self) stopGame(self, false) end end function onActivityNotify(self,msg) local tKills = self:GetVar("CannonBallKills") or {} -- Don't count any of this if we're firing our super charged cannon ball if msg.notification["shot_done"] then if #tKills < 1 and msg.notification["shot_done"] ~= g_const.CANNON_SUPER_CHARGE then self:SetVar("m_curStreak", 0) -- This account for real misses self:SetVar("m_misses", self:GetVar("m_misses") + 1) self:SetNetworkVar("HideStreak", true) self:SetNetworkVar("UnMarkAll", true) elseif #tKills > 0 then -- registerHit for all of the kills since last shot for k,v in ipairs(tKills) do registerHit(self, GAMEOBJ:GetObjectByID(v), msg.notification["shot_done"]) end if #tKills > 1 then self:SetNetworkVar("mHit", true) end end if msg.notification["shot_done"] ~= g_const.CANNON_SUPER_CHARGE then updateStreak(self) end self:SetVar("CannonBallKills", {}) end end function registerHit(self, target, shotType) local points = target:GetActivityPoints{}.points -- Only apply bonus to positive things and don't do streak etc for negative if points >= 0 then points = points + (points * getCurrentBonus(self)) if shotType ~= g_const.CANNON_SUPER_CHARGE then self:SetVar("m_curStreak", self:GetVar("m_curStreak") + 1) if (self:GetVar("m_curStreak") > self:GetVar("m_maxStreak")) then self:SetVar("m_maxStreak", self:GetVar("m_curStreak")) end end else if shotType ~= g_const.CANNON_SUPER_CHARGE then self:SetVar("m_curStreak", 0) -- This accounts for friendlies self:SetVar("m_misses", self:GetVar("m_misses") + 1) end self:SetNetworkVar("hitFriend", true) end self:NotifyClientShootingGalleryScore{rerouteID = getActivityUser(self), target = target, targetPos = target:GetPosition().pos, score=points} m_totalScore = m_totalScore + points self:SetNetworkVar("updateScore", tonumber(m_totalScore)) local lastSuperTotal = self:GetVar("LastSuperTotal") or 0 scScore = m_totalScore - lastSuperTotal if shotType ~= g_const.CANNON_SUPER_CHARGE and scScore >= g_const.ChargedPoints and points >= 0 then StartChargedCannon(self) self:SetNetworkVar("SuperChargeBar", 100) self:SetVar("LastSuperTotal", m_totalScore) end local rewardS = 0 local rewardF = 0 if self:GetVar("Matrix") <= 5 then local scoreRewardNum = "Score_Reward_"..self:GetVar("Matrix") local RewardAmount = g_const[scoreRewardNum] / 100 * 3 rewardS = (m_totalScore / RewardAmount) rewardF = round((rewardS * 3),0) if rewardF > 100 then rewardF = 100 end self:SetNetworkVar("modelPercent", rewardF) end if rewardF > 0 and rewardF < 200 and self:GetVar("Matrix") <= 5 then local obj = self:GetObjectsInGroup{ignoreSpawners=true,group = g_const.Reward_Model_GrpName }.objects --RWS -- check to make sure obj[1] is not nil, mrb... if obj[1] then obj[1]:SpawnModelBricks{amount=(rewardF/100),pos=target:GetPosition().pos} if rewardF >= 100 then --print('giving new model score is: ' .. m_totalScore) spawnNewModel(self) self:SetVar("Matrix" , self:GetVar("Matrix") + 1 ) end end end self:SetNetworkVar("beatHighScore", tostring(m_totalScore)) checkSpawn(self, target) end function onUpdateMissionTask(self, msg) -- We get these forwarded to us by the cannon ball if msg.taskType == "kill" then local tKills = self:GetVar("CannonBallKills") or {} table.insert(tKills, "|" .. msg.target:GetID()) self:SetVar("CannonBallKills", tKills) getActivityUser(self):UpdateMissionTask{target = msg.target, value = msg.value, value2 = msg.value2, taskType = msg.taskType} end end -------------------------------------------------------------- -- put the player in the cannon, does not start the cannon -------------------------------------------------------------- function onRequestActivityEnter(self, msg) storeObjectByName("activityPlayer", msg.userID) self:SetNetworkVar("HideScoreBoard", true) self:SetNetworkVar("ReSetSuperCharge", true) self:SetNetworkVar("showLoadingUI", true) -- Preloading reload animations -- Cannonballs, plunger, and pirate local sceneactors = self:GetObjectsInGroup{ group = "cannongroup" }.objects for i = 1, table.maxn (sceneactors) do if sceneactors[i] then sceneactors[i]:PreloadAnimation{animationID = "wave1", respondObjID = self} end end msg.userID:PreloadAnimation{animationID = "wave1", respondObjID = self} self:PreloadAnimation{animationID = "wave1", respondObjID = self} end --------------------------------------- from zone function spawnNewModel(self) if self:GetVar("currentReward") ~= -1 then local rewards = self:GetVar("rewards") if rewards and rewards[1] ~= -1 then table.insert(rewards, self:GetVar("currentReward")) else rewards = {self:GetVar("currentReward")} end self:SetVar("rewards",rewards) self:SetNetworkVar("rewardAdded", self:GetVar("currentReward")) end local obj = self:GetObjectsInGroup{ignoreSpawners=true,group= g_const.Reward_Model_GrpName}.objects if(#obj > 0) then for index, rewardObj in pairs(obj) do local items = GAMEOBJ:RollLoot(g_const["Score_LootMatrix_"..self:GetVar("Matrix")], getObjectByName("activityPlayer")) for LOT,count in pairs(items) do rewardObj:SetModelToBuild{templateID=LOT} self:SetVar("currentReward", LOT) end end end end -------------------------------------------------------------- -- try to start the game -------------------------------------------------------------- function startGame(self) -- clear score self:SetNetworkVar("game_timelimit", self:GetVar("TIME_LIMIT")) self:SetNetworkVar("Audio_Start_Intro", true) self:SetVar("currentReward", -1) local obj = self:GetObjectsInGroup{ignoreSpawners=true,group= g_const.Reward_Model_GrpName}.objects for i, j in pairs(obj) do j:SetModelToBuild{templateID=-1} end local idString = self:GetID() -- get the player local player = getObjectByName("activityPlayer") if player then -- Telkl the client to get the initial data for showing the top score local targetID = self:GetActivityUser().userID targetID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = self:GetActivityID().activityID } -- put the player in if we have to, otherwise start if ((self:GetActivityUser().userID):GetID() == player:GetID()) then --print("starting game") self:ActivityStart{ rerouteID = player } end self:SetNetworkVar("Clear", true) DoGameStartup(self) end spawnNewModel(self) end -------------------------------------------------------------- -- try to stop the game -------------------------------------------------------------- function stopGame(self, bCanceling) self:SetNetworkVar("ReSetSuperCharge", true) self:SetNetworkVar("HideSuper", true) --print("STOPING GAME ******************************************") -- get the player local player = getObjectByName("activityPlayer") -- if we have both stop it if we need to, but dont exit if player then -- Now retrieve everything form the cannon. We have the score here so we do the rest here too local streak = self:GetVar("m_maxStreak") local misses = self:GetVar("m_misses") local fired = self:GetVar("m_shotsFired") self:SetActivityUserData{ userID = player, typeIndex = 0, value = m_totalScore } self:SetActivityUserData{ userID = player, typeIndex = 1, value = streak } --print('stop super charge from stopGame()') toggleSuperCharge(self, false) local percentage = 0 if (fired > 0) then percentage = (fired-misses) / fired end self:SetActivityUserData{ userID = player, typeIndex = 2, value = percentage } -- Tell the leaderboard to store everything self:UpdateActivityLeaderboard{ userID = player } self:ActivityStop{rerouteID = player, bExit = false, bUserCanceled = bCanceling} DoGameShutdown(self) self:SetVar("Mym_totalScore", m_totalScore) m_totalScore= 0 LOCALS["GameStarted"] = false -- if we are not exiting, show the summary and allow for retry if (bCanceling == false) then showSummaryDialog(self, fired, fired-misses, streak) end awardModels(self:GetVar("rewards"), player) resetVars(self) end end function awardModels(rewards, player) if not rewards then return end for index, reward in pairs(rewards) do if reward ~= -1 then player:AddItemToInventory{iObjTemplate = reward, invType = 5 --[[5 is INVENTORY_MODEL--]] } end end end -------------------------------------------------------------- -- sends a message to display the current wave text to player -------------------------------------------------------------- function DisplayWaveNumberToPlayer(self, waveNum) local player = getObjectByName("activityPlayer") if (player) then self:SetNetworkVar("wave", {waveNum = waveNum, waveStr = self:GetVar("TIME_LIMIT")}) end end -------------------------------------------------------------- -- show the summary dialog -------------------------------------------------------------- function showSummaryDialog(self, shots, kills, streak) -- get player local player = getObjectByName("activityPlayer") if player then -- do summary dialog -- Wave Score local score = m_totalScore local r = self:GetActivityReward{ playerID = player} local rstring = (r.rewardMoney..","..r.rewardItem1Name..","..r.rewardItem1Image..","..r.rewardItem1StackSize..","..r.rewardItem2Name..","..r.rewardItem2Image..","..r.rewardItem2StackSize) local rscore = ( self:GetVar("Mym_totalScore").."_"..PLAYER_SCORE[1].."_"..PLAYER_SCORE[2].."_"..PLAYER_SCORE[3].."_"..shots.."_"..kills.."_"..streak ) -- Send the activity ID down to the client self:SetNetworkVar("UI_Rewards", tostring(rscore)) --self:GetActivityID().activityID) self:SetNetworkVar("Audio_Final_Wave_Done", true) local targetID = self:GetActivityUser().userID targetID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = self:GetActivityID().activityID } end end function RecordPlayerWaveScore(self) -- get wave number local waveNum = tonumber(LOCALS["ThisWave"]) if (waveNum > 0) then -- get total current score local score = m_totalScore -- to get the wave score we must subtract prior waves from it for waves = 1, waveNum - 1 do score = score - PLAYER_SCORE[waves] end -- store the new score PLAYER_SCORE[waveNum] = score --print("*************** SCORE? "..PLAYER_SCORE[waveNum]) end end -------------------------------------------------------------- -- Sent from the cannon to get a score for the player -------------------------------------------------------------- function onDoCalculateActivityRating(self, msg) -- also return the score as the result for the activity msg.outActivityRating = m_totalScore return msg end function checkSpawn(self, target) local waveNum = tonumber(LOCALS["ThisWave"]) if (LOCALS["GameStarted"] == true) and (waveNum) and (waveNum > 0) then local spawnData = target:GetVar("SpawnData") -- spawn the right object if (spawnData) and (spawnData.sdRespawn == true) and (target:GetVar("wave") == LOCALS["ThisWave"]) then spawns[waveNum][spawnData.sdnum].sdLastPath = spawnData.sdPath SpawnObject(spawnData.sdnum,spawns[waveNum][spawnData.sdnum],self,false) end end end function RemovePlayerFromZone(self, player) if not player then return end player:TransferToLastNonInstance{ playerID = player, bUseLastPosition = true } end -------------------------------------------------------------- -- User is exiting via cancel -------------------------------------------------------------- function onRequestActivityExit(self, msg) if (msg.bUserCancel == true) then stopGame(self,msg.bUserCancel) RemovePlayerFromZone(self, msg.userID) self:SetNetworkVar("showLoadingUI", true) resetVars(self) end end -------------------------------------------------------------- -- handle all the game startup data -------------------------------------------------------------- function DoGameStartup(self) -- set game state and vars resetVars(self) LOCALS["GameStarted"] = true self:SetNetworkVar("Clear", true) -- start the first wave LOCALS["ThisWave"] = 1 if g_const.FIRST_WAVE_START_TIME < 1 then g_const.FIRST_WAVE_START_TIME = 1 end ActivityTimerStart(self, "SpawnWave1", g_const.FIRST_WAVE_START_TIME, g_const.FIRST_WAVE_START_TIME) end ----------------------------------------------------------------- -- Target Spawning logic ----------------------------------------------------------------- -------------------------------------------------------------- -- Called when a Child is loaded -------------------------------------------------------------- function onChildLoaded(self, msg) -- look through spawn data to find the most recent data -- that matches the template local SpawnData = GetLatestSpawnDataByTemplate(self,msg.templateID) if (SpawnData) then local curSpawnNum = IncrementVarAndReturn("CurSpawnNum") -- store spawn for use later storeObjectByName("spawnObject" .. curSpawnNum, msg.childID) -- store who the parent is storeParent(self, msg.childID) -- store the spawn data in the child (@TODO: Need to Optimize) msg.childID:SetVar("SpawnData", SpawnData) if (SpawnData.sdMovingPlat == true) then msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } msg.childID:SetCurrentPath{ pathName = SpawnData.sdPath, startPoint = 0 } else -- assign child's waypoint msg.childID:SetVar("attached_path",SpawnData.sdPath) msg.childID:SetVar("attached_path_start",0) local startpos = GAMEOBJ:GetWaypointPos( SpawnData.sdPath, 1 ) msg.childID:SetPosition{pos = startpos} -- start child on path msg.childID:FollowWaypoints() msg.childID:SetPathingSpeed{ speed = SpawnData.sdSpeed } end end end -------------------------------------------------------------- -- return if template is a valid actor -------------------------------------------------------------- function IsValidActor(templateID) for k,v in ipairs(self:GetVar("VALID_ACTORS")) do if templateID == v then return true end end return false end -------------------------------------------------------------- -- return if template is a valid effect -------------------------------------------------------------- function IsValidEffect(templateID) for k,v in ipairs(self:GetVar("VALID_EFFECTS")) do if templateID == v then return true end end return false end -------------------------------------------------------------- -- handle all the game shutdown data -------------------------------------------------------------- function DoGameShutdown(self) ----print("DoGameShutdown GAME ******************************************") LOCALS["GameStarted"] = false -- cancel all timers ActivityTimerStopAllTimers(self) -- despawn all spawns DestroyAllSpawns(self) end -------------------------------------------------------------- -- Get a random path -------------------------------------------------------------- function GetRandomPath(self, spawn, lastPath) -- pick a random local newPath = lastPath local lastRandomPath = self:GetVar("lastRandomPath") or "" if not lastPath then lastPath = "" end if #spawn.path > 1 then local newPathTable = {} for k,v in ipairs(spawn.path) do -- if we find the lastPath or lastRandomPath then remove it from the temp table if v ~= lastPath or v ~= lastRandomPath then table.insert(newPathTable, v) end end -- if we still have paths to pick from then get a random path if newPathTable then --print('** multi Path ' .. #newPathTable ) newPath = spawn.path[math.random(1,#newPathTable)] else -- otherwise use the first path newPath = false end else --print('** one Path') if spawn.path[1] == lastRandomPath then newPath = false else newPath = spawn.path[1] end end --print('spawn: ' .. spawn.id .. ' @ ' .. tostring(newPath) .. ' : lastPath = ' .. lastPath)-- .. ' : lastRandPath = ' .. lastRandomPath) self:SetVar("lastRandomPath", newPath) return newPath end -------------------------------------------------------------- -- spawn an object for the game -------------------------------------------------------------- function SpawnObject(num, spawn, self, bSpawnNow) -- get the current spawn number local spawnNum = IncrementVarAndReturn("SpawnNum") local newPath = GetRandomPath(self, spawn, spawn.sdLastPath) if not newPath then spawn.bRespawn = false end -- save the spawn data for the object when it is loaded local SpawnData = { sdTemplate = spawn.id, sdRespawn = spawn.bRespawn, sdSpeed = spawn.speed, sdScore = spawn.score, sdPath = newPath, sdnum = num, sdChangeSpeed = spawn.bChangeSpeed, sdSpeedChance = spawn.speedChangeChance, sdMinSpeed = spawn.minSpeed, sdMaxSpeed = spawn.maxSpeed, sdMovingPlat = spawn.bMovingPlatform, sdDespawnTime = spawn.despawnTime, sdTimeScore = spawn.timeScore, bSpawned = false} -- store the data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- set the timer to spawn the object local timerName = "DoSpawn" .. spawnNum -- spawn now and use initial spawn times if (bSpawnNow == true) then if (spawn.initSpawnTimeMin > 0 and spawn.initSpawnTimeMax > 0) then local ranSpawnTime = (math.random() * (spawn.initSpawnTimeMax - spawn.initSpawnTimeMin)) + spawn.initSpawnTimeMin --print ("init spawning with time " .. ranSpawnTime) if ranSpawnTime < 1 then ranSpawnTime = 1 end ActivityTimerStart(self, timerName, ranSpawnTime, ranSpawnTime) else ActivityTimerStart(self, timerName, 1, 1) end elseif (spawn.bRespawn == true) then -- respawn, use respawn times -- pick a random spawn time local ranSpawnTime = (math.random() * (spawn.maxTime - spawn.minTime)) + spawn.minTime if ranSpawnTime < 1 then ranSpawnTime = 1 end ActivityTimerStart(self, timerName, ranSpawnTime, ranSpawnTime) end end -------------------------------------------------------------- -- destroys all spawns -------------------------------------------------------------- function DestroyAllSpawns(self) local maxSpawnNum = LOCALS["CurSpawnNum"] for spawn = 1, maxSpawnNum do local spawnObject = getObjectByName("spawnObject" .. spawn) if (spawnObject) then if (spawnObject:Exists() and not spawnObject:IsDead().bDead) then --print("removing spawn object " .. spawn) spawnObject:Die{killerID = spawnObject, killType = "SILENT"} end end end -- reset vars LOCALS["SpawnNum"] = 0 LOCALS["CurSpawnNum"] = 0 end -------------------------------------------------------------- -- look through spawn data to find the most recent data -- that matches the template, returns nil or data -------------------------------------------------------------- function GetLatestSpawnDataByTemplate(self,templateID) local spawnNum = LOCALS["SpawnNum"] while (spawnNum > 0) do -- get the data local SpawnData = SPAWN_DATA[tonumber(spawnNum)] -- check spawn flag and template if (SpawnData.bSpawned == false and templateID == SpawnData.sdTemplate) then -- set spawned flag SpawnData.bSpawned = true -- re-save data SPAWN_DATA[tonumber(spawnNum)] = SpawnData -- return the good data return SpawnData end -- try prev spawn data spawnNum = spawnNum - 1 end return nil end -------------------------------------------------------------- -- Sent from an object after loading into zone -------------------------------------------------------------- -------------------------------------------------------------- -- Sent from a player when responding from a messagebox -------------------------------------------------------------- function notifyMessageBoxRespond(self, other, msg) if other:GetID() ~= GAMEOBJ:GetZoneControlID():GetID() then return end --print(msg.identifier .. " - " .. msg.iButton) -- make sure this is the right player local player = getObjectByName("activityPlayer") if not player then return end if (player:GetID() == msg.sender:GetID()) then if msg.identifier == "Scoreboardinfo" then strText = "Retry?" -- show the summary message box player:DisplayMessageBox{bShow = true, imageID = 2, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Retry"} else -- User wants to retry or is closing the big help to start the game if ((msg.iButton == 1 and (msg.identifier == "Shooting_Gallery_Retry" or msg.identifier == "RePlay")) or (msg.identifier == "SG1") or (msg.iButton == 0 and msg.identifier == "Shooting_Gallery_Exit_Leaderboard")) then self:SetNetworkVar("Clear", true) startGame(self) elseif (msg.iButton == 0 and (msg.identifier == "Shooting_Gallery_Retry" or msg.identifier == "RePlay")) then -- User wants to quit -- called before we leave the cannon, so we can trigger a loading screen -- as soon as possible. Should still remove player from cannon on server self:RequestActivityExit{userID = player, bUserCancel = false} RemovePlayerFromZone(self, player) elseif msg.iButton == 1 and (msg.identifier == "Shooting_Gallery_Exit" or msg.identifier == "Shooting_Gallery_Exit_Leaderboard") then RemovePlayerFromZone(self, player) self:RequestActivityExit{userID = player, bUserCancel = true} elseif msg.iButton == 1 and msg.identifier == "Exit" then local player = getObjectByName("activityPlayer") strText = "Exit?" -- show the summary message box player:DisplayMessageBox{ bShow = true, imageID = 1, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Exit_Leaderboard"} end end end end function notifyObjectLoaded(self, other, msg) if other:GetID() ~= GAMEOBJ:GetZoneControlID():GetID() then return end if ( IsValidActor(msg.templateID) == true ) then -- store the actor local nextActor = #ACTORS + 1 ACTORS[nextActor] = msg.objectID:GetID() elseif ( IsValidEffect(msg.templateID) == true ) then -- check for effects -- store the actor local nextEffect = #EFFECTS + 1 EFFECTS[nextEffect] = msg.objectID:GetID() end end function onNotifyObject(self, msg) if (msg.name == "FinishedPath") then checkSpawn(self, msg.ObjIDSender) end end function notifyActivityStateChangeRequest(self,other,msg) if other:GetID() ~= GAMEOBJ:GetZoneControlID():GetID() then return end if (msg.iNumValue1 == 1000) then -- retry startGame(self) elseif (msg.iNumValue1 == 7777) then -- qurriey local targetID = self:GetActivityUser().userID targetID:RequestActivitySummaryLeaderboardData{target = self, queryType = 1, gameID = self:GetActivityID().activityID } elseif (msg.iNumValue1 == 2000) then -- exit local player = getObjectByName("activityPlayer") strText = "Exit?" -- show the summary message box player:DisplayMessageBox{ bShow = true, imageID = 1, callbackClient = GAMEOBJ:GetZoneControlID(), text = strText, identifier = "Shooting_Gallery_Exit"} elseif (msg.iNumValue1 == 1200) then -- play startGame(self) end end --------------------------------------------------------------- --left console to be rebuilt to cause the blue brick to become available --------------------------------------------------------------- function onStartup(self) self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) end function onRebuildNotifyState(self, msg) if msg.iState == 2 then --print("console built") self:SetVar("IAmBuilt", true) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console built, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleLeftUp", ObjIDSender = self} end elseif msg.iState == 4 then self:SetVar("IAmBuilt", false) self:SetVar("AmActive", false) local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console destroyed, notifying object") --object:PlayFXEffect{name = "imaginationbase", effectID = 114, effectType = "onrebuild"} object:NotifyObject{name = "ConsoleLeftDown", ObjIDSender = self} end end end function onUse(self, msg) --print("console being used") if self:GetVar("AmActive") == true then return end if self:GetVar("IAmBuilt") == true then self:SetVar("AmActive", true) --print("the console has been activated") local object = self:GetObjectsInGroup{group = "Facility", ignoreSpawners = true}.objects[1] if object then --print("console activated") object:NotifyObject{name = "ConsoleLeftActive", ObjIDSender = self} end end msg.user:TerminateInteraction{type = "fromInteraction", ObjIDTerminator = self} end function onRebuildNotifyState(self, msg) local Ape = self:GetParentObj().objIDParent if( Ape == nil or Ape:Exists() == false ) then return end -- a player just did the quickbuild. if (msg.iState == 2) then -- Notify the APE that the build is done and using the player as the sender so we can update missions. Ape:NotifyObject{ ObjIDSender = msg.player, name = "rebuildDone" } self:SetVar("AnchorBreakTime", 1) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("AnchorBreakTime") , "AnchorBreakTime", self ) self:PlayAnimation{animationID = "smash",fPriority = 1.7} end if (msg.iState == 6) then --Ape:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } self:RequestDie{} end end function onDie(self, msg) local Ape = self:GetParentObj().objIDParent if( Ape == nil or Ape:Exists() == false ) then return end Ape:NotifyObject{ ObjIDSender = self, name = "rebuildCancel" } end function onTimerDone(self, msg) if msg.name == "AnchorBreakTime" then self:RequestDie{} end end require('EquipmentScripts/SpawnPowerupsOnTimerThenDie') function onStartup(self) self:SetVar( "numCycles", 8) self:SetVar( "secPerCycle", 25) self:SetVar( "delayToFirstCycle", 1.5) self:SetVar( "deathDelay", 25) self:SetVar( "numberOfPowerups", 4) self:SetVar( "LootLOT" , 6431) onTemplateStartup(self) end function onFactionTriggerItemEquipped (self) self:AddStatTrigger(self:GetVar("trigger")) end function onStatEventTriggered(self, msg) if msg.Parent:Exists{} then -- the value of the stat local statValue = msg.StatValue -- Fire the toughness skill if statValue ~= msg.OldValue then --IsItemInSet will give us a list of all the sets an item is in local setInfo = msg.Parent:IsItemInSet{setItem = self} if setInfo.setIDs then if self:GetVar("isFactionSkill") == true and self:GetVar("factionSkillReady") == true then checkSetAndCast(self, setInfo.setIDs, msg.Parent) GAMEOBJ:GetTimer():AddTimerWithCancel( self:GetVar("factionCooldownTime") , "skillCooldown", self ) self:SetVar("factionSkillReady", false) elseif not self:GetVar("isFactionSkill") then checkSetAndCast(self, setInfo.setIDs, msg.Parent) end end end end end function checkSetAndCast(self, set, itemParent) for index, skillSetID in ipairs(set) do --verify that we're firing from the right set if skillSetID == self:GetVar("skillSet") then --fetch all the currently equipped items from our set. local equippedItems = itemParent:GetEquippedItemsInSet{setID = skillSetID} if self:GetVar("itemsRequired") <= #equippedItems.setItems then --if we are the first item in the list we're going to cast the skill. --All the items in the set will get this far, but only one of them will have to --actually fire the skill local selfID = self:GetID() local equipSet = equippedItems.setItems local items1 = equipSet[1] local itemsID = items1:GetID() if selfID == itemsID then itemParent:CastSkill{ skillID = self:GetVar("skillID") } return end end end end end function onTimerDone(self, msg) if msg.name == "skillCooldown" then self:SetVar("factionSkillReady", true) end end-------------------------------------------------------------- -- Server side script for the GF Organ next to Captin Jack -- -- updated mrb... 9/24/10 -- updated audio and fixed interaction -------------------------------------------------------------- function onCheckUseRequirements(self, msg) if self:GetNetworkVar('bIsInUse') then msg.bCanUse = false return msg end end function onUse(self,msg) -- play nd audio self:PlayNDAudioEmitter{m_NDAudioEventGUID = "{15d5f8bd-139a-4c31-8904-970c480cd70f}" } -- old {500434f3-3e21-48f6-87d7-928487ff280e} self:SetNetworkVar('bIsInUse', true) GAMEOBJ:GetTimer():AddTimerWithCancel( 5 , "reset", self ) msg.user:PlayAnimation{ animationID = "jig", bPlayImmediate = true } end function onTimerDone(self, msg) if msg.name == "reset" then self:SetNetworkVar('bIsInUse', false) end end -------------------------------------------------------------- -- Client side script on the lion pet -- this script controls the icon and interactablity of the lion -- only the player who spawned the lion show see the interact icon above the lion and be able to tame it -- created by Brandi... 2/17/10 -------------------------------------------------------------- function onGetPriorityPickListType(self, msg) -- if the pet is someones tamed pet, ignore the rest of the script if self:IsPetWild{}.bIsPetWild == false then return end local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:Exists() then msg.fCurrentPickTypePriority = myPriority -- if the player is the player who spawned the pet, then set the lion to be interactable to that player --print("on lion player is "..tostring(player:GetID())) --print("on lion tamer is "..tostring(self:GetVar("liontamer"))) if self:GetVar("localCrabTamer") == player:GetID() then msg.ePickType = 14 -- Interactive pick type end else --if the player is not the player who spawned the lion, the player can't interact with the lion msg.ePickType = -1 end end return msg end -- i have to do the back and forth with FireEventServerSide and FireEventClientSide because SetNetworkVar doesn't serialize properly function onStartup(self,msg) -- doing this because SetNetworkVar is busted and unserialized if self:IsPetWild{}.bIsPetWild == false then return end end function onScriptNetworkVarUpdate(self,msg) local crabtamer = msg.tableOfVars["crabtamer"] if crabtamer then local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if player:GetID() == crabtamer then self:SetVar("localCrabTamer",player:GetID()) self:RequestPickTypeUpdate() end end end -------------------------------------------------------------- -- client script on the consoles that are built for the blue brick puzzle in FV -- -- created Brandi... 8/25/10 -------------------------------------------------------------- -------------------------------------------------------------- -- server script sends a message to this script -------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) for k,v in pairs(msg.tableOfVars) do if k == "used" then self:RequestPickTypeUpdate() end end end function onGetPriorityPickListType(self, msg) local myPriority = 0.8 if ( myPriority > msg.fCurrentPickTypePriority ) then msg.fCurrentPickTypePriority = myPriority -- the player used the console, set it so the player cant use it again if self:GetNetworkVar("used") then msg.ePickType = -1 else msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 98 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } local GUIDPeaceful3D = {} GUIDPeaceful3D["Audio-Birds"] = "{4cb54b8f-ec5d-4298-aa40-b190859ec59f}" GUIDPeaceful3D["Audio-Birds2"] = "{55bed0ad-92f9-4b5f-adf7-2dd0af22f954}" GUIDPeaceful3D["Audio-Wind"] = "{4d877735-1e91-4035-a764-d93f763c9a9f}" GUIDPeaceful3D["Audio-Waterfall"] = "{b5b79e35-9272-41e7-b65d-d6c686541fa9}" GUIDPeaceful3D["2D Ambience"] = "{ddb9f210-6e12-4e8b-b75d-6dce373a6d57}" ---------------------------------------------------------------- -- Statrup, Sets up us some variables ---------------------------------------------------------------- function onStartup(self) self:SetVar("GUIDPeaceful3D", GUIDPeaceful3D) end ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 3200.0, 3200.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/PP_PlayerProperty/S_Small/env_sky_gf_smallProperty.nif") LEVEL:SetLights( true, 0xD4FFFC, --ambient color false, 0xFFFFFF, --directional colorZ:\LWO\4_game\client\res\macros\gfstart.scm false, 0xFFFFFF, --specular color true, 0xFFFFFF, --upper Hemi color true, { -1.00, 0.0, 0.0 }, --directional direction true, 0xC9E0E1, --fog color true, --modifying draw distances (all of them) 200.0, 200.0, --fog near min/max 200.0, 400.0, --fog far min/max 0.0, 80.0, --post fog solid min/max 350.0, 350.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/env_sky_won_ag_property.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end function onStartup(self) self:SetVar("bIsDead", false) end function onCollisionPhantom(self, msg) if ( self:GetVar("bIsDead") == true ) then return end --print("onCollision") local target = msg.objectID local controlledObject = GAMEOBJ:GetControlledID() if ( target:GetID() == controlledObject:GetID() ) then --print ("controlled object") controlledObject:PlayFXEffect{effectID = 1159, effectType = "pickup"} --target:PlayFXEffect{name = "bouncer", effectID = 194, effectType = "onbounce"} target:PlayFXEffect{name = "energy_orb", effectID = 1007, effectType = "cast"} -- assume they will soon collect and delete this object on the server, but just -- in case they don't, we need to turn visibility back on after a couple seconds self:SetVisible{visible = false, fadeTime = 0} GAMEOBJ:GetTimer():AddTimerWithCancel( 2.0 , "visible", self ) self:SetVar("bIsDead", true) --print ("down by notify") target:VehicleNotifyHitImagination{ pickupID = self } --print ("past notify") end end function onTimerDone(self, msg) --print("timer done, going visible again") if msg.name == "visible" then self:SetVisible{visible = true, fadeTime = 0} self:SetVar("bIsDead", false) end end---------------------------------------------------------------- -- level specific Server script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB -- updated 6/18/10 added tutorial mission stuff -- updated mrb... 9/7/10 - added brickLinkMissionID ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "ClaimMarker", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "maelstrom", -- the damaging maelstrom cloud FX around the property Enemies = "strombies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXObject", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "StrombieWander","Strombies" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "ClaimMarker", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "MaelstromFX", -- the spawner network for the damaging maelstrom clouds FXSpots = "MaelstromSpots", -- the spawner network for the non-damaging fx spots PropMG = "PropertyGuard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXObject", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "BirdFX","SunBeam" } -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 71, -- when the player builds the claim marker, this flag is set placedModel = 73, -- when a player places a model for the first time, this flag is set guardMission = 891, -- last mission for the guard password = "s3kratK1ttN", -- behavior password build qb object with behaviors generatorID = 10118, --lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 10445, -- lot id of the behavior platform quickbuild brickLinkMissionID = 951 -- Achievement ID to complete on property rental } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) if msg.playerID:GetFlag{iFlagID = 108}.bFlag == false then msg.playerID:SetFlag{iFlagID = 108, bFlag = true} end end ---------------------------------------------------------------- -- called when the player places a model ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) local player = msg.playerID --the player placed their first model, set the flag to true if player:GetFlag{iFlagID = 101}.bFlag == false then baseZonePropertyModelPlaced(self,msg,newMsg) --it turns off the spots and sets a player flag player:SetFlag{iFlagID = 101, bFlag = true} -- if they are one the place 4 models mission, update the tutorial if player:GetMissionState{missionID = 871}.missionState == 2 then self:SetNetworkVar("Tooltip","AnotherModel") end -- the player placed a second model, set the flag elseif player:GetFlag{iFlagID = 102}.bFlag == false then player:SetFlag{iFlagID = 102, bFlag = true} -- if they are one the place 4 models mission, update the tutorial if player:GetMissionState{missionID = 871}.missionState == 2 then self:SetNetworkVar("Tooltip","TwoMoreModels") end -- the player placed a third model, set the flag elseif player:GetFlag{iFlagID = 103}.bFlag == false then player:SetFlag{iFlagID = 103, bFlag = true} -- the player placed a third model, set the flag elseif player:GetFlag{iFlagID = 104}.bFlag == false then --tell the client to close a tooltip, if it isnt open, it shouldnt do anything self:SetNetworkVar("Tooltip","TwoMoreModelsOff") player:SetFlag{iFlagID = 104, bFlag = true} --the player has a tooltip telling them to place a model, which they just placed, so it needs to close it elseif self:GetVar("tutorial") == "placeModel" then self:SetVar("tutorial","TutorialOver") self:SetNetworkVar("Tooltip","PutAway") end end ---------------------------------------------------------------- -- called when the player picks up a model ---------------------------------------------------------------- function onZonePropertyModelPickedUp(self, msg) local player = msg.playerID -- first time the player picked up a model, set their flag if player:GetFlag{iFlagID = 109}.bFlag == false then player:SetFlag{iFlagID = 109, bFlag = true} -- if they are on the mission to pick up a model, update the tutorial if player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","Rotate") end end -- if the player has already picked up a model, is on the mission, but hasnt rotated a model, update the tutorial if player:GetFlag{iFlagID = 110}.bFlag == false and player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","Rotate") -- if the player is on the mission, but has done the other to parts, then just turn the tooltip off elseif player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","PickUpModelOff") end end ---------------------------------------------------------------- -- called when the player removes a model from their property ---------------------------------------------------------------- function onZonePropertyModelRemoved(self, msg) local player = msg.playerID -- if this is the first time they have done it, set a flag if player:GetFlag{iFlagID = 111}.bFlag == false then player:SetFlag{iFlagID = 111, bFlag = true} end end ---------------------------------------------------------------- -- called when the player removes a model from their property while its equipped ---------------------------------------------------------------- function onZonePropertyModelRemovedWhileEquipped(self, msg) local player = msg.playerID -- if this is the first time they have done it, set a flag if player:GetFlag{iFlagID = 111}.bFlag == false then player:SetFlag{iFlagID = 111, bFlag = true} end end ---------------------------------------------------------------- -- called when the player enters property edit mode ---------------------------------------------------------------- function onZonePropertyEditBegin(self, msg) -- tell the client the player entered edit mode self:SetNetworkVar("PlayerAction","Enter") end ---------------------------------------------------------------- -- called when the player equips a model ---------------------------------------------------------------- function onZonePropertyModelEquipped(self,msg) -- tell the client the player equipped a model self:SetNetworkVar("PlayerAction","ModelEquipped") end ---------------------------------------------------------------- -- called when the player rotates a model ---------------------------------------------------------------- function onZonePropertyModelRotated(self,msg) local player = msg.playerID -- if the player hasnt rotated a model before, set a flag if player:GetFlag{iFlagID = 110}.bFlag == false then player:SetFlag{iFlagID = 110, bFlag = true} -- if they are on the mission to rotate a model, update the tutorial if player:GetMissionState{missionID = 891}.missionState == 2 then self:SetNetworkVar("Tooltip","PlaceModel") -- used in pickupmodel to close the tooltip self:SetVar("tutorial","placeModel") end end end ---------------------------------------------------------------- -- called when the player leaves property edit mode ---------------------------------------------------------------- function onZonePropertyEditEnd(self, msg) self:SetNetworkVar("PlayerAction","Exit") end ---------------------------------------------------------------- -- called from the generator object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the orb when something collides with it ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) -- send from the guard when the player accepts the mission to rotate, pick up and put away if msg.name == "LastMissionAccepted" then local player = msg.ObjIDSender --check to see if the player already did all the stuff in the tutorial, then skip it if player:GetMissionState{missionID = 891}.missionState ~= 4 then self:SetNetworkVar("Tooltip","ThinkingHat") end end end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end---------------------------------------------------------------- -- level specific client script for Property Pushback in AG small property -- this script requires a base script -- this script should be in the zone script in the DB ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('client/zone/PROPERTY/L_BASE_PROPERTY_CLIENT') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedPropFlag = 97 -- when the player builds the claimmarker defeating the maelstrom on this property } --GROUPS, set in Happy Flower on objects, make sure these match the server script local Groups = { PlaqueGroup = "PropertyPlaque", Guard = "Guard" } local GUIDPeaceful3D = {} GUIDPeaceful3D["Audio-Birds"] = "{091064d4-a80a-4c39-a63b-9f9f431afe84}" GUIDPeaceful3D["Audio-Birds2"] = "{c677d8ad-48e6-4600-ab9b-ca50615eab35}" GUIDPeaceful3D["Audio-Wind"] = "{f5635d3e-f7a9-4f4f-9cc8-89989d45cb81}" GUIDPeaceful3D["2D Ambience"] = "{45421e6a-0127-4c5c-8979-a2042dbe5b38}" ---------------------------------------------------------------- -- Statrup, Sets up us some variables ---------------------------------------------------------------- function onStartup(self) self:SetVar("GUIDPeaceful3D", GUIDPeaceful3D) end ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- called when the server script sends a message saying if the property is rented or not ---------------------------------------------------------------- function onScriptNetworkVarUpdate(self,msg) setGameVariables(Groups,flags) baseScriptNetworkVarUpdate(self,msg) end ---------------------------------------------------------------- -- called when the server script notifies the client script ---------------------------------------------------------------- function onNotifyClientObject(self,msg,newMsg) baseNotifyClientObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the map is shut down, used to kill the LUT ---------------------------------------------------------------- function onShutdown(self) baseShutdown(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom inhabiting the property ---------------------------------------------------------------- function maelstromSkyOn(self) LEVEL:SetSkyDome("mesh/env/vfx_propertySky_SKYBOX.nif") LEVEL:SetLights( true, 0x3e4191, --ambient color false, 0xd3d1ff, --directional color false, 0xFFFFFF, --specular color/ true, 0xFFF5CA, --upper Hemi color true, { -0.83, 0.53, -0.16 }, --directional direction true, 0x333333, --fog color true, --modifying draw distances (all of them) 0, 0.0, --fog near min/max 150.0, 150.0, --fog far min/max 3200.0, 3200.0, --post fog solid min/max 100.0, 100.0, --post fog fade min/max 8000.0, 8000.0, --static object cutoff min/max 8000.0, 8000.0, --dynamic object cutoff min/max true, "mesh/env/vfx_propertySky_SKYBOX.nif", 1.0 -- blend time ) LEVEL:CLUTEffect( "LUT_blue.dds", 1, 0.0, 1.0, false ) end ---------------------------------------------------------------- -- enviromental settings for the maelstrom are defeated from the property ---------------------------------------------------------------- function maelstromSkyOff(self) LEVEL:SetSkyDome("mesh/env/PP_PlayerProperty/S_Small/NS_PP_01_sky_planetoids.nif") LEVEL:SetLights( true, 0xDDDDDD, --ambient color false, 0xAAAAAA, --directional color false, 0xFFFFFF, --specular color true, 0xFAB489, --upper Hemi color true, { -0.23, -0.46, 0.86 }, --directional direction true, 0x394379, --fog color true, --modifying draw distances (all of them) 50.0, 50.0, --fog near min/max 275.0, 290.0, --fog far min/max 300.0, 500.0, --post fog solid min/max 300.0, 200.0, --post fog fade min/max 700.0, 1100.0, --static object cutoff min/max 150.0, 150.0, --dynamic object cutoff min/max true, "mesh\env\PP_PlayerProperty\S_Small\NS_PP_01_sky_planetoids.nif", 3.0 -- blend time ) --LEVEL:CLUTEffect( "LUT_2xsunny.dds", 3, 0.0, 1.0, false ) -- disable the LUT after a time GAMEOBJ:GetTimer():AddTimerWithCancel( 2, "DisableLUT", self ) end---------------------------------------------------------------- -- level specific Server script for Property Pushback in NS small property -- this script requires a base script -- this script should be in the zone script in the DB -- updated mrb... 9/7/10 - added brickLinkMissionID ---------------------------------------------------------------- -------------------------------------------------------------- -- Includes -------------------------------------------------------------- require('zone/PROPERTY/L_BASE_PROPERTY_SERVER') --////////////////////////////////////////////////////////////////////////////////// -- User Config local variables --GROUPS, set in Happy Flower on objects local Group = { ClaimMarker = "Rhino", -- claimmarker object that the player rebuilds Generator = "Generator", -- object the player smashes to get the claimmarker quickbuild Guard = "Guard", -- mission giver npc PropertyPlaque = "PropertyPlaque", -- make sure this matching the client script PropertyVendor = "PropertyVendor", -- the object the player actually rents the property from Spots = "Spots", -- the fx on the ground that don't damage the player and say until the player places a model MSClouds = "Clouds", -- the damaging maelstrom cloud FX around the property Enemies = "Enemies", -- all the enemies on the map, no matter what spawner network they are in FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map ImagOrb = "Orb", GeneratorFX = "GeneratorFX" } --Spawner networks, set in happy flower local Spawners = { Enemy = { "StrombieWander","StrombieGen","PirateWander","PirateGen","RoninGen" }, -- this can be as many spawner networks as necessary, --but all spawner networks with enemies should be listed ClaimMarker = "ClaimMarker", --the spawner network for the claim marker, should only be one node Generator = "Generator", --the spawner network for the generator, should only be one node DamageFX = "MSClouds", -- the spawner network for the damaging maelstrom clouds FXSpots = "Spots", -- the spawner network for the non-damaging fx spots PropMG = "Guard", -- spawns the mission giver for this property ImagOrb = "Orb", GeneratorFX = "GeneratorFX", Smashables = "Smashables", -- smashables to give the player imagination if they run out FXManager = "FXManager", -- the hidden object underground (small yellow box) that controls all the env fx for the map AmbientFX = { "Rockets"}, -- the ambient happy effects for the property, they are on by default and are turned off if maelstrom is spawned BehaviorObjs = { "Cage", "Platform","Door" } -- Behavior scenerio object } -- player flags. These have to be different for each property map. these are set up in the db local flags = { defeatedProperty = 97, -- when the player builds the claim marker, this flag is set placedModel = 105, -- when a player places a model for the first time, this flag is set guardMission = 872, -- last mission for the guard password = "s3kratK1ttN", -- behavior password build qb object with behaviors generatorID = 11031, --lot id of the generator orbID = 10226, -- lot id of the orb behavQBID = 11009, -- lot id of the behavior platform quickbuild brickLinkMissionID = 948 -- Achievement ID to complete on property rental } ---------------------------------------------------------------- -- leave the functions below alone ---------------------------------------------------------------- ---------------------------------------------------------------- -- Called when the player fully loads into the map, passes the variables set above, -- Sets up the map for maelstrom if the player has not defeated this map before ---------------------------------------------------------------- function onPlayerLoaded(self, msg) setGameVariables(Group,Spawners,flags) basePlayerLoaded(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player rents a zone, turns on the property border ---------------------------------------------------------------- function onZonePropertyRented(self, msg) baseZonePropertyRented(self,msg,newMsg) end ---------------------------------------------------------------- -- called when the player places a model, the first time it turns off the spots and sets a player flag ---------------------------------------------------------------- function onZonePropertyModelPlaced(self, msg) baseZonePropertyModelPlaced(self,msg,newMsg) end ---------------------------------------------------------------- -- called from the generator object and the claimmarker object when they die ---------------------------------------------------------------- function notifyDie(self,other,msg) baseNotifyDie(self,other,msg) end ------------------------------------------------------- -- called when a player exits the zone ---------------------------------------------------------------- function onPlayerExit(self,msg) basePlayerExit(self,other,msg) end ---------------------------------------------------------------- -- called from the quickbuild behavior model when its done rebuilding ---------------------------------------------------------------- function notifyRebuildComplete(self,other,msg) baseNotifyRebuildComplete(self,other,msg) end ---------------------------------------------------------------- -- called when orb is collided with ---------------------------------------------------------------- function notifyCollisionPhantom(self,other,msg) baseNotifyCollisionPhantom(self,other,msg) end ---------------------------------------------------------------- -- called when notify object message is recieved ---------------------------------------------------------------- function onNotifyObject(self,msg) baseNotifyObject(self,msg,newMsg) end ---------------------------------------------------------------- -- called when timers are done ---------------------------------------------------------------- function onTimerDone(self,msg) baseTimerDone(self,msg,newMsg) end-------------------------------------------------------------- -- (CLIENT SIDE) Obstacle Course Starter NPC -- -- Handles client side dialogs/messages and input -- updated 9/28/10 - fixed clearing out ui on terminate interaction -------------------------------------------------------------- --////////////////////////////////////////////////////////////////////////////////// local npcName = '' local missionCamDist = 10 -- distance to teleport player away from npc local misID = 319 -- missionID from DB local misID2 = 317 local misID3 = 318 local camTime = 10 -- time to release player local timerTick = 0 local myPriority = 0.8 local COUNTDOWN_TIME = 2.0 --////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------- -- Make this object interactable (must register for picking) -------------------------------------------------------------- function onGetPriorityPickListType(self, msg) if ( myPriority > msg.fCurrentPickTypePriority ) then local player = GAMEOBJ:GetControlledID() if player:Exists() then local missionStateA = player:GetMissionState{missionID = misID}.missionState local missionStateB = player:GetMissionState{missionID = misID3}.missionState local missionStateC = player:GetMissionState{missionID = misID2}.missionState msg.fCurrentPickTypePriority = myPriority if missionStateA < 4 and missionStateB >= 4 then self:SetIconAboveHead{bIconOff = true, iconMode = 0, iconType = 65} msg.ePickType = -1 return msg elseif missionStateA > 4 and missionStateB > 4 then if missionStateC > 1 and missionStateC < 5 then self:SetIconAboveHead{bIconOff = false, iconMode = 0, iconType = 4} else self:SetIconAboveHead{bIconOff = false, iconMode = 0, iconType = 65} end --print('showIcon') end msg.ePickType = 14 -- Interactive pick type end end return msg end ---------------------------------------------------------------- -- Server sends us a notification to do help, show dialogs ---------------------------------------------------------------- function onHelp(self, msg) local player = GAMEOBJ:GetControlledID() if not player:Exists() then return end local missionStateA = player:GetMissionState{missionID = misID}.missionState local missionStateC = player:GetMissionState{missionID = misID2}.missionState if missionStateA < 8 or (missionStateC > 1 and missionStateC < 8) then return end -- player is trying to exit the activity if (msg.iHelpID == 0) then -- show the exit message box player:DisplayMessageBox{bShow = true, imageID = 1, text = Localize("UI_OBSTACLE_COURSE_EXIT"), callbackClient = self, identifier = "player_dialog_cancel_course"} -- player is trying to start the activity elseif (msg.iHelpID == 1) then -- show the start message box UI:SendMessage("ToggleFootRace", { {"visible", true}, {"text", Localize("UI_OBSTACLE_COURSE_START")}, {"callbackClient", self}, {"identifier", "player_dialog_start_course"} }) freezePlayer(self, true) self:SetVar("start_open", true) -- player is canceling the activity by moving out of range elseif (msg.iHelpID == 2) then UI:DisplayToolTip{strDialogText = Localize("UI_OBSTACLE_COURSE_OUT_OF_RANGE"), strImageName = "", bShow = true, iTime = 5000} UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }}) -- player is finishing the activity elseif (msg.iHelpID == 3) then --[[ UI:DisplayToolTip{strDialogText = Localize("UI_OBSTACLE_COURSE_FINISH") .. " Your Time is " .. SecondsToClock(self:GetVar('FinalTime')), strImageName = "", bShow = true, iTime = 5000} ]]-- -- player is starting the activity elseif (msg.iHelpID == 4) then -- trigger the Countdown player:ShowActivityCountdown { bPlayCountdownSound = false, bPlayAdditionalSound = false, } -- set a timer to Unpause and Go GAMEOBJ:GetTimer():AddTimerWithCancel( COUNTDOWN_TIME, "CourseGo", self ) end end ---------------------------------------------------------------- -- Sent from a player when responding from a messagebox ---------------------------------------------------------------- function onMessageBoxRespond(self, msg) --gets the player and ends the player's cinematic if one is playing local player = GAMEOBJ:GetControlledID() if msg.identifier == "player_dialog_start_course" or msg.identifier == "player_dialog_cancel_course" then if msg.identifier == "player_dialog_cancel_course" or msg.iButton == 0 then freezePlayer(self) end self:SetVar("start_open", false) end if msg.identifier == "Exit" then player:DeactivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Post-Monument"} end if player:Exists() then player:EndCinematic{ leadOut = 1.0 } player:SetVisible{visible = true, fadeTime = 0.5} player:TerminateInteraction{type = 'fromInteraction', ObjIDTerminator = self} end end function onMissionDialogueOK(self, msg) local player = GAMEOBJ:GetObjectByID(GAMEOBJ:GetLocalCharID()) if msg.bIsComplete == false then player:FlashNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Monument_2"} end end function SecondsToClock(sSeconds) local nSeconds = tonumber(sSeconds) if nSeconds == 0 then return "00:00"; --return "00:00:00"; else nHours = string.format("%02.f", math.floor(nSeconds/3600)); nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60))); nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60)); return nMins..":"..nSecs --return nHours..":"..nMins..":"..nSecs end end function shutdownUI(self) local player = GAMEOBJ:GetControlledID() if player:Exists() then -- close any tooltip or messagebox player:DisplayTooltip{ bShow = false, strText = "..." } player:DisplayMessageBox{bShow = false, imageID = 1, text = Localize("UI_OBSTACLE_COURSE_EXIT"), callbackClient = self, identifier = "player_dialog_cancel_course"} player:DisplayMessageBox{bShow = false, imageID = 4, text = Localize("UI_OBSTACLE_COURSE_START"), callbackClient = self, identifier = "player_dialog_start_course"} UI:SendMessage("ToggleFootRace", { {"visible", false}, {"callbackClient", self}, {"identifier", "player_dialog_start_course"} }) end UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }}) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar('FinalTime', 0) timerTick = 0 end ---------------------------------------------------------------- -- Player has exited the map ---------------------------------------------------------------- function onShutdown(self, msg) shutdownUI(self) end function onNotifyClientObject(self, msg) if msg.name == "start_timer" then local player = GAMEOBJ:GetControlledID() player:ShowActivityCountdown() GAMEOBJ:GetTimer():AddTimerWithCancel( COUNTDOWN_TIME, "CourseGo", self ) elseif msg.name == "cancel_timer" then ---------------------------------------------------------------------------------------------------------------------- --You respond in the positive to "I would like to stop playing the foot race" ---------------------------------------------------------------------------------------------------------------------- UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }} ) GAMEOBJ:GetTimer():CancelAllTimers( self ) timerTick = 0 elseif msg.name == "stop_timer" then --UI:SendMessage("UpdateFootRaceScoreboard", {{"visible", false }}) GAMEOBJ:GetTimer():CancelAllTimers( self ) self:SetVar('FinalTime', msg.param2) UI:SendMessage( "UpdateFootRaceScoreboard", {{"raceComplete", true}, {"message", Localize("UI_OBSTACLE_COURSE_FINISH") .. " " .. Localize("UI_OBSTACLE_COURSE_TIME") .. " " .. SecondsToClock(self:GetVar('FinalTime'))}} ) timerTick = 0 elseif msg.name == "ToggleLeaderBoard" and msg.paramObj:GetID() == GAMEOBJ:GetControlledID():GetID() then UI:SendMessage("pushGameState", {{"state", "TimedRaceLeaderboard"}}) UI:SendMessage("ToggleLeaderboard", { {"id", msg.param1}, {"visible", true}, {"hideReplay", true}, {"callbackObject", self} } ) GAMEOBJ:GetControlledID():ActivateNDAudioMusicCue{m_NDAudioMusicCueName = "AG_Post-Monument"} elseif msg.name == "out_of_bounds" then shutdownUI(self) freezePlayer(self) end end function onTerminateInteraction(self, msg) local player = GAMEOBJ:GetControlledID() if player:Exists() then player:DisplayMessageBox{bShow = false} if self:GetVar("start_open") then shutdownUI(self) freezePlayer(self) end end end function freezePlayer(self, bFreeze) local player = GAMEOBJ:GetControlledID() if not player:Exists() then return end local eChangeType = "POP" if bFreeze then if self:GetVar('frozen') then if player:IsDead().bDead then GAMEOBJ:GetTimer():AddTimerWithCancel( 0.1 , "Try_Freeze_Again", self ) end return end self:SetVar('frozen', true) eChangeType = "PUSH" else self:SetVar('frozen', false) end --print('Player ' .. eChangeType .. ' is frozen: ' .. tostring(self:GetVar('frozen'))) player:SetStunned{ StateChangeType = eChangeType, bCantMove = true, bCantAttack = true, bCantInteract = true, bDontTerminateInteract = true } --bCantMove = true, bCantTurn = false, bCantAttack = true, bCantEquip = false, bCantInteract = true } end -------------------------------------------------------------- -- Timers -------------------------------------------------------------- function onTimerDone(self, msg) if (msg.name == "CourseGo") or (msg.name == npcName .. 'Cam') then freezePlayer(self) UI:SendMessage( "ToggleFootRaceScoreboard", {{"visible", true }, {"time", 0 } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "ClockTick", self ) elseif msg.name == "ClockTick" then timerTick = timerTick + 1 UI:SendMessage( "UpdateFootRaceScoreboard", {{"time", timerTick } }) GAMEOBJ:GetTimer():AddTimerWithCancel( 1, "ClockTick", self ) elseif msg.name == "Try_Freeze_Again" then freezePlayer(self, true) end end o](k7222db398030186f474e6ca6056ad44df1597bd122b6e151962fddd939cb53e1AM ddb34f12acbacc84f4e7e8ca8b816bb8>z1d7a43169efb9261822055385cd1a1aacC60ac9239ef50a399245bb6422b81facaof9e12ede546620be4febfa0353e57247jF:Z c5d7405a43b0f1c472d39b3f4aefabeef7abe6b683eceb57ded914366e3b14d5bi GY#edf490c46d5ada22c1acd47f4c5cc48c:0988b20529e72d863e797a8fe6769fc1!96l16f1ab534785dfced2398b63f766675c595596c76a3e221f277ad255e7cf3856?5Gr3P 33e476b1a0e5b79a7b69ba38734d35d6~9faeea4190b69a3ee1ec98f3d84456db19=\3fb665e44f5bab99c0d92c17df9f9839 94571ce1c68c3009c98aad7f4ff72432g(Sf35b2637116a998c8bad090828d6b8c08167bb4ff122063d5ea11d9aee7a8f6013G Wce2565ec7d48e006f48a02343e8ffd0a<492ad00626564d4a90294a097b7f850aKCz 380ae4bcbb0d5b22435e107e45e37a48,cd3503d94660f6ef657897aa7d38c295Ei \"dc594f5e17ee6e06e76cc32a2a02330283604356e04b552844fce1b42795174646\֤Sb6f0c9dc8ce3e0662970efbd05dd7d29_;efb3cb86f0ec49af7a7bc1ad7358282ax$Atd41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688+t\r32 c60618d9b209f9f7855f9d57a31b5eff09024982ecb2a6da3fd0dc0acf8d8f5d]4#;7faf53506fd19d3e7af7e2cdb67d644851f8bd6b1887e30620773306d922dbc96GJ@ 45667988b8975d406df30e338094add1a4702637b0740c169f936b37dc967d23>:CS,{N05a65cc4f5a44245e660291e84c5217a`9f9e9f34e804de5358515c1aac970468n$2a286314eaee6724eb23e4f9fa6cf667db469b642e68ef23a7854d56f81cf7b6"Dg4eda3b5c058dbea5dc8941ce80be1591294dd42f76e29f9cb4658ce0a6401055AGZCRadedbdfd00fc6a010dae4a16a1ddfceb59f8ccab8760b32157d06c6fdbd81386wCF]69abebde1fdaad749d24c6888155c0fc%e66fe6632fb2e57bb273100a4f715f5bB1XoHc06d8775d17d60f1a16875afac81527b_e08b624d260bc7bc7aa556150d0e077b0 q@4f8553244958e2779e3a43e489e64773590f054e4fb368fc85b988c20c0cf63b*0G?߈d62855d4ae3f1a5d474a0400715d17298ecacacb13c0f6411af87bb223da303ce7@EÑ & 6457f49cd5f730edb05853dd0cdae0c3Xc43955cbdb7d14a87d2e30c127e22b90N2Sb8b3ccb8d12f968525b28fc639a1b4800e4278405762e6fbdb9d915d1c4ec3bb2M p9985c79946324ee27597e79a076f0f91M5d51b538b7cebd2268d506fbbb8bd183ק / cf3cd7dd31620b553b9afef91d8c4d24/Cf0e2d99b7396991e53cc860d6b78c4d1Cycf453445aac096f63dbdad79b5239f1be54c60adf3e9015bc838cb50cf9f5b311'Lc7624c38c3f79b8aa14f023e5221cd4aaf07779f93ded60719afc9b020113575ų9-c5e0207b19bfbb8685474b7392e36ed94Ud45ccf0841a27097c0e191ae35f60473!~|#]11b8058fad1a4dd4423983bd64d4dda2Y28b73d71a0aef12229695d99b417b987#CDc335abb50c35c887a18fa4f21aa8ae22_1db69bbd4c1358df32105915e142d381KGK!7b6e964f6812a37252f2169dc7f3cfa8(cfa4f732e67ae084dfafb0fbd9be5299TG<{h"%c9ff777b55d052a3fa4794360b465723L>f0cd03d69b5afc64bf2fe090d3681679АG:f0fa87dcc4b84881980bbdaefd715b7d928f0bf0a932c41a480ca79ee51cb32598-2}$4c9e9ca79171092bf4f6839de75c5607b2f7e3089a440e67c7c1b2bca0126f0a!9E --cf3cd51ce8f12b77bdfb97a9160f8c64#5cc1ca21e3b8bfdcd4b114910ef9cf6bq 1D \ba223ec07635ba7be58af17c102de39e0e8866ae0446966e6140b7d06bbe44b45 G?Dv')d41d8cd98f00b204e9800998ecf8427eAd521d2d49afa6f27ff014d84e4d06688g t\r'c6fa4770bca83954c6622146706fc647f721c5af0f5d84dbebe9c4f926952bcb0)1G(,5e872c58d2df8aedb29ae101e5d969f6871cfe492ae1d6fdeaf14b66f389af7c>># U0de463fb53438e89e0e8991e3b0522deFXe800ba0699a06c2d6e4eb5c1a0724a64jG+,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14]+0*0"73cce0205dd7812f340893f6587410d066902265ae8eae97246c3feaf964242b4FT9}%i3ca447e1b5549a9f648fc6ff2bcf8e981o 200db65f08a50113d934e071a51eae9b6.v%f786ed841c18d76ab3d0c2a6cd3895bd 31a6c0821c8d41f58aedbb81e5f7f112"=K ̥6/262257bc4d0841018fc44f35d0632e60424ed547cbf5f6c983f765881ce6c369eVzX)86252c55023ce0f7aaed2abdde0fcab5B) e46410e5e8cacf82b9d972b243ddbdb2c1"4aea1f937f6fbfd9a663bf9b86b54a716eee9672035f3996e401b8f10ffdd2a2P(GM23162c707affe50cc8526e9a2b87ce016c05c88eb0528ca3a3468a5a2b32343ez1b>7f4a590ef804f3d24f8454bd0dfbe9db02deffed38879093e8aa0ae485f96d8931G_467f05de81c7b5c3d4c6686bf8d35d5e717824894bc20f2eb8fea04b89daaeeb47YVU\T aa28e392cd535304243a4777123d8c6e3F41270e27f974b528b3bcdcd7ab6b1576l59a34a56dd2f719396973e6df2100b43208<95e83909f716377514aa02dc6ae68cb0Gn9a5bdf3f7e1b9bbdfdf6cd291a2a82103I7660c60f3f2461778ed8863d7e5be8da+GY8 c103c0ff92fb19031f5b985fc75bd8e6NP38f3fa40f5df119a269e82ba9b4e179c~ C[7=Ae916fded32246155cfab7f0f31a4d754T2ab95031fbee6a79c09a3c01026024043G^5a00dc10f18175a0fdd9ccf1dba487f6Z122ea219c8d9f4495a5c7fdf30a2d9b5dCP ;qT4655392f4f0cc9d80208535b27593eaa3a1faee2ec5053e83bebf8e519df19f9`N :V <? e5f67488d1ed78a5521e0304e12292c908f75c6c7ef2000ce43bb8e6052e441e5Ga{ 00c640909d8712cb348ed0c40f5e5858)120c13591b75a7e54eb7de3f48a30dee4G >qa518edb482ec9a01284262462f30547621b57358d8f79db096c90725cf911a340G) :G<4eadea5c852808ef932a428190d50907>811cca043abee5c9447cc9d3c40d07ebxC0O cda26b9de4bb3ac37748012dab88fd50g]00ef2f9dd12ce366167da9c77cfcadb0/%Gcj ACb0be9c0d4f3c3767d7a356db9f6b0d2abe6e97837e4321fe4c8fff80e9758677M6GB $40445fc44f8cbcbdd0adc83e33d7a42b)c9c7c947bdfc7b5690964556c14ac82e\7GH BFa4f2c2eecb0de43d133ef26e4570900c1285906ab90f447686641e27a12477123Cw 90bf63fa7217a4e5a60f421b64ab30eb3786aca9a79bc06d406ff4ea73959e3d';c E7cc10c89be5962e0cbf87c9ab2461cfe%5bf696a38b8428c4a94bb19e7d3bc340K1u DJ>8b883d4e308ab45c4ef7798344e57cdcBbe08fdc369bb55b54a00a9b7b3bfb0be(G} 51558161db1b8111edfa6da4f286a7f3)58b6f5e4d48931cada01c3c7db6612d1=q1ŧ H99e412b3bd721190cf17e0f3201e691220f6a1a4c282937b20e4452bf85e21bb1S ILuf444774b6852a30bf419ff84f9ded025`Ld793c5d12e09220d071f5a026cdc7efah* Gm e7699aa307d5f6f93da93f0e9b2e04c4+9bbfe242f1e636b7c5de09a847925fa9uP { Kd46f4dd51ef3bbf97a876b5658eaba7b_9d01efa17af529e0fa943bc6028a8b36R8SYK @Zb573fe8f868d1e14475dd1fe8cbdbcf9ftc876c8cd4b047561f1808d39b676b375I Xa 1252e250ffb5df0d30095104793b81f81bf28232faf6370994f320befba78879o3# NPG.72b3684435be5f0a16352b3ce4486087&46dfc0f6108b9f90a18a3345c4da88b2~؜ 05a65cc4f5a44245e660291e84c5217a[9f9e9f34e804de5358515c1aac970468k$ OSM380a10de3bb561c99f29d071d15b8f1e6=6682292a872c26318810a27427264970GX @ 459063c3684b28e3c3d1526f16813afe4e714d1fc46f612544546fdba495f828 @#u0 Ra4449dbb2c38473469a313c60888a8a240ac17df2412d8db52081318df7f18333GH QW094bf051f6752d7d85345679e9ff3069c 7fe03e84e051d75b2d5ed31caaadebd7j9GjW |1b7e17f50bd08af391fa44c3ab7e785f|eb19b1d3d0c52860893e5579a7afee94| U13c35b230cc4ba637615282dab0bea1da/2ad9c6ba54c0f0dcb865fa962c98d5edv VY0677dae1cea0b76e0ddf082634918608@257dd48ae8346905f6474a9609df6178.EP87bb800605a08d85107f80cb3f87291c641766b16572d61d09806d6c73c37189Y6G*`)Xbb5125e9c7cd25f5a5d3f7ae01b50e0d 2e9df37182a8aa6ab8ca865fdf0844b779G mhT`ef94912d5216fa2fa429ab2c8e5473e3E8ddfd87226958b74093094aa521422b1Pl45324cc6bf674ff9786e27662771dbc1cf01e4516d74de28128b1a0b32ca3f41)3G0[4ca42cca7bf0ea44e3f800b4ebb1ae4dH6306c5988bb17286c9fd3544b15d9c52FC\_Da2cf13b113918afd6ded63047a8be4d3 39716ec324e2b5bccf7d10b7ae3868c2`D9Gq4eab8c18acb67e9729db7563fd4dc9e65390189252113179efa8219e4ee6a8a9e7^\e5b40689adb4a10403e21b20ab4be55a`c7f36147d8815b0952581c252ebe01108$C0]c09d85c3a0c0de342a9d5063d4703fbab2b48de91960d296ac637eb462bfc4de3h"3G7"@ade93ac20c9e9a5e33d53eb77ba9b31b7a40cd356f7d89f3414a9ac62e768f73CTS#a4579fc02e28e90e9a03d55463e879498B5d0619734fd4a81f3e91bc90f0d884c4=?5be573eede940353823d928175aa53397eb0c691fabc72bc4e48c5db464dd22b4511GԄh95e65916a1120606e5a5a53e79da76cd96700a7fad5eac434d62e6f1ed4df0f1AG/ttdh888e033cba0500ee3b0e77b3a666fa14l5400866167d41ffee9a41db4588cd6f4 731305a65cc4f5a44245e660291e84c5217a`9f9e9f34e804de5358515c1aac9704683p$׭i33614288074cea9d03514d9999daac3f0y 3193681147ec073f3796b82eee7f6264ݑDgi287ad0bc2953502a877e1a046a84fed2=100f20088b7b4e59b4d35c97e0d8b249 En_U caca21fa00240c606a7c280755093cb1)64452bcefbb0773c624f34c3c57dc8faY'Shld41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688q?t\rdNa8d7385a7c981986b1605a037eb197c7 cb0d508c16e3e0cf4b0a0889b1e247e0G9'%«k864aa676376d78a66bcf47e50cc69447>A90416a30eebe5290ee206980724d18c9GNjpc5555a964c38b840c9915d7077267adec73c497357068d84a88d56f21ba1921b1xCG-> c94f336299a9bddf7a314e02780edd934cf86024274d4039ecf9de104aad1a05=SBn0209a2d9c16c0f0a4d236cd09255a67eT9578fda7137ca0f7941cd355f2f705f4%h ydor57160c423b2805a11f724a53809c8fd6`33897938b9477e8b5494948c79d94363?EGL 66cf24a3ff21d337fbde5fdf8d4af2ec51735e732f4613f42984743f81614328$CS8_qQ4f09428a667ff9039174071f28e76f52ce2ac7fbc8d6981ee8493fd66e2e5ad6;mzL7ffaea5ce2bb5120d753397e720215ad9459dccbfb35c02f60b52c8fc8390720qQ >370b9f5c7f626cb68a660658d6670cb82cdf3a17b6fce9faeadedf8b98dd6fc63cGtv32642d4a3c9dfe1a7a671b0bd17bf046,c5f0a32823e22938d1c1cf037c52b280plCGg48814935f4874309e77ae92914867e5c<215798817749795b3981aa7598c9526d DGuy6285ee4fac977c8cb3a303aabf46de5c}1961d7a0b70d7d0bf136d2b6a2538d84L;aX$fcd4771c30aa1df0de75a1ad1b4951468681ef7384779ed1942ff580a4cf3f275GI4xh9e6a448cae1b2ae588ec0d81bf782d1b7 4813fa942d0004968fc3e9d82adf5f80 O zw} 126c0ac7b3c6198c0fc4a23fc0bc1666d59c2a2f3324788213a3abcf4e078ed0pCw91219853d0ee5aa600fdff33e0b976cb%1404948a08ceb7ead6fd593a28f345c3T1Y{65e9b80c54801bf7e12ec0af358510bc,d26b9e021a5f4f8900bada3e0a6940ccS%Gx|037ee5cb9009bd52592072942f5ecdc6<37a0337526aee66cbb4a2cefe199f1f3LG˯fd66b485ee30a95a6f02031c20defa78f22e08a3583b5b132f9743cda10e9ce99Ǻ;G ~ea7ac7fd143dd6d25bdd964953c0109a)3641da986f0c7210a01acd8a32328685k1sa61fe09ad15797e7c39f55fad1507ce9d99e08249927c308842ef114cea02c32ː1!od07091cb52c75646df4f592aa7a7a33dA86fa157f21fc6780bb0ca5c4960f8229R Gjs22e78bcf1476050798f58e99fb728e428*8f29b2087879cc4dd10e5fbca584579316c7b94db26bb230677075c4938cd10adId360cf803e74347c2e85399662573d8eCz 7517d6c466a708abe27fec5991cd046784481c4edb769e37c7f4d062385383b2b(SYf801002dcd95eac7b9bd7865ffbeb747806b3b2d3af487b1f35959910f1a3e6e/i9J,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14|-pcbd50a8b1db2028b00a8d473646528129 N508d2f46162b9418f3ee0cf3c77fd9d7'G%d41d8cd98f00b204e9800998ecf8427e7d521d2d49afa6f27ff014d84e4d06688t\r b128d94b74bc0b095f0589203fb4816eR2da47bf0736917207fa1e1797f2f82e7Ǵ4S]EBc0e6376651f93606dd4f302c0f1076c7L2f4ef5ca671fb037373120946711fec6 CP,c295945d1d828cf2c3491eab9b6712b8+4c0d1ba05e445fc7215bcf447ed1f56fG(WQb5e5cf23c6234e7af93ad8c6c2f464077a102a28f33b12bb60057f0a22c88af2 m<+<I  6836e2ece6bcd99231889d48cefb0045 dfa116b985b77a42f14db5e164ad2119F'"e62c8f3516e47710589d66fa21c0e925S83f1c2f452639e15a0475e860f497faaB!PB0db0505ba6cd03da8d8a69a9a5c1c4b4*effc52500a15ba60de18680f25133828$CY]*a2912111779e5c180d6b44946c07e854. 4b797232e24e087ecbb7553a9a585fecVjc725c4d96d5d1253997ac8b912c080f8/75281c59d7a8a8f5b5cb0f6f9cb7b64f>J#~>O1ced2f51f96d2aa2ec055db4000273b806bb20859a449e1d0b666c282a6b5734-n6Gr239be4b39301e855a2d9281b9ecf643c32954fbc9f086962e88fe5e576916dd0-P r<de9644168c11a961d204ed3747dea2c43ff5566f92f14097fb55f23bbe44d0a778GJ&0b127d173a4c581e878a1c208c6009f5~270959a38730a5eeac9417c5cd0a8e85&01=V7ebd7e361d5f7ac3081fb2e541d8f998`b02560142c80db8adbe0efce1cc0cbfa=G52d9badc929d9032bd34665b486d533bJc86ee040d499a7131420b9a0a9e4e788E GDX642226e5fd3be576bda62e954d40cf3b6N#411a7777d8f49848a024b8777b49ec50Ew C52171e1bf4d612e9bcf7777e629452be0ba3e9306684b0533d20831c57fb9383,y K122e5c44650f2d80e1bbab9196bd43fb9685e141ffa458de699d67711eb02bc797ICvQdb3b524c16b076b32fb16def063c67c1$V687169d661bacd0f9c2b485c6aabf87dG=`$9890b6f9469e768eb47a386fbf6bea9fe2db1ddfb46866f4221267e0ad290d0aKYsd41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688s;t\rw 1accdefb79bf6c77e43266c69a79b7745a9e3e811aa65e4c124178acbc23fb8eM>Gt3B18e211c3922b7d56189a5598eea0e9a7fRacd0ff151d7676292ba0a8d7df762f7f)k%ZmNe428c0e0019ec42f8ae81f7aaa6bb8d06932095e0092f8cf1c0da09f8bde9e64`0G̔68bd1974c2911676c82cf048a616966d]1532836ed04be676797bd3761eefce66:$C9558c8047f40398ca2eb5a68c05f4211,3f2e29ffe252b2782ef3b1b3aecd884ei{(fa59c8d65bc0a1796b1223a928608232313591da59ea8b942c9d5ac0dc7e4a653*I)\efe7319d21828634d94c7383c8045357B 78e9d8630fdc17089af4ca40a8c7e247ANC[)a75065189d073db486983603417246daCde42b8ab29a75a261965b25fc40b55d8(CUcb2c49e8c29377d20eacaba0aac5b90e& abe7dfb255f0dd8117b61df30c74e66aGI5423cfd2b9afe8fefcaef31d69f4f4b393d7931b66706f7dcc2b5cba608ff178}YCùa18753a312b9e4b81edbcb41912949d8h0fb59245b1812bbfe60c4a3fd92b585c\ Cbec14c0446ada9ca0086978bfe0c2000)628a24a0122fd295609ee63114cd9d1c^1 #e0fbbbbdcc88b76aa05804327f5dc28b;F f2a7247d687ca2807f1fa2f9663162c9sH49818ef8fb61997187ae323e3b3f1342h623d8d5ee1254f74f4881ba0654716a9$lad4fc3ba08711c16f98124ba4151abeb52d351b24364b55f75c9882c0af36130Ep)02bed085a7a62c3fc9aceadf2c0628adA( 63eba64f1b2f92551500d1a54b4244d6g R91a966ad406cff95db5a3edc44d40ca3 0d094b7d032b8bdafc9d8cfc508ca9cdR8#k 0d21f592d36ee55310d05ee8eefdd8c7dbda94143be35af20e6e4e3b72dfbbf6-p;15dd46f0d8504bdc2b1e323e9f5c4e66426f7f191d637f3b796538374502e331=G2817ccdd0077808efca3edf0259156a8cR2d7561d9272742a9806e539a20ceb447_!C}\3af71f9e920059a55bbf01741322e735cc8790e0659699a0c31aa174d2eaca043e$C@bde895b72d387b50a8bcba329b08333aFf912c4bb34028b555ce0f6c2b5e6d1fef CAV5038e3be2ee2c838ecf1bdaa4d67bee5 22b302a60469f790bfa4fbb8682b6df1]Q %L_d5e69a8335b330de8ba94ab8eae350201922e6fcc713b2347afb49d640a510308G c03078a072917ba46ab3f68d536e0b05bQ*32822c269cd1230f05d3edc31da3cd6fH Cno21f8b35aa40d6a28f0cbff56038cb18b e7c2a5e4ee6488fad28e8435a7a6101b!m))8e5293a3990ba4292fa6b48f14393d01_% 6146efb37808bb7f43418e9f3751bf41= ?5E 7de029d3e51ee863c8dc727f7cd4b4724fe75d9b2320762e67bbeb3d238799133DS<}3398e7e03f28e6f1d0bcffcc3bac87959ge268e5264e6e484cbbd14a5ac40554a0JG馄2cf0e9186027550d3168bcb49c711905297e3c0aaad8f5a4e3be8b23eb911323aD2137b1a37e955def80a3bb7e3461d274db~iab666ca577bf50b4323aad68fd6925e2GߦM0a62ad01d4642f01bef1bacd8e97c50fGN7c2b55cd19563bac3606a62ca8b74b526CI ?040673365283a88c4ade02d1bb6fcb22&8a1cd70e1283af3a526d4735d9193702|C.# _ 88c025b8a8a4c863cbce5287400e67d6ad1b96c4b4a353626bade740d8f1fccb(DSMX 618d95d5c0324714b6d7888201c555edVb2f890bf1676b7502ad86f885bce3c73Ѯ=G}m O4701e120ced33c40b92ec5d3eeadc3a5O90cfc3261fbf1483f5dafb528e340e13a3!G 34323f29479db106e578e9d635d4cf89_f7bcef4ed4f23f3b0844c142cc6f7d94Gt 3b6dbd027b2bb13be1ec3fbc7f61e6219c 67d6bee8e21431f0baa9c980cafa569f$x$!C88c25d4b60390571e016b0383416f1afZR7a8bb3fe7100ea0bdc725fea83fd45cb) Gjd1!0 ec3be496d0c73b8d374854118f0e3e11a8976a5130874370d8e37f45dbbefe1bc+3S:!g86c3c69719a010b3b0a53ffe950cb6a5@M0f478661bd2e2269694381c53dee015c=Gh!: 693162882ec3d678d47e10d7ede5019429bcbb2dbcef0576a51e2d207f5e8a0day+Ct!Za7b7d39da404c29e5f20b31d28fb7754|ed87ee81411d3c7964b13efff01f2f40i/#u!O7ceca46e4aa4f713f01b6b9e8f61df8b59ae7aa4a7f72c5c2a30abeb281266b6φ5#:[!b3338fdc75bb71267f2dd672797e50a4d3db992efa77f827e4e56c57d6a8155et]<#!9b6bff2a3f2fa813891d7e7c454ad2496b 7ea5849f5b3d133dfaaccd9a34892239Y+D!F8531d893719ea0e63e264e85709bfaa8wp30290992c4d5868f9dcc0509efb09364mvG[ "f4p#477d810878a3d965174d0c99da9d6a7e 57d5c3d2d2c6f6657076351f6bb56dad1(HI"#028a8948eeac23152d78fe5ffe808db9=136d0e553d7a644c0aaffef0c53f7816b#T"408f042f8976d4c430fe9654601c107cc85525bc05f9ebec2af36e3ade944bff#~1@g"Xd657d884e099ed97b5971f4fae5671b6c[0c378a90943662fabc1a36868e6ee175$ "4e3f1c8e325036782d7b91797eaf0cb75092c9ad9d5df9b5a37d624f756f72959EJ"90ed3051e9ceab4993f458845f03213e cb64caa2037d187801d464df3a0c5e95Vū"620b8a27a42111cfd1033f13ee40e48c739f91a580f2c27bc4c2eec071e61412BPG"d0ea807f86585e2cdf60f562c08654f0 ^3e094933ad6100a21ec165f9e43c1e558#V>&#y02f93341826a358a6983d5b26c5de4a66a7c40617891c7899aa446eb16065b11'@Gr*C#88a37ab1632a27cc0544ef14548f5f89%8306b68a2734ef0127744865f73454f6.@o# 4605ffc899983ef87faf0a701b8d5142X816bc92906d2ca97253742115cef4dd34"Cr#3717880694bd799093121595ce44ce01e263f763eff6745b9353b7e5256ed9bd2?9:#mt#ef5be77402e41b5774314224d57c9484b925cb07fba52fd1c7ab4c4ef73f432d>#b#b950d4f10bc98a16249dbf308eafd3fbb58cfa661ec6e1125e955553f4cea85f M :#bb796a1e79951a5192ccd2ca18f490ef2c4a013cfe5313959b150f5fdae679e30G$#c9dc2d899c3ba14ae8dd3b3a5225781d+aeed4652f00f0683caa5a79082c2d80b}/#29a9a70a6e0201672a4f5ed0cd2b8a9c;a9e90b09d098eebe26faa4d9d5934a03>Gz>$58e87b55677e964c8f61f2c756c62aa0A82e7148ab4d55b95fc428160c33d3d0aRDGbb$Sb6f0c9dc8ce3e0662970efbd05dd7d29_;efb3cb86f0ec49af7a7bc1ad7358282aTy$$k9c670f791a821766321c84a5b79ef891c305a641a6a4f3ee10b9eacb59ddb3068u$G$,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c144,9$0abfa892a041136e5c58b28a83de3f4c)24704760dc6aa5881d38d52f8acc0713s1N%a5c038c47d7fc21c37c334d74b0096e9%3a12690f9ae116994379e162c0e168f6qM1TD|%m65a22747c6e252b17b62123e5665d8429U2810a5f4829f74ea042a54d7ddc65501G%*38d4c704d25c4297ce853ab20ddb9e94  43f24bb84cf49cd5f71eabd1c78c7e81&'Ă%Zp9e9053c4d7b7ae83f8170aef4d30c8a2Me7eb361d8360861d0ae07dea07972b9d-E+<q&W0334c049fba48642a53fd97279a66ce5778246dcd661ace8f684e92bf06eb2dc1a`Ge&m(486915c2fb955e5fa4779910e8fad7bf}34c6373fdfc242592417cb97716c9309({(~& 25b8664209305dd228a43f47d503db55:d4b5d55d7c175ed48263da0b5c8ccb33A3L ]ϥ&lbaa921e7e8a9933d77b95e9a8e609645:8297444cefc63e482bc6e566264c103eHGļ&27c13d808fd8e20c3dc3c313eb4a15ec% 1d692d820640adeb26636e747b02b595Gv0&#0c40601e79c2c2b5323692e104c684aaJ29fbb52a3f5d312e42086cb9965b8f72O C[R'247929f0ab5cddfea3506745150775f69d260be36b078b8f8c7ad89d055d14cad?;GJt'22c992b37c69e669e97f1532c0811a0b.e641cf6bf2be3c0cd7d29be3a0fdac1b^GL'Q629ea3460e3f4660e84e9501ca06e5c0[7ae0d5f30fb3757d54923b4e0cf782c3M"GG'8f87d5bc23198300f2c73ae243d8d64fC?605db6dfd9172c3fc80eb1b06d148898zC'15768d068988c7ef92cdaa68871f86f7I7492081a78ff05783b85465982cfeb08;G>49(Vf2fb91c3c902cca9abc4693374f3e74bs462a6bbd2c9583fa8a16f989782f930bFB@G]H(eb454cf9c9d776bddac32bef1df09b29Z624f01da1cf9ecee4421c8c00ef198588"EXQ(102b923e59b2a2b6b5a91198a79c1816a04ce844bf3c64ec02e4b96b83f6885b1GCl(7a7d36839a6dffc0601d28020a9b7bc2fX4ab6c7b7936e2900351878b8c8aa5b98!ua(rb470419ec3f131ddc279f7c761e2daab-Bb29d726830143a7c9987046ca448bb22GuL(b6b4f27219137bdf0dffdb05fb570ad6Ug84438dd86ac5d8f9b6a9b63149569979!Gx)876ccb8661e1dc2b508e7873065b135c:4f870871a9ff27f3206d78fdccd5143c](CD|)6e0e333bc112aa4ba94c5b3157b75bf5 07cc2c50ab63a063d8986ffdaa4cb08eh]9Gɦ)f74a4418e94761e72d0a5fe2752db4a0395d6e643514e76b5d9b32ff3d1121a0&1),2b6222fc15a865dde9c32fc5752db6b2 74f865e74b645d47c5650c73e11b97d319N)36d63201d8348d191e982f2481dd7aa5H206da77624909e7cab8a3a707b9bcd507Gց*0f09a17b9cc1eb0415eb9415cb98de5ecd 5e0a74ab1b940730363db4228bb9c4a6]$G!*)7e7db8ff2862ef6c755ee3e359b1be71H3 7098d9b557697b32c3b7d2abe78b48bc׮a* 88ac6b5ef975aa38065785baae54a1d4e2c3d2b5ad8bd317a8a7cec414222fc7b2So*a4b9e9d31beb5f063b210c933f1241f571ee68f6bf08272ad1d0c3f70077d7c79E>[*21b66afbd7d209effa05f012ace5aa95ybfec20621b5448af6d2ce477d7c70b76A~ۍ*i[4f842dbd650afba6853a25acc2f7345fSb498fb55689ff3fa4cbd60aebe76bddeIO X*\281b99b3b43864c0f2b2ff59bfa1fc16acaa4f5b16f278d13b4aa6318cdc25aa32$CGC*179c1f21cb5ee1e738682b1825b568ff6d8cc358c4ba58192c0b0c605ee63cf6(>L *s7af65d82807ed8529d62fec8399c339aQ3ef164797dddd4a64133a77a5b72796458#LL+1a5146b4d9d6ef83ba2c30fea3aebd45)44f90c0052d6e3caa1b3ab21419840b03*Gb+3421efc214caee6527a170b48ae0dcd9fg595de1fffa3677e4eb543417ec690ddd7$+ 8cc6aa6031fb9de362a086935eea84c5289f72757c574eeee745fba91115cab1γCG2*,W6237fd604ddf3c2e0b7f39c82e02a653;ce93f0f9e451c77f2ad6839dca000b7aC+, I1e536180a5d2acc14a61ebc985eeff20 62587acf197eac56f23a52244d8e91f6<9GӛH,  Ub5db6c793c918d97ab6f82e90e1bfe1d=6c60339b2d1f4262bbba7a4ab0c221a5G,8dc9be3b35b2ca9f19d2261f5d69b95aD332b901b088ab55a776a01663c76497cw`C' , 595f74376e4a28ae5e7f3f3151c22cec~a892410c0fafbda78ea4dd8330d4f10d;;#,f492595a5bd1d05409d63115418c53f7%00102c62910fd3486075c33b5aec00d1@1}M-fd7fa86d5bfe0361a1a9509845e992a4chedb8533804d883c0dcb652f5ceb57be5)1N-Ya3b267cbb50ef4c291e5ef8984bfc4292c364997babdf2c16cb7f0fdea5aa020Cc}S-614938be1a679f66716e3375ff5579930M#30eca70bd2f8ee6d3857aa7dee8a3aaf& CT-7f4f2e8347d1008654f238d85669862cBzc80ecb1ba854634ffd50c97eba8780e0UG=-31ca39b19339e35fe0e7174c4ea01f9d877481487e2170c0dbcadd4afe480afb4C-wbf6e0fe346202d45c6e20471eebf8400vd7590c834dbb70ae735058798f8bfbc5b9ݼ.3828caa1f7d3a0d963fd996a5fc4c944ua1153cf591bebf9280d508f4441b74d5G@GW6.fd2515d649e35d6aee2e298dd936041b[&96014ffc12178c9dd46e4985d41e604d /(O.a33d58073fe430e1a058b6304680fa66d25014b1886a67835b54169f6aa84dfa8q. 34baa58d8f0345352bb2c7b5d0d611d894ac77b814503b066c5be5605f66b56a{5G..d41de4655a817bd9a2ba83f3cea7afbbCAf62e797503c1927aafe09123d21a5e40aF#/"4a853208f5a07834754bdc3e1ed0725eJ.dc4cb4430bde815e0201010b5610b99d!C4/(y9ac127036315c30c0ffab52e587afd6bLQ5d5a5f75865b9dd1cfde2e81267f4dfc GtG/)866dfdfa80e6fed1132dbd8cf32a0c4b9, cf820dc0e914f35a108eb177bb6a9de7e\/17aee1a865173b92218c06f1e47824782edf930fe8c88558a1210023b163d0e9C#=/4b4825484482980c2ef362355452b57b9w26645334880542e08c262ffed46a2571Gq/!1be065f7191a8fded954a1b4d1bf13df*a3c70c31942f3fbd785d10b05ea024ca} CQ7/(afec5c079da8f7d129eda616454e4a1faa299308891f364c6cbc60ec2f4d0b73eRDGY/ e1afec6da448b548f13180bd9c6b2c220291ae599fef7f12c64c5070dd726e7e%6#60%3af0ab4ec602222f139513cb0da04ae7Ua71db21d69f3c5dade125df449a01c78!0V3b25e28581a0edcca67d99e164e7c133775598ebe06287aa368f9c38bb7f4b1fDG0#2a831e28ece711e4d4edda0b25f5bbe6411ef96b601982eba48dfcfcc8a901c3fz1z10$' e3225ccdb0b38331d791e2acbc1051eb9f1edff06783aae3d219c37c4ff7ae46ҐCS~0 8e3da19b86c557c47242e272743d596077da1f27f1f52ec64b43da52e50c93a8~G},1&344ae96ba026ca325b1a7709057796f0/fb81fb090463ade1af3d45a80ccd4a5aRCeP1".0fa43659e09212001e0fd18d7f51602c36bb9bf758bfa561b0715fbb048ac58d?tDG1m8c6b67cc7296f8a85dbae47da96fc509a61a88aa074d29fc1eda7fa24dfbd0333=#q&1)fce794275e1cb184a8dc0fe7b8a7cefbF@840e8d4ab037ee578ca92c5c6d73722d K1*-c0e23e6589f4564779dcef99cb9a407de54b73543dabe92c35bfdf16e9b5d1749@G2c35771e9a22ce43208d17ff966c4de0a_c68bcb967cfeb5ef097165a32f83a0397Gy2,d6411adf2e3eab22b742ef38ed27d9a3v1443232e11251ce45584f51d42455d92@*u2+1a451a6be8983f6192a53346e9e45f103a100b0fac0169b39b751a26aec47cc23{>C23fe7cfee023440fb81a233d9a6d1acb652002cc62a76446537d8a349e2016b8c_/Gi.2/51dd67c5a8ae0699b3cf91a9fafa20d34a7d318dd008064b337944fcb46c34080h&Gj203da34e5a1db9aab8cb125526834c8752ev2c5823f6d509282e22ec16c5614dcc17#c9Gx2i9c004b72548765253b6e6d4b51d2a8d0AMedf07c4b981782544362a7818ddc9b4bG32b3eed4ab91df50f0d1d72a7eeabbc2d8)f5e45a1162cc0b8e50cb9e4a3751dc69`1N3hi4af3523090500341b35320070e2b4c7aI\b18d08ada033f5256ab30fbb33f94b02Cq]38db957008978876083b96105fea915799cbbb9438afbbc54d35c895f67d80dcehC357e8f44cf4d087e1a6002fdf86e7f760950e6fb926ae6af0ed120eeeee351b129a: a3 de0465b797c2172f898bff384f2937bb34d1a0dd6f15eb33e573f2ef953e64a1(Si 36: ac5e425db0f548f2e2f73ac21dacf281-cfe66df877e87f3aa3e083e140084017M /3z6801bf5cc1424b95be0f1ced5fa6229e bb6e71987c8fd8c859ab4dc6184a0332P9491533bf2d9016cd01a407d7f1d906340a7c14ae14d89058bf9b70cc5b30d4a884c 1#yKY48>58b8c7326c982511b412b6832697bacba0e3e94adf05678222d66f46888a9b38%:g4Xe43783e992f569c08141ef036161373e,56f2748b15507d8c7b6796abeb1fdd04:PG ƅ4<da0ffdd3e912e73c60f32df89da74ad94033a3cc5feedf2ae77fcab7d2788d3dVÌ4=@/cf75750132173635ece8673dd5af6ba0}4898f6a8b0e21641b60bff584bb51136?DG4b6cb56ee7bc6d4fd7fafa8411ee489fbId7c36156963da826d4ddba8118000297aD1G4? 9ba5f38cdf970d7c113d8fd9f46c1e50Pd0effa8f88db90c652db6e2981ef0762!q:S ^5;H05a65cc4f5a44245e660291e84c5217a_9f9e9f34e804de5358515c1aac970468Ms$<5275ac63e5f713c98e93deab0934683220cce9ca8a6460bf810dafb1a11ea59adsVa 5BD(1d95980866b1b7cde0986b34d42db943 5b3c7fc135a956aa5592cb9aa8d8ba91%oo5b5b0bdb256b068ace7302a2b3a87f864faf4054369267b2ed80f5c83c9e8279dԡ3(vq5CGfc4655a2582906bd334ec517eb352417bMb804d72ecd47d30b4d3fdca85c1ce66eI GI{5 13a04db8482a8728f07a3a992378f110807cce96fa7248ffcd25d28cc1889afaS]P 5F225d6ecf44693675d63608a7d864d468<86bd8454b136119254e8fee30ce61bacICW25EKb31d9e221103c54ec955f11837ed51e4-672fb4f04511e157628c6854181a4c39G5ddccb58460b46f855d39d4616aa8083158c73a0f6eea0a15c2a1029bf391299a1qP 5I/8f6ef760651781eda4c6e67b12ba4be0}135bc63800dd32f045e0291f3b39a1ee=2G-6JMF8ab1774a49e88f2500664752ff8d8201f99ce5e3edd6829143c74d89eb976072M x;6Je90d712aa091c2d2f3046833cfd9f078<f3ea834a3f0b250035f5ab42527461fd=@G?6L0b6fdeaac529004648c5b890ffed800af55ebec6c9e6c87e9da3ff9949a2ecb6.LP L6A[91da81e472930fe46d8d94fdcc264ab402417b6ae68ab9896004dea4a2f65f49} vxX6 *b08df89ffcf37e4db7c3b460a41c70c1 i 18797b06305939baaa83db5ddc17ebd18#^6OQ7e6c2289d0204ab8c71726c61c08e2556b9ae3bd2a33725be4c841e12a955b8dfGw6a53c5845a43e62ce587c34c8187ff920c7934841b9ee4a8f3e82d5888731be66f75G6PTSb6f0c9dc8ce3e0662970efbd05dd7d29_;efb3cb86f0ec49af7a7bc1ad7358282ay$<61cb8ef4e8781f5fb3f13317e657871dbd93c176eb2e3604d6d10b970dee4ddbaII!&*7S9+71b6ad7b16cd0f6a316fe524759c555483bb9d1febaa65aa44b8b88fe5829932B#::+7RXk1651b1158d88d69327e7df2dfc97ba2cx9e7f969f8eb1361a171780f05f4c31adLk7606d8af70a448282dc877fc22c71b81268ab79de14b3b88cc0869c1ec67e2c5aON 7V 10706d537da6fdbe5508e277a01588c3<b3755063773706be5499aabe2257b5abxM;7WZrb5eef7fecf7c9cebe3650883e616c120e31852a163b8f4da2a854c56eb5875ee1)iJF8f038471fc98cc76811457675248b872be3f143093d460f766e6a4420d09c6668L.78YHac8a0497ae5073b46a9ca59d9b270d9d0c02240d3b28d009d615a5a2c0bef2bf2Se=8Ubf08590e635d3236c4f888734ef52de0cU3f3304b6676f6b4881c8ce7aa4e4f963!hZ85f288a247ebb7e8e8211025c2ef38604?o9d4f9592a218459ad6f90bf3fa997bf8GQ8\^\730662fc0aa1ca0080fc99ebf2ef5946F916e75eefba41ea7b6be361b76da9719^G8i3bc9599307b8387cafb9bb2a2cf6123e7y b94306ea334844e3bb388b63bf2ff70fo8]a:a9a4086aa98705dcf3d94b04072d9ca4 64cd17c8d75c26dd2cdc1d41c60b0113V8T901ddaae0c9176ba98baf43d4daf2bb7f[e5e5a81aa6fe596b66333f4c29ad38ca^"EdW*9` 9a13766c3a86ffbc4adcbff7fce4b237Xc8b888473cdbd414d41f7f6f51376c10B&"CޡC9_eC638089d87e25cc38e0f93c72e489fa7bW7ba8b32594f88efb6c4655df55f7599835GD9 3609b6dc12610646a9a954213bc42ac6.968dd04c8ecc86b43d1ce5defb6b022b97SP}9c462c97597b28b0c067d51a3a10d84359ef452851eb33bc7279fdd4570e9c1f1d1H:dg-0d2b4e2a338655cf46d29ea98833c5d5 169fbb29371b38b347eed5c245ea514bQ =M:] 335bfa788e360460b8f1e1546071ecfbcd85bc509adbb54ba021142e6a3c0476ϧ9S:f cfe1c913398eb61280591328cadf09ed[7c337ec5eadbf8c1e8102f169bc7a14d5 G:N9d996feb0be00c2761c948aea1e04cbd657b1a4a82e59144216dbfa40bdccddfdM?#-:618a7d00b090faa79dfa82be7b3bebe0)5af12a3a376e6bff39b0d57aa6e5e723i1?:ikb5fbc6845f8f7fd657d197b825e41ae3 "dc03b8e3a69ff0b19ceef07d17ccc941ki&;504c4584d7e7b5f840de3d829973f44a0e573176d0163a6c91a6459f62a3644c>9X9;jnd1db31863e642fc8a91ae15419b97442%e99f2bd2e356be1f33aef87527d82fa0R1; 2093ca6b7b8888ed9eabf626a6c7f53e:f3b2f0ac097e02e7f6e707084f7c5f1aHYCh;me127ec0939a53186197fd16881e0f6831400555e30cc46ba2db7196c5a993d470M0S*df63afe63688686edc5398e6ff8d94ef;?393af5cc93bb092a2f8cd4a8372f3ece~G:->111461149e89d027b90aaa60863ce723f24f6be73db4eb323a3bd988cf8ea0c3A7#LF>9677685745399f6eb5772209cf4b0c941625db4daed399a4297cc68966600971c%7>42c7cc94a46c65ba0d7f47e2b55263d816ec00581cb6f1922fe0facc96ea56ff.Gʪ>?524305ab063de824ed9478f2deb0a6c7 00c2fc6ae9e5fb5ed643f28f390f67b0.9P ?De54675bac0d3afecc85d9dc62cba971eb536878d32df6befbeb8680036d54ca3aNSGM?edbb5afae4c3e77c534a2e3dc55286cad4d783b7e6b0da0708a7f56443785145y~4XO?1782ff2a22fdb0dc53d3ecb4c44f5ff6.Bea5e8fb4f6212c58f47c1efccd130e8e2XGÀ? 87074d1102ce0f1c0d7416157518f3ec n4a8d313cfbb7dfaeb331dd288edc73ffA8S?ccf87e191c509e064976a3092c62dd7abf9474f4bc2618a2dfe289c8cebd0c2a1G~_!@af8111475eff623f131afdba06e848d62AOdd9304b64797799470e4c48e678d468fG"@229fb8d76b612e3be77827eab0eeecb283dffb4bd44ad82aa712eb8da5bb2f73<1jrK@|31d64d968d5eb1ee9527a471364759c8Eb97f68ec067e5f414e94a78c1149bbaaC@74d7911d64d49b9b732a74625c942fdd`48b9b95728c91b271a06258529afad66M:GAY@]635eec851c243ab8027328135ec3a3b7g59994d474850b49efdaf30083b54ba02T%@1deb3027ab783cb2eef0c4fe1be962f19ef8902cf3bfeda4138e1ef031c462ef32Z=k@$715fddb4f887e0ce3860ef2bfc77ebe8 8797738d77001c97efccecf36a89f1b3BfGTb@0b6df92ffcb1194668486bb4f19d91d2 8d2b540825e86e3918aefdc2715336c29GZ@#82e0c2706b0834ce931e25b6f8547e4bn672d177f985b3d38618c5f8d289ea7a0V4)S~HAc7f3f95b318b74b3f56476c9a31a9f54h94f22f8d01faf7d1ad07b282b2fc13d0k7 GcZA1f841def09d59f10eaedd2b026cd21d3$ae1b51393d588ce6752bf4efb3d5a029ON)SqA803b3a8a1c9ab4ce2415a6553afc8719f54f0eb1eefbf5509a8fd8720963859c7{E5Ai9e2f39a130ff6d51b364affcf230b130z05d142fd9b4056b06af53bcb6e985ecauGAbe5f11e19e84765e7c0939f99223eccfaha19a5dd66903aacfbd8ac627ff07eedbk$Bed9a34248fcf454baea1b52a552611d1Ic337240ac1b74247cf8e8712d67a29f2ܮ2GiBbc69cfc322f3c141468a2573860e27662e113025e87d69bb8e5b51e3a131d821N(CB ac19535348e634a713a3c3337e6d8596@dfb09ff9dc9cb597c7aae8d030f26ea1{6SNB e9c441ed31e6805114bcaf75935e35c5PE3d78f5c686c7c96778609fcbcc1acd3d!CjB+848bb0f896dd1886b9483215fc3c5a44 55ecc83741d80f864748a958869a512029!iBf488087ba6aec338815c3e6a11f9f211:*79a73aae2eefdd67ff8da0785d28528ayCB a0f3f6be8d1f9a8a012fe1a2a9bad609S19c4b732d121e8be3aa53123fdc6d8f5 GZcB)dc5ee2a6e362bba0b020c429421749a1T' 5d71080c0ebcc8c67a34e0aa70e7b23e Bdbb5419b22aec2194b53ca08bb716c55388fb6279966ed56cb0e1011cfa4aac8o5#(Bh860fc3144fd1378553d5ab43935c4bf1g44d3e288bc7b438b74c00e85eb16c8483GYBef3054d500c28f8f450729de795f13d66783060f4be17c46b746081435c766da{9INCcb1e2911731ec644488c38204f05e86ec\88c9521d22e2de91135ed8405f7741e5bK YUC92b0ee45768c7aa524af7e98590c36bc5e5ec967f2de2a5c9d7d54d36dd6fc30t4&VCe7492f1091c848c546ea164741724dd213204aa907ee36a4abf63f96df003b222$DS߳Cn;096de0db8322f1092bad32fdfb465095>l 56da8e9d973a07d9c2f019821e60b93aeNyCd1f12e8ef2868d087f4a664babb7776cblfb726b655914fb80ee27ec6fa0754be3$~$C6 c9c9e943df09168000a4556eee0ea934$82cb7447cfe30a772d8414b8bf426880G4D\c2fff2d6f8a31e8fd6cb654a69b7f32bdcf89a54553bd326fc778a50bf7dd47f83?$CAD4be5cfdfc6e8850a734c61f7949e0cbcfd8796172ebea8a927ac465a9091846739GzHD8df8de3fb08e978bb35db8f22e3a6209af9526ad4a5e7d5c5064a2be8bce0f5e4tD b73897be2c07b84a98cb43ca4466cf67Z+61eeac4835aecc35d229bed8a1de6a4b7"C1D30e3fefe0feaad2c4fd8b5d32f3e1a1a10765fd48abb12b5dcf539947a23da50 2/ E6d52947899c7ea7e9a33cb35f0e89e5e~353d210ab47992ade4b9108b4aa81778+K H Enc82d6dcad5c06d5e3a64d63aa313fa0b`<ed978438ffd14b474015fb35208c93884 GUE bacbf557fb319b60c7bbfd4cd0e542ads3412790443b788cd3c6c47dbf6522e87`9GE082c72cdb1a68d560f96c9f78b93d1ae4ddc17c7b129b471a85fd52c74f8f5219b:GlE1e3cf853f3e020af22d4b9d3c31d79a2Pfa7ead77b0b859977db79301c7ecb077F !CEt759c0c3a84ccf4d0e30e3dbea8a8d9bctaf81f0a8a23497e3ce33b82ee3ee475fN;iHF 7c713bfa21cd9388f81f8ca32d1dae522a0dd86aff3dc4cd636ab8f9b68e958fk;S˻F* 7e07d385d094eb7c6eea57ad134b9535Gc249042b12e0391e114ee606ac573dfaCz)Fdbf0199d624d4fd11735bb0fc26d1c9aYdcd2e4711ea1650bc84a7531c538d2bb\ B4G518c60a98c26806f81c326b9a44bf0647633a26bb3edc73095849db3c71f74a9vI/Gn`G a5383271a53382719e2aba6467271fcbGucad6741175e09cd2859e382043425551F Ga/G331da658bc10d12dc3451bd9f16582253e/d2e0e948d2f489025ecf496767c4402f\>% TG05a65cc4f5a44245e660291e84c5217a\9f9e9f34e804de5358515c1aac970468Xe$XGbe30fa568824a21649cbe38c84d4feec7cdae24c71dcdca6e439d40b220ec8a71G4d8bbd6c7921d5a0db9188354b6f316f4=371fe8dad6a55af5010dd6240929349cXGG*a44bf1a638e19604f99e2415d2829561(1d6f2ae47cda0a457f903409bccbb4d2f^CC(H>ec8d7bfb6c0e8b57cefa080c1a1abbcffWd114a9e5a86afe39d995b00ce87b4ba2& G UHf5ff1bd46f0f4ea296830e42829ce45c"8b4fe4e7724f4810d1afb335bc5201b6%^G^XHq35dc6b0bb636b8b452c4fa65d0f90b3fueee12aca6fe4254cb4ff27420f53c30ca2#rH 18221efff1e5a7d8dd4959b73e140065697bc42c0d89fce2e839a51c74ae8ea53,LIb4f4bd8156c94bd099b37a2fd56b250ece53837332b624c4a1d29819658a5071U4S)%-IKc877544200188b41a08e51ce67242f73d983828441e001f6c7b64bcb12f271287.GuoIf4ad6470f1bdaff7cb1c6ed70c5f5d412f29267bc8bb39c4c8a984defba3654ffCI1979864f3b0f3f05c6862c661f49ecad4ffb9eb6710d0bfbff08b0bd3ba1981a5G}gIdec6f1e91a14957c460090477d42ccff$19c745dbf0115b0174f3faaa757e40afYC;]Ib52408b4ef8ec7269c35dabfa6d27994}1f57fdf67080c08de8f305fb3e4a6fb63GZI53f58f84ffcefcb504cbb75bc8f85128'1ba87917f224dba01f40e3d7a38c5d465*I bc3e416bc21833226da843c70447c933X574d214e5d17ecb9a751251c8496708bR9"Ct&J7b359a729f921d6a7965274e1c21c0f4db39e1e51544477126bb3230968fd4e0eD2Jga82f190ae3efe34693574d42e894692338bee3bc474654d1faf2c08330c4607c1~UM bJh&427c2e6e17d90197ef86652e0f1ffc12de96f04746a98ebef8eb0fbe3cb12ada5=/#0}J;1cbbb133f628479962989139b64438ed9324ecd1c04d7f19870297b17900613f;TuJa45c73973f5c548e630d5281c8045240f8e4f3a727e08a215241e5ec39a3c823ғGԱJ\75a420e0b8efeab2d887b111a8a1accfdc5fadb0e2c785b82b2cbb5ed64291166b$Cf086c29846b3ed08199f50206b92c77dbEcL127a55e888d0b0d617a633007dff835eP6fb117af05791f0a5024d02dc84ce0591#XAM57a6dd32edb8c4c8948bd9bb840606676aQ e70ae038b1da4e1d274e884c8c345289 D#*TM70cc81d58e3eab1660578eb942db2985!7886d3d7dab151c05e5440dd1fe1bb56P):Z{M6473593715ad1e033db2e3bab38ecd7b07cab49e42a5747893f4f54c098accb7to;XM 87f7286552b0f76269816b7c4a3c6ab6'yb936104127a6b32c6764e2ad73e4b082/C M+c96728915adc074f2cf7293479bf04f9Eeef753883738a550e74d532d8f155380?tMc38436ef33b4f828f2c8a584ab451250Ob58d34c9396f31e07b45845cfb0bca3b9#M4264e10e9e1a8e96c8abeb860e13c779Z~a7ed425685e445412598d394ed6f19cd- GCUM&60b31daf3688d3590e40162caf126f7236eedc4063dff58058080dde5e824c401SM; 9291c93da13ced9e0b4bec5d54c1ec89?2321fab3b3c30287a39e6556e2b92653CM.5821d5b7cd2f0a4c782bf515102c4d63g7cce11c5e2b44ceeea0bd111beb8740dP%GRff0066b41d5fe5ba00c082fd186f23b9E#KPc824cc5106715a96232d132877014b4bm011ee776764d40e24104dd97865becffO;#HjdPu0f285093ccfde61c323daca2268341d145675f05de40ca3825254731d188a2620GP94979443a4b48ad55ec0743b4bf582c8?00e7f93753cb92e4206a756f61d6cf35;3SQPte887642e05d715d43b5a02ab9fa412deK74f83e114738d03f59a15437217456e27$0SOP^a02a2f6a07b9a2f2ad217c6a338801a2ad185b4419da00713b17822f3ac2a21dv73GQW8d9fa6e23633953cb46b89513af459c0ca4ba735f8f84706bd1715941fb3c12bHGPQe106aec5260411afcac6cbe0896621571 93ba0530f44b2084b543ae07006213ea32GY+Rb7c3630ac360af8cacdb78525288d3fb+*7394e013d4a5e71b04ea434751fc284bG8,R595f74376e4a28ae5e7f3f3151c22cec~a892410c0fafbda78ea4dd8330d4f10d <# UR15079d6bef00d9229a1b0d56c07b116c`378208fc8eaadbd9036e7b93933468d7[/GۄR6Ob99205b8cef36e3c4f3c2994503f1ec5002a1ff7bfebfacc080af10bf9e1ab8a1CRgb8d3983f7eb2dee0f2389ef44fd984f9faa07c341e73b201aab5a4ac961a7f13B2R712d3ec9fadef5a8c8851c05240d3278 463ce024edd4a66978f9cb96d905112dU(R82297d28118c688e511ac201b931d3c99687e3ec97150c5b1c7c4e6548dd49a218GpSf177091312f7eadf3273502febfba5c6ah05ab45e7bf6419e1b249164772f2f7ea$3S#9f67daf5b8b9ac866d121ec76bbf842281ba625606885c49e29d070d55709893a~Cp?S864cd43dba925197a4fb687a734934362cf0bd8240418c42b5b36041f16901d07MGsS e997605e8b447e46932586b7e77291c292b8cd1ab57750116e43fd8d8f992634Ё14S803b3a8a1c9ab4ce2415a6553afc8719<f54f0eb1eefbf5509a8fd8720963859cJzE~S  4bd1e3164e6a74ee6fd64442406360ce:f0f2ebd0416b8a2ed662127f8178a22b6~CUmS b7527be0c085fbed5e7e06f4eb8ad91c;a672b262cbb7c433808c7defc13834b4GʔS]b63326c2b794124f404419052379222caa42f4a8e6b62179acb7b3a5ae7a316d31 GS F3d5ad3bb0a17d3f3003c7dd530d1f84d#312d6ae520c0fb90e704eb0964c3f2a1^GtS t9e87b69eb85127453c2f209d155acd8043b52f0824c79d0cb8f96b48401885c9U>=GT502484b95bd54d6451e0b78bfc7a1654)bbdcc36f5019e28f3527319b24d8b4dcm1A/T+05735ed65600f13724d03973250c0837d501f32452b33273aa251f2b4d5b493c,9!=Ts9bae8d32782f140bf48f047a219874a0Lk3faed0d68a7c4cb2153d5c0c9c887a87 ({T960bcbd55d8964ec7b093a543fe6c94dLe0bfa328792d090f35e778674e0fcd3cGZ@T90bf63fa7217a4e5a60f421b64ab30eb 3786aca9a79bc06d406ff4ea73959e3dKo(;e>Tb597755fdf30f88213f0f1154efa48afb471997612d8dd01e8a0569286c8b2d6wS:TYf47c115809fbb2105952112393931e35 ?a01708cb40deaab6b3c51e2d0dfa8c38G T863a5d6a2a5ef68bc74dcd9f641d3e0ead69e94eca433b6794484ea0c4e5c55d#5Ӆn!U 9bfb2c27d3bc69488a2e35964ebeace97'cfa2b201f85bb1769f56f560cc07cae6oC_U05a65cc4f5a44245e660291e84c5217a[9f9e9f34e804de5358515c1aac970468f$ 8U7e715bddba8e92b3a11f18a731f48a8df2b750548eebb5d007d698246ead7aa1@L :fU 996792e961ce58ee9ce34dea3546414f-4a389f883bd01ec8458cae52def05827:GN$V)jd0683e5ee521cf32a3bebadd421c226bJ2ad1edd7087a5851a7461b5232ee55caj G5iV 6a3cfd393ca282e6edd2386cba27e994Ba3273f70d8ddc693fb499e0f322c2c26CV= f9c3f90acf2d7a55d0dd3dad166446f65628d8003c4e70772727702650489cdb6ShVSb6f0c9dc8ce3e0662970efbd05dd7d29b;efb3cb86f0ec49af7a7bc1ad7358282al|$W"5598b21c6a10b99b19387f0b8942f1b9814db30581f368201357c9588c595a5deSN \W9d35670feb4f480477d508f622b4f50c#bd36b3e7355f8ab254f287acd075aaa8PE.{W!7e8fa3811076b9a9c8358138b83f7df6/sd31d212d66d5ef742e001377acf05f1f[lW &X02549972df809dae31b9e1afa1ea896e_7b45440d6d14c81e4fc8f1f0125771e8:nIG<+W94ddee54bb4c027ad7ba83a8905b66d6@7120270e1fd049a1661715f95e97348cORC-cW$ 99d627b84c808a57dbe88dcf28486426saa10733fbbceea45efef93f0770be77a:#dX%()fbf7a6f81c7d41321c947b1393aab8bd) abb1301935d4281c0a09b727be30dc67)5 X8deb4ea50b7efa9f24ad45f150e01577,12f0cd9d25ccf2c43cdfef907465df31GR&X'\8508665b44e339aee84bf985a14baae7ecca8490b74849a31ff362061c44928c87b$C\L8X#06384e863af02f7424f287e7ce0721a70y3e481bf69b1e6f718d4c0270f99d419b|G?X95a47bf2757340d265094db7585844c3/4b00582661002cfd24c968a4eeb476a2cCr QX*,636cbaa336ae0fe20aa7e6f21b5ef60a0jf628f227da7649f63493ca21ad640dd9ZEnWX a9b283ef55b7a4d32a4c57183f79db3e~0c56356b0feb86464151c8f125b4018e\~8#LX+/afb47cdf7839793abe4d445ae61d0b8b`fc28463850e8284abf44cf253a07f49d0 G@X379c92d20e26e0a8931a9dc6ed7b0e2b6bbe317a0e4407e70434eefebc00e8da1GX. a978d36623429d8b428537ad2fc2915dV1465166f331f2953a29000e6b3428df2.Sv6X-3#5e62051f2c2cdea44bc75c1dbe0b21d6?&c1ebd7811bc77c23753781dbab8273aeCb+X32c96a20d0c18151e8c32359c82c16b402799e0ef3b46aa7091e072dcbf0262188^3Y14928efdcb43ebd7e424b2894dfc6dbb3+700ecc02228ddc8f8012144ceb779914<CzY25a04a04b50fd25fb38b563c6fb3d9da07bdcb47460c35eddece59fbb997fc6423 5G~`Y216ede9a8d24b6bb831b73b2ff39cf9b8402fdbad33c6267dcf1fd184716b032C~cY4f418bf69e37c597cb4f982fe1cd839c8el93d49f4360e34c5b9c67248f2a420a8d$QыYP?5c77649e916f4862ae99e2ed848d7bf0A/744b53ea368ddbeff37ecb2678d0e17aWyChY 9be88bbf60f7fa094d559f98a53ad2d439c82de2db2a3ecad55e1c5246f82218G`Z79O4c215f9cc49289447c8d3debe30e09d70a1ec1b643884af7983151f0a90a6f88 /}Zf0d1c474dabb72131b3e4829b84964f65d17070df07c7568656b3b30c604b3f9f(GZ8<39b0b55186c1921a81ba6aa3ddf44dc61b057db4b64e696d22103d72aafbfd2b 9E^xZ>ec8d7bfb6c0e8b57cefa080c1a1abbcfgWd114a9e5a86afe39d995b00ce87b4ba2 Gt [;V7a3e4b33e09963c8d7e7ab52c0ce0b5f,9145e102347356bbb7d181ae2bc1f564BG[:@b9acef170ddcdc81662b1b7d8ddfa7293948e823af63b2ac9cd1a44c16ae2f58 ;Cv9[c34b2e796ce1b63694c305c923a1da29c@Macc4dd7754635b75a9c1282563ed8434G X<[>U2785b41047993aadf6db64c8095942b4 Z11f0dfb6de21dd24aa33310d79c922d7B9FJ[?B131455d2406438eeb355769228cf003f37661d36ab779a13a06d9a9204b034776'Gɲ`[e4d7e6e030e1fd31ac8c52aa4e373482ad4074c60f2b515b5e7bb5a2afaf3fdfmDG[Adfec1d7ac41997555d9d5e85840f077cb4515a50f33864247a3433db16e1de80/SI[=J8fccbd73a4642fd8de00ce79858ebf40[22bb3cf0574855a2645efa2f916d183c G![aa3f233677602ab7d01b40acd122012c7=dd843f6c05f3e6aa3f8515779da970f7\DFd41d8cd98f00b204e9800998ecf8427e&d521d2d49afa6f27ff014d84e4d06688$t\r\t43cce4582e04860d485d8705365093beS53bd641f4fe65a4c5155471db7afa445. C4]1\EI3cd5f97fe1352e5ffa4aaaecf7bb04a1573d39b7342b5caa87ba9c867a237e33%82\508f959ce379437e581cbea68695c5a9<88bf04d5f00fc78f9e5405be4c638743=1G`T\H36c05ed57c76e7eb0d38bc4865b3705c]59be9c2f8f44bc67de81203b6f54b8df3G$X\GMVe267584e3f6ec19421002cc1b55260d19e81fcf131d6fab384db3519bb4d3371A=+<-\21ee0687747b903ee47967b62000f6c7B2498d56bdc6f42b439354e8544524b7cCo\Kf3b855a1a0d140029e97cc2f3f5f7f95|feb3faa9a291f3a79640d48f7bb5476d#G+\LOfbf29b773d600559d280855dfb5313715fccd85f5c10dbab3c2aa6d3946737a6'X#]49be66b8fed4328ff03a413c40ada39fbbbbe0f55c8d6c33620185e739cad2f7=|1L9]N aee3fa0004fd6c9d2647c2b431fd1473Q 00af55cb0b923e524479294ca2c1daa6!Cf]C]@e3cff7a98fc8501aabc356be0f3ac71040130885f27ffef414124d366e8d67fcQ=#d ^678585de50ab03ad805595993240c12700c0f589c2f76a17508cb70ed7d9fe40U:#29^QS8d40f67fdca0128017bf3920cbdc4acedafbb197716bc5b646ed0c798d73352c=*GqN^ a02806ce2e14a3eea8ad596d78046e3b19774a2c889c0156a42f97ea8ce6d7f35#y^RVwa08deee764457c0a3ee28dddc73255a631034a0cbb1214c92291352c3b18e745-<#m _d41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688e;t\rnX_Uab1cfccfdb42c5eb6705d9d6d4455f43\h3f86d29c52037f880660ebeeadbef5c4L$C7_TZ 7b25064234e92ccf61310ed85050b31cIvd022f0843082052da9068529e6a329e5CDp_325b419b3d39a3d0243ff73004822a111a96bf21a0d03bc4409b159e3c59913a2HSr_X638ebe8193986a55726157085e3969390b22c4d35197a2e4f159a37b7b264ecfm3G_Y\47527242215e9b1bf1c3a87274c7499a7i9e1b659fb8e219d5c41dda4fcb25ee49UK _695f8ced6af2d18a71cfaaaffc4865c4dSdbb3b92b931756e640cee795a74fd07a;!Gm_[|1ccb14f6e6678a62212c05ab85c499b9E17beb23cd07b55b1c9cb1030854187f0U0G2`WcS5ffe9a7af9e6330ac03d44aea74670fba0d3623b1f3555c71ca238b8962ceaf3'n3G`c3a6089894f73e8075cf5ab05109ad66dVT4cd4fb5537cb3438442a77c4184edf0a!G&`^.e08bc29a7487e0423a36e94a34d5117e 475bdbfd970f0f356d33ccf8bfa6a130`Q Ԕ`_b550612d28ff95dd6baa5877abce97f27~250022c38ef65d9390be2e8fb7a2ae180G` d77b0d54129c2dc87db5fb6a4773581a 511d1b7ddd789a31684c5d8a51bb66d79E`a43774b26edc83c240960de9b64fb82fbZx00a62561598cb6db9a2c466e4085764a ! Gd{``f[eaa25a1d89e7d256697e1deaf13d38db616c5ce311c5853319145fd5ebd0a9d61z^`dJcc6c123ef439e445caabc3571271e8e9`ba08edc1cb3a2d75fb0a0e06fa3ede0a9 d1ad70435280e248dc96bbbf60c0c9cfd363fd56e4ba5d3ca51bc4ff2dc07d4a9257w5X5aeh( bdd081e45247ecd4fb00fbed7d088608ua7a6f4ac52936c48182eed1f53e7d4a7CN keaf145e2cb0aa881e91add1d3e90ed8db8J72017fe73e136be1485c9c030027b6f7_ Gx#agcf78fbba15483ece1b59e4937223ca1bL 38009c1051adbf543b68dcc3bd6f9feeS CMaSb6f0c9dc8ce3e0662970efbd05dd7d29^;efb3cb86f0ec49af7a7bc1ad7358282ad{$;b1daadf055ada57226bebf1fc8ca3128a t4584a84be065cfd1ac80a62f65a92bf89#0bjl05a65cc4f5a44245e660291e84c5217a\9f9e9f34e804de5358515c1aac970468>b$!bf4acd2fbfa41c5ba8c602f5287984dd8'8cc07b3d1f72562fda382529c34094d8YGN"bkoO 2a1af47c03030c8623d6ae323f3cccfe'adbe72921f5681386b2bb39a3ba717e8N/SCb5a81212a7688fa9b039157d0fa12d73738c05166891e12623b90169c058d5709fN#GObn9a697113ed36a49259853b66ef01667799b861d5b565eff65bb87c642ef3332aaQ bms58011ae36e29319feec62079fed3b2b5 58841822009d198f3c4b1478eef13023r]3G b89dd32d1d81950e8a740fab395cc02e01fb0b7ea16553773c843377090f0eebe6G' bq2958b3158f494fd2c3e029fe542fa021593de77d9e18e3c80eaa30a851505961agDGLbru7da3a5c817d3439f6111ce6f06bdced757af593dab78b25cfd254cd69c758ef2[O1#d 3e64bc994e7e1006d4cd74f8f0fafc9a)gd7591704a01547599d5c2efcef66dd41^qCd23b38bb0a764a2005a0d6ef575b801a75=b8fd2d0dcd7ea0fc464c8b3f7d29beaat6Gdv428b25fd90b9f69eb1563d2a32841d159f4c513ec2ae34ec56d4b34bc1dd298f}E;d=39639c7e28be6c1a4f77409126e16df934f2964a429699e798301a613a0ea831Id|,657420e9ac7f51d02dce95540b677d4c fb28e8cb3b3c10652968bf167e975d6d+-.edf9386e3ba7b5dce8bbecf229af39732_c2dc51e4bc37d3a9925d8a68d4be8394m$G5ed41d8cd98f00b204e9800998ecf8427ehd521d2d49afa6f27ff014d84e4d06688f t\r$Gee7d9fc628f1759d16aec37f65bc7501204ec1bd8b11ce68d2ddf337b2c9ee1c2>F;Gnej05f2b0cc0e1e9e5a5326a5afbc169317c466a3740962dbb3a813dab4353865dbdG$Decaffb4adc3a65da5f1e780461284835c8417c3ca4496731c1970654896d38fa6 @Gef4e560b799c798e1bf3c0396a11a392c:c2541ac6cf596d8a05823c068588c6b00mGedd03d3e625aa1a17a8bb8c5eb97d192023fa94704cf563b012820c803046ff2a1#ea0aadbb80d441877c0b8b43519b7ab07fc579244fff61110297c8d2da00cdca4 7Gۛe b16654a9607e83fb370aac9c369c25e415f2dcb0ee484988c3cb1bed7c9f20836Saffdde692cf26c32c4f9b12f9c592e7d0bPdee0b64a89b2027add3b018d3fc62b4c!!GCf 4cc3e5be383d1ddd092e78c8db8aec868456883b49b0b538fbb007043d363410 hP )Ef 135e9b7af3a3c308194a33c2c108acc6Wf5107042f1eeba4a155d83defbc297d6`L"C(fQ c476763b5a221f975f5eefd05c7140bdwff81052cf7bc824b61a31269c89e9e3c:GMf16d881568cea817d21483b5daff5754838b7ff76788323ee9666dfeb9d9c41154aX$f37448dacbd789d29ccdee7933fdc4b345550dc4a107d714cca725f15a77615d77G6&g)1f861e9485045cb8e257cd91c2a3b9f4, b276130d6796525db71df4157dfb1bcd/+SZg.9f7b7878b70772d4e58727743d8b091ce56f2d66e0747164770cbe9ab60862d1C4g6150eed094bd4408f1209b82ccf86a4e 47e7a5434d9c99ef52e982f4fbf2cfe6 ]'{phe56ed93f017acbb01f4921b9a7a52058I5ab62c0ea6953bdb709df5bb36909b23 phv78ce738ab34ab7b41db82fa631ca7ab3?5e7f63bd2e171ecaa2b68ff56f6ef23d?G if5f74727971d937dedbdec4965701659,52e06601210b1b219c9ee13b7fca89fb/LGk i33cfe7f4112364e8f63597cace4b5a1f,M0c9d71ea796c29bc862ec1c2ae181c17dFGwiRa433015da0b0a02ed2a812bc007330322a6135c26247afb8a708641a3166c642H?N 4iqaa11b5e706d8c3e94410f450c848564f 8f19b3edf604e1668e9ecc5cb1c7994c-8G_iYb490d395e65603ff5884fa0338861d37:9cfb16075abae77c107d571a00d71bd3DG}i6af1e23da4663674084c34c51bb6a904bd18c221f069c4b4b664dbf806a8e20287GPiBc4c12e602bde16d43279d588d482d9ac9413e35b719dea090375900b8b3457cdFC8>j3d8a04b02bd93554bdf6c0159d4db986bi7e7186f611447ebb9f23180d47a8b7e8:$6Cj)05bd404cd154e102078c9141453ee918  a551354b97d8329be9f8c0e38f1a7af0R%Lj6e369c23536bffb936d3a8760b328b13H05946e6e0c52b61213f340d671455b622H P[j9154e4e23593f244acac7c1d92ba8bf0fdc44f46ab705295fd72a01e7f3757caB@WtjN0ead4c36cbf78544ec34372c8d341372"m9cf62ea954256ee8eb66ac462fd6d6be Czjf250d09048f5ec3b1fb6c6dfeda06319Ya8c7e8958a383dad7ccfdbfac2947de9|9#[j)99b2b39a9c2cdc051c137c7415a32360  79f410269217aa681508939d7b6eb520!W&m9k"c3ff584cc54cf0acd6abbaa2fa2bbb7c32acd958d6d170e8280af4e2e996e6b53/Gk1601d2ff91e5b3529eaf646361214740^d7d9cff2edda7cc2baf948d7a1e1ff65#G~]lofc34ddf8b4dc2c61d3376c8408b91b809cdb79845817cee06e3f6d66d076ecc0:#/`l&32d7afd097b02477c51e5394b19bfbc693a85dc51c597017b453bead919a8c9d%QGvvl 5672e47c0011ecf15a41bc1e42cd24a4Ac81b964df91e28ca476432497934f438[1G4yl635dd7cbb378b0e7aeb12b4025a4ed676341c2ef340e3acf072166a60c2c08c4Gpl774fe2cdfd06fd38c5f2fb0c77ee26695pf89a6cdb356163f78569380c23cdd7a0G%md41d8cd98f00b204e9800998ecf8427e)d521d2d49afa6f27ff014d84e4d06688z5t\r)mc405753501a020e78a72e863e12de5055bff73837ae31e08717726ba6ad48313'@GJ>0md3920deb07d0eab12991c0fec96b998fB1a228e7d5f63757435f3ab46f05030acbwGi`mScc7303e5168e8f6e7c741a60c96ff77a#iaf3e4d184448dbd343d25998c9f064f4C̚m94617c1681706a9bf0a49d99fde80c1fFy1934c11523183d300e5f845629f79ad1"^G5m5993d6c22b5fdc3fae5b8d3ba14e0846a0094b2e9e03180eaa3dcf609646cb88Lh0 Z-mf549a5914a8c8679bf8e20e818d82296;bf8fa552927cdc9e14e44c35a8abec134\m"69fbd6c5fc7e17d024bdeb754c209d60'f27360752a0e5e9577018af6e4c9aef5!DS?m71f8b9f820d94952c06a88ce8ee63ad31adfefc5f74a16805f0d77c1495aedf1ޡ9Ums318acdb76218ac8b6317cfca82f6d99b85a4c048cb46a084a426860f3872345d~;)m5bfc7458dbb6f7de895c294c78121ad1e4cb35d15100ee27f50da929bdd897bd@ n12589d2354a1f5bc095c2dc98981d12dD0e65cf6750539c7377069c2694a2cb42Ok;~`)n52a31bb5a586eab62c0223e617c5ac7ee2cd92851b391f13124b51127e45d264dRDS7nl ddce52ba0599d780ed65f8f0db2ac271d674bf3990c0d8f96ae19d4f04cd47f2{G]nfefc3ac4f4d6ff460779c60ae1c120a73?d8b5219a10f979ec21778ae5bef08598 GTnc0a49e6f2f30671abb5b551a9bece823ca13d524a23efe661678e0ebbfb053ab360Gqn@17acbf93fca10c65b871bf1fee11c6a852978b4e3c46d1c8fb12109208292070t;G"n' 90d19435915798167364557c134aeaf65fb0f832ff21de66ca4b742ff9bb4b3e2S[Cn93733093b4af4774cf82f97f2325da04+ed37301106fc58f52672cb157801dbd9MGaoSb6f0c9dc8ce3e0662970efbd05dd7d29^;efb3cb86f0ec49af7a7bc1ad7358282az$Sjoc3808a6f0e176caa8e0e7117bd807962acb8a006e4459fff30b5a9e5d6ef6bc8yGco:47dffe784ce8e2f317392b605eebfb1d8x^ 3f37dbc366c3f2e5042ac00b75f5d983%c=o=11ca13c5024e1e703e1e8b72d74b540e%cb46adb62ed88c2e8951919302c5f9c97TOoace36ca8dc3a1e218c05ad41d1256195ed073c8dd463a95de421c7cd27a0fcc59}godf280f0cc919a0fddab67b158891a6c33 e015af960c425e322d45b74cd30a35915H3Gpxc3811044db4764c8ba1c6826ede60e38840d2cecd413e386217c91851391114e8C-pYc18f613f4334f62df8314a508423b72aV8b3971bb6bd5de4a547e3537e7a8fb65}"C2p341a487c444641bbaf55496254c00f51 tb1c1e700ded4f80f4a6b6357aa48f04fM(=}>p36dfa2898583a06b34ea13343fb9df6673763787fd43752355adcfffe5cca5b9|4LIpb594c0db41963c41ad725cf7f212af550aeb148902fe452167e101a549eedd77r0Xip870d646d5ec5d5c7947efefabf14826aeb8a11d73a8d27d54c6d81809cc636810g:#:Ӻp,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14-p721557dd7947306f449b683e5bd354b919c30afce0841712db751efefcd420e4ZVdyq d89bc5115c309f9c0288e0d5d4746c4dKOacc479ba7493277d85ad32a4f4204d72G qe520262ce9c73aca79d9c210dc8699ca39a97472c341f0d44f09713543380917~C/q75b74c9e1fc18a22df5492a1bdbc16a6(d19f7f4b32c6a55b8a671110a3b3d10c+\G eqb9b6574fa75854c4a719b5fa206454859]2fbbdfee604d1c95bdf0e3499d425d45#CqS489fc104916211a9d2f44c07cc51c2a2\bc5cd7fdb60ef374f588ad3e49e45effyH/q^b2ee13662c1ad5edddb73ab77722985cg 70c7021b19604fb312f8c7c44e7b5ad0õ G] q92bdf80c006adfd280ecfa6cb527885dZb9ac62a4331872a8931d5a55e70b7c4aU 9r60c5acc24728dce629ab48ce65c1e633Yb7ebe86555bdd8070a9b2969b4e539bf#:Gr'100843509cb6b8d9f58a7e96d539f2dc%0fa5c79a02f5e6fdcc18e44e68194ba9TGGr_57f3026a9372525ffce18965e50062a80d7f24095e68c4d4e201ee5181a50810cPQ s2s/407b29020d7e291f59ed67840fa25a8d cbaca97807689f701a9e39d15e573a12T/9)s[e6cc5944a1664f850c12b661a26588e5@;d91d9484015cbc83793c72d36ca86709G ks1cb3b33afad91a93f1702f6e0478ed70cBV d7c4b98ecd78d6c6c5a6fd6f13265c45ns6583b319ba2cd40fa9a8e27b6ce9842412701216796b7cd06fd999a159b30609d2D&׮ssSb6f0c9dc8ce3e0662970efbd05dd7d29^;efb3cb86f0ec49af7a7bc1ad7358282a{$s50408b15628d8669a04940e966f92f848cb4a2c42c39d1223e86102cd6f748d2Gs4b9304cbbfdad0645e842455b974c1739;3dede6496f7bb8461bfd5dd8a0d263f9Gsead6f0a6b78b04b4295cd75e575832b462f219a8fef430fa1a53531993464f5b3UGksGd35c28ba53647851775006ddd3b9d8b4S:e540e9fc0c108012e99ad6561949eeb98!Gs7925e14fe5e8af2cb8bf4445fc517eb9M22ee96ac5bd494ecb53bc7756fa50fae~ C#sE528419e831c2815de9ac1859160842ae86c96a48244a19a80cee9a2cb018b645/S*t3d9ee0ee5508045b1bb1b57fb15e10cc]i9d0707d08229b06ee8a585cb7e151092'$C:*tK 7b5699eceaa3d7e3446f1cbece4bb895kf4cda03db9a3c7baa48b469fdd69da1bM N Dt e8b8e3349dd655afa37523f947ad65cb?F1d50dde6c3ae06f969d8d062f226a98a8CQt~d2466df5432ed1bd0f2036c5ca746a8772e1505935f3b18a55fbd8c3f15e2222XQ XGat6a5f569b28f9ca28b86a0afb20b759d6932d6b96b93303257e02bba8659c6e8f3Gl^teadcd79255f5ba0d05b0916dc3afdd94S;80343287f75ba0f4d1ee4ce7567f12b3 Gt3685e468282932da68b2ee83f644a127ca716a5cabab35bf96e500a79eb8ded1B4Gt3bf6cb8d38e3bff2c1352270e3c7237e[V56e5c2652ce5048305959f8ec14f2c80"Gu0d77035f0aefe6e0457438cfa71480dfec28cef012d7337308dcafc295b54432,G߿u{96768568cf58dbd96a34c6d75af49147Y8501f393361ea7c585005a8da079d6a9Cu,367b68cc00f6125373d93201759983d1D443c9e5d9c0ed56525b497e268d55b60VDG u'3032fbf13e457d61cec6a953d9196e1983dfd55ac9b4c2a398d79f9364d061cbQC#u8bbe9107587090955acb93be217cab412G6e582b1f3028499bea1a4c014e94ac2b;WCve7904010a7bb0764983c2b5aa9a100d7P`429f3ea56d8848903ad768fdaa6f97b8>!Gv5cc5aabb36e2a3cc1e96022511fb7e94|0f97a5576afa7963b7fd7c350bbe18d2t%3Gwc8e20611b4473be398fa67172205ad46ef34463035b6ee281584b6479d9bf462Ҳ1GLw0011dc0bdc5866719a98ea518c554ab296b014468d56d9b8126770f4e7706005-@G@Mw$9415e76bd3f13187a375cd1cd35397a2f0fcf428f7aa99474c768e66bad9a1f07G*ZwV7a3e4b33e09963c8d7e7ab52c0ce0b5f9145e102347356bbb7d181ae2bc1f564 3Gpmw% 442e7b0f4f17755be67826783540548928c964a49a957cf4de225d67d55dd63c| bb9ffad9ae2d7da827f93b3db8c9d417237dbe8ce6e705e05d0c5dd82872d72eT^0Sm6|cf4474fb7bccb425473dbd0f119e4fa67c31a0ab23a534bd82c3a7fd50cc98b7a4%O>|,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14+-Rm|2b4778f0c346b891000b121ba7b99bdafeca930d00d55fd9c3c277e06a51f7d0'w|bfaaaa3ed87b04fe5fdfd7815a742341`C2ea797803ca55e2c3edf0959607a3cd8, r|7a2a1b7560c99778a9d5bc847c5f7858fd20f7810b99a351215926dfe35bd0c2G8|+2c1ece490dec1ab27c96f5ef29cb8ef8KU1d14e93782b55a507044b56f4a5d1b42J G<|3399e1d8587830952bfc4818bc6fc930Q)ec688398db3ce00938db3913ae9ddc90 C\|!e31f2779a5d357fb2bf47fe99857e63bbfee60667b2f0c79701ce8bf31c7fd4e7G3}Y6b62cd18f2d01d02c8f08d7ead330523f6c0cab32bf8c645c55f0d80560e74fcC0SKW} $ 0b58d17a8ba8d34e5b170c04a1dbff9eH65e178d6ec5ff704e8a04da1625194b6/N p}t b68d3a96e04af9c54f3793a6d503036d7ac13d34263d6269ed5bad4ec40e6eb9ƚBS}#\ff4e0753e77922c111ff69a5c901f3c6dcfc0a9d12cf63318c69491b12925ed375$$Cu}"(9042b8a7e8bf26e6af754939b9945bb6,e193cb59f3683a0fea0f432328dcaeb09G+}bdb3053ba59b3d603aed06c7b631c3585675f5b596da8ec28f36e91ab51574cea4$8GW^J~&(8ce25c8a963d22d02d3fbab0ccca31d3e63af42d0066dad8b5c7380ff5a61402M `~'*d41d8cd98f00b204e9800998ecf8427eCd521d2d49afa6f27ff014d84e4d06688" t\r}~l3c7db1053e9c62bc46af6cc0469eb9c26fd6b8fe4196f97d30fd59d91df9cdb5 1GnU~) 6860e75824d181cd5303eb35ceb7fb71wb933843c722966f391abe2dfbc25ab0di2441c81cc53c5ccbf0f0c66eb18a5830HO10e7289911191c43ccee21da93fa7effMFw?c0ba6f9a60a18f0029133f525a418eb4e8e94f5cac6ab027739220e4cd1bfa4e?{4Eu@C5b5fd15763962da04fa5e90f848688e66!ee57517c20368c15b21d8807722b3be9(˂Lf6a6bce2eaf7cd05f673fb131307946b|ef69ee52e0aa0fb0b40f7d2b89303f51 i0#KނB05a65cc4f5a44245e660291e84c5217a\9f9e9f34e804de5358515c1aac970468$_$_>K52f82467e5cf9c1196a476229adefb8534ccbbf92d358c15eed28d6102ff97adaVGr%3fea8521ad4a0a80850632b7ca8f99b3L41091c217b06d334851cac6d9a31ae8fVEG6883af2eaa2b00acbcd62f215f2651c2Ra521294f9ae051f4c5a579d32db62e57@!Ↄqbd3f58000fceefa02edc5fcf2e50604cEve5c761dc5e89e1ec9ff522a0b694ccaaFJe3de861ef987aa8161e242e87e70fa00 1296fca66d36482550280b9c193e222f 1KɃ|6f3bcb252dcd512d8dc6a9a3e91a3c19Y6666fdd5f343accce0db0618beed15e3@#u̓I%a561db54f4126ba39895b3c4262aa7b2c2c0f8ccd32254e73de530271ab1e32bw$GyHNf2bb5ea29c7177e313be1a67c73203a2,e6a00ac6f687e0f001b9436582b08456Ƿ*983042e183f97d7a6256dbc53e797a345 {d39589d3a793abc73daa9e0bd6340927H9#3DL88566431fbc619284bcee316c2364fa82fdc3c98f0a7c5f59150c30d3f9f24c246 G;EMPd41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688`;t\r l0f34c671811707fcc4d2f3f72d04f370ala0cd0fd58e277848c71e9973e88b7b96$O721e9c54f6a1044ac555769b9d35fb4dbhea9da3bf7252b9e26526ee49bf175129~$D^a8d7385a7c981986b1605a037eb197c7cb0d508c16e3e0cf4b0a0889b1e247e0r*³Cb2a6d9b2f1eb0397036555f4eeb85ca395701704cb6aaed3088182cc5cea7ed4,0Gf*RT*91b613c277a71480a76a751c8429a1f1 y 0ec2a2a75996d74107721e648c8a9932&7fad748ad9b212b9c6224c88da4a95f18d4eb5f5a01e75a9dae6638326e4c01493HSW4089ca820f3c322f9781d8e7a4048560O40022e0989f004278e9ecbf43e34c4d6Rj8Ss[35e9fc060387ef1a9e87cf0a4c713ac5X209ff30b617795d1b2813c06537bdaaa!C[zVGcb80449901c6860bba5497eb5d42d5cf4273fea683bc478d904ce283f15ed938f2CtU[5550e7b6b21c63a678feb7ef300e2e6a 86909ccb119db8c5836b7fff3ce265633&=뛅31c5e0c409831f8ac52fee48450a0e2fqf90de8390b682de6988405d34d0774dd)sY_f68ec2f65603dbe86f3ba9d8e04f20f6A0 9a2c80efc845744dc4303341af284ca46H ЅZ]5aa977437bb82071c54a7041479cf6d3-8287af4f12cc55da863cf05c43ba6814zGgԅ174aba1ce372429255b06ee99a5d91a1`85b22a5ddf45e750acd9ea75a5ef24f5+GG\ۅ\31514e7d123a7dfd1da0ed581e167a9a"226d23985ccd933524ad8611c863d37dZ>#l4Xe2787970266965daef4b76a85b6b7110d$bcf8b1955db10c1b254dbb1d7693107d Z1Pr)866dfdfa80e6fed1132dbd8cf32a0c4bG, cf820dc0e914f35a108eb177bb6a9de7x _a- 22625d7a6b499513304ce959fef8aecdge0e9d4521b5bcba32853035fe7ac9999_ G3: 7e850aec2e86c5901cc188f1377e8a221fc58e7fda1e93fbeac0392b14d437070$C0G`de87b5841a6dbd2a584b732616390c395da58de4e5e7a468dfab335e1e22dbc134k1376ec344f786d7f2d22ebaa2df58b4d e95873c66eb0926ead2a2c86c68338af.Ͼc348473d0e3a78c51b5cf30e622a0921739a1dd43a5287d9be5bbf629b3c45d12Vbhf82449b347b8a046d3f96bb38f753aaa_631f250de44b846e5cddccc1f7532be8LQ 8Mda8d017105e04380bf56cc8ebe9febad5q2d509dd8d67e7f5a4efa094e55625f88hGf}c4f08ca9593fb3a7f3ddeebe6ba70b2735a765e0061a65f2cddbbef1e84b11d0c!Ggj cd6e2d3010f371322831f6eb3ee39a976fffeda6c1c3c5011ae4e8be3aafa060[.Sa0c2ab24008090a11bc08393bfde3e115Mcdb47cc8ab2ea0a349fff3eb8d05784d Gk(i4d40be7c1c8eb0cffc5b2f987ef5cbd6`0fe86dc0c724a265227409972f776fe00*س.Q8a3764cdf13c482d068fe887f14f753a3E52c4ee94702cc40bde313f4f225ce401z:1d921c26a20fe116adf5e7c04683f66a12bc1624e73e25412d2b31d61ff29ed135J*/lnKba714a0e06fafefa29bb46ad6885b681Zfd5b02ab59c142a3b9ed2d57a55f6439s5G9ff89337adfe54f37ffd191e66210e39c00da7a36ce6a17509ef68c0bef5f138fIMGqLmqbcaffaeb6bb4f53ab128e7afb237059432ce964572da887f4cada9aff87c98fec|18G]!d41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688.t\rQ?p498e70db86b91c313861d98483d6f0ca3sc9605effd06f551e2b0c44239e33de1cUGԧoufb8dcbd0cbead7aef0d3914627c5204d173f710b299a14330186bbe67d9d6161Cr;dae43413ab699952bb38b5e785b560c0 3207f5e39599664435c36257c11427e2r%G9s62aef56ddb7e8c51f5694e2f7a2ceb8b]S3481d408d6ea08d878c670b476431e4d^#C etw502d4039177b8e9187b7e7d54eace303y5d1638e18ef9e3f78b72f788f4a5242dAK0c2f81eb680712b2e9a7e95ada7e6ad43408bd275942e156b342077377ac188f@!qvJe8a458dc8713988b15673c53fdc5ade7TPdd79f24aeeace9a55b9ffdecbcac1ac6P Cr16ff08f901b0f878bc9f2d518af47e35/29c2b4eb7e2a08cc16890793c0918c2b/vQ 7f63f44783fc034b5339774458e7ff96/vd50c0efcff176c87e133674a7d4a2a58Vxy{`faf5bb70d830cbd5fc79314c3b6a377ePa70b7862468a0f9e122890c13ea0fe39P G1909e5ad2a891b9ad9475ed77005a337510b92d572b6efcb8dfba8251bbc19264[0G;3z~x)bdc822b87cc9d571ab7b4cf5259e80d3j d70bf9526d02083c91ba05311562da8eL %4a3cc20d101146d801534121052c37ec5o8dcb826acda31a5a00dc0bb7daea6e0c(GXm}a567544608a3a0fab3e0160e31b7d136[3567124119e69c52267aa2da01ce6e23L$+|j51c9749e60a1a206723709274bb0fd5f 19aa1170d184d3c4facbc3bebdc8fec5&3G(Aa96673aa1c47ec75545db06a1f5aa89e 8f63f4929f37eb4594dd865f5fdbfae3^=# dY6ae314ffd5a8e02dc8df7dda5e2acadfef6d4e44cbb479bd43f70a2d1b06d1d593 lm쌁q8754532b762d87ecad35ba24aa1d4a84 bb9be7907bd87a492a5df758d6bb19a9C3G 2d6ded93782c1f93f0aaa31d9a6bf631H957dd45ffb6c3fe3e73234945793d3d1A. G1-y47a35a18f1ea2c7a8ab90e91c5924c75 6c61d986cd77463596127b2d414b6b65ý8G<90xZ6214a47c8056a2058a39a00066abd0fa<)bf4bb36145337a20bd91851ac17f6d22GA45af8003c8d12af0eb723998aac2e1449Y2c3b1cf521e33221e848206263fdacceE C@R746341d837ff2c142837920a6bf3d52d2d3676341a1b443d25b1d8c52cbdb46d35q}b 2d6f87498bde0d1f73c0fe6bb24b4445>be8f4d5cb43ee4dc22bf952b38d897daCS W\160ce46f78944327a37a3ff78f3a4b80T420fa6f914bfc124c0c8e2fec0888618!G(N 3b7a109e0e6236eb5eb3fba56146be95D.b73885ac5fc822328f5f0420ccaab230_CNǍ270c2288f796284d26db19eba549a0a7)10dcf9f6e6eb801668e316ad3d847555h1Ӎ 774e4318b561d3bd6703b0fbebc8f619 A96694c0159a4bf4e058b795d084255c1Xo(>] 4c27df26fec023258e9f2d9424354c36R00a14c26e8c0a0123e6ca2c7c3aebfd7F!C鍍4a5539787d4e7823f91789b1dc62c447ee62bc8904f6b6e5745566dab42980f7@G7_a43537dad7ee7d708f5cb6c54b2a4674e39e05e35574c7f9d5e7a462c915b80a0Hq&9cf1fc71c21d4c5290bded41ca01b286f;?ef3f7af4aa5a9b44ff8cb78589150d08.GY5a6933f22b616eece09e74a5e0c8c939S68d0c037127079c8ddb114847ebc5da4?>!H[cbc94e26bd469f08d0e5a929154653b7 645a10c186a4e3e3055723835c73c238-5\c7a820589df6e59af0399e1c2ade90b0 660865f055ae59e9398aa6f5a7026306gM pt ec64d75b178237d4dcec48c1a5e48140R66954d5c1584e5b7680416cc4b9d02c6q!Cav31b47f0c12e4c522de33a57acf2364b7d bb8db6ccdc1e73a9fd12846d8adeae66+͜t41ef0af9c875f97093558a7ff67354f1cb150a88eb6514395b467b144af988fer3G#A2aa4dfb1cdd13167b2245b3664d3d982**70456b5bc755b7b4080f6371e2291f13!(eN392271334dbb5e0e42b701c2075cae6f 98cd5797e5543314659e7b8627e84d0e`H#?7ea4aefb0fce1ee544dadf7d81358378e7879143e0912e29207a84cf2abb1943/#>\ec2aca6a60e2e2532b9e2b26c4b85d1edcd69baf3d15f1a930cd3981f2a42c67d8$C m폚if81fedd7b5fe7e9d7f4c0f54a95766ce9b6ae956fa5619b4c9e1d73565b4a648i3G"48720417838364775123a4acf35c82ce e4560bc45253cbcb822e9ba1ed5e38c3X9G<435b61a5944457c44303929932cbac997b380de8a73611423c0c60daec88ba7fӧGV8k05a65cc4f5a44245e660291e84c5217a\9f9e9f34e804de5358515c1aac970468`$/O 36f204e2fa56651f0269a6a25c255362R0e9a68d87aaaadb9d2eed84c9d3a8c865}!CnZPO6feaa4a808a1f3adb1ab1a798bda8e7f44f8b39272c5e1a1ecd4c60dc332e23cs>#.a24f429a7eda688b5f270abea715872c2`a1f77d6a3af72917d91b84637d2938a7 Eocf28a0205a334bf3f5d48e39abea42ce9c489ab474a9257a692f27eb1d7ced79{葐18c92ec04947bac6842249f63c34d2b4C04b95b6c13847d14c834e1e2d84c16e1' G;j24bbc5d9a1deed967091e404b35beea6s6f34fe2cf50366e18de305b23c523ee88f9G*NƐ4f86b9e2adf7db609a972bbf71b32424abae6e7b246cd83cbf4217bc1c584b5e\M c00e99a169b33ea9a7f6d341aa5f74ce3ebc6457d29865421e21b1a72559506ad34G |3bf1f7b18002b596fa8667a55ece51b6Y19df6f730f7d16270de264591ebc16fc;@#&E?d6e1bee1ecc971c0a16b6bf12d803687ba201f12f113dba412d86b1b4a093f067Y f86dcbdea85e9ef01d651adcc9393d69b43add259ee932d2ea5d3a9779d09db1f|1Gʑ~ 3b6013f0febdaf6241e2ea89420890b0>b7dee42eb2eb6b59dc71e2d8b1411ff1QP * 0342fa25e29a82165bd36618c7e72a85ede484638fc427d7c2fcbbe57171a4c7@:#14cfebae79beb33162617241f1e63d35ec%f3eae867707e3fd01958759707e24d85 H18(b23df0eb1b3608cc6b71e1e5309f9cb8 6940f7951994257ef43a507c4cb5eb59E#*^16d2e7b711329fa3787dde091c0650b3bm565dd25316865cca6af2998d3c452f47$XF!o b160f05198d084cface163d561362f94%d85828011e4b16aa830790647c742fb5'Gq/65690cba8bc12bd1d3d11b7970735a6d5dda44ed0277d605115f6099a60ba83f4 3a2cbad146900bc78f0a53b60de6ecf8_4ae55da39d00051b5ebf4c89370a3ad19#糓Sb6f0c9dc8ce3e0662970efbd05dd7d29^;efb3cb86f0ec49af7a7bc1ad7358282a {$ɓ30b34c28f4f08168830ae1db662ad560eRA2e3955ef69b7ee2f1ef276272def9c4bC!ʓxf4b83a712b62db1d5e1c7efd972ddc89A0428b238b4d451e350632312e20673e05VDG,967c29f08a86615e3ef043492604b79be1a62a678649862f2ffab44190503e031 '13fb52a936ec6efd5aaf9f85f381f2444869e43688c5fc3546f928ae1fdb417e6GaFc809199f26e907af38728dfdac5903c04b944c8766423609ff604182ca30f5d9Iy6Z946d7d9b4a975dd646a28429352029e8ba338111f0f17e48223d4931c91c0e2c0Gٔ52dc93727de8a48c28261683b5c636078 0c0a418ec06746307ac44fc4965123f7'Gjc453552608478b35fddf5ac4ff04207cuce0fa07d28abf42e83e1041c0e02ba07=*lU2785b41047993aadf6db64c8095942b4Z11f0dfb6de21dd24aa33310d79c922d739νrcaf99dd6d9edc09b1085b08ef5857c7a/4bdc288c7d571fd88d291f7b784a44c8GB64aaccee01e6d6b8952b84e58e2bf95b4M22def54a200ee98d840ae0d77cdf52855AG63551c6e585d82b60365b725d33711ea0d0f5e5e87f3f77c478d7776c08c6bf9bc2|'F079cde86bbdb28f30e061760b19e0e75ahebbec4b191ff3b4b5c7b7a3fc3070b2et}$<S)51f9488512625d29727a36d0b2ba5b000, 654d32892649ac01cac5fa440db7cf1a.Q16d046620b5f786673aed7a5265252e369 e24303a76b0d5a03749ea0cf7bb0b7b05?#Є> c56a98859c6ed47e48921f610a135abdjb1d4af575a04ae8aad8a953e0ad557b6 G-6675c5e16d8570d8ba8905bf3cada8c6T2f5312e939b45c767595eaf20a2b8de7!G}43ea003c7235381e0c6e0aeb0fe0aef3f4355cdaaacf070e2c51e953d2e90c5841Gcbad5047e1bc76a5b77335a19ee9886f6 R58f2549fc656efa8b2f56e19a369fd9f&U69bcc461587ad2375076e066ee3188d16cd64fe8af766800ce612b40929ed0d4r5&c2285df76420354660c28f7a3c399337Tdb2cc0e4296e93e610396545e26c1e9dS C6a6a6b5cba83c3fb613433831a5fa8fc_27ef2356b926f56118805a533b883c32 GQ(9e1033bf3693f6f421f3258af0f0948e2 c2143977eb28fcee69fc197aa8d24496CR55c0db65c983c0d12e9c755eeee911ed693c69bf90365c427bd41ca9d23b67f233.;.0ab80b435b4e50590db71ca4f7e7db3c598f265f73b77ea66e5189a1a64a4a279597C2a507817e986fff0e5af95616e849d4539dd175c369ccea041dfaff5a3da1dba@Gʤ[c1c3752fc904c7d800dcd07828e8d4a10468b944d2c75768f785095ae5b8c9ea6G꧗a04d3ce47558c60a18f95c16a7ffa485Od35dfc57e0737ed3b45d41d68adb07d10!GٗCc3a60ba17630fa7abf3b3dfe4770f99b-,41b7d2949590efdfadc99234ea014e0eG 9f50dc9055e13f10190eae7a802f0ba6T96a52f3b05d1669da1b2b4ac5a4c5e45 GBAt66b4b3e37754405f7c3df0e62dc9a817<X1e8232604b9784decab0234a77845ecd:Ge399d6cdacf12016557f98b9e91ec755;d4e670ce2d0a9eab1460bbc308004fdd•CwKN)f8b53bf2c35813c059a6323699638c3058f91e5f72fb6cd46b2f475d5b0b211b=#[7a327132fc0b8ece6fd0063f0a4cafb95f845bc43ad76954ce582b645be0c8a8s@)Fnbd45bd358bb32ceb1fafaf317f212f34V\2487d9049c970ac7aeec97af0252b8b8!Gikzd8085bf96394fe6b19529620a4daed4c40f7bd689c51b924dd4e17374262164a*CT 6e3e60e0ab935b12904da3b033cb63ffe5d486662c70545fbe3a5544aef28b9dS2SAK 3418a0c0d03febd7f4d453679c8a07efi123ab5e4a0aafbf4dba7d321bb5bbea3/Sh860fc3144fd1378553d5ab43935c4bf1)g44d3e288bc7b438b74c00e85eb16c848',G'o212043b56420e10177b9e12de68a4f7e5460cec3fa9eeb62ef9e4d529d67d95334G'ƙ56b3f46f485a6bda6b6522925727b43a_bdb67af18c7853fcad2bf187c654ca2eGי927d2302b755b7908892c253c2dacf647@05401e8bf4b60465d2f2fe66ab80bd51 Cԛޙ`d65b98389ebf9de1d05a441f6d07d909Pde80780ec9e33d884bf59d0aaf33d19a!G<4de6ce1b046ea5c582e9f9fcc3d2c53c  a481ffc8cae0d5d2bbde26c4b528c638k''Tdb885c7c4451b03616b61560b67ae7ed2321c47f62994fabd90d302ad88b8483>2GG8ea1933c6b38be86d75d21f50fd768923:dbaa7dcafcfbd4adb2dbc156535bd556WnCMe714c5cab0dfecc2317665e46e876b90d,c91e70492e8631f35656a8df0132322bG1LXbdbb5d82555ba0ff9e95d4c6ca1ffc67ed0da7586d61c6de8a00eb04d9e3de4d9GV347453e84208da292cee204b71880eb3Bdf1b12d0ff29241eb3e7d9258e1925af/Ca8791a02b1c0c13503a57ea9d5f8982ddb657d7d521ad2c7a42deb097360908f21y͚591e8d331fb41144445dba7fbfb2b803W18a5d2e8bfe638fc3bcf0278b45cabd4s"o4d633d5c90b12aabbc56ad3585647dc62859f0e74e6903b60f1f3554447c1d053p?#t79329f8128960f31f85f1b5c61103a8b2O09e76c9ad03b58f788cd9059ab821336-!Ew${c 662f2c2291a95fd01e0a2bf0696ff282*ve37ef42364169e7f7adbf2e2fcd6a2f0CV8ddc070349837c8930cfad28b79e17cbY6f8fb9ccdde7995b2372a57c0d507119#C望m36441178cd2f363a39e23aac8a0caade479a8798798b77ca64d30dec511efc739GڛY2668e237b6d0458488a85ee4b3f0dadf:8017556a340890fa7777d8b590f17f26bCd62143aefda0b989ea33fcb24e344494,9923733fa674016e74a03f8266aa6c08=jz6801bf5cc1424b95be0f1ced5fa6229e bb6e71987c8fd8c859ab4dc6184a03325a$:b682e00006881f9bdb374732731a88acGfdf92a24050896e33fb37f75df5e6b54@T4a36a86da0c3d9f25a096c16cec720ccbK8bd68f1e1bf5425b671cc489566d0a02> 7k 56ab18291e96dd458ccb9c9adad40281053a31423ec146a4b7fa9f142b1d4d34Gg8d8e70724ad4113404292620bd213c76k6e7974c492ef4e775f5ab65c13109b29o0Ghl889862ceb91d31ea65cd3bdfaa00d55e70c3cc6b4d738237029fc898c08a75e14%C>$aed19ca99581136d44b35bbb2240a6bf69a5a607b089bb5f2eb7b3411dcf990ec;DaSb6f0c9dc8ce3e0662970efbd05dd7d29_;efb3cb86f0ec49af7a7bc1ad7358282a\z$g\0703dbb6b8e596821a08fa7b8cf777f0ccf049fe2db30acb5c56400e1f7ad72558$C77057550893d1ece491906825c030f95.50ebb635a476eb54b97a7417a9fb0de8"zɎ;4ea0e4ccd14bd78dbe8d6106c9a000bbcwa edceed5373ab4b471545e3328d483c32i3ca447e1b5549a9f648fc6ff2bcf8e981o 200db65f08a50113d934e071a51eae9bF 34bb2030b70f8ec0f430df55f58a438cc90325b13352b5021b476177d586e6b6$41Y")f08727b04d8364e091b0272bb7843f6d$ d4ca59b381376468244d68467b290924+286f5d69442e51694412f09c7ccf1690677e5ba23732fe0281eecebc4eed936aaPmJ:Z77ed6903e177275a6229c66dcafe3ecc6+08239e9daf479f7abba5c6c3e1c95c46%Ӆ>h06cd452e5e1e8384ae16db5da0ade869477368bdf37337142a92f41b1e69ace3fjaXNDn2fc60f1a2392a6a0ec3ef51cee204617 56d7f334197b0e581b30d938a3c4f492`DP tffe0f8e1b772687855d740d6271d4618356576173c5b64aa7ab2b13705b5b5a7o.H]595f74376e4a28ae5e7f3f3151c22cec~a892410c0fafbda78ea4dd8330d4f10d;#PHg341a487c444641bbaf55496254c00f51tb1c1e700ded4f80f4a6b6357aa48f04f(=-ab1cfccfdb42c5eb6705d9d6d4455f43h3f86d29c52037f880660ebeeadbef5c4^*Nğe156e1d5eaff5c15d2710cc4fa2bbbdfZ5836432d319d29eeea7ffb068ce26673#G׸55c73fa699ba6964112c9765d8aa63de3796c7ece426c2dd24cdb0a55570a1c2@GCl'827665bc8c02bcde37667ce4ba812bb8d901eaf14a8177f52bc0802bb90d1918RGUf4a1e32605be2d14f8fbdd3e6028cecb`623a92e211d56e5e42ce1c040a3e83303G%Z6214a47c8056a2058a39a00066abd0fa;)bf4bb36145337a20bd91851ac17f6d22Gb"15e06a042dfb84f3a08fce5d8352f844|7908fc763c7f1dc5bcafc99f960c1b1e+Z8#hɠ 11ee45bcc4f0bdf58ddf269770a727edgof6d24a728b3ca136d73ac2a488cecc0d%ؠ811f7eb96131386cca4f10bf8bc25d8cd"kd00264d2793b9f91562ab54809e9f5f2ReC 4b920e472fe426431128e48373de9466bhcb3e5536cd6e9cd5a68c45f253a3de3bV$ C bb4c9d5147aab8f8e12215d8fc04b3e75bf496da8e4b91eb0d0a8dcf29daf215dJ2S2PK625e365422c590992b40dca088f6a038@0b990136ca3d38c0560ca9fe2946674b7ܧ G\ 6a813bac4037d42119bb11fa76589f29026fa29f435f9de32493751c61257ce7{b@#x"{8b5e7577c0e5653f789e8e1990ee3020p1d1a32ee502029c45435a91b87a823915# a2cba06d10175c0f011214442ab5b02bH1949f08fca88b3b7dbc423ca239781f2NCKf30508d20d620edb8ca77cce5bf23767sa8b128eeccf7ba465a1d3ab149b754ae{CGtKp eb88c1e3faa68200dc2ab53ddb82de07)f034f900b70eb8d62bcccb517c569c86?f1Pᆢc9ef11527897561260ee11a42d4fb22e9# 2c449fe32c24f41f30167d178dab007bC@K18bf825a259d592ee68cf714b0ed781f5cb700cd48b3b6955a75714eff2013083#E80829ebcde6dd6f91d601d8767f7ecba:cc23b9fb8044e9363445a4cbde8ac179 L }*P47b656d18a2387750d9fd75e6f37f0eeUY65beac96dc4b876de41ca456aa63d6cd!GM2K177ca0c44a291f110199fadf443b87acWU85b8e2a2a5dea7ffa966011997702540n_"G7207fd04c83d030cf4fdd1fff20aeb973c8e54889aca1d3296ddae04ba9390ff1`*2G8H1fc544744162737689715d5e027dc8351ae1e75f241d04e89ba751864426c6894d41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688X8@t\r81b11b6481f43baae54d010163713709<f9334f6df48cca67695381f502976642G8%9d0243c6cdd049b41ea58b81c0d0becdaf968c73785f345932852a1aaf930f1ef$^ G28163f99c7c323f9862cdaa4f20bec98e05db7d05e6c205e5858c81a520f17560`_L ~4_58d92288064fce66a4f51ed9410b5948>260a7dfe0668ed43136a79d3ab559c9fGI,c32ca1852587ee9e003e60cf0376f281vb4831f7acc6394cf3cfa3046f5c629deq8Gr7c5412a69edd8cb3600a4244be57f3227-9173b69541fefb46ca8358f27f27ad68rG| "5b5f3b19d102ce5187030f122f172a8e*2f0bf565841e9e38a88301ae0eb4cd9c-GϤda4d0b4679851e2bac142a29e61a9dc7:e1a5011fcfce94116c9141872ea15d27#Ӆ!%Sb6f0c9dc8ce3e0662970efbd05dd7d29c;efb3cb86f0ec49af7a7bc1ad7358282a|$5595f74376e4a28ae5e7f3f3151c22cec~a892410c0fafbda78ea4dd8330d4f10dS;#7$,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14!y,bA#)(ce1aa23cdd13b555ab2e1a04729349af40bfc8a8146ba1923a41ba6e7e69b89a6]Cs1add62930d5b97442a69a306412894458322cd1369d57780e7472ed12d41435a MDG'_85325a4d9f42589718a80b11f135624dAfee5442ef590754c0f007b5c7dd3a172F j$(+93ca7e0f7013d495c8800982906a3614FDb267068e0c2485417af0cfa3c7c2a83ffGzb90c88147d03ce257fd37d06b4d8bc5cfb'81ba67ffa225f764afa0733bffc1b3df!@;*8640ae8f801f1938c8c307a893cd4855O62d6e732df5f748ee4a20bd78a9e20e70G&30463c16c4155aa904a7d1828792df8dc`d7ee49aa6700ec09567788e38ad38d2a0G720aac8168a9e5475066b5720fe87302g0fef32bd669bbb8fc9e2c3f1103abdf97#o-/01528a97b6dabbe9c3b2ca98970e88b00u 7438e27d1939bcb9ef694507f65187ed-e95ac1de4caf35141b8ed2309e2adb11#65327f4803b560b18d62dbd46b1b98e6k.nH.208b13a706196db95f7083220c610606a&1ac4758dba718b5a0df19aadf72e5a571q_05a65cc4f5a44245e660291e84c5217a\9f9e9f34e804de5358515c1aac970468rh$@i1}df99a993ac5e3a189d1957886330570dB9de965684d46945d693889882bfc9728bPD G|06d7f3ef8b4dbc6d0b806550ef1e1faca4y20f1715dd2943dbb2a542158d4b87326MC386f448b1574782821f7440724a6edd47e26aa47aad664c0c795b0e8aa4464cbd{Ggȝ4f8b227f995715b6478e1f38831d91d93s449993a37ebbadf64aa94141040fac6dVGݪ58 b5bf8f82e8bb683af62f48b09d8ffa84+[a0ec96ed901a5d385a4b0c4743bec3cbC>5f3fd889b5b7c0d61275ae4046e649d9+[5263ca41594557384fc303de6aadc60dWC*XD70390a2c05ad0ca5061395937e6c86a82Ba60d477a48a8b4c1e82a0cc19c6394ab_6#oS=afb741d2166c0e45ff4f0547b1d877fcRa7026196f80170bc67ef72b57c978bf27GZ}U 95ed5df4b4c7ad533c150d7eb86f34b2fad533fa1b7f7df3bf2acfd41463708032St:< e696848e80f07f7f0fe638a9cb379758@b6c6dc12bd4ed95759f35f80e2894e724#b41bd41d690796688ba30faecbc477c5b0Kc5d5afe602582d43dc1d8cfd9411b179I G;?49f11a9327ab7d5151eb5d0b31e66dfd925b6240e63e6b525f4469ffd743aeb93_G/Qfc81876bfb5f17d3627bf73b487dc326326f4e6151b1100bb6b34c260fc55b7dC>eea50f8ce1c5823b0593653be0ac3dcc68bdc8434acb6dfb1add7fcee6baf2a4G}ĩ=C9d56f6fd96d53105a1cfe2e617c256dd9de289bff71716de38ad595a4d9a060d4GPǩ!e4369363ae78e7b775503b799b4df14cEf4b15a0743701feb6723c11274b13a84pG؟A8e74026fbafc815dec8b8c62d8b11392$567cd2a8fac6344bf03950a522ddca67CBE+848bb0f896dd1886b9483215fc3c5a44 55ecc83741d80f864748a958869a5120w698ce3e496c7dbc3121b3e8e78f603a4aee%204b5d876494ab78504a213d2de37671pGmD404999d125fb9fca8e6a8e66f7a8645b>f086c29846b3ed08199f50206b92c77dEy&@Mb57183cb6fb4cc6d78209df55ff30a93df7aae39f94d901fa6752707cf502af0Nj&\e6962e247a04443de2a8f1539770a5c4dc535aa28d651cb73cf5b0fc1e7f82b828Ë$CUe@GIW524e6e23dd7d577ce835f49a85f8bf5985d105b849e5cfd95514276d19d799c6H+< ^33c83f4c2d821f991ccb66d81beaf174_69a1910a930995ac63874ef6828423f5H7G".gHLd41d8cd98f00b204e9800998ecf8427eHd521d2d49afa6f27ff014d84e4d06688 t\r&K:041ab13ec6f67de3062e96b242399a98ff57c4724533fe1a9b49a197cc6c3f5901pK2b42b4336c32aa98b602f3461c574943G bbc31a865035c5705fba0438f3e2ccddd WJPcc05f98f97f952ca54b86b80cbce8c7effa4db351de533bf0c63ef1eba945728b/Sfd391e14821137c1f6b00e59f223a47br628a03b6db1420877c7df9de1bdaa96a[x0#YNd15d6ab7e2ce9d94e272899b7ec674ba05dda971c7163ddad0d711a7ad06280093#OR9d5103566a52a1de7e17632ffabb9ef5>t0d18200b670f2b47611d9dbdb4415decCd41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688iJt\r-'Q7ab36fd58767136a84bf03a6238ef80b35f735dca94f83280e5b1645adb1b21dbu@Gfeda365384ea355bd94ef20025f3858f1d93af0a999c672711434266781dedc8GD#5Tdd635f2bed3944d91eb34706377b0bcb 13294440a0a773ee6387fbd8bca9e4c0'[)ea8bf2fed475b2064238aa56516ab2b8R& d9ee05e120b855dc8830ebe1ecaf857cZ' %:\_882cc496ea24f82e9a7105d0ed7c06383add21b837374035abe7e27cb6b85d12!]N =95308a9237844fddefb273235b2270cfc4f3068755832928849f70de463795e927CD^Pa8a9acdc52303e07b5b1e6d767a05293&01b738def881fc59c9e941d7737c62c07FٜحZf68ddd56467c378f66708421dce8a7863w57bec8bd4310573a591638614419583eJ}9G%#fa6e408765039a66a30f7947aa080c72Hacd949cfb915af11b96ef921bb05583f'?r"aa2838a6300a71fe48e96ca60b3e48d31x844190c653750e7dafd1c56cc7ff9f0ctmUbe}96b42d5acc39093c35c9ef97962d682f@?43c880df872a62465004c96a56d479fcG ,[Fc757d835a119e8b7b6a4f95776c0d4aa-75c8fd2328fb2a4f2acf11023c688e81Ed19935f84fc4bf75a3afc13a0dfffa725A260e67c1c2963a6215889e9c5af979741tCHciu0d93389eb93c06c3e075e40256be5473Ed02446d7b021a0cee81909ce276e291d5%G~RAe916fded32246155cfab7f0f31a4d754T2ab95031fbee6a79c09a3c0102602404w3GXg,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14,ݮhk 9d9e749e3d3881bb86d4f685ae456e3dc3f2d3c66b177c4150e0e6be3fa2732e~3Sfb 71eedfe2c1621320e0860b9199a65825a11d10a22068188805be417cabbf8579$Cja0072813edec10481da4fdca6b1d28f4e68590c010c5df02f7a5396658dfb5a2s1G9 f7530e76feb91941a01c8d7acbab1771b85c3bce0a6f2a378e280ea22ff3de2cQ% e8848ba7e3f9cdfc1e492e1787c19857625ea295cdfb43d4d0f31afc125da50adC?mo7faad2197df74c0c08559ef1b2593ff6&85cc72951363edbe28201a1608c00f0e>zCKd57c3c88ea8e5315cb7d76c161c366ece;.cf4bff5cafce714aab3f580628b4a040u G/)nr804b54baa282d59bf50f5cbb7ac5c65fa[e08beef217bb0f1934254d47c6cf1b00' G @ 16fe7780ad6648ef6b9b8bd73e8982ca9f4bb45e1ddb7deb2cc69ec75ad3a8a2]:SaWq003fcfede22913fe39c38ca4b827fa6d5B- 5e73314eae95b9821cd91ee341197244b_pvW8d9fa6e23633953cb46b89513af459c0 ca4ba735f8f84706bd1715941fb3c12bXGM9d77945ba7e0469abf8682c85c75b52eT1e0358b32555a1faf1c011b541f07191%!Gtlbebceedccb437c6be00da905d39f474a ef160d102ed8ff50f6cf9356d19ac7c5L3G% ux0afba60cd38d9e9c602359fdd3231f9fdcd70de92d76570cc0ec8c3496e5d8570GVI#b2f3e0c20dc29224c6ee8e842f9c40d80111b3299427587f9b0b704e51aae521 E#/.wb572382adab071da493a467cc69252a6%&6b41967ee10d9314eeeb9ad2a9f883c2Lks3c7cc6ddbc52bdb91dc05099c3758b0431704c5179635f5538cd5d42553416cb4JECz u 9cfcc8bbbba5300bf2a1e38f67a48cbe#1f978007214a412b16f99166382821420G,z|#77d24d6ec7736017336b4ce6fc699171 68497b3aefe16d58c82469245816f267&<f5ba01345441ff6db5bda68b6453f0a7 C8abda31c9d66d4b025af7d7469538cbf^%0U{~1e275b1838c01b90623430e6bb18bb8d#ac5cf444e42c6f130d30becc017356d36G8Fde#f653f86de6abecfd7f4e798ea7f1e04eSc1aca29e2f8004fae8ea09d9561a7705D#®f~3f94bb0d70e7bf7ffbffcf58ab967e422fccb49d08c0f61c2cda32c03c68a0980G:j}c774afba52c8963f039d984462b4a3f7=4234a409423e2e6d87686a613a9cdfc1>A#k478a0fb892938fdb53c3dad8f73ace66f50ac7c560d30df20107095b30e4bd74N(GY} d6a060a579f9259df271ce7c76901348gf5ac214ca047b30c2678b950c3203075 GMp2fc6651be8b36a47d24400c1f92dc314ceaede813cf86f2fefbb8982023de9f1y4je4bf36cedeeeaf212691f284728d72648961e159895225f238fecd1635dc3267ebGSͱ539dc9f7a4d1c5a2ffad678f9baf9397bX;a19d30cac0ef0fa98539646072d01fbe9!C#ձy40d17c3105666698b102be1688413ffbZ8ceb6165e0a363c865835f175cb1b522' ر6e286f2b61c1d9131033092643ce0c16966b7e95ab42a25e71232f962bc4676bE#^ed19ca99581136d44b35bbb2240a6bf6&9a5a607b089bb5f2eb7b3411dcf990ecGe;c ide1edd533c172afcd873a747e46f0050@Odf2544b9fb059d061d5350e42a85293ewGIC% d908c7817157833be96e35d9460e7442R"339745e1c145b5a485de236c387e9ab7 Gc4-c32e4550280761a21883e86f5ef06788f2fa3da3ca14725260d82c4966f300807C))3341a487c444641bbaf55496254c00f51 tb1c1e700ded4f80f4a6b6357aa48f04f'=oDd6c6eb7bf6b929e5f931e973d58eb890a}k774b7d0252d34b76009273cdadfce516C)w<7c777c77db3dae9b82ec9ea177344395 d06644eec3cfc3080c71c152a39647ab$web5c03d2dd00b90daae8a6fe2cb32296$4ba5da7a4cc60d7c2215039a40fa4469|Gx,15d09898e0e40d570b50946f6039335e f11780802f7a3adcacbc4977161f8196B#Bf9f8aa4c9b6cf52238df5f19b79f0731`a04ffa5d68409fa96aeb7cfe972393c06G욣70315345751e22ac2c50d18b4091c59c_#1c503361625bbeae79e9c5d617ff04c6c Gsʲ 1ecada64c5a8fb4a1eea05a74cee772edac475c47fb666a1954c0502b7ca8eb2*FCSv8986752b8038b971088b72e7645622a5  1523831eec8dcdef86517c948e86c4f258'd41d8cd98f00b204e9800998ecf8427e)d521d2d49afa6f27ff014d84e4d06688u5t\r\1\d32c3f637c8c376e6bf587297ca43942X0b4da745296dc5c58dfeaeeedfa4851bs!CICad8aac57c626065f6933ec069efd26f0Z951e79d4d461a8c9e9b7483c469b4527, CVVW495b3dc628b9dc566eb54bef28679f66cfc20e6a670edbff988c83c6b2dabc359;G'cfc146535900e8d9f97032474ff35ea69tddcb7855fcf6065d06800b0e23ea0197'SOq803b3a8a1c9ab4ce2415a6553afc8719f54f0eb1eefbf5509a8fd8720963859c$|Eft9bde0f9247896773dac853e081613e7d59776cd08ef60b7b46c1cd3cf6b86957d-)Sz;Cf132300a98f58a5a9e7f57dca67dbb77405aa788fb3f3d0a7bb54df9e3c8b61ez0P 9dzbf6fc93796d15c1963a5b41a09d34ce0ah16f9930d6090ecdb305632f54bf98de4Ѕ$ 83ceaec0e6c445752633da020a63ecfa8bbc5ffc30faf82f40410022acc266c4ekm;*C68e7c6a9a2813a8d0c610614375bf2c1804d0c169a771cf05e29263ad6763c60*䴆f0f883db56c76c70057ab399495be3e9F50ebfd8b2fa099e3f501d362ec54b2d5hk0191c53d26a87214b5ab66092cc92bc4<ze40257a6c1a864065cc3021290419d9dq 0f21ec8195eef5524b6fb71068d41629N96a924e2cfade51d1e39c02ebdad4e127 Gc[f8c49fa6c68d6a62110e733e2ec7c3995#*7ebcbeec826d6a45b7422720c00d7adcQC` 0be94f0f2127fd17e033984ed2f9a9f7Gr9589d277909eefb067338817133df32b#R Gd1cb77af2e85d9ea48ece0a245ea0b1eg3c0e2d9c6c9a51c9ab1fcaabe1ec3acep%l05a65cc4f5a44245e660291e84c5217a\9f9e9f34e804de5358515c1aac970468c$)z9a5d6da117e37de054f13872c70f0f4c(add14ac9e754416eff2be7d961b5adc8x1Q54f44b66605aca381f8c14b3998ac253A274830319e6137d43ce985b2015152c4/ C!P 06d161ce37862fe7c43dfe3aa7c0e753q1eb55a6afd52a669e3d05033559f808aV2S!2Sb6f0c9dc8ce3e0662970efbd05dd7d29`;efb3cb86f0ec49af7a7bc1ad7358282a}$4\3536dca1d61dba47f4ffe9a4a6047e1ddc5d63f92ab471f6b485c012088a4b1eb5މ$Cm<}9 fe61dd5f1d7632487dba8ce53141477b]d31932f3209488677101a7931406570b $CnŶS@36a29db18b80a0e4420de5d6a891dab4$ 7ee575a6381a5c6a9cd37f5af32128a3$ 6cb71199c03ae48c732aa47d791ebb0f{d180422589d8cb61f572f92d310b57e4̔Gc1f876baecc9f8e0dddcc8a67b201eee832f379ebd4b25da6d670b4071bd4c60G %_a212c7b0abbcb99e47a30d6f2f4e3b1709f2193899ebc8f689bfd9f474fb1bdepIGZv]yacdc9113823ca6e7dacf2844484f7a27003a5df41c42462b229f139440fcd959ЙGtPr=1bdd687349515544337b8caeaa7777391t415ccdb91e48fe9db869db7f620a7249|/ⷲ 316194f9571f3be96aa36d6a0d3b0718x]63b7959c6de9e65cdeea5ccb7a4c9340G i!36ffcfab9f03a4344ed6a2ec1a968265L 44ae780e5f8a0f197a7678b7e65c533fu Xks54e24c1756c96e5609b6b47dfa55745798a99ce25251a659acd0532c373ea262'Gq8966eb182e7a726660a94b5732bcead68b170986d32d2d44436049824e974f8a^522772404f0181ca4ac82b23af5425e998c26e3639c634d02e2afbc3d8beb808nE#4b97bb56652631391e222d8f4096eebd7.F583f20a61ac3a156ea48f825a5930478ȔC游\bc492d76c232a1dbbf084731ce0af531ecc9176310b409558478eae352251a6d5b$CX@#|e921d262760cbe60ed2d6f7afa6e539f7Y58a9b953023103f00846f80389fd6f4fCꄆ,20acad263a7995f41056a83436e069a7fc2800af113ca31c3dfbfaf0a0ff731fb GW0c58efe333fd100835a76748e3c37fd25F3cf63162e0141363967b9c36e477bab9 bGb18eb33e81d22faee5a72db78b04897fV318f29a0c51c6af4f493d3c7afae1eb8!G!eef9c2b713e6f8dbeb870df4be7f356d3@Pe8024b6df54178cc3acea20c9942ec06G{o9505a1c137f6e8d22da1c6fbbe1ceea3Teb75ebffc3c045c705da640e0b984264*GX@5b2a57c01ceab935678a28891138c6e6?38d85592c2a74c403f1290392d7c2c07Gd/gd18c73633a81d089fbb23b373dbc1a0c26326816ff3ef59ed698c0d2161dba09aIG{Xpeb37defada0921a3fcbac77f6ef331d3e293f62c78f5c28c516429f07b74cfba3p2#[8529074086846558fa5d5822183d0b27D\0eab86b60d2e99d1dac65e49077cde73TG^B710fe1f4441bdaf70d48ce83022f5055^27e4a98b58f666ae8a59b89106968639M#-e7d4b802f358c3b26b9256b0f639ee7e 21d4e198aa8a9a58f595aa8d9afcb89d3 ̺595f74376e4a28ae5e7f3f3151c22cec~a892410c0fafbda78ea4dd8330d4f10d#<#}ֺO08b2e1c1a01c8bccf16fcee6fb9c3712D722a4b82d3919ac016b54c326dfca5c6GMV02c68a44134c48e22268a0682f7e9974Fidfa355837a42ab5ceb970ed8815f6516mG] 5 a20b461c8b68e5e3ba5cbf617d669accRa3d7d2f89a89a1a892f7bddac539f380R!Cr  b75a334599c566bcbf3f2dda90e4f46eW01071524d844df612e631642c4679f8e_"C2 3b580db3bee5c876548e28ce26a605db[882369cf9ed0991fe46dfa2a685fe258a"CB*^f7df3c288c5208e445b866b1d25fe3bc( 821a7eb3c135ef0e5de10a879058ac8cmC.8711fee8fa896ac96e496e2a688c4000<0b8d8c7f6c835039fc1c1c21c47b8e109õ;bb253872215568c5940d58fa251310de}e474dbf13748cf1cf14894beeb09eb6cðG379513ef00c1038bf82c0efef0759e89Mg9ca6d6a6ccc8c14833f563ab15bc0794E GyI534f861094c7bfe9f3ce244336f61b49B25f54a23aa323667be3ce63a77b464e6 EädNdbb310bec89a0483a7bd38511420323471ab63e797f312eec44abaa13d42af271Gfc83d3c0999bc48a33fec9bbed8f3c91Q0c5c177030daf027513da6135951fa08BO ¼wfb35ca4332e5f120db5326f755f552a72dddcd9ff8f63801feab2fe2c25822ab0CLMҼ92e6a2f0ca16e96f81f287bc3797afaeT8dcf69afb45f0510857877da35cccd6bw!h 522d36ff6645d63483a7cf877f25896bg6bd3d99daf79cf8086f7042c02f5a992GV,0Mj9f4650d1a73246307c5a88a1ed7d9e4514c59e7b5c62a6f40a26b94524806085:# b0d1e6588b36b1b4c84c7accbdc47c38%d6db92fe6962c0e613c953fd1076ee7cI1SēB631762811c818d32b8162c0fe56e0cbe26445b7028867927a380f3db54fb637e5XB#`l 2f1f18448086f73806a49d08cd525ea59df648c0aeb39e6db5b0031a46721130yGZf6a479d9d937900c73189cb35850caa1cb634b0457f9c07dede512a28e2a647c5(8G0efce10ae53bd04b8ac9d023466bbeba6b4cca3ef33adde5b7cdfc00453e396dbFL 1efc0ec98e253461473c319a8e4314702fa6b1a83afb73f6113641550a254e5c1ۓ4#A)67bd7fd2b4affba41306d1500b7d8858A& ddd23f93687ab51d414e2cd2db1a64ddFƭǾ,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14- .; 7ae13658675f33ccf32de8bc4aacdc8bgacfce3fb0a7c9f78208b1239271b0532v3SrXM0a62ad01d4642f01bef1bacd8e97c50fCN7c2b55cd19563bac3606a62ca8b74b52./C%"g92e8e336c12ab83bcc472d13fa00ef21 64981a94e7118ff96e7fb33a4200d6178#%N1248313f477434181669a4f39381dd314,3b60b2563fc30bca8964f79324c085efG"885042e5097dd26b8ec5390223d2c1298eaf647c2c0a88e77b6ada70ced862bf4GI/xa24bdab2666744a723c20b4ebb13d1c3+86ac4fc72830e586c0ce98b721397d36dHG%m2cc0c534e6736e0550612653810f26293082fa1ef75cf2dd4697fce6e2fbab18dXEm eea30053c7606dd7646f4a7a97bc5d50fe614ab77431b406c317aa7f80fd60960GH1e7899635cc4ee38227a0e4f72b458df_61613c0330ca544a6e35a81f3d0031aaG2<1bc32b99d1abfa99c4fd96ac3251b242zf11978406ff68e8d54e1a4d3d64f95e6E4G&Deaad7dd3620c1e1532c2c17633fff8c57bb539dc87aff347ed290e259f8697391Gct2cb9037ab0ebeda6ace0f5887edf21dcZ857a7734e23637e7971b557e1b6f16e8"3#ya5dfe13c8196d502d2e4314f955b0170bf0913c6fe0d9e67d0e16a8b5e5d4011|:G}\58d9845f9bea78ea6e373b8a0ecf9945e080722fec52c471a425598557f62411?B#h c429bc1ff8e56e7d4ecc0a05ab9062fcYb3579f55aaf910bbb212b659f99eeff8#C Tb5d17a0639726aae2efe825d4e86f98c V8d4b19d7eaf75115d71cebb158d1725dܱ8G1?a8089051ba2cf5b1655981aefd5a2a8e'f085a91d3a62c577fb9ec8583cb9cbdbG{bf8690e6ea44e467f84ce93b3ef76d0aN2f816c29c59cae904357a2d98c68cb57a G<10d606d77981eba9b66ea904a407a018Na56b55bdbffe6afe7d2189f70727aa85fpGFea515e4726510bbf50eaa43a4190f1167c5dadce925e565947cb027e91c074398Ä558df140e99be201c377832b791f2473c3QHa18a4d96e0687f303cc83a55c6bccbe6 GB0c00438ef5cb5fb8187cc796121eec8e82778ba38c57cefc7eb2ced25fa57d93ar;t\r՗|Ce33fa24c30e124acd58f12ff3649b33c*11544db9573a01b457a17457847bbf0a*C c51a074e945c695afe060dfcd046b9a8b&1d879a965aeacdcb412ddffed3efa743z@Feded2dade46b8e65fa50fcf230bf5e7c309b2c744847ec9098872a43fe76ccbc2E-wceb6738812932f990a8236f98521265e2ddaaf98d42d9d2de1ce1bc9ba5f0e4d7 @G/+!8b3ee242cac206023239552334a6591d3aee780127208442ff0d3c92257554dbA/cU5b2dfc3388884487286f5eab8b48de81a62d8dde6ba526c2bac1c38f3d16f6151r $b30a176fe2b265d106ef481e7764b60d2_10a7294a1e4e69c783d5106d2d5d18d9vC_8c9d5e049b2f6607e519db79b369f7c0817450e6847afd8170926c0522a1949f7V 9W05c06f0ac68b343bf14a92727999539e26625e9ec9350f6213248ef05e94a046~GWIce4003b5f49d94bac988775c790b47395340c252fe276785acee86efe2004514Q M*W6b5bdec8665d720a156f0ad4c1b1fe57 O33a43c2608e5e02f4849cb9d2085d7a4&GKg34c7f8d0efb8fb3153edb1d5e46a93192-b0e8420c48be61bf71a0134c38bb4ab7e+Gx}w7a9870f9c95b9c45cbae0513172901bbf07a432b1ebd619d5b07fbb29f597aa8e׳5GP}b00b0df7762725bab737c687d99ecae4T35e6e2ab4c7861faf06aa20eb4f41897Ic GҜe7d9fc628f1759d16aec37f65bc7501204ec1bd8b11ce68d2ddf337b2c9ee1c21:G+!Sb6f0c9dc8ce3e0662970efbd05dd7d29_;efb3cb86f0ec49af7a7bc1ad7358282az$- 97d94aa6b8d63c95dec41bc59b4c29842e1250d64147019cc6f8f10e31c8a3cbO<#} 81051bcc2cf1bedf378224b0a93e2877$e0cc0e346ae2380343d86c30a33372ed; fcc0ded7f0570a13e0a45b44b67ee9911aWce7f5cb987186f07639a024d20fee034 GT@  l2eb16a945a6a268b7e2d697ff8c631a3F1d57df8f3ec21737f2caefac64d0f907ZG!cHv30cc3384d1a246116839d526c38d23d9%b48f112e283c6dc84aa85c44ded356cf7C"` e4c6bdda7bbfe69c013c45cc09759fe50ANd947b7c24c3741e8ec60260dfddcf92doGm f7ebc5fd229befad9b9154cb9fe32f5ee`12ce599c09aebaa3622e150adfe539d9/2 g{8434d2b3a8e7c7eb52e348d2819614ca(ce2f248e76861b3d058feab74cc93636v1, |-ddb8fd522739f6d0c3125c85f17e961e7fcb0dc5588ddc6e59e2dc251e0a33dc00 N)f8b53bf2c35813c059a6323699638c3058f91e5f72fb6cd46b2f475d5b0b211b>#4f787db09b38be83ac3b22554ac4323e520518020c0439b4ea6487df5180597f.L d0d692898f3f68dc566905c60f10ab94bt1cdbdd11b6056009ac3809a83ef16a400G ,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14ҥ,o,Gd56a8d25505627587761b994c1a3990cce86fe970e8c636c5c5df46f1dad273bcDG!E7f399071359e3221b45ee906ce4eb420e018babc3de5b6e336f9b702accaf40e5'Cu[5bf7653c760a7a844fefbe31be16546f%114503c7175bf4829f199a3e51762b75OGhdf2f3e296de50f9a5284e92dd7928f1da'96b0796ba4bc7bfbd692052e8e784069$CJ,872ef07b3ea514335ecdc3c5456f832c6 d546fa41cfe46218a2313c58d5800c14,Βd3be3fb8cf48dd02baab4709b35a3aa4/bee6b0a9c6143dab0fdcf621846e73ebCm05a65cc4f5a44245e660291e84c5217a`9f9e9f34e804de5358515c1aac970468t$q641a320482fa825dd19263bbc444066ad8653466804ea9d008cbc1ed0b2c6940cdnC]595f74376e4a28ae5e7f3f3151c22cec~a892410c0fafbda78ea4dd8330d4f10d<#ڋ b55583707983f9d3843caab337fffe69 702734eaa4ccda5992610beba0d03cb2nGxb3edab4ad660c0f7fd28fb7f492f6a4cb,2aef77093e09edd0e99b457cf26e4ca78+<3c87117a779471cad710b360859b8147Heb7b66e527336e1d90f5741420c86c48 GD !23e4f52c2c4dda5cbc1618599e7c4759aed40407c93916155e2b6b2a9448e44cM NM6ea0be22e48da542873494d0f6990c309*6fae1a474efe856f1ac258ee50247068_GLiBYbc3dfb4db94f16ee4909dbfba7251757;=08bdba1020e83a5721d75b7b62df9047fGl CFb11b5b82c645ca27450baec2f449f838V97c85d65f17bfda8872fb124fb82f361 !8c'c1a54492dc3e7ad5c0b0e9dd19b9e940ed17a95b9702ac49638322734f330d6c=DЎnE7c69bb34c35dce30450bb225ff40b3c4f65667fe1408522b0fc21d6a747ca666[AG"PuAN c021cff5b3c03815f5be66e1057be193G32579a21f857924a68dd5cf0eeb6f757HCH}b1cd4c92036af16d88dee43fa7c035a74d667093ebf7a09facb0d188c8fa0f9386GHJd2208febf9c050406953be5f4d25cc66 265c38d2436571c5c39bc9dda8813243+K'b1da0b70681cd22551d379c9ad97209du683ebebedd15a1f645a300ada624a8a6T@G4IM aff17eab5beecd480e4cd8712b907c10@z143a8e7a35ace802eb91967d2e8b9625OG7&a061137d342d48938ff87df6ed472bc4;35bee6a692367238b9df9ebe8640ca93>:G5eLe5f9dfd4d1fddbbb77632b8ee2d7bc995Yf0ec4d625e5cf60fce8a0ac1490a38cbs6#uKQf3457602b320fbdcd40d7ac0e802f39b64379d7acbd1027eedc0afc22b08e9b3q*% 1b864bc90288e31c1130a7d96da56aa1 bcdb171f469f783eb3aa2e679b7fc2c8&OO13b11b110344f23ab37bd7f0e5f0a86d[\acea195f804c2188c5209d96165fe61b  G+*PSf9c1ae1f3219dee73d4784376947a3c1K27a978aac66049f7fe4698951a0211ed? G^16d2b2b2d3483643ad9d42b2b31f99ffd0aa3d12769ef536ed88e9738b95cb124#R443eb97db5470f534b3d86431f79bc63P80387d9239093d4d6fa257154455791aŦ5GT Gaf 1fb5d7e70526d8bb6c4cca73ca46f730$3ea2d3f92d261fef16c2176ca7f9ce6c@SDX cbfa0ac77b2a1e768650498dc1f1b3e8c71fbbd2d653a9f12d633bc9a9d4f620WB<#̉TUW97712855eb74a09776505969d21f5494537c81ecc4753cf9f2e592acf17b58e91TQ2f91b094cd03d35b5392c309967ec798x67352fa734f544fea24f8773c5682e79lGJCVZ5284f9955dab7b2c23787475c08ea399Z790edb38e897b15b040afd17e796de634A G4:c558c6a78d4a0796c95be7c15ba6d22c 9c88a38c94ff064a28075f653a1673a7_A#CYe479404a47f7cebde3b8fd33b8af119b'6be1cb3a7a8453853e1c6ac20942d4e8T@tX^G77c926a10f2b028d1ec6ff71cca80b27M1cc52745245ac552176cccbcfb013a90.>#c6119cef575ba9da7ae59f61954d2800/ba1833bec6c874e02f4afc7cbec8df542;Gt\eaeff1ff4a13d92a22cb4f24e6c978f1+ 65b3d2c9591f22b727d6bd54f7db9fa3rC*]`Ve267584e3f6ec19421002cc1b55260d19e81fcf131d6fab384db3519bb4d3371,<+<re1b0009d144725267e80a0cd0a805384d6fe889ef4f09531db50581d3e6a88fe<@ _]0bdd6891f8884f5ac7b8cf33f88eb3c614c15d39705f3804fe35f75b22aa5846\Q `e[h3bf253dabd82fb6fef6a30ccc1676cdf967fb1c1761e3687cce28ff0fd707078A=Sda79d017e1ad84e7fd19bdfaab06759766&dd66a68d2a3ecdfe73af691b67ff266d DSUbdwf7a1d8da6061705085e64d9465705228443eb175ad7e10d06598532fc21fcbcebmUc5e831729b01ebd39f8672283ff9865d9641d88576063e16e8e7f8d522a17cc0e:#:cga5acec2b958614c09bd47ebeea554723(2af60e8a43ed2a070911481a59be85f0jd1!ge293fb8065e8fad728c4ad6f3e78f54ek466fd61fd8f32ced280e823fbaf010da2Gfdd2e7bbc971c78bcc557b7b33f496a8d_c520a5fbc785fdd91e4a45a4004110c6 Gvek758f4430b303822025b28f08c1588de4f4900259699f5315d8b6e310d3711ee12wUcc0ae1b4f5cda5ac2bd7bb3005ffa629["5bb1c55444b5b5147672d4adf4d3501f nic8c87d178df299acae11b70daa2bde538I^d85735c72501500e482a451c207f5761@G#jmd41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688k?t\rI\e9f9830f10ec8acf8671dcd0b1c64d2e6Z e81e8ebfda15dab9895b7ac750dac72f!#+<l63baaa27310024df99cffe0e6fe0f94bb79e77258d05ec3a01268be577593a63@'&AT a57a4d94006b08a761f999dacf8501de06cd8eef7f04ee59ed3739f22bbe0ccaQA(S:)6c01dc3747687f885915de1be680d1c3g88b411a95a3fd5d69dd8a4c2150b61e7. oq:ca582e896b73b0697a52dc910b22c36e e1a4cb0405f24df8ae5a17a30d703a00$A#{g953eaa09deb21e09c54c77c9af4456f8b994fadca8b5d81abd3a06d4fc7fc462n9G)2fbe2cca3bf9a00460720063dade52c0T. fda817b68a3725ffde40bc6258b02fc7U ,&1b67a46dcf5577011525b693ed705fe5 7554e86f23c80e0b792196a6eec33207lB9  8b3439e49393d4b74022d323bfb26f88 3dc784d99de1307b65628e309b4177fa7& me1f0416f61d60b45f9ee67ef4158cd2eNbaec611042c54d1db5ca192dc2b429e8L G'59013a781222ae907b1a79b330c0e619~5cc5c3613f4120b1e34e0e32a795721cm5=f92a01032e60e7128d9d5c5f989efd5c5b6446f204c0c540c3a4e0c89445416eQ6@EGf7a049eb55290ed8d34c2b06f3764544b8134a290175d80d2dd12d97156cc8cf_6#,f46ddea49559ea89193b57cc3709749cZ9db71a278f395c610ecb7ecaf95f0418o"Gزf30a58a5ae3c6e621632613bae1486de3a6b3eb966d894b0672030cc4d8727f55ZN _5e1327571c05c309245a8bd9b42a6ee0ab8240230a36f464a89ff79df47987d4br 0#]aa80d186af733f9998060d93f0540fd3)f050cca0a336564952ed529e8f8a9125t1T&7fdcd4442608292f14a2eea169eb61d12697ef9fcd25b41e9e30f62389351298v%\6+9a52eb4a1dd5e007f21afbbce310ef1e@q379c53660a8d4b632590a2df7f7b5f21R G>l%6ece6cd72dd8f7c0aa90742432b79c79)be04e87863d4799a690df3728a459272I-V3ed421b2948aac72c441db63d9a86f52_1aeb115334a57b2f0e63c7078888f4feAGJpab028acf42a9672ee5ecaadf2a677e077396d42fc027f72a5fc7d3599370bcdc2[CA669e9c8814efe513bbc1101a728dbe028c87da3bd2ed05fdd28b96b30bcc062869GL^ fb67c4711fa6d969808209fb0263eba73!c4aeb8e626e87d9664b4917016414437V*G72ebf4d2f2fec18662b00440a3f904e8u46aed8bbd25621d75f60309ca2e25553%Gdi(d59b5503defa8b82b0852ced224853079edd8b6629546707524aa75081639d2ccPYGޗ6c0fd76a9a651757bcacda3a57c213b594f4b990ac3849478e77aa339a43d761[F8G=y494d28222e543e88d7bd2c34424bccdea8aa976efda48802e2cb25328c420c95.:ZCi~ 43a2ce0c31e164abc426d3b69ea3087f]fb57c94c08bd572c0a382fa2a00fb62eu#C~e518a87cfde4fbd32a7fd131756d88ec34432d6435c6f22c4589a6ea8f3922c86'1ube819b56ec8617bc1982bc7840526c9fTca002a1367ae5a53d07fea45c403b2a8.!mcedfc3034123b50463e1de0a8a36c502J76dffe96293b3b62d16a2475c3da6fdb274b9ba1b24fd04b2ad604463b10564cHU6ce2f64f14990660996ec5b586940940ݓ fc7de0642151f674ddb4ceb946c8a6d74dae8685f761ef39add0427ba4ced604GA'L5f4889454827a01801b539d9d498ac81/2f31097a0966fc2199503b7db2fa04a0(G9<8b2c464eb22d9cb4760b1135ad7bab8533cef14653efd615960ef2fa5505fb79OG틯>f11e9a40589d06cb5e059072fb7f951f9c8b90ca621229eff41d957a96fd10f4G'Q007e91148eeb42fa1eaac4f2369ae9367433012228823b8e18eb142b0c45eec9{31S61d89052de331b56de63f487f9d5f260Gw5834191ba97277277830f9d892b61a7c̿EdA8d0fcb76405e3eea5480f7de3cb7a06eK28efbd3803ad1ac9439cdea32c3fd97b< GB<tc6342ff94668f0d63d345dd506f93947669fa3b37cb16d46f348dc8db10f6c3cjIG{v )63729ea27c236597e68ee70b2e5c3eb1g# 1b003a81ba95edbc321e3202d63a7c8ff   7eed80e3d3e4e565fa35b4b8beb1a28d=130c0480cc66346f731d1b8857a058fd`G4[21a40fd0661657bc8cb46459b26f1845Pe9461ad7c283b6eb7ac7ec6d1db07e5d !lp  e6b1aec28e7b68e38c636ff4e5b4dbcf55b250e3e8a2fb72b8986a479e0e270d7(SX0dbe6fac5924142a367e882fb2dd7266Ve09d337d84ba9e28c4e69ab3c1d1e1b8w3י 5abcfb4a5e94ea6877baa4bbde5a7d2dc1f56a2cac3e3cd4df796f54e85affaf1G \fbb1fb41e5b38cc889ce9fe9f61c49faecb39253d3a655404b7b39ad24dfdbed2e}$CE_a7fef153ffbc36506288e1d6070cbdf72a5d80068b48c93be63ed73244fa5e46h0G&B*c282be79466b606f3ce6073d50c7bf22 4277d2195dcd6400872b881062a616e2z-B#JN05a65cc4f5a44245e660291e84c5217a^9f9e9f34e804de5358515c1aac970468m$Yf26e4411261d877b4f693f9c4770d363xd683a64e414f84420379dbd51146abb2DGO ,2b6222fc15a865dde9c32fc5752db6b2 74f865e74b645d47c5650c73e11b97d3496f97aa10a89ca9115a4f784f0644f69a 0cf770f432f6050c174e715f1a9492e05P E&205e9f248e5a3bb0e8a1207328aa5bf0ef793737721ceab3fa948d44417f7126.g5e53906c76c734f7e45be731d7d4bc94m8fc78587be7f061bfcd385ec652787cf3 :S}4f4ee1e115ea8bbe8c530feb5cd29eba5a009818465bb02e744ebfe5b8b5fd38Vc856009fc2d764f89227fbf5500ce6aa8a803efcfa4575304e0aef02fdbca66111GkI014061a39f3c4accd0d8f2bf627a188c53515b813908facce7316467ae934c41eCNV0e40faec1951989b73166d9097e34150a1e39f4229e9ec16f1e1bedcc58f63efd(;e Y73704292f669d9500037b42c316802c1828140c458612d607c758b37b4082347J9GAve2bb1c8f5d2d1ed25cc681ae924e354a{a33ca9815783feb47b2603201bf1166aUG:ZCWD4f470eae5b064bac1a0c0d08f0b0618aRE0dc8f8ae1bf8b840d3ee0db0f80b2d6f C!913848e0e2f99eccb57c79f73effdceeD8f2a7d7ad006f8a9bba76563c48f179fIE =d2f1e95e2996ed12a47639954c83e482712738d6e2d86934096c4357330e674bb*20G *bcb029500032f71c9c00aed7fed17ead+`1eabfc8cc55d1b696e4eb371844d340e GP/N07235b00285c504aaa63876c4ba9e51d "24b28c128b1272b84927fea5dc822b3c |8GSb6f0c9dc8ce3e0662970efbd05dd7d29_;efb3cb86f0ec49af7a7bc1ad7358282aLx$ii#%d2f04b90d497e295fd5feee4977f143dJ1fcd802079a308a98b3f486c45c0227eclr G44fb3e61c57914b2428f1e1e53661bdd0675a0e97abfdb5d50c52e14bf925dec2D0?$(y abb89d978f588021da1ba1e5441c784a081a11812888b8d045b65caa2f1b06e0ZCS/]52a663246250011fc52fbcd6c7ad1c28#9a84084ed3d05a175e683f0ac9577aa1C؜'3d4fad9f5ab643fcdd1b60fc6f60b5e05edab5c56c9a4453e65cc688eb7ae35bEEDG&;&,Gf7d5db20dee17e5e87ecb81b3059bffb6fb8768bcaafd92c08f29c98efb46718q6#Y%5ca9c7135a28126830fa1b2337591527f 51293c8b7793122c5a20d89abe2e9664@9Z_%*h3a9f65f110fd56bfac68248b09ec6ad39y 7bf6d5df5955d3c5594b67091dd3e9fe"?+.1e6cd603ead1037235b15b8c8dd6520d$77e49aa9b3613fa88e3ed4ce17fc4294?X1Nzb1a196e596e45229a8223b1576bdfffe79aa6ca334aaaa7e228bb2fbba46a4e7>9GN-46b6381e1a433c0a7943f21c6d6204f3 5d117141e118c9be2d1f40f725c26de7oR2# )67d0a91da993186b5c03ec6f89c163526[3e5a8b48efd8d28876262bffa302619as;#O067301fbd0e38d9f979d7b589ec5f609cfac726e31432f9a88bf9a768032543571]02pe69d40d9b19b52e83f13aabda9f5fabfc46aaedfc9b0d122a1b7727a7132ef6b2G& "5e1620ad2cc0bf2499e31b309ae4a8c65Qa82d1c2bd752f66825170a87ce102bc7F CC)C15d41d8cd98f00b204e9800998ecf8427e%d521d2d49afa6f27ff014d84e4d06688pt\r؞F8e9e3f3e4ddd7d7579de486b14a587dbe449754cf1372532d72b30c38af6b7bb~V+~4517f0514ba7253bf670dbb76b5334157b430545a7e2c7757f5a6f24765f4d34a`1&q39c43079c8b8a50028adb3e2a71f203b83S4eedb919ff669ba45520a31031f5c1223!G6 68daadd6858b0dfd569461162ff7bc94_e02324681de900ea5bfe904430733b6fX="e748e8636698d44f4969fa318d4ae89df066064d03350501260851a3d2469f5c187:mD8;7330b5c164ec86a1ce2aaf1ef6977dfe^09ed9b32dc0c99bb8e96556e6b28691eGUX4880450e7523998cf98bcd32f4af4165@ed6a5d57d30be9115b0da5895767cb77Ea:@688985d4a1c3b77d30aa7a16dc58d962)45f223fd96672177f4507ec76ca71913d"V1211f62d7833eeedcf8f4fd5af03511e=6e3c0889b9944318e7cfd68e2b356468 Es[d34cb1d422181d07137622935bde26ba9dd8ca1bc26bebadacd5906681c5321fE@B865fe8b0b646183bdb6303f487b80ba422f913ff38c67dc7531ec5997876989crwM =m0e57e5799bc3e0e61047c7242eb0e4e723f0681a649f01b46e377e99f9cec64fXCGA>2d1d3198a7039496f3d6f28a7b59933a2fefa671ad6c6742b1c98aa5d45d0a73/#q@F| d21d36a8426bb9911553352542f4bbc2+7e7e7c01351ae1c8e00ee20391f0fd76C4B0894e34e05a3b2cb4f3c547a6f655b9b?ufde2ce9f0f0849fa564d76731be7f9f09FDd41d8cd98f00b204e9800998ecf8427ed521d2d49afa6f27ff014d84e4d06688t\raEH3408a267e3f99e20033d7cae6dc1eddb8ea454f29c3610eb9ed8e9bcedf5228e5Y0@f40251c56441f23c8d519f07ba9dcafea8a8eadc29b9cdb4d613b8a91cbbbfc58Q1NxGw 44c9a4c571aecfa2c0b91c7357189b42>26b745968e1ec5c766e444148be5eb57I\DSpCPz895cd68f8528ce4e1776133d37ed91b4v29721bc592296ba1e769134af48dd9622347453e84208da292cee204b71880eb3Bdf1b12d0ff29241eb3e7d9258e1925afaZC\JLy476edd01820e36db5096d6b1378e541d5f60d93529e851172e496d28091e142e>wI#Z'8484d9a459b9260cda1c7b0ecb810c0c*7bb592bcef20469f70cc7eace7e9be415CȽKObb4dbdfd8a2696fc3c44ccc45d4c7526141a0d2205ea5261afe519afe6535009H/ӅQ$6e31f99428416ef8646c2836bfcf4a58co 0679e0d0bf522d9330f6684fd2e2ee09o;#*N^085d39f88c4777e3121e59cfb83f6d96(B 52c2f0c1f3d5de8faf7e7ac86c6d9e55"RЮMSd1eb72c8dfb1cbbca1dc1f83a331a01cE]093ac8dbedae4043ac9bf1d9c4d29b67G? 0acc422fc5a8d706067c9c7e3014eb75NP04c2b9d895e1a94c0ea6d200ce3a5a63S C=aQAe916fded32246155cfab7f0f31a4d754T2ab95031fbee6a79c09a3c01026024043GRUd03aa11fee0847959d17161935a94a4e1d100afb62f732c1862f7fee184f6f2794Sl0acba356d2cc3f29bd16dcc1f3ca83e39U5c0530d0e466e49525bef3c8b939476fQ3S?zT bc7dbbaea569d3c9b5c72c50697abe70Vb6ecbcdaf887ecadb9ea7590ef2a6d7bߊ!C!$Ic7491ac79cbc2ce52ebee6b1b88d92e9cb23a3b1bba53f84aa04d494944631cc2q0Gg<8d977fc3e3fd124265756d69311a9417M0b483eb953445c5d76ffe137a13ef3e1= G.WY~a60538446387641e5dbd70875d6bb594668cef3241c5f927037b20f5b2f3129c5G f190fc02651122425946204349bf382cXp51608e7537e383aeec151c291e20afd2u"CmL2X\26b04be2035fab3ede3464972b14a343:018d1557a2b57da13ac0f5c7854a321ezGHE 9541b5a38c9b1eefde8038170b144e5fY4953b7ad33a58c63c0af000646d1f616?"Cdԕ[42a9019485e51495afe5e84897efef6aOa0c9bd5af8a2be871a4a00a474711917j;#%(Z`f862bc085c276c7ac7b9a103a13ecacd"e4e71ac26242ce2caa2bcfcb3a3d5382D/G875237c419d4e4a3281fd3d245db0babblda1048877ca90d66003dd5272fa3b15e$5^fcb9ace5e3eadca5125ac974d8890438)35dc10efd442261e473133b1c1e8e6c8b147_b\4ef35c27d81f3bc02ec623afe1ea53b4`c0fad692d481cb4edbdb90b13defd4eebZ$C@\(4f99ce7adcc6cd39b61545f5834a7e07 e5f71ac4436e61fa09124d9679265878097ayb624d289be9fefa9ce775011be6c5591:1465661c02e39a94fdcaad58bf75df44RCGc]iqXc37fb2cfb06bc476da1a5d69acffc6cbcc28c31c428de763493517d8fc947a01aN } 04179c110fa453fef61ebf29305c028dd0820673e385c2dbe48deb36059625d9G/Qdce0c58850f8ad405e563a57eae3838f3?0fc48762f1555e30b55f7f25f80a7ea0a3SڼehX22f49e3dd163c23373f3e723895a1bba61063c1960049e7162bbd4e3361c9a14G1035919b1e6d933d9b3873a162a5c831240e 9c9633f58b2a3d67ece534c2750fb756]hge37868d1b1a0c7b4b140505fcd0bd5e6Def5eeb98afe04e4ad138e0575451571a:rfl05a65cc4f5a44245e660291e84c5217a\9f9e9f34e804de5358515c1aac970468i$B(1ac1968449c36283219ac45c8e6a8d92 b9c0980020845dde5e2f098a9b9733f3M %NjMa76205a11a4197ca00b4d88fe52e922aEaef5518d84cca13e8781d64693fef388wpukn97da33c18be08bfa65086e9e5f8b0e95HR1886cc552bf1dc613df081ec25168d7aCf$712c880f62d0ace346c34ee8ab0d7a456318772f5592c37fd1a46f6980272db0 ;,:mCe47cc2c908021a151cf6ceaff8f16fe1(f415c084111f67258aa24f141d39d876-1GRF