Jump to content

Tuliq

Member
  • Content Count

    118
  • Joined

  • Last visited

  • Medals

Everything posted by Tuliq

  1. UPDATED: 07.04.2013! Thought I'd post this. This is a simple more advanced killticker I've created for use in my own missions. Thought some other people might have use of it as well. It's not hard to implement. For AI it displays classname of unit, for player it displays user name. It shows a maximum of 8 kills at a time, but this you are of course free to change. killTicker.sqf tlq_killTicker = { _this addMPEventHandler ['MPKilled',{ _unit = _this select 0; _killer = _this select 1; _newKill = [_unit,_killer]; if (count tlq_killArray > 100) then {tlq_killArray = []}; tlq_killArray set [count tlq_killArray,_newKill call tlq_parseKill]; [] spawn tlq_killList; if (player == _killer) then {_newKill spawn tlq_killPopUp}; } ]; }; tlq_parseKill = { _line = ""; _killerName = ""; _victimName = ""; _killerString = ""; _victimString = ""; _killerColor = "#99D5FF"; _victimColor = "#99D5FF"; _victim = _this select 0; _killer = _this select 1; if (!(isplayer _killer)) then { _killerName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _killer] >> "Displayname"); if(vehicle _killer != _killer) then {_killerName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _killer] >> "Displayname")}; }else{_killerName = name _killer}; if (!(isplayer _victim)) then { _victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname"); if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")}; }else{_victimName = name _victim}; if ((_killer==player) or (_killer == vehicle player)) then { _killerColor = "#ffff00"; //yellow } else { _killerColor = side group _killer call BIS_fnc_sideColor; _r = _killerColor select 0; _g = _killerColor select 1; _b = _killerColor select 2; _killerColor = [_r+0.1,_g+0.1,_b+0.1]; _killerColor = _killerColor call BIS_fnc_colorRGBtoHTML; }; if (_victim==player) then { _victimColor = "#ffff00"; //yellow } else { _victimColor = side group _victim call BIS_fnc_sideColor; _r = _victimColor select 0; _g = _victimColor select 1; _b = _victimColor select 2; _victimColor = [_r+0.1,_g+0.1,_b+0.1]; _victimColor = _victimColor call BIS_fnc_colorRGBtoHTML; }; _killerString = format["<t color='%1'>%2</t>",_killerColor ,_killerName]; _victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName]; //the line which shows the final formatted kill _line = switch(true) do { case(_killer == _victim): {format ["%1 killed themselves",_killerString]}; case(isNull _killer): {format ["Bad luck for %1",_victimString]}; default {format ["%1 killed %2",_killerString,_victimString]}; }; _line; }; tlq_killPopUp = { _victim = _this select 0; _killer = _this select 1; _victimName = ""; _victimString = ""; _victimColor = "#99D5FF"; if (!(isplayer _victim)) then { _victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname"); if(vehicle _victim != _victim) then {_victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")}; }else{_victimName = name _victim}; _victimColor = (side group _victim call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML; _victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName]; _line = if ((_killer == player) and (_victim == player)) then { "<t size='0.5'>You killed yourself</t>"; } else { format ["<t size='0.5'>You killed %1</t>",_victimString]; }; [_line,0,0.8,2,0,0,7017] spawn bis_fnc_dynamicText; }; tlq_killList = { //flush kills and show most recent if (time - tlq_killTime > 37) then { tlq_displayedKills = []; }; tlq_displayedKills set [count tlq_displayedKills, tlq_killArray select (count tlq_killArray - 1)]; _tickerText = ""; _c = 0; for "_i" from (count tlq_displayedKills) to 0 step -1 do{ _c = _c + 1; _tickerText = format ["%1<br />%2",tlq_displayedKills select _i,_tickerText]; if (_c > 8) exitWith{}; }; hintsilent parsetext _tickerText; //["<t size='0.4' align='right'>" + _tickerText + "</t>",safeZoneX,safeZoneY,10,0,0,7016] call bis_fnc_dynamicText; tlq_killTime = time; }; //declare global variables tlq_killArray = []; tlq_displayedKills = []; tlq_killTime = 0; //start kill registration for player if (!isNull player) then { player spawn tlq_killTicker; }; if (isServer) then { //ai { if (!(isPlayer _x)) then { _x spawn tlq_killTicker}; } forEach allUnits; }; Hotfix 07.04.2013: Tweaked things regarding dedicated servers Changes 31.03.2013: Fixed bug that caused no kills to get displayed clientside Fixed deletion of kills when lot of kills were happening Moved kill detection clientside because of locality issues Changes 30.03.2013: Fixed bugs that caused script not to fire Brightened up colors on kills to increase readability Made global variables unique as to not interfere with other scripts Added "tlq_killTicker_init" variable to check if script has initialized Changes 21.03.2013: Now registers much more accurately for aoe-based weapons (grenades, bombs) Kill detection handled by server (or hosting player) Colors for killed players now reflect their ingame color (blufor blue, opfor red). Fixed some bugs relating to unexpected types of deaths Now registers kills for ALL editor-placed units by default (includes playable units waiting to spawn) Known bugs: When player disconnects from an ai-disabled slot, script will fire. Installation: Place in your mission folder and run "killTicker.sqf" from init.sqf like so: null = execVM "killTicker.sqf"; To add kill detection to units created during mission, run the following command after creation: yourunitName spawn tlq_killTicker;
  2. Well spawn only returns the script handle for the spawned script so no wonder things went out of control.
  3. Don't need a handle for scripts called with spawn! ;)
  4. hard coded into arma afaik
  5. Tuliq

    Class base ammo box

    We need to know what the mps_ammobox function looks like. . ---------- Post added at 13:04 ---------- Previous post was at 13:03 ---------- looks like you didn't define it
  6. [["taskOne","Succeeded",true],"BIS_fnc_taskSetState",nil,true] spawn BIS_fnc_MP!
  7. Tuliq

    They better have female soldiers...

    Its 2035 who knows maybe they are jacked up on steroids and nanos.
  8. There is another way to do this which i feel is probably the best way. Use setmarkerposlocal to set the position of a marker locally on a players computer, independent from all other players. Just make a simple "if" check, and if the player is a pilot, then do a "respawn_west" setmarkerposlocal [your pilot spawn coordinates]. ---------- Post added at 11:41 ---------- Previous post was at 11:38 ---------- F.ex "respawn_west" setmarkerposlocal getpos player will make units respawn at the same position you placed them in the editor
  9. You could make a trigger and write in the condition field !alive anton then in on activation write hint "Anton is dead. He is with us no more. Anton was a brave man who fought with great honor for his country. We shall never forget his memory or his boundless sacrifice to our common cause. Viva la Anton!"; I hope this helps!
  10. That seems strange... BIS's own splendid cam displays icons, so I guess there must be a way to do it.
  11. Tuliq

    multiplayer money system

    You have to make sure that the script only runs on the killers machine dude. player addMPEventHandler ["MPKilled",{ _killer = _this select 1; if (_killer == player) then { _killer execVM "killed.sqf"; }; } ]; alt: player addMPEventHandler ["MPKilled",{ _killer = _this select 1; if (_killer == player) then { mymoney = mymoney + 100; }; } ];
  12. Tuliq

    overdrive Lamps ?

    Driving over? I am confused.
  13. if(isNil "myIcons") then { myIcons = addMissionEventHandler["draw3d",{ { if(side _x != side player) then { drawIcon3D ["", [1,0,0,0.7], visibleposition _x, 1, 1, 45, (format ["%2:%1m",player distance _x, name _x]), 1, 0.03, "default"]; } else { drawIcon3D ["", [0,1,0.5,0.4], visibleposition _x, 1, 1, 45, (format ["%2:%1m",player distance _x, name _x]), 1, 0.03, "default"]; }; } foreach allunits; } ]; }; Maybe that would work? I am not sure. Worth a shot! I also replaced position _x with visibleposition, learned that from KK, and it gives it a lot smoother updating. Eh, made a mistake. fix'd it!
  14. Don't give a shit about people saying COD is shit and this is arma and blah blah blah... if you want to make a COD like mission, then go do it. If you want to make a Peggle Extreme like mission, go do it. Because that is Arma. Freedom to play like you want.
  15. So I have a UI resource which I want to place in the lower right corner of the screen. It's a vertical list of the names of players connected to the game. I want this list to be displayed at the same relative position on the screen through all aspect-ratios and interface-sizes. Right now, it looks good and sits in place when I am in the "small" interface size, but my friend who has interface size set to "normal" will have this list of names cut off on his screen. What would I have to do to ensure that this list stays at the same relative spot on the screen for both of us?
  16. It doesn't overlap for me, but it does for other interface sizes other than small. I guess I should keep the values within the 0 - 1 range?
  17. You might be right. That is what I am using though. Here is my resource definition. class RscTitles { class sniperList { idd = -1; fadeout=0; fadein=0; duration = 1; name= "sniperList"; onLoad = "uiNamespace setVariable ['sniperList', _this select 0]"; class controlsBackground { class sniperListText:RscStructuredText { idc = 6000; type = CT_STRUCTURED_TEXT; size = 0.047; x = 0.856875 * safezoneW + safezoneX; y = 0.686927 * safezoneH + safezoneY w = 0.3; h = 0.5; colorText[] = {1,1,1,1}; lineSpacing = 4; colorBackground[] = {0,0,0,0}; text = ""; font = "PuristaMedium"; shadow = 2; class Attributes { align = "right"; }; }; }; }; }; I stole the gist of it from another script, so I am not sure about if this is the proper way to make a simple list resource. I am a total noob at dialogs.. ---------- Post added at 16:03 ---------- Previous post was at 15:59 ---------- For now I have just moved the resource a tiny bit more to the left, so that if a player is using the normal interface size, he will see it.
  18. objectPos = [firstObject,4,random(360)] call bis_fnc_relPos; 4 = radius from center, firstObject
  19. thanks, onplayerdisconnected mixed with some UID magic did the trick.
  20. Hi, anyone know how to test for if a player has left the server? In other words, if I have a variable that refers to a player, what will this variable refer to when the player has disconnected?
  21. Tuliq

    Operators inside a string

    Hmm, have a look at bis_fnc_param. It is a function used inside a lot of BIS functions to handle function parameters. ---------- Post added at 01:04 ---------- Previous post was at 00:56 ---------- you should place the marker name / spawn pos as the first index of the passed array, and the model type second, or vice versa, since they are the most important parameters passed. Also, you can do away with the _minNumberOf var. Just pass _numberOf as an array if you want random amount of objects (like [4,19] four being the min, 19 the max), or as a number for an exact amount. ---------- Post added at 01:08 ---------- Previous post was at 01:04 ---------- Also, while I can see that having an option to name all your placed objects according to a formula is great, you might have an easier time just returning an array of all the created objects at the end of the function. then you could call it like this: _myWonderfulArrayOfObjects = [YOUR ARGUMENTS] call fnc_ranPos _myWonderfulArrayOfObjects would then be an array of all the objects. ---------- Post added at 01:11 ---------- Previous post was at 01:08 ---------- For super easy-peasy mode, make the spawnpos parameter only accept a position array [x,y,z]. Then you don't have to rely on only using markers and units to spawn.
  22. Tuliq

    Operators inside a string

    _tyre = "Land_Tyres_F" createVehicle (_position); missionNameSpace setVariable [format["tyres%1",_i],_tyre]; setVariable uses a string to name the variable, so you can use format command on it to set the variable name
  23. No that is impossible as far as I know.
  24. Tuliq

    Available Vehicles

    You need to place an unit and set is as playable before you can run the mission, also you need to save your mission before you can play it if you are running MP mode.
×