Scapoose Posted July 16, 2018 Share Posted July 16, 2018 So here im looking through the mods section and im like Player??? WARP GATES YES , How ever when i tried testing it, i get from the server console Using /gate Create xxx -xxx Via Console Execution Context (inner to outer): #0: execute data/scripts/commands\gate.lua could not execute function 'execute' in '"data/scripts/commands\gate.lua"': data/scripts/commands\gate.lua:2: attempt to index a nil value stack traceback: data/scripts/commands\gate.lua:2: in function <data/scripts/commands\gate.lua:1> Script "data/scripts/commands\gate.lua" or one of its requirements is not in its original state, skipping sending of stack trace. Using /gate create xxx -xxx Via client Execution Context (inner to outer): #0: initialize data/scripts/player/cmd/gate.lua could not execute function 'initialize' in '"data/scripts/player/cmd/gate.lua"' property not found or not readable: Player.payMoney stack traceback: [C]:-1: in function __index data/scripts/player/cmd/gate.lua:32: in function popWormhole data/scripts/player/cmd/gate.lua:13: in function ? Setting state to invalid. I have no knowledge into this sort of coding but id figure id ask and see what anyone has to say. Link to comment Share on other sites More sharing options...
Devious Posted July 16, 2018 Share Posted July 16, 2018 It looks like the Player.payMoney hook might have changed, you can find the API hooks in the documentation folder. edit: found this function var pay(string or Format [optional] description, int money, int... resources) function bool, string, table<int, string> canPayMoney(int money) Link to comment Share on other sites More sharing options...
Scapoose Posted July 16, 2018 Author Share Posted July 16, 2018 So this is the code using player,price ,how ever i cant figure out where to rewrite what you have giving me in possible to making it work Edit: put the full gate.lua into this if onServer() then package.path = package.path .. ";data/scripts/lib/cmd/?.lua" package.path = package.path .. ";data/scripts/lib/?.lua" require "common" SectorGenerator = require ("SectorGenerator") Placer = require ("placer") function initialize(help, action, ...) local flag, msg = false, "" player = Player() if action == "create" then local ship = Entity(Player().craftIndex) flag, msg = popWormhole(ship, ...) else player:sendChatMessage("Gate", 0, "Unknown action: "..action) end terminate() end local station function popWormhole(ship, x1, y1) --local player,price = Player(),0 if onClient() then invokeServerFunction("popWormhole") return end local player,price = Player(),0 if not player:canPayMoney(price) then player:sendChatMessage("Station Founder"%_t, 1, "You Need 1000000 credits!") return end if player:canPayMoney(price) then player:payMoney(price) local generator = SectorGenerator(Sector():getCoordinates()) local faction = Faction() station = ShipGenerator.createShipGate(faction) center = center or vec3() station.position = MatrixLookUpPosition(vec3(0, 1, 0), vec3(1, 0, 0), center + random():getDirection() * random():getFloat(500, 750)) Placer.resolveIntersections() local plan = PlanGenerator.makeGatePlan() station:setPlan(plan) station.invincible = true station.title = "Hacked Warp Gate"%_t local sector = Sector() local wormhole = createWormhole(station.translationf,x1,y1) end end function createWormhole(center, x1, y1) center = center or vec3() local wormholeLifetime = 55 -- spawn a wormhole local desc = WormholeDescriptor() desc.position = station.position desc.cpwormhole.color = ColorRGB(0, 0, 1) --desc:addScript("data/scripts/entity/gate.lua") local size = random():getFloat(75, 150) local x, y = Sector():getCoordinates() local own = vec2(x, y) local d = length(own) local distanceInside = 355; local specs = SectorSpecifics() local x, y = Sector():getCoordinates() local coords = specs.getShuffledCoordinates(random(), x, y, 1, 25) local serverSeed = Server().seed --local x1, y1 = Sector():getCoordinates() local wormhole = desc.cpwormhole --local faction1 = Galaxy():getNearestFaction(x, y) wormhole:setTargetCoordinates(x1, y1) wormhole.visible = false wormhole.visualSize = 50 wormhole.passageSize = 50 wormhole.oneWay = false wormhole.simplifiedVisuals = true --wormhole.title = getGateName() local wormhole = Sector():createEntity(desc) --local timer = DeletionTimer(wormhole.index) --timer.timeLeft = wormholeLifetime wormhole.translation = station.translation return wormhole end end Link to comment Share on other sites More sharing options...
Raboy13 Posted July 17, 2018 Share Posted July 17, 2018 Please patch the complex mod for 0.17 :) 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