---------------------------------------------------------------- -- 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 -- updated abeechler... 2/22/11 - added "BankObj" PropObjs Spawner ---------------------------------------------------------------- -------------------------------------------------------------- -- 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 PropObjs = "BankObj", -- spawns objects that player's can interact with once a property is claimed 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