Author Topic: AI getting things it shouldn't  (Read 2457 times)

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
AI getting things it shouldn't
« on: March 01, 2017, 08:37:54 pm »
I added a minor hero ship to the Rebel Alliance and the Empire somehow got their hands of four of this particular hero. I would like to know if there is a way to fix this issue. The minor hero in question is in a VSD, but his code is in no way linked to the Imperial VSD (it is not a "variant _of_existing"). Any assistance would be appreciated.

Offline Kad_Venku

  • Administrator
  • Senior Lt.
  • ******
  • Posts: 85
Re: AI getting things it shouldn't
« Reply #1 on: March 02, 2017, 12:33:10 am »
The AI does not adhere to build limits. So if you add a buildable (aka. minor) hero, the AI will build it ... often.

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
Re: AI getting things it shouldn't
« Reply #2 on: March 02, 2017, 02:56:59 pm »
I forgot to mention the minor hero in questing is only available via story scripting and only one spawns for the Rebels late game. The Empire shouldn't be getting him period.

Offline Kad_Venku

  • Administrator
  • Senior Lt.
  • ******
  • Posts: 85
Re: AI getting things it shouldn't
« Reply #3 on: March 02, 2017, 03:35:19 pm »
I forgot to mention the minor hero in questing is only available via story scripting and only one spawns for the Rebels late game. The Empire shouldn't be getting him period.

Without the hero's code, I'm in the dark here...

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
Re: AI getting things it shouldn't
« Reply #4 on: March 02, 2017, 04:27:41 pm »
Code: [Select]
	<!-- Protector is used by Admiral Harkov (Rebel Minor Hero) during space battles - released during story arc -->
<UniqueUnit Name="Protector">
<Text_ID>TEXT_UNIT_PROTECTOR</Text_ID>
<Encyclopedia_Text> TEXT_TOOLTIP_PROTECTOR </Encyclopedia_Text>
<Encyclopedia_Unit_Class> TEXT_ENCYCLOPEDIA_CLASS_FLEET_COMMANDER </Encyclopedia_Unit_Class>
<Encyclopedia_Good_Against> Tartan_Patrol_Cruiser Crusader_Gunship </Encyclopedia_Good_Against>
<Encyclopedia_Vulnerable_To> TIE_Bomber Star_Destroyer Vengeance_Frigate </Encyclopedia_Vulnerable_To>
<Is_Named_Hero>No</Is_Named_Hero>
        <Show_Hero_Head>Yes</Show_Hero_Head>
<Icon_Name>i_button_harkov.tga</Icon_Name>
<Space_Model_Name>Imp_VSD_I.ALO</Space_Model_Name>
<Mass>0.995</Mass>
<Scale_Factor>1.0</Scale_Factor>
<No_Colorization_Color> 255, 255, 255, 255 </No_Colorization_Color>

        <Ranking_In_Category>5</Ranking_In_Category>
<Select_Box_Scale>300</Select_Box_Scale>
<Select_Box_Z_Adjust>-20</Select_Box_Z_Adjust>

<Build_Cost_Credits>5000</Build_Cost_Credits>

<MovementClass> Space </MovementClass>
<Space_Layer> Frigate </Space_Layer>
<Max_Speed>1.45</Max_Speed>
<Max_Rate_Of_Turn>0.167</Max_Rate_Of_Turn>
<Max_Thrust>0.16</Max_Thrust>
<Max_Rate_Of_Roll>0.167</Max_Rate_Of_Roll>
<Bank_Turn_Angle>25</Bank_Turn_Angle>
<Hyperspace>Yes</Hyperspace>
<Hyperspace_Speed>4.0</Hyperspace_Speed>
<Space_Full_Stop_Command>yes</Space_Full_Stop_Command>
<OverrideAcceleration> .00533 </OverrideAcceleration>
<OverrideDeceleration> .00533 </OverrideDeceleration>
<Layer_Z_Adjust> -165 </Layer_Z_Adjust>

<Armor_Type> Armor_Victory_Class </Armor_Type>

