Phase Gate visible destination
<div class="IPBDescription">Auto generated based on linked gate.</div>Went ahead and fiddled with the .lua.
Fairly straight forward to add in.
Marines see "Phase gate to Place (X%)'.
Aliens see 'Phase gate (X%)'.
<img src="http://img815.imageshack.us/img815/3995/2011061700004.jpg" border="0" class="linked-image" />
<img src="http://img713.imageshack.us/img713/3389/2011061700003.jpg" border="0" class="linked-image" />
<img src="http://img810.imageshack.us/img810/1694/2011061700001.jpg" border="0" class="linked-image" />
PhaseGate.lua, ~line 22
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> // KRIS START
linked = "boolean",
linkedLocId = "integer"
// KRIS END</div>
PhaseGate.lua, ~line 36
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> // Compute link state on server and propagate to client for looping effects
self.linked = false
// KRIS START
self.linkedLocId = 0
// KRIS END</div>
PhaseGate.lua, ~line 63
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>end
// KRIS START
function PhaseGate:GetDestinationLocation()
local locText = ""
if self.linkedLocId ~= 0 then
locText = Shared.GetString(self.linkedLocId)
end
return locText
end
// KRIS END
if Server then</div>
PhaseGate.lua, ~line 119
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> // Update linked state
// KRIS START
//self.linked = self:GetIsBuilt() and self:GetIsActive() and (destinationPhaseGate ~= nil)
self.linked = false
self.linkedLocId = 0
if (self:GetIsBuilt() and self:GetIsActive() and (destinationPhaseGate ~= nil)) then
self.linked = true
self.linkedLocId = destinationPhaseGate.locationId
end
// KRIS END</div>
NS2Utility.lua, ~line 1264
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> secondaryText = "Unrooted "
end
// KRIS START
elseif entity:isa("PhaseGate") then
if not enemyTeam then
local destLoc = entity:GetDestinationLocation()
if destLoc ~= nil and destLoc ~= "" then
statusText = string.format("to %s %s", destLoc, statusText)
end
end
// KRIS END
else</div>
Originally it replaced the 'linked' network variable with the entity id of its destination.
Problem was that the destination didn't always exist on the client, so information like its location could not be retrieved.
This method copies the location id of the destination gate and sends that to the client.
Simple.
Enjoy.
Fairly straight forward to add in.
Marines see "Phase gate to Place (X%)'.
Aliens see 'Phase gate (X%)'.
<img src="http://img815.imageshack.us/img815/3995/2011061700004.jpg" border="0" class="linked-image" />
<img src="http://img713.imageshack.us/img713/3389/2011061700003.jpg" border="0" class="linked-image" />
<img src="http://img810.imageshack.us/img810/1694/2011061700001.jpg" border="0" class="linked-image" />
PhaseGate.lua, ~line 22
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> // KRIS START
linked = "boolean",
linkedLocId = "integer"
// KRIS END</div>
PhaseGate.lua, ~line 36
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> // Compute link state on server and propagate to client for looping effects
self.linked = false
// KRIS START
self.linkedLocId = 0
// KRIS END</div>
PhaseGate.lua, ~line 63
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>end
// KRIS START
function PhaseGate:GetDestinationLocation()
local locText = ""
if self.linkedLocId ~= 0 then
locText = Shared.GetString(self.linkedLocId)
end
return locText
end
// KRIS END
if Server then</div>
PhaseGate.lua, ~line 119
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> // Update linked state
// KRIS START
//self.linked = self:GetIsBuilt() and self:GetIsActive() and (destinationPhaseGate ~= nil)
self.linked = false
self.linkedLocId = 0
if (self:GetIsBuilt() and self:GetIsActive() and (destinationPhaseGate ~= nil)) then
self.linked = true
self.linkedLocId = destinationPhaseGate.locationId
end
// KRIS END</div>
NS2Utility.lua, ~line 1264
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'> secondaryText = "Unrooted "
end
// KRIS START
elseif entity:isa("PhaseGate") then
if not enemyTeam then
local destLoc = entity:GetDestinationLocation()
if destLoc ~= nil and destLoc ~= "" then
statusText = string.format("to %s %s", destLoc, statusText)
end
end
// KRIS END
else</div>
Originally it replaced the 'linked' network variable with the entity id of its destination.
Problem was that the destination didn't always exist on the client, so information like its location could not be retrieved.
This method copies the location id of the destination gate and sends that to the client.
Simple.
Enjoy.
Comments
However, would you mind uploading your modified PhaseGate.lua and NS2Utility.lua files somewhere (dropbox?) and posting a link?
Edit: Alright, I made put your changes in an easy to load mod for NS2
Download: <a href="http://dl.dropbox.com/u/5490563/mod_pg.zip" target="_blank">http://dl.dropbox.com/u/5490563/mod_pg.zip</a>
How to install:
<ul><li>Extract the mod files to your "/Steam/steamapps/common/natural selection2/" folder</li><li>Put "-game mod_pg" (without the quotation marks) in your launch options for NS2 (i.e. right click Natural Selection 2 in your games library and select properties, then under General, select 'Set launch options...")</li></ul>
<b>NOTE:</b> This changes only seem to work for a listen server. Any server I try joining gives me a 'Client and Server differ' error. Maybe this is because you made changes to NS2Utility.lua?
The server and client need the same files.
My bad, should have mentioned it :(
HL2 had cameras + screens which could sort of achieve this but it was still tricky and in the end the reward for doing that isn't that great, since you can just look at the mini map and get a better idea of what's going on at the destination anyways...
Also, it would be cool if we could somehow choose the destination, like pushing E on the portal so it switches the link. And maybe even switching it for everyone at the same time so people don't find themselve lonely where they get.
Groovy.
My first method worked fine if you could see them and used one network variable, rather than two.
I was thinking of changing the way the gates were picked too, to allow for setting an 'emergency' exit point etc (priority system I mentioned in other thread).