Page 1 of 1

Removing built in map placables

Posted: Wed Sep 16, 2020 9:24 pm
by bossmanslim
I am editing a map to remove a bunch of stuff I don't like. To my surprise, the starting farm buildings are placables, yet do not show up in the garage and therefore cannot be removed. My question is two fold:

1) Is there a way to get them to show up in the garage? (preferred option)
2) If I comment them out in the modDesc.xml file, will this remove them and not cause errors?

Re: Removing built in map placables

Posted: Thu Sep 17, 2020 3:41 am
by jmelvin
I am NOT what I would even call a novice modder, but I have experimented with what you are wanting to do.

You need to be very careful whenever you remove, or even shift the order of, transform groups in an i3d. This can cause animated functions (such as doors and gates that open/close, lights that turn on/off) of other items to not work. Each transform group gets an index ID that seems to be of the form a.b.c.d based on how a given transform group is nested within other transform groups (i.e., d nested within c, nested within b, nested within a). This ID gets assigned by the map editor when you save the i3d. Deleting a nested transform group will change the IDs for any transform group that follows the one you are deleting that are nested in the same level as the one you delete. Animated functions associated with those changed functions will end up with the wrong index and thus cease to function as the mapmaker intended.

For example: A barn that is the fifth transform group in a grouping of buildings/items of a farm lot may have doors that open/close. If you delete any of the four preceding transform groups for the farm lot, the doors of the barn will not open/close within your game.

You can safely delete the last transform group of a multi-transform group nested set because that will not change the ID of anything else. Be careful with this so you don't delete a given level of the nesting structure where animated functions could be in levels below the one you are working in.

I have safely deleted buildings where nothing else within that level of nesting had animated functions. I have also been able to delete trees on a map where I made sure that none of the other transform groups in the same level of the nest had animated functions.

You mention that you are wanting to remove a placeholder. Placeholders seem to be objects that can, and often do, have animated functions. You could possibly get around affecting the transform groups at that same nested level by replacing instead of deleting. By this, I mean you could delete the transform group for a building but add a transform group for a tree at that position in the nest. That would leave the IDs unchanged for the other transform groups of that nested set.

When I was playing around with this, I always made sure that I kept a reserve copy of the map mod in case I found I had messed things up. Also, remember that you probably won't know right away that you have affected the doors/gates/lights of transform groups that were nested at the same level as the one you deleted. Plus, a transform group that you delete may not have animated functions but you could be affecting other transform groups that DO have animated functions such as a door or gate that you want to function in your game.

Re: Removing built in map placables

Posted: Thu Sep 17, 2020 3:53 am
by jmelvin
I forgot to mention: One of your other options is to use the map editor to lower the object far enough below ground level so it can't be seen or give some type of collision. Doing this will leave the IDs of any animated function unchanged. This is probably the easiest method to accomplish what you want without having to worry about animated functions.

Re: Removing built in map placables

Posted: Thu Sep 17, 2020 1:34 pm
by bossmanslim
The objects I'm talking about are not in the id3 file. They are placables in the files for the map and seem to be placed upon map start by lines like the below:

<storeItem xmlFilename="maps/placeables/animals/Schweinestall.xml"/>

believe there is a point in the id3 file for the map which provides the xyz coordinates for where the above is to be placed. This item I am not keen on deleting because of the issues you indicate above.

Re: Removing built in map placables

Posted: Thu Sep 17, 2020 5:49 pm
by jmelvin
The objects I'm talking about are not in the id3 file. They are placables in the files for the map and seem to be placed upon map start by lines like the below:

<storeItem xmlFilename="maps/placeables/animals/Schweinestall.xml"/>
As I understand it, that type of entry puts the item in the store for purchase and placement while playing the game. The entries that you mention that provide xyz coordinates are in a transform group in the i3d and control where the map maker placed that building for the start of the game. In order for the player to be able to sell that first building it has to be owned by the player. Objects/buildings purchased in game are automatically owned by the player and can be sold to get rid of them.

Most of the buildings that show up at the beginning of the game do not have an owner that can sell them. Sometimes you can become the owner by purchasing the land where the building sits. It will then show up in your garage and you will be able to sell it. I have seen maps where some of the buildings on land that was owned by a player at the start of the game were not owned by the player (as shown by them NOT being in the player's garage. If I wanted to play that map but the building was in the way of what I wanted to do, I made sure to use the editor to drag that building/object well underground (i.e., deep enough to even allow for some land contouring at that location).

I should correct something I stated in my first post. If I remember correctly, it is not just animated objects that use the ID I mentioned. It is anything with a trigger. You can inadvertently lose a trigger function (such as an animal unloading zone, straw spreading location, or animal feeding location) used for a building whose transform group is at the same level of the nested stack of the one you want to delete. If I had any doubts about what I wanted to have disappear from the map I wanted to play, I used the editor to bury that *censored* far underground.

After selecting an object in the editor, you can use the arrows to change the object's xyz coordinates. Sometimes, instead of dragging the object underground, I drug it to a different position so it was still seen on the map but not in my way. Changing the xyz coordinates does not change the ID associated with the item's location within the nesting structure and thus doesn't affect any triggers.

Re: Removing built in map placables

Posted: Thu Sep 17, 2020 8:36 pm
by jmelvin
There may be another way you can accomplish what you want to do without using the editor to delete an object.

I think you could do this by editing the items.xml file in your saved game folder. I haven't done this but I think it would work. The items.xml file for a given saved game has entries for all of the buying stations, selling stations, silos, etc. for the saved game. Entries in this file can have a field farmid="number" where the number shows who owns that item. I think farmid="0" is for items that have no specific owner. I've only played single-player games and see that items I own use farmid="1". I'm guessing that other values are used for multi-player games so the game knows who owns a given item. In your game you are probably not the owner of the item you want to remove. But, you should be able to edit the entry for that item in the items.xml to make you the owner. You would then be able to restart your saved game and see the item in your garage and thus be able to sell it.

If you want to try this approach, you should save a backup copy of the items.xml at some other location so you have a way to go back to the current status of your saved game. It would just be a matter of putting the unedited items.xml back into your savegame folder.

Like I mentioned, this isn't something I have done. I would be interested in hearing what you find out if you go this route.

Re: Removing built in map placables

Posted: Thu Sep 17, 2020 8:50 pm
by bossmanslim
I think this is the issue:
  • In the individual palacables within the map, there is a line called <canBeSold>false</canBeSold>
  • I swapped it to "true" and the item can be sold. There are some issues with this as the map author didn't intend for them to be sold, mainly as once it's sold, it's lost and there are no pictures or price for the building
  • As there is an icon for the some of the buildings in the id3 file, those will need to be removed in order to completely clear the building
The map is Eiersholt

Re: Removing built in map placables

Posted: Fri Sep 18, 2020 12:09 am
by jmelvin
The map is Eiersholt
I have not looked at that map and have not had to look at the use of canBeSold so I can't offer any more input on your issue. That item may prevent changing the ownership in the items.xml from letting you sell the building as I theorized.

Re: Removing built in map placables

Posted: Sun Sep 20, 2020 11:07 am
by thenashone
Not sure this will solve your problem or even a sensable reply, but i too had a simular issue.

the way i solved it was, i went into the giant editor and made the item not renderable.