LoSboccacc Posted February 20, 2017 Share Posted February 20, 2017 I want to make an easier start to a more difficult server, I'd like to give starting players 100k credit, 10k iron and 1k titanium I think I can work around the mail system to attach and send the stuff, but I can't find where/how to register the script so it runs at player first creation any pointer? I found in the doc the galaxy has a 'onPlayerCreation' callback, but I still need some way to have that method called and a script attached properly nevermind found it, in the end it's yet another piece of code going in server.lua function onPlayerCreated(index) -- default stuff do no touch local player = Player(index) Server():broadcastChatMessage("Server", 0, "Player %s created!"%_t, player.name) -- welcome mail local mail = Mail() mail.money = 100000 mail.sender = "The Tutorial Hating Co" mail.header = "Greetings" mail:setResources(10000, 1000, 0, 0, 0, 0, 0) mail.text = "Here's a starting package to boostrap your exploration. This is a dangerous galaxy, don't go alone! " player:addMail(mail) end Link to comment Share on other sites More sharing options...
Aki Posted February 21, 2017 Share Posted February 21, 2017 I know it is solved, but I would like to add one more thing: Default start resources are handled by scripts/server/factions.lua (lines 112-118): if server.difficulty == Difficulty.Beginner then player:receive(40000, 5000) elseif server.difficulty == Difficulty.Easy then player:receive(20000, 2000) else player:receive(10000) end Link to comment Share on other sites More sharing options...
LoSboccacc Posted February 21, 2017 Author Share Posted February 21, 2017 ah I see! thanks that'd be much better and less conflict prone - weird tho that part of the player creation callback code is also on the server.lua Link to comment Share on other sites More sharing options...
Eury Posted February 24, 2017 Share Posted February 24, 2017 how would i attach weapons say 2 randomexceptional iron/titanium turrets and 2 random exceptional titanium mining turrets 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