Announcement

Collapse
No announcement yet.

Python's Insta-Wall Script

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

  • ZephyrDark
    started a topic Python's Insta-Wall Script

    Python's Insta-Wall Script

    Are you a mission maker?

    Do you consider yourself EXTREMELY lazy, like myself?

    Do you hate having to place individual walls around that base you're trying to set up?

    Don't you wish there was an easier way?

    Well now there is! Introducing:


    Insta-Wall by Blackpython


    This easy to use script allows you, as a mission maker, to create walled in rectangular areas with no stress at all! All it takes is for you to place a marker on the map, set its size (remember, the x and y axis variables only measure half of the real dimensions!), run the script, and wah-lah, you now have a instantly made rectangular wall, with an entrance as well! Mind you, this entrance will always the direction of the marker. So for example, if my marker is facing 90 degrees (east), my entrance will be to the east. Also, do not worry about annoying markers now cluttering your mission's map screen, the script auto-magically hides them for you!

    This script does not guarantee the wall to be perfectly aligned, however. Instructions are included at the top of the script.

    Code:
    /* 
    -------------------------------------------------------
    | Blackpython's Insta-Wall Script - Version 1.0  |
    -------------------------------------------------------
    
    Call Line: _bp = [_mkrArray,_wallType] execVM "instaWall.sqf";
    Script is to be called at start of mission. Preferably in the init.sqf
    
    ##############################################
    
    Arguments:
    _mkrArray = Array of Markers you wish to have walls applied to them.
    _wallType = Type of Wall you wish to use, either 1, 2, or 3.
    Wall Type 1 = Big Bag Fence
    Wall Type 2 = HESCO Barrier
    Wall Type 3 = Tall Concrete Wall
    
    Example: _bp = [["mkr1","mkr2","mkr3"], 1] execVM "instaWall.sqf";
    
    ##############################################
    
    */
    
    private ["_mkrArray","_wallType","_wallClass"];
    _mkrArray = _this select 0;
    _wallType = _this select 1;
    switch (_wallType) do
    {
        case 1:
        {
            _wallClass = "Land_fort_bagfence_long";
        };
        case 2:
        {
            _wallClass = "Land_HBarrier3";
        };
        case 3: 
        {
            _wallClass = "Concrete_Wall_Ep1";
        };
        case default
        {
            _wallClass = "Land_fort_bagfence_long";
        };
    };
    
    {_x setMarkerAlpha 0;} forEach _mkrArray;
    
    {
        private ["_xVar","_yVar","_xPos","_yPos","_rad","_theta","_distX1","_distX2","_distY1","_distY2","_xCor1","_yCor1","_xCor2","_yCor2","_xCor3","_yCor3","_xNew1","_yNew1","_xNew2","_yNew2","_xNew3","_yNew3"];
        _distX1 = 0;
        _distX2 = 0;
        _distY1 = 0;
        _distY2 = 0;
        _xVar = getMarkerSize _x select 0;
        _yVar = getMarkerSize _x select 1;
        _theta = markerDir _x;
        _xPos = getMarkerPos _x select 0;
        _yPos = getMarkerPos _x select 1;
        _rad = sqrt((_xvar^2) + (_yVar^2));
        _xCor1 = _rad * sin ( 180 + _theta + (atan((_xVar) / (_yVar))));
        _yCor1 = _rad * cos ( 180 + _theta + (atan((_xVar) / (_yVar))));
        _xCor2 = _rad * sin ( 90 + _theta + (atan((_yVar) / (_xVar))));
        _yCor2 = _rad * cos ( 90 + _theta + (atan((_yVar) / (_xVar))));
        _xCor3 = _rad * sin ( 270 + _theta + (atan((_yVar) / (_xVar))));
        _yCor3 = _rad * cos ( 270 + _theta + (atan((_yVar) / (_xVar))));
        _xNew1 = _xCor1 + _xPos;
        _yNew1 = _yCor1 + _yPos;
        _xNew2 = _xCor2 + _xPos;
        _yNew2 = _yCor2 + _yPos;
        _xNew3 = _xCor3 + _xPos;
        _yNew3 = _yCor3 + _yPos;
        while {_distX1 <= (2 * _xvar - 1)} do
        {
            private "_Lthis";
            _Lthis = _wallClass createVehicle [0,0];
            _Lthis setPos [(_xNew1 + .5) + (_distX1 * sin(90 + _theta)) , (_yNew1 - .5) + (_distX1 * cos(90 + _theta))];
            _Lthis setDir _theta;
            _distX1 = _distX1 + 1;
        };
        while {_distY1 <= (2 * _yvar - 1)} do
        {
            private "_Lthis";
            _Lthis = _wallClass createVehicle [0,0];
            _Lthis setPos [(_xNew1 - .5) + (_distY1 * cos(90 - _theta)),(_yNew1 + .5) + (_distY1 * sin(90 - _theta))];
            _Lthis setDir (_theta - 90);
            _distY1 = _distY1 + 1;
        };
        while {_distX2 <= (2 * _xvar - 1)} do
        {
            private "_Lthis";
           if (_distX2 != (_xVar - 3)) then 
            {
                _Lthis = _wallClass createVehicle [0,0];
                _Lthis setPos [_xNew3 + (_distX2 * sin(90 + _theta)),_yNew3 + (_distX2 * cos(90 + _theta))];
                _Lthis setDir _theta;
                _distX2 = _distX2 + 1;
            } else {_distX2 = _distX2 + 6};
        };
        while {_distY2 <= ( 2 * _yvar - 1)} do
        {
            private "_Lthis";
            _Lthis = _wallClass createVehicle [0,0];
            _Lthis setPos [_xNew2 + (_distY2 * cos(90 - _theta)),_yNew2 + (_distY2 * sin(90 - _theta))];
            _Lthis setDir (_theta - 90);
            _distY2 = _distY2 + 1;
        };
    } forEach _mkrArray;

  • woof
    replied
    Re: Python's Insta-Wall Script

    This could be very cool for us Fobbits. Thanks!

    Leave a comment:


  • ZephyrDark
    replied
    Re: Python's Insta-Wall Script

    Note: Might be best to run this on the server only, as I have not tested this on local servers nor dedicated. Running it on all clients might produce more than needed wall objects.

    Leave a comment:


  • Hawke
    replied
    Re: Python's Insta-Wall Script

    Awesomeness!!

    Leave a comment:

Connect

Collapse

TeamSpeak 3 Server

Collapse

Twitter Feed

Collapse

Working...
X