Phase Gate visible destination

slowJuskoslowJusko Join Date: 2010-12-24 Member: 75922Members
<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.

Comments

  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    edited June 2011
    Awesome.

    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?
  • slowJuskoslowJusko Join Date: 2010-12-24 Member: 75922Members
    edited June 2011
    An extra network variable is set on the server, then used by a call from GetCrosshairText() on the client to get the correct location.
    The server and client need the same files.
    My bad, should have mentioned it :(
  • aeroripperaeroripper Join Date: 2005-02-25 Member: 42471NS1 Playtester, Forum Moderators, Constellation
    They should add this to the game.
  • SwampRatSwampRat Join Date: 2003-02-10 Member: 13369Members
    I thought you meant having the destination visible through the phasegate, sort of like a blue wobbly semi-transparent image. Names make much more sense...
  • FrenchDude59FrenchDude59 Join Date: 2011-06-16 Member: 104696Members
    edited June 2011
    We were trying to achieve that in a MOD I used to program for back in the day for HL2 SwampRat, the problem with doing that is that you have to somehow get the server to send you the information for the entities at the destination point, and then get the engine to render a slice of the world at that destination...

    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...
  • peregrinusperegrinus Join Date: 2010-07-16 Member: 72445Members
    Very useful mod. If you could get the phase gates to appear on the marines minimap that would be awesome too.
  • FlayraFlayra Game Director, Unknown Worlds Entertainment San Francisco Join Date: 2002-01-22 Member: 3Super Administrators, NS2 Developer, Subnautica Developer
    I just put this into the game (although I implemented it slightly differently). Thanks!
  • Deagle2Deagle2 Join Date: 2010-11-30 Member: 75360Members
    I hope that someday phase gates will look like portals in portal, wel that would be a post-release feature of course, but that would be awesome!
    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.
  • slowJuskoslowJusko Join Date: 2010-12-24 Member: 75922Members
    <!--quoteo(post=1855504:date=Jun 23 2011, 08:01 AM:name=Flayra)--><div class='quotetop'>QUOTE (Flayra @ Jun 23 2011, 08:01 AM) <a href="index.php?act=findpost&pid=1855504"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I just put this into the game (although I implemented it slightly differently). Thanks!<!--QuoteEnd--></div><!--QuoteEEnd-->

    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).
Sign In or Register to comment.