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

hogmason

Member
  • Content Count

    405
  • Joined

  • Last visited

  • Medals

Everything posted by hogmason

  1. thanks mate, I cant believe the iskindof command slipt my mind ---------- Post added at 21:09 ---------- Previous post was at 20:54 ---------- so I went with _town = _this select 0; _units = nearestObjects [_town, ["Car","Tank","Air","Man"], 200]; { //_unit = _x; if(_x isKindOf "Man" && side _x == east) then { if (_x distance _town <200) then { _town setMarkerColor west_near; }; }; } foreach _units; but im getting a error 0 elements provide 3 expected pointing to _units = nearestObjects [_town, ["Car","Tank","Air","Man"], 200];
  2. if you only whant it to teleport the player inside the trigger area then only run it client side not on server side. Due to using player command. waitUntil {!isNull player}; [b]if (local player) then {[/b] // Get the destination. _dest = "teleportDestination"; // Get a random direction _dir = random 359; //Player ID Array _Players = [uIDARRAYGOESHERE]; // Move the person to marker defined on map (Name: teleportDestination) if !(getPlayerUID player in _Players) then { player SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)]; sleep 0.5; hint "You have entered a restricted access area. You do not have permission to enter this hanger." }; };
  3. ok so I need to create a marker on all towns on a map at the start of a game. I know how to select random towns using nearestLocations but I need to select all towns and create a marker on them all. this is how I get random town selection for a marker _gamelogic = CENTER; _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; _RandomTownPosition = position (_towns select (floor (random (count _towns)))); _m = createMarker [format ["mrk%1",random 100000],_RandomTownPosition]; _m setMarkerShape "ELLIPSE"; _m setMarkerSize [500,500]; _m setMarkerBrush "Solid"; _m setMarkerAlpha 0.5; _m setMarkerColor "ColorRed"; so how can I use this to get all towns a place a marker
  4. dont know if you all got what you needed but this works great i believe shk is the original owner of this code init.sqf execVM "check_for_civ_death.sqf";// run on server side check_for_civ_death.sqf MC_DeadCivilianCount = 0; MC_DeadCivilianLimit = 10;// limit amount of civ casualties allowed MC_EndMission = false; [] spawn { waituntil {MC_EndMission}; playSound "start"; cuttext ["Game over. Civilian casualties are at an unacceptable level. Hearts and minds, boys...","PLAIN",2]; sleep 10; endmission "END2"; }; MC_fnc_deadCivilians = { hint parseText format["<t color=""#80FF00"">Civilians dead: %1, Watch Your Fire 10 is the limit.</t>"]; if (_this >= MC_DeadCivilianLimit) then { MC_EndMission = true; publicvariable "MC_EndMission"; }; }; MC_eh_killed = { private "_side"; _side = side (_this select 1); if (_side == WEST) then { MC_DeadCivilianCount = MC_DeadCivilianCount + 1; publicvariable "MC_DeadCivilianCount"; if isdedicated then { if (_this >= MC_DeadCivilianLimit) then { MC_EndMission = true; publicvariable "MC_EndMission"; }; } else { MC_DeadCivilianCount call MC_fnc_deadCivilians; }; }; }; if isserver then { { if (side _x == Civilian && _x iskindof "Man") then { _x addEventHandler ["killed", MC_eh_killed]; }; } foreach allunits; } else { "MC_DeadCivilianCount" addpublicvariableeventhandler { (_this select 1) call MC_fnc_deadCivilians }; }; [] spawn { waitUntil{!isNil "BIS_fnc_init"}; waituntil {!isnil "BIS_alice_mainscope"}; waituntil {!isnil "bis_fnc_variablespaceadd"}; [bIS_alice_mainscope,"ALICE_civilianinit",[{_this addEventHandler ["killed", MC_eh_killed]}]] call bis_fnc_variablespaceadd; };
  5. yeah mate thats easy, i have to change a few things as well like only us players can see the addactions that cuff the east player then ill add an addaction to the east player that only east players see once detained to escape. Also thinking maybe you should have a array of random select from 1-4 that makes the east player try to escape but he fails so that all east players cant just escape everytime you cuff them. gives the mission a bit of randomality. ill add that as well if you dont like it just delete it out of the code. Any ways ill get on to it tonight.
  6. thanks mate adding _soldier selectWeapon "Huntingrifle"; works perfectly ;)
  7. ok so i have a little basic script that will allow players to select a weapon from addactions this works fine but due to a arma bug the player has to drop the weapon then pick it back up before it can be fired. so wondering if any 1 knows how i can add the weapon to the players back " slinged over shoulder" when the player selects the weapon. i know this will sort it out as it works for rocket luanchers. my little basic code set off by addaction _soldier = _this select 1; [_soldier] joinSilent east_side; removeAllWeapons _soldier; _soldier addMagazine "5x_22_LR_17_HMR"; _soldier addMagazine "5x_22_LR_17_HMR"; _soldier addMagazine "5x_22_LR_17_HMR"; _soldier addWeapon "Huntingrifle";
  8. hogmason

    Mission Timer help

    Here you go mate works fine for me on MP INIT.SQF if (isServer) then //RUN IT ON SERVER IT SYNC'S ON ALL CLIENTS { execVM "timer.sqf"; }; TIMER.SQF _hour = 2; _minute = 0; _second = 0; while {true} do { if (_second == 0 AND (_minute > 0 OR _hour > 0)) then { _second = 59; if (_minute > 0) then { _minute = _minute - 1; } else { if (_hour > 0) then { _hour = _hour - 1; _minute = 59; }; }; } else { _second = _second - 1; }; hintSilent format["Timeleft = %1 : %2 : %3",_hour, _minute,_second]; sleep 1; if (_hour == 0 and _minute == 0 and _second == 0) exitWith {endmission "END1"; }; _countdown = _totalTime - time + _serverTime; while {sleep 0.5; _countdown > 0} do { //Find how much time is left _countdown = _totalTime - time + _serverTime; if (_countdown > 0) then { hintSilent parseText format ["<t size='2' color='#ffffba0c'>%1</t>", ([floor (_countdown / 60), _countdown mod 60] call _numbersToTimeString)]; }; };
  9. Here you go............ in your init.sqf place if (local player) then //"now you need this in multiplayer to luanch on client side not server side" { if ((side player) == east) then {execVM "interigate.sqf"}; }; interigate.sqf = this adds the action to east players player setVehicleInit "this addAction ['Detain!', 'detain.sqf']"; processInitCommands; detain.sqf = this will let a west player detain the east player place them on grouns and cuff them then adds 2 new action for players to order the prisoner to follow them or uncuff him _suspect = _this select 0; _interigator = _this select 1; _interigate_action = _this select 2; _suspect removeAction _interigate_action; _suspect disableAI "MOVE"; _suspect setcaptive true; _interigator switchMove "AinvPknlMstpSnonWrflDnon_medic3"; _suspect switchMove "boundCaptive_loop"; sleep 5; _interigator switchMove ""; hint "Taliban Suspect Detained, and ready for transport to Command Center for Interigating."; // arrest him _suspect setVehicleInit "this addAction ['Order to follow!', 'follow.sqf'];"; processInitCommands; // let him go / uncuff him _suspect setVehicleInit "this addAction ['uncuff him!', 'uncuff.sqf'];"; processInitCommands; uncuff.sqf _prisoner = _this select 0; _guard = _this select 1; _act = _this select 2; _prisoner setskill 1; _prisoner EnableAI "MOVE"; _prisoner switchMove ""; hint "Suspect released."; follow.sqf = this commands the prisoner to follow the west player. also if the west player dies the prisoner will go back to being handcuffed on ground ready for another player to detain him. _prisoner = _this select 0; _guard = _this select 1; _act = _this select 2; _prisoner removeAction _act; [_prisoner] joinSilent _guard; _prisoner setskill 1; _prisoner EnableAI "MOVE"; _prisoner switchMove ""; while {true} do { if (!alive _guard) exitwith { _prisoner disableAI "MOVE"; _suspect setcaptive true; _suspect switchMove "boundCaptive_loop"; _prisoner setVehicleInit "this addAction ['Order to follow!', 'follow.sqf'];"; processInitCommands; [player,nil,rgroupChat,"Escorter Down!!! someone get the Prisoner"] call RE; }; sleep 3; }; diddnt have time to test it but should work :)
  10. ok so i need to get a random position on any town on the map. But if i use nearestLocations with CityCenter NameVillage NameCity or NameCityCapital the position is returned exactly on that set spot so i need to funk it up a bit by getting that position then adding a random distance and direction from the given nearestLocations result i have been playing with the following but cant get it to work. the spawen code _town_logic = CENTER; _towns = nearestLocations [getPosATL _town_logic, ["CityCenter","NameVillage","NameCity","NameCityCapital"], 25000]; _RandomTownPosition = position (_towns select (floor (random (count _towns)))); _Target = createVehicle [target, _RandomTownPosition, [], 0, "None"]; [_Target] call Random_Pos; Random_Pos function Random_Pos = { private ["_Object", "_pos", "_dist", "_dir","_position"]; _Object = _this select 0; _pos = getPos _Object; _dist = random 300; _dir = random 360; _position = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0]; _Object setPos _position; };
  11. cheers mate that works BUT when i loop the code 11 times like for "_i" from 0 to 10 do { _OBJECTIVES = createVehicle [Target, [color="#FF0000"]random_Poistions[/color], [], 0, "None"]; _OBJECTIVES setVehicleInit "_OBJECTIVES addEventHandler [""HandleDamage"",{(_this select 4) == ""PipeBomb""}]" ;format ["%1 = this; this setVehicleVarName ""%1""",_OBJECTIVES]; processInitCommands; if (TF66_Debug) then { [player,nil,rsideChat,"Spawning Target."] call RE; sleep 0.2; [_OBJECTIVES,"tgt","ColorRed","mil_dot"] spawn fnc_tf66_Debug; }; }; i get the same position for all spawns.
  12. hogmason

    Bank script?

    lol yeah its a bit tricky but alot of fun learning it all and this excellent forum with helpfull people will be your lifeline saved my arse a few times from smashing my pc lol :) * this will help alot with learning just type in what you need on the left hand search box http://community.bistudio.com/wiki/Main_Page * also for arrays start here http://tactical.nekromantix.com/wiki/doku.php?id=arma2:missions:array_tutorial
  13. hogmason

    Bank script?

    mate all that is possible to do using arrays dont have time to explain right now but start with learning arrays so you can store the values in to them.
  14. hogmason

    HOG Mechanic v2.0

    yeah there is a way to do this i just havent got around to it as yet ;). IMPORTANT thanks to Iceman77 HOG Mechanic v2 will be updated tomorrow with some excellent new features added by Iceman77 ill post details later when i get home. Huge thanks to Iceman77 ;)
  15. HOG Mechanic v2 By =Mason= ///////////////////////////////// ======================>>>>DOWNLOAD<<<<<======================= ============= ABOUT ============= This script gives the player the ability to repair vehicles if a few requirments are met. ================= HOW THIS WORKS ================= At base there is a pile of tyres and fuel cans from each pile an engineer can pickup a spare tyre for Vehicle Repairs or a Fuel can to refuel a Vehicle. To check how many tyres you have or fuel cans you have open your map and you will find a radio with 2 options 1 to check spare tyres and 1 to check Fuel cans. ============= Requirments ============= 1) player is an engineer. 2) player has at least 1 spare tyre to repair a vehicle. 3) player at least 1 fuel can to refuel a vehicle. ============= HOW TO USE ============= 1) drag the demo to your missions folder C:\Users\yourname\Documents\ArmA 2 Other Profiles\yournick\missions 2) then open it in the editor to view what you need on the map for the script to run you can simpy select merger in the editor to merge all objects on the map over to your mission. 3) transfer the HOG_scripts folder over to your mission folder and place the following in your init.sqf // HOG_mechanic start and Public Variable if ! isdedicated then { [player] execVM "HOG_scripts\HOG_mechanic\common.sqf"; //Repair [player] execVM "HOG_scripts\HOG_mechanic\Repair\add_repair_TOvehicle.sqf"; [player] execVM "HOG_scripts\HOG_mechanic\repair_functions.sqf"; [player] execVM "HOG_scripts\HOG_mechanic\Repair\tyre_count.sqf"; //Refuel [player] execVM "HOG_scripts\HOG_mechanic\Refuel\add_refuel_TOvehicle.sqf"; [player] execVM "HOG_scripts\HOG_mechanic\refuel_functions.sqf"; [player] execVM "HOG_scripts\HOG_mechanic\Refuel\fuelcan_count.sqf"; }; =================================================== SETTING UP LIST OF ENGINEERS / USING WITH UNIT MODS =================================================== TO add different engineer classnames simply open up HOG_scripts\HOG_mechanic\common.sqf and at the top you will find crewType = ["USMC_SoldierS_Engineer","US_Soldier_Engineer_EP1","BAF_Soldier_EN_W","BAF_Soldier_EN_DDPM", "BAF_Soldier_EN_MTP","Soldier_Engineer_PMC","CDF_Soldier_Engineer"]; now this has all standalone engineer classnames but if you need more just add them in to the _crewType array. =================== UPDATES =================== V2 * Changed from player needing a laserdesignator to use repair and refuel to player needing a spare tyre to repair and a Fuel can to refuel. * Fixed a variable issue * Sepperated Repair and Refuel to 2 seperate events. =================== COPYRIGHT STATEMENT =================== HOG Mechanic is © 2012 All rights reserved. ================ LEGAL DISCLAIMER ================ The Software is distributed without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. The Software is not an official addon or tool. Use of the Software (in whole or in part) is entirely at your own risk. ========================================================= DISTRIBUTING SIMULATION CONTENT CREATED WITH THE SOFTWARE ========================================================= Please note that you do NOT require permission from The Contributors to distribute simulation content (e.g. missions) created with the Software. However, The Contributors do ask that you credit the Software in any release documentation. ======= CREDITS ======= thanks to the community on BIS Forums for helping me to get my knowledge of Arma 2 scripting.
  16. have you checked out wolfy's script using these cariables if not check it out might help you. ;) http://www.armaholic.com/page.php?id=13056 ---------- Post added at 21:17 ---------- Previous post was at 21:16 ---------- To place a custom CityCenter, use the GameLogic/Location objects in the editor, name the object (eg loc_1) and place the following in the INIT: this setVariable ["name", "Lighthouse"];
  17. a) you are saving as sqs BUT the code given is sqf as sqs is now old and crap. b) *Why is a local variable used to define the playername and not "player2"? well the player name is not being brought to the script throught the addaction so we are using _this select 1 to reference the player so for the purpose of the script we name it i.e plyr = _this select 1; //or _whatever = _this select 1; in any addaction _whohadit = _this select 0;// so name the var name whatever you want this just references the object that had the addaction _caller = _this select 1;// so name the var name whatever you want this just references the unit that used/called the addaction _theraddaction = _this select 2;/ so name the var name whatever you want this just references the addaction its self. c) Can I define any object in-game as a local variable? What will be the purpose? just give it a name then use the name to call the code i.e i name a vehicle rover in game to use it in a script i use its name rover like _deploy = "USBasicWeaponsBox" createVehicle (getPos rover); // notice the _deploy thats just a var name i give the ammobox local to this script. i hope this helps
  18. i dont knw vbs code ill assume its the same as arma 2 sqf and same code commands. SO im assuming in your example you whant an addaction on player2 that leats another player kill him ???? right if so you use in editor in your player2 init have this addAction ["kill", "kill.sqf",player distance <3];// the 3 is the deistance in mtrs players have to be to get the addaction kill.sqf _player2 = _this select 0;// player with addaction _player1 = _this select 1;// player who selects addaction _addaction = _this select 2;// the aDDACTION _player2 setDamage 1; _player2 removeAction _addaction; ---------- Post added at 14:34 ---------- Previous post was at 14:32 ---------- addaction
  19. hogmason

    Need help with editing

    you can make the params work in editor testing by adding this to your init.sqf if(isNil "paramsArray") then{ paramsArray = [12]; // the number in the array are your params defaults };
  20. no probs man glad i finally got the chance to you help you back ;)
  21. i dont know if it will work or how to make it but to get the rear end of a vehicle using model to world use _vehicle = _this select 0; _vehicle modelToWorld [0,-7,0];// the -7 is 7 meters backwards from the center of the vehicle ---------- Post added at 21:04 ---------- Previous post was at 21:00 ---------- just got to nest it in a if command using _this select 1; from the addaction somehow i.e _vehicle = _this select 0; _person = _this select 1; _behind = _vehicle modelToWorld [0,-7,0]; if (_person _behind) then i know that will not work but gets the idea across
  22. its quite easy to rip the insurgency revie script out ill get it tomoz and upload it if thats what you really whant ---------- Post added at 20:54 ---------- Previous post was at 20:47 ---------- but as far as following a player even after death use this p.s this is a marker that follows a unit named sgt //call it from your init.sqf using execVM "whateveryoucallit.sqf": _setmkr = 1; while {true} do { _marker = createMarker ["respawn",getPosATL sgt]; _marker setMarkerType "milDot"; _marker setMarkerColor "ColorRed"; _marker setMarkerAlpha 0; while {alive sgt} do { _marker setMarkerPos getPosATL sgt; sleep 0.5; }; deleteMarker _marker; execVM "theMARKERscriptAGAIN.sqf": }; };
  23. is it me or is the demo at the top of this thread the mission.sqm file????? Man you can achieve that by scripting in sqf i.e using model to world like for example _vehicle = _this select 0; _behind = _vehicle modelToWorld [0,-7,0]; _deploy = "USBasicWeaponsBox" createVehicle (_behind); _deploy setPosATL [_behind select 0, _behind select 1, 0]; just an example on how model to world works. you can place anything anywhere i really would not be touching the mission.sqm
×