Forged Alliance Forever Forged Alliance Forever Forums 2018-02-27T01:18:37+02:00 /feed.php?f=53&t=15916 2018-02-27T01:18:37+02:00 2018-02-27T01:18:37+02:00 /viewtopic.php?t=15916&p=161267#p161267 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]> The solution was, in the end, simple as I had hoped it would be. In case anyone will want to mess around with survival waves and needs clarification - give me a hauler (here or via FAF lobby chat - PM).

Statistics: Posted by DDDX — 27 Feb 2018, 01:18


]]>
2018-02-21T03:18:47+02:00 2018-02-21T03:18:47+02:00 /viewtopic.php?t=15916&p=161096#p161096 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]> Here's a link

https://pastebin.com/b39kqg48



Code:
-- spawns a wave of units
--------------------------------------------------------------------------
Survival_SpawnNavy = function(SpawnTime) ((I TRIED ADDING AN EXTRA SPAWN FUNCTION))

-- LOG("----- Survival MOD: Performing a wave spawn at " .. SecondsToTime(SpawnTime));

local WaveTable = nil;
local UnitTable = nil;

local UnitID = nil;
local POS = nil;
local RandID = nil;

for x = 3, table.getn(Survival_WaveTables) do ((I ADDED AN EXTRA WAVE ID IN THE WAVETABLE, REFFERENCING IT HERE WITH THE 3, ALSO ADDED AN EXTRA COLUMN IN THAT TABLE TO REFFERENCE MARKER POSITION))

if (table.getn(Survival_WaveTables[x][Survival_WaveTables[x][1]]) > 1) then
-- for the amount of units we spawn in per wave
for z = 1,Survival_UnitCountPerWave do

WaveTable = Survival_WaveTables[x][Survival_WaveTables[x][1]]; -- grab the wave set table we're spawning from
RandID = math.random(3, table.getn(WaveTable));
UnitTable = WaveTable[RandID]; -- reference that unit table

UnitID = Survival_GetUnitFromTable(UnitTable); -- pick a random unit id from this table
OrderID = UnitTable[2];
POS = Survival_GetPOS(UnitTable[3], 0); ((BORROWED THIS FROM SURVIVAL_SPAWNSPECIALWAVE, ADDED AN EXTRA COLUMN WITH THE MARKER VALUE IN THE NEWLY ADDED WAVETABLE))

Survival_SpawnNavy(UnitID, "ARMY_SURVIVAL_ENEMY", POS, OrderID); ((THIS FOR THE NEXT FUNCTION BELOW))

end
end
end
end

-- spawns a specified unit
--------------------------------------------------------------------------
Survival_SpawnNavy = function(UnitID, ArmyID, POS, OrderID) -- blueprint, army, position, order ((ADDED A NEW FUNCTION BASED ON THE SURVIVAL_SPAWNUNIT))

-- LOG("----- Survival MOD: SPAWNUNIT: Start function...");
local PlatoonList = {};

local NewUnit = CreateUnitHPR(UnitID, ArmyID, POS[1], POS[2], POS[3], 0,0,0);

NewUnit:SetProductionPerSecondEnergy(325);

table.insert(PlatoonList, NewUnit); -- add unit to a platoon
Survival_PlatoonOrder(ArmyID, PlatoonList, OrderID); -- give the unit orders

end

Statistics: Posted by DDDX — 21 Feb 2018, 03:18


]]>
2018-02-21T03:10:28+02:00 2018-02-21T03:10:28+02:00 /viewtopic.php?t=15916&p=161095#p161095 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]>
Without that its unreadable

Statistics: Posted by speed2 — 21 Feb 2018, 03:10


]]>
2018-02-21T02:40:13+02:00 2018-02-21T02:40:13+02:00 /viewtopic.php?t=15916&p=161093#p161093 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]>
-- spawns a wave of units
--------------------------------------------------------------------------
Survival_SpawnNavy = function(SpawnTime) ((I TRIED ADDING AN EXTRA SPAWN FUNCTION))

--LOG("----- Survival MOD: Performing a wave spawn at " .. SecondsToTime(SpawnTime));

