ffredyk 49 Posted June 18, 2018 Hello, I am modifying curator interface, and I've run into a problem with AI following waypoints. The curator interface has only friendly units editable. Enemy units are rendered through my script separatedly so they can't be manipulated. To reinvent the functionality of "right-pressing" the enemy units with mouse to attack them, I am using CuratorWaypointPlaced event handler. I tried to modify waypoint passed from event handler, I tried to create new one and set it to waypointType "DESTROY" and delete the passed one. And I tried to set the one event handler gave me. AI just refuses to behave correctly as in vanilla zeus interface What am I trying to do: - Recreate the RMB behaviour in curator interface - Make AI move to and attack units at "DESTROY" waypoint What is actually happening: [when waypoint is attached to enemy] AI just stands on place nothing is happening, except the AI seems to guard more the direction to it's waypoint attached waypoints are offset to units they are attached to even several meters. (the position is different) sometimes attachWaypointVehicle attaches waypoint to nearby objects instead to enemy unit (but waypointAttachedVehicle still returns enemy unit) [when waypoint is spatial on ground] AI moves to position, sometimes attacking the enemy usually doing weird sh** on the way. when friendly units are too close to waypoint, unit may start killing nearby friendly units (nearby to waypoint) instead of enemy sometimes the waypoint survives for about 5 seconds before disappearing (maybe false completion?) when forced waypoint position by setWaypointPosition to position identical to enemy unit, sometimes the waypoint refuses and jumps to a nearby position What vanilla zeus does when creating a waypoint: Type: "DESTROY" Behaviour: "COMBAT" Position: under interface cursor it doesn't attach the waypoint to units, only sets position, type and behaviour. When I do the exact same, my AI's refuses to work properly (identical to vanilla zeus) //Event Hadler: When zeus places a waypoint (context: added when pressed RMB while hovering over an enemy unit - attack order) eh_waypointModifier = zeusModule addEventHandler ["CuratorWaypointPlaced", { params ["","_group","_waypointID"]; //Waypoint created by curator interface _wp = [_group,_waypointID]; //Waypoint array _group reveal cw_var_unitToAttack; //Revealing the enemy to ordered group (not helping) _wp setWaypointType "DESTROY"; //Sets the waypoint as "DESTROY" so AI would know it is going to attack something (Curator interface does the same) //AI usually moves towards the target, sometimes it does nothing. But it won't attack the enemy. //** Method 1 ** _wp setWaypointBehaviour "COMBAT"; //Makes the AI move towards the waypoint more reliably (Curator interface does the same) //AI moves towards the target tacticaly, it sometimes even engages against the enemy. //** Method 2 ** _wp setWaypointPosition [(position cw_var_unitToAttack),0]; //Sets the position of the waypoint so spatial DESTROY can find it's actual target more easily - does quite the opposite //AI usually stays on position //** Method 3 ** //Variable 'sys_unitToAttack' set by logic calling this EH _wp waypointAttachVehicle sys_unitToAttack; //Attaches the waypoint to the enemy unit - actually attaches the waypoint several meters away from unit, sometimes to different object (waypointAttachedVehicle still returns sys_unitToAttack) //AI usually moves towards the target, but won't attack //** Method 4 ** deleteWaypoint _wp; //Removes the waypoint created by curator interface _wp = _group addWaypoint [position sys_unitToAttack, 0]; //Creates a whole new waypoint on enemy's position _group setCurrentWaypoint _wp; //Sets the new waypoint as current so AI can't be confused which waypoint to use //AI just stands on place doing nothing. zeusModule removeEventHandler ["CuratorWaypointPlaced",eh_waypointModifier]; //Not needed anymore sys_unitToAttack = nil; //Not needed anymore }]; I've spend at least 7 hours figuring this nonsense out and trying several AI hacks. I want to have my scenario addon-free, just working with vanilla, so any mods are not usable to me. Only scripting hacks. This is not really a request for help. It is a request for someone from dev-team to give me some insight on how zeus waypoints works so I can successfuly and reliably replicate. Thx. Share this post Link to post Share on other sites
pierremgi 4817 Posted June 18, 2018 Without any code... 1 Share this post Link to post Share on other sites
Grumpy Old Man 3544 Posted June 18, 2018 3 minutes ago, pierremgi said: Without any code... No worries, he doesn't want help anyway: 5 hours ago, ffredyk said: This is not really a request for help. Cheers 2 Share this post Link to post Share on other sites
ffredyk 49 Posted June 18, 2018 Sorry, I had a snippet ready, but forgot to add it. //Event Hadler: When zeus places a waypoint (context: added when pressed RMB while hovering over an enemy unit - attack order) eh_waypointModifier = zeusModule addEventHandler ["CuratorWaypointPlaced", { params ["","_group","_waypointID"]; //Waypoint created by curator interface _wp = [_group,_waypointID]; //Waypoint array _group reveal cw_var_unitToAttack; //Revealing the enemy to ordered group (not helping) _wp setWaypointType "DESTROY"; //Sets the waypoint as "DESTROY" so AI would know it is going to attack something (Curator interface does the same) //AI usually moves towards the target, sometimes it does nothing. But it won't attack the enemy. //** Method 1 ** _wp setWaypointBehaviour "COMBAT"; //Makes the AI move towards the waypoint more reliably (Curator interface does the same) //AI moves towards the target tacticaly, it sometimes even engages against the enemy. //** Method 2 ** _wp setWaypointPosition [(position cw_var_unitToAttack),0]; //Sets the position of the waypoint so spatial DESTROY can find it's actual target more easily - does quite the opposite //AI usually stays on position //** Method 3 ** //Variable 'sys_unitToAttack' set by logic calling this EH _wp waypointAttachVehicle sys_unitToAttack; //Attaches the waypoint to the enemy unit - actually attaches the waypoint several meters away from unit, sometimes to different object (waypointAttachedVehicle still returns sys_unitToAttack) //AI usually moves towards the target, but won't attack //** Method 4 ** deleteWaypoint _wp; //Removes the waypoint created by curator interface _wp = _group addWaypoint [position sys_unitToAttack, 0]; //Creates a whole new waypoint on enemy's position _group setCurrentWaypoint _wp; //Sets the new waypoint as current so AI can't be confused which waypoint to use //AI just stands on place doing nothing. zeusModule removeEventHandler ["CuratorWaypointPlaced",eh_waypointModifier]; //Not needed anymore sys_unitToAttack = nil; //Not needed anymore }]; All units ordered by waypoints have YELLOW combat mode and NORMAL or FULL speed mode, they have all skills maxed out and their morale is disabled. Enemies are independent FIA units with normal skills, normal morale, only with stand pose set to CROUCH or STAND Share this post Link to post Share on other sites
pierremgi 4817 Posted June 18, 2018 Zeus or not, the "destroy" waypoint seems to be broken. Share this post Link to post Share on other sites
ffredyk 49 Posted June 20, 2018 That's it? Nothing can be done to make it work? Am I just supposed to release a bugged feature, without any possible solution left? Share this post Link to post Share on other sites
Harzach 2516 Posted June 20, 2018 On 6/18/2018 at 6:45 AM, ffredyk said: The curator interface has only friendly units editable. Enemy units are rendered through my script separatedly so they can't be manipulated. Why don't you give spawned AI to the curator? Share this post Link to post Share on other sites
Grumpy Old Man 3544 Posted June 20, 2018 2 minutes ago, Harzach said: Why don't you give spawned AI to the curator? Possible scenario could be blufor vs opfor curators, RTS style. Doubt a destroy waypoint would do what he wants anyway, since AI still pick their own targets, depending on incoming threat etc. Cheers 1 Share this post Link to post Share on other sites
Harzach 2516 Posted June 20, 2018 1 minute ago, Grumpy Old Man said: Possible scenario could be blufor vs opfor curators, RTS style. It doesn't sound like that's what he's doing, but fair point. Share this post Link to post Share on other sites
ffredyk 49 Posted June 20, 2018 I don't want the player to be able to control enemy units, and managing restrictions event based is not perfect (player is still able to manipulate AI waypoint etc.). So I just made them uneditable and rendered their icons the same way curator interface does. But when player wants to attack the enemy unit, he right-clicks it, assuming that it will work the same way as in vanilla zeus. Therefore I am trying to recreate it with DESTROY waypoints (my waypoints have exactly the same settings as the vanilla zeus ones) and AI still refuses to work as expected. So I am asking someone, who might know, how to set the DESTROY waypoints the best way, for them to work reliably. Simple said, just tell me how to create attacking waypoints for AIs that behave the same way as in zeus. Share this post Link to post Share on other sites