Good evening,
i know it is possible but i dont know how cause i'am still not that experienced with LUA, maybe someone can give me an idea.
my goal is for some mod factions for my mod to tell the AI that if a bot plays that faction he is forced to build the first couple of buildings in a certain order.
Lets say for example: "power plant - refinery - refinery"
my idea is to start the Script like the SupplyTruck Script like that to define if the player is a bot:
p1cash = function()
if p1 and p1.IsBot then
and then tell him to build in a certain order, i guess it is doable with this operation?
bool Build(String[] actorTypes, LuaFunction actionFunc = nil)
i played around with this a little but dont know how to get it to work
LUA script to force AI to build in a certain Order
LUA script to force AI to build in a certain Order
Check out my CnC mod at:
https://www.moddb.com/mods/cameo
https://www.moddb.com/mods/cameo
Re: LUA script to force AI to build in a certain Order
We do not support letting players place buildings via Lua, sorry. The Soviet-06 maps are currently using (horrible) workarounds to simulate the AI building a base, maybe you can get some inspiration from there.
Re: LUA script to force AI to build in a certain Order
i guess you are reffering to "soviet06a-AI"?
but then what is this for?: bool Build(String[] actorTypes, LuaFunction actionFunc = nil)
so it is not supportet to let players place buildings and even force them to build in a specific queue in a specific order?
Check out my CnC mod at:
https://www.moddb.com/mods/cameo
https://www.moddb.com/mods/cameo
Re: LUA script to force AI to build in a certain Order
A workaround could be using yaml prerequisite & condition systems.
For instance you could clone the refinery (make it only available to the specific bot/faction) & make ai build Powerplant then Refinery & then refinery 2 before it can unlock other buildings.
You’d need to clone most of the bots techtree do you could change the prerequisite buildings & also add the clone buildings to the AI.yaml.
For instance you could clone the refinery (make it only available to the specific bot/faction) & make ai build Powerplant then Refinery & then refinery 2 before it can unlock other buildings.
You’d need to clone most of the bots techtree do you could change the prerequisite buildings & also add the clone buildings to the AI.yaml.
Re: LUA script to force AI to build in a certain Order
that is exactly how iam doing it at the momentInq wrote: ↑Fri Nov 23, 2018 12:51 amA workaround could be using yaml prerequisite & condition systems.
For instance you could clone the refinery (make it only available to the specific bot/faction) & make ai build Powerplant then Refinery & then refinery 2 before it can unlock other buildings.
You’d need to clone most of the bots techtree do you could change the prerequisite buildings & also add the clone buildings to the AI.yaml.
for example, i attatch to the Main Building "fact" the lines:
Code: Select all
GrantConditionOnBotOwner:
Condition: botplayer
Bots: cabal, watson, hal9001
ProvidesPrerequisite@botowner:
Prerequisite: botplayer
RequiresCondition: botplayer
Code: Select all
Buildable:
Prerequisites: !botcity
Code: Select all
Buildable:
Prerequisites: ~botcity
RenderSprites:
Image: pyle
except i find another way.. i have to try if it is somehow possible to stack conditions and then get a prerequisite?
i mean, at least it is possible for ranking units that there is a counter for their ranks:
Code: Select all
DamageMultiplier@RANK-3:
RequiresCondition: rank-veteran == 3
Modifier: 85
i will look into it
Check out my CnC mod at:
https://www.moddb.com/mods/cameo
https://www.moddb.com/mods/cameo
Re: LUA script to force AI to build in a certain Order
hmmm... i looked into it, i cant seem to find a way to provide a prerequisite as soon as a certain number of one building is build on the map.
for example:
as soon as a player has 4 Power Plants - the Power Plants provide a new prerequisite necesary to build other buildings... that does not seem do be possible in any way i think.
only with another work around, if i make 4 seperate Power Plants, limit them to 1 and each of those grant an unique prerequisite "power1" ""power2" "power3" "power4" i can tell all other further buildngs they need to have all of the 4 unique prerequisites before they can be build.
the problem with this is, if i also make it possible afterwards to build as many "normal" power plants as you want, it DOES matter wich power plant is destroyed for the player.
if one of the first 4 is destroyed, the prerequisites are not met anymore for many buildings... if one of the later "normal" power plants is destroyed, nothing happens to the 4 prerequisites...
well... no advantage without a disadvantage
for example:
as soon as a player has 4 Power Plants - the Power Plants provide a new prerequisite necesary to build other buildings... that does not seem do be possible in any way i think.
only with another work around, if i make 4 seperate Power Plants, limit them to 1 and each of those grant an unique prerequisite "power1" ""power2" "power3" "power4" i can tell all other further buildngs they need to have all of the 4 unique prerequisites before they can be build.
the problem with this is, if i also make it possible afterwards to build as many "normal" power plants as you want, it DOES matter wich power plant is destroyed for the player.
if one of the first 4 is destroyed, the prerequisites are not met anymore for many buildings... if one of the later "normal" power plants is destroyed, nothing happens to the 4 prerequisites...
well... no advantage without a disadvantage
Check out my CnC mod at:
https://www.moddb.com/mods/cameo
https://www.moddb.com/mods/cameo