This script generates a randomized, urban-like area using the new generic VR structures. It is a simple implementation, and it is mostly meant for arena-style PvP missions or CQB practice vs. the AI. You can use this function to quickly have fun in the editor, or generate a complex VR city block by block.
The function uses a grid system to evenly distribute large structures and small cover objects. It uses a rectangular area marker to define the boundaries of the area. The size of each grid, each of which contains one large structure, and how many smaller objects there are per grid are entirely customizable. Each object is randomly placed and rotated within the grid.
The function is very fast, generating large areas in less than a second, and it can be used as many times as you need. There is no debug, argument checking, or defensive code, to make it as simple and fast as possible, so make sure the arguments are correct.
Installation / Usage:
Place the script somewhere in your mission folder
String, an area marker
Scalar, the grid size in meters, each grid gets one large structure
Scalar, count of smaller VR objects, each grid gets this many
The complete documentation is also commented at the top of the file
You can run it from anywhere with execVM, example:
0 = ["marker", 25, 6] execVM "Zen_GenerateVRArea.sqf";You can also compile it into a function if you plan on using it many times:
Zen_GenerateVRArea = compileFinal preprocessFileLineNumbers "Zen_GenerateVRArea.sqf"; 0 = ["marker", 25, 6] call Zen_GenerateVRArea;
When using a small grid size or small marker, some of the large buildings can overlap each other. The only way to fix this is to prevent them from rotating. Using a reasonable grid size should mostly prevent this issue.
There are only 5 big VR structures and 5 little VR objects right now, so it could get a little repetitive. There's nothing I can do about that unless BIS adds new objects, as I have already may every effort to randomize things.
If you liked/disliked it or have any suggestions for improvement, I would like to hear your thoughts. Either this thread, PM, or email is fine.
This software is released under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0).
- Improved: Area can now turn with marker angle
- Improved: Object rotation stays at right angles to the marker angle
- Legal: Added license
- first release
- BI forums