local WaveTable = nil;
local UnitTable = nil;

local UnitID = nil;
local POS = nil;
local RandID = nil;

for x = 3, table.getn(Survival_WaveTables) do ((I ADDED AN EXTRA WAVE ID IN THE WAVETABLE, REFFERENCING IT HERE WITH THE 3, ALSO ADDED AN EXTRA COLUMN IN THAT TABLE TO REFFERENCE MARKER POSITION))

if (table.getn(Survival_WaveTables[x][Survival_WaveTables[x][1]]) > 1) then
-- for the amount of units we spawn in per wave
for z = 1,Survival_UnitCountPerWave do

WaveTable = Survival_WaveTables[x][Survival_WaveTables[x][1]]; -- grab the wave set table we're spawning from
RandID = math.random(3, table.getn(WaveTable));
UnitTable = WaveTable[RandID]; -- reference that unit table

UnitID = Survival_GetUnitFromTable(UnitTable); -- pick a random unit id from this table
OrderID = UnitTable[2];
POS = Survival_GetPOS(UnitTable[3], 0); ((BORROWED THIS FROM SURVIVAL_SPAWNSPECIALWAVE, ADDED AN EXTRA COLUMN WITH THE MARKER VALUE IN THE NEWLY ADDED WAVETABLE))

Survival_SpawnNavy(UnitID, "ARMY_SURVIVAL_ENEMY", POS, OrderID);((THIS FOR THE NEXT FUNCTION BELOW))

end
end
end
end

-- spawns a specified unit
--------------------------------------------------------------------------
Survival_SpawnNavy = function(UnitID, ArmyID, POS, OrderID) -- blueprint, army, position, order ((ADDED A NEW FUNCTION BASED ON THE SURVIVAL_SPAWNUNIT))

--LOG("----- Survival MOD: SPAWNUNIT: Start function...");
local PlatoonList = {};

local NewUnit = CreateUnitHPR(UnitID, ArmyID, POS[1], POS[2], POS[3], 0,0,0);

NewUnit:SetProductionPerSecondEnergy(325);

table.insert(PlatoonList, NewUnit); -- add unit to a platoon
Survival_PlatoonOrder(ArmyID, PlatoonList, OrderID); -- give the unit orders

end


the ((CAPLOCKS)) are not in the code ofc ;)
well...if I got everything right that code should work I guess...but I cannot implement it in the Survival_Tick = function (line 1112) where i see that the Survival_SpawnWave(Survival_NextSpawnTime); is (line 1149), which I guess is how the game initializes it. Any ideas how to do it, and if the stuff I copy-pasted make sense at all?

Statistics: Posted by DDDX — 21 Feb 2018, 02:40


]]>
2018-02-20T20:48:05+02:00 2018-02-20T20:48:05+02:00 /viewtopic.php?t=15916&p=161084#p161084 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]>
It is...frustrating. i have so many ideas but this language is way too abstract for me, to put them to life. Way, waaaaaaaaay too many unknown variables and parameters for me to solve by logic, or guessing.
I am a map maker, always been, be it Heroes of might and magic or Starcraft...god, what I would do for SupCom to have a brilliant map Editor like Starcraft...

Statistics: Posted by DDDX — 20 Feb 2018, 20:48


]]>
2018-02-20T20:14:05+02:00 2018-02-20T20:14:05+02:00 /viewtopic.php?t=15916&p=161083#p161083 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]> The map I am altering is the standard Survival 5.th Dimension map, v2. (as far as I have seen all of them have the identical basic code, with some alteration to starting units for example. That is why I didnt refference which one).

The code in question starts from line 1243 - this, ore something that does this, is what I hope to use to spawn additional naval waves TOGETHER with the existing standard land waves. I have the naval spawn nodes, even copied the code that makes an additional MarkerId for the new naval spawn points (number 6, 1-5 referenced other locations)...but the problem is that I have to have the code below spawning stuff in land spawns and another like it spawning in naval spawns:

-- spawns a wave of units
--------------------------------------------------------------------------
Survival_SpawnWave = function(SpawnTime)

