Community Forum

Classname

Forum Overview >> Scripting

CategoryScripting
Created28.11.2021 14:45


Tautvidas (tautvidas) 28.11.2021 14:45
Hello,

I tried add new selling station for new map,I change place for the triggers per GE so i cant just load xml file from game files. I moved that in map folder.I tried load selling station per "Items" xml file and that doesnt working,because wrong classname
"( 2021-11-28 15:27 Error (C:/Users/pc/Documents/My Games/FarmingSimulator2022/mods/FS22_Working/maps/items.xml): Class 'SellingStationPlaceable' not defined for item 'items.item(0)' )"

After that,i tired to add that station per storeItems xml file,
<storeItem xmlFilename="maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml" />
then,game just don't loading that object,and no log errors.

Bilbo Beutlin (BBeutlin) 28.11.2021 15:34
Some things have changed from FS19. You didn't really examine the new structures from default files, did you?

Beginning with the map's "modDesc.xml" <maps> <map .. you'll see the important auxiliary files
- 'defaultVehiclesXMLFilename' are the start vehicles
- 'defaultPlaceablesXMLFilename' are the start placeables (earlier known as defaultItems)
- 'defaultItemsXMLFilename' are now other items apart from vehicles and placeables
- 'configFilename' is the map configuration where you also find the file to <storeItems>

That means
- your storeItems declarations must be either in modDesc.xml or the map config <storeItems> file.
- your placeable selling station must be in the file 'defaultPlaceablesXMLFilename'

For your setup see for reference a default "placeables.xml". The earlier used attribute 'className' is obsolete now.

Tautvidas (tautvidas) 28.11.2021 16:21
No,i watched game files few times.Just i tried in several ways.
I think that 'defaultPlaceablesXMLFilename' in my map is just named placeables.xml

So if i go there like this <storeItem xmlFilename="$moddir/maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml" />

and i use "$moddir in that way to show directory of mod,game still not found xml file. buit file 100% is in that location.
So if i will not use $moddir and go like maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml game in the log file will not show any errors

but then game starts loading files from placeables.xml and that shows that Warning: PlaceableUtil.loadPlaceable can only load existing store items, no store item for xml filename 'maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml

that error i have then i'm not using $moddir in storeItems and i have no error there then game loads those files,

Tautvidas (tautvidas) 28.11.2021 16:21
No,i watched game files few times.Just i tried in several ways.
I think that 'defaultPlaceablesXMLFilename' in my map is just named placeables.xml

So if i go there like this <storeItem xmlFilename="$moddir/maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml" />

and i use "$moddir in that way to show directory of mod,game still not found xml file. buit file 100% is in that location.
So if i will not use $moddir and go like maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml game in the log file will not show any errors

but then game starts loading files from placeables.xml and that shows that Warning: PlaceableUtil.loadPlaceable can only load existing store items, no store item for xml filename 'maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml

that error i have then i'm not using $moddir in storeItems and i have no error there then game loads those files,

Bilbo Beutlin (BBeutlin) 28.11.2021 16:33
Your placeholder "$moddir/.." is wrong. It must be "$mapdir$/.."
Only if you need a cross reference to external mods use "$moddir$modName/..". (not recommanded)

PS
Also, you cannot use placeholders in <storeItems>. There you must use relative paths, eg.
<storeItem xmlFilename="placeables/myPlaceable.xml"/>

Tautvidas (tautvidas) 28.11.2021 16:43
i change that,but still game can't found xml file.

<storeItem xmlFilename="$mapdir$/maps/aTextura/sellingStationFarmShop/sellingStationFarmShop.xml" />

Xml file folfer : C:\Users\pc\Documents\My Games\FarmingSimulator2022\mods\FS22_Working\maps\aTextura\sellingStationFarmShop

Bilbo Beutlin (BBeutlin) 28.11.2021 16:44
see above my PS

Looks like you have researched in examples only very roughly.

Tautvidas (tautvidas) 28.11.2021 16:44
that still doesnt work :(

i use your example,and moved files : <storeItem xmlFilename="$mapdir$/placeables/sellingStationFarmShop.xml"/>

I have already added few buildings,from original files,that works fine,but this....

Bilbo Beutlin (BBeutlin) 28.11.2021 17:01
You can read, can't you?
See my post 16:33 (PS) and 16:44
You MUST NOT use placeholders in <storeItems>.

Tautvidas (tautvidas) 28.11.2021 17:42
i deleted placeholder from storeitems,and that looks good,without errors in the log file that wrong place.

But then i have error : Warning: PlaceableUtil.loadPlaceable can only load existing store items, no store item for xml filename 'placeables/sellingStationFarmShop.xml'

Bilbo Beutlin (BBeutlin) 28.11.2021 17:58
Either your "placeables/sellingStationFarmShop.xml" is invalid or the i3d cannot be found.
Check the xml for correct <base> <filename>..
Assuming the i3d is in the same folder should be then
<filename>placeables/sellingStationFarmShop.i3d</filename>

Tautvidas (tautvidas) 28.11.2021 18:11
Photo 1
https://part.lt/img/0372108323a6c5b5d7489759205acde7640.png

Photo 2

https://part.lt/img/87e1ed0b2e957a800958fe77fddcaeb6908.png

Maybe you can see mistake,i cant see any mistakes...

Or just selling points xml doesn work if you want load them from your map.

Bilbo Beutlin (BBeutlin) 28.11.2021 18:24
*sigh* In comparison with default files you would have seen what's wrong.
In the placeables.xml it MUST be
<placeable .. filename="$mapdir$/placeables/sellingStationFarmShop.xml" ..

Tautvidas (tautvidas) 28.11.2021 18:34
Thanks for help, Now works :)

Rok Perenič (themapguy) 05.12.2021 13:52
I've been trying the same thing, but i have a problem. If i copy over storeitems.xml from default map to my custom map and change in map.cml the filename it doesn't load load any vehicles, but if i load the one from %data it just says the error that it can only load default storeitems.

Sebastian Reinke (CreativeHRO) 10.12.2021 12:19
Lösung:

modDesc.xml:
<storeItems>
<storeItem xmlFilename="placeables/sellingStationVehicles/sellingStationVehicles.xml" />
</storeItems>


placeable.xml:
<placeables>
<placeable mapBoundId="sellingStationVehicles" filename="$mapdir$/placeables/sellingStationVehicles/sellingStationVehicles.xml" position="-713.141 193.950 635.618" rotation="0 -16 0" />
</placeables>

die storeItems.xml lasst ihr aus dem Standardspiel laden. so mach ich es, da ich daran nichts ändere!


Note: Log in to post. Create a new account here.