Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

  Click here to go to the first Developer post in this thread.  

Thread: Random Spawn and Waypoints

  1. #11
    First Lieutenant CameronMcDonald's Avatar
    Join Date
    Oct 10 2005
    Location
    Sydney, Australia.
    Posts
    5,554
    It is very possible. You would run a script file when you want to make the unit move out, either via trigger or called in another script, or even from its init line if you wish for it to move straight away.

    Start with:

    Code:
    _groupOne = group *whateverunit*;
    _randomWPinteger = round (random 4);
    ...which will return either 0, 1, 2, 3 or 4. Moving on:

    Code:
    if (_randomWPinteger = 0) then {[_groupOne, 1] setWPPos markerPos "MarkerWPPossibility1"};
    if (_randomWPinteger = 1) then {[_groupOne, 1] setWPPos markerPos "MarkerWPPossibility2"};
    etc etc ad infinitum
    The AI will randomly "select" and move to one of your 5 waypoints. All you do is put down markers where you want to give the option for the AI to move to in each case, and then run another similar script upon reaching the waypoint.

    It's not easy, but it's certainly not Maths C surd multiplication either.

    Note that the above code is probably broken in about 30,000 places, but I'm currently not in the mood to write something ironclad.

    Further discussion probably belongs in A2 scripting.

    Everyone tempted to post another inane/useless/whogivesatoss topic in the A3 forum - here.

  2. #12
    Quote Originally Posted by Nicholas View Post
    That is possible? ^^
    Yes!

    In WP1's on Act field:
    myGroup setCurrentWaypoint [myGroup, 2 + floor random 2]

    Then at WP2 (to stop them from going to WP3):
    myGroup setCurrentWaypoint [myGroup, 4]

    That's it. ArmA's script language allows you to do a lot more than you may think (and almost always in more than one way as CameronMcDonald shows)

  3. #13
    First Lieutenant CameronMcDonald's Avatar
    Join Date
    Oct 10 2005
    Location
    Sydney, Australia.
    Posts
    5,554
    Much better, ceeeb.

  4. #14
    It would be nice if this were simplified as it is a very useful thing. Perhaps we could have a "DECISION" waypoint, which could be connected to multiple next waypoints, with some logic choosing which one to go to next. The default would be to choose randomly, but with the ability to attach some scripting to make the decision in other ways. Similar to trigger logic maybe. Yeah you can do this with some semi-complicated scripting but it would be nice to see it visually represented in the UI and to be able to draw these waypoints out in the editor and then hook them up, with at most a little coding in a "decision script" texbooks on the DECISION waypoint, that defaults to the code for "pick at random".

    Here are some examples of things that it would be useful to make a decision on, which could be supported in the UI with minimal scripting:

    -- Choose next waypoint based on whether enemy units are detected / how many
    -- Choose next waypoint based on whether friendly units are detected / how many
    -- Choose next waypoint based on time of day
    -- Choose next waypoint based on how many units in my group

    Lots of possibilities here:

    -- A patrol that circles around to different locations until nightfall, at which point it heads home until morning
    -- A patrol that circles different locations, but if it finds one abandoned, switches to garrison it
    -- Move to an area, get in/out of a vehicle based on presence of enemies
    -- A patrol that goes to different locations at random

  5. #15
    First Lieutenant Tonci87's Avatar
    Join Date
    Jul 7 2009
    Location
    Hagen/Germany
    Posts
    5,957
    Quote Originally Posted by Polar Bear View Post
    It would be nice if this were simplified as it is a very useful thing. Perhaps we could have a "DECISION" waypoint, which could be connected to multiple next waypoints, with some logic choosing which one to go to next. The default would be to choose randomly, but with the ability to attach some scripting to make the decision in other ways. Similar to trigger logic maybe. Yeah you can do this with some semi-complicated scripting but it would be nice to see it visually represented in the UI and to be able to draw these waypoints out in the editor and then hook them up, with at most a little coding in a "decision script" texbooks on the DECISION waypoint, that defaults to the code for "pick at random".

    Here are some examples of things that it would be useful to make a decision on, which could be supported in the UI with minimal scripting:

    -- Choose next waypoint based on whether enemy units are detected / how many
    -- Choose next waypoint based on whether friendly units are detected / how many
    -- Choose next waypoint based on time of day
    -- Choose next waypoint based on how many units in my group

    Lots of possibilities here:

    -- A patrol that circles around to different locations until nightfall, at which point it heads home until morning
    -- A patrol that circles different locations, but if it finds one abandoned, switches to garrison it
    -- Move to an area, get in/out of a vehicle based on presence of enemies
    -- A patrol that goes to different locations at random
    Nice idea!

  6. #16
    Hi,

    Nicholas point is, more functionality within the editor.
    Proud community admin/member of The Tour of Teamrespawn

  7.   Click here to go to the next Developer post in this thread.   #17
    For these situations, we've been using copyWaypoints for some time now. I think you'll find it allows you to do pretty much everything suggested here quite easily.
    The game, Mrs. Hudson, is ON!

  8. #18
    Copying way points is a hack getting around the lack of a proper implementation. We should not argue against proper implementation on the grounds that some ridiculous hack can accomplish the same thing in a round about, arcane way.

    For one thing it's not going to be obvious to new players. They might actually have to find this thread, or one like it, to learn about this hack. Common scripting cases should be implemented with clear, clean, intuitive, well documented methods that are directly accessible in the editor.

    In general all ridiculous hacks should be replaced by proper, clear implementations if we want scripting to be something any savvy user can do, as opposed to old timers who scour forums for hacks.
    Last edited by Polar Bear; Jun 24 2012 at 12:57.

  9. #19
    Gunnery Sergeant Phantom Six's Avatar
    Join Date
    Nov 28 2010
    Location
    The Track or the Mission Editor
    Posts
    506
    I like what Nicholas is suggesting. The more features there are, the better. What I would like to see is some system like UPSMON as a module because I like using UPSMON for most of my missions. It gives it a bit more dynamic feeling to it and the AI reacts much better. Well, if that doesn't happen, I guess I can wait for a release.
    Phantom Mission Site Download my missions, view screenshots, and check out a step by step mission editing tutorial here - - - - - - - - - - - - - - - - Join CiA Coop Nights
    Spoiler:

  10. #20
    1) Set unit on map (nicknamed TheDude).
    2) Place 5 waypoints on editor map (WP1, WP2, WP3, WP4, WP5). If you're trying to make waypoints in-game rather than in-editor, that's different.
    3) Make a script:

    _randomArray = [WP2, WP3];
    //Presumably, WP2 and WP3 are variables for arrays like [(group TheDude), 3] and [(group TheDude), 4]
    _randomSelect = (_randomArray select (round (random 1)));
    // This will select either WP2 OR WP3 randomly
    deleteWaypoint _randomSelect;
    //This deletes the selected waypoint, leaving the other one as the only option

    This way you can predefine the position of each waypoint via the editor while also randomly choosing one of the two waypoints (by deleting one). I hope that helps (though I might have misunderstood you).
    The first Taoist in a foxhole.



    - Come one BI, give us some pyrotechnic weapons already! Napalm! Flamethrowers! Incendiary grenades!


    (\_/)
    (O.o) copy the bunny into your signature
    ( ><) help him achieve world domination

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

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