Jump to content

37 posts in this topic Last Reply

Recommended Posts

EDIT: In this thread, boformer contributes a script to allow you to add lights to a prop whilst in the asset editor. Best is to install ModTools locally (also explained a few posts down) and run the Asset Editor in -noWorkshop mode. Once you have imported your prop, hit F7 to open the ModTools window. Copy and paste the script into the input box in ModTools and either press Enter or click "run". The light effects should immediately appear. In the script, you can control the position and rotation of the light effect. Later in the thread are examples for 3 light effects and 4 light effects, which have been tested and work! 

Here is the script:

// --- FIRST LIGHT EFFECT ---

// Used light effect
var lightEffect1 = EffectCollection.FindEffect("Flood Light Orange") as LightEffect;

// Final position in prop
var pos1 = new Vector3(0f,10f,-1f); 
// this would be near the center of the prop, 10m above ground

// Final direction in prop
var dir1 = new Vector3(0f,1f,0f);
// this would be up

var propEffect1 = new PropInfo.Effect {m_effect = lightEffect1, m_position = pos1, m_direction = dir1 };


// --- SECOND LIGHT EFFECT ---

var lightEffect2 = EffectCollection.FindEffect("Flood Light Orange") as LightEffect;
var pos2 = new Vector3(0f,10f,1f); 
var dir2 = new Vector3(0f,1f,0f);

var propEffect2 = new PropInfo.Effect {m_effect = lightEffect2, m_position = pos2, m_direction = dir2 };


// Apply effects to prop
var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
asset.m_effects = new PropInfo.Effect[] { propEffect1, propEffect2};
asset.m_hasEffects = true;

 

---------------------------------------------

ORIGINAL POST:

 

I'm trying to add lights to this Rail Lighting tower prop. Does anyone know how to do it?

20170221015631_1.thumb.jpg.e00a050936f3afffb2bc4324fe34c54e.jpg

Share this post


