Arma 3
Shy Mar 23, 2021 @ 12:36pm
Applying a script to vehicles that respawn?
I have found a script that allows Tanks, APCs, Armed Cars, Planes and Helicopters that allows for a single player to operate the vehicle in full. I would like to have this script applied to a vehicle that is capable of respawning.

Question: How do I apply scripts to vehicles that spawn through the Vehicle Respawn module?

any insight to my question is very much appreciated!
< >
Showing 1-5 of 5 comments
Mr Elusive Mar 25, 2021 @ 7:58am 
The vehicle respawn module has an expression field, which you can use to execVM a script. Or alternatively, you can write the script in notepad, then copy-paste it into the expression field like you would a trigger's OnAct box.
Last edited by Mr Elusive; Mar 25, 2021 @ 7:59am
Shy Mar 25, 2021 @ 10:09am 
@Mr Elusive

the script i'm trying to implement is as follows:

this call {
if (isServer) then {
_this lockTurret [[0], true];
_this lockTurret [[0,0], true];
_this lockCargo true;
_this addMPEventHandler ["MPKilled", {
if (isServer) then {
_d = driver (_this select 0);
_g = gunner (_this select 0);
if (!isNull _d) then {deleteVehicle _d};
if (!isNull _g) then {_g setDamage 1};
};
}];
};
if (!isDedicated) then {
_this addEventHandler ["GetIn", {
enableSentences false;
_tank = _this select 0;
_unit = _this select 2;
_unit allowDamage false;
_unit action ["EngineOn", _tank];
_unit action ["MoveToGunner", _tank];
_tank lock true;
_tank switchCamera "EXTERNAL";
_tank addAction [localize "str_action_getout", {
_this select 0 removeAction (_this select 2);
_this select 1 action ["GetOut", _this select 0];
}, "", 3, false, true, "GetOver"];
_tank spawn {
waitUntil {!isNull gunner _this};
_ai = createAgent [
typeOf gunner _this, [0,0,0], [], 0, "NONE"
];
_ai allowDamage false;
_ai moveInDriver _this;
};
}];
_this addEventHandler ["GetOut", {
_tank = _this select 0;
_unit = _this select 2;
deleteVehicle driver _tank;
_unit allowDamage true;
_unit action ["EngineOff", _tank];
_tank lock false;
enableSentences true;
}];
};
};

It's mean to for players to 1 man crew a tank but i'm unable to get the respawn to execute the sqf file, is there something i'm missing?
Mr Elusive Mar 25, 2021 @ 10:56am 
I think I know that script. If I recall, it's purely for tanks and other armored fighting vehicles, so it (probably) won't work for helicopters or aircraft.

A tank with an AI crew and human commander/gunner works fine, so long as the player is the group leader. You can drive the tank using WASD while controlling the gun with your mouse -- there's no need for a one-man-tank script. The only downside to this method is you'll have to hear "LEFT, RIGHT, FORWARD" voice lines from your player's, but I've learned to ignore them lol.

If you don't want AI group members, then the best alternative is MGI's "One Man Tank" module (link below). Place it on the map and then hop into the gunner's seat; you're good to go. I've used it in the past and it works great. Downside is you can't switch to driver or commander seat, which means you can't pop smoke countermeasures. Also you can't have other human players in your tank as they get kicked out immediately.

https://steamcommunity.com/sharedfiles/filedetails/?id=1682280809
Shy Mar 25, 2021 @ 11:02am 
i'll check it out on the workshop thank you :)
Mr Elusive Mar 25, 2021 @ 11:08am 
No worries, happy to help. The "flip overturned vehicle" module in that pack is really useful too. I use it in almost every mission I make, for those occasions where vehicles accidentally collide with a rock and go upside down.

Good luck with your mission making! :steamthumbsup:
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Mar 23, 2021 @ 12:36pm
Posts: 5