Code:
---- Fleet close to army, fleet gets own effect bundle ----
if context:character():has_military_force() == true *If character has army = YES, SHOULD BE FORE EVERY DEPLOYED CHARACTER
and (char_is_general_with_navy(context:character())) == true *Character is Admiral = YES
and context:character():has_region() == false *Character is not in land = YES
and Unit_Is_In_Army(context:character(), supply_ship_list) *Fleet has supply ship = YES
and context:character():turns_at_sea() <= 8 *<=8 turns at sea... = YES
and context:character():faction():has_food_shortage() == false *Requires no food shortage = YES
then local char_list = context:character():faction():character_list() *Local char list is constructed, data includes character, faction, and a list of ??? = THIS IS JUST AN EQUIVALENCE FOR NOT WRITING DOWN LONG "PHRASES". IT MEANS THAT EVERY TIME YOU WRITE char_list IT WILL BE context:character():faction():character_list()
for l = 0, char_list:num_items() - 1 do *No idea... = IF YOU FOUND THAT ON SIMILAR FUNCTIONS LEAVE IT AS IT IS, IT'S FOR THE LOOP (ACTUALLY HAVE NO IDEA EITHER)
local curr_char = char_list:item_at(l) *List curr_char objects, in this case land army = JUST AN EQUIVALENCE
local army = curr_char:cqi() *curr_char list (that is unique) is referred to local army = JUST AN EQUIVALENCE
if char_is_general_with_army(curr_char) *This curr_char has to be land army = YES
and curr_char:cqi() ~= context:character():cqi() *beats me.... = THIS MEANS CONTEXT CHARACTER MUST BE DIFFERENT FROM THE LIST IT HAS BEEN PREVIOUSLY DONE, CHECK INTO THE SCRIPT HOW THIS LIST WORK BY SEARCHING EVERY curr_char
and distance_2D(curr_char:logical_position_x(), curr_char:logical_position_y(), x, y) < supply_values_table["radius_fleet"] *curr_char has to be inside "radius_fleet" = YES
and not SupplyNearEnemyFleet(curr_char:logical_position_x(), curr_char:logical_position_y(), supply_values_table["radius_enemy_fleet"], char_faction, EnemyFactionKeys)
then scripting.game_interface:apply_effect_bundle_to_characters_force("Fleet_to_Army_Supply", army,-1);
end
end
end
this sounds weird to me
local army = curr_char:cqi() = so a character from a list
and curr_char:cqi() ~= context:character():cqi() = but here they should be different
then scripting.game_interface:apply_effect_bundle_to_characters_force("Fleet_to_Army_Supply", army,-1); = and here you put the effect to all the characters in the list but not the context one