designate entry point only for reinforcements, different from the beginning.

Users who are viewing this thread

hello everyone, this is for a naval battle.
At the beginning, there are 2 ships and where the soldiers of both teams spawn and the ships that sail to a central point.
I am trying to activate reinforcements at an entry point different from the one at the beginning, so that those reinforcements always appear there (where the ships are), because at the beginning they are no longer there and the soldiers drown, that is the reason for the change.
In other words, I want reinforcements to arrive from a specific place every time both teams have less than 8 soldiers.
I have tried to occupy some siege triggers, but they don't work quite right. The first wave of reinforcements appears fine, but then they appear at the beginning, also the reinforcements of the other team (attackers) do not arrive.
Any help is welcome, thank you.
these are the triggers i'm testing...
Code:
common_ship_battle_defender_reinforcement_check = (
  0, 0, 0, [],#3,0,5
  [
   (lt, "$defender_reinforcement_stage", 0),
   (store_mission_timer_a,":mission_time"),
   (ge,":mission_time",10),
   (store_normalized_team_count,":num_defenders",0),
   (lt,":num_defenders",8),
   (add_reinforcements_to_entry,17, 10),
   (val_add,"$defender_reinforcement_stage",1),
   ])

common_ship_battle_attacker_reinforcement_check = (
  0, 0, 0, [],#1,0,5
  [
    (lt,"$attacker_reinforcement_stage",0),
    (store_mission_timer_a,":mission_time"),
    (ge,":mission_time",10),
    (store_normalized_team_count,":num_attackers",1),
    (lt,":num_attackers",8),
    (add_reinforcements_to_entry, 16, 10),
    (val_add,"$attacker_reinforcement_stage", 1),
    ])
 
