Jump to content

Lucky44

Member
  • Content Count

    359
  • Joined

  • Last visited

  • Medals

Posts posted by Lucky44


  1. Kommiekat: you can call the line in your #3 any way you like. For example, you can put it in your init.sqf. That's probably the easiest thing to do. You just need to have a clean way to execute the script (jsp_garrison_radius.sqf) with the parameters you want.

    Keep in mind that the first element of those parameters is "mrk2", right? And that means that the location where this radius will be centered is a marker named "mrk2". So you need a marker on the map with that name for it to work.


  2. I've searched high and low and can't find anything on this.

    I'm trying to make sure that a player who's performing a certain Action (via an addAction that puts the player into a Move animation) can't walk away in the middle of the animation.

    I thought the player was locked out of control of movement like that, but apparently not. Is there a way to make sure the player must stay put through the duration of the animation/Move?

    EDIT: OK, more tests are needed. It seems to lock the player into the animation automatically now. I am going to have to figure out what happened on the other time I tested it and it let me move. I'll get back about this.


  3. Thanks, Cuel. But I'm still getting a (different) problem. Here's my code now:

    _testHelo1 = [getMarkerPos "mrk_WPtest0", 10, "LIN_UH1", _airSquad1] call bis_fnc_spawnvehicle;
    (_testHelo1 select 0) setVehicleVarName "Helo98";
    .
    .
    .
    //move each group member into Helo
    for "_x" from 0 to 4 do {
    sleep 0.2;
    (units _heloTroop1 select _x) moveInCargo Helo98;
    };
    

    The problem comes when I try to refer to helo98. I get a "undefined variable" error. Why would that be???


  4. Quick question: I don't see any provision for running for MultiPlayer, either on Dedicated or Hosted servers. I naively assumed that was built in, but when I played my mission with 11 players (on a dedicated server), I got a nasty surprise (it spawned one "set" of hostiles per player connected, overwhelming the server).

    Did I do something wrong? Is there a best way to adapt it to a dedicated server? Would a simple: if (!isServer) exitwith {}; do the trick? -Anyone??

    EDIT: I've tried adding a line at the beginning that's just: if (!isServer) exitwith {}; --and it seems to do the trick. But I'd be curious for more expert folks to weigh in.


  5. I appreciate any help!

    I'm trying to randomize which 6 of 20 "intel objects" (e.g., files, photos, laptops) in a building need to be gathered by the players in this co-op mission. My method is to place each object on the map in the editor and give it a name. Then I'm running a script that picks a first object randomly and adds the "Take this intel for examination later" action to it. Then it continues on to pick 5 more objects (that haven't been picked yet.)

    I originally ran the script that does this from an execVM from the init.sqf. Problem was that it effectively ran once for each client connected, apparently. So I put a "if (!isServer) exitwith {}" at the top of the script. But that made it only run on the dedicated server, and not on any clients. I know there's a way to accomplish this, but I'm stuck trying to find it!

    Here's the code, if it helps.

    if (!isServer) exitWith {}; // This is an addition for version 0.4
    
    sleep 9;
    
    _intel1 = [i0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19]; //array of intel items
    
    //initialize the picked variables (with obviously weird values!)
    _r1=-2; _r2=-2; _r3=-2; _r4=-2; _r5=-2; _r6=-2;
    
    
    //randomly choose 6 intel pieces to activate from the 20 possible/////////////////////////////////////////////////////
    //1st object: ///////////////////////////////////////////////////////////
    _r1 = floor(random 20); // set value for first pick
    (_intel1 select _r1) addAction ["Take this intel for later examination","scripts\takeIntel.sqf"];
    
    // 2nd roll: start _r2 //////////////////////////////////////////////////
    _r2 = floor(random 20);
    while {_r2==_r1} do
    {
      _r2 = floor(random 20); // reroll
    };
    (_intel1 select _r2) addAction ["Take this intel for later examination","scripts\takeIntel.sqf"];
    
    // 3rd roll: start _r3 /////////////////////////////////////////////////
    _r3 = floor(random 20);
    while {(_r3==_r1) or (_r3==_r2)} do
    {
      _r3 = floor(random 20);  // reroll
    };
    (_intel1 select _r3) addAction ["Take this intel for later examination","scripts\takeIntel.sqf"];
    
    // 4th roll: start _r4 /////////////////////////////////////////////////
    _r4 = floor(random 20);
    while {(_r4==_r1) or (_r4==_r2) or (_r4==_r3)} do
    {
      _r4 = floor(random 20);  // reroll
    };
    (_intel1 select _r4) addAction ["Take this intel for later examination","scripts\takeIntel.sqf"];
    
    // 5th roll: start _r5 /////////////////////////////////////////////////
    _r5 = floor(random 20);
    while {(_r5==_r1) or (_r5==_r2) or (_r5==_r3) or (_r5==_r4)} do
    {
      _r5 = floor(random 20);  // reroll
    };
    (_intel1 select _r5) addAction ["Take this intel for later examination","scripts\takeIntel.sqf"];
    
    // 6th roll: start _r6 /////////////////////////////////////////////////
    _r6 = floor(random 20);
    while {(_r6==_r1) or (_r6==_r2) or (_r6==_r3) or (_r6==_r4) or (_r6==_r5)} do
    {
      _r6 = floor(random 20);  // reroll
    };
    (_intel1 select _r6) addAction ["Take this intel for later examination","scripts\takeIntel.sqf"];
    


  6. I'm trying to spawn a varied number of groups and send them all along the same waypoints. The only problem I'm having is that only the first spawned group will follow the waypoints; the others just stand at the spawn area. I know it must be something about naming the groups and referring to those names, but I've tried a variety of things and nothing is working. What am I doing wrong?

    In the code, _hSquads is a number scaled to the number of players.

    for "_x" from 1 to _hSquads do {
    
    _squad1 = [_spawnPt, EAST, 8] call BIS_fnc_spawnGroup; 
    
    _wp0 = _squad1 addWaypoint [ _WP1, 1];	// set location and radius
    _wp0 setWaypointType "MOVE"; // set WP type here
    _wp0 setWaypointStatements ["true", ""]; // ?
    
    _wp1 = _squad1 addWaypoint [_WP2, 3];
    _wp1 setWaypointType "MOVE";
    _wp1 setWaypointStatements ["true", ""];
    
    _wp2 = _squad1 addWaypoint [_WP3, 3];
    _wp2 setWaypointType "MOVE";
    _wp2 setWaypointStatements ["true",""];
    
    }:
    

    EDIT: Well, I realized the problem was I'd changed some waypoint names and painted myself into a corner. Problem solved by renaming the waypoints!

    Thanks in advance!


  7. I have not found this anywhere else after looking, so I'll ask here: what is known about importing Arma2:OA (or CO) missions into Arma 3? Will .sqm files work? Will A2 units be possible in A3, without addons? Will it be a possible but difficult "translation"? Or just impossible?? Will map elements be copy/pastable, even in a script editor, working with .sqm files?

    And more fundamentally, is it true that SQF will still be the base scripting language, but that others (Java friendly? like Python??) will be usable?


  8. Sigh.

    Thanks for the help. I guess I still am not clear on the difference between isNil and isNull. I see http://community.bistudio.com/wiki/isNil and http://community.bistudio.com/wiki/isNull, but it's not sinking in.

    I should have thought to at least try it, though!

    (Readers: note the use of quotation marks with isNil)

    ---------- Post added at 06:29 PM ---------- Previous post was at 06:17 PM ----------

    Ugh, it couldn't be simple, could it?

    I'm having problems with both !isNil and !isNull - both are giving me "undefined variable" errors. Here's the whole code; the !isNil is 2/3 down.

    {
    removeAllWeapons _x;//clear em out first
    
           //Add standard items to all
    _x addWeapon "Binocular_Vector";
    _x addWeapon "NVGoggles";
    _x addMagazine "SmokeShell";
    _x addMagazine "SmokeShell";
    _x addMagazine "IR_Strobe_Target";
    _x addMagazine "handgrenade_west";
    for "_i" from 1 to 8 do {_x addMagazine "15Rnd_9x19_M9SD"};
    _x addWeapon "M9SD";
    
    //give each team member specified rifle
    for "_n" from 1 to 8 do {_x addMagazine "30Rnd_556x45_StanagSD"};
    _x addWeapon "m8_tws_sd";
    
    //clear backpacks and insert specified gear into them
    clearMagazineCargo unitBackpack _x;
    //_x addBackpack "US_Assault_Pack_EP1"; // this is how you'd add one, if needed.
    (unitBackpack _x) addMagazineCargo ["30Rnd_556x45_StanagSD",4];
    (unitBackpack _x) addMagazineCargo ["SmokeShell",2];
    (unitBackpack _x) addMagazineCargo ["handgrenade_west",2];
    
    //if someone is in the sniper/observer slot, give specific gear
    if ((!isNil "p10") && (_x == p10)) then {
    	p10 removeWeapon "m8_TWS_SD";
    	p10 removeMagazines "30Rnd_556x45_StanagSD";
    	for "_y" from 1 to 8 do {p10 addMagazine "20rnd_762x51_b_scar"};
    	p10 addWeapon "M110_TWS_EP1";
    
    	clearMagazineCargo unitBackpack _x;
    	(unitBackpack _x) addMagazineCargo ["20rnd_762x51_b_scar",4];
    	(unitBackpack _x) addMagazineCargo ["SmokeShell",2];
    	(unitBackpack _x) addMagazineCargo ["handgrenade_west",2];
    };
    
    } forEach playableUnits;
    

    Is it a problem that it's all inside a "playableUnits" forEach?

    Thanks again for any help.


  9. I've searched around with no luck, and this is driving me nuts.

    I'm looking at the isNull wiki entry, and it gives this example:

    if (isNull obj) then {hint "doesn't exist"}
    

    So I try this, but it says that p10 is an undefined variable:

    if (isNull p10) then {hint "p10 is null"};
    

    p10 is a playable unit. If someone is in that slot, everything is fine. If not, I get the "undefined variable" error. What's going on there?

    (What I'm ultimately trying to do is a check for !isNull, so that something certain gear is giving to the p10 unit if there's a player in the slot, BTW.)


  10. Thanks to both of you for the help.

    Yes! setVariable was what I was thinking of. I had it in my head that it was called a "personal variable" or something...duh.

    Here's what I'm going to use for now:

    
    if (!isServer) exitwith {}; // make sure only the server runs the script
    if (alarmSounded == "true") exitwith {}; // just quit script if alarm has already sounded
    
    
    //if (shotFlag == "true") exitwith {}; // this is initialized in the init.sqf
    //shotFlag = "true"; //the problem with this ATM is that if one person shoots, the script won't work again for 10-15 seconds, for ANYONE...
    //publicVariable "shotFlag";
    
    _shooter = _this select 0;
    if ((_shooter getVariable "alarm") == "yes") exitWith {}; // if this is not the first shot, exit
    _shooter setVariable ["alarm", "yes", true]; // if this is first shot, set alarm call to YES, and make it TRUE for publicVariable
    
    sleep ((random 5)+15); // if unit is still alive 15-20 seconds after shooting, it will call on radio for help
    
    //If, after the delay (to give the shooter time to get on his radio), shooter's still alive, do this:
    if (alive _shooter) then {
    alarmSounded = "true"; // this will disable further messages and calls for reinforcements (from other units)
    publicVariable "alarmSounded"; 
    
    [[west,"HQ"],nil,rsideChat, "You've been spotted. A hostile guard put out a radio call for help!"] call RE;
    //hint format ["%1 is calling for help on the radio!",_shooter]; // another approach
    
    sleep 260+(random 120); // put a delay before the reinforcements start out
    execVM "scripts\spawnRFland.sqf"; //spawn some reinforcements on land
    execVM "scripts\spawnRFair.sqf"; //spawn some reinforcements in air
    };
    

×