Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

musky

Member
  • Content Count

    5
  • Joined

  • Last visited

  • Medals

Community Reputation

10 Good

About musky

  • Rank
    Rookie
  1. Thank you Galzohar woohoo, I managed to get it working like this... In editor... tank...(empty)...named "tank". init...tank setVehicleVarName "tank"; nul = [tank, 0, 0, 0, TRUE, FALSE] execVM "vehicle.sqf" man..."crewman"...(playable)...(all 4 not named) man..."crewman"...(playable) man..."crewman"...(playable) man..."crewman"...(playable)...all joined as group - (nothing in init lines). marker...named (respawn_west). Game logic...named (server). In mission folder... description.ext... respawn = 3; respawnDelay = 5; respawnDialog = 1; vehicle.sqf... //Simple Vehicle Respawn Script v1.7 //by Tophe of Östgöta Ops [OOPS] if (!isServer) exitWith {}; // Define variables _unit = _this select 0; _delay = if (count _this > 1) then {_this select 1} else {30}; _deserted = if (count _this > 2) then {_this select 2} else {120}; _respawns = if (count _this > 3) then {_this select 3} else {0}; _explode = if (count _this > 4) then {_this select 4} else {false}; _dynamic = if (count _this > 5) then {_this select 5} else {false}; _unitinit = if (count _this > 6) then {_this select 6} else {}; _haveinit = if (count _this > 6) then {true} else {false}; _hasname = false; _unitname = vehicleVarName _unit; if (isNil _unitname) then {_hasname = false;} else {_hasname = true;}; _noend = true; _run = true; _rounds = 0; if (_delay < 0) then {_delay = 0}; if (_deserted < 0) then {_deserted = 0}; if (_respawns <= 0) then {_respawns= 0; _noend = true;}; if (_respawns > 0) then {_noend = false}; _dir = getDir _unit; _position = getPosASL _unit; _type = typeOf _unit; _dead = false; _nodelay = false; // Start monitoring the vehicle while {_run} do { sleep (2 + random 10); if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true}; // Check if the vehicle is deserted. if (_deserted > 0) then { if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then { _timeout = time + _deserted; sleep 0.1; waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0}; if ({alive _x} count crew _unit > 0) then {_dead = false}; if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true}; if !(alive _unit) then {_dead = true; _nodelay = false}; }; }; // Respawn vehicle if (_dead) then { if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;}; if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;}; if (_explode) then {_effect = "M_TOW_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;}; sleep 0.1; deleteVehicle _unit; sleep 2; _unit = _type createVehicle _position; _unit setPosASL _position; _unit setDir _dir; if (_haveinit) then {_unit setVehicleInit format ["%1;", _unitinit]; processInitCommands;}; if (_hasname) then {_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname]; processInitCommands;}; _dead = false; // Check respawn amount if !(_noend) then {_rounds = _rounds + 1}; if ((_rounds == _respawns) and !(_noend)) then {_run = false;}; }; // Script by Galzohar - player moveInCommander tank; _aiCrew = (units group player) - [player]; (_aiCrew select 0) assignAsGunner tank; (_aiCrew select 0) moveInGunner tank; (_aiCrew select 1) assignAsDriver tank; (_aiCrew select 1) moveInDriver tank; (_aiCrew select 2) moveInTurret [tank, [0,1]]; //not sure if this is the correct turret path for loader, you'll have to check. Might be [0,1] instead of [1]! { _x setDammage 0; } forEach _aiCrew; }; not sure how to use respawn script you posted for reference?? tried it and nothing happened?? can you point me in the right direction There is one other question.... if you would be so kind.... How do i use this say for five or six players? I have seen this question of mine come up time and time again here and on other sites and have posted elsewhere without a single reply...you were the first person to help me...Thanks... and after searching (for over a month) and dowloading loads of stuff i never found what i wanted. So if you dont mind i will post this for other people to use on different sites with reference to you for your part of the script? You are most helpful...thank you for your time and effort.....musky:D
  2. Sorry Galzohar...i'm a numpty:(...here goes... I have tried both ways....like this... Both End up spawning tank with diver in and rest of crew outside of vehicle leaving me to get in as commander and order both gunners in tank...which they do and then i can move in as gunner and controle tank whilst fireing. with players... 1 mee...(playable) init... mee moveincommander tank; nul = [Grp1, 0, 0, "respawn_vehicle_west"] execVM "Script.sqs" 2 crew...(non playable) init... this moveindriver tank 3 crew...(non playable) init... this MoveInTurret [tank,[0]] 4 crew...(non playable) init... this MoveInTurret [tank,[0,1]] tank...(empty) init... tank setVehicleVarName "tank"; tank = [tank, 0, 0, 0, TRUE, FALSE, "this setDammage 0"] execVM "vehicle.sqf" vehicle.sqf... if (!isServer) exitWith {}; // Define variables _unit = _this select 0; _delay = if (count _this > 1) then {_this select 1} else {30}; _deserted = if (count _this > 2) then {_this select 2} else {120}; _respawns = if (count _this > 3) then {_this select 3} else {0}; _explode = if (count _this > 4) then {_this select 4} else {false}; _dynamic = if (count _this > 5) then {_this select 5} else {false}; _unitinit = if (count _this > 6) then {_this select 6} else {}; _haveinit = if (count _this > 6) then {true} else {false}; _hasname = false; _unitname = vehicleVarName _unit; if (isNil _unitname) then {_hasname = false;} else {_hasname = true;}; _noend = true; _run = true; _rounds = 0; if (_delay < 0) then {_delay = 0}; if (_deserted < 0) then {_deserted = 0}; if (_respawns <= 0) then {_respawns= 0; _noend = true;}; if (_respawns > 0) then {_noend = false}; _dir = getDir _unit; _position = getPosASL _unit; _type = typeOf _unit; _dead = false; _nodelay = false; // Start monitoring the vehicle while {_run} do { sleep (2 + random 10); if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true}; // Check if the vehicle is deserted. if (_deserted > 0) then { if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then { _timeout = time + _deserted; sleep 0.1; waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0}; if ({alive _x} count crew _unit > 0) then {_dead = false}; if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true}; if !(alive _unit) then {_dead = true; _nodelay = false}; }; }; // Respawn vehicle if (_dead) then { if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;}; if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;}; if (_explode) then {_effect = "M_TOW_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;}; sleep 0.1; deleteVehicle _unit; sleep 2; _unit = _type createVehicle _position; _unit setPosASL _position; _unit setDir _dir; if (_haveinit) then {_unit setVehicleInit format ["%1;", _unitinit]; processInitCommands;}; if (_hasname) then {_unit setVehicleInit format ["%1 = this; this setVehicleVarName ""%1""",_unitname]; processInitCommands;}; _dead = false; // Check respawn amount if !(_noend) then {_rounds = _rounds + 1}; if ((_rounds == _respawns) and !(_noend)) then {_run = false;}; }; }; marker...respawn_vehicle_west Game Lodgic...server description.ext... respawn = 3; respawnDelay = 5; respawnVehicle = 3; respawnVehicleDelay = 0; respawnDialog = 1; init.sqf... if (!isDedicated) then { player addEventHandler ["KILLED", "execVM 'Script.sqs']; }; Script.sqs... waitUntil {alive player}; player moveInCommander tank; _aiCrew = (units group player) - [player]; (_aiCrew select 0) moveInGunner tank; (_aiCrew select 1) moveInDriver tank; (_aiCrew select 2) moveInTurret [tank, [0,1]]; //not sure if this is the correct turret path for loader, you'll have to check. Might be [0,1] instead of [1]! { _x setDammage 0; } forEach _aiCrew; // probably delete old tank here without players.... tank... playable as commander, driver,gunner init... tank setVehicleVarName "tank"; tank = [tank, 0, 0, 0, TRUE, FALSE, "this setDammage 0"] marker...respawn_vehicle_west Gamelodgic...server description.ext... respawn = 3; respawnDelay = 0; respawnVehicle = 3; respawnVehicleDelay = 0; respawnDialog = 1; init.sqf... _Object="M1A2_US_TUSK_MG_EP1" CreateVehicle (GetPos Player); _VarName="tank"; _Object SetVehicleVarName _VarName; player moveInCommander tank; _aiCrew = (units group player) - [player]; (_aiCrew select 0) assignAsGunner tank; (_aiCrew select 0) moveInGunner tank; (_aiCrew select 1) assignAsDriver tank; (_aiCrew select 1) moveInDriver tank; (_aiCrew select 2) assignAsGunner [tank, [1]]; (_aiCrew select 2) moveInTurret [tank, [0,1]]; //not sure if this is the correct turret path for loader, you'll have to check. Might be [0,1] instead of [1]! { _x setDammage 0; } forEach _aiCrew; if (!isDedicated) then { player addEventHandler ["KILLED", "execVM 'Script.sqs'] }; Script.sqs.... // respawn tank first and do tank = ... so tank points at the correct tank. Of course save the old tank in another variable so that you can delete it at the end of the script player moveInCommander tank; _aiCrew = (units group player) - [player]; (_aiCrew select 0) assignAsGunner tank; (_aiCrew select 0) moveInGunner tank; (_aiCrew select 1) assignAsDriver tank; (_aiCrew select 1) moveInDriver tank; //(_aiCrew select 2) assignAsGunner [tank, [1]]; (_aiCrew select 2) moveInTurret [tank, [0,1]]; //not sure if this is the correct turret path for loader, you'll have to check. Might be [0,1] instead of [1]! { _x setDammage 0; } forEach _aiCrew; // probably delete old tank here Hope this helps... Thanks in advance:)
  3. Galzohar, can i be so bold as to ask for an example? (if you have time of course) I spent hours last night trying to work the code you kindly wrote. The only thing i could get was a respawn with a driver in tank and me and rest of crew outside of tank? Thanks for all your help:)
  4. Thanks for your reply Galzohar, Yes i need to make the tank respawn but now you have mentioned it i'm not sure if i need the crew to respawn?? may be this would stop them jumping out as the tank get damaged leaving me to fight it out alone??. the idea is once spawned as commander i want to be able to move to gunners seat but still have control of tank movement whilst in as gunner fireing as i go - with machine guns manned by computer generated players and computer generated driver. i have tried resolving this for so long now until my brain n eyes went pop. so to have your help is nothing short of the most exciting thing thats happened this year! thanks loads n loads for your time and skill:D:bounce3:
  5. hi, i am a newbie to posting so here goes... 1. i am creating a multiplayer tank level - where i need, when killed player (me - commander) and all crew (computer generated - driver, gunner, loader) to respawn in tank. (i am hoping to do this for may be 5 or 6 players) the closest i have got to this is by using an init.sqf :- if (!isDedicated) then { player addEventHandler ["KILLED", "execVM 'respawn.sqf']; }; with a respawn.sqf:- waitUntil {alive player}; player moveInDriver tank; - tank being the name of vehicle this works in as much as the crew and tank will respawn with one of the crew in as driver - i then have to get in tank as commander and order other two crew in as both gunners. im not sure why the computr generated player is put in as driver and not me the actual player and have tried to use...... waitUntil {alive player}; player moveInDriver tank; player moveIngunner tank; player moveInturret tank; as my respawn.sqf. this still only put driver in tank on respawn leaving me and crew outside tank as before. i am wondering how i refere to crew to order them into tank in correct positions. my editor is full of different attempts i have made to try and resolve this problem. can someone help me or point me to an example i can adjust or alter to overcome this problem. thanks in advance for any help given.
×