lmapper Posted February 23, 2014 Report Share Posted February 23, 2014 How to interact with players located nearby? For example, I have to add health to all who are close to me. principle: Who _nearplayers ? { addhealth _nearplayers; }; How to implement this condition? Thanks ! Link to comment Share on other sites More sharing options...
0 lmapper Posted February 23, 2014 Author Report Share Posted February 23, 2014 Here you go: /*REMOTE STUFF*/ /*Heals any "Man" Object in "distance" meters but not the zombies and animals.*/ /*----------------------#YOU_CAN_CHANGE_THESE#----------------------------*/ distance = 500; /*----------------------#YOU_CAN_CHANGE_THESE#----------------------------*/ xyzaa = (getPosATL player) nearObjects ["Man", distance]; { if (!(_x isKindOf "zZombie_Base") and !(_x isKindOf "Animal")) then { _unit = _x; usecBandage = [_unit]; publicVariable "usecBandage"; {_unit setVariable[_x,false,true];} forEach USEC_woundHit; _unit setVariable ["USEC_injured",false,true]; _unit setVariable["USEC_lowBlood",false,true]; usecTransfuse = [_unit]; publicVariable "usecTransfuse"; _unit setVariable ["NORRN_unconscious", false, true]; _unit setVariable ["USEC_isCardiac",false,true]; _unit setVariable['medForceUpdate',true,true]; usecMorphine = [_unit]; publicVariable "usecMorphine"; "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5; usecPainK = [_unit,player]; publicVariable "usecPainK"; _unit setVariable["medForceUpdate",true]; _text = format["%1 healed", xyzaa]; titleText [_text,"PLAIN DOWN"]; titleFadeOut 8; }; } forEach xyzaa; This is an heal script for all the players in 500m. Credits: Healp script I need heal all players near one other player. Can you tell me what part of the code is looking for players around the outside of one player? This ? xyzaa = (getPosATL player) nearObjects ["Man", distance]; And what makes this thing? And what makes this thing? Thanks ! Link to comment Share on other sites More sharing options...
0 lmapper Posted February 23, 2014 Author Report Share Posted February 23, 2014 if you want to select a player connected on your server via a scroll menu use this: Modified scripts by me: healp + spectate _mycv = cameraView; _n2sh = 10; _n2c = "Select Player:"; shnext = false; nlist = []; selecteditem = ""; if (isNil "spectate") then {spectate = true;} else {spectate = !spectate;}; if (spectate) then { {if (_x != player) then {nlist set [count nlist, name _x];};} forEach playableUnits; shnmenu = { _pmenu = [["",true],[_n2c, [-1], "", -5, [["expression", ""]], "1", "0"]]; for "_i" from (_this select 0) to (_this select 1) do {_arr = [format['%1',nlist select (_i)], [_i - (_this select 0) + 2], "", -5, [["expression", format["selecteditem = nlist select %1;",_i]]], "1", "1"];_pmenu set [_i+2, _arr];}; if (count nlist > (_this select 1)) then {_pmenu set [(_this select 1)+2, ["Next", [12], "", -5, [["expression", "shnext = true;"]], "1", "1"]];} else {_pmenu set [(_this select 1)+2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]];}; _pmenu set [(_this select 1)+3, ["Exit", [13], "", -5, [["expression", "selecteditem = 'exitscript';"]], "1", "1"]]; showCommandingMenu "#USER:_pmenu"; }; _j = 0; _n2sh = 10; if (_n2sh>9) then {_n2sh=10;}; while {selecteditem==""} do { [_j,(_j+_n2sh) min (count nlist)] call shnmenu;_j=_j+_n2sh; WaitUntil {selecteditem!="" or shnext}; shnext = false; }; if (selecteditem!= "exitscript") then { _name = selecteditem; { if(format[name _x] == _name) then { r_player_blood = 11999; r_player_inpain = false; r_player_infected = false; r_player_injured = false; dayz_hunger = 0; dayz_thirst = 0; dayz_temperatur = 100; r_fracture_legs = false; r_fracture_arms = false; r_player_dead = false; r_player_unconscious = false; r_player_loaded = false; r_player_cardiac = false; r_player_lowblood = false; r_player_timeout = 0; r_handlerCount = 0; disableUserInput false; dayz_sourceBleeding = objNull; player setVariable ["USEC_injured",false,true]; {player setVariable[_x,false,true];} forEach USEC_woundHit; player setVariable ["unconsciousTime", r_player_timeout, true]; player setHit ['legs',0]; player setVariable ['hit_legs',0,false]; player setVariable['medForceUpdate',true,true]; /*REMOTE STUFF*/ /*Heals any "Man" Object in "distance" meters but not the zombies and animals.*/ /*----------------------#YOU_CAN_CHANGE_THESE#----------------------------*/ distance = 500; /*----------------------#YOU_CAN_CHANGE_THESE#----------------------------*/ xyzaa = (getPosATL player) nearObjects ["Man", distance]; { if (!(_x isKindOf "zZombie_Base") and !(_x isKindOf "Animal")) then { _unit = _x; usecBandage = [_unit]; publicVariable "usecBandage"; {_unit setVariable[_x,false,true];} forEach USEC_woundHit; _unit setVariable ["USEC_injured",false,true]; _unit setVariable["USEC_lowBlood",false,true]; usecTransfuse = [_unit]; publicVariable "usecTransfuse"; _unit setVariable ["NORRN_unconscious", false, true]; _unit setVariable ["USEC_isCardiac",false,true]; _unit setVariable['medForceUpdate',true,true]; usecMorphine = [_unit]; publicVariable "usecMorphine"; "dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5; usecPainK = [_unit,player]; publicVariable "usecPainK"; _unit setVariable["medForceUpdate",true]; _text = format["%1 healed", xyzaa]; titleText [_text,"PLAIN DOWN"]; titleFadeOut 8; }; } forEach xyzaa; }; } forEach playableUnits; }; spectate = false; }; Execute this -> select a player from the list that shows up (you will not be in that list) -> it will heal the player + all players in "distance = x" choose that distance Thanks ! What if I need to throw out of the car all the players seated in a car with a player who fulfill certain conditions? How do I know who is sitting with him, and to expel them? Link to comment Share on other sites More sharing options...
0 lmapper Posted February 23, 2014 Author Report Share Posted February 23, 2014 Wow, that I do now know :-P I would need to work on that script but I atm do not have much time. Look on the internet, there are man scripts available :) I do not require a script, I just wanted you to help me understand the principle on which I can write this script. I need to know who is sitting in a car with a player, and how to use the effect on these players. Thank you! Link to comment Share on other sites More sharing options...
0 Axe Cop Posted February 23, 2014 Report Share Posted February 23, 2014 you can simply use the crew command: https://community.bistudio.com/wiki/crew _playersInVehicle = crew vehicle player; and then you have an array with all players in the vehicle where the "player" (or whatever other player you specify) is sitting in. TheVampire 1 Link to comment Share on other sites More sharing options...
0 lmapper Posted February 24, 2014 Author Report Share Posted February 24, 2014 you can simply use the crew command: https://community.bistudio.com/wiki/crew _playersInVehicle = crew vehicle player;and then you have an array with all players in the vehicle where the "player" (or whatever other player you specify) is sitting in. But as the action to apply to the entire array? Just like that? _veh = vehicle player; if (player = driver _veh) { _array = (crew _veh); _rightarray = _array - (_array select 0); // commentOne _rightarray action ["getout",_veh]; }; //CommentOne: Remove from the array driver, I have to pull out all but the driver. (I think in the crew _array driver will be on the 1st place in _array). Link to comment Share on other sites More sharing options...
0 Axe Cop Posted February 24, 2014 Report Share Posted February 24, 2014 yeah your idea is good, but the script won't work like that i guess. 1. to remove one element from an array you have to substract another array and not a single element, so make it like _rightarray = _array - [_array select 0]; // commentOne it is not the same if you use ( ) or [ ] :D 2. you can't perform actions on the array, just loop through it and send the action so a single unit: { _x action ["getout", _veh]; } forEach _rightarray; _x is a single unit from the _rightarray array in that for each loop. Link to comment Share on other sites More sharing options...
0 lmapper Posted February 24, 2014 Author Report Share Posted February 24, 2014 yeah your idea is good, but the script won't work like that i guess. 1. to remove one element from an array you have to substract another array and not a single element, so make it like _rightarray = _array - [_array select 0]; // commentOne it is not the same if you use ( ) or [ ] :D 2. you can't perform actions on the array, just loop through it and send the action so a single unit: { _x action ["getout", _veh]; } forEach _rightarray; _x is a single unit from the _rightarray array in that for each loop. Link to comment Share on other sites More sharing options...
Question
lmapper
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now