Jump to content
Sign in to follow this  
OzeRick

Problem with script please help

Recommended Posts

I am trying my hand at some more scripting and have come to a holt and need help:o

Could some one have a look and tell me what I am doing wrong

thanks

if (!isServer) exitWith {};
_pos    = _this select 0;
_area   = _this select 1;
_Num       = _this select 2;
_dist   = _this select 3;
_side   = _this select 4;
_type = _this select 5;

private ["_pos","_area","_Num","_dist","_side","_type"];
_skill  = [0.6,1];

_a = "SkeetDisk";// obj to use as spawn place.

for [{_i = 0},{_i < _Num},{_i = _i + 1}] do
{
_newpos = GetPos _pos;
 _posX = _newpos select 0;
  _posY = _newpos select 1;
   if ( isNil "ob_u" ) then { ob_u = 0 };
   ob_u = ob_u+ 1;
   _mar = format["ob%1", ob_u ];
  _mar = _a createVehicle[(_posX + random _area)-_area/2, (_posY + random _area)-_area/2,0];

 switch (_side) do
 {
     case west:
     {
switch (_type) do
      case ammor:
      {
          // spawn west ammor
          _units = ["HMMWV_Base","M1A1","APC"];
          _grp = [getPos _mar,180,_units,_side] call bis_fnc_spawnVehicle;
          [_grp, ( getPos _mar), _dist] call BIS_fnc_taskPatrol;
          sleep 0.8;
      };
          case air:
        {
          //spawn west air
          _units = ["A10","AV8B2","F35","AH1Z","AH64D","UH1Y","UH60"];
           _grp =  [getPos _mar,180,_units,_side] call bis_fnc_spawnVehicle;
            [_grp, ( getPos _mar), _dist] call BIS_fnc_taskPatrol;
            sleep 0.8;
        };
            case man:
       {
             //spawn west men
          _units = 2 + random 20;
              _grp = [getPos _mar,180,_units,_side] call bis_fnc_spawnVehicle;
          [_grp, ( getPos _mar), _dist] call BIS_fnc_taskPatrol;
           sleep 0.8;
          };
   case east:
      {
  switch (_type) do
      case ammor:
      {
              //spawn east ammor
          _units =  ["BMP3","BTR90","T72_RU","T90","GAZ_Vodnik","GAZ_Vodnik_HMG"];
           _grp = [getPos _mar,180,_units,_side] call bis_fnc_spawnVehicle;
          [_grp, ( getPos _mar), _dist] call BIS_fnc_taskPatrol;
          sleep 0.8;
      };
      case air:
      {           //spawn east air
          _units = ["Mi17","Mi24","Su25","su34"];
        _grp = [getPos _mar,180,_units,_side] call bis_fnc_spawnVehicle;
          [_grp, ( getPos _mar), _dist] call BIS_fnc_taskPatrol;
          sleep 0.8;
        };
          //spawn east men
   case man:
   {
          _units = 2 + random 20;
       _grp = [(getpos _mar),_side,_units, [], [], _skill] call bis_fnc_spawngroup;
       [_grp, ( getPos _mar), _dist] call BIS_fnc_taskPatrol;
       sleep 0.8;
       };
};

Edited by OzeRick

Share this post


Link to post
Share on other sites

It would help a lot if you would tell what that script should do and what the problem is.

Also please use code tags when posting scripts and not spoiler tags.

Share this post


Link to post
Share on other sites

Also your thread title is not descriptive.

What are you trying to do?

What is it doing when you try to run it?

What have you tried to fix it?

Share this post


Link to post
Share on other sites

HI all

Sorry about all that.

What I am trying to do is

1. spawn a object in a random area with a name,that part works no problem.

2. have it so that if you put say "ammor" for _type it will pick the correct path and spawn the required vehicles.

3.I am runnig it from a trigger from radio just for testing.

4.Well I am really just trying to learn how scritping work

thanks

Share this post


Link to post
Share on other sites

Well the problem is that it is not working :0

If I brake the script apart and run the single parts it work's, but as a hole it is not.

I think it is in the way I am useing the If, then, else, switch, but I have no idear.

thats way I am asking for help

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×