Results 1 to 9 of 9

Thread: Scripting help

  1. #1
    Student Pilot
    Join Date
    Jul 2017
    Posts
    7
    Post Thanks / Like
    Total Downloaded
    443.01 MB

    Scripting help

    Trying to learn scripting, is this the right place to ask for scripting help.


    redpilot007

  2. #2
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    893
    Post Thanks / Like
    Total Downloaded
    895.44 MB

    Re: Scripting help

    Ask away.

  3. #3
    Student Pilot
    Join Date
    Jul 2017
    Posts
    7
    Post Thanks / Like
    Total Downloaded
    443.01 MB

    Re: Scripting help

    Quote Originally Posted by redpilot007 View Post
    Trying to learn scripting, is this the right place to ask for scripting help.


    redpilot007

    I want an AI plane to change course, that is overall purpose. But problem is identifying the A.I. plane. It is not finding it in my script so not using the correct identifier. (is it the name?)
    I think it worked once, but not reliably.

    Also, not sure if the setting of new waypoints is functional.
    Anyway, I attached what I have done.

    Thanks for attention.

    redpilot007
    Attached Files Attached Files

  4. #4
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    893
    Post Thanks / Like
    Total Downloaded
    895.44 MB

    Re: Scripting help

    Some thing like this.

    Code:
            int ARMY = 2;
            string groupName = "BoB_LW_JG51_II";
    
            AiAirGroup[] aig = GamePlay.gpAirGroups(ARMY);
            foreach (AiAirGroup ag in aig)
            {
                if (ag.Name().Contains(groupName))
                {
                    return ag;
                }
            }
            return null;

  5. #5
    Student Pilot
    Join Date
    Jul 2017
    Posts
    7
    Post Thanks / Like
    Total Downloaded
    443.01 MB

    Re: Scripting help

    Quote Originally Posted by ATAG_Oskar View Post
    Some thing like this.

    Code:
            int ARMY = 2;
            string groupName = "BoB_LW_JG51_II";
    
            AiAirGroup[] aig = GamePlay.gpAirGroups(ARMY);
            foreach (AiAirGroup ag in aig)
            {
                if (ag.Name().Contains(groupName))
                {
                    return ag;
                }
            }
            return null;

    Thanks, that part works.
    Maybe wrong but I dont think you can enter waypoints by script/hand, so overall wont work.

  6. #6
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    893
    Post Thanks / Like
    Total Downloaded
    895.44 MB

    Re: Scripting help

    Quote Originally Posted by redpilot007 View Post
    I dont think you can enter waypoints by script
    That should work. I've written code to control movement of formations of ground units and to designate targets for AI air support.

  7. #7
    Student Pilot
    Join Date
    Jul 2017
    Posts
    7
    Post Thanks / Like
    Total Downloaded
    443.01 MB

    Re: Scripting help

    Quote Originally Posted by ATAG_Oskar View Post
    That should work. I've written code to control movement of formations of ground units and to designate targets for AI air support.



    Are you referring to what I have done? Because I cant get further on (no debug messages) and the plane does not change course.
    What values should you be using for Point3d? I used the mouse cursor , so am unsure that is the correct way.

    If I could see your script, that would be good.

  8. #8
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    893
    Post Thanks / Like
    Total Downloaded
    895.44 MB

    Re: Scripting help

    Are you comfortable with multi-threaded code?

    Do you have a good development environment?

    You need to start by getting a path parameters object. Here's how it looks for ground units.

    Code:
    IRecalcPathParams pathParams = GamePlay.gpFindPath(start, 10.0, targetPoint, 20.0, PathType.GROUND, ARMY_AXIS);
    Then you need to check for completion.

    Code:
    	if (pathParams.State == RecalcPathState.SUCCESS) {
    		groundGroup.SetWay(pathParams.Path);
           }

  9. #9
    Student Pilot
    Join Date
    Jul 2017
    Posts
    7
    Post Thanks / Like
    Total Downloaded
    443.01 MB

    Re: Scripting help

    Quote Originally Posted by ATAG_Oskar View Post
    Are you comfortable with multi-threaded code?

    Do you have a good development environment?

    You need to start by getting a path parameters object. Here's how it looks for ground units.

    Code:
    IRecalcPathParams pathParams = GamePlay.gpFindPath(start, 10.0, targetPoint, 20.0, PathType.GROUND, ARMY_AXIS);
    Then you need to check for completion.

    Code:
    	if (pathParams.State == RecalcPathState.SUCCESS) {
    		groundGroup.SetWay(pathParams.Path);
           }
    I made the changes with the code you gave, to be sure: start , targetPoint are x, y values from mouse cursor, 10,20 are z height.
    It passed debug, so good so far, but still no change of course.

    I didn't attempt to multi thread, I know little about it, but works without it?

    I use Visual Studio Express

    Thanks anyway

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •