Jump to content
Sign in to follow this  
spec10

init line for vehicles spawned during mission, not placed in editor

Recommended Posts

I'm looking for a way to put an init line on specific vehicle classes when they are being spawned during a mission via zeus or script.

To be a little more precise: I'd like all boats to spawn with the same init line (which adds a push back script to the player's menu while in or near the boat).

I'm sure there is a way via some event handling magic, but I can't get my head around it. Some help would be appreciated. :)

Share this post


Link to post
Share on other sites
I'd like all boats to spawn with the same init line (which adds a push back script to the player's menu while in or near the boat).

One of solutions:

player addAction ["Something", "script.sqf", nil, 1.5, true, true, "", "((typeOf cursorTarget) in boats) and {(cursorTarget distance player) <= 5}"];

player addAction ["Something", "script.sqf", nil, 1.5, true, true, "", "(typeOf (vehicle player)) in boats"];

Share this post


Link to post
Share on other sites

Not sure about with Zeus as haven't used it but through scripts, you should be able to do it with something like

scripts\VehicleSpawn.sqf

private["_Position","_Vehicle"];
_Position = getMarkerPos "BoatSpawn";
_Vehicle = "B_Boat_Transport_01_F" createVehicle _Position;
[[[_Vehicle],"scripts\InitVehicles.sqf"],"BIS_fnc_execVM",TRUE,TRUE] call BIS_fnc_MP;

Then in the following script you could define the types of vehicles etc. so you can use it for more than the one vehicle or just remove the switch and excess other bits if only going to be used for one vehicle type

scripts\InitVehicles.sqf

private["_Vehicle","_VehicleType ","_VehicleClass"];
_Vehicle = _this select 0;
_VehicleType = typeOf _Vehicle;
_VehicleClass = getText(configFile >> "CfgVehicles" >> _VehicleType >> "vehicleClass");
switch (true) do
{
   case (_Vehicle isKindOf "Ship"):
   {
       _Vehicle addAction ["<t color='#FF9900'>Push</t>","scripts\BoatPush\Push.sqf",[],-1,false,true,"","_this distance _target < 8"];
   };
​    case (_VehicleType == "[i]classname[/i]"):
   {
       [i]someinit;[/i]
   };
​    case (_Vehicle == [i]vehname[/i]):
   {
       [i]someinit;[/i]
   };
   case (_VehicleClass == "Autonomous"):
   {
       [i]someinit;[/i]
   };
   default
   {
   };
};

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  

×