Results 1 to 4 of 4

Thread: Check vehicle vleocity

  1. #1

    Here's the deal - 4 Abrams (m1a1a - m1a1d) have completed a seek and destory objective and are awaiting support. Support should not approach tanks until they are stationary as they have to move on to another waypoint before being repaired by the support vehicle (reptruck).

    The code is:
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#wtforstop
    ?velocity m1a1a=&#91;0,0,0&#93;&#58;goto &#34;checka&#34;
    goto &#34;wtforstop&#34;

    #checka
    reptruck domove getpos m1a1a
    #chka
    ?damage &#40;m1a1a&#41;==0&#58;goto &#34;checkb&#34;
    goto &#34;chka&#34;
    #checkb
    reptruck domove getpos m1a1b
    #chkb
    ?damage &#40;m1a1b&#41;==0&#58;goto &#34;checkc&#34;
    goto &#34;chkb&#34;
    #checkc
    reptruck domove getpos m1a1c
    #chkc
    ?damage &#40;m1a1c&#41;==0&#58;goto &#34;checkd&#34;
    goto &#34;chkc&#34;
    #checkd
    reptruck domove getpos m1a1d
    #chkd
    ?damage &#40;m1a1d&#41;=0&#58;goto &#34;repaired&#34;
    goto &#34;chkd&#34;

    #repaired[/QUOTE]

    I keep getting told that there is an unknown operator (seems to indicate the "=". When I try a logical "==" it complains that I&#39;m using an array where I should be using number, object, string.
    How do I check that the tank m1a1a has come to a halt before I let the repair truck move in?

  2. #2
    Sergeant Major
    Join Date
    Feb 15 2002
    Location
    Wales in the U.K
    Posts
    1,538
    You can use the &#39;speed&#39; command instead of setvelocity to check if the vehicle has haulted or not. For example:
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?speed M1A1A ==0&#58;goto &#34;checka&#34;[/QUOTE]

    hope that helps.
    Twighlight island http://operationflashpoint.filefront.com/file/;41660
    Guerilla Tatics&#33; Large 8 player DYNAMIC coop.
    http://www.tacticalblunder.com/~upload....bel.pbo
    Bio Hazard - Apocaylpse, single playe dynamic zombie mission. Command the special Z-com unit and defend the inhabitance of malden from the hordes&#33;
    http://www.flashpoint1985.com/cgi-bin....73;st=0
    Fallout RPG&#33;
    http://www.flashpoint1985.com/cgi-bin....t=46625

    The &#163;1 blog&#33;
    http://the1poundblog.wordpress.com/

  3. #3
    Private First Class
    Join Date
    Nov 20 2004
    Posts
    29
    Author of the Thread
    Aha&#33; Thanks for that - sorted the problem nicely.

  4. #4
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#wtforstop
    ?velocity m1a1a=&#91;0,0,0&#93;&#58;goto &#34;checka&#34;
    goto &#34;wtforstop&#34;[/QUOTE]

    There&#39;s "=" instead of "==". I think it&#39;d be better to check multiple times if the tank&#39;s stopped, so it doesn&#39;t activate early because of some random stop. Like this for example so it waits for the tank to be stationary for 3 seconds:
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    #wtforstop
    ?speed M1A1A &#62; 0&#58; goto &#34;wtforstop&#34;;
    ~1
    ?speed M1A1A &#62; 0&#58; goto &#34;wtforstop&#34;;
    ~1
    ?speed M1A1A &#62; 0&#58; goto &#34;wtforstop&#34;;
    ~1
    ?speed M1A1A == 0&#58; goto &#34;checka&#34;;
    goto &#34;wtforstop&#34;;
    [/QUOTE]

    Would also make it a little lighter because it doesn&#39;t try to execute as fast as possible.

    ...

    Ops, you already knew that = thingy. I think it should be done like this with arrays:
    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
    ?velocity m1a1a select 0 == 0 && velocity m1a1a select 1 == 0 && velocity m1a1a select 2 == 0 &#58; goto &#34;checka&#34;;
    [/QUOTE]

    The select parameter is used to get a single element from array, 0 being the first element, 1 second and so on.




Posting Permissions

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