Jump to content

CnCNet Forums

Search In
  • More options...
Find results that contain...
Find results in...
Concolor1

AI in Missions?

Recommended Posts

Ive started looking into this McPwny, Ive had some success, but do have a few questions that may confirm or add new information with regards to allowing the AI to control its House.

First off Im using the original Final Alert, as Im not doing anything with YR. Would I be better off using the YR editor and just setting it to Red Alert2? Would this give me more options, just a thought.

Secondly, Ive got the AI House Russia to produce Units, however I did initiate the 'Use own AI Triggers', option. So of course its happily running its own teams across the map and ignoring the scant Units I told it to build. 

Third one. I set up a second Enemy house, however for some reason the Pre-placed MCV failed to follow the waypoints in script and simply went for the Deploy and success. At first I though this could of been a problem in the waypoint path, (a blockage, or too narrow a channel). However on placing the MCV next to its deploy spot, that's just what it did, deploy.  It then went on to produce its base node buildings, but stopped at producing Units. Given that the MCV was the only Unit belonging to House Cuba on the map, does it still confuse the AI? Would I be better off simply placing a Con Yard.

I understand that if I want patrols ect they must belong to a 'Third House', so no to confuse the AI. I'll just ally them, ensuring the conditions exist for a win. However if I were to force the third side to 'change house', at some point would that upset the AI also?

Share this post


Link to post
Share on other sites

the inner workings of the AI and its triggers in yr are actually exactly the same as they were in tiberian sun, so it will be okay to use normal ra2 with them (might not have "neutral house owns..." condition idk) 

one of the reasons global AI doesnt work with campaign well is that unlike skirmish, all houses share a max= value.. so if you have multiple houses all allies or soviet, then there may be more houses than available basedef teams etc and it becomes a mess. its easier to debug without global AI also so i never use it and dont really recommend it. global AI might also be whats making your MCV's act weirdly... i know that mcvs have some really janky logic behind their deployment and i know that scripts exist for them in ai.ini that tells them to deploy (though not actually used in skirmish). global AI could be commandeering your mcv teams through recruitment.

and lastly about the patrol teams.. you can get around the problem without separate houses if you either 
1) make the patrols all out of units that the AI will not try and use ; or 
2) add "areteammembersrecruitable=yes" to all the teams, then make sure their priority is set right (assuming your AI teams have recruiter=yes) doing this will make the AI pick up the units and use them and there will be no problem. if its a preplaced unit just tick both recruitable boxes.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks McPwny Im starting to get my head around it a little now, and Id like to understand it so keep trying different ideas just to see what works and what doesn't , it certainly makes for a more 'random', game. Never quite knowing what's coming for you. At the moment the only thing that gets me is the wait. The AI seems to take a fair amount of time building these complicated teams, only to send them out and get destroyed by an enemy Unit that just happens to get lucky. It also sent a single Kirov, by the time it got to me Id built enough SAM sites to bring down a fleet. Map size is 130 x 110.

