Module : Ore extraction

edited October 2016 in EmptyEpsilon
Hi,

I propose a complete script to add ore into asteroids and an extraction capacity to the ship.

https://dropbox.com/s/eas84cb13cen5r1/scenar_minerai.lua?dl=0

To use it, you have to place it in the script folder and to add this code in the Init function of your script :

Script():run("scenar_minerai.lua")

From now, it is only available for the first playerspaceship, but i think it is easy to adapt for many playerspaceship (if someone knows how, please say it to me).

Also, from now, the script is in french, but it is not difficult to translate it I think (if you want, I can help you).

Each Asteroid can contain a ore, with a concentration. In the script, you have to complete two tables (or you can just use mine) , one for "classic" asteroid, one for asteroid within nebula, to describe each ore you want in your scenario , with some parameters :
- Name of the ore
- Probability to find it
- difficulty to scan it
- Max of concentration

You also have to complete a scan table (or use mine) to give scanning parameters of each scan difficulty.

At the beginning of the game, all asteroids are empty, and the GM can add ore to an asteroid (or to a lot of asteroids), randomly selected or selected by the GM.

The relay knows the part of asteroid around the playerspaceship and around the probes which contains Ore

The science can scan asteroids to know their composition.

The engineer can extract ore if the ship is nearest than 1U from the asteroid, and if the asteroid is scanned. The engineer see the stock of the ship. He/She can also unload ores, in a station or in space. From now, their is no impact of this action in the game.

The weapons can destroy asteroid near than 2.5 U, by using a HVLI for all of them.

The Helm... pilots the ship ^^

The script doen't add effect on the game, but it is easy to make that. For example, I added in my scenario a capacity to transform Ore into special EMP, then a capacity for the weapons to launch the special EMP to disable some beams and tube launcher for a target.

Please be free to use it and to comment it.

