Coolinator 10 Posted January 21, 2015 How do you remove weapons for pilots only? even after they respawned? Share this post Link to post Share on other sites
jshock 512 Posted January 21, 2015 if (player isKindOf "B_pilot_F") then { removeAllWeapons player; }; player addEventhandler [ "Respawn", { if ((_this select 0) isKindOf "B_pilot_F") then { removeAllWeapons (_this select 0); }; } ]; Share this post Link to post Share on other sites
Coolinator 10 Posted January 21, 2015 if (player isKindOf "B_pilot_F") then { removeAllWeapons player; }; player addEventhandler [ "Respawn", { if ((_this select 0) isKindOf "B_pilot_F") then { removeAllWeapons (_this select 0); }; } ]; Thank you so much! Jshock!!! it's been a long time :D Im still not sure how to run this, i know it's sad lol Can i run it like this? init.sqf execVM "Pilot.sqf"; Pilot.sqf if (player isKindOf "B_pilot_F") then { removeAllWeapons player; }; player addEventhandler [ "Respawn", { if ((_this select 0) isKindOf "B_pilot_F") then { removeAllWeapons (_this select 0); }; } ]; Share this post Link to post Share on other sites
jshock 512 Posted January 21, 2015 (edited) I would create a initPlayerLocal.sqf and do something like this: initPlayerLocal.sqf: if (player isKindOf "B_Pilot_F") then { removeAllWeapons player; }; player addEventhandler [ "Respawn", { if ((_this select 0) isKindOf "B_Pilot_F") then { removeAllWeapons (_this select 0); }; } ]; EDIT: Checked to make sure, and pilot is capitalized in "B_Pilot_F", changed above. Edited January 21, 2015 by JShock Share this post Link to post Share on other sites
Coolinator 10 Posted January 21, 2015 I would create a initPlayerLocal.sqf and do something like this:initPlayerLocal.sqf: if (player isKindOf "B_pilot_F") then { 0 = [player] execVM "Pilot.sqf"; }; player addEventhandler [ "Respawn", { if ((_this select 0) isKindOf "B_pilot_F") then { removeAllWeapons (_this select 0); }; } ]; Ahh Thank you so much!!! i really appreciate it :) Share this post Link to post Share on other sites
jshock 512 Posted January 21, 2015 Made another quick edit, check above, also made another change in the code, so just re-copy/paste :p. Share this post Link to post Share on other sites
Coolinator 10 Posted January 22, 2015 Made another quick edit, check above, also made another change in the code, so just re-copy/paste :p. Which one? the first post you made? Also, Jshock how do you put radio towers? i can't find it in the editor :( (don't want to make new thread, so i just ask here). Share this post Link to post Share on other sites
jshock 512 Posted January 22, 2015 Post #4, and: _obj = createVehicle ["Land_TTowerBig_2_F", _somePosition, [], 0, "NONE"]; Share this post Link to post Share on other sites
Coolinator 10 Posted January 22, 2015 (edited) Post #4, and: _obj = createVehicle ["Land_TTowerBig_2_F", _somePosition, [], 0, "NONE"]; Ahh thank you so much!!!! About the radio towers. Do I use game logic? and how do i make them destroyable? and how do i make it a task? For example, when radio tower destroyed, task completed. (like i want to use "!alive tower", but i don't know how to do it with game logics?) MISTAKE EDIT: (I meant game logics not game objects, sorry about that) ---------- Post added at 01:21 ---------- Previous post was at 01:13 ---------- I tried making radio tower with game logic, i put the script in game logic's init but it's giving me error "Local variable in global space"? Edited January 22, 2015 by Coolinator Share this post Link to post Share on other sites
jshock 512 Posted January 22, 2015 (edited) This is for use in an sqf file, not in a game logic and the script would be something like the following: _somePosition = ;//set this variable to the position you want the tower to be at //example positions //getMarkerPos "markerName"; //[123,456,789] << some position array (x,y,z) coordinates _tower = createVehicle ["Land_TTowerBig_2_F", _somePosition, [], 0, "NONE"]; [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {sleep 5; !alive _tower;}; ["YourTaskNameHere","Succeeded",true] call BIS_fnc_taskSetState; So execute it in the init.sqf or whenever you want the tower and task to be created. Edited January 22, 2015 by JShock Share this post Link to post Share on other sites
Coolinator 10 Posted January 22, 2015 This is for use in an sqf file, not in a game logic and the script would be something like the following: _somePosition = ;//set this variable to the position you want the tower to be at //example positions //getMarkerPos "markerName"; //[123,456,789] << some position array (x,y,z) coordinates _tower = createVehicle ["Land_TTowerBig_2_F", _somePosition, [], 0, "NONE"]; [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {sleep 5; !alive _tower;}; ["YourTaskNameHere","Succeeded",true] call BIS_fnc_taskSetState; So execute it in the init.sqf or whenever you want the tower and task to be created. this is really too advanced for me but i go give it a try, but i have to ask a lot of questions if thats okay with you? ---------- Post added at 05:28 ---------- Previous post was at 05:22 ---------- about [/C_somePosition = ;//set this variable to the position you want the tower to be at //example positions //getMarkerPos "markerName"; i want to use getMarkerPos "markerName"; instead of coordinates can you give me an example how to include that in the script? im really sorry im not pro scripter :( For example, i named marker "tower1' do i do it like this? _somePosition = getMarkerPos "tower1"; //set this variable to the position you want the tower to be at //example positions //getMarkerPos "markerName"; //[123,456,789] << some position array (x,y,z) coordinates _tower = createVehicle ["Land_TTowerBig_2_F", _tower1, [], 0, "NONE"]; [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {sleep 5; !alive _tower;}; ["YourTaskNameHere","Succeeded",true] call BIS_fnc_taskSetState; Share this post Link to post Share on other sites
jshock 512 Posted January 22, 2015 Yes, your correct with the position, but where you have "_tower1" in the code put it back to "_somePosition" because the getMarkerPos blah is saved into _somePosition. Share this post Link to post Share on other sites
Coolinator 10 Posted January 22, 2015 Yes, your correct with the position, but where you have "_tower1" in the code put it back to "_somePosition" because the getMarkerPos blah is saved into _somePosition. tested it, no tower showed up :( i put marker called "tower1", made a "tower.sqf", i put the script code inside "tower.sqf". In my init.sqf i put (execVM "to objectswer.sqf";) tested it.. no luck :( i think im just gonna bail out on this. Im just gonna use military devices objects to substitute for the towers for my mission objectives. Thanks so much your help, i really appreciate it :) Share this post Link to post Share on other sites
jshock 512 Posted January 22, 2015 I made one minor change to see if it helps. And to ensure we haven't lost exactly what needs to happen: 1. Make a marker named: "tower1" 2. Create a .sqf file name: "tower.sqf" 3. Paste the code below into tower.sqf and save it. _somePosition = getMarkerPos "tower1"; _tower = createVehicle ["Land_TTowerBig_2_F", _somePosition, [], 0, "NONE"]; _task = [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {sleep 5; !alive _tower;}; [_task,"Succeeded",true] call BIS_fnc_taskSetState; 4. In the init.sqf put the following call to the script: 0 = [] execVM "tower.sqf"; Share this post Link to post Share on other sites
Coolinator 10 Posted January 23, 2015 I made one minor change to see if it helps.And to ensure we haven't lost exactly what needs to happen: 1. Make a marker named: "tower1" 2. Create a .sqf file name: "tower.sqf" 3. Paste the code below into tower.sqf and save it. _somePosition = getMarkerPos "tower1"; _tower = createVehicle ["Land_TTowerBig_2_F", _somePosition, [], 0, "NONE"]; _task = [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {sleep 5; !alive _tower;}; [_task,"Succeeded",true] call BIS_fnc_taskSetState; 4. In the init.sqf put the following call to the script: 0 = [] execVM "tower.sqf"; it worked!!! thank you so much!! :) ---------- Post added at 04:38 ---------- Previous post was at 04:35 ---------- I made one minor change to see if it helps.And to ensure we haven't lost exactly what needs to happen: 1. Make a marker named: "tower1" 2. Create a .sqf file name: "tower.sqf" 3. Paste the code below into tower.sqf and save it. _somePosition = getMarkerPos "tower1"; _tower = createVehicle ["Land_TTowerBig_2_F", _somePosition, [], 0, "NONE"]; _task = [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; waitUntil {sleep 5; !alive _tower;}; [_task,"Succeeded",true] call BIS_fnc_taskSetState; 4. In the init.sqf put the following call to the script: 0 = [] execVM "tower.sqf"; How do you end mission? and using multiple towers? im used to using triggers for ending missions, but with scripting i have no experience :( but's it okays if you dont feel like explaining all of that stuff, im already happy to see a radio tower lol :) thnx ^^ Share this post Link to post Share on other sites
jshock 512 Posted January 23, 2015 Try this out: _towerMarkers = ["tower1","tower2","tower3"];//<<put all tower markers here //script should do the rest _towerPositions = []; _allTowers = []; { _towerPositions pushBack (getMarkerPos _x); } forEach _towerMarkers; { _tower = createVehicle ["Land_TTowerBig_2_F", _x, [], 0, "NONE"]; _task = [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; _tower setVariable ["spawnedTowerTaskID",_task,true]; _tower addEventHandler [ "Killed", { [(_this select 0) getVariable "spawnedTowerTaskID","Succeeded",true] call BIS_fnc_taskSetState; } ]; _allTowers pushBack _tower; } forEach _towerPositions; waitUntil {({alive _x} count _allTowers) isEqualTo 0}; [] call BIS_fnc_endMission; Share this post Link to post Share on other sites
Coolinator 10 Posted January 24, 2015 Try this out: _towerMarkers = ["tower1","tower2","tower3"];//<<put all tower markers here //script should do the rest _towerPositions = []; _allTowers = []; { _towerPositions pushBack (getMarkerPos _x); } forEach _towerMarkers; { _tower = createVehicle ["Land_TTowerBig_2_F", _x, [], 0, "NONE"]; _task = [ "RadioTower", true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; _tower setVariable ["spawnedTowerTaskID",_task,true]; _tower addEventHandler [ "Killed", { [(_this select 0) getVariable "spawnedTowerTaskID","Succeeded",true] call BIS_fnc_taskSetState; } ]; _allTowers pushBack _tower; } forEach _towerPositions; waitUntil {({alive _x} count _allTowers) isEqualTo 0}; [] call BIS_fnc_endMission; THank you so much Jshock! :) i really appreciate it! I haven't tested it yet, but i will test them in my future missions. Share this post Link to post Share on other sites
jshock 512 Posted January 24, 2015 Actually small edit, probably need a unique ID for each task, not the same one :p: _towerMarkers = ["tower1","tower2","tower3"];//<<put all tower markers here //script should do the rest _towerPositions = []; _allTowers = []; { _towerPositions pushBack (getMarkerPos _x); } forEach _towerMarkers; { _tower = createVehicle ["Land_TTowerBig_2_F", _x, [], 0, "NONE"]; _task = [ format ["RadioTower%1",_forEachIndex], true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; _tower setVariable ["spawnedTowerTaskID",_task,true]; _tower addEventHandler [ "Killed", { [(_this select 0) getVariable "spawnedTowerTaskID","Succeeded",true] call BIS_fnc_taskSetState; } ]; _allTowers pushBack _tower; } forEach _towerPositions; waitUntil {({alive _x} count _allTowers) isEqualTo 0}; [] call BIS_fnc_endMission; Share this post Link to post Share on other sites
Coolinator 10 Posted January 24, 2015 Actually small edit, probably need a unique ID for each task, not the same one :p: _towerMarkers = ["tower1","tower2","tower3"];//<<put all tower markers here //script should do the rest _towerPositions = []; _allTowers = []; { _towerPositions pushBack (getMarkerPos _x); } forEach _towerMarkers; { _tower = createVehicle ["Land_TTowerBig_2_F", _x, [], 0, "NONE"]; _task = [ format ["RadioTower%1",_forEachIndex], true, ["Destroy the Radio Tower at all costs.","Destroy Radio Tower", ""], (getPos _tower), "AUTOASSIGNED", 5, true, true ] call BIS_fnc_setTask; _tower setVariable ["spawnedTowerTaskID",_task,true]; _tower addEventHandler [ "Killed", { [(_this select 0) getVariable "spawnedTowerTaskID","Succeeded",true] call BIS_fnc_taskSetState; } ]; _allTowers pushBack _tower; } forEach _towerPositions; waitUntil {({alive _x} count _allTowers) isEqualTo 0}; [] call BIS_fnc_endMission; Ahh thanks!!! :) i keep in this mind Share this post Link to post Share on other sites