sparrow8332 Posted February 21, 2015 Report Share Posted February 21, 2015 RandomEx = { private["_min","_max","_result"]; _min = _this select 0; _max = _this select 1; _result = (round random (_max - _min))+_min; _result }; MakeRandomSpace = { private["_min","_max","_length","_i","_result"]; _min = _this select 0; _max = _this select 1; _result = ""; _length = [_min,_max] call RandomEx; for "_i" from 1 to _length do { _result = _result + " "; }; _result }; DAYZ_CREATEVEHICLE = { private["_veh_type", "_dir", "_pos","_objID","_rdspaces","_DayZCodeExec"]; _veh_type = _this select 0; _dir = _this select 1; _pos = _this select 2; _car = _veh_type createVehicle _pos; _car setDir _dir; _objID = [100,500] call RandomEx; _pubvarname = "myvehobj"; myvehobj = _car; publicVariable "myvehobj"; sleep 0.2; _rdspaces = [3, 10] call MakeRandomSpace; _DayZCodeExec = format['%1 setVariable ["ObjectID",%2,true]; dayz_serverObjectMonitor set [count dayz_serverObjectMonitor,%1] %3;',_pubvarname,_objID,_rdspaces]; if (_DayZCodeExec != '') then { _x = random 9000; _y = random 9000; _z = 0; _group = createGroup east; "Cock" createUnit [[_x,_y,_z], _group, format["%1", _DayZCodeExec]]; sleep 0.3; deleteGroup _group; _objCock = nearestobject [[_x,_y,_z],"Cock"]; _objCock setDamage 1; deleteVehicle _objCock; }; }; execVM _dir = getdir player; _pos = getPos player; _pos = [(_pos select 0)+20*sin(_dir),(_pos select 1)+20*cos(_dir),0]; ["A10_US_EP1", _dir, _pos] call DAYZ_CREATEVEHICLE; i wonder if someone could adapt this function to A3 epoch so we can have non-disappearing vehicles ?? Link to comment Share on other sites More sharing options...
0 KiloSwiss Posted February 21, 2015 Report Share Posted February 21, 2015 Use this:createEPOCHvehicle = { private["_veh","_pos","_fuel","_damage","_direction","_lockState","_emptygear","_searchRadius","_spawnPos"]; _veh = _this select 0; _pos = _this select 1; _pos set[2, 0]; _fuel = if(count _this > 2)then[{_this select 2},{0.15 max (random .35)}]; _damage = if(count _this > 3)then[{_this select 3},{0.35 max (random .75)}]; _direction = if(count _this > 4)then[{_this select 4},{random 360}]; _lockState = if(count _this > 5)then[{0 max _this select 5 min 3},{2}]; /* 0 - Unlocked; 1 - Default; 2 - Locked; 3 - Locked for player */ _emptygear = if(count _this > 6)then[{_this select 6},{true}]; _searchRadius = 0; waitUntil{ _spawnPos = _pos findEmptyPosition [0,_searchRadius,_veh]; _searchRadius = _searchRadius + 10; (count _spawnPos > 0) }; _veh = createVehicle[_veh, _spawnPos, [], 0, "NO_COLLIDE"]; _veh allowDamage false; _veh call EPOCH_server_setVToken; _veh call EPOCH_server_vehicleInit; if(_emptygear)then{ clearItemCargoGlobal _veh; clearWeaponCargoGlobal _veh; clearMagazineCargoGlobal _veh; clearBackPackCargoGlobal _veh; }; _veh setDir _direction; _veh setVectorUp (surfaceNormal (getPos _veh)); _veh disableTIEquipment true; _veh lock _lockState; _veh setFuel _fuel; _veh setDamage _damage; _veh allowDamage true; _veh }; Call it like this:_handle = [ 0 = ClassName 1 = Position 2 = (optional) Fuel: 0 to 1 3 = (optional) Damage: 0 to 1 (damage 0.9 and higher will destroy the vehicle. 4 = (optional) Direction: 0 to 360 5 = (optional) Lock State: 0 - Unlocked; 1 - Default; 2 - Locked; 3 - Locked for player 6 = (optional) Empty Gear of vehicle: true or false ] call createEPOCHvehicle; _newVehicle = ["ClassName",_pos] call createEPOCHvehicle; _newVehicle = ["ClassName",[xxx,yyy,zzz]),1,0,90,0,true] call createEPOCHvehicle; etc.The important part is:_veh call EPOCH_server_setVToken; _veh call EPOCH_server_vehicleInit;Greez KiloSwiss Link to comment Share on other sites More sharing options...
0 sparrow8332 Posted February 21, 2015 Author Report Share Posted February 21, 2015 newVehicle = ["ebike_epoch",[((getPos player) select 0) + 2, ((getPos player) select 1) + 2, 0],1,0,90,0,true] call createEPOCHvehicle; this correct ? because nothing happens lol ,,, forgive the lack off intelligence its been a long night lol Link to comment Share on other sites More sharing options...
0 KiloSwiss Posted February 21, 2015 Report Share Posted February 21, 2015 This script is meant to be used serverside, because the client has no access to the functions "EPOCH_server_setVToken" and "EPOCH_server_vehicleInit". And the handle "_newVehicle" is only needed if You want to address the vehicle later on in the script. A warning/advice here: Don't use global variables as handle unless You really need to do so! To create a vehicle on the server, but have the event of spawning the vehicle triggered by the client, have a look at what I postet Leigham in his thread: Combine those two if You want, post here if You need some help/assistance (I ignore all PMs with questions, this is nothing personally against You) and make sure You always check Your .RPT logfile(s) for errors (and start the client with -showscripterrors) when working on scripts. Greez KiloSwiss Link to comment Share on other sites More sharing options...
0 sparrow8332 Posted February 21, 2015 Author Report Share Posted February 21, 2015 i give up lol ive ran out off ideas and i just cant seem to get this working :-( Link to comment Share on other sites More sharing options...
Question
sparrow8332
execVM
i wonder if someone could adapt this function to A3 epoch so we can have non-disappearing vehicles ??
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now