Jump to content

Lucky44

Member
  • Content Count

    359
  • Joined

  • Last visited

  • Medals

Posts posted by Lucky44


  1. I'm trying to do a randomizing thing. I want to have five or six groups of enemies (AI). At a certain time, a random number will pick one group and trigger them to move to their next waypoint, assaulting the players' position.

    EDIT:

    I realize now that the best way to do this is with arrays, and with dengibtsschon's help (see below) I'm working on that. But here's one way to do it in a single script. A trigger calls this, but you could set it up in an init.sqf file or a trigger with a radio call to start it, etc. The script is handy for generating random numbers in a group, keeping track of which have been used, and generating more from the ones that remain.

    MUCH EDITED CODE below. Now all in one script:

    // Random Number selection
    // Picks random number from one to six, then picks from remaining, etc., etc.
    // let's you set time between number "rolls" using "sleep" & "random" calls.
    // By Lucky44
    
    
    if (! isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.
    
    n1=0; // if you want to make this repeatable (like by radio calls)
    n2=0; // these will reset values of the variables
    n3=0;
    n4=0;
    n5=0;
    n6=0;
    
    // first roll ///////////////////////////////////////////////////////////////
     n1 = round ((random 6) + 0.5);
     x=n1; // I'm passing the value found in n1 to x for use in triggers, etc.
     sleep (random 10); // to alter time between "rolls", change this sleep value
    // //////////////////////////////////////////////////////////////////////////
    
    // 2nd roll: start n2 ///////////////////////////////////////////////////////
    n2 = round ((random 6) + 0.5);
    
    while {n2==n1} do
    {
     n2 = round ((random 6) + 0.5);
    };
    x=n2;
    
    sleep (random 10); // to alter time between "rolls", change this sleep value
    // //////////////////////////////////////////////////////////////////////////
    
    // 3rd roll: start n3 ///////////////////////////////////////////////////////
    n3 = round ((random 6) + 0.5);
    
    while {(n3==n1) or (n3==n2)} do
    {
     n3 = round ((random 6) + 0.5);
    };
    x=n3;
    
    sleep (random 10); // to alter time between "rolls", change this sleep value
    // ////////////////////////////////////////////////////////////////////////////
    
    // 4th roll: start n4 /////////////////////////////////////////////////////////
    n4 = round ((random 6) + 0.5);
    
    while {(n4==n1) or (n4==n2) or (n4==n3)} do
    {
     n4 = round ((random 6) + 0.5);
    };
    x=n4;
    
    sleep (random 10);  // to alter time between "rolls", change this sleep value
    // ////////////////////////////////////////////////////////////////////////////
    
    // 5th roll: start n5 /////////////////////////////////////////////////////////
    n5 = round ((random 6) + 0.5);
    
    while {(n5==n1) or (n5==n2) or (n5==n3)or (n5==n4)} do
    {
     n5 = round ((random 6) + 0.5);
    };
    x=n5;
    
    sleep (random 10);
    // ////////////////////////////////////////////////////////////////////////////
    
    // 6th roll: start n6 /////////////////////////////////////////////////////////
    n6 = round ((random 6) + 0.5);
    
    while {(n6==n1) or (n6==n2) or (n6==n3) or (n6==n4) or (n6==n5)} do
    {
     n6 = round ((random 6) + 0.5);
    };
    
    x=n6;
    // ////////////////////////////////////////////////////////////////////////////
    
    

    Thanks in advance for any help!


  2. You got me thinking about this, so I started working on a similar mission. But I'm stuck on how to spawn the wreck. Can anyone suggest a better way to do this than what I have below?

    ; Generate random positions in 500m diameter from marker1

    x = round(random 1000) -500;

    y = round(random 1000) -500;

    SpawnPos = setPos [ (getPos Marker1 select 0) + x, (getPos Marker1 select 1) +y, (getPos Marker1 select 2) +0.2];

    ; Create Vehicle at the randomly generated position

    wreck = "UH1Wreck" createVehicle (getMarkerPos "Spawnpos");


  3. I've gathered a few of the better YouTube tutorials together here with a brief note for each. Hope this is helpful.

    YouTube Arma2 Tutorial Videos

    Intro to Editor 1: Basic Map controls (titles not VO) - By RichieSpeedIsBack

    Intro to editor 2: Groups and Waypoints (titles not VO) - by Richiespeedisback

    Artillery and UAV (titles not VO) - by bigbangAT

    Helo insertion, Part 1. (w/VOs) by eclipse245

    Helo extraction (after completing objective) (titles not VO) - by Pollitochuloo

    Triggers intro part 1. (w/VOs) by eclipse245

    Creating (placing) Units in editor (w/VOs) by eclipse245

    Setting up Respawn (w/VOs) by eclipse245

    Triggers, Part 1 (w/VOs) by BabyAlien83

    Triggers, Part 2 (w/VOs) by BabyAlien83

    Triggers w/a bit of scripting (w/VOs) by BabyAlien83

    Scripting a napalm bomb (W/VOs) by BabyAlien83

    Triggers and reinforcements (w/VOs) by BabyAlien83

    Designing missions (w/VOs) by BabyAlien83

    Arma2 File and Folder organization (w/VO) by Lucky44

    Firing Triggers via specific units (w/VO) by Lucky44


  4. ---------- Post added at 09:15 PM ---------- Previous post was at 09:14 PM ----------

    [/color]Problem solved. Apologies!

    gogogo should be placed On Action! Works a charm now!

    I realized after carefully reading through your post, only to come to the end and see you no longer need help, that I have done similar things.

    I suggest we both make a habit of putting the edit at the TOP of the post so people don't waste time unnecessarily.


  5. This seems like a bug, but maybe I'm missing something.

    I have a situation where 1 unit (call him Boss) is going to flee to a helo and take off and exit the area. But if the helo is damaged, he will skip the helo and go to a car, and if the car is damaged, he'll skip it and go to a boat to exit the area.

    So I have Boss's waypoints set up to basically move near the helo, then GetIn the helo, then move near the car, then GetIn the car, then move near the boat, then GetIn the boat, then leave.

    I've messed with using empty vehicles and crewed vehicles (crewed is what I want so they can each have their own exit waypoints after Boss gets in).

    And it works fine until I add the Switch triggers to the GetIn waypoints to detect the damage and make Boss skip the GetIn waypoint if the vehicle is damaged. (For testing purposes, I've tried making the triggers detect other things, btw.) Once I add the trigger, the Boss just runs near the vehicle and stands there, maybe stuttering a little. It's as if he wants to get in but he can't. And it's not a matter of his path to entering the vehicle being physically blocked; nothing has changed except the addition of the Switch trigger.

    I can throw the trigger and make him skip the helo and go to the car, but then he won't get in the car either. If I then make him skip the car and go to the boat (which has no Switch trigger on its GetIn waypoint since it's last in the chain), he will get in.

    So what's going on with Switch triggers messing with my GetIn waypoints?

    Thanks!


  6. Many Thanks I have been looking for a way to land Helo's on the LHD. Hopefully Mandoble will convert his other amazing scripts to ARMA2.

    Does this script (the Mandoble heli precise landing one) work with Arma2 at the moment? If so, can someone explain how to implement it in an Arma2 mission? (I mean, I know that the files need to be in the mission's folder and all, but when I set it up as expected, it didn't work.)

×