|Steve O Malley (Unknown)||04.01.2019 23:39|
|Hi, I've recently finished my first mod for farming simulator 19. I did this by defining a custom vehicle type in my moddesc.xml like so, using the previously posted VehicleType list on this forum (https://gdn.giants-software.com/thread.php?categoryId=3&threadId=6655):
<type name="IBCwater_1000L" className="Vehicle" filename="$dataS/scripts/vehicles/Vehicle.lua">
<specialization name="mountable" />
<specialization name="fillUnit" />
<specialization name="fillVolume" />
<specialization name="fillTriggerVehicle" />
<specialization name="dischargeable" />
<specialization name="pickup" />
<specialization name="tensionBeltObject" />
<specialization name="waterTrailer" />
This allowed me to create my own vehicle that was able to use functions from two seperate vehicle types (pallet and waterTrailer) that otherwise could not have been used in either one type (specifically waterTrailer and tensionBeltObject were exclusive). All of the specializations I defined in the moddesc can be called/configured in my vehicle's .xml which is entirely contained within the wrapper:
I then began exploring placeables, wanting to play around with modding those a bit. While going through all the various xml I noticed, similar to vehicles, all of the xml was contained within a wrapper of:
I have now been looking into making my own placeable type simliar to how I did with my vehicle type, in an attempt to get functionality from two different placeable types into the same type. The only topic on here I've been able to find regarding custom placeable types is https://gdn.giants-software.com/thread.php?categoryId=3&threadId=3499. This solution involves creating your own .lua scripting and defining it in the moddesc simliar to how I defined my vehicle type from the vehicle.lua, however I don't feel I'm at that level yet, and since the thread is a few years old and I was able to accomplish creating my vehicle type in such a way, I was wondering if there is a non-lua method in FS19/GE8 to creating your own placeable type? I was thinking something along the lines of:
<type name="myplaceabletype" className="Placeable" filename="$dataS/scripts/placeable/Placeable.lua">
<specialization name="husbandry" />
<specialization name="buyingStation" />
<fillType name="diesel" priceScale="0.9" />
In this rough example this new placeable type would be able to take advantage of the pallet module from <placeableType>husbandry and the gas selling of <placeableType>buyingStation.
I guess my question is if something like this is possible for placeables, being able to combine types into your own via just the basic xml and not having to go through lua, since I assume all the placeable functions are within a base placeable class simliar to how they are for Vehicle. Any advice or direction would be appreicated, apologies for any lingo/concepts I butchered, I've only been at this for about a week but it's fun. Thanks.
|Jos Kuijpers (Unknown)||06.01.2019 14:37|
|Custom placeables types are bound to custom code. There is no specialization system for placeables.
So if you want a cusotm placeable you need custom class that subclasses from Placeable. You can then call
g_placeableTypeManager:addPlaceableType(typeName, className, filename, customEnvironment) to add the type. After that you can use the typeName in your XML file.
|Steve O Malley (Unknown)||06.01.2019 17:48|
|Ok thanks for the info, I'll start researching into that route and see if I can't figure out some more about it.
|Derek Squire (dezza069)||07.02.2019 00:52|
I'm stuck with:
Error: No filename specified for placeable type 'FS19_EstanciaLapacho.mySpecial_Factory'. Ignoriring it!
Is it possible to please provide an (annotated) example for your suggestion?
|Derek Squire (dezza069)||11.02.2019 09:42|
|Would really, really appreciate some information, a tutorial or even some basic skeleton code explaining/illustrating how to get a custom placeable to access it's LUA script... This whole fumbling around thing is really frustrating.
Since the 1.3.0 beta update, can now create a custom placeable type using "g_placeableTypeManager:addPlaceableType(typeName, className, filename, customEnvironment)" - but am totally at a loss at how to actually access the script (filename provided to addPlaceable) from triggers in the i3d.
Changing the placeableType in the i3d's .xml file doesn't seem to make any difference.
Would really appreciate some guidance.
|Derek Squire (dezza069)||12.02.2019 11:07|
The problem as stated directly above (by me) has been solved and there is a need to admit it was really an incredibly stupid mistake on my behalf!
I'd not changed the class type of the custom placeable in the map's XX_items.xml before stating a new test game. Now that's been adjusted everything works as expected, except if the placeable is purchased...
|Derek Squire (dezza069)||07.03.2019 01:41|
|Hello, me again!
Getting really frustrated with custom placeables - I've made two differing types now that both show up in the store, can be placed/purchased - yet if the custom placeable class is used in the XML's "placeableType" tag the custom placeables just defaults to a "Placeable". All without any log errors.
If the custom placeable uses "placeableType" of any standard types, everything works on initial placement/purchase and then that class name is saved in items.xml - but this is not the case if a custom type is used (it defaults to "Placeable" in the saved items.xml).
Only after saving the game and manually changing 'class="customPlaceable.customPlaceable"' in "items.xml" will the game use the custom class.
I've even used LUA scripts containing nothing but simple print statements to check they're being utilised, but they simply are not accessed unless the game is saved and the savegame's "items.xml" is manually edited. I cannot work out how to get the game to recognise the custom scripts on the initial purchase.
Any suggestions as to what I could be doing wrong are very much appreciated.
Thanks in advance.
|Changju Hwang (Unknown)||20.05.2019 15:51|
|It's quite belated, but I had an exact same problem with Derek and I kinda sorted it out so that I leave a comment. When you call g_placeableTypeManager:addPlaceableType(typeName, className, filename, customEnvironment) , the className must be your customized one, not "placeable". That's how I resolved the issue with save files.
|Derek Squire (dezza069)||21.05.2019 00:45|
|Thanks for sharing CityFarmer, that's exactly it.
There's a response somewhere else on this forum from one of the developers saying that - and I'd simply mis-interpreted his original forum post and put the wrong details in...
Thanks again for your help, appreciated!!
Note: Log in to post. Create a new account here.