Jump to content

58 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

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
Posted:
Last Online:  
 

NetworkSkins supports prop light effects:

CO also added native support for prop light effects, but there is no tutorial how to add them.

  • Like 1

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    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
    Posted:
    Last Online:  
     
    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.

    • Like 1

    ekCYJKD.pngTim The Terrible's Steam Workshop

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    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
    Posted:
    Last Online:  
     
    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.


    ekCYJKD.pngTim The Terrible's Steam Workshop

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Alright, great. Once you go Daylight Classic, you can't go back to toxic yellow. I'll have to put that one on as well.

     

    How about the target triangles for the LOD?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    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

     


    ekCYJKD.pngTim The Terrible's Steam Workshop

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    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.

    • Like 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    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
    Posted:
    Last Online:  
     
    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
  • Posted:
    Last Online:  
     

    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
  • Posted:
    Last Online:  
     

    I think I found the light effect in the asset importer but I can't edit the numbers. I try to type in a new z position but it won't accept it and it just stays "-0.15"

     

    20170222153148_1.thumb.jpg.10bbbb38e1a2e505b6f2b97453342867.jpg

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    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
    Posted:
    Last Online:  
     
    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.

    • Like 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Thanks for the reply. Sorry, I'm a total noob with this stuff right now. How do I put the info in your post into practice?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    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;

     

    • Like 3

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    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
  • Posted:
    Last Online:  
     

    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?

    • Like 4

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    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
    Posted:
    Last Online:  
     
    1 hour ago, AmiPolizeiFunk said:

    What programming language is this script written in?

    C#, like the game.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    19 hours ago, AmiPolizeiFunk said:

    Has anyone done a working Lighthouse yet with a rotating light?

    How would you do that?

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    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
    Posted:
    Last Online:  
     
    21 hours ago, AmiPolizeiFunk said:

    Has anyone done a working Lighthouse yet with a rotating light?

    Nope, but I'm interested. I'm very busy so I won't be surprised if someone beats me to it.


    ekCYJKD.pngTim The Terrible's Steam Workshop

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

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

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    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. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

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

    STEX Collections

    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