Jump to content

riouken

Member
  • Content Count

    570
  • Joined

  • Last visited

  • Medals

Everything posted by riouken

  1. No you can not change much about the built in function, but you can build your own Dialog or Resource with your own custom specs. http://community.bistudio.com/wiki/DialogControls-Text#Static_Videos Here is an example from some of my work: class controls { class videobkgrd: cms_RscPicture { idc = 1201; text = "cms_sys\gui\EKG_Trial2_0.OGG"; autoplay = 1; loops = 1000; x = 0.420312 * safezoneW + safezoneX; y = 0.30875 * safezoneH + safezoneY; w = 0.215313 * safezoneW; h = 0.310926 * safezoneH; }; class RscButton_1600: cms_RscButton { idc = 1600; x = 0.729102 * safezoneW + safezoneX; y = 0.2875 * safezoneH + safezoneY; w = 0.0502084 * safezoneW; h = 0.0303703 * safezoneH; }; class RscButton_1601: cms_RscButton { idc = 1601; x = 0.739062 * safezoneW + safezoneX; y = 0.3725 * safezoneH + safezoneY; w = 0.0252084 * safezoneW; h = 0.0424073 * safezoneH; }; };
  2. That fire mission is all kinds of wrong, take a look at the wiki. If you dont want to pre-place static battery's then use the virtual's: http://community.bistudio.com/wiki/Artillery_Module#Virtual_Artillery http://community.bistudio.com/wiki/Artillery_Module#Creating_fire_missions Here is a arty template from one of my systems. It includes some stuff to talk back to the caller.
  3. This should work: _gamelogic = CENTER; _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; _RandomTownPosition = position (_towns select (floor (random (count _towns)))); { _pos = position _x; _m = createMarker [format ["mrk%1",random 100000],_pos]; _m setMarkerShape "ELLIPSE"; _m setMarkerSize [500,500]; _m setMarkerBrush "Solid"; _m setMarkerAlpha 0.5; _m setMarkerColor "ColorRed"; } forEach _towns;
  4. riouken

    Combat Medical System

    This is looking good guys, nice work!
  5. You can take a look at the scripts in rMsgBox to see how I did it. http://forums.bistudio.com/showthread.php?144227-rMsgBox-Easy-and-Customizable-GUI-Message-box
  6. Congratz! nice work Tankbuster.
  7. You have to provide at-least 2 positions in an array. I would try creating a function that tracks the players pos every second for say 5 -10 seconds and stores it in an array, then execute that function. rinse and repeat, in theory it should follow you around like a puppy dog. Let me see if I can write something up real quick. ---------- Post added at 07:20 PM ---------- Previous post was at 07:01 PM ---------- This is not tested but I hope this helps. _target = _this select 0; _path = []; while {alive _target} do { _seedtime = time + 10; While {time < _seedtime} do { _newpos = getposATL _target; _path set [count _path,_newpos]; sleep 1; }; _nul = [_atv1,_path] spawn BIS_animateMoveSmooth; sleep .01; _path = []; };
  8. You might find this useful, I discovered this little gem in the game files, it is hardly documented anywhere, but BIS used it animate targets and such. (This was written by a BIS dev as far as I know) I made a quick demo a long time ago as a proof of concept, please ignore the sound and this was just a test. Here is the function: functions_animations.sqf BIS_animateMoveSmooth = { private["_sleep","_object","_posStart","_posEnd","_deltax","_deltay","_deltaz","_distance","_tmax","_a","_vmax","_t","_ssaved","_animList","_animPhase","_progress","_posx","_posy","_posz","_anim","_taccel","_saccel","_sconst","_tconst"]; private["_wps","_positions","_distancesStart","_distancesPrev","_refWP","_ghostBall","_time","_hoverHeight","_dir"]; _sleep = 0.01; //delay between each anim frame, lower values = smoother animation _object = _this select 0; _wps = _this select 1; //array of all animation WPs //hover height if (count _this > 4) then { _hoverHeight = _this select 4; }; //---------------------------------------------------------------------------------------------- //positioning & animating along waypoints ------------------------------------------------------ _positions = []; //array of all WP positions _distancesStart = []; //array of WPs distances from the beginning of the animation _distancesPrev = []; //array of WPs distances from the previous WP _refWP = _wps select 0; private["_d","_dTotal","_tmpPos"]; _d = 0; _dTotal = 0; { //storing position of each WP //it's WP object if (typeName(_x) == "OBJECT") then { _tmpPos = getPosASL _x; if (_x == player) then { _tmpPos = [_tmpPos select 0, _tmpPos select 1, (_tmpPos select 2) + 0.8]; }; //it's position } else { _tmpPos = _x; }; _positions = _positions + [_tmpPos]; //total from the start _d = _x distance _refWP; _dTotal = _dTotal + _d; _distancesStart = _distancesStart + [_dTotal]; //from previous WP _distancesPrev = _distancesPrev + [_x distance _refWP]; _refWP = _x; } forEach _wps; //current WPs _wpStart = 0; _wpEnd = _wpStart + 1; //count positions _posStart = _positions select _wpStart; _posEnd = _positions select _wpEnd; //count delta x,y,z _deltax = (_posEnd select 0) - (_posStart select 0); _deltay = (_posEnd select 1) - (_posStart select 1); _deltaz = (_posEnd select 2) - (_posStart select 2); _dir = [_posStart,_posEnd] call BIS_fnc_dirTo; _object setDir (_dir-180); //display object at start position if isNil("_hoverHeight") then { _object setPosASL (_positions select 0); } else { _object setPos [(_positions select 0) select 0, (_positions select 0) select 1,_hoverHeight]; }; //---------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------- //_vmax if (count(_this) > 2) then { _vmax = _this select 2; } else { _vmax = 15; }; //_a if (count(_this) > 3) then { _a = _this select 3; } else { _a = 5; }; //acceleration path _taccel = _vmax/_a; _saccel = 1/2 * _a * _taccel * _taccel; //distance (of whole animation) _distance = _distancesStart select (count(_distancesStart) - 1); //["_distance",_distance] call BIS_debugLog; //distance too short if (2*_saccel > _distance) then { //["DISTANCE IS TOO SHORT"] call BIS_debugLog; //["_saccel (raw)",_saccel] call BIS_debugLog; //["_taccel (raw)",_taccel] call BIS_debugLog; _saccel = _distance/2; _taccel = sqrt(_distance/_a); //["_saccel (fixed)",_saccel] call BIS_debugLog; //["_taccel (fixed)",_taccel] call BIS_debugLog; //distance is too short -> object wont reach max speed _vmax = _a * _taccel; //there is no constant speed part in middle _sconst = 0; _tconst = 0; //distance is fine } else { //["DISTANCE IS FINE"] call BIS_debugLog; _sconst = _distance - 2*_saccel; _tconst = _sconst/_vmax; }; //total time _ttotal = 2*_taccel + _tconst; _t = 0; _tmax = _taccel; _ssaved = 0; _animList = []; _animPhase = 0; _animList = _animList + [{1/2 * _a * _t * _t}]; _animList = _animList + [{_vmax * _t}]; _animList = _animList + [{_vmax * _t - 1/2 * _a * _t * _t}]; _time = time; private["_sleepTime","_tover"]; _tover = 0; while {_animPhase < count(_animList)} do { _t = _t + _sleep; _sleepTime = time; sleep _sleep; //real sleep time calculations _sleepTime = time - _sleepTime; _t = _t - _sleep + _sleepTime; if (_t > _tmax) then { _tover = _t - _tmax; _t = _tmax; }; _anim = _animList select _animPhase; _s = call _anim; //------------------------------------------------------------------------------------------ //positioning & animating along waypoints -------------------------------------------------- _movedFromStart = _ssaved + _s; //searching for acctual _wpStart & _wpEnd while {_movedFromStart > _distancesStart select _wpEnd} do { _wpStart = _wpStart + 1; _wpEnd = _wpStart + 1; //["Current waypoints:",format["%1 -> %2",_wpStart,_wpEnd]] call BIS_debugLog; //count positions _posStart = _positions select _wpStart; _posEnd = _positions select _wpEnd; //count delta x,y,z _deltax = (_posEnd select 0) - (_posStart select 0); _deltay = (_posEnd select 1) - (_posStart select 1); _deltaz = (_posEnd select 2) - (_posStart select 2); //set direction _dir = [_posStart,_posEnd] call BIS_fnc_dirTo; _object setDir (_dir-180); }; //progress part -> object positioning _movedBetweenWPs = _movedFromStart - (_distancesStart select _wpStart); _progress = _movedBetweenWPs / (_distancesPrev select _wpEnd); if (_progress > 1) then { _progress = 1; }; _posx = (_posStart select 0) + _deltax * _progress; _posy = (_posStart select 1) + _deltay * _progress; _posz = (_posStart select 2) + _deltaz * _progress; if isNil("_hoverHeight") then { _object setPosASL[_posx,_posy,_posz]; } else { _object setPos[_posx,_posy,_hoverHeight]; }; //["_movedFromStart",_movedFromStart] call BIS_debugLog; //["_movedBetweenWPs",_movedBetweenWPs] call BIS_debugLog; //["_progress",_progress] call BIS_debugLog; //["_posx",_posx] call BIS_debugLog; //create a ghost-ball /* _ghostBall = "sign_sphere25cm_ep1" createVehicle [0,0,0]; _ghostBall setObjectTexture [0,"#(argb,8,8,3)color(0.8,0.5,0.5,0.5,ca)"]; _ghostBall setPosASL[_posx,_posy,_posz]; */ //------------------------------------------------------------------------------------------ if (_t == _tmax) then { _animPhase = _animPhase + 1; //[format["Animation ID%1 finished at distance %2 (took %3 secs)!",_animPhase-1,_ssaved + _s,_tmax]] call BIS_debugLog; //skip the middle part (animationPhase 1) if its time == 0 if (_animPhase == 1 && _tconst == 0) then { _animPhase = _animPhase + 1; //["Animation ID1 skipped!"] call BIS_debugLog; }; if (_animPhase == 1) then { _tmax = _tconst; } else { _tmax = _taccel; }; //_t = 0; _t = _tover; _ssaved = _ssaved + _s; }; }; private["_pos"]; _pos = _positions select (count(_positions) - 1); if isNil("_hoverHeight") then { _object setPosASL _pos; } else { _object setPos [_pos select 0, _pos select 1, _hoverHeight]; }; }; //_sqf = this spawn {_i=0;while {true} do {_i=_i+2;if(_i>360)then{_i=_i-360;};_this setDir _i;sleep 0.01;};}; BIS_animateRotate = { private["_object","_dir","_i"]; _object = _this select 0; _dir = getDir(_object); _i = _dir; while {true} do { _i = _i + 2; if (_i > 360) then {_i = _i-360;}; _object setDir _i; sleep 0.02; }; }; BIS_animateUpDown = { private["_object","_s","_t","_v","_a","_pos","_sleep","_smax","_tmax","_vmax","_startPos"]; _sleep = 0.02; //delay between each anim frame, lower values = smoother animation _object = _this select 0; _smax = _this select 1; //animation length [m] _tmax = _this select 2; //animation time [sec] _a = 2*_smax/(_tmax*_tmax); //_acceleration _vmax = _a * _tmax; //animation speed [m/sec] _t = 0; _pos = getPosASL(_object); _startPos = _pos; _animList = []; _animPhase = 0; //move-up and decelerate _animList = _animList + [{+1 * (_vmax * _t - 1/2 * _a * _t * _t)}]; //move-down and accelerate _animList = _animList + [{-1 * (1/2 * _a * _t * _t)}]; //move-down and decelerate _animList = _animList + [{-1 * (_vmax * _t - 1/2 * _a * _t * _t)}]; //move-up and accelerate _animList = _animList + [{+1 * (1/2 * _a * _t * _t)}]; while {true} do { _t = _t + _sleep; if (_t > _tmax) then { _t = _tmax; }; sleep _sleep; _anim = _animList select _animPhase; _s = call _anim; _object setPosASL[_pos select 0,_pos select 1,(_pos select 2) + _s]; if (_t == _tmax) then { _animPhase = _animPhase + 1; _t = 0; if (_animPhase == count(_animList)) then { _animPhase = 0; }; _pos = [_pos select 0,_pos select 1,(_pos select 2) + _s]; }; }; //reposition bact to start pos _object setPosASL _startPos; }; Compile it like this: BIS_animateMoveSmooth = compile preprocessFile "functions_animations.sqf"; You call it by passing the object to be moved or animated and then providing a list of postions or objects that you want it to path over. Example: _nul = [_objectthatsmoving, [[x,y,z], [x,y,z] , [x,y,z], [x,y,z]]] spawn BIS_animateMoveSmooth;
  9. What about taking the vector of your player or detector, and then checking if it intersects with your ied. http://community.bistudio.com/wiki/intersect I'm not sure if this will work but its worth a shot. I have never used that command.
  10. It might be easier to use a script, this type of stuff has been done a lot, here is one of the more popular ones: http://forums.bistudio.com/showthread.php?91696-UPSMON-Urban-Patrol-Script-Mon
  11. addAction is a local command, if you put the addAction in the init of an object, every client will run it. Also you can hard code it in the init.sqf. If you want to add an Action to a object you have to make sure all clients run that command.
  12. You have to tab out of the game and paste it into notepad/text editor. It copies the data to your clipboard.
  13. You say _this in your text and then in your code you have _item. How are you populating _item. _this is a protected var and you should never override it. It is used to refer to items passed to the script.
  14. riouken

    MP Dynamic missions

    SOM was never written or intended for dedi or multiplier. I think there have been a few improvements along the way to help with MP compatibility, but in my opinion the amount of work involved for the little bit you get with SOM, its not worth it to try and make it work in your MP mission. There are several well written missions with random elements to missions or totally random missions. MSO as Tupolov already mentioned. Domination by xeno I think TFOR has some random missions as well. Also there is a chopper transport mission, I think its called workhorse or something. I wish I could remember what the exact name and author was. Your not going to find any simple scripts that does this, its a big task with lots of scripts to get this type of system into a mission and working for MP and Jip. Thats why you only see custom scripts that are tailored to a specific mission.
  15. No this is a dialog, That would have to be a Resource. I may look into some options for that. But that would be for ver 2.0.
  16. You would do it in a script. Usually people use the onLoad feature to load a scirpt when ever the dialog is called. class WF_main_dlg { idd = 1775; movingEnable = true; [color=#ff0000]onLoad = "// The code in here will be called every time your ui element is loaded or created. ";[/color] objects[] = {}; class controlsBackground { But if you are using this as a hud of sorts, In the same script you call the ui element right after you create the ui element I would spawn another thread and have your loop in there. Since you will never close the ui element since its a hud.
  17. When you create your ui element, you use a command Either createDialog for a dialog or CutRsc for a resource. A dialog stops the users interface(control) of the game, like the map. A resource is just an overlay, and can not be interacted with by the player, like the compass. Before you call either one of those, the. Ui element does no exist, its just defined in the description.ext so you can't interact by scripting commands with it untill you create it for the user.
  18. The code deadfast posted should be ran after you create your dialog or cutrsc. If your using this like a hud, then you could put this in a loop and have it update the hud every second or two. ---------- Post added at 02:40 PM ---------- Previous post was at 02:37 PM ---------- Also you should take off those AS_PLO prefix tags, you should come up with and use your own prefix. Otherwise you will have compatibility problems if you try and use another gui with those same prefix's on the base classes.
  19. riouken

    Tutorials on GUI.

    No the only tutorial that I knew of has been taken down on ofpec. Unforntinaty there are not that many people that can write gui's well so there are not that many tutorials. It is probably one of the harder things to do. You just have to go out and dig into them and look at examples and then code it yourself to learn. If you get stuck on something feel free to post the spacific question here and we will be glad to help. Here are some important links to get you started. First the wiki with examples: http://community.bistudio.com/wiki/Dialog_Control Gui related commands: http://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control GUI Editor - Once you know how the basic config set up works and can get one in game working this will help alot with designing and getting a new gui off the ground but it will not do all the work for you. http://community.bistudio.com/wiki/User_Interface_Editor_(Arma_2) http://forums.bistudio.com/showthread.php?115250-User-Interface-Editor Once you get a feel for the basics here are some great examples to learn from: (I would not recommend this till you get your head around it first, cause it can be pretty overwhelming at first.) http://forums.bistudio.com/showthread.php?57825-Dialog-Template-plus-Standard-Dialogs Anything from Dr EyeBall is good stuff. Here is a demo mission with just a simple GUI that I did for the Arma2MySQL example mission. It wont do anything with out the Database but you can see how I set it up. and the basics on how to get one into a mission. That's all that's in it is the gui. https://sites.google.com/site/armatutorials/home/videos/AS_PLO_GUI.utes.zip?attredirects=0&d=1
  20. I don't think there is a way while the player is spawning in. You will have to wait until the player is not nul: waitUntil { !(isNull player) };[color=#000000][font=Lucida Console] [/font][/color]
  21. When you say unit, are you referring to the slot or body he will spawn into or are you referring to the reference to him.
  22. Here you go: http://community.bistudio.com/wiki/6thSense.eu:EG#Determining_if_machine_is_Ingame_Server.2C_Ded_Server.2C_Player_or_JIP_Player
  23. Yes, you just have to pass the information to the script, it doesn't care about where the info comes from. So in your veh spawn script, after you create a veh just pass the reference of that veh and the desired perams and execVM the script. ---------- Post added at 09:50 AM ---------- Previous post was at 09:46 AM ---------- _veh = createVehicle ["ah1w", position player, [], 0, "NONE"];[color=#000000][font=Lucida Console] [/font][/color] _null = [[color=#000000][font=Lucida Console]_veh[/font][/color], 15, 10, 5, TRUE, FALSE] execVM "vehicle.sqf";
×