Announcement

Collapse
No announcement yet.

Need scripting help

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need scripting help

    I am trying to create a random variable in the init file so these variables can be used in the briefing for my TvT mission. Problem: Random runs differently on each client. Here is my code:


    obj1=round(random 4);
    obj2=round(random 3);

    if(side player == west) then {
    if(obj1==0) then {tskobj_1 = player createSimpleTask ["Destroy UAV Trailer"];};
    if(obj1==1) then {tskobj_1 = player createSimpleTask ["Destroy Food Storage"];};
    if(obj1==2) then {tskobj_1 = player createSimpleTask ["Destroy Ammo Dump"];};
    if(obj1==3) then {tskobj_1 = player createSimpleTask ["Destroy Radar Unit"];};
    if(obj1==4) then {tskobj_1 = player createSimpleTask ["Destroy HQ"];};

    if(obj2==0) then {tskobj_2 = player createSimpleTask ["Destroy Vehicle Pool"];};
    if(obj2==1) then {tskobj_2 = player createSimpleTask ["Destroy Fuel Dump"];};
    if(obj2==2) then {tskobj_2 = player createSimpleTask ["Destroy Artillery Guns"];};
    if(obj2==3) then {tskobj_2 = player createSimpleTask ["Destroy ZU-23 Trucks"];};
    };

    How can I create ONE random variable on the SERVER and copy it to the clients? Right now, clients were creating their own random numbers. This is so all of Blufor has the same objectives.

  • #2
    Re: Need scripting help

    =49th=OPS give me some helpful links, one of them was a link to MultiTask on Armaholic. Its tool 4 creating MP tasks on server and load it to clients. Try search this:

    //MultiTask.sqf
    //Core script of the MutliTask multiplayer-compatible task system
    //Version 0.1.4
    //By Deadfast (http://deadfast.armaholic.eu)

    If u will not find i can send u files, poke me in TS..

    sry 4 my engl again :)

    BTW it helps me set correct task status 4 JIPs

    Comment


    • #3
      Re: Need scripting help

      Code:
      if (isServer) then
      {
          taskVar1 = floor(random 4);
          taskVar2 = floor(random 5);
          publicVariable "taskVar1";
          publicVariable "taskVar2";
      };
      
      switch (taskVar1) do
      {
          case 0:
              {taskObj1 = yadayada;};
          case 1:
              {taskObj1 = yadayada;};
          case 2:
              {taskObj1 = yadayada;};
          case 3:
              {taskObj1 = yadayada;};
          default 
              {hint "Something went wrong...";};
      };
      
      switch (taskVar2) do
      {
          case 0:
              {taskObj2 = yadayada;};
          case 1:
              {taskObj2 = yadayada;};
          case 2:
              {taskObj2 = yadayada;};
          case 3:
              {taskObj2 = yadayada;};
          case 4:
              {taskObj2 = yadayada;};
          default 
              {hint "Something went wrong...";};
      };
      Should work.

      I don't know how this would work with JIPs, though.
      Blackpython / ZephyrDark
      Former 31st RECCE Member

      Comment


      • #4
        Re: Need scripting help

        Originally posted by ZephyrDark View Post
        Code:
        if (isServer) then
        {
            taskVar1 = floor(random 4);
            taskVar2 = floor(random 5);
            publicVariable "taskVar1";
            publicVariable "taskVar2";
        };
        
        switch (taskVar1) do
        {
            case 0:
                {taskObj1 = yadayada;};
            case 1:
                {taskObj1 = yadayada;};
            case 2:
                {taskObj1 = yadayada;};
            case 3:
                {taskObj1 = yadayada;};
            default 
                {hint "Something went wrong...";};
        };
        
        switch (taskVar2) do
        {
            case 0:
                {taskObj2 = yadayada;};
            case 1:
                {taskObj2 = yadayada;};
            case 2:
                {taskObj2 = yadayada;};
            case 3:
                {taskObj2 = yadayada;};
            case 4:
                {taskObj2 = yadayada;};
            default 
                {hint "Something went wrong...";};
        };
        Should work.

        I don't know how this would work with JIPs, though.
        Thanks, not caring about JIPs since it is a non-jip mission.

        Comment


        • #5
          Re: Need scripting help

          Can always just tell the JIPs what's going on, and leave it at that anyway.

          Pepper

          "If you find yourself in a fair fight, you didn't plan your mission properly." David Hackworth

          Comment


          • #6
            Re: Need scripting help

            Now I need help with the spectating part.

            I want players who are dead OR JIP to spectate using the built in ACE spectating mode. Jips on joining goto a black screen. Players come back as seagulls. I want both to go to the spectator script. Tried following the API on the spectate class but no luck so far. Is extra code needed?

            Comment


            • #7
              Re: Need scripting help

              anyone?

              Comment


              • #8
                Re: Need scripting help

                Don't use ACE Spectator? Theres some other ones out there that work fine.
                Blackpython / ZephyrDark
                Former 31st RECCE Member

                Comment


                • #9
                  Re: Need scripting help

                  Originally posted by ZephyrDark View Post
                  Don't use ACE Spectator? Theres some other ones out there that work fine.
                  Recommendations?

                  Comment

                  Connect

                  Collapse

                  TeamSpeak 3 Server

                  Collapse

                  Advertisement

                  Collapse

                  Twitter Feed

                  Collapse

                  Working...
                  X