Statistics: Posted by Domino — 15 Mar 2015, 11:52
Statistics: Posted by Locutus — 14 Mar 2015, 00:34
Myxir wrote:
you can pass information from sim to ui by using UserSync.lua
as example, use
- Code:
Sync.researchpoints = {0 = 13, 1 = 342, 2 = 23, 3 = 98}
somewhere in the code, Sync is a global var and you don't need to import it
then, hook UserSync.lua:
- Code:
local baseOnSync = OnSync
function OnSync()
baseOnSync()
if Sync.researchpoints then
import('/mods/researchMod/modules/myUi.lua').updateUi(Sync.researchpoints)
end
end
Myxir wrote:
(in this case, you'd send all data to every player, but you get the idea)
OnCreate = function(self)
TWallStructureUnit.OnCreate(self)
print('RM: A research station has been built')
self:ForkThread(self.GenerateResearchThread)
end,
GenerateResearchThread = function(self)
while true do
local army = self:GetArmy()
if not Sync.ResearchPoints then
Sync.ResearchPoints = {Army = army, ResearchPoints1 = 3}
end
WaitSeconds(1.00)
end
end,
function UpdateScores(ResearchPoints)
if not ResearchPoints then
return
end
local rsp = ResearchPoints.ResearchPoints1
research_points_1 = research_points_1 + rsp
if research_points_1 >= research_points_1_max then
research_points_1 = research_points_1 - research_points_1_max
research_points_2 = research_points_2 + 1
treePointView.Group.ResearchPoints2:SetText(research_points_2)
end
treePointView.Group.ResearchPoints1:SetText(LOCF('%s / %s', research_points_1, research_points_1_max))
end
Myxir wrote:
unsure about this, i suggest to take a look at some blackops/extremewars code, they might do stuff like that
Statistics: Posted by Locutus — 10 Mar 2015, 23:00
Sync.researchpoints = {0 = 13, 1 = 342, 2 = 23, 3 = 98}
local baseOnSync = OnSync
function OnSync()
baseOnSync()
if Sync.researchpoints then
import('/mods/researchMod/modules/myUi.lua').updateUi(Sync.researchpoints)
end
end
Locutus wrote:
2) I somehow need to count the points for each player separately. Is it correct that "army" is the word I need to look for in the scripts?
Are there simple mods you could suggest as learning examples?
for army, brain in ArmyBrains do
myPointTable[army] = hisResearchPoints
end
Sync.researchpoints = myPointTable
Locutus wrote:
3) In the campaign new units get unlocked all the time. I haven't really looked for it yet but I think that should work in multiplayer too, right? Is it also possible to unlock new abilities? I believe a cheaty solution would be to lock the old unit and unlock a new one in the factory but would it be also possible for all units that are already on the field?
Statistics: Posted by Myxir — 10 Mar 2015, 19:30
Statistics: Posted by Locutus — 10 Mar 2015, 19:09