Solution
You can add some messages to display variable values between the lines.
Code:
common_ship_battle_attacker_reinforcement_check = (
  1, 0, 5, [],#1,0,5
  [
    (assign, reg0, "$attacker_reinforcement_stage"),
    (display_message, "@Attackers reinforcement stage: {reg0}"),
    (lt,"$attacker_reinforcement_stage",2),
    (store_mission_timer_a,":mission_time"),
    (assign, reg0, ":mission_time"),
    (display_message, "@Mission time: {reg0}"),
    (ge,":mission_time",20),
    (store_normalized_team_count,":num_attackers",1),
    (assign, reg0, ":num_attackers"),
    (display_message, "@Number of attackers: {reg0}"),
    (lt,":num_attackers",9),
    (add_reinforcements_to_entry, 16, 8),
    (val_add,"$attacker_reinforcement_stage", 1)...
Perhaps mark the ship scene props in a way that the reinforment waves spawn at their original entry point but get teleported immediately to the ship scene prop.
but there are several problems ...
1- reinforcements are generated in the first wave, at the correct entry point, then they are generated at the beginning (water at the beginning of the navigation)
2- reinforcements for attackers are not generated
3- After the reinforcements are generated on the ship, every 10 seconds they are generated at the beginning, completing the total number of troops that the defenders have. :razz:
 
Upvote 0
There is a problem ... the position of the entry point 21, it is right at the water level, there the boat does not have a collision, it only has on the surface that they are at least 4 meters higher ...
Also, no reinforcements arrive to the attackers, why does that happen, if they have the same trigger?
 
Upvote 0
I modified the code a little, I also added part of the code that @Dalion gave me (in the navigation code of the ships), I also modified the scenes (7 scenes) in all I left a static ship and 2 that sail (so I put the entry point of reinforcements 15 in the static boat, in addition to 16 and 17 of only reinforcements).
Well, with these changes, the reinforcements arrive at those entry points, but sometimes the waves are very close and can reach up to 40 reinforcements in less than 1 minute (they are supposed to be scheduled to arrive every time there are less than 9 left) , but the worst thing is that no reinforcements reach the attackers, anywhere, not at the beginning of the navigation, not under the sea, or on the ship at its final point ..... so the battle is always victory for defenders.
What would be missing for reinforcements of attackers to arrive?
ship movement and entry point handover
Code:
(0, 0, ti_once,
    [
    (entry_point_get_position, pos21, 21),
    (scene_prop_get_instance,":prop","$g_mi_barco", 0),
    (prop_instance_get_starting_position, pos1, ":prop"),
    (scene_prop_get_instance,":prop","$g_mi_barco", 0),
    (prop_instance_get_position, pos1, ":prop"),
    (get_distance_between_positions, ":dist_falcon", pos1, pos21),
    (store_div,":falcon_hiz",":dist_falcon",3),
    (prop_instance_animate_to_position, ":prop", pos21, ":falcon_hiz"),
    (try_for_range, ":entry1", 3, 16), #Dalion
    (entry_point_get_position, pos16, 16),
       (entry_point_set_position, ":entry1", pos16),
    (try_end),
  
(entry_point_get_position, pos22, 22),
    (scene_prop_get_instance,":prop2","$g_barco2", 0),
    (prop_instance_get_starting_position, pos2, ":prop2"),
    (scene_prop_get_instance,":prop2","$g_barco2", 0),
    (prop_instance_get_position, pos2, ":prop2"),
    (get_distance_between_positions, ":dist_falcon2", pos2, pos22),
    (store_div,":falcon2_hiz",":dist_falcon2",3),
    (prop_instance_animate_to_position, ":prop2", pos22, ":falcon2_hiz"),
    (try_for_range, ":entry2", 15, 17), # replace 15 and 18 with the problematic ones
    (entry_point_get_position, pos17, 17),
       (entry_point_set_position, ":entry2", pos17),
    (try_end),



Code:
common_ship_battle_defender_reinforcement_check = (
  3, 0, 5, [],#3,0,5
  [
   (lt, "$defender_reinforcement_stage", 2),
   (store_mission_timer_a,":mission_time"),
   (ge,":mission_time",20),
   (store_normalized_team_count,":num_defenders",0),
   (lt,":num_defenders",9),
   (add_reinforcements_to_entry,17, 8),
   (val_add,"$defender_reinforcement_stage",1),
   ])

common_ship_battle_attacker_reinforcement_check = (
  1, 0, 5, [],#1,0,5
  [
    (lt,"$attacker_reinforcement_stage",2),
    (store_mission_timer_a,":mission_time"),
    (ge,":mission_time",20),
    (store_normalized_team_count,":num_attackers",1),
    (lt,":num_attackers",9),
    (add_reinforcements_to_entry, 16, 8),
    (val_add,"$attacker_reinforcement_stage", 1),
    ])
 
Upvote 0
common_ship_battle_attacker_reinforcement_check = (
1, 0, 5, [],#1,0,5
[
(lt,"$attacker_reinforcement_stage",2),
(store_mission_timer_a,":mission_time"),
(ge,":mission_time",20),
(store_normalized_team_count,":num_attackers",1),
(lt,":num_attackers",9),
(add_reinforcements_to_entry, 16, 8 ),
(val_add,"$attacker_reinforcement_stage", 1),
])
'attacker_reinforcement_stage' is a global variable. You should reset it to zero at the initialization of the scenes including battles as you can see in this code.
Code:
common_siege_init = (
  0, 0, ti_once, [],
  [
    (assign,"$g_battle_won",0),
    (assign,"$defender_reinforcement_stage",0),
    (assign,"$attacker_reinforcement_stage",0),
    (call_script, "script_music_set_situation_with_culture", mtf_sit_siege),
    ])
You may have forgotten to reset that variable and also some other global variables for those scenes. You can test it by adding something like this to the mission template triggers.
Code:
(0, 0, ti_once, [], [(assign,"$attacker_reinforcement_stage",0),])
 
Upvote 0
'attacker_reinforcement_stage' is a global variable. You should reset it to zero at the initialization of the scenes including battles as you can see in this code.
Code:
common_siege_init = (
  0, 0, ti_once, [],
  [
    (assign,"$g_battle_won",0),
    (assign,"$defender_reinforcement_stage",0),
    (assign,"$attacker_reinforcement_stage",0),
    (call_script, "script_music_set_situation_with_culture", mtf_sit_siege),
    ])
You may have forgotten to reset that variable and also some other global variables for those scenes. You can test it by adding something like this to the mission template triggers.
Code:
(0, 0, ti_once, [], [(assign,"$attacker_reinforcement_stage",0),])
I already had it on the mission ;(
Code:
(0, 0, ti_once, [], [(assign,"$g_battle_won",0),
                     (assign,"$defender_reinforcement_stage",0),
                     (assign,"$attacker_reinforcement_stage",0),
                     (call_script, "script_place_player_banner_near_inventory"),
                     (call_script, "script_combat_music_set_situation_with_culture"),
                     ]),

      common_ship_battle_attacker_reinforcement_check,
      common_ship_battle_defender_reinforcement_check,
 
Upvote 0
Paste the code of the entry points at the beginning of the mission template.

If you made 0 units spawn at the beginning then you should count agents of each team instead of using black box operand store_normilized_team_count wich depends on agents spawned by mission template head entry points code.
 
Last edited:
Upvote 0
You can add some messages to display variable values between the lines.
Code:
common_ship_battle_attacker_reinforcement_check = (
  1, 0, 5, [],#1,0,5
  [
    (assign, reg0, "$attacker_reinforcement_stage"),
    (display_message, "@Attackers reinforcement stage: {reg0}"),
    (lt,"$attacker_reinforcement_stage",2),
    (store_mission_timer_a,":mission_time"),
    (assign, reg0, ":mission_time"),
    (display_message, "@Mission time: {reg0}"),
    (ge,":mission_time",20),
    (store_normalized_team_count,":num_attackers",1),
    (assign, reg0, ":num_attackers"),
    (display_message, "@Number of attackers: {reg0}"),
    (lt,":num_attackers",9),
    (add_reinforcements_to_entry, 16, 8),
    (val_add,"$attacker_reinforcement_stage", 1),
    ])
It can help you to pinpoint the issue, especially what @Vetrogor pointed out.
 
Upvote 0
Solution
according to the messages, they tell me the following:
- the battle begins with 32 soldiers per team.
- I am an attacker because I use the ship that has the entry points from 0 to 7
- Once in the center of the map, I send my soldiers to attack without weapons (so that they die quickly and demonstrate what I had already thought).
- in short, the code when there are less than 9 attackers or defenders left, the code sends reinforcements to the defenders only.
photo1 beginning of the battle
mi9kw0wc1ressa66g.jpg

photo2 end of the battle
bbjbxco50cofi6f6g.jpg

photo3 log
j3zsygwna40x3uu6g.jpg
 
Last edited:
Upvote 0
Back
Top Bottom