Jump to content
Gudsawn

Rooftop Static Weapons Script

Recommended Posts

Rooftop Static Weapons Script


(overly long demonstration video)

What it Is
As the name suggests, this script will take a given area (defined by a marker) and spawn static weapons (such as DShKMs or KORDs) on rooftops. Taking inspiration from Insurgency for Arma 2, rooftop static weapons add much more variation to battles and make jobs harder for both infantry and air support.

This script was originally made for a private mission, but I thought other mission makers may also find this useful.

How it Works
When called, the script will first scan a given area for enterable buildings. Positions within each building will then be identified. Since there is no command for finding rooftops, this has to be done manually by checking for obstructions above each position and deciding whether or not it is a rooftop. A final check is then performed to ensure that there is enough room for the static weapon to spawn and that the rooftop position is not obstructed by any nearby walls or other solid objects that may prevent the weapon from manoeuvring properly.

How to Use
1. Within your mission, create an ellipse marker (this will define the area that you wish to place static weapons) and give it a name (e.g. "m1").
2. Place down a "Game Logic" unit and put the following in the unit's init field:

["m1", 1, 5, false, "CAF_AG_ME_T_RPK74", east] call gdsn_fnc_spawnRooftopStaticWeapons;



Parameter 1: Name of marker (e.g. "m1").
Parameter 2: Type of weapon placement. 1 = Light (Anti-infantry), 2 = Medium (AT), 3 = Heavy (AA).
Parameter 3: Number of static weapons to spawn.
Parameter 4: Delete marker after use.
Parameter 5: Classname of gunner unit.
Parameter 5: Side of gunner (east, west, resistance).

Requirements
Since Altis/Stratis has no (or barely any) flat rooftops, this script has very little use on the vanilla maps. The example mission provided was created using:
@A3MP
@RDS

These mods are only required for the example mission. The script will, however, work with any mission (as long as you change the default static weapon classnames in the script). Details are in the readme.

Download
Download via Armaholic

Any feedback/comments are always welcome.

Edited by mistergoodson

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

================================================

You are not registered on Armaholic, or at least not that we are aware of. In the future we offer the possibility to authors to maintain their own pages.

If you wish to be able to do this as well please register on Armaholic and let me know about it.

This is not mandatory at all! Only if you wish to control your own content you are welcome to join, otherwise we will continue to follow your work like we have always done ;)

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

This is fantastic! Gotta giver her a try. May be a staple script for all missions. Thank You!!

:yay:

Share this post


Link to post
Share on other sites

^ exactly!! Thanks a lot for releasing this to the masses :o

Share this post


Link to post
Share on other sites

GOOD job Goodson.

Can you do something similar with bunkers / sandbag emplacements i.e. for Metis launchers or Recoiless at rifles ?

Share this post


Link to post
Share on other sites

Any chance you'll allow the script to spawn and despawn units, very similar to BangaBob's 'Enemy Occupation Script'? Having a function or some kind of parameter that makes it work with ALiVE would also be nice. I'm working on two different versions of Takistan Insurgency --- one that uses ALiVE for spawning/despawning, the other uses EOS instead.

A great looking script and hope it is doable and worth your time!

Share this post


Link to post
Share on other sites

Hi! Nice work!

Just a question, if we omit the y part of the lineintersects we could achieve having this in the normal mil towers? The ones without roof, but space to watch.

Share this post


Link to post
Share on other sites

@Serjames - I'll look into doing something like that. In terms of the rooftop placements, I'm thinking of also including sandbags to provide the gunners with some small defences.

@Phronk - I'll probably be getting the script to work with ALiVE's profiler first (since my group uses ALiVE), and then I'll see about creating a custom spawning/despawning function :)

@barboiani - The obstruction checkers (lineIntersects) use the map's X and Y axis, so omitting the Y part would not help with identifying mil towers. Unless I have misunderstood you? I think for specific placements of static weapons (e.g. in mil towers), it would be more reliable to use a predetermined list of buildings/towers. I may include this in the future.

I'm glad you have all found this script useful for your missions :)

Edited by Goodson

Share this post


Link to post
Share on other sites

Great script. The script seems to delete my markers in single player, but it doesn't do so for MP on a dedicated server? Have you ever produced this bug?

Edit: Oh I see. The script only runs on the server, so only the marker is deleted on the server. That makes sense.

Edited by AviatorMoser

Share this post


Link to post
Share on other sites

Goodson, I would like to spawn statics in several places, do I have to declare several markers in one fame logic (thus how do I seperate each marker name?) or is it best to use several game logics?

Share this post


Link to post
Share on other sites

I'm having an issue with the gunner moving into gunner.

seems like some spawn in the guns and some out..

Anyone else having this issue ?

nm, I'm a retard and some of my class names were wrong to the vehicle pool.

Edited by 3lockad3

Share this post


Link to post
Share on other sites

Yo, nice script you got there. I tried this and is working fine in the Editor but how do I make it work in dedicated server / Multiplayer session?

When I do that, the Static Weapons don't appear on the rooftops but in the ground and the markers don't dissapear.

Thanks!

Edited by AlexSegen

Share this post


Link to post
Share on other sites

if (!(_rooftopPos in gdsn_rooftopPositionsUsed) && count (nearestObjects [ _rooftopPos , _type, 10]) == 0) then

{

gdsn_rooftopPositionsUsed = gdsn_rooftopPositionsUsed + [_rooftopPos];

// Create weapon

_staticWeapon = createVehicle [(_type call BIS_fnc_selectRandom), _rooftopPos, [], 0, "NONE"];

_staticWeapon setPosATL _rooftopPos;

_staticWeapon setVectorUp [0,0,1];

// Create gunner

_crew = getText (configFile >> "CfgVehicles" >> (typeOf _staticWeapon) >> "crew");

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 0) then {_side = east};

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 1) then {_side = west};

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 2) then {_side = guerilla};

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 3) then {_side = civilian};

_group = createGroup _side;

_gunner = _group createUnit [_crew, getPosATL _staticWeapon, [], 0, "NONE"];

_gunner moveInGunner _staticWeapon;

Share this post


Link to post
Share on other sites

Hello MisterGoodson,

thanks for this very useful script. Is there any way to determine the direction the weapons are heading?

Share this post


Link to post
Share on other sites

// Create gunner

_crew = getText (configFile >> "CfgVehicles" >> (typeOf _staticWeapon) >> "crew");

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 0) then {_side = east};

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 1) then {_side = west};

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 2) then {_side = resistance};

if ((getNumber (configFile >> 'CfgVehicles' >> (typeOf _staticWeapon) >> 'side')) == 3) then {_side = civilian};

_group = createGroup _side;

_gunner = _group createUnit [_crew, getPosATL _staticWeapon, [], 0, "NONE"];

_gunner moveInGunner _staticWeapon;

Thx for the script!

Share this post


Link to post
Share on other sites

Any chance this works with Arma 2 OA?

EDIT: I see the function used in the script is only for Arma 3 so I didn't even try it. But does anyone know of a similar script for A2?

Edited by K-Hunter

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

×