--LOG("----- Survival MOD: Performing a wave spawn at " .. SecondsToTime(SpawnTime));

local WaveTable = nil;
local UnitTable = nil;

local UnitID = nil;
local OrderID = nil;
local POS = nil;
local RandID = nil;

-- check the wave table times vs the wave spawn time to see which waves we spawn
-- START AT TABLE 2 BECAUSE TABLE 1 IS SPECIAL UNITS (ARTY/NUKE)
for x = 2, table.getn(Survival_WaveTables) do -- loop through each of the wavetable entries (ground/air/sea...)

--LOG("----- Survival MOD: Category(" .. x .. ") Wave Set (" .. Survival_WaveTables[x][1] - 1 .. ") (ID: " .. Survival_WaveTables[x][1] .. ");

-- for the amount of units we spawn in per wave
if (table.getn(Survival_WaveTables[x][Survival_WaveTables[x][1]]) > 1) then -- only do a wave spawn if there is a wave table available
-- for the amount of units we spawn in per wave
for z = 1,Survival_UnitCountPerWave do

WaveTable = Survival_WaveTables[x][Survival_WaveTables[x][1]]; -- grab the wave set table we're spawning from
RandID = math.random(2, table.getn(WaveTable)); -- pick a random unit table from within this wave set
UnitTable = WaveTable[RandID]; -- reference that unit table

UnitID = Survival_GetUnitFromTable(UnitTable); -- pick a random unit id from this table
OrderID = UnitTable[2]; -- get the order id from this unit table (always 2nd entry)

POS = Survival_GetPOS(3, 25);

Survival_SpawnUnit(UnitID, "ARMY_SURVIVAL_ENEMY", POS, OrderID);
end
end

end

end


(((---------ALTERNATIVELY THIS)))

-- spawns a specified unit
--------------------------------------------------------------------------
Survival_SpawnUnit = function(UnitID, ArmyID, POS, OrderID) -- blueprint, army, position, order

--LOG("----- Survival MOD: SPAWNUNIT: Start function...");
local PlatoonList = {};

local NewUnit = CreateUnitHPR(UnitID, ArmyID, POS[1], POS[2], POS[3], 0,0,0);

-- prevent wreckage from enemy units
--local BP = NewUnit:GetBlueprint();
--if (BP != nil) then
--BP.Wreckage = nil;
--end

NewUnit:SetProductionPerSecondEnergy(325);

table.insert(PlatoonList, NewUnit); -- add unit to a platoon
Survival_PlatoonOrder(ArmyID, PlatoonList, OrderID); -- give the unit orders

end

Also, i have tried the code you provided earlier, but cannot get it to work (since I do not know what the parameters should look like, and the 2.nd link you provided is identical by oversight I guess). This one, I mean

function CreateUnitHPR(blueprint, army, x, y, z, pitch, yaw, roll)
end
(blueprint is unit blueprint, army is easy too, but xyz? Pitch etc... is all 0 I guess?).


And the reason I dod not show any code earlier is because I thought I was asking something very basic and widely used- (how to spawn a unit at a given time at a given location and order it). Guess nothing is basic about LUA :p

anyways...thank you!

Statistics: Posted by DDDX — 20 Feb 2018, 20:14


]]>
2018-02-20T18:39:38+02:00 2018-02-20T18:39:38+02:00 /viewtopic.php?t=15916&p=161080#p161080 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]>
Then I have to say that all survival code I've seen to far was kinda not the best. It's working, but sometimes hard to find out what does what and how.

This is a function that can create a single unit https://github.com/FAForever/fa/blob/de ... #L247-L249 documentation is missing, but the parameter names should be clear, if not, you can check some examples here https://github.com/FAForever/fa/blob/de ... #L247-L249

For creating groups of units, you need to have some tables that will contain all the info about what units and where to spawn (and what to do with them) then either using some existing funtion from the survival to spawn them or making your own.

Statistics: Posted by speed2 — 20 Feb 2018, 18:39


]]>
2018-02-20T17:38:14+02:00 2018-02-20T17:38:14+02:00 /viewtopic.php?t=15916&p=161079#p161079 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]>

