Make AIs have different start units

Make AIs have different start units

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Make AIs have different start units

Post 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
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Make AIs have different start units

Post by PicassoCT »

http://pastebin.com/jbhhzWDm

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

Its never too late to learn lua. Coding-Analphabetism can be cured!
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Make AIs have different start units

Post by smoth »

Avoid doing that in game spawn. Use a new gadget
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Make AIs have different start units

Post 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.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Make AIs have different start units

Post by Forboding Angel »

smoth wrote:Avoid doing that in game spawn. Use a new gadget
Why?

@picasso, thanks :-)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Make AIs have different start units

Post 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
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Make AIs have different start units

Post 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.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Make AIs have different start units

Post by FLOZi »

S44 CRAIG does this since years, too lazy to find full link so https://github.com/spring1944/spring1944
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Make AIs have different start units

Post 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.
User avatar
azaremoth
Cursed Developer
Posts: 549
Joined: 17 Feb 2005, 22:05

Re: Make AIs have different start units

Post 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.
Post Reply

Return to “Game Development”