Jump to content

[MOD] Welcome Mail - 1.0


Shrooblord

Recommended Posts

For anyone still looking for a mod like this in the Steam Workshop Era, why not check out Bubbet's Ranks Mod? It does everything this mod did, and more.
 

====

 

After a request made by death dealah for a mod that creates a welcome e-mail to first-timers on a server, I created this mod, which is able to send such welcome e-mail, and include resources like money and all the materials from Iron up to Avorion as an attachment to the e-mail.

 

====

 

WELCOME MAIL - v1.0

 

Introducing: Welcome Mail!

 

Kspu1m4.png

 

 

====

 

MODIFYING THE E-MAIL (SERVER OWNERS):

 

You can change the contents of the e-mail, including the amount of resources the joining player will receive, by modifying the appropriate lines of code in the file /mods/WelcomeMail/scripts/player/welcomeMail.lua :

 

invokeServerFunction("setTranslatedMailText",
                     "Some Assets to Help You Get Rolling"%_t,  --message header
                     WelcomeMail.generateWelcomeMailText(Player().index),
                     "Shrooblord /* The owner of this galaxy. Wait, what? */"%_t)   --sender
invokeServerFunction("generateWelcomeMailAttachments",
                      50,  --money
                      100,  --iron
                      200,  --titanium
                      300,  --naonite
                      400,  --trinium
                      500,  --xanion
                      600,  --ogonite
                      700)  --avorion

local welcome_text = [[Welcome, ${player},

We see you are new here. Good to have you on board!
Included in this e-mail is a bit of a start-up capital for you to work with.
We hope this will help you get going more easily, and give you a little bit
of a leg-up in this dangerous Galaxy... good luck out there!
    
May our paths once cross. Until then!

Best wishes,


Your Galactic Overlords
]]%_t
 

 

====

 

INSTALLATION INSTRUCTIONS:

 

This mod needs to be installed on both client and server.

 

Unzip the contents of this .ZIP file into your (...)/Avorion/ installation directory.

 

Modify (...)/Avorion/data/scripts/server/server.lua in the following way:

 

Insert this code inside the onPlayerLogIn call.

    player:addScriptOnce("mods/WelcomeMail/scripts/player/welcomeMail.lua")                                   --WelcomeMail
 

If you had a vanilla server.lua file, that function will now look like this:

    function onPlayerLogIn(playerIndex)
        local player = Player(playerIndex)
        Server():broadcastChatMessage("Server", 0, "Player %s joined the galaxy"%_t, player.name)

        player:addScriptOnce("headhunter.lua")
        player:addScriptOnce("eventscheduler.lua")
        player:addScriptOnce("story/spawnswoks.lua")
        player:addScriptOnce("story/spawnai.lua")
        player:addScriptOnce("story/spawnguardian.lua")
        player:addScriptOnce("story/spawnadventurer.lua")
        player:addScriptOnce("mods/WelcomeMail/scripts/player/welcomeMail.lua")                                   --WelcomeMail

        matchResources(player)
    end
 

You're done! Have fun playing. 🙂

 

NOTE: A side effect of having to install this mod on both client and server means that new Galaxies created in singleplayer will also trigger the Welcome Mail. I'm looking into how to prevent this from happening.

 

Changelog

==MOST RECENT VERSION: 1.0==

1.0

  • Initial release.

 

==OLDER VERSIONS==

 

 

 

  • 1.0
    • Initial Release

 

 

WelcomeMail-1.0.zip

Edited by Shrooblord
Link to comment
Share on other sites

BUG REPORT

Turns out the Welcome Mail contents listen only to the contents as they are defined on the client-side. This is bad. Why? Because the client can say "hey put 7 million Avorion in the Welcome Mail" and the server won't be able to do anything against it. Lame.

 

I will look into this and publish an updated version of the mod ASAP.

Link to comment
Share on other sites

  • 3 weeks later...

hey Shrooblord!

 

It's awesome that you're working on this, thank you!

 

Does it not defeat the purpose of a welcome mail for the person joining the server for the first time to not recieve it because they haven't installed the mod that sends them a welcome mail telling them to install the mod?

 

If that didn't blow your circuits, mod MUST be server side only to be of any use. 

 

 

I've seen your work, it's awesome!  bye for now

 

Link to comment
Share on other sites

Hi Shrooblord - saw a similar mod on one server, but there it did not need to install it on the client.

 

By accessing the server, the player also received a welcome letter and initial resources.

 

Far Hope Sector

IP Avorion - 146.158.111.29:27000

Link to comment
Share on other sites

  • 2 years later...

I really would like this mod on my server, however I cant seem to get it to work and i followed all the instructions.

Also to note, the server.lua file is no longer there. From the updates since Oct, they seem to removed it. 

Edited by Draxima
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...