<Death_Clone>Damage_Normal</Death_Clone>
<Remove_Upon_Death>true</Remove_Upon_Death>

<Damage>80</Damage>
<Autoresolve_Health>4250</Autoresolve_Health>
<Shield_Points>9650</Shield_Points>
<Tactical_Health>9040</Tactical_Health>
<Shield_Refresh_Rate>120</Shield_Refresh_Rate>
<Energy_Capacity>3000</Energy_Capacity>
<Energy_Refresh_Rate>500</Energy_Refresh_Rate>

<Affiliation>Rebel</Affiliation>
<Ship_Class>frigate</Ship_Class>
<Formation_Priority>4</Formation_Priority>
<Is_Bomber>no</Is_Bomber>
<Surface_Bombardment_Capable>yes</Surface_Bombardment_Capable>
<!--<Political_Control>1</Political_Control>-->
<Political_Faction>Rebel</Political_Faction>
<Squadron_Capacity>10</Squadron_Capacity>
<Transport_Capacity>8</Transport_Capacity>
<Number_per_Squadron>1</Number_per_Squadron>
<AI_Combat_Power>3000</AI_Combat_Power>
<Size_Value>8</Size_Value>
<Behavior> SELECTABLE, DUMMY_STARSHIP </Behavior>
<SpaceBehavior>WEAPON, BARRAGE, ABILITY_COUNTDOWN, SIMPLE_SPACE_LOCOMOTOR, POWERED, SHIELDED, HIDE_WHEN_FOGGED, REVEAL, TARGETING, UNIT_AI, ASTEROID_FIELD_DAMAGE, ION_STUN_EFFECT, NEBULA, DAMAGE_TRACKING, SPAWN_SQUADRON </SpaceBehavior>
<Collidable_By_Projectile_Living>Yes</Collidable_By_Projectile_Living>
<Space_FOW_Reveal_Range>1500.0</Space_FOW_Reveal_Range>
<Dense_FOW_Reveal_Range_Multiplier>0.2</Dense_FOW_Reveal_Range_Multiplier>
<Targeting_Max_Attack_Distance>2000.0</Targeting_Max_Attack_Distance>

<Projectile_Types>Proj_Ship_Concussion_Missile</Projectile_Types>
<Turret_Rotate_Extent_Degrees>300</Turret_Rotate_Extent_Degrees>
<Turret_Elevate_Extent_Degrees>300</Turret_Elevate_Extent_Degrees>
<Projectile_Fire_Pulse_Count>18</Projectile_Fire_Pulse_Count>
<Projectile_Fire_Pulse_Delay_Seconds>0.23</Projectile_Fire_Pulse_Delay_Seconds>
<Projectile_Fire_Recharge_Seconds>8.0</Projectile_Fire_Recharge_Seconds>
<Targeting_Max_Attack_Distance>2500.0</Targeting_Max_Attack_Distance>
<Targeting_Min_Attack_Distance>20</Targeting_Min_Attack_Distance>
<SFXEvent_Fire>Unit_Missile_Fire</SFXEvent_Fire>

<Starting_Spawned_Units_Tech_0>TIE_Avenger_Squadron, 2</Starting_Spawned_Units_Tech_0>
<Spawned_Squadron_Delay_Seconds>5</Spawned_Squadron_Delay_Seconds>


