Page 6 of 15 FirstFirst ... 2345678910 ... LastLast
Results 51 to 60 of 141

Thread: TPW HOUSELIGHTS - automatic house light addon

  1. #51
    Quote Originally Posted by tpw View Post
    Hmm, http://www.kylania.com/ex/?p=26 suggests otherwise, which is why I and many others use if (!isServer) exitWith {}; to make our scripts run on clients but not servers.
    Code:
    if (isDedicated) exitWith {};
    and the script will run on clients only. No matter if it is a client playing on a dedicated server or a client in a hosted environment (including the host which is both, client and server, thus isServer is true for the host).

    if (!isServer) exitWith is for scripts which should only run on a server (including a host in a hosted environment).

    Xeno

  2. #52
    "[KH]Jman" tested it as the host of a non dedicated server and because that, "!isServer" wasn't true for him.

  3. #53
    First Sergeant
    Join Date
    Oct 30 2009
    Location
    Brisbane, Australia
    Posts
    981
    Author of the Thread
    I'm a bit confused!

    Why does if (!isServer) exitWith {} work in SP and MP clients then? I remember being told long ago by someone to always include that code in the head of my scripts to keep them off servers.

    Anyway, thanks for trying to enlighten me Rockhount and Xeno. I'll try if (isDedicated) exitWith {};

  4. #54
    I would recommend against starting the script from the init line of a playable (including player) unit for a MP mission. Pretty sure that that the init line is not run unless somebody actually choses (jip or not) the specific unit which has the init line.

    There is no real need for the server to create the lights and manage it for all players. Just create all the lights locally for each player. If the algorithm does not depend on random elements then the result would be the same. Even if it does it probably doesn't matter. A lot of things isn't synced entirely in Arma. I think for instances that dead bodies may lie in different postures for each player in MP. I would do as Xeno suggests running the script on all client machines and create the lights locally for each player, starting the script for all in init.sqf or something like that.

  5. #55
    First Sergeant
    Join Date
    Oct 30 2009
    Location
    Brisbane, Australia
    Posts
    981
    Author of the Thread
    Ok, so I've been hard at work thinking and refining this thing. Here's v1.03:
    • Wrote my own flickering routine which hopefully achieves an approximation of Rydygier's, but with less calculation.
    • Wrote a flexible light-type system. You can add (or remove) as many light-types as you like, each with configurable colour, brightness and flickering.
    • Changed the code regarding (not) executing on dedi servers.


    It should run on MP but each player will see different lights due to the randomisation. The CPU and network overhead to synchronise these visuals would be pretty high, and beyond my shit coding abilities.

    I will put up an addon version shortly.

    Thanks again for the input everyone!

    Spoiler:
    Last edited by tpw; May 19 2012 at 13:30.

  6. #56
    v1.03 is erroring out tpw.

    Here is a snippet from my .RPT:
    Code:
    File C:\Users\******\Documents\ArmA 2 Other Profiles\*********\mpmissions\********\common\client\ambient_lights.sqf, line 40
    Error in expression <20,5], 
    _tv = [100,200,255,60,30,100,30]]; 
    _ratio = [4,2,1]; 
    
    
    
    
    _lightarray =>
      Error position: <]; 
    _ratio = [4,2,1]; 
    
    
    
    
    _lightarray =>
      Error Missing ;
    and here as well:
    Code:
    Error in expression <n player);
    
    {deletevehicle _x;} foreach tpw_lithouses; tpw_lithouses = []; 
    
    if >
      Error position: <tpw_lithouses; tpw_lithouses = []; 
    
    if >
      Error Undefined variable in expression: tpw_lithouses
    File C:\Users\*******\Documents\ArmA 2 Other Profiles\*******\mpmissions\*******\common\client\ambient_lights.sqf, line 97
    EDIT: Error came from taking the code from the first post, the code given in the post above is error free.
    Last edited by bigshotking; May 20 2012 at 21:37.

  7. #57
    First Sergeant
    Join Date
    Oct 30 2009
    Location
    Brisbane, Australia
    Posts
    981
    Author of the Thread
    Thanks bigshotking. A rogue ] crept in when I was doing the final edit of the script version before uploading it. That's what you get for scripting late at night.

    It should work as advertised for you now. The addon version is fine.

    Cheers
    tpw


    Quote Originally Posted by bigshotking View Post
    v1.03 is erroring out tpw.

    Here is a snippet from my .RPT:
    Code:
    File C:\Users\******\Documents\ArmA 2 Other Profiles\*********\mpmissions\********\common\client\ambient_lights.sqf, line 40
    Error in expression <20,5], 
    _tv = [100,200,255,60,30,100,30]]; 
    _ratio = [4,2,1]; 
    
    
    
    
    _lightarray =>
      Error position: <]; 
    _ratio = [4,2,1]; 
    
    
    
    
    _lightarray =>
      Error Missing ;
    and here as well:
    Code:
    Error in expression <n player);
    
    {deletevehicle _x;} foreach tpw_lithouses; tpw_lithouses = []; 
    
    if >
      Error position: <tpw_lithouses; tpw_lithouses = []; 
    
    if >
      Error Undefined variable in expression: tpw_lithouses
    File C:\Users\*******\Documents\ArmA 2 Other Profiles\*******\mpmissions\*******\common\client\ambient_lights.sqf, line 97
    EDIT: Error came from taking the code from the first post, the code given in the post above is error free.

  8. #58
    I haven't read the recent pages fully, so please excuse me if it should have been mentioned.
    It seems as if the GLOBAL command createvehicle #lightpoint only works locally. The light only shows up where the command has been executed. Concerning randomness (colours and which houses are lit), the server should make globalvariable'd arrays that the clients have to use.

    Btw, using totally randomized colours for many houses does NOT look that bad at all (_light setLightColor [random 1,random 1,random1]). This way, Zargabad at night for example with many total-randomized houselights looks nice (some kind of cosy and colourful Orient of auld lang syne).

  9. #59
    Hello tpw,
    it is great to see, how a "little thing" is growing up! Now v 1.03
    Well done mate and thx to all who help this smart guy!

    That´s how com works! Fantastic!
    Cheers
    McLupo

  10. #60
    Sergeant Major
    Join Date
    Sep 21 2006
    Location
    In ze mountains
    Posts
    1,445
    The link to v1.03 is broken on Armaholic.
    Foxhound: could you please fix it?

Page 6 of 15 FirstFirst ... 2345678910 ... LastLast

Similar Threads

  1. Addon automatic rifle AK-9
    By DAK in forum ARMA 2 & OA - ADDONS & MODS: DISCUSSION
    Replies: 13
    Last Post: Aug 15 2010, 22:19
  2. Chimney smoke / House light
    By Nephris1 in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: Aug 4 2010, 09:33
  3. Need help for add light in an house
    By XPETIT in forum ADDONS & MODS: DISCUSSION
    Replies: 0
    Last Post: Jun 16 2004, 20:00
  4. Replies: 1
    Last Post: Jun 15 2002, 14:04
  5. Working light house
    By walker in forum ADDONS & MODS: COMPLETE
    Replies: 2
    Last Post: Jun 2 2002, 23:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •