Search the Community
Showing results for tags 'game ai'.
Found 1 result
-
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.