JacobJ 10 Posted April 19, 2011 Hey all I have a point-system that I would like to start from the lobby. This ive got to work, but in the lobby I have an option to display the points on the fly in the task menu. The problem is that it will only show "Points", which is the title of the simple task i have created. It doesnt show, what I want it to show, and that is "Current point status: mst". mst is a variable that I have from another script. Here is the scripts: Points.sqf if (!isServer) exitWith {}; //starting points _points = 1600; while {true} do { _humres = 0; _humdes = 0; _tower = 0; //The triggers if !(alive tower) then {_tower = 250}; if !(alive hummer) then {_humdes = 100}; if (triggerActivated humrescue) then {_humres = 250}; //The calculation mst = _points + ((blufor) * -100) + ((opfor) * 50) + (_humdes + _humres + _tower) + (cyw * -400); publicVariable "mst"; hint str mst; sleep 1; }; Pointsintask.sqf if (!isServer) exitWith {}; if (paramsarray select 5 == 1) then { sleep 12; tskPoints = {_x createSimpleTask ["Points"]} foreach allunits; while {true} do { {tskPoints setSimpleTaskDescription [format ["Current point status: %1",mst],format ["Current point status: %1",mst],format ["Current point status: %1",mst]]} foreach allunits; sleep 1; }; }; How can this be? Is there something wrong with the pointsintask.sqf? I get no script errors... /Jacob Share this post Link to post Share on other sites
shuko 45 Posted April 20, 2011 Tasks are unit and client specific. So using if (!isServer) exitWith {}; to limit the script only to the server will pretty much guarantee that it's not updated on clients (players). Edit: In Pointsintask.sqf, of course. Share this post Link to post Share on other sites
JacobJ 10 Posted April 20, 2011 Okay, but how do I do it then? The just foreach allunits doesnt work. Share this post Link to post Share on other sites
JacobJ 10 Posted April 20, 2011 Somehow the forEach thing doesnt seem to work. If I remove the {_x} foreach allunits; and replace it by player createSimpletask bla bla, then it works as it should, but only on my computer, not on anyone else joining. Share this post Link to post Share on other sites
shuko 45 Posted April 20, 2011 As I said, tasks are unit specific as well as client specific. If you use a loop to create a task, the last task/unit will be stored in your tskPoints. Every other unit's task variable is gone. Thus, you can't update them. ---------- Post added at 12:07 PM ---------- Previous post was at 12:04 PM ---------- You need something like this: creation: tskPointsHandles = []; { _tsk = _x createsimpletask... _tsk setdesc... tskPointsHandles set [count tskPointsHandles,_tsk]; } foreach allunits; update: { _x setdesc... } foreach tskPointsHandles Share this post Link to post Share on other sites
JacobJ 10 Posted April 20, 2011 I am sorry if I am a bit stupid, but could you explain what these lines do? The update code, where does it go, or is that a substitution for the other code? Share this post Link to post Share on other sites