mirror of
https://github.com/Fallingsheep1985/Arma3Epoch.git
synced 2024-08-30 16:42:12 +00:00
deploy bike update
This commit is contained in:
parent
db9f931ee7
commit
ff4ea14ac2
@ -1,60 +0,0 @@
|
||||
|
||||
//Created by - Fallingsheep
|
||||
//Special thanks - infistar
|
||||
|
||||
//check if player has scrap
|
||||
if ("ItemScraps" in magazines player) then{
|
||||
//check if player has toolkit
|
||||
if ("ToolKit" in magazines player) then{
|
||||
player playActionNow "Medic"; // play build animation
|
||||
sleep 3; //wait 3 seconds
|
||||
//remove scrap from inventory
|
||||
player removeMagazine "ItemScraps";
|
||||
//set vehcile tokens
|
||||
if (!isNil 'EPOCH_server_setVToken') then {_vehObj call EPOCH_server_setVToken;};
|
||||
if (!isNil 'EPX_server_setVToken') then {_vehObj call EPX_server_setVToken; };
|
||||
|
||||
_vehClass = "ebike_epoch"; // vehicle class to spawn
|
||||
_position = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0]; // get player pos for spawning
|
||||
_dir = getDir player;
|
||||
//spawn the vehicle at players postion
|
||||
_vehObj = _vehClass createVehicle (_position);
|
||||
//set vehicle slots
|
||||
if (!isNil 'EPX_server_vehicleInit') then {_vehObj call EPX_server_vehicleInit};
|
||||
EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1;
|
||||
EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit);
|
||||
_slot = EPOCH_VehicleSlots select 0;
|
||||
_vehObj setVariable ['VEHICLE_SLOT',_slot,true];
|
||||
EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot];
|
||||
EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots;
|
||||
publicVariable 'EPOCH_VehicleSlotCount';
|
||||
//remove any items from vehicle
|
||||
clearWeaponCargoGlobal _vehObj;
|
||||
clearMagazineCargoGlobal _vehObj;
|
||||
clearBackpackCargoGlobal _vehObj;
|
||||
clearItemCargoGlobal _vehObj;
|
||||
//randomize colour if more than 1 available
|
||||
_config = (configFile >> 'CfgVehicles' >> _vehClass >> 'availableColors');
|
||||
if (isArray(_config)) then{_textureSelectionIndex = configFile >> 'CfgVehicles' >> _vehClass >> 'textureSelectionIndex';
|
||||
_selections = if (isArray(_textureSelectionIndex)) then {getArray(_textureSelectionIndex)} else { [0] };
|
||||
_colors = getArray(_config);
|
||||
_textures = _colors select 0;
|
||||
_color = floor (random (count _textures));
|
||||
_count = (count _colors)-1;
|
||||
{
|
||||
if (_count >= _forEachIndex) then{_textures = _colors select _forEachIndex;};
|
||||
_vehObj setObjectTextureGlobal [_x, (_textures select _color)];
|
||||
} forEach _selections;
|
||||
_vehObj setVariable ['VEHICLE_TEXTURE',_color];
|
||||
};
|
||||
//Save vehicle
|
||||
if (!isNil 'EPOCH_server_save_vehicle') then {_vehObj call EPOCH_server_save_vehicle};
|
||||
if (!isNil 'EPX_server_save_vehicle') then {_vehObj call EPX_server_save_vehicle;};
|
||||
|
||||
cutText [format["You built a EBike."], "PLAIN DOWN"];
|
||||
} else {
|
||||
SystemChat "You need a Toolkit to build a EBike.";
|
||||
};
|
||||
} else {
|
||||
SystemChat "You need Scrap to build a EBike.";
|
||||
};
|
45
MPMissions/epoch.Altis/deploy/deploybike.sqf
Normal file
45
MPMissions/epoch.Altis/deploy/deploybike.sqf
Normal file
@ -0,0 +1,45 @@
|
||||
//Created by - Fallingsheep
|
||||
//Special thanks - infistar for vehicle spawn code
|
||||
|
||||
//check if player has scrap
|
||||
if ("ItemScraps" in magazines player) then{
|
||||
//check if player has toolkit
|
||||
if ("VehicleRepair" in magazines player) then{
|
||||
player playActionNow "Medic"; // play build animation
|
||||
sleep 3; //wait 3 seconds
|
||||
//remove scrap from inventory
|
||||
player removeMagazine "ItemScraps";
|
||||
//set vehcile tokens
|
||||
if (!isNil 'EPOCH_server_setVToken') then {_vehObj call EPOCH_server_setVToken;};
|
||||
if (!isNil 'EPX_server_setVToken') then {_vehObj call EPX_server_setVToken; };
|
||||
|
||||
_vehClass = "ebike_epoch"; // vehicle class to spawn
|
||||
_position = [((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0]; // get player pos for spawning
|
||||
_dir = getDir player;
|
||||
//spawn the vehicle at players postion
|
||||
_vehObj = _vehClass createVehicle (_position);
|
||||
//set vehicle slots
|
||||
if (!isNil 'EPX_server_vehicleInit') then {_vehObj call EPX_server_vehicleInit};
|
||||
EPOCH_VehicleSlotsLimit = EPOCH_VehicleSlotsLimit + 1;
|
||||
EPOCH_VehicleSlots pushBack str(EPOCH_VehicleSlotsLimit);
|
||||
_slot = EPOCH_VehicleSlots select 0;
|
||||
_vehObj setVariable ['VEHICLE_SLOT',_slot,true];
|
||||
EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_slot];
|
||||
EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots;
|
||||
publicVariable 'EPOCH_VehicleSlotCount';
|
||||
//remove any items from vehicle
|
||||
clearWeaponCargoGlobal _vehObj;
|
||||
clearMagazineCargoGlobal _vehObj;
|
||||
clearBackpackCargoGlobal _vehObj;
|
||||
clearItemCargoGlobal _vehObj;
|
||||
//Save vehicle
|
||||
if (!isNil 'EPOCH_server_save_vehicle') then {_vehObj call EPOCH_server_save_vehicle};
|
||||
if (!isNil 'EPX_server_save_vehicle') then {_vehObj call EPX_server_save_vehicle;};
|
||||
|
||||
cutText [format["You built a EBike."], "PLAIN DOWN"];
|
||||
} else {
|
||||
SystemChat "You need a VehicleRepair to build a EBike.";
|
||||
};
|
||||
} else {
|
||||
SystemChat "You need Scrap to build a EBike.";
|
||||
};
|
10
MPMissions/epoch.Altis/deploy/packbike.sqf
Normal file
10
MPMissions/epoch.Altis/deploy/packbike.sqf
Normal file
@ -0,0 +1,10 @@
|
||||
//Created by - Fallingsheep
|
||||
//Special thanks - infistar for vehicle spawn code
|
||||
_target = cursorTarget;
|
||||
_isbike = _target typeof "ebike_epoch";
|
||||
if (_isbike) then{
|
||||
deleteVehicle _target;
|
||||
player addMagazine "ItemScraps";
|
||||
player addMagazine "VehicleRepair";
|
||||
SystemChat "You packed the EBike.";
|
||||
};
|
@ -1,6 +0,0 @@
|
||||
_target = cursorTarget;
|
||||
_isbike = _target typeof "EBike";
|
||||
if (_isbike) then{
|
||||
deleteVehicle _target;
|
||||
player addMagazine "ItemScraps";
|
||||
};
|
@ -5,8 +5,7 @@ _logistic = execVM "=BTC=_Logistic\=BTC=_logistic_Init.sqf";
|
||||
//Loadouts
|
||||
[] execVM "custom\loadout.sqf";
|
||||
|
||||
//Deploy bike/chopper
|
||||
[] execVM "custom\deployvehicle.sqf";
|
||||
|
||||
|
||||
//Status Bar
|
||||
[] execVM "custom\fn_statusBar.sqf";
|
||||
@ -57,3 +56,17 @@ if (!isDedicated) then {
|
||||
VEMFChatMsg = nil;
|
||||
};
|
||||
};
|
||||
|
||||
//Created by - Fallingsheep
|
||||
//Special thanks - infistar for vehicle spawn code
|
||||
|
||||
//BUILD BIKE
|
||||
if (("ItemScraps" in magazines player)&&("VehicleRepair" in magazines player)) then{
|
||||
act = player addaction [("<t color=""#0074E8"">" + ("Build Bike") +"</t>"),"deploy\deploybike.sqf","",5,false,true,"",""];
|
||||
};
|
||||
//PACK BIKE
|
||||
_target = cursorTarget;
|
||||
_isbike = _target isKindOf "ebike_epoch";
|
||||
if (_isbike) then{
|
||||
act = player addaction [("<t color=""#0074E8"">" + ("PackBike") +"</t>"),"deploy\packbike.sqf","",5,false,true,"",""];
|
||||
};
|
Loading…
Reference in New Issue
Block a user