Comments

  • edited October 2016
    I'll try it out maybe tonight. Looks cool good, would adding a reputation bonus for unloading ore be hard to implement? I was thinking money, but this could be a way to get resources for the stations that make missiles for your ship.
  • So I got a bit of time to try it out tonight. Neat.
    I will be translating it a little at a time. But I understand most of the words.
    However, in the GM screen on the left table when you click on the type of fill for the asteroid is it placing that all asteroids currently in the game or? I was able to figure out how that works.
  • I translated most almost all the information that is sent to the player or on buttons tonight. I like your emp idea, can you provide that script as well?
    I played some more with it after the translation and works well. Though Maybe adding a warning if you are not close enough to mine the asteroid. I will attempt that, but my scripting skills are not as good as you.

    Thank you for providing this, I may use it in an upcoming game.
  • So, I added an additional mineral, dilithium, for Kwadroke's star trek mod, but I couldn't get an extra button for refining it to show up. I didn't see anywhere for locating a button in the engineering station, I must be missing something. I'll admit my script skill is not that good but following other examples I'm hoping I can get it done. Any advice el.Tito? Thank you
  • Hi,

    Here is my code for my special EMP, I think I can do something more useful, but it works :)

    function create_empp(delta) if player.create_empp == nil then player.create_empp = 0 end if player.create_empp == 1 then if player.minerai["Yttrium"] == 0 then player:addToShipLog("Yttrium indisponible pour crꦲ la bombe ࡦr겵ence","red") player.create_empp = 0 end if player.minerai["Yttrium"] > 0 then player.minerai["Yttrium"] = player.minerai["Yttrium"] - 1 player.update_stock = 1 player:addCustomInfo("engineering","INFO_EMPP","Crꢴion de la bombe") player.timer_empp = 0 player.create_empp = 2 end end if player.create_empp == 2 then player.timer_empp = player.timer_empp + delta if player.timer_empp > 20 then player:removeCustom("INFO_EMPP") if player.empp == nil then player.empp = 0 end player.empp = player.empp + 1 player:addCustomInfo("weapons","COUNT_EMPP","Nombre d'EMPP : " .. player.empp) player:addCustomButton("weapons", "LAUNCH_EMPP", "Activer EMPP", function() x0,y0 = player:getPosition() if player.empp >= 1 then player.empp = player.empp - 1 if player.empp == 0 then player:removeCustom("LAUNCH_EMPP") end player:addCustomInfo("weapons","COUNT_EMPP","Nombre d'EMPP : " .. player.empp) for _, obj in ipairs(getObjectsInRadius(x0,y0,4000)) do if obj.typeName == "CpuShip" then effet_empp = math.floor(random(1,obj:getWeaponTubeCount())) player:addToShipLog("Vaisseau " .. obj:getCallSign() .. " : " .. effet_empp .. "canon(s) d괡ctiv驳)","yellow") obj:setWeaponTubeCount(obj:getWeaponTubeCount()-effet_empp) for n=0,15 do if random(0,100) < 40 then obj:setBeamWeapon(n, obj:getBeamWeaponArc(n), obj:getBeamWeaponDirection(n) , obj:getBeamWeaponRange(n)*0.4, obj:getBeamWeaponCycleTime(n), obj:getBeamWeaponDamage(n)) end end end end end end) player.create_empp = 0 end end end function init(delta) player:addCustomButton("engineering", "CREATE_EMPP", "Crꦲ EMPP", function() player.create_empp = 1 end) end function update(delta) create_empp(delta) end
  • Flea11 said:

    So, I added an additional mineral, dilithium, for Kwadroke's star trek mod, but I couldn't get an extra button for refining it to show up. I didn't see anywhere for locating a button in the engineering station, I must be missing something. I'll admit my script skill is not that good but following other examples I'm hoping I can get it done. Any advice el.Tito? Thank you

    You have to update the table "liste_minerais", the table "table_minerai" and the table "table_minerai_nebula". After that, I think it could work.

    Don't forget to update all the probability. A example :

    table_minerai = {} -- creation d'une table table_minerai[1] = {"Fer",0.3,"facile",20} table_minerai[2] = {"Nickel",0.2,"moyen",20} table_minerai[3] = {"Silice",0.1,"moyen",15} table_minerai[4] = {"Dilithium",0.1,"difficile",10} table_minerai[4] = {"Vide",0.4,"facile",0} table_minerai_nebula = {} table_minerai_nebula[1] = {"Fer",0.1,"facile",20} table_minerai_nebula[2] = {"Nickel",0.1,"moyen",20} table_minerai_nebula[3] = {"Silice",0.05,"moyen",15} table_minerai_nebula[4] = {"Scandium",0.15,"facile",5} table_minerai_nebula[5] = {"Yttrium",0.2,"moyen",5} table_minerai_nebula[6] = {"Cerium",0.1,"difficile",5} table_minerai_nebula[7] = {"Praseodyme",0.1,"difficile",5} table_minerai_nebula[8] = {"Dilithium",0.1,"difficile",10} table_minerai_nebula[9] = {"Vide",0.1,"facile",0} liste_minerais = {"Fer","Nickel","Silice","Scandium","Yttrium","Cerium","Praseodyme"} player.minerai = {["Fer"]=0,["Nickel"]=0,["Silice"]=0,["Scandium"]=0,["Yttrium"]=0,["Cerium"]=0,["Praseodyme"]=0,["Dilithium"]=0}

  • Thank you! Yes I updated the table and rest of info, I will see about using your emp script for my refine fuel idea, I will let you know how it goes.
  • edited October 2016
    El.tito
    Here is what I added for an additional button...but it's not working..


    --REFINEmeans Download ore
    player:addCustomButton("engineering", "REFINE_DILITHIUM", "Refine Dilithium", function()
    if compte_stocks(player) > 0 then
    for _, res in ipairs(liste_minerais) do
    player.minerai[res] = 0
    end

    local x,y = player:getPosition()
    local dummy_station = 0
    for _, obj in ipairs(getObjectsInRadius(x,y,1500)) do
    if obj.typeName == "SpaceStation" then dummy_station = 1 end
    end
    if dummy_station == 1 then
    player:addToShipLog("Resources mining released","white")
    else
    player:addToShipLog("Resources mining evacuated in space","red")
    end
    player.update_stock = 1
    end
    end)

    Thanks for your help

    Granted it has stuff from download ore button, but I was attempting to get it to show up first..
  • i don't understand, what do you want to do with this function ? What do you mean by "refine" the dilithuim ?

    Because your function only leave the ores from the stock.
  • Yeah, sorry, I want the function to create energy for the ship.
    Sorry, I thought I mentioned that in this thread, but i did in another...
  • Ah ok...

    An example :

    player:addCustomButton("engineering", "REFINE_DILITHUIM", "refine dilithuim", function() if player.minerai["Dilithuim"] == 0 then player:addToShipLog("Yttrium not available","red") end if player.minerai["Dilithuim"] > 0 then player.minerai["Dilithuim"] = player.minerai["Dilithuim"] - 1 player.update_stock = 1 player:setEnergyLevel(player:getEnergyLevel()+200) end end)

    You have to active to rest of my code, for the gestion of the ore.
  • Ah simply marvelous, thank you sir. Pretty close to what I was thinking of doing
    I will give it a try. However do you have your emp code in the scene_mineri script or separate, when I add the emp portion it tends to not display the ore parts (buttons) in the game.

    Thank you for your time,
  • Well that worked, good sir. Thank you.
  • Perfect !

    Based on your idea, I create some functions to provide weapons, hull or energy with ore combinaison. I will post these function here when I will have tested them.
  • We thank you! I'll try out anything you make!
  • As there been any progress with this function? I find it a very nice addition!
  • Hey,

    Sorry for the delay. I have made some progress. Here is the last version, with function to create hull, energy, homing, EMP, mines, nuke and emp+ (disable shields).

    Sorry, it is in french by the way.

    If you have some questions, be my guest.
  • Thank you! I will see if I can test it this week! I may try to translate most of it at some point, but first am going to check out the functionality!
Sign In or Register to comment.