Jump to content

LoonyWarrior

Member
  • Content Count

    110
  • Joined

  • Last visited

  • Medals

Everything posted by LoonyWarrior

  1. LoonyWarrior

    loop performance

    look at expample n. 2... thats the point... and question is...
  2. LoonyWarrior

    loop performance

    when u have IF statement... is fater if ( true ) or its same as if ( 1 > 0 ) ....the true statement in first case is already done..
  3. LoonyWarrior

    loop performance

    huh ? method 1: while { true } { if (myVariable > 0) then { do something.... }; sleep 1; }; method 2: while { true } { if (processMyVar) then { do something.... }; sleep 1; }; this is NOT same ?
  4. LoonyWarrior

    loop performance

    its example and i thought that i will get theoretical answer.. :( limitScore = false; limitTime = false; if (scoreLimit > 0) then { limitScore = true; }; if (timeLimit > 0) then { limitTime = true; }; while { true } { if (limitScore) then { if (scoreLimit..........) then { do something.... }; }; if (limitTime) then { if (timeLimit ..........) then { do something.... }; }; sleep 1; }; its based on that i know that limitScore and limitTime will never change inside the loop.... is it theoretical faster ?
  5. again... u CANT send this whole text to all clients... "GlobalHint" addPublicVariableEventHandler { hint parseText (_this select 1); }; .....this will do NOTHING on machine which triggered publicVariable ""; ---------- Post added at 19:40 ---------- Previous post was at 19:39 ---------- why format ?
  6. try this.. it will show task states with icons... as in showcases.. [player, "objShootDown", ["description", "title", "marker"], objNull, false] call BIS_fnc_taskCreate; ["objShootDown", "Succeeded"] call BIS_fnc_taskSetState; that function simply doesnt work...... so... u re the best......
  7. LoonyWarrior

    Setting a kill/point limit?

    let me try... :) init.sqf enableSaving [false, false]; sGameOver = nil; pLimitScore = 30; pLimitTime = 600; if (isServer) then { #include "initServer.sqf" }; if (!isDedicated) then { #include "initClient.sqf" }; initServer.sqf if (isServer) then { if (pLimitScore > 0 || pLimitTime > 0) then { _sLimitScript = [pLimitScore, pLimitTime] execVM "Server\_server.sqf"; }; }; initClient.sqf if (!isDedicated) then { #include "Client\functions.sqf" cTaskMain = nil; if (!isServer) then { "sGameOver" addPublicVariableEventHandler { call SetMissionEnd; }; }; waitUntil { !isNull player }; ["objMarkerMain"] spawn SetMissionTask; }; Client\functions.sqf if (!isDedicated) then { SetMissionEnd = { if (!isNil "sGameOver") then { if (!isNull player) then { _taskState = "Failed"; _victory = false; if (side player == east and sGameOver == "END1") then { _taskState = "Succeeded"; _victory = true; }; if (side player == west and sGameOver == "END2") then { _taskState = "Succeeded"; _victory = true; }; if (!isNil "cTaskMain") then { cTaskMain setTaskState _taskState; }; [sGameOver, _victory, 2] call BIS_fnc_endMission; } else { endMission sGameOver; }; }; }; SetMissionTask = { if (!isNull player && isNil "cTaskMain") then { _taskMarker = _this select 0; if (!isNil "_taskMarker") then { cTaskMain = player createSimpleTask ["objMainTask"]; cTaskMain setSimpleTaskDestination (getMarkerPos _taskMarker); cTaskMain setSimpleTaskDescription [Localize "MissionTaskDescription", Localize "MissionTaskTitle", Localize "MissionTaskWaypoint"]; player setCurrentTask cTaskMain; }; }; }; }; Server\_server.sqf if (isServer) then { _end = nil; _limitScore = _this select 0; _limitTime = (_this select 1) - 2; _processScore = false; _processTime = false; if (!isNil "_limitScore" && !isNil "_limitTime") then { if (_limitScore > 0) then { _processScore = true; }; if (_limitTime > 0) then { _processTime = true; }; while { isNil "_end" } do { _scoreEast = scoreSide east; _scoreWest = scoreSide west; if (_processScore) then { if (_scoreEast >= _limitScore || _scoreWest >= _limitScore) then { if (_scoreEast > _scoreWest) then { _end = "END1"; }; if (_scoreEast < _scoreWest) then { _end = "END2"; }; }; }; if (_processTime) then { _timeLeft = _limitTime - time; if (_timeLeft <= 0) then { if (_scoreEast > _scoreWest) then { _end = "END1"; }; if (_scoreEast < _scoreWest) then { _end = "END2"; }; if (_scoreEast == _scoreWest) then { _end = "END3"; }; }; }; if (!isNil "_end") then { sGameOver = _end; publicVariable "sGameOver"; if (!isDedicated && !isNil "SetMissionEnd") then { call SetMissionEnd; } else { endMission _end; }; } else { sleep 2; }; }; }; }; description.ext debriefing = 1; class CfgDebriefing { class End1 { title = "end1 title"; subtitle = "end1 subtitle"; description = "end1 description"; picture = "b_inf"; pictureColor[] = {0.0,0.3,0.6,1}; }; class End2: End1 { title = "end2 title"; description = "end2 description"; }; class End3: End1 { title = "end3 title"; description = "end3 description"; }; };
  8. looks like u didnt get the joke... your code... is completly wrong... u have server and u have clients... and as u know u have to have defined variable on the server and then make it public aka send that to clients.. (thats what your code do) but you re missing the client side.. clients dont know what to do when they get your variable.......... "serverVariable" PublicVariableEventHandler { do something }; ...when serverVariable is published.... do some thing.. if (isServer) then { ObjCompletedFunction = { serverVariable = true; publicVariable "serverVariable"; if (!isDedicated) { call SomeFunction; }; }; }; if (!isServer) then { "serverVariable" addPublicVariableEventHandler { call SomeFunction; }; }; if (!isDedicated) { SomeFunction = { if (!isNil "serverVariable") then { use serverVariable...... bla bla bla.... show hint.... }; }; }; on server.... objective completed......... call ObjCompletedFunction; and u CANT send this whole text to all clients.......... send true, false or number.... think about net traffic.. and localization..........
  9. LoonyWarrior

    how to spawn function in trigger

    ..thats it ...thx !
  10. hi.. is it possible to spawn function with trigger ? Trigger on Activation h = spawn MyFuncion; right now im doing the same with execVM calling additional script file.. and since this script have 6 rows of code i would like to avoid this.. thx for advice... Loony
×