<HardPoints>
HP_VSD_I_MTLT_19,
HP_VSD_I_MTLT_18,
HP_VSD_I_MTLT_17,
HP_VSD_I_MTLT_16,
HP_VSD_I_MTLT_15,
HP_VSD_I_MTLT_14,
HP_VSD_I_MTLT_13,
HP_VSD_I_MTLT_12,
HP_VSD_I_MTLT_11,
HP_VSD_I_MTLT_10,
HP_VSD_I_MTLT_09,
HP_VSD_I_MTLT_08,
HP_VSD_I_MTLT_07,
HP_VSD_I_MTLT_06,
HP_VSD_I_MTLT_05,
HP_VSD_I_MTLT_04,
HP_VSD_I_MTLT_03,
HP_VSD_I_MTLT_02,
HP_VSD_I_MTLT_01,
HP_VSD_I_XX9_S_11,
HP_VSD_I_XX9_S_10,
HP_VSD_I_XX9_S_09,
HP_VSD_I_XX9_S_08,
HP_VSD_I_XX9_S_07,
HP_VSD_I_XX9_S_06,
HP_VSD_I_XX9_S_05,
HP_VSD_I_XX9_S_04,
HP_VSD_I_XX9_S_03,
HP_VSD_I_XX9_S_02,
HP_VSD_I_XX9_S_01,
HP_VSD_I_QHTLT_04,
HP_VSD_I_QHTLT_03,
HP_VSD_I_QHTLT_02,
HP_VSD_I_QHTLT_01,
HP_VSD_I_DHTLT_02,
HP_VSD_I_DHTLT_01,
HP_VSD_I_SG_01,
HP_VSD_I_SG_02,
HP_VSD_I_SG_03,
HP_VSD_I_SG_04,
HP_VSD_I_Bridge,
HP_VSD_I_Hangar,
HP_VSD_I_Engines
</HardPoints>

<Death_Explosions>Large_Explosion_Space</Death_Explosions>
<Asteroid_Damage_Hit_Particles>Large_Damage_Space</Asteroid_Damage_Hit_Particles>
<Victory_Relevant>yes</Victory_Relevant>
<Score_Cost_Credits> 55000 </Score_Cost_Credits>

<SFXEvent_Select>Unit_Select_Victory_Destroyer</SFXEvent_Select>
<SFXEvent_Move>Unit_Move_Victory_Destroyer</SFXEvent_Move>
<SFXEvent_Fleet_Move>Unit_Fleet_Move_Victory_Destroyer</SFXEvent_Fleet_Move>
<SFXEvent_Attack>Unit_Attack_Victory_Destroyer</SFXEvent_Attack>
<SFXEvent_Guard>Unit_Guard_Victory_Destroyer</SFXEvent_Guard>
<SFXEvent_Bombard_Select_Target> RHD_Bombard_Select_Target </SFXEvent_Bombard_Select_Target>
<SFXEvent_Bombard_Incoming> RHD_Bombard_Incoming  </SFXEvent_Bombard_Incoming>

<SFXEvent_Engine_Idle_Loop> Unit_Victory_Destroyer_Idle_Engine_Loop </SFXEvent_Engine_Idle_Loop>
<SFXEvent_Engine_Moving_Loop> Unit_Victory_Destroyer_Moving_Engine_Loop </SFXEvent_Engine_Moving_Loop>
<SFXEvent_Engine_Cinematic_Focus_Loop> Unit_Victory_Destroyer_Cinematic_Engine_Loop </SFXEvent_Engine_Cinematic_Focus_Loop>

        <SFXEvent_Build_Started>RHD_Build_Vehicle</SFXEvent_Build_Started>
        <SFXEvent_Build_Cancelled>RHD_Unit_Canceled</SFXEvent_Build_Cancelled>
        <SFXEvent_Build_Complete>Unit_Select_Victory_Destroyer</SFXEvent_Build_Complete>

<Death_SFXEvent_Start_Die>SFX_Death_Bombard</Death_SFXEvent_Start_Die>

<Population_Value>3</Population_Value>

<Neutralization_Cost>3000.0</Neutralization_Cost>
<Can_Be_Neutralized_By_Major_Heroes>No</Can_Be_Neutralized_By_Major_Heroes>
<Can_Be_Neutralized_By_Minor_Heroes>No</Can_Be_Neutralized_By_Minor_Heroes>

<!--<MULTIPLAYER SKIRMISH VALUES BEGIN>-->
<Tactical_Build_Cost_Multiplayer>3000</Tactical_Build_Cost_Multiplayer>
<Tactical_Build_Time_Seconds>20</Tactical_Build_Time_Seconds>
<Tactical_Build_Prerequisites />
<Tactical_Production_Queue>Tactical_Units</Tactical_Production_Queue>
<Build_Limit_Current_Per_Player>1</Build_Limit_Current_Per_Player>
<Build_Limit_Lifetime_For_All_Allies>-1</Build_Limit_Lifetime_For_All_Allies> 
<!--<MULTIPLAYER SKIRMISH VALUES END>-->

<!-- Non-Hero unit abilities description -->
<Unit_Abilities_Data SubObjectList="Yes">
<!-- Primary ability -->
            <Unit_Ability>
<Type>POWER_TO_WEAPONS</Type>
<Mod_Multiplier>WEAPON_DELAY_MULTIPLIER, 0.3</Mod_Multiplier>
<Mod_Multiplier>SPEED_MULTIPLIER, 2.0</Mod_Multiplier>
<Mod_Multiplier>CAUSE_DAMAGE_MULTIPLIER , 2.0</Mod_Multiplier>
<Recharge_Seconds>50</Recharge_Seconds>
<Expiration_Seconds>7</Expiration_Seconds>
                <Alternate_Name_Text>TEXT_TOOLTIP_ABILITY_ASSAULT_NAME</Alternate_Name_Text>
                <Alternate_Description_Text>TEXT_TOOLTIP_ABILITY_ASSAULT_DESCRIPTION</Alternate_Description_Text>
                <Alternate_Icon_Name>i_sa_assault.tga</Alternate_Icon_Name>
</Unit_Ability>
</Unit_Abilities_Data>

<!-- Hero abilities moved to ship; Harkov "movable" unit removed -->
<Abilities SubObjectList="Yes">
<Combat_Bonus_Ability Name="Harkov_Combat_Bonus">
<Activation_Style>Space_Automatic</Activation_Style>
<Unit_Strength_Category>Fighter | Bomber | Transport | Corvette | Frigate | Capital</Unit_Strength_Category>
<Applicable_Unit_Categories>Fighter | Bomber | Transport | Corvette | Frigate | Capital</Applicable_Unit_Categories>
<Applicable_Unit_Types />
<Health_Bonus_Percentage>0.15</Health_Bonus_Percentage>
<Damage_Bonus_Percentage>0.15</Damage_Bonus_Percentage>
<Energy_Pool_Bonus_Percentage>0.0</Energy_Pool_Bonus_Percentage>
<Shield_Bonus_Percentage>0.0</Shield_Bonus_Percentage>
<Defense_Bonus_Percentage>0.0</Defense_Bonus_Percentage>
<Movement_Speed_Bonus_Percentage>0.0</Movement_Speed_Bonus_Percentage>
<Stacking_Category>0</Stacking_Category>
</Combat_Bonus_Ability>
</Abilities>

<Is_Visible_On_Radar>Yes</Is_Visible_On_Radar>
<Radar_Icon_Scale_Land>1.0</Radar_Icon_Scale_Land>
<Radar_Icon_Scale_Space>1.0</Radar_Icon_Scale_Space>
      <Visible_On_Radar_When_Fogged>true</Visible_On_Radar_When_Fogged>
<Multisample_FOW_Check>Yes</Multisample_FOW_Check>

<CategoryMask> Frigate | SpaceHero | AntiCorvette </CategoryMask>
<Targeting_Priority_Set>Frigate</Targeting_Priority_Set>
<Has_Space_Evaluator>True</Has_Space_Evaluator>
</UniqueUnit>

Offline Kad_Venku

  • Administrator
  • Senior Lt.
  • ******
  • Posts: 85
