Jump to content

rikkles

Members
  • Posts

    61
  • Joined

  • Last visited

Everything posted by rikkles

  1. Thanks Grimes, I ended up counting the shot events for the group. However one really weird thing I found was that when the paladins stop firing and end the task, they revert to the waypoint tasks from the ME, starting at WP 0. Maybe it's because I created the Fire at Point task in a script, with pushTask(). The only way I found to get the paladins to finish firing, stay in position and await new orders is to turn off the controller at the end of the fire task, and turn it back on when I push a new task on the stack later.
  2. Thanks for the idea to count the shots or ammo. The problem I had with the mission tasks is that there is no script task, only a script command, and script commands are executed instantly (from what I can tell). I would have easily solved the problem with a script task that would be pushed onto the stack and executed serially after the fireAtPoint command.
  3. Revisiting the above. One kludgey solution I found is to add another movement task after the fire at point task, which then triggers a zone flag. But that's really ugly.
  4. When you write: BDA = {[unitTypeName]=1} you replace the whole BDA with a table with a single entry. What you want is: BDA[unitTypeName] = 1
  5. Why don't you use coalition.addGroup() ?
  6. The next problem is integrating multiple large scripts like these, and making sure they're optimized. They all poll for stuff, and you can quickly overwhelm your cpu if you're not careful. At least that's what I saw. (speaking as an ancient programmer)
  7. There are a number of ways to go about this, with some tasks easier one way or another. Kind of like if you have a geometry problem, and it can be trivial if you use angles in classical geometry, or inversely much simpler if you solve equations analytically. The two main techniques are: 1- Trigger-based actions 2- Event loop (technically (1) might use an event loop, but it would be an internal DCS one that we don't have access to) TRIGGER-BASED ACTIONS Those are easily done via the Mission Editor, as you said. The standard techniques are: A- Zone-based triggers and other stuff that you set up in the trigger menu B- Anything in a group's advanced waypoint conditions This includes dealing with flags, which you set somewhere and use as trigger conditions somewhere else. It also works very well when you want to get a group to do something at or after a certain time, or when it enters/exits a zone. EVENT LOOP This is the more "advanced" technique, which is closer to the analytical geometry thing. Here you say "well I can run scripts, why don't I make an event loop in my script and check every x seconds what's going on? I can then precisely do things with my own variables, etc..." An event loop generally functions better when you want to use a custom F10 menu since generally you'll have one in your code anyway: you constantly need to update the F10 menu to make it contextual to the situation you're in. In your specific case, you need a detailed contextual F10 menu, coupled with precise knowledge of what's going on. So I suggest going the event loop route. Every time you hit the F10 menu item, it triggers a specific function. That function can respond based in random or deterministic fashion, and set a condition for future success (you can use flags and/or lua variables for that). Say for example you hit F10 to land. The requestLanding() function chooses between 50% full stop and 50% go landing. If it selects full stop, it will message you and then schedule a 1-second timer on a function that checks your helicopter speed and ground altitude. That function will succeed if you are at 0/0 for say 3 seconds, and fail if you exceed 120 seconds from calling the function. Anyway, it's basic event management in code, and you just have to figure out within the DCS api what info you need to monitor to succeed/fail in the tasks that you want. Finally, you can mix and match both techniques by using flags. In your code you use: trigger.action.setUserFlag(200, 3) -- this sets flag 200 to value 3 trigger.misc.getUserFlag(200) -- this returns 3 As long as you use flags with numbers, you can use them also in the Mission Editor.
  8. Did you put in waypoints? If you make a patrol route, then duplicate it about 10nm behind for the second group, it doesn't work?
  9. I just looked at your script. It uses a simple Land task. I tried a new mission where a group of 3 helos take off, go through a couple of waypoints and the last waypoint has a Land task. They land in formation, without a problem. The mission file has the following task: So I really don't understand where the problem would be.
  10. I do even worse. I delete the DO SCRIPT FILE and recreate the whole line. Also sometimes if by mistake you create a DO SCRIPT FILE and choose a script that you already load (say mist), then switch to the correct script, when running the mission the other script (mist in that case) won't load. You have to refresh it as well.
  11. Hello, I'm having trouble determining when a "fire at point" task is finished. There's no way to set a flag at the conclusion of a task, and if I do a hasTask() it always returns TRUE even before firing (maybe because the unit had moved through waypoints before the firing task). If I could see the list of active tasks for a group controller it would work, but I don't know if we have access to that table. The docs certainly don't show an API for that. Thanks!
×
×
  • Create New...