Jump to content

[Help Please] - How to get these groups to spawn?


Enzo Matrix

Recommended Posts

In alienattack.lua there are 4 spawn groups from Attack type=0 to 3 with each being obviously harder and seems to be rarer to spawn the higher it goes?

 

I had success with changing up these 4 for my xsotan mod however I also added 3 more spawns so it goes up to Attack type =6.

 

However I havent had one from 4-6 spawn at all. So here is the code, I need help understanding how this works and how to make 4-6 spawn also.

 

Here is attack 0

 

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
            createEnemies({
                  {size=1, title="Small Xsotan Scout"%_t},
                  {size=2, title="Large Xsotan Scout"%_t},
                  {size=2, title="Large Xsotan Scout"%_t},
	  {size=1, title="Small Xsotan Scout"%_t},
                  })

            Player():sendChatMessage("Server"%_t, 2, "A group of alien scout ships appeared!"%_t)
            terminate()
        end

This works up to attack type 3

 

elseif attackType == 3 then

        if minute == 1 then
            Player():sendChatMessage("Server"%_t, 3, "Your sensors picked up short bursts of subspace signals."%_t)
        elseif minute == 3 then
            Player():sendChatMessage("Server"%_t, 3, "The subspace signals are getting too strong for your scanners. Brace yourself!"%_t)
        elseif minute == 6 then

            createEnemies({
                  {size=2, title="Small Xsotan Fighter"%_t},
                  {size=3, title="Medium Xsotan Fighter"%_t},
                  {size=3, title="Xsotan Interceptor"%_t},
                  {size=4, title="Xsotan Advanced Interceptor"%_t},
                  {size=4, title="Large Xsotan Fighter"%_t},
                  {size=5, title="Xsotan Destroyer"%_t},
	  {size=7, title="Xsotan Battleship"%_t},
                  {size=6, title="Xsotan Destroyer"%_t},
                  {size=5, title="Xsotan Advanced Interceptor"%_t},
                  {size=4, title="Xsotan Harvester"%_t},
                  {size=3, title="Xsotan Harvester"%_t},
                  {size=2, title="Large Xsotan Scout"%_t},
	  {size=2, title="Large Xsotan Scout"%_t},
                  })

            Player():sendChatMessage("Server"%_t, 2, "WARNING! A Battleship fleet of alien ships appeared, BE CAREFUL!"%_t)
            terminate()
        end

Now here is my added groups that haven't spawned at all yet.

 

elseif attackType == 4 then

        if minute == 1 then
            Player():sendChatMessage("Server"%_t, 3, "Your sensors picked up short bursts of subspace signals."%_t)
        elseif minute == 3 then
            Player():sendChatMessage("Server"%_t, 3, "The subspace signals are showing odd powerful detections!"%_t)
        elseif minute == 6 then

            createEnemies({
                  {size=5, title="Xsotan Guardian Scout"%_t},
                  {size=6, title="Xsotan Guardian Scout"%_t},
                  {size=8, title="Xsotan Planet Harvester"%_t},
                  {size=8, title="Xsotan Planet Harvester"%_t},
                  {size=7, title="Xsotan Super Fighter"%_t},
                  {size=6, title="Xsotan Harvester"%_t},
	  {size=5, title="Xsotan Advanced Interceptor"%_t},
	  {size=5, title="Xsotan Advanced Interceptor"%_t},
	  {size=4, title="Xsotan Advanced Interceptor"%_t},
	  {size=4, title="Xsotan Advanced Interceptor"%_t},
	  {size=3, title="Xsotan Interceptor"%_t},
	  {size=3, title="Xsotan Interceptor"%_t},
	  {size=3, title="Xsotan Interceptor"%_t},
	  {size=3, title="Xsotan Interceptor"%_t},
                  })

            Player():sendChatMessage("Server"%_t, 2, "Watch out! A Harvester Battle Fleet Fleet has appeared! Stop them!"%_t)
            terminate()
        end

 

elseif attackType == 5 then

        if minute == 1 then
            Player():sendChatMessage("Server"%_t, 3, "Your sensors picked up short bursts of subspace signals."%_t)
        elseif minute == 3 then
            Player():sendChatMessage("Server"%_t, 3, "Your scanners are detecting very large signals! Get prepared!"%_t)
        elseif minute == 6 then

            createEnemies({
                  {size=4, title="Xsotan Advanced Interceptor"%_t},
                  {size=5, title="Xsotan Advanced Interceptor"%_t},
                  {size=8, title="Xsotan Assassin"%_t},
	  {size=8, title="Xsotan Assassin"%_t},
                  {size=10, title="Xsotan Star Destroyer"%_t},
                  {size=7, title="Xsotan Destroyer"%_t},
                  {size=6, title="Xsotan Destroyer"%_t},
	  {size=7, title="Xsotan Super Fighter"%_t},
	  {size=7, title="Xsotan Super Fighter"%_t},
	  {size=5, title="Xsotan Advanced Interceptor"%_t},
                  {size=4, title="Xsotan Advanced Interceptor"%_t},
	  {size=5, title="Xsotan Guardian Scout"%_t},
	  {size=5, title="Xsotan Guardian Scout"%_t},
	  {size=5, title="Xsotan Guardian Scout"%_t},
                  })

            Player():sendChatMessage("Server"%_t, 2, "WARNING! Battlestations everyone! A Star Destoyer fleet has appeared!"%_t)
            terminate()
        end	

 