Re: AI getting things it shouldn't
« Reply #5 on: March 04, 2017, 10:23:50 am »
Did you copy that from an existing hero?
Because what is currently irritating me is the lack of build prerequisites and tech level.
Which still doesn't explain the enemy AI building it... Have you added the hero to the AI files or does it show up in a story even where it shouldn't?
Or more importantly, are you able to build the hero when playing as the enemy?

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
Re: AI getting things it shouldn't
« Reply #6 on: March 04, 2017, 06:38:42 pm »
Yes, I believe I used either Ackbar or the Sundered Heart as a base and I changed information as needed.
I haven't touched the AI. No, he only spawns when he's supposed to (when I'm playing as the Rebels anyway.
I haven't checked yet.

Offline Wariscool

  • Staff
  • Ensign
  • ***
  • Posts: 34
Re: AI getting things it shouldn't
« Reply #7 on: March 07, 2017, 08:45:34 pm »
So if you haven't touched the AI how do you spawn the hero for your side?

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
Re: AI getting things it shouldn't
« Reply #8 on: March 07, 2017, 09:56:05 pm »
I meant I haven't touched any of the files in the AI section of the XML folder. I have added the story event that spawns the hero for both the rebel player and the rebel AI.

Offline Wariscool

  • Staff
  • Ensign
  • ***
  • Posts: 34
Re: AI getting things it shouldn't
« Reply #9 on: March 07, 2017, 10:38:08 pm »
Could you post the code possibly? And maybe a breakdown of when the enemy gets hold of them? Maybe the AI is using the wrong story code.

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
Re: AI getting things it shouldn't
« Reply #10 on: March 07, 2017, 10:51:16 pm »
The AI got a hold of them at what I can only assume was Imperial Tech 3 or 4 and, to my knowledge, the story code was not incorrect. I will have to play-test a bit to be certain, but the Imperial AI story code is definitely correct now. This is the code used to spawn him for the Rebels.
Code: [Select]
<Event Name="Spawn_Harkov">
<Event_Type>STORY_TRIGGER</Event_Type>
<Reward_Type>UNIQUE_UNIT</Reward_Type>
<Reward_Param1>Protector</Reward_Param1>
<Reward_Param2>Hoth</Reward_Param2>
<Prereq>Rebels_Enter_Tech_03</Prereq>
</Event>

Offline Wariscool

  • Staff
  • Ensign
  • ***
  • Posts: 34
Re: AI getting things it shouldn't
« Reply #11 on: March 07, 2017, 11:02:36 pm »
No issues with the code there.
One thing you could try is in the unique unit code add a tech level line which is set at 99. That way is shouldn't be buildable at all.

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
Re: AI getting things it shouldn't
« Reply #12 on: March 08, 2017, 04:49:04 am »
That's not a bad idea.

Offline Striker

  • Regular Member
  • Cadet
  • *
  • Posts: 17
Re: AI getting things it shouldn't
« Reply #13 on: April 14, 2017, 05:26:51 pm »
Not really on point but somewhat related is can anyone tell me what the heck is the deal with the build limits. If you take a regular unit like say a Star Destroyer and you only want to be able to build one at a time so in the skirmish values section you set the build limit to 1 and the build lifetime to -1 or 0 or whatever so you can always rebuild it if it dies but then when you get in a skirmish game there is no limit on them and you can build as many as you can afford. If I copy a hero code like Ackbar's Home One and change all the necessary bits to make it a Star Destroyer then suddenly the build limit works. I've gone through a hero unit and regular unit line by line and don't see what the heck the difference is other than the Hero unit is missing a few lines of code and has a few hero specific lines which I've added those to the regular unit including making it a unique unit but nothing worked so far without a complete code copy and paste. Would love to find out what the heck you need to change to make a regular unit build limit work without having to copy a hero ship code and start from scratch.

Offline Bucman55

  • Regular Member
  • Ensign
  • *
  • Posts: 21
Re: AI getting things it shouldn't
« Reply #14 on: April 15, 2017, 04:07:01 am »
Would love to find out what the heck you need to change to make a regular unit build limit work without having to copy a hero ship code and start from scratch.
At the bottom of the ship code should be a commented out line saying

    <!--<Build_Limit_Current_Per_Player>0</Build_Limit_Current_Per_Player>-->

Uncomment it and change 0 to whatever number you want.

    <Build_Limit_Current_Per_Player>4</Build_Limit_Current_Per_Player>