Jump to content
Twiznak

[Solved] setPos on SectorModule_F & spawned units not moving towards new position.

Recommended Posts

Hi everyone! I am making a dynamic AI vs AI king of the hill mission and I can't get the AI to capture the sector after it has been moved with setPos. I have programmed parameters to choose the size and location of the target area "sectorModule_F (TA_1)" . Everything is working as intended , script side. However, the spawned groups from the spawn AI modules don't move towards TA_1's new pos. They instead move towards TA_1's original editor placed position. I use setPos and setVariable "pos" to change TA_1's location. this is what I add to the sector modules init filed.

Spoiler

zoneSize = "TAsize_1" call BIS_fnc_getParamValue; 
this setVariable ["objectarea", [zoneSize,zoneSize,0,false,0],true]; 
sectorLoc = "TAlocation_1" call BIS_fnc_getParamValue;   
switch (sectorLoc) do  
{ 
case 1:{Npos = getMarkerPos "site_1"; this setPos Npos;this setVariable ["pos", Npos,true];}; 
case 2:{Npos = getMarkerPos "site_2"; this setPos Npos;this setVariable ["pos", Npos,true];}; 
case 3:{Npos = getMarkerPos "site_3"; this setPos Npos;this setVariable ["pos", Npos,true];};   
};  

 

This changes the zone size and location to one of 3 test positions. These test positions are logic markers placed in the editor. The zone changes size and location as intended. Players can cap the zone as normal.

 

I need help with understanding the init order of the modules. It seems to me that the sectors location data is stored as a variable in one or more of the 4 sector control modules, as the mission initializes. However, I can't identify the specific variable outside the sectorModule_F that stores the area position so that I can change it with setVariable and make the spawned AI move towards the new sector Pos. Please help me. 

 

I used "allVariables" command on the 4 module types that are present in the editor:

ModuleMPTypeSectorControl_F,

Spoiler

["bis_fnc_moduleexecute_activate","bis_fnc_moduleinit_iscuratorplaced","bis_fnc_moduleinit_status","bis_fnc_initmodules_activate","bis_fnc_initmodules_priroty","sides"]

 

SectorModule_F,

Spoiler

["taskowner","costwheeled","pos","bis_fnc_moduleexecute_activate","finalized","tasks","onownerchange","designation","costair","costwater","bis_fnc_moduleinit_iscuratorplaced","position","step","bis_fnc_moduleinit_status","defaultowner","ownerlimit","bis_fnc_initmodules_activate","owner","bis_fnc_initmodules_priroty","costtracked","sidescore","objectarea","costplayers","contested","areas","flags","area","scorereward","name","costinfantry","taskdescription","#var","triggers","sides","tasktitle","bis_fnc_addscriptedeventhandler_ownerchanged"]

 

ModuleSpawnAI_F, &

Spoiler

["infantry","sectorsand","groupsblu_f_motorized","b_g_soldier_lat_f","b_g_soldier_tl_f","b_g_soldier_a_f","b_t_soldier_lat_f","groupsblu_t_f_infantry","b_ctrg_soldier_tna_f","o_soldier_tl_f","o_medic_f","o_t_soldier_aaa_f","o_t_sniper_f","mechanized","bis_fnc_moduleexecute_activate","b_soldier_ar_f","b_recon_tl_f","groupsguerilla_mechanized","b_t_recon_jtac_f","groupsblu_t_f_motorized","groupsblu_ctrg_f_mechanized","b_w_soldier_lat_f","b_w_soldier_gl_f","b_w_soldier_at_f","o_heavygunner_f","o_t_soldier_ar_f","b_soldier_aaa_f","b_heavygunner_f","b_g_medic_f","b_t_soldier_a_f","b_t_soldier_lat2_f","o_soldier_aaa_f","o_recon_m_f","o_pathfinder_f","o_soldieru_gl_f","o_t_soldier_a_f","o_t_recon_f","bis_fnc_moduleinit_iscuratorplaced","usesectortactic","b_soldier_f","b_soldier_a_f","b_g_soldier_sl_f","b_g_soldier_m_f","b_t_soldier_aaa_f","b_gen_soldier_f","groupsgendarmerie_motorized","b_w_medic_f","groupsblu_w_f_infantry","o_soldier_sl_f","o_soldier_aa_f","o_t_soldier_hat_f","o_g_soldier_m_f","groups","b_soldier_gl_f","b_soldier_at_f","groupsblu_f_armored","b_t_soldier_f","b_t_sniper_f","groupsgendarmerie_infantry","b_w_soldier_aaa_f","o_sniper_f","o_t_medic_f","o_t_soldier_gl_f","o_t_soldier_at_f","bis_fnc_moduleinit_status","b_soldier_aar_f","b_t_soldier_m_f","b_t_soldier_tl_f","b_ctrg_soldier_m_tna_f","groupsblu_ctrg_f_infantry","b_w_soldier_f","o_soldier_a_f","o_soldier_aar_f","o_soldier_hat_f","o_soldieru_f","o_t_soldier_m_f","o_t_recon_medic_f","o_g_soldier_lat2_f","o_g_soldier_tl_f","expression","spawnrate","vehiclesingroup","bis_fnc_initmodules_activate","b_soldier_m_f","b_recon_m_f","b_soldier_lat2_f","b_g_soldier_ar_f","b_t_recon_tl_f","b_t_recon_f","groupsblu_t_f_mechanized","b_gen_commander_f","groupsgendarmerie_mechanized","groupsblu_w_f_motorized","o_soldier_ar_f","o_recon_medic_f","o_spotter_f","o_soldieru_a_f","o_t_soldier_f","o_t_soldier_aat_f","manpowercap","faction","bis_fnc_initmodules_priroty","activated","sectorsor","b_recon_medic_f","b_recon_jtac_f","b_recon_f","b_recon_sharpshooter_f","groupsguerilla_armored","b_t_recon_m_f","b_t_recon_medic_f","b_t_recon_lat_f","b_ctrg_soldier_jtac_tna_f","b_ctrg_soldier_lat2_tna_f","b_w_soldier_tl_f","b_w_soldier_a_f","o_t_recon_lat_f","o_t_recon_jtac_f","infantryingroup","b_soldier_aat_f","b_sharpshooter_f","b_g_soldier_f","b_t_soldier_sl_f","b_t_medic_f","b_t_soldier_aa_f","groupsblu_t_f_armored","groupsblu_w_f_mechanized","o_soldier_m_f","o_soldier_aat_f","o_soldieru_tl_f","o_g_soldier_sl_f","motorized","b_medic_f","b_recon_lat_f","b_g_soldier_gl_f","b_t_soldier_aat_f","b_ctrg_soldier_medic_tna_f","groupsblu_w_f_armored","o_soldier_gl_f","o_soldier_at_f","o_soldieru_m_f","o_t_recon_m_f","armored","initialized","spawnpoints","b_soldier_tl_f","b_spotter_f","groupsblu_f_infantry","b_t_recon_exp_f","b_ctrg_soldier_exp_tna_f","groupsgendarmerie_armored","b_w_soldier_sl_f","b_w_soldier_m_f","b_w_soldier_aat_f","b_w_soldier_aa_f","o_recon_lat_f","o_t_soldier_tl_f","o_t_recon_exp_f","o_g_soldier_f","side","groupsblu_f_mechanized","b_g_soldier_lat2_f","groupsguerilla_infantry","b_t_soldier_ar_f","b_t_spotter_f","b_ctrg_soldier_ar_tna_f","groupsblu_ctrg_f_motorized","o_recon_tl_f","o_soldieru_sl_f","o_soldieru_lat_f","o_soldieru_medic_f","o_t_recon_tl_f","o_t_soldier_ahat_f","o_g_soldier_ar_f","blacklistedgroups","b_recon_exp_f","groupsguerilla_motorized","b_ctrg_soldier_lat_tna_f","o_recon_jtac_f","o_soldier_ahat_f","o_t_soldier_lat_f","b_soldier_sl_f","b_soldier_aa_f","b_g_sharpshooter_f","b_ctrg_soldier_tl_tna_f","groupsblu_ctrg_f_armored","b_w_soldier_ar_f","o_recon_exp_f","o_recon_f","o_sharpshooter_f","o_t_soldier_sl_f","o_t_soldier_aa_f","o_t_spotter_f","o_g_medic_f","b_soldier_lat_f","b_sniper_f","b_t_soldier_gl_f","b_t_soldier_at_f","o_soldier_f","o_soldier_lat_f","o_soldieru_ar_f","o_g_soldier_gl_f"]

 

ModuleSpawnAISectorTactic_F. 

Spoiler

["bis_fnc_moduleexecute_activate","bis_fnc_moduleinit_iscuratorplaced","bis_fnc_moduleinit_status","bis_fnc_initmodules_activate","bis_fnc_initmodules_priroty"]

 

 Please, If anyone who is familiar with these modules and their variables could give me some advice and maybe even a solution I would really appreciate it. Thank you.

Share this post


Link to post
Share on other sites

Once you move the sector update the variable 'position' stored on it with its new position.

_area = [_sector, "LocationArea_F", true] call bis_fnc_synchronizedObjects;
_sector setVariable ["position",getPos _area];

This is the variable used ('position') by spawnAISectorTatic FSM to send groups to the sectors position.

  • Thanks 1

Share this post


Link to post
Share on other sites
31 minutes ago, Larrow said:

Once you move the sector update the variable 'position' stored on it with its new position.


_area = [_sector, "LocationArea_F", true] call bis_fnc_synchronizedObjects;
_sector setVariable ["position",getPos _area];

This is the variable used ('position') by spawnAISectorTatic FSM to send groups to the sectors position.

Larrow, you are my hero! You have solved my problem. The answer was to move LocationArea_F along with the sector and then use the LocationArea_F's position in the updated sector variable of "Position".  Larrow,  your tutelage has given wheels to my imagination and It has taken me to places I never thought I could go. For this I am forever grateful. Thank you sir!

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×