PDA

View Full Version : Attempting to have all squads deploy



s2r222
4th Mar 09, 5:58 PM
Deciding that I want to have all the squads deploy into a mission, I started to dig though the scar files to find an easy way to do so.
After some digging I found this in campaign.scar :

function Campaign.GetHumanStartingUnits()
if(Campaign.IsEnabled())then
--fatal("Starting Units from the campaign is not setup yet")
local unitTable = {}

for i = 0, Campaign_GetSquadCount() - 1 do
local squad = Campaign_GetSquadAt(i)
if(squad.locked == false and squad.deployed ~= false)then
local unit = Campaign_GetSquadAt(i)
unit.offset = Campaign.StartingUnitOffsets[i]
table.insert(unitTable, unit)
end
end

return unitTable
else
local humanUnits = {}
for k, v in pairs(SPIKE.startingUnits)do
if(SPIKE.players[v.player].type == "human")then
table.insert(humanUnits, v)
end
end

if(SPIKE.usePersist)then
Campaign.HeroesSwapPersist( humanUnits )
end

return humanUnits
end
end



The line that I found interesting here is this one:

if(squad.locked == false and squad.deployed ~= false)then

Assuming I am reading this correctly, This part of the scar file looks at first if our squad is locked, and if we do not have it deployed. If either of these are true, we do not add it to the unitTable, that I am reading as unit that we are deploying to the mission.

However just making the line read

if(squad.locked == false)then

So that we get all squads into the unitTable that are not locked. This however just causes a scar error when the drop pod should drop in. I am going to work at it some more, but I was wondering if anyone here has got this working yet?

EDIT:

After much digging ( and not finding the Campaign_GetSquadCount() function ), i looked at the error message and found that it was not complaing about the number of squads but was in fact compaing that the player index was invalid.
and the scar file is failing around here:

function Campaign.GetPlayer(id)
if(Campaign.IsEnabled())then
return World_GetPlayerAt(id)
else
if(SPIKE.players[id] == nil or SPIKE.players[id].id == nil)then
fatal("Player ID is invalid")
end
return SPIKE.players[id].id
end
end

EDIT2:

Well, I think I am getting somewhere, after examing the LUA files I noticed that all squads expect the FC are set to owner id 0 when you finish SS3_SEP3.lua. I think what Is happening is that the addtional squad are tryin to drop in but then they have an invalid player controling them ( player id = 0 ) that would be in line with the error message I got. Now to find out where the Player ID get set when you select squads.

guiyunzi
7th Mar 09, 5:20 PM
this is great. hope you get it done soon.

nteger
9th Mar 09, 2:39 PM
Have you tried editing the mission files and adding in all the squads to them? I tried doing that once with the apothecary, but I got a SCAR error. Then again, the Apothecary probably isn't programmed right to be used in the campaign, even though his sbps and ebps files are in there. Also, the 'locked' attribute can be found in the squads.lua file. The FC and Tarkus start out with it being set to 'false' since they are in the first mission and the others get unlocked during subsequent ones. Hope this helps somewhat.

s2r222
25th Mar 09, 2:56 PM
I would rather not edit the mission files to make all squads deploy, as I would like to just make a small change to the squad deploy control that sets up what squads are placed onto the map. Right now I am having trouble with the fact that when I tell it to just send every squad that is not locked, it just crashed with it try to add stuff for player id 0, or at least that what I think the id is. The problem is that due to how they did coop, squads who are not deployed do no belong to either player, so the game chokes when it see a player id that it does not know what to do with.

My attempts to see all player ids to host, or host and client (like it does in the first few missions ) just fail with an invalid command, despite it being called the exact same way as the first level.

As for locked units, I don't care as much about that, as what I want is that if 5/6 squads are unlocked, you can send all of them into the world to fight, so I don't need to worry about that.

potemkis
17th Apr 09, 9:19 PM
This is exactly what I've been looking for!! Good luck and keep us posted! Scar to me resembles jibberish- I totally should have taken up programming in college!

vgo
18th May 09, 1:41 AM
What's the status on this? Is there anyone else working on a similar mod?

Uncle Benny
28th May 09, 9:40 AM
I've been looking at this, but so far I haven't found the right setting. Like s2r222, I assume this is SCAR coding, but I haven't found what we're looking for yet. Of course, I'm still getting used to the folder & file structure, as well as being a novice at coding in the first place.
I have found certain other campaign-related settings, such as max # of deployments, calculation of Tyranid infestation, etc. but this is the biggest thing I'm looking for.
Any one have any insight, feel free to chime in. Otherwise I'll keep looking.

Croaxleigh
28th May 09, 3:22 PM
This is really interesting... I hope that y'all find what you're looking for. Wish I could help, but I've yet to get back into DoW2 modding after being away for a bit. Hell, I still need to update my copy of DoW2 to 1.3.1.