Jump to content

8 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

I wanted to add some animal spawn points to buildings but ran into the problem of the spawn points being to big - the animals will wander through walls, etc. So I was wondering if there was a way to shrink the size permanently?

I placed one in the asset editor and used mod tools to change the size and then loaded up a game to test. It seems to work just fine except those changes aren't permanent. So I tried to create a new marker by exporting the mesh and then using it for a new prop using the default spawn point as the template. Everything seems to be fine but upon loading up a save, no animals appear now. Any help would be appreciated. 

Share this post


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

    Okay, so I know what the problem is when trying to make a new marker. There is no CitizenInfo set by default. I tried to search for a script you could run to add something there, but couldn't find anything (wiki page says custom animals can be used via scripting, so I assume this is possible somehow). @Ronyx69, since you seem to be the most knowledgeable person in this area, have you come across something for this?

    Share this post


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

    I have no idea how markers work and didn't test anything but it seems that either saving it or loading it makes m_creatures be null, so probably a mod would be necessary to save/load that.

    These (and also ItemClass set to Marker) seem to be the relevant things for animal spawn markers:

    var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
    CitizenInfo[] creatures = new CitizenInfo[]{PrefabCollection<CitizenInfo>.FindLoaded("Cow")};
    asset.m_creatures = creatures;
    asset.m_isMarker = true;
    asset.m_doorType = PropInfo.DoorType.Animal;

     


    Ronyx rhymes with electronics...  

    Steam  //  Twitch  //  YouTube  //  Twitter  //  CSLModding.INFO

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    20 hours ago, Ronyx69 said:

    I have no idea how markers work and didn't test anything but it seems that either saving it or loading it makes m_creatures be null, so probably a mod would be necessary to save/load that.

    These (and also ItemClass set to Marker) seem to be the relevant things for animal spawn markers:

    
    var asset = ToolsModifierControl.toolController.m_editPrefabInfo as PropInfo;
    CitizenInfo[] creatures = new CitizenInfo[]{PrefabCollection<CitizenInfo>.FindLoaded("Cow")};
    asset.m_creatures = creatures;
    asset.m_isMarker = true;
    asset.m_doorType = PropInfo.DoorType.Animal;

     

    Yeah, running the script does allow for the CitizenInfo to be set to something (cow in this case), but it always gets set back to null when reloading. What a bummer. Thanks anyways!

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    9 hours ago, von_Maximilian said:

    Yeah, running the script does allow for the CitizenInfo to be set to something (cow in this case), but it always gets set back to null when reloading. What a bummer. Thanks anyways!

    In that case, the only way to fix it would be a real mod that "runs the script" every time the game is loaded.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    3 hours ago, boformer said:

    In that case, the only way to fix it would be a real mod that "runs the script" every time the game is loaded.

    You would have to have a different "line" of code in the mod for every variation though, right? Because otherwise you wouldn't be able to designate what kind of Citizen you want spawning (cow, sheep, etc.). I don't have any experience modding, or writing code, but that is the way it seems to me at least.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    13 hours ago, von_Maximilian said:

    You would have to have a different "line" of code in the mod for every variation though, right? Because otherwise you wouldn't be able to designate what kind of Citizen you want spawning (cow, sheep, etc.). I don't have any experience modding, or writing code, but that is the way it seems to me at least.

    Yes, you would have one asset per animal type and size.

    Then you just need 3 things:

    1. A loading hook to run the code. I'm not sure if there are constraints set by the game when the scripts must be run. The easiest kind of hook would be a LoadingExtension. If no animals are spawning, you can utilize my PrefabHook mod to run the code right after the assets are loaded from disk.
    2. You have to find your prop assets using PropCollection (or when using PrefabHook, comparing the name)
    3. Run the "script" for each loaded prop, with the animal type you want.

    If you want, I can help you to create the mod/assets.

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    23 hours ago, boformer said:

    Yes, you would have one asset per animal type and size.

    Then you just need 3 things:

    1. A loading hook to run the code. I'm not sure if there are constraints set by the game when the scripts must be run. The easiest kind of hook would be a LoadingExtension. If no animals are spawning, you can utilize my PrefabHook mod to run the code right after the assets are loaded from disk.
    2. You have to find your prop assets using PropCollection (or when using PrefabHook, comparing the name)
    3. Run the "script" for each loaded prop, with the animal type you want.

    If you want, I can help you to create the mod/assets.

    Sure, if you don't mind taking time out of your day, I'd appreciate it. Not sure what part of the world you are in, but I'm in Texas and work nights, so my schedule is a little funky (just a heads up).

    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