hamza_Khan Posted July 5 Posted July 5 I am trying to send group to a random waypoint after a certain amount of time based on random flag. i.e after every 2 minutes, generate a random flag value, then send the unit to said waypoint based on flag value, if there are 10 waypoints, flag value in generated between 1 and 10 i am using the following script local randPoint = trigger.misc.getUserFlag(1) local g = Group.getByName("Patrol-1") local c = g:getController() local goToWaypointTask = { ["id"] = 'goToWaypoint', ["params"] = { ["fromWaypointIndex"] = 0, ["goToWaypointIndex"] = randPoint, } } c:pushTask(goToWaypointTask) I get an error "unknown task goToWaypoint" what am i doing wring?
Grimes Posted Thursday at 11:00 PM Posted Thursday at 11:00 PM A "fun" aspect of AI tasking is that there are a number of ways to call a given task. Basically there are tasks, commands, and options. In this case it is a command. The last line needs to be: c:setCommand(goToWaypointTask) In order to use commands with setTask or pushTask you have to embed them into a wrappedAction task. If you wanted to create a whole new route with tasks at assorted waypoints like you would in the mission editor, then you'd have to use a mission task, which has a combo task, which has each task, wrapped action, or controlled action within. Hence the fun. If you are just calling the single task then setCommand is what you are looking for. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
hamza_Khan Posted Sunday at 12:09 PM Author Posted Sunday at 12:09 PM (edited) On 7/11/2025 at 4:00 AM, Grimes said: A "fun" aspect of AI tasking is that there are a number of ways to call a given task. Basically there are tasks, commands, and options. In this case it is a command. The last line needs to be: c:setCommand(goToWaypointTask) In order to use commands with setTask or pushTask you have to embed them into a wrappedAction task. If you wanted to create a whole new route with tasks at assorted waypoints like you would in the mission editor, then you'd have to use a mission task, which has a combo task, which has each task, wrapped action, or controlled action within. Hence the fun. If you are just calling the single task then setCommand is what you are looking for. i tried setCommand with Id set as SwitchWaypoint. i don't get any errors but the group doesn't react at all, it keeps following waypoint in sequence form mission editor. i am attching the miz, please take a look whenever you have time WaypointChange.miz Edited Sunday at 12:09 PM by hamza_Khan
Recommended Posts