Jump to content

twirly

Member
  • Content Count

    1304
  • Joined

  • Last visited

  • Medals

Everything posted by twirly

  1. Hi.... This little script will make you invincible once inside a vehicle and then when the vehicle can no longer move you will be ejected and your ability to take damage restored. I've called the script "test.sqf"...you can call it whatever you want. Create a file in your mission folder called "test.sqf"... add the following lines to the file. while {true} do { if (vehicle player != player) then { player allowdamage false; if (not (canmove vehicle player)) then { UnAssignVehicle player; player action ["EJECT", vehicle player]; player allowdamage true; }; }; sleep 1; }; In your players init add this:- nul = [this] execVM "test.sqf"; If your player starts off in a vehicle add it to the vehicles init. It still works. If you don't want to be invincible while in the vehicle remove the two (2) lines with player allowdamage.
  2. I'm fairly sure it might be this.... Add this and try it. [b][color="Red"]_factionside = west;[/color][/b] if (_factionselection == 0) then {_factionside = east; _rifPosPos = _tkm_rifPosPos; _atPosPos = _tkm_atPosPos; _mgPosPos = _tkm_mgPosPos; _atmgPosPos = _tkm_atmgPosPos; _snipPosPos = _tkm_snipPosPos};
  3. Mate... In your post you say you don't know how to install an addon correctly! Not trying to scare you off but you've got a huge amount to learn before you attempt messing with scripts! Trust me :) Look in the Sticky Section at the top of the forum posts.... and go from there. Prepare to read a lot!
  4. Hi... welcome to the forums. That's a pretty big list and a lot of work! ....and I don't think anyone is just going to write a whole mission of scripts for you. Try searching using different search terms.... make an attempt at it yourself and then come back with the problems encountered. So that you have an appreciation of what might be involved have a look at the scripting commands here.
  5. Hi mate... and welcome to the forums. All your answers are right here in the "Sticky Threads" at the top section of this forum. This is what you want:- http://forums.bistudio.com/showthread.php?t=78089 It pay off big time if you look around first before asking :)
  6. ninja'd with my edit.... but yes. Sit and think for a minute.
  7. Does the hint return a list of buildings? EDIT:- If it does.... you will never find "Land_House_L_1_EP1" in there! You have to use typeOf with the items in the list for it to work. That's what you're not grasping. The light will eventually come on I'm sure!!!!:)
  8. In simple form.... A useless but simple example to return the height (z value) of an object Create a file called "fn_getZ.sqf" in your mission folder. fn_getZ.sqf:- private ["_obj","_z"]; _obj = _this select 0; _z = getPos _obj select 2; _z In your init.sqf (precompile):- getZ = compile preprocessFileLineNumbers "fn_getZ.sqf"; To call:- _height = [_plane] call getZ; _height will contain the height (z value) of the _plane. This returns a single value. If you can't figure out returning an array I can post another example for you.
  9. I use TextPad 4 and use this file for hilighting.... it's easy to add to it if you need to. Works for me!
  10. The strings must match exactly. Try this... add the line in bold red to the buildInMarker script and run the code. Then look in your .rpt file and you will see all the building types (classnames) found in the marker. You have to use names chosen from these. if (_inmrkr) then { [b][color="Red"]diag_log format ["%1",typeOf _build];[/color][/b] if (typeOf _build in (_buildings_to_check_4)) then { _builds_in_mrkr set [count _builds_in_mrkr,_build]; _mrk = format ["%1", diag_ticktime]; _m = createMarkerLocal [_mrk, _pos]; _m setMarkerTypeLocal "mil_dot"; _m setMarkerColorLocal "colorRED"; _m setMarkerSizeLocal [1, 1]; }; }; Alternatively... look here and use these names. Classnames can also be found in this post here. Galzohars post also shows you how to filter the list. It's not that hard!
  11. Hi... welcome to the forum. Place the aircraft on the deck in the editor and put this in it's init box. this setPosASL [getPos this select 0, getPos this select 1, 18]; This will set it to it's current x,y position... but it's z coordinate (height) is now 18m above sea level.
  12. Try this to find specific buildings using the stuff in my demo. Replace the call and the script buildInMarker.sqf. You have to add an array to the call of the types of buildings you want to find. Call with:- nul = ["mkr1",[b]["Land_HouseV_1I4","Land_Shed_W4","Land_HouseV_1I3"][/b]] execVM "buildInMarker.sqf"; Then I changed the script buildInMarker.sqf to:- _mkr = _this select 0; _buildings_to_check_4 = _this select 1; _mkrsiz = markersize _mkr; _mkrszx = _mkrsiz select 0; _mkrszy = _mkrsiz select 1; _mkrpos = getmarkerpos _mkr; _longside = _mkrszx max _mkrszy; _builds = nearestObjects [_mkrpos, ["Building"], _longside]; _inmrkr = false; _builds_in_mrkr = []; for "_i" from 0 to (count _builds - 1) do { _build = _builds select _i; _pos = getpos _build; _inmrkr = [_mkr,_pos] call fnc_InMarker; if (_inmrkr) then { if (typeOf _build in (_buildings_to_check_4)) then { _builds_in_mrkr set [count _builds_in_mrkr,_build]; _mrk = format ["%1", diag_ticktime]; _m = createMarkerLocal [_mrk, _pos]; _m setMarkerTypeLocal "mil_dot"; _m setMarkerColorLocal "colorRED"; _m setMarkerSizeLocal [1, 1]; }; }; sleep 0.01; }; The array _builds_in_mrkr will now only contain those types of buildings if they exist. The code is also placing markers at the locations of the buildings found to show what's going on. EDIT: I'm writing this just for you as a one off..... so rename the scripts, variables, etc... to whatever you want... I'm running out of original names for scripts! lol!
  13. Yes... in the demo... the script buildInMarker.sqf is finding all buildings in the marker using the function fnc_InMarker.sqf and placing them in the array _builds_in_mrkr. You then have to filter this list to find the buildings you want. Then it does the same thing again using the script buildInTrigger.sqf which uses the function fnc_InTrigger.sqf. So you have an example for both triggers and markers in the one demo. If you didn't already know this...you can increase the sleep values in the script to slow down the hints.
  14. Here is the BIS_fnc_InTrigger modified to work with markers. It might help you. Tests whether a position is in a rectangular or elliptical marker area. Returns true or false. In init.sqf:- fnc_InMarker = compile preProcessFile "fnc_InMarker.sqf"; fnc_InMarker.sqf:- /* ****fnc_InMarker.sqf ****BIS_fnc_InTrigger modified by twirly to work with markers. ****Sept 1st 2011 Description: Detects whether is position within marker area. Parameter(s): _this select 0: Marker _this select 1: Position _this select 2: OPTIONAL - scalar result (distance from border) Returns: Boolean (true when position is in area, false if not). */ private ["_mkr","_object","_posx","_posy","_tstuff","_tx","_ty","_tdir","_tshape","_in"]; _mkr = _this select 0; _position = _this select 1; _scalarresult = if (count _this > 2) then {_this select 2} else {false}; _posx = getmarkerpos _mkr select 0; _posy = getmarkerpos _mkr select 1; _tstuff = markersize _mkr; _tx = _tstuff select 0; _ty = _tstuff select 1; _tdir = markerdir _mkr; _tshape = markershape _mkr; _in = false; if (_tshape == "RECTANGLE") then { //--- RECTANGLE _difx = (_position select 0) - _posx; _dify = (_position select 1) - _posy; _dir = atan (_difx / _dify); if (_dify < 0) then {_dir = _dir + 180}; _relativedir = _tdir - _dir; _adis = abs (_tx / cos (90 - _relativedir)); _bdis = abs (_ty / cos _relativedir); _borderdis = _adis min _bdis; _positiondis = _position distance getmarkerpos _mkr; _in = if (_scalarresult) then { _positiondis - _borderdis; } else { if (_positiondis < _borderdis) then {true} else {false}; }; } else { //--- ELLIPSE _dis = sqrt abs(_tx^2 - _ty^2); _posF1 = [_posx + (sin (_tdir) * _dis),_posy + (cos (_tdir) * _dis)]; _posF2 = [_posx - (sin (_tdir) * _dis),_posy - (cos (_tdir) * _dis)]; _n = _tx max _ty; _total = 2 * _n; _dis1 = _position distance _posF1; _dis2 = _position distance _posF2; _in = if (_scalarresult) then { (_dis1 + _dis2) - _total; } else { if (_dis1 + _dis2 < _total) then {true} else {false}; }; }; _in Call with:- _test = ["mkrname",_pos] call fnc_InMarker.sqf; Where:- "mkrname" is the name of the marker _pos is the position you are checking Returns true or false. Hope it helps. EDIT: Here's the mission I was using to test. Both a trigger and a marker are used in the test....so both functions there. Of course this is just a part of the puzzle..... but you can build an array of buildings in the marker or trigger and then filter that list to find out if any of the buildings you are interested in are there.
  15. BIS_fnc_InTrigger might help you there. I've never used it but it is in the Functions Module. Here is part of the comments for the script...will help with how to call it. Description: Detects whether is position within trigger area. Parameter(s): _this select 0: Trigger _this select 1: Position _this select 2: OPTIONAL - scalar result (distance from border) Returns: Boolean (true when position is in area, false if not).
  16. I've bought 3 sets of Arma 2, OA, BAF and PMC and given them to my mates...but they still won't play because it's not really playable with the warping! So I for one cannot wait until the networking stuff is sorted out. Keep up the good work BIS!
  17. I'm calculating the points radially every 1 degree and stepping out a 100m at a time.... so a point may not necessarily be on the road but most likely will end up near a road. Might have a re-think about the calcs and using isOnRoad. Cheers for that.
  18. I had a look at this but nearRoads does not seem to be too reliable. 9 out of 10 times it's not returning road segments that are close to the points that I'm generating. So..that sort of shut me down right away.
  19. Just about anything is possible with some thought... See if this post helps you..... but try searching for yourself next time. It really wasn't that hard to find. http://forums.bistudio.com/showthread.php?t=78066&highlight=insertion%2Fextraction There are also many other post about this.....so do a search!
  20. Good page here.... http://seit.unsw.adfa.edu.au/coursework/ZEIT2305/Resources/SQF_Tutorial/basic_sqf.HTML EDIt: Added.....quoted from that page. SQF is faster. SQF can be used to make functions and scripts. SQF improves the program flow. SQF is structured, SQS is rarely as structured as SQF. This should make the natives even more restless!:)
  21. My bad. Disregard this post.. Try this.... In the triggers init... [s]nul = [thislist] execVM "spy.sqf";[/s] ...and for spy.sqf.... [s]if (isserver) then { _triglist = _this; _count = count _triglist; _num = floor (random _count); _spy = _triglist select _num; }; hint format["%1 is a spy!", _spy]; _spy setvehiclevarName "spy";[/s] Tested and working fine. Oops! Not working.
  22. Have you checked to see what's in _triglist ? If _triglist is any then try initializing it before the if statement with _triglist = [];
  23. I didn't quite get it either! Was no need for it.
  24. I came up with almost the same thing as Demonized and Cobra.... might as well post! if (not isServer) exitWith {}; _unit = _this select 0; _number = _this select 1; switch (_number) do { case 0: {_unit setDammage 1}; case 1: {_unit setVelocity [0,0,50]}; case 2: {_unit setDammage 0}; case 3: {{if (side _x==east) then {_x setDamage 1}} forEach allUnits}; };
×