Jump to content

[REQ] [QUESTION] - Changing pirate attack time and alien attack time


JayNic

Recommended Posts

Hey guys,

 

I'm trying to mod the frequency of two events: The aliens, and the pirates.

 

I have found in the file: "scripts\events\pirateattack.lua" there is a function called "getUpdateInterval" and it simply returns "15"

 

--VANILLA CODE
function getUpdateInterval()
return 15
end

 

 

If I update it to something like the following, is that good enough?

--UPDATE BY JAYNIC
function getUpdateInterval()
math.randomseed(os.time())
        local x = math.random(15,60) 
        print("events/pirateattack.lua.getUpdateInterval: returning " .. tostring(x))
        return x
end

 

 

The other part of the question is: where can I find the alien spawning time?

Link to comment
Share on other sites

Ok I was wrong. I'm pretty sure it's all in "player/eventscheduler.lua"

 

There is an initial object set up with some variables that looks like this:

 

local events =
{
    {schedule = random():getInt(45, 60) * 60, script = "convoidistresssignal", arguments = {true}, to = 560},
    {schedule = random():getInt(60, 80) * 60, script = "fakedistresssignal", arguments = {true}, to = 560},
    {schedule = random():getInt(60, 80) * 60, script = "piratehunter", to = 560},
    {schedule = random():getInt(25, 50) * 60, script = "alienattack", arguments = {0}, minimum = 5 * 60, from = 0, to = 500},
    {schedule = random():getInt(35, 70) * 60, script = "alienattack", arguments = {1}, minimum = 25 * 60, to = 500},
    {schedule = random():getInt(60, 80) * 60, script = "alienattack", arguments = {2}, minimum = 60 * 60, to = 350},
    {schedule = random():getInt(80, 120) * 60, script = "alienattack", arguments = {3}, minimum = 120 * 60, to = 300},
    {schedule = random():getInt(50, 70) * 60, script = "spawntravellingmerchant", to = 520},
}

 

These are the available events, and each of their names correspond to a script file that is used to generate the appripriate event particulars.

The "schedule" property seems to be what denotes their time. For "piratehunter" it randomizes a value between 60-80 minutes. Out to a range in the galaxy of up to 560 sectors.

 

 

Later in the script I found a comment that states that if there are more than one player in the sector: then cut the event time in half. That means twice as fast. So this is why it seems when I'm playing with friends: we get attacked by pirates and aliens ALL the time...

 

 

I think I'm going to just double those values in the random:getInt call

 

Link to comment
Share on other sites

  • 4 weeks later...

i'm actually working on a balance mod too. you are right in both posts.

 

both player/eventscheduler and events/pirateattack need to be modified. events/pirateattack seems to be an event connected to the sector, whereas all the others seem to be attached to the players.

 

the version im working on attempts to balance how often events happen based on how beastial the sector is. the first thing we wanted is when a sector is empty, we want to simulate pirates not having enough interest to even bother going there just to screw with you. on the other hand we also want pirates et al to gtfo when a sector is defended to the spaceteeth. so the result we are creating a curve that modifies the frequency and chance of an event happening based on the total volume of ships in a sector and compare that to what the game expects the average ship in a specific sector to look like.

 

if the volume of ships is simliar enough to what the sector expects then we allow the events. if its too empty or too full then we start applying chances to skip the event. still working out a few kinks, my lua is rusty. probably push it to github with diffs in a few days if interested.

Link to comment
Share on other sites

I had to modify this stuff for my ultimate difficulty mod due to the amount of time it could take on the much bigger spawns. Before I had like 5 events pop up but now events are pretty rare and when they happen you feel ready to tackle it and not burnt out. Lots of time I get to mine and explore but I also can have a large xsotan event that will take me an hour to deal with if I get the extreme spawns lol.

 

Sometimes it's overwhelming but then it can go silent for awhile and I am out looking for a battle. Tough to balance but I am happy where it's at.

 

That event schedule plays around with the likely hood of which events happen more frequently than others and at what distances before they even begin to happen.

 

I'll post my setup in the morning :)

Link to comment
Share on other sites

my Event timer is currently this

local events =
{
    {schedule = random():getInt(45, 60) * 60, script = "convoidistresssignal", arguments = {true}, to = 560},
    {schedule = random():getInt(60, 80) * 60, script = "fakedistresssignal", arguments = {true}, to = 560},
    {schedule = random():getInt(60, 80) * 60, script = "piratehunter", to = 560},
    {schedule = random():getInt(25, 50) * 60, script = "alienattack", arguments = {0}, minimum = 5 * 60, from = 0, to = 500},
    {schedule = random():getInt(35, 70) * 60, script = "alienattack", arguments = {1}, minimum = 25 * 60, to = 500},
    {schedule = random():getInt(60, 80) * 60, script = "alienattack", arguments = {2}, minimum = 60 * 60, to = 350},
    {schedule = random():getInt(80, 120) * 60, script = "alienattack", arguments = {3}, minimum = 120 * 60, to = 300},
    {schedule = random():getInt(90, 140) * 60, script = "alienattack", arguments = {4}, minimum = 140 * 60, to = 250},
    {schedule = random():getInt(120, 160) * 60, script = "alienattack", arguments = {5}, minimum = 160 * 60, to = 200},
    {schedule = random():getInt(150, 190) * 60, script = "alienattack", arguments = {6}, minimum = 200 * 60, to = 150},
    {schedule = random():getInt(50, 70) * 60, script = "spawntravellingmerchant", to = 520},
}

local pause = 15 * 60
local pauseTime = pause

function initialize()
    for _, event in pairs(events) do
        event.time = (event.minimum or 15 * 60) + math.random() * event.schedule
    end

 

my alien update interval is this

function getUpdateInterval()
    return 65

And

function update(timeStep)

    minute = minute + 1

    if attackType == 0 then

        if minute == 1 then
            Player():sendChatMessage("Server"%_t, 3, "Your sensors picked up a short burst of subspace signals."%_t)
        elseif minute == 3 then
            Player():sendChatMessage("Server"%_t, 3, "More strange subspace signals, they're getting stronger."%_t)
        elseif minute == 6 then

Etc. lol Play around with it until your happy with the off time and active time.

 

Also if I am not alone my events are speed up 25% now instead of 50%

 -- but, if we're not alone, we speed up events by 25%
    if #players > 1 then timeStep = timeStep * 1.25 end

change this to just 1 if you want no increase in event timer with multiplayer. Although no idea if you must be host for this effect? lol

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...