Having added the Global AI would I have to delete each team to remove it, or might it be simpler to start from scratch and never initiate it. (Assuming Im understanding that Global AI is AI trigger types Enable? This wouldn't be hard as Ive not done that much.

 

Share this post


Link to post
Share on other sites

turning the global AI off in [Basic] means that any ai.ini teams will not be built. literally, it will build only its hardcoded miners and the new teams you tell it to, which is ideal for debugging. i am pretty sure it will ignore the global AI whether or not you have them 'individually enabled' via the default map ai triggers thing... i think they only put that in so people could turn off specific AI triggers in skirmish maps, and whether or not it even properly does that is a mystery to me. i never use it.

if the AI is taking a long time to start building its attack teams, but builds defense ones right away, it is because it doesnt recognize a threat and you can hurry it up by using the trigger action "make enemy" 

if the AI is building all teams but is just annoyingly slow for your tastes, you can ini edit the AI to build them faster with this tag:
[General] 
TeamDelays=2000,2500,3500  ;if way too low the ai may get confused, use 500+ at least
and of course, make sure it has money and power.

when i make map ai's, i usually ini edit myself an invincible unit with a big gun and a psychic beacon with huge range and then turn the game speed to max (theres a hack to enable the speed slider in campaign somewhere). you will be able to tell if everything is working or not in about a minute like that.

Share this post


Link to post
Share on other sites

Well its sort of working, but I don't really think the Ai has a hand in it.  You see I turned off the global Ai, so the Ai now just produces its harvesters, and builds its structures. No random units are produced to defend its base.

It builds the teams I tell it to, but only if I instruct it to in a trigger, by using the Action 4 create team..... (It creates the team, the team follows its script and thats it). Literally, the Ai does nothing else, no other units are produced. Is this what Im aiming for? 

Share this post


Link to post
Share on other sites

Ok, here it is in a very basic form, no Locked input, No scrolling, its just the Player and 3 Ai teams, one of which does its own thing with the MCV despite being told otherwise. I may end up just forcing Russia to build it. 

You will see there are a few Ai teams and triggers. All buildings produce their Units and follow their scripts, that's not a problem. I just can't get my head around what exactly isbasedefense means, and why it needs it?

The patrols belong to the third house, (possibly why the MCV sat on Waypoint 16 just deployed instead of following its script.

all01t.map

Share this post


Link to post
Share on other sites

pretty much basedefense teams are normal teams but the game handles them with special logic. base defense teams are built before the AI even picks an enemy; they are built before other teams (so if the basedef team dies, the AI fills them before anything else). it means that the AI will always always try and build them first, and if it cant build them it will do absolutely nothing.

i am looking at your map and you havent made any 'AI trigger types'. pretty much you just make an ai trigger, and when the conditions are met, the ai will build them just like action 4.

any team can be a basedef team, but its good to make them actually defend the base. look here:
image.png.d095d6b596b0f3d2c13679ccb6934680.png
the script tells it to patrol around the base and the taskforce is made up of the most common units. it has priority=1 and areteammembersrecruitable checked which means any team with the same units, recruiter=yes, and a priority more than 1 will steal this teams units( which is cool but not mandatory ). it has reinforce checked which means that once some of this teams units are killed/stolen, the AI will try and make the team whole again ( which is good for pool/defense teams ) house doesnt matter. this team will be a good base defense
image.png.172256be9791368ae8d39a5028d53023.png
now the AI trigger just says "hey if you own 1 or more [NAWEAP] and you are "soviet", go right ahead and build team 01000078 at the discretion of the ai trigger's weight." all basedefense teams should have basedefense ai triggers, though.

once you have like two teams like this, (or 1 team with a higher max=) you can make as many 'non base-def' teams as you want with the same procedure.

the other thing i noticed is that in your AI enable trigger it has actions 3 and 74. what you want is actions 13 and 74 (im convinced 3 does nothing). the "AI Auto Production" triggers fa2 generated automatically are enabling the AI, though

 

Edited by McPwny
  • Thanks 1

Share this post


Link to post
Share on other sites

Ok I see some of the problem here. As I was using the original Final Alert2 editor. Its not got the Ai Triggers it only has the Trigger Enabling feature. Only the Final Alert YR has.

Share this post


Link to post
Share on other sites

that comes as a surprise considering that AI triggers are available in the tiberian sun editor. but now that i think about it, the tibsun editor came after the original ra2 one so maby they didnt add it until later in development. very weird

  • Like 1

Share this post


Link to post
Share on other sites

Just looking through it now. Im still unclear as to the reasoning behind this Condition being Great than or Equal to, meaning, the base has to own '1' of this building to make the team, so you find the building in the drop down list. In my case NAHAND the Soviet Barracks? That right, shouldn't it need power too? Hang on your says Tech type, mine says Unit type.

Edited by Concolor1

Share this post


Link to post
Share on other sites

thats the condition of the AI trigger, and if its met it will tell the AI "go ahead and make this team if you can". it will still follow other rules like prerequisites, money, techlevel, owner, and stuff. it only controls when the AI has a green light to consider making the teams. if you tell it to build apocolypse tanks when it has a war factory but i doesnt have a battle lab yet, it wont make the team.


you can set it to -1 OR set it to the team's unit's factory and it will just build it when it can, or you could get fancy and set it to make the team only when maby the enemy has a battle lab, or if they build 8 harriers, or if the own house has no conyard etc.

  • Like 1

Share this post


Link to post
Share on other sites

Ok yes I understand. So Ive now written two Base defence teams, one consisting of a few Flak Troops and Conscripts, the other of 3 Rhino Tanks. Both are scripted to move to own buildings. Ive written the Ai triggers for this and altered the AI trigger to Action 13 instead of 3. Fingers crossed I'll go see what happens. Many thanks again.

So here's what it did. It produced the First Team that was left alone, the Conscripts with the Engineer. It then produced the Base defence team, with the Flak Troops and Conscripts. That was all, no Rhino's. 

The Cuba Base I left alone and it did what it was told to. I'll go look at my trigger again.  --- My bad I hadn't altered the 0 house owns the conditions field.

Edited by Concolor1
  • Upvote 1

Share this post


Link to post
Share on other sites

Yes it built both base defence teams. I now have a little understanding. Unclear on weighting ect, But I guess I'll get more into that as I get comfortable with this cleaner method of bringing Units into the field. Once again thankyou for taking all this trouble and time to explain it all, its going to be a while before this current project is finished, but you will be the main contributing factor in it's completion once its done.

 

Share this post


Link to post
Share on other sites

nice. now that its working and building those basedef teams it will build anything else you tell it to no problem. just remember that in campaign all houses share the max= value on their teams so if you have like 3 basedef teams with max=1 and 2 AI that want 2 basedef teams each one of them will glich out. let me know if you need anything else

Share this post


Link to post
Share on other sites

So the second or third houses need identical Base Defence Teams, or just Base Defence teams set to the same Max=. Im gonna have to write all this down, lol 

Share this post


Link to post
Share on other sites

lets say there is a team and it has a max=5, and there is 6 AI on the map that can use that team. total, those six AI can build that team five times... like there can only be 5 instances of that team on the map at any 1 time. in skirmish, each AI can build it five times but in campaign all AI combined can only build it five times. no one really knows why

i made some notes for this kind of thing on that mapping guide i showed you earlier, if you ever need to refresh your memory

  • Like 1

Share this post


Link to post
Share on other sites

Ok I understand, yes I keep going back to that guide. Now Ive a more practical idea, I'll read it again, so something should stick.☺️

Share this post


Link to post
Share on other sites

Im having some success, but it seems that after an initial onslaught there's a lull in attacks, (More a yawning chasm), is this because I started dictating conditions as to what team is being built? (Does that interrupt the ai, so it stops?)

Couple of non related questions, is it possible to have two radiation colours on a single map? I know how to change the colour, but was wondering if it can be duplicated so you could have a second colour for another use, just by ini editing. 

Oh and if I don't work it out by trawling through the rules, im thinking 'pilot' or crewed, can I have a mixed paradrop without two planes flying overhead from the tech airport. I could fake it with the cargo plane maybe?

Share this post


Link to post
Share on other sites

most of the time when an AI becomes unresponsive its because the scripts of the units get jammed. maby it cant complete its script, or maby the pathfinding gets a snag and the unit just dies mid script(this was a huge problem in TS). the teams get built so their max= is met, but they cant do anything. so they sit there while the AI waits to be able to build more teams. i can take a look at it myself if all else fails

no.. there is only 1 rad hardcoded into the game. many mods have added radtypes, but its not possible through just .ini editing.

for whatever reason, the paradrop superwep from rules.ini will always spawn a plane for every infantrytype added. though if its a team with multiple types of infantry and you reinforce it through map triggers it will come in 1 plane.
.... i guess you could fake a sidebar button that reinforces the team when clicked through a ini/trigger setup i know of, but you wouldnt be able to chose its dropzone and its pretty complex.

  • Like 1

Share this post


Link to post
Share on other sites

I'll stick with the Ai for now, and see if I can fix this myself. It gives me a little longer to turn it into something, as there's lots of loose ends with regards to the win conditions. what with me keeping adding stuff too.

Great shame about the Radiation, I was hoping to do something different with a separate colour. Has given me the glimmering of an idea for another project though. Searched through a few forums for this and saw nothing which made me think it was a no go.

As for the Paradrop, hmmmm, guessing adding a paradrop to a separate building is just going to give me the same troops too if its owned by the same house as the Airport. I'll have a think about that. Once again thankyou.

Share this post


Link to post
Share on other sites

I'll stick with the Ai for now, and see if I can fix this myself. It gives me a little longer to turn it into something, as there's lots of loose ends with regards to the win conditions. what with me keeping adding stuff too.

Great shame about the Radiation, I was hoping to do something different with a separate colour. Has given me the glimmering of an idea for another project though. Searched through a few forums for this and saw nothing which made me think it was a no go.

As for the Paradrop, hmmmm, guessing adding a paradrop to a separate building is just going to give me the same troops too if its owned by the same house as the Airport. I'll have a think about that. Once again thankyou.

If you would like a look at it, I've now got a basic full mission, that runs ok. Ive still got variables to add, along with sounds, texts, crates ,detail and bridge repair triggers. Ive fixed up a second cargo plane that repeats on a building exists/not exists trigger. My only bug on that is it needs directing to a waypoint.

Your probably going to scream at me if you see what Ive done.☠️

Share this post


Link to post
Share on other sites

if you want to send it to me, i will have a crack at debugging any problems i find. if not, ill just wait for the maps release

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...