Link to post
Share on other sites
  • Original Poster
  • If you all don't mind, I'm gonna use this thread to ask more questions about finishing this light prop. I've made progress, deciding to go with a bigger texture for the main model 256x256. We're down under 1k tris now yay (942).

    20170221143058_1.thumb.jpg.9f07f21739576dac9b2139da35fe757b.jpg

    Two questions:

    1. What should be my target tris for the LOD?

    2. I've been loading the Asset Editor after using "-noWorkshop" in the launch settings. If I don't, it crashes. I tried disabling all mods and all assets in the content manager but the game struggles with that as well. So now I've gotta use ModTools to edit this prop for lights while creating it in the Editor, right? Can I somehow load ModTools locally while in "-noWorkshop" mode?

    Share this post


    Link to post
    Share on other sites
    1. Unpack this folder into C:\Users\USERNAME\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\000_ModTools
    2. If you can't find the AppData folder, perform a Windows Search: %Appdata%
    3. Start the game, enable the mod
    4. Restart the game, open the Asset Editor.

    LOD could be 18 tris: two cubes on top of eachother.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Awesome! Thank you. Do I have to do this with Network Skins as well?

     

    Also, I discovered something funny. I used the common path Lamp  #1 as a template for the model, and look what it did:

    20170221150946_1.thumb.jpg.0b6d1452d88f93f275c38eb0624afda0.jpg

    it added the light in the place where the path lamp would be. That was a surprise.

    Share this post


    Link to post
    Share on other sites
    8 minutes ago, AmiPolizeiFunk said:

    Awesome! Thank you. Do I have to do this with Network Skins as well?

    Restarting the game? No. Use a local copy? No, you don't need the mod enabled when making the prop, only when using the prop in a city.

    You can use any mod locally like this, but not all mods work properly. You can find any mod or asset in: Steam\SteamApps\workshop\content\255710. The folder names match the Workshop ID, which can be found at the end of any Workshop item URL.

    Share this post


    Link to post
    Share on other sites
    4 minutes ago, AmiPolizeiFunk said:

    How about the target triangles for the LOD?

    24 minutes ago, Tim The Terrible said:

    LOD could be 18 tris: two cubes on top of eachother.

    EDIT: One cube for the base, one stretched cube for the rest

     

    Share this post


    Link to post
    Share on other sites
    51 minutes ago, AmiPolizeiFunk said:

    Also, I discovered something funny. I used the common path Lamp  #1 as a template for the model, and look what it did:

     

    it added the light in the place where the path lamp would be. That was a surprise.

    If that works, you can probably do it without NetworkSkins. You just need Mod Tools to change the coordinates of the light effect.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • That would be cool. I'm looking through the sub-building tutorial now and am trying to create and XML but it's taking me a while.

     

    Can you mod the number of lights and type of lights in the mod tools? (The lamp just gives you one lamp ofc, while I would like 2 wall-mounted floodlights). I wonder if I could use one of GC_Vos's street lights as a template.

     

    I did another test w the Wall-Mounted Floodlight template, and sure enough, it puts one light at 0,0,0. Now I just need to figure out how to position it and duplicate it? Is all of this possible w ModTools?

    Share this post


    Link to post
    Share on other sites
    8 hours ago, AmiPolizeiFunk said:

    I did another test w the Wall-Mounted Floodlight template, and sure enough, it puts one light at 0,0,0. Now I just need to figure out how to position it and duplicate it? Is all of this possible w ModTools?

    Yes, but it requires a script, and I don't have the time to write it right now.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • I think I'm getting closer? So do I just edit these values whilst creating the object in the asset importer?

    20170222143252_1.thumb.jpg.90bbab2549d5a5ecbb0239fcb38d1d4f.jpg

     

    for my own reference... (direction x=0, y=-180, z=-25)

    Flood Light White
    Type: Spot
    Intensity: 8
    Blink Type: None
    Base Color: F0F0E6
    # Variation: FFF3F3
    # Variation: FFF8DF
    # Variation: EEFEFF

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • I found it w000000t! *:idea:*:D*:thumb: negative z is up, lol *:party:

     

    20170222154840_1.thumb.jpg.e02842fd3a0f3932c85a3dcdebbf3010.jpg

    Wow, you can make the light rotate! Who wants to make a lighthouse with a working rotating hi-power spotlight? Or a movie theater with a red carpet opening and spotlights shooting in patterns into the sky?

     

    I don't know how to add a second light. I tried to add another element to the m_effect array but it wouldn't let me.

    Share this post


    Link to post
    Share on other sites
    1 hour ago, AmiPolizeiFunk said:

    I found it w000000t! *:idea:*:D*:thumb: negative z is up, lol *:party:

    Wow, you can make the light rotate! Who wants to make a lighthouse with a working rotating hi-power spotlight? Or a movie theater with a red carpet opening and spotlights shooting in patterns into the sky?

    So to add a second light, I think I would need to add another element to the m_effect array? I tried to do that in ModTools but it wouldn't let me.

    You changed the wrong values. The "m_effect", the actual light effect, is not editable. The game won't save the effect.

    You can only take existing effects and place them on your prop (and change the position and rotation).

    The values of the "PropInfo+Effect" object are saved.

    Here is the internal code that saves the effect information:

    PropInfo.Effect effect2 = (PropInfo.Effect)o;
    w.Write(effect2.m_effect.name);
    w.Write(effect2.m_position);
    w.Write(effect2.m_direction);

    It's really just the name of the effect, the position and the direction.

    I'm not sure if you will see direct changes in the asset editor, but after a save and reload, the position and direction of your PropInfo+Effect should be updated.

    Share this post


    Link to post
    Share on other sites

    I made a script that adds 2 light effects to any prop: https://gist.github.com/boformer/9def9e179904092c0735ede28b4c1b85

    Just run that script in the Mod Tools console (F7) when your prop is loaded in the asset editor.

    You can easily add more light effects. A list of available effect strings (like "Flood Light Orange") can be found here: https://gist.github.com/boformer/4197263476ba10198501

    No mods are required to display the light effects. CO added support for this in one of the last updates.

    // --- FIRST LIGHT EFFECT ---
    
    // Used light effect
    var lightEffect1 = EffectCollection.FindEffect("Flood Light Orange") as LightEffect;
    
    // Final position in prop
    var pos1 = new Vector3(0f,10f,-1f); 
    // this would be near the center of the prop, 10m above ground
    
    // Final direction in prop
    var dir1 = new Vector3(0f,1f,0f);
    // this would be up
    
    var propEffect1 = new PropInfo.Effect {m_effect = lightEffect1, m_position = pos1, m_direction = dir1 };
    
    
    // --- SECOND LIGHT EFFECT ---
    
    var lightEffect2 = EffectCollection.FindEffect("Flood Light Orange") as LightEffect;
    var pos2 = new Vector3(0f,10f,1f); 
    var dir2 = new Vector3(0f,1f,0f);
    
    var propEffect2 = new PropInfo.Effect {m_effect = lightEffect2, m_position = pos2, m_direction = dir2 };
    
    
    // Apply effects to prop
    var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
    asset.m_effects = new PropInfo.Effect[] { propEffect1, propEffect2};
    asset.m_hasEffects = true;

     

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • What I have so far:

    20170222174248_1.thumb.jpg.0bd836ce6a9f400337786da5124a8004.jpg

    // --- FIRST LIGHT EFFECT ---
    
    // Used light effect
    var lightEffect1 = EffectCollection.FindEffect("Flood Light White") as LightEffect;
    
    // Final position in prop
    Vector3 pos1 = new Vector3(0f,18f,-1.1f); 
    // this would be near the center of the prop, 18m above ground
    
    // Final direction in prop
    Vector3 dir1 = new Vector3(0f,-1f,0f);
    // this would be down
    
    var propEffect1 = new PropInfo.Effect {m_effect = lightEffect1, m_position = pos1, m_direction = dir1 };
    
    
    // --- SECOND LIGHT EFFECT ---
    
    var lightEffect2 = EffectCollection.FindEffect("Flood Light White") as LightEffect;
    Vector3 pos2 = new Vector3(0f,18f,1.1f); 
    Vector3 dir2 = new Vector3(0f,-1f,0f);
    
    var propEffect2 = new PropInfo.Effect {m_effect = lightEffect2, m_position = pos2, m_direction = dir2 };
    
    
    // Apply effects to prop
    (GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_effects = new PropInfo.Effect[] { propEffect1, propEffect2};
    (GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_hasEffects = true;

    I'm trying to figure out how to angle the lights out a bit.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • We are in business!

    20170222175031_1.thumb.jpg.f448d75bfa8c28a77b05577d3f53a9de.jpg

    FINAL WORKING SCRIPT FOR RAIL LIGHTING TOWER:

    // --- FIRST LIGHT EFFECT ---
    
    // Used light effect
    var lightEffect1 = EffectCollection.FindEffect("Flood Light White") as LightEffect;
    
    // Final position in prop
    Vector3 pos1 = new Vector3(0f,18f,-1.1f); 
    // this would be near the center of the prop, 18m above ground
    
    // Final direction in prop
    Vector3 dir1 = new Vector3(0f,-1f,-0.3f);
    // this would be pointing down and a bit out
    
    var propEffect1 = new PropInfo.Effect {m_effect = lightEffect1, m_position = pos1, m_direction = dir1 };
    
    
    // --- SECOND LIGHT EFFECT ---
    
    var lightEffect2 = EffectCollection.FindEffect("Flood Light White") as LightEffect;
    Vector3 pos2 = new Vector3(0f,18f,1.1f);
    Vector3 dir2 = new Vector3(0f,-1f,0.3f);
    
    var propEffect2 = new PropInfo.Effect {m_effect = lightEffect2, m_position = pos2, m_direction = dir2 };
    
    
    // Apply effects to prop
    (GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_effects = new PropInfo.Effect[] { propEffect1, propEffect2};
    (GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_hasEffects = true;

    What programming language is this script written in?

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Published: https://steamcommunity.com/sharedfiles/filedetails/?id=869810547

     

    PreviewImage.png.0444742868be8750129c953aa0dd923e.png

     

    Here is another one, with 3 light effects:

    PreviewImage.png.02f15f64089b4aaaa8bbb262cf56f7ad.png

    https://steamcommunity.com/sharedfiles/filedetails/?id=877500410

     

    URBI 3 SCRIPT:

    // --- FIRST LIGHT EFFECT ---
    
    // Used light effect
    var lightEffect1 = EffectCollection.FindEffect("Street Light Highway") as LightEffect;
    
    // Final position in prop
    Vector3 pos1 = new Vector3(0f,5.75f,-1.3f); 
    // this would be near the center of the prop facing the street, 5,75m above ground
    
    // Final direction in prop
    Vector3 dir1 = new Vector3(0f,-1f,0f);
    // pointing down 
    
    var propEffect1 = new PropInfo.Effect {m_effect = lightEffect1, m_position = pos1, m_direction = dir1 };
    
    
    // --- SECOND LIGHT EFFECT ---
    
    // Used light effect
    var lightEffect2 = EffectCollection.FindEffect("Street Light Highway") as LightEffect;
    
    // Final position in prop
    Vector3 pos2 = new Vector3(0f,5.75f,1.3f); 
    // this would be near the center, on the other side, facing the street, 5,75m above ground
    
    // Final direction in prop
    Vector3 dir2 = new Vector3(0f,-1f,0f);
    // pointing down 
    
    var propEffect2 = new PropInfo.Effect {m_effect = lightEffect2, m_position = pos2, m_direction = dir2 };
    
    
    // --- THIRD LIGHT EFFECT ---
    
    var lightEffect3 = EffectCollection.FindEffect("Street Lamp") as LightEffect;
    Vector3 pos3 = new Vector3(-1f,3.5f,0f);
    // facing the sidewalk, 3.5m up
    Vector3 dir3 = new Vector3(0f,0f,0f);
    // not pointing (point light)
    
    var propEffect3 = new PropInfo.Effect {m_effect = lightEffect3, m_position = pos3, m_direction = dir3 };
    
    
    // Apply effects to prop
    (GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_effects = new PropInfo.Effect[] { propEffect1, propEffect2, propEffect3};
    (GameObject.Find("Tool Controller").GetComponent<ToolController>().m_editPrefabInfo as PropInfo).m_hasEffects = true;

     

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Well I noticed that there are variables in the light effects to say which axis to rotate and at what speed. I was able to edit them in ModTools, and the spotlight started animating round and round... looking just like a lighthouse or movie searchlight. If I knew how to make a quick .gif of it, I would have, cause it was really cool looking.

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account

    Sign In  

    Already have an account? Sign in here.

    Sign In Now


    • Similar Content

      • By heu3becteh
        Can you place props (like light and benches and whatever) in the Asset Editor precisely (be it grid snapping, display of coordinates or whatever)?
        For now the best I could do - is to check the coordinate values of props while placing them using Mod Tools, without being able to input them numerically.
        In Mod Tools there are a bunch of interesting properties found on...
        Tool Controller - PrefabInfo - BuildingInfo+Prop
        But I dunno if you can make changes made there affect the result?
        For now I just place Props and set colors as precisely as I can do it unprecisely (:
        Best regards.
      • By tariely
        Seeing how obsessed I am with lighting everything and the kitchen sink, a friend asked me if I could light Jenx QuaisdeSeine. I gamely tried. And found out it is way beyond my pay grade. The pieces swallow anything that is not the props specifically made by Jenx.
        My question is : is it possible to do that for light props (not lampadaires, they can be added easily and stay on see pic) but lightcones ? Would a kind soul do it for us if it is ? I was trying to use Jenx' own light cones -- the ones that go with his Pont Neuf. I'd added benches, also JENX-Porkissimo's, and you can see one peeking on the right ; Jenx made benches specifically for his pieces, OK, they can be used, but as for lightcones... naaah.


      • By airman15
        At the heart of any well-balanced city is an order legislated to guarantee the welfare of all who live inside it's jurisdiction. Law Enforcement is one of the most important branches to a government, ensuring safety to all. Even if it's a traffic ticket now and then or a donut shop being stormed. Your departments need a sturdy car and the Impala is the perfect fit! For when the going gets tough in the streets, these new cruisers are well-equipped to take on anything!
        About the Upload-
        This mod converts the Police Car into a modified Chevrolet Impala. There are 8 different liveries included, based on various police departments from the United States. The liveries included are not specific to any real cities, so they can blend into almost any setting within the game. The shields on each side are custom emblems from GM to promote the Impala as a police unit. Static props included.
        Dependencies?
        None required, but if you would like to see these units in action (besides their regular patrols), it's recommended to download the Lots of Riots mod, which will spawn more frequent uprisings that allow you to actually use the police dispatch tool!
      • By RaeFromStateFarm
        An asset i'm working on is having a weird light glitch that i first thought was because of the specular mask or something.
        I know it's most likely the police lights causing it, it only happens when the police lights are on and it seems the rotation of the lights light up certain parts of the car too.


        I'm guessing maybe the police lights are positioned awkwardly or in the center? 
        But i don't know where to begin in asset editor because when you position the police lights, you can't see the police lights while you're doing it like you can with headlights.
      • By RandyE
        Transfer here from one route to another. Transit and network enabled.
         ___           _                 
        | _ )_  _ ___ | |   ___  ___ _ __
        | _ \ || (_-< | |__/ _ \/ _ \ '_ \
        |___/\_,_/__/ |____\___/\___/ .__/
                                    |_|  
        City Bus Loop 1 - 3x2. 
        Capacity: 2500.
        Medium Wealth
        Plop Cost: 350
        Monthly Cost: 150
        Landmark Effect: 10,5
        Park Effect: 5, 5
        Air Pollution: 3, 2
        Water Pollution, 2, 2
        Maxis  Night Lighting
        Dependencies:
        Bus props used from: Glenni-buspack-
        RATP_Microbus-1
        RATP_Scania-Vest-HSD
        ORION-Old-MTAbus
        ORION-Old-MTAbusLongIsl
        Orion_VII_SacramentalRegionalTransit
         
        INSTALL to folder:
        C:\Users\<Username>\Documents\SimCity 4\Plugins
         
         
    • Recently Browsing   0 members

      No registered users viewing this page.

    ×

    Season's Greetings!

    xmas popup.jpg

    Thank You for the Continued Support!

    Simtropolis relies mainly on member donations to continue operating. Without your support, we just would not be able to be entering our 15th year online!  You've really help make this a great community.

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running, so that we can help keep bringing SimCity players together to share our creations.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Echange.
    Make a donation and get one or all three discs today!

    stexcollection-header.png

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections