Soul_RiderMod BeanJoin Date: 2004-06-19Member: 29388Members, Constellation, Squad Five Blue
if you look at the playerdata that is sent to the scoreboard, you will see things like playerscore, kiills, deaths etc. This playerrecord data is what you can use to do things with. Remember though, use the source data, not the scoreboard end, as that only works on client, and you need to be on the server to unlock things.
So far no success... I tried to implement it in the "PointGiverMixin.lua":
function PointGiverMixin:OnUpdatePlayer(deltaTime)
//periodically award points in survival phase
if self:isa("Player") and surviviorGamePhase
and surviviorGamePhase == kSurvivorGamePhase.Survival
and self:GetTeamNumber() == kTeam1Index then
self.lastTimeSurvivalPointsGiven = self.lastTimeSurvivalPointsGiven or Shared.GetTime()
if self.lastTimeSurvivalPointsGiven + kSurvivalSecondsPerPoint < Shared.GetTime() then
if HasMixin(self, "Scoring") then
//TODO: replace w/ config value
self:AddScore(1,0,false)
self.lastTimeSurvivalPointsGiven = Shared.GetTime()
score = player:GetScore(),
if player and HasMixin(self, "Scoring") and score then
if score > 5 then
self:GiveItem(Welder.kMapName)
end
end
end
end
end
end
end
I ve decided to make a new function out of it but still there is something wrong...
function ItemUnlocker()
local score = player:GetScore()
if self:isa("Player") and self:GetTeamNumber() == kTeam1Index then
if HasMixin(self, "Scoring") and score > 5 then
self:GiveItem(Welder.kMapName)
end
end
function PointGiverMixin:OnUpdatePlayer(deltaTime)
//periodically award points in survival phase
if self:isa("Player") and surviviorGamePhase
and surviviorGamePhase == kSurvivorGamePhase.Survival
and self:GetTeamNumber() == kTeam1Index then
self.lastTimeSurvivalPointsGiven = self.lastTimeSurvivalPointsGiven or Shared.GetTime()
if self.lastTimeSurvivalPointsGiven + kSurvivalSecondsPerPoint < Shared.GetTime() then
if HasMixin(self, "Scoring") then
//TODO: replace w/ config value
self:AddScore(1,0,false)
self.lastTimeSurvivalPointsGiven = Shared.GetTime()
ItemUnlocker()
end
end
end
end
end
GhoulofGSG9Join Date: 2013-03-31Member: 184566Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, Reinforced - Supporter, WC 2013 - Supporter, Pistachionauts
edited June 2014
function ItemUnlocker()
local score = player:GetScore()
if self:isa("Player") and self:GetTeamNumber() == kTeam1Index then
if HasMixin(self, "Scoring") and score > 5 then
self:GiveItem(Welder.kMapName)
end
end
Where should that function get "self" and "player" from? Those vars are nowhere declared as locals or globals for that function.
Comments
Seems like in your case self doesnt has that mixin and is therfor not a player.
but nothing happens...
also better design it as local
Where should that function get "self" and "player" from? Those vars are nowhere declared as locals or globals for that function.