elseif attackType == 6 then

        if minute == 1 then
            Player():sendChatMessage("Server"%_t, 3, "Your sensors picked up short bursts of subspace signals."%_t)
        elseif minute == 3 then
            Player():sendChatMessage("Server"%_t, 3, "Your Scanner is detecting an unbelievable force imminent! Get reinforcements!"%_t)
        elseif minute == 6 then

            createEnemies({
                  {size=5, title="Xsotan Firestorm"%_t},
                  {size=5, title="Xsotan Firestorm"%_t},
                  {size=5, title="Xsotan Firestorm"%_t},
                  {size=6, title="Xsotan Space Rifter"%_t},
                  {size=6, title="Xsotan Destroyer"%_t},
                  {size=6, title="Xsotan Destroyer"%_t},
	  {size=7, title="Xsotan Battleship"%_t},
                  {size=7, title="Xsotan Assassin"%_t},
                  {size=8, title="Xsotan Firestorm Destroyer"%_t},
                  {size=8, title="Xsotan Planet Harvester"%_t},
                  {size=12, title="Xsotan Ethereal Commander"%_t},
                  {size=10, title="Xsotan Star Destroyer"%_t},
	  {size=8, title="Xsotan Battleship"%_t},
          {size=8, title="Xsotan Battleship"%_t},
	  {size=6, title="Xsotan Shredder"%_t},
	  {size=6, title="Xsotan Shredder"%_t},
	  {size=5, title="Xsotan Firestorm"%_t},
	  {size=5, title="Xsotan Firestorm"%_t},
	  {size=5, title="Xsotan Firestorm"%_t},
	  {size=5, title="Xsotan Firestorm"%_t},
                  })

            Player():sendChatMessage("Server"%_t, 2, "WARNING! A full destructive Xsotan Fleet appeared! IT'S WAR NOW!"%_t)
            terminate()
        end	

    end

end

 

I understand that each attack level increase seems to become more rare and needs to be closer to centre before you start to get attack 3 to show up. Can someone help me out with what I need to do to get attack 4 to 6 to show up. The help would be fantastic!

 

If this has anything to do with it?

function createEnemies(volumes)

    local galaxy = Galaxy()

    local faction = Xsotan.getFaction()

    local player = Player()
    local others = Galaxy():getNearestFaction(Sector():getCoordinates())
    Galaxy():changeFactionRelations(faction, player, -200000)
    Galaxy():changeFactionRelations(faction, others, -200000)

    -- create the enemies
    local dir = normalize(vec3(getFloat(-1, 1), getFloat(-1, 1), getFloat(-1, 1)))
    local up = vec3(0, 1, 0)
    local right = normalize(cross(dir, up))
    local pos = dir * 1500

    local volume = Balancing_GetSectorShipVolume(faction:getHomeSectorCoordinates());

    for _, p in pairs(volumes) do

        local enemy = Xsotan.createShip(MatrixLookUpPosition(-dir, up, pos), p.size)
        enemy.title = p.title

        local distance = enemy:getBoundingSphere().radius + 20

        pos = pos + right * distance

        enemy.translation = dvec3(pos.x, pos.y, pos.z)

        pos = pos + right * distance + 20

        ShipAI(enemy.index):setAggressive()
    end
end

 

Or perhaps this part is where I need to look?

local minute = 0
local attackType = 1

function initialize(attackType_in)
    attackType = attackType_in or 1
    deferredCallback(1.0, "update", 1.0)
end

function getUpdateInterval()
    return 60
end

 

I going to try this.. no idea if this will work lol

function initialize(attackType_in)
    attackType = attackType_in or 1 or 4 or 5 or 6
    deferredCallback(1.0, "update", 1.0)
end

Link to comment
Share on other sites

local minute = 0
local attackType = 1

function initialize(attackType_in)
    attackType = attackType_in or 1
    deferredCallback(1.0, "update", 1.0)
end

This method defines the attacktype which will spawn. Especially "attackType_in" needs to be your type (4-6).

It gets set in eventscheduler.lua on top.

add some lines like these:

 

{schedule = random():getInt(80, 120) * 60, script = "alienattack", arguments = {4-6}, minimum = 120 * 60, to = 300},

 

That way you will get all your waves spawning. You might want to experiment with the random, minimum and to variables to get more desirable amounts in size/frequency of spawns.

 

Edit:

I going to try this.. no idea if this will work lol

   

attackType = attackType_in or 1 or 4 or 5 or 6

This will not work the way you think. The "a or b" operator in context of an assignment works the same as:

if a ~= nil then
    return a
else
    return b
end

It's pretty much syntactic sugar for nil-object-checks.

Link to comment
Share on other sites

Ok I did this,

{
    {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, 130) * 60, script = "alienattack", arguments = {4}, minimum = 130 * 60, to = 250},
    {schedule = random():getInt(100, 140) * 60, script = "alienattack", arguments = {5}, minimum = 140 * 60, to = 225},
    {schedule = random():getInt(120, 160) * 60, script = "alienattack", arguments = {6}, minimum = 150 * 60, to = 175},
    {schedule = random():getInt(50, 70) * 60, script = "spawntravellingmerchant", to = 520},
}

 

Gonna give that a try.

 

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