Page 1 of 1

Make AIs have different start units

Posted: 05 Feb 2015, 05:53
by Forboding Angel
Game Spawn
http://pastebin.com/v0efaweN

Can someone help me modify this so that AIs will start with a different unit?

I have already defined startunitai in sidedata.

SideData
http://pastebin.com/JRBF1SCY

Re: Make AIs have different start units

Posted: 05 Feb 2015, 10:13
by PicassoCT
http://pastebin.com/jbhhzWDm

http://tylerneylon.com/a/learn-lua/

Its never too late to learn lua. Coding-Analphabetism can be cured!

Re: Make AIs have different start units

Posted: 05 Feb 2015, 15:13
by smoth
Avoid doing that in game spawn. Use a new gadget

Re: Make AIs have different start units

Posted: 05 Feb 2015, 15:59
by PicassoCT
Smoth volunteers to write a gadget for you forb - always said the guy was a big spender when it came to time.
Bravo, smoth, bravo, da capo!
Nothing more admirable then giving everything you got for the comunity.

Re: Make AIs have different start units

Posted: 05 Feb 2015, 22:04
by Forboding Angel
smoth wrote:Avoid doing that in game spawn. Use a new gadget
Why?

@picasso, thanks :-)

Re: Make AIs have different start units

Posted: 06 Feb 2015, 00:44
by smoth
Because you may want to built it into something more later.
Because games spawn is for start units, why complicate a simple gadget?
If it errors nothing spawns
Seperation of concerns

Re: Make AIs have different start units

Posted: 06 Feb 2015, 09:21
by PicassoCT
But this is the part that concerns itself with various GameStart Activitys..

What you could do is add a GameMode.lua that creates startConditions depending in which GameMode evo is started, but any more architecture would be overkill.

Re: Make AIs have different start units

Posted: 06 Feb 2015, 20:54
by FLOZi
S44 CRAIG does this since years, too lazy to find full link so https://github.com/spring1944/spring1944

Re: Make AIs have different start units

Posted: 06 Feb 2015, 21:59
by Forboding Angel
Unfortunately, this does not work. The AI unit never spawns, no matter how I have tried to make it happen. Help would be appreciated.

Imo a separate gadget doesn't make sense at all. Game spawn is already a gadget, so why wouldn't you want all of your game start spawning stuff to happen there?

Edit: Found the issue, it wasn't reading from sidedata correctly.

Re: Make AIs have different start units

Posted: 07 Feb 2015, 13:52
by azaremoth
[code]
local Gaia = Spring.GetGaiaTeamID
local ai = select(4, Spring.GetTeamInfo(teamID))+
cheatAItype = Spring.GetModOptions().cheatingai

if ai == true and team ~= Gaia and type ~= "feature" then
local heading = math.random(3)
local builder1 = Spring.CreateUnit("euf_constructor_ai", x, y, z, heading, teamID)
if cheatAItype == "1" then
local zero = Spring.CreateUnit("euf_techcenter_shield_ai", x,y,z+150, heading, teamID)
end
else
local heading = math.random(3)
local builder1 = Spring.CreateUnit("euf_constructor", x, y, z, heading, teamID)
end
[/code]


This is how we did it for the cursed - it also includes a mod option to boost the starting conditions of AI teams.