Autoplacement of units on a map.

Autoplacement of units on a map.

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Autoplacement of units on a map.

Post by Tribulex »

I was wondering if there is an existing algorithm for placing units over mex spots when the game loads. The units will belong to LuaGaia, and are control points. We will have a script that will automatically transfer ownership of one of these units to the team with the most value of units inside of it (value is just a custom param in the unit's lua script). When no units are in the radius (probably will just use the LOS) of the autoplaced unit's ownership will go back to luagaia.

Basically, the placement of these control points needs to be dictated in the map file somehow, and then loaded by the game. I thought mex spots would be a good way to do it so that our game is compatible with existing mex-spot based maps for spring. However, if there is a better way I would appreciate knowing it.

Thank you.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Autoplacement of units on a map.

Post by Neddie »

Well, in 1944 and Star Wars: Imperial Winter, we have lua gadgets which place flags over either metal spots or in a custom layout when we generate a profile for a map. Feel free to look at the 1944 scripts.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Autoplacement of units on a map.

Post by Tribulex »

Is there a repository for s44, or should I just extract the mod. What about SWIW?
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Autoplacement of units on a map.

Post by Neddie »

There is an SVN repository, but extracting the game is fine as well. Star Wars: Imperial Winter is in a closed beta, so you would have to ask one of the developers for help directly. You can find them in the #swiw channel on the Spring lobby.

SVN Folder Name: "S44LiteRelease.sdd"
1944 Repository: https://spring1944.svn.sourceforge.net/ ... elease.sdd
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Autoplacement of units on a map.

Post by Tribulex »

Thank you.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2700
Joined: 25 Aug 2004, 13:31

Re: Autoplacement of units on a map.

Post by bobthedinosaur »

what about an army placer? maybe like a 60 second timer to place an army before hand. for mods that don't have bases and building.

I think it would be cool in various mods. like gundam and s44
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Autoplacement of units on a map.

Post by FLOZi »

Note that the S44 code is not exactly well optimized.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2700
Joined: 25 Aug 2004, 13:31

Re: Autoplacement of units on a map.

Post by bobthedinosaur »

for that idea you mean?
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Autoplacement of units on a map.

Post by Pressure Line »

bob: CA deployment mode.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2700
Joined: 25 Aug 2004, 13:31

Re: Autoplacement of units on a map.

Post by bobthedinosaur »

really? i need to play ca more
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Autoplacement of units on a map.

Post by FLOZi »

bobthedinosaur wrote:for that idea you mean?
In general.

Also note that S44 has CA deployment mode.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Autoplacement of units on a map.

Post by Tribulex »

bobthedinosaur wrote:what about an army placer? maybe like a 60 second timer to place an army before hand. for mods that don't have bases and building.

I think it would be cool in various mods. like gundam and s44

Thank you but this has nothing to do with our game.
Pressure Line wrote:bob: CA deployment mode.
Deployment mode has nothing to do with our game. Please, I appreciate these ideas, but the control points MUST be dictated by the map. Since they don't belong to players until they occupy them, the units that serve as control points cannot be placed by the players, since this does not make any sense. I appreciate feedback, but really its good to have feedback that corresponds to the topic please.

Thank you.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2700
Joined: 25 Aug 2004, 13:31

Re: Autoplacement of units on a map.

Post by bobthedinosaur »

Many mods do this: Cuberor, s44, IW. All of which spawn neutral units on metal spots before the game starts.

Also,
Thank you but this has nothing to do with our game.
what game is that if you don't mind me asking?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Autoplacement of units on a map.

Post by FLOZi »

http://spring1944.svn.sourceforge.net/v ... iew=markup

There's the specific S44 gadget which spawns flags (and handles how they are captured). It's GPL v2 so feel free to use it, though as I said, its not the best written code.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Autoplacement of units on a map.

Post by Tribulex »

Thank you very much Flozi. It looks very similar to my code. Somehow your code works and my doesnt, so its very useful to me.
bobthedinosaur wrote:what game is that if you don't mind me asking?
I will pm you.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Autoplacement of units on a map.

Post by Tribulex »

I have another lua question now. Have any scripts been created where two transports share a loaded unit list? For example, i load my unit into one transport, and then I can unload it from another transport. Its for a sort of teleportation system.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Autoplacement of units on a map.

Post by imbaczek »

kernel panic's network faction packets/ports/connections work kinda like that, but i don't know if KP tries to preserve packet hitpoints, etc.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Autoplacement of units on a map.

Post by lurker »

d_b wrote:nothing to do with our game
...
nothing to do with our game
Yes, they were talking to each other, no need to say it twice. Your question had already been answered at that point, so there was no reason to complain.


Actual transports using load and unload, no. Is this the way you want to do teleportation, or just an idea you had that might make it easier? Because doing it with transport buttons is slightly more difficult than other methods.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Autoplacement of units on a map.

Post by Tribulex »

Oh, well any way in which a unit is "loaded" by the structure, or rather disappears from the map, and then can be recreated next to a structure of the same type. Basically its underground tunnels. It would be good to be able to add to this at will. Now I am thinking the KP network is pretty much exactly what I need, so thanks for making my brain work.

I want units that are "underground" to heal while they are underground. i havent looked at KP's code yet, but does this happen?
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Autoplacement of units on a map.

Post by lurker »

KP wipes out the units to full health. Will tunnels take time to go along?
Post Reply

Return to “Lua Scripts”