Friday, April 13, 2012

need help spwaning mass _only_ for existing players

[:1]Hello,
yes, i flipped through the topics and found nothing that answers my question :)
i want to do the following:
create mass spots for existing players in the _script.lua
i did the following:
spawn resources with the existing mass script (http://supcom.wikia.com/wiki/Script ... awn_points) which spawns resources for all armies defined in the map, not existing players
try out ListArmies in a for-loop :
local i, army, armyx;
for i, army in ListArmies() do
armyx = GetArmyPosition(army);
CreateResourceMatrix(ResourceType.Mass, armyx.x, armyx.y, armyx.z, 4.00, 4.00, 1, 10);
end
=> this works exactly the way i want it, but it creates a new problem: the game starts with empty scoreboard (players are listed, but no scores are shown) and sandbox-like behaviour (ctrl-k my commander -> he explodes, game continues)
i tried to put the mass script in the OnPopulate(), this doesn't work either.

Thx for your help...|||There is a map that does this, I forget the name....lemme check.
EDIT: right, it was called Sentina(I think I got it from the Vault), a neat map to test your mettle against multiple AIs, cause you couldn't compensate by micro-ing oyu base better, because you only have half(or less!) the resources the AIs would.
Mike|||thanks for the effort, but actually on sentina, the mass markers (in the _save.lua) are marked with ['SpawnWithArmy'] = STRING( 'ARMY_1' ), which makes them only appear for existing armys.
The script file on the other hand has nothing in OnStart() or OnPopulate().
As i do not know how one could mark a marker which is spawned in a script with the "spawnwitharmy" tag, this doesn't help.
Is there any useful Documentation about the supcom scripting? Luadoc didn't help me any...|||There is one that does it per player that I have, don't remember the name off hand (will check when I get home). It's a 20x20 island map, 3v3 with two smaller islands on either side of the main. The mass spots for each player position will only spawn if there is a player for that spot.|||Did you look at this Thread?
http://forums.gaspowered.com/viewtopic.php?t=14032
That's how I do it in my maps.|||Hey, what do you know. The map that is referenced in that link is the one I was thinking of. :)|||ok, i give up.
Seems there is no way to script resources onto a map according to players, only the fixed mass that spawns with the players or scripted mass for all player slots, used or not :(
at least i found a halfass workaround: just set 1/2 of the mass you want in the options for a half-full game. then you have what you wanted, just a little off the startpoint.|||It is possible, you have the required code, electro2 linked to it.
Limiting the amount of mex spots per player with map options, too by adding a count variable.|||oh well, maybe i wasn't shouting loud enough. let me try again:
I want to spawn mass ACCORDING TO THE MAP OPTIONS SELECTED IN THE GAME LOBBY, i.e. player creates game, selects "extra rows" = 4 and "extra colums" = 4 -> every existing player gets 4x4 mass spots spawned at his start location.
I DO NOT WANT TO create an absurd amount of mass spots for each player here, i want to make a script that can be used on any map. If i wanted to do that, i could just release each map with 4, 5, 6, ... 100 extra mexes which have the "spawnsWithArmy" property.
The script i posted at the beginning does exactly what i want to do, i just wonder where the bugged game comes from.
EDITING THE MASS MARKERS PROPERTIES IS NOT AN OPTION FOR DYNAMICALLY CREATED MASS.
i have the possibilities i was looking for, only the mass is spawned for all armies defined in the map and using listarmies() breaks the game.
like i said before, using the listArmies function in connection with the mass spawning results in an empty scoreboard and broken victory condition.
Please stop telling me about something i didn't ask for.|||I understood you well enough, wanted to clarify it is possible, without issues.
My 5 player campaign is currently only 30% completed, but that option is in and working fine. Went a bit further and gave the option to spawn a matching count of metal extractors and storages, too.
Don't let frustration cloud your judgement.
I haven't taken the time to look at your code, I still have a ton of work ahead of me.
tbh it sounds like you have some syntax error or something in yours, check the log.|||well the script you use would be very helpful, as electro2's link doesn't lead to code that does what i want...|||... (there used to be code here as requested)
Ah well whatever, seems this isn't needed after all ...
Deleted the code, I think I will stick to not sharing code, much less of a bother.
If someone still wants to post it again don't forget to credit and thank me.
I'm tired of wasting my time on filling other people's requests, doesn't seem it is appreciated.|||Trueffelschwein

No comments:

Post a Comment