Announcement

Collapse
No announcement yet.

Help with V.I.P spawning locations

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with V.I.P spawning locations

    Hey guys,

    I'm making this new mission where I'd like to incorporate the assassination of a high priority target. The thing is I would like the V.I.P to be able to have the possibility to spawn at two different places on the map. Half the time he could spawn at Point "A" or half the time he can spawn at point "B". Any suggestions on how I could go about doing this?

    Cheers,
    Jbone

  • #2
    Re: Help with V.I.P spawning locations

    Try this

    Code:
    if (! isServer) exitwith {}; 
    
    // Create Group for units to be spawned into; must have group created BEFORE spawning units in.
    groupPrimo = createGroup RESISTANCE;
    
    // Pick Location ///////////////////////////////////////////////////////////////////////
    n1 = round ((random 2) + 0.5); // generates random number either 1 or 2
    
    switch (n1) do
    {
        case 1: {_markerPos = getMarkerPos "marker1"};    
        case 2: {_markerPos = getMarkerPos "marker2"};
    
    };
    
    G1 = "UnitName" createunit [_markerPos, groupPrimo];
    G1 setdir 180;
    G2 = "UnitName" createunit [_markerPos, groupPrimo];
    G2 setdir 180;
    You can get the unit lists from here:

    http://www.armatechsquad.com/ArmA2Class/

    [unit][squadl][command2]

    KnyghtMare ~You could always tell the person holding the gun to your head you would like to play on a different server...

    Comment


    • #3
      Re: Help with V.I.P spawning locations

      heres mine:

      init_randomizePosition.sqf:
      Code:
      if(!isServer) exitWith {};
      
      //sleep 5;	// This needs to be figured out better
      
      //Variables:
      //1 - Unit List to move
      //2 - Marker list of possible positions
      //3- spacing, this is how far apart you want them to spawn on ground (5-10 for inf, 20-40 for armored)
      
      _unitList		= _this select 0;
      _markerList		= _this select 1;
      _spacing		= _this select 2;
      
      // pick random marker
      _count = {_x==_x} count _markerList;
      _rNumber = random _count;
      
      _targetPos = getMarkerPos((_markerList select _rNumber));
      _counter = (_targetPos select 0);
      
      { 
      _movePos = [_counter, (_targetPos select 1), (_targetPos select 2)]; 
      _x setPos _movePos; 
      _counter = _counter + _spacing; 
       
      } forEach (_unitList);

      |TG-TFP|Jaynus
      Task Force Proteus


      The very existence of flamethrowers proves that sometime, somewhere, someone said to themselves, You know, I want to set those people over there on fire, but Im just not close enough to get the job done."

      Comment


      • #4
        Re: Help with V.I.P spawning locations

        This line of code at the beginning of both of your scripts:

        Code:
        if (!isServer) exitWith {};
        might or might not exit the script successfully for clients. The exitWith command script is not intended to exit a script but rather to break out of a loop such as while, for, count, forEach. Although, it does not really matter in this case, I strongly suggest not to use exitWith to exit a script when it does matter. There are cases where if a script does not exit successfully in a client, it could cause a catastrophe on the server depending on how many machines are connected. Good luck and happy editing!


        IN GAME ARMA: |TG-Irr| Lq.Snake

        Comment


        • #5
          Re: Help with V.I.P spawning locations

          No need for scripts to do this. Put down your VIP on the map in one of the two places you want him to spawn then put a marker on the 2nd place you want him to spawn, the marker can be 'empty' type so people can't see it. Then group the marker to the VIP and the VIP will spawn 50/50 between the marker and his original position. His group members will move with him too, not sure if they need to be 'In Formation' or not.

          Comment


          • #6
            Re: Help with V.I.P spawning locations

            Originally posted by nthamma View Post
            This line of code at the beginning of both of your scripts:

            Code:
            if (!isServer) exitWith {};
            might or might not exit the script successfully for clients. The exitWith command script is not intended to exit a script but rather to break out of a loop such as while, for, count, forEach. Although, it does not really matter in this case, I strongly suggest not to use exitWith to exit a script when it does matter. There are cases where if a script does not exit successfully in a client, it could cause a catastrophe on the server depending on how many machines are connected. Good luck and happy editing!
            I'm not disagreeing with you on this... even the exitWith Biki entry says that the behavior of exitWith is undefined in some cases... but what other choice do we have?

            Ideally, scripts meant only to execute on the server would never be executed on a player's client, but we know that unintended stuff happens sometimes... a root-level exitWith has been the only answer that I know of. Ideas?

            Comment


            • #7
              Re: Help with V.I.P spawning locations

              Wrap all of your code in a if (isServer) then {};

              ie:

              Code:
              if (isServer) then
              {
                hint format["Wheeee ... %1 is teh server", name player];
                awesomeVar = awesomeVar + 1;
              };

              Comment


              • #8
                Re: Help with V.I.P spawning locations

                There are many solutions to this problem. One of which has been mentioned above by beita.

                Another method which I personally don't use since it requires more work is:

                1. Create a game logic named anything
                2. Wrap all of your code with if (local game_logic_name) then { };

                EX:
                1. Game logic name: server
                2.
                Code:
                if (local server) then
                {
                   player sideChat "I am local to the server";
                };
                Explanation why this works: Any game logic created in the editor is local to the server. The local command returns a boolean either true or false depending if the object argument is local to the machine that is executing the script.

                So, which of these methods is better? The answer is YES. They are equally good. It is a personal choice which one you choose. For instance, 2+2 and 2*2 both equate to 4. Some people might choose to want to add those numbers and some people might choose to multiply. Either way, they give you the same result. I, personally, use the method mentioned above by beita because it requires less work since all you have to do is put in the condition statement: isServer. But, just remember, it is your own personal choice which one you use.

                Good luck and happy editing!

                PS: awesomeVar... HAHA! Nice one, beita ;)


                IN GAME ARMA: |TG-Irr| Lq.Snake

                Comment


                • #9
                  Re: Help with V.I.P spawning locations

                  Originally posted by cheesemenbashi View Post
                  No need for scripts to do this. Put down your VIP on the map in one of the two places you want him to spawn then put a marker on the 2nd place you want him to spawn, the marker can be 'empty' type so people can't see it. Then group the marker to the VIP and the VIP will spawn 50/50 between the marker and his original position. His group members will move with him too, not sure if they need to be 'In Formation' or not.
                  This is what I'm trying right now. It's working so far, hopefully it continues. Thanks for all the replies guys.

                  Comment

                  Connect

                  Collapse

                  TeamSpeak 3 Server

                  Collapse

                  Advertisement

                  Collapse

                  Twitter Feed

                  Collapse

                  Working...
                  X