LogicSocket Posted February 18, 2017 Share Posted February 18, 2017 I'm trying to get a function to work to create a wormhole: function onWormHolePlanPressed() if onClient() then invokeServerFunction("onWormHolePlanPressed") return end local generator = SectorGenerator(Sector():getCoordinates()) generator:createGates() end Anyone know why this isn't working or know the proper way to do that please? Thank you -LS Changed subject so it gives some idea about what's inside, Aki. Link to comment Share on other sites More sharing options...
Boxelware Team cepheni Posted February 19, 2017 Boxelware Team Share Posted February 19, 2017 Look in the documentation on the server-side sector class. There should be a function createWormhole. Link to comment Share on other sites More sharing options...
JEENA Posted February 19, 2017 Share Posted February 19, 2017 Would be fun to be able to open wormholes like an hyperspace window (#STARGATE ATLANTIS HYPERESPACE) Link to comment Share on other sites More sharing options...
LogicSocket Posted February 19, 2017 Author Share Posted February 19, 2017 Look in the documentation on the server-side sector class. There should be a function createWormhole. Thanks Cepheni, I saw that I'll just have to tinker until I can get it to work. Problem is figuring out proper way to make it work. Link to comment Share on other sites More sharing options...
Aki Posted February 19, 2017 Share Posted February 19, 2017 @LogicSocket I leave following code for you as some kind of small reference. I was playing around with wh creation and this is really simple function for that. -- x and y are coordinates of exit function popWormhole(x, y) if x and y then local player = Player() local sector = Sector() local ship = Entity(player.craftIndex) local wormhole = sector:createWormHole(x, y, ColorRGB(0,1,1), 25) wormhole.translation = ship.translation -- you will need to get away from the wormhole first end end Link to comment Share on other sites More sharing options...
LogicSocket Posted February 19, 2017 Author Share Posted February 19, 2017 Thank you Aki! works like a charm. For my uses I have scripts attached to a system that allows for dialog options: function onStartDialog(playerIndex) ScriptUI(playerIndex):addDialogOption("[Create WormHole]"%_t, "popWormhole") end function popWormhole() if onClient() then invokeServerFunction("popWormhole") return end local player = Player() local sector = Sector() local ship = Entity(player.craftIndex) local x, y = random():getInt(-400, 400) local wormhole = sector:createWormHole(x, y, ColorRGB(0,1,1), 25) wormhole.translation = ship.translation -- you will need to get away from the wormhole first end EDIT:I changed wormhole.translation = ship.translation to wormhole.translation = random():getFloat(75,150) this solves it being right on top of the ship :) cheers Link to comment Share on other sites More sharing options...
vrenth Posted February 21, 2017 Share Posted February 21, 2017 I know you guys are super awesome and smart for getting this to work, but would it be possible to get this packaged up for others to use as well? Creating wormhole would be amazing ^_^ Link to comment Share on other sites More sharing options...
LogicSocket Posted February 21, 2017 Author Share Posted February 21, 2017 I know you guys are super awesome and smart for getting this to work, but would it be possible to get this packaged up for others to use as well? Creating wormhole would be amazing ^_^ Hey there vrenth. here you go: http://www.avorion.net/forum/index.php/topic,2262.0.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now