Jump to content
Game-Labs Forum

Is there a way to deny the AI a ship part


McMatto

Recommended Posts

Is it in Components and if so... what determines that the AI wont use it but the player can still choose it?

main_engine_1,,engine,$component_name_short_main_engine_1,1,$technology_name_engine_engine_1,$technology_desc_engine_engine_1,,
main_engine_2,,engine,$component_name_short_main_engine_2,2,$technology_name_engine_engine_2,$technology_desc_engine_engine_2,,
main_engine_3,,engine,$component_name_short_main_engine_3,4,$technology_name_engine_engine_3,$technology_desc_engine_engine_3,,
main_engine_3_adv,,engine,$component_name_short_main_engine_3_adv,6,$technology_name_engine_engine_4,$technology_desc_engine_engine_4,,
main_engine_4,,engine,$component_name_short_main_engine_4,24,$technology_name_engine_engine_5,$technology_desc_engine_engine_5,,
main_engine_5,,engine,$component_name_short_main_engine_5,25,$technology_name_engine_engine_6,$technology_desc_engine_engine_6,,
main_engine_turbo,,engine,$component_name_short_main_engine_turbo,10,$technology_name_engine_engine_7,$technology_desc_engine_engine_7,,
main_engine_6,,engine,$component_name_short_main_engine_6,36,$technology_name_engine_engine_8,$technology_desc_engine_engine_8,,
main_engine_7,,engine,$component_name_short_main_engine_7,37,$technology_name_engine_engine_9,$technology_desc_engine_engine_9,,
main_engine_8,,engine,$component_name_short_main_engine_8,37,$technology_name_engine_engine_10,$technology_desc_engine_engine_10,,
main_engine_9,,engine,$component_name_short_main_engine_9,0,$component_name_short_main_engine_9,$technology_desc_engine_engine_11,,

I have changed the value of this Gas Turbine Engine from 37 to 0...  does anyone know if that will that work?

Link to comment
Share on other sites

2 hours ago, McMatto said:

I have changed the value of this Gas Turbine Engine from 37 to 0...  does anyone know if that will that work?

While it does make AI unable to use it, the game also uses this value for Obsoletion.
I don't recall the exact formula, but if there's a component with this value that's like more than 4 times larger than the other target component's value, then that low-priority component will obsolete and be inaccessible to players too.

Edited by XerMGGW-2
Link to comment
Share on other sites

7 hours ago, XerMGGW-2 said:

While it does make AI unable to use it, the game also uses this value for Obsoletion.
I don't recall the exact formula, but if there's a component with this value that's like more than 4 times larger than the other target component's value, then that low-priority component will obsolete and be inaccessible to players too.

Thanks for getting back to me! So what would be the solution for absolute denial or is there no option for that?

Link to comment
Share on other sites

21 minutes ago, NathanKell said:

You can do this for parts (add a new param to all AI-allowed parts. Add it in the effect column for all randParts and randPartsRefit.) I can't think of a way to do this for components without writing code.

Okay! I haven't had a look at the randParts file yet but I could definitely make that work i reckon... if you got a moment and its not too much of a bother could you please give me an example of what that might look like?

  • Like 1
Link to comment
Share on other sites

6 minutes ago, McMatto said:

Okay! I haven't had a look at the randParts file yet but I could definitely make that work i reckon... if you got a moment and its not too much of a bother could you please give me an example of what that might look like?

I've added ai_enabled to a tower, and added it as an effect to a randpart entry.

@name,enabled,type,nameUi,order,weight,cost,costMod,crew,model,scale,group,mountPoints,countries,param,stats,caliber,#caliberInch,barrels,hullWeightRatio,sectionsMin,sectionsMax,tonnageMin,tonnageMax,maxAllowedCaliber,beamMin,beamMax,draughtMin,draughtMax,beamCoef,draughtCoef,speedLimiter,minMainTurrets,minMainBarrels,#comment,#comment2,#cost_base,#cost_base_mod
french_usold_tower_main_1,,tower_main,Front Tower III,,500,830000,,120,massena_tower_main_a_var,1.2,,tower_main,,"need(B_Indiana_var), need(g1), ai_enabled","tower_main(1), night(10), aim(6.5), acc(3.5), acc_long(5.5), radio(37), fire_ex(11), smoke(-22), size(15), tspot(2250), torpedo_detect(17.5)",,,,,,,,,,,,,,,,,,,500,375,250000,750000
@name,enabled,shipTypes,chance,min,max,type,paired,group,effect,center,side,rangeZFrom,rangeZTo,condition,param,#,#
8/tower_main///////and(tag[barbette_need]),,"bb, bc",,1,1,tower_main,,,ai_enabled,,,-1,1,,and(tag[barbette_need]),,

Note that if you are adding another param or effect and there's only one there, you enclose in " " and separate by a comma and a space. So for example

22/gun//mc/main_center/c//main_cal/or(tag[newyork_style]),,"bb, bc",,1,2,gun,,mc,main_center,c,,0.5,1,main_cal,or(tag[newyork_style]),,

would become

22/gun//mc/main_center/c//main_cal/or(tag[newyork_style]),,"bb, bc",,1,2,gun,,mc,"main_center, ai_enabled",c,,0.5,1,main_cal,or(tag[newyork_style]),,

 

Note you will need to do this for _every_ Part in parts (and every RandPart in the randParts and randPartsRefit) that you want the AI to be able to use. (some RandParts are actually just flags, like the ones that say "delete_unmounted"--dont' touch those. You just want to touch the ones that are actually calling for parts).

  • Like 1
Link to comment
Share on other sites

UGH actually forget that. Sorry. :( I forgot that randpart's "effect" is a string, it doesn't get parsed into a set. I.e. you can only have one. So this won't work after all (at least for all randparts with an existing effect--it'll work fine for those without one). I mean, it could work wherein you make a copy of all params that randParts _do_ call for in their effect (i.e. main_center_ai_enabled) and give that to all parts with param main_center that you do want the AI to use, and then _change_ all randPart lines with effect main_center to be main_center_ai_enabled, but that's an even more ridiculous amount of work.

Edited by NathanKell
  • Like 1
Link to comment
Share on other sites

That is fantastic... thanks for such a great example : )
So, If I understand this correctly, if I decide to use the ai_enabled tag I have to add it to all or none is essentially the gist of what you are saying?

Link to comment
Share on other sites

Just now, McMatto said:

Could I make a new part that is nation specific maybe?

Certainly! Copy-paste a line, change the name to be unique, and change the countries column for it and there you go. Note that if it's a part, you don't have to worry about adding a specific unlock rule (in techs) for it, that'll already have been handled in the original part (or not handled at all, i.e. handled entirely by hull availability).

 

See above for my second post re: how the effect thing is more complicated though, sorry.

Link to comment
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
×
×
  • Create New...