This is, roughly and ofc wrongly written (cause it does not work), what I want to get:

-- navy spawn in Survival 5thDimension
---------------------------------------------------------------------------------------------
SpawnNavyWave = function(UnitID, ArmyID, POS, OrderID, Quantity, SpawnTime) -- This is all I need :p but cannot get it to work

local UnitID = 'URS0201';
local ArmyID = "ARMY_SURVIVAL_ENEMY";
local POS = ScenarioUtils.MarkerToPosition("SURVIVAL_SPAWN_NAVY_1"); -- My added extra sea marker, 2 total
local OrderID = 2; -- this is supposed to be "attack move", no?
local Quantity = 1; -- or more
local SpawnTime = 1.5; -- Or whenever

Survival_SpawnUnit(UnitID, ArmyID, POS, OrderID, Quantity, SpawnTime) -- Does this do anything, is it needed?
end

Ok. The system has all the info it requires, but clearly I am missing something in the way it is executed, something the code needs. God I hate LUA...zero logic, zero user friendliness...how the hell are lawyers supposed to code, LUA? :p
HALP!

Statistics: Posted by DDDX — 20 Feb 2018, 17:38


]]>
2018-02-20T15:16:34+02:00 2018-02-20T15:16:34+02:00 /viewtopic.php?t=15916&p=161076#p161076 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]>
All joke aside, now. I really do need some assistance. Anyone? Please?
You will get cake... (it's delicious and moist).

Statistics: Posted by DDDX — 20 Feb 2018, 15:16


]]>
2018-02-19T02:17:34+02:00 2018-02-19T02:17:34+02:00 /viewtopic.php?t=15916&p=161004#p161004 <![CDATA[Re: Survival - spawning "side" waves independent from main w]]> I am trying to get ships from my navy scout platoon to spawn in the navy spawn point. What am doing wrong?
(also, it would be great if I could add a time index when those units spawn).

CreateUnitGroup = function(Blueprint, SpawnPoint, Quantity) --Used to creating enemy units outside the wave table

local strBluePrint = ''
strBluePrint = Blueprint
local POS = GetMarker(SURVIVAL_SPAWN_NAVY1).position
for i = 1, Quantity do
local NewUnit = CreateUnitHPR('NAVY_SCOUT_1', "ARMY_SURVIVAL_ENEMY", POS[1], POS[2], POS[3], 0, 0, 0)
end
end

Statistics: Posted by DDDX — 19 Feb 2018, 02:17


]]>
2018-02-17T16:17:07+02:00 2018-02-17T16:17:07+02:00 /viewtopic.php?t=15916&p=160955#p160955 <![CDATA[Survival - spawning "side" waves independent from main wave]]> . I am messing around with a survival map (5.th dimension). Added a bunch of Total Mayhem units in it, and they work like a charm and people love the changed waves.

But I have a problem - I NEED A SIMPLE COMMAND to create units separate from the waves, that would be independent from the wavetable that spawns the main waves (they would have their own spawn point, number of units spawned, time of spawn, order), while the regular survival waves still spawn like nothing happened.

I cannot, for the life of me, get alternate spawn points to function independently. Survival waves either spawn in the normal spawn points, or where I tell them - but never both.

It does not even have to be in a WaveTable form - I'd be perfectly satisfied with a code that did the following: (at time xy, spawn xy number of unit xy in the marker xy and order it to attack). And I just repeat it as many times as i need units spawned...

Should be fairly simple, but it is not. I checked 4-5 other survivals for hints, however I am a lawyer and not a programmer... when my wife tells me to go buy milk and if they have eggs, to get 10 - I don't return home with 10 milks :p (a little joke there).

So...HELLLLPPPPP!!!!! (a working piece of the so much desired spawn code from one of you "pfff I can do that in 20 seconds" guys would be awesome, but a link to instructions works too I guess...).
Live long and prosp...gank ACUs.

Statistics: Posted by DDDX — 17 Feb 2018, 16:17


]]>