Community Forum

How do you load a playable gate in the defaultfarm and make it interactable?

Forum Overview >> Editor

CategoryEditor
Created14.01.2022 21:44


Gregg Macfarlane (SirCuddlesWorth) 14.01.2022 21:44
I figured I would take a break from the dang object colision, and add two gates to the players starting farm.
Only issue is the tutorial I followed might be outdated fs19 and nothing happens when i press action on the gate.

UPDATE - Made some changes, hopefully I'm heading in the right direction.

It's setup like this
placeboes.xml
--------------------------------------------------------------------------------------------------------
<placeable filename="$mapdir$/maps/mapUS/gates/AnimatedGate/electricslidinggate_green.xml" position="205.247 42 72.585" rotation="0 0 0" age="34.000000" price="1.000000" defaultFarmProperty="true" farmId="1"/>

shopitems.xml
--------------------------------------------------------------------------------------------------------
<storeItem xmlFilename="maps/mapUS/gates/AnimatedGate/electricslidinggate_green.xml" />

It loads in just fine, but it's still not interactable So what am I missing/doing wrong lol.

Update. I made a xml in /maps/mapUS/xml

animatedObject.xml located in maps/mapUS/xml/
--------------------------------------------------------------------------------------------------------
and it has this inside it.
<animatedObject saveId="door2">
<animation duration="2.5">
<part node="2|0">
<keyFrame time="0.1" rotation="0 0 0"/>
<keyFrame time="0.9" rotation="0 -97 0"/>
</part>
<part node="2|0|0">
<keyFrame time="0.0" rotation="0 0 0"/>
<keyFrame time="0.1" rotation="21 0 0"/>
<keyFrame time="0.9" rotation="21 0 0"/>
<keyFrame time="1.0" rotation="0 0 0"/>
</part>
</animation>
<controls triggerNode="2|1" posAction="ACTIVATE_HANDTOOL" posText="action_openGate" negText="action_closeGate"/>
<sounds>
<moving file="maps/mapUS/gates/sounds/gate.wav" loops="0" linkNode="2|0" volume="0.15" radius="25" innerRadius="3" fadeOut="0.25"/>
<posEnd file="$data/sounds/prefab/gate/gate_opened.wav" linkNode="0|10|2|6|2|0|1" volume="0.8" radius="25" innerRadius="3"/>
<negEnd file="$data/sounds/prefab/gate/gate_closed.wav" linkNode="0|10|2|6|2|0|1" volume="0.8" radius="25" innerRadius="3"/>
<posEnd file="$data/sounds/prefab/gate/gate_opened.wav" linkNode="0|10|2|6|2|0|2" volume="0.8" radius="25" innerRadius="3"/>
<negEnd file="$data/sounds/prefab/gate/gate_closed.wav" linkNode="0|10|2|6|2|0|2" volume="0.8" radius="25" innerRadius="3"/>
</sounds>
</animatedObject>

And the gate has this on it under attributes.

index door2
onCreate AnimatedMapOject
xmlFileName maps/mapUS/xml/animatedObject.xml


Colin Smith (WrinkleysRule) 14.01.2022 22:16
I'll bet you have an error in your log regarding the onCreate, you will need to put your animation text in the fencesFarmLevel02Gate02.xml

Gregg Macfarlane (SirCuddlesWorth) 14.01.2022 22:24
@Colin Smith (WrinkleysRule)
Tanks for the reply, I actually updated it all following a new video.
But still no error in the log and it's not interactable :(

2022-01-14 13:17 C:/Users/SirCuddlesWorth/Documents/My Games/FarmingSimulator2022/mods/MyValley/maps/mapUS/gates/AnimatedGate/electricslidinggate_green.i3d (2.55 ms)


These are the errors in the log.

Warning: Only zip mods are supported in multiplayer. You need to zip the mod MyValley to use it in multiplayer.
^ I'm editing it in the fs22 mod directory, so I don't have to re-zip it 6mil times.

2022-01-14 13:16 Warning: TGM' is an unknown brand! Using Lizard instead!

2022-01-14 13:16 Error: Can't load resource 'dataS/menu/hud/fillTypes/hud_fill_roundBale.png'.
2022-01-14 13:16 Error: Can't load resource 'dataS/menu/hud/fillTypes/hud_fill_roundBale.png'.
2022-01-14 13:16 Error: Can't load resource 'dataS/menu/hud/fillTypes/hud_fill_roundBale.png'.
2022-01-14 13:16 Error: Can't load resource 'dataS/menu/hud/fillTypes/hud_fill_squareBale.png'.

2022-01-14 13:16 Warning: Texture array layer 'C:/Users/SirCuddlesWorth/Documents/My Games/FarmingSimulator2022/mods/MyValley/maps/mapUS/data/pathwayAsphalt02_weight.png' doesn't match the image properties of the other layers.
2022-01-14 13:16 Warning: Texture array layer 'C:/Users/SirCuddlesWorth/Documents/My Games/FarmingSimulator2022/mods/MyValley/maps/mapUS/data/pathwayAsphalt04_weight.png' doesn't match the image properties of the other layers.

2022-01-14 13:16 Warning (performance): Foliage lod 1 mesh 'meadow' 'cut' 'cut' is much larger than lod 0 mesh (min/maxY (-0.175/0.082 vs -0.125/0.103).

2022-01-14 13:16 Warning: Mesh cooking 'axion960TT_vis'.
2022-01-14 13:16 Error: Physics Mesh Cooking failed, due to too many polygons in 'axion960TT_vis'.
^ I made display tractor that can't be used.

2022-01-14 13:17 Warning (C:/Users/SirCuddlesWorth/Documents/My Games/FarmingSimulator2022/mods/MyValley/maps/mapUS/prefabs/ATVFS19/ATVOffroad.xml): Rotation of driveNode 'Rotation' is not 0/0/0 in the i3d file (-90.0/0.0/0.0). '.wheels.wheel(5)'
^ I imported a custom mod of an atv, not sure how to fix the wheel error et.


"you will need to put your animation text in the fencesFarmLevel02Gate02.xml" I'll try that right now.

Gregg Macfarlane (SirCuddlesWorth) 14.01.2022 22:46
I figured it might help if I link the file for the gate prefab I'l trying to load. It's a gate prefab form FS22 Mod Hub.
This one spawns the same, but is not usable... I know I'm stupid, but what the heck lol.

Do I have to call the modDec.xml?

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<placeable type="simplePlaceable" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../shared/xml/schema/placeable.xsd">
<storeData>
<name>Electronic Sliding Gate (Green)</name>
<functions>
<function>$l10n_function_electricslidinggate</function>
</functions>
<image>maps/mapUS/prefabs/FS22_ElectricSlidingGate_prefab/store_electricslidinggate_green.dds</image>
<price>1900</price>
<dailyUpkeep>0</dailyUpkeep>
<canBeSold>true</canBeSold>
<showInStore>true</showInStore>
<lifetime>1000</lifetime>
<rotation>0</rotation>
<brand>TGM</brand>
<species>placeable</species>
<category>placeableMisc</category>
<brush>
<type>placeable</type>
<category>decoration</category>
<tab>fences</tab>
</brush>
<vertexBufferMemoryUsage>186344</vertexBufferMemoryUsage>
<indexBufferMemoryUsage>20772</indexBufferMemoryUsage>
<textureMemoryUsage>11534504</textureMemoryUsage>
<instanceVertexBufferMemoryUsage>0</instanceVertexBufferMemoryUsage>
<instanceIndexBufferMemoryUsage>0</instanceIndexBufferMemoryUsage>
</storeData>
<placeableType>placeable</placeableType>
<base>
<filename>maps/mapUS/prefabs/FS22_ElectricSlidingGate_prefab/electricslidinggate_green.i3d</filename>
</base>
<placement useRandomYRotation="false" useManualYRotation="true" >
<testAreas>
<testArea startNode="3|0" endNode="3|0|1" />
</testAreas>
</placement>
<leveling requireLeveling="true" maxSmoothDistance="10" maxSlope="75" maxEdgeAngle="30">
<levelAreas>
<levelArea startNode="3|0" widthNode="0>3|0|0" heightNode="0>3|0|1" />
</levelAreas>
</leveling>

<clearAreas>
<clearArea startNode="3|0" widthNode="0>3|0|0" heightNode="0>3|0|1" />
</clearAreas>

<animatedObjects>
<animatedObject saveId="door1" >
<animation duration="31">
<part node="1|0">
<keyFrame time="0.0" translation="0 0 0"/>
<keyFrame time="1.0" translation="0 0 -7.1"/>
</part>
<part node="4|0">
<keyFrame time="0.0" rotation="0 0 0"/>
<keyFrame time="1.0" rotation="0 28800 0"/>
</part>
<part node="4|0|0">
<keyFrame time="0.00" visibility="true"/>
<keyFrame time="0.01" visibility="true"/>
<keyFrame time="0.02" visibility="false"/>
<keyFrame time="0.99" visibility="true"/>
<keyFrame time="1.00" visibility="true"/>
</part>
<part node="4|0|1">
<keyFrame time="0.00" visibility="false"/>
<keyFrame time="0.01" visibility="true"/>
<keyFrame time="0.99" visibility="true"/>
<keyFrame time="1.00" visibility="false"/>
</part>
</animation>
<controls triggerNode="1|1" posAction="ACTIVATE_HANDTOOL" posText="action_openGate" negText="action_closeGate" />
<sounds>
<moving file="maps/mapUS/prefabs/FS22_ElectricSlidingGate_prefab/sounds/electricslidinggate.wav" loops="0" linkNode="1|0" volume="0.1" radius="25" innerRadius="3" fadeOut="0.05"/>
</sounds>
</animatedObject>
<animatedObject saveId="door2" >
<animation duration="2">
<part node="2|0">
<keyFrame time="0.1" rotation="0 0 0"/>
<keyFrame time="0.9" rotation="0 -97 0"/>
</part>
<part node="2|0|0">
<keyFrame time="0.0" rotation="0 0 0"/>
<keyFrame time="0.1" rotation="21 0 0"/>
<keyFrame time="0.9" rotation="21 0 0"/>
<keyFrame time="1.0" rotation="0 0 0"/>
</part>
</animation>
<controls triggerNode="2|1" posAction="ACTIVATE_HANDTOOL" posText="action_openGate" negText="action_closeGate" />
<sounds>
<moving file="maps/mapUS/prefabs/FS22_ElectricSlidingGate_prefab/sounds/gate.wav" loops="0" linkNode="2|0" volume="0.15" radius="25" innerRadius="3" fadeOut="0.25"/>
</sounds>
</animatedObject>
</animatedObjects>
<maskAreas />
<tipOcclusionUpdateAreas>
<tipOcclusionUpdateArea startNode="3|0" endNode="3|0|1" />
</tipOcclusionUpdateAreas>

<indoorAreas>
<indoorArea startNode="0>3|0" widthNode="0>3|0|0" heightNode="0>3|0|1"/>
</indoorAreas>

<ai>
<updateAreas>
<updateArea startNode="3|0" endNode="3|0|1" />
</updateAreas>
</ai>

<windTurbine optimalWindSpeed="0.00000001" />

<i3dMappings>
<i3dMapping id="height" node="0>3|0|1" />
<i3dMapping id="width" node="0>3|0|0" />
<i3dMapping id="start" node="0>3|0" />
</i3dMappings>
</placeable>


moddesc

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="62">
<author>TGM_Micha</author>
<version>1.1.1</version>
<title>
<de>Elektrisches Schiebetor</de>
</title>
<description>
<en>
<![CDATA[
Konvertiert von LS19.
Preis: 1900 €
Changelog 1.1
Animierte Rundumleuchten
]]>
</en>
</description>
<iconFilename>icon_electricslidinggate.dds</iconFilename>
<multiplayer supported="true"/>

<storeItems>
<storeItem xmlFilename="electricslidinggate_green.xml"/>
<storeItem xmlFilename="electricslidinggate_grey.xml"/>
</storeItems>
<l10n>
<text name="shopItem_electricslidinggate">
<de>Elektrisches Schiebetor</de>
</text>
<text name="function_electricslidinggate">
<en>Elektrisches Schiebetor in Grau oder Grün</en>
</text>
</l10n>

<brands>
<brand name="TGM" title="Tegnas Gaming Mods und Micha" image="textures/brand.dds"/>
</brands>

</modDesc>

Colin Smith (WrinkleysRule) 14.01.2022 22:58
Look at the placeables/mapUS/farmBuildings/farmBarn --farmBarno2.xml and you will see how its is done.

Ed Propsner (crotchfrog) 14.01.2022 22:58
Is it just not placing? Is that the issue you are having? Try adding a mapboundID to the placeable line.

<placeable mapBoundID="electricSlidingGate" filename="$mapdir$/maps/mapUS/gates/AnimatedGate/electricslidinggate_green.xml" position="205.247 42 72.585" rotation="0 0 0" age="34.000000" price="1.000000" defaultFarmProperty="true" farmId="1"/>

Gregg Macfarlane (SirCuddlesWorth) 14.01.2022 23:42
@Ed Propsner (crotchfrog)

No it places just fine, it just has no interactions at all. It's there but the trigger is not detecting or letting me open it.
Here is a couple screenshot of what I mean,
in the editor - https://drive.google.com/file/d/1LwwVq9MgtdkJRurDNiRF7MrFEBfgtBys/view?usp=sharing
in-game -
https://drive.google.com/file/d/1kehRJdssBajbZg-kX9ZgGvQNGFm8gjRL/view?usp=sharing
https://drive.google.com/file/d/1FGPLjoGaqDuVykuGKBHrWbqP_dz40U6K/view?usp=sharing

I forget not all users understand my ADD Ramblings haha. Hope that is more clear.

More Detailed Info: User Attributes

On the object it's self, root node is 0
Object Name: electricslidinggate_green
index [string] door2
onCreate [scrip callback] AnimatedMapObject.onCreate
xmlFileName [string] maps/mapUS/prefabs/FS22_ElectricSlidingGate_prefab/electricslidinggate_green.xml


Ed Propsner (crotchfrog) 15.01.2022 02:23
Gotcha'. I suggest the mapBoundID because I noticed it was missing :)

I would delete the user attributes altogether. Everything should work from the animated objects section of electricslidinggate_green.xml. You should not need the modDesc unless you are loading it as a mod from the mods folder.

Are you sure it's actually placing and not still in your scenegraph somewhere? Do you use the placeholders function in your map?

Gregg Macfarlane (SirCuddlesWorth) 15.01.2022 04:39
@Ed Propsner (crotchfrog)

Nope I always place it, align it how I want for the X,Y,Z and then delete it entirely before saving the map.
I'll remove all the attributes and se if that helps. And yes I added the mapBoundID

Ed Propsner (crotchfrog) 15.01.2022 07:01
Something a bit unrelated for you to try out. Create a transform group and name it "placeholders" or whatever you wish (I put mine in the gameplay TG). Open up user attributes and add an attribute named onCreate [script callback] and give it the value "Placeholders.onCreate." Put your placeables in there so they are visible when you are working on your map. You won't constantly have to reload and delete them every time you want to work with them. They will be there in the editor, but not the game. When you're ready to zip the mod just exclude that folder. I've always found this feature to be super handy.

I'm not sure that removing the attributes will help, but I suppose it could if it's telling it to look in the animatedobject.xml instead of your placeable xml.

Colin Smith (WrinkleysRule) 15.01.2022 11:19
You cannot call an onCreate function from a placeable in the vanilla game, to do so would require a custom script (as in FS 19 Seasons mod).

The AnimatedMapObject setup doesn't appear to be working in FS22 as any reference to it will generate an error, it was the same in FS19 to start with until Giants/Stegei incorporated it in a game update.

With animations at the moment you are limited to the relevant object.xml or you could try directly in the i3d as was the case in earlier versions of the game

Ed Propsner (crotchfrog) 15.01.2022 17:04
Interesting. Now there is something I never knew!

If you really want to use animatedObjects.xml there is a mod floating around out there that will allow you to do so. It's called a bit differently, something along the lines of modAnimatedMapObject.onCreate, but they say it works all the same. You honestly shouldn't have to go that route as there should be no issues running your animations from within your placeable's xml.



Gregg Macfarlane (SirCuddlesWorth) 15.01.2022 23:01
@Colin Smith (WrinkleysRule)
"The AnimatedMapObject setup doesn't appear to be working in FS22 as any reference to it will generate an error, it was the same in FS19 to start with until Giants/Stegei incorporated it in a game update."

So I'm SOL till he has time to update/incorporate it into GE. I just want a gate on the starting farm and shop, not a Space Center lol.
.It's bugging my OCD already, been fighting it for days. I'll stop till I can find a way to add it in.

@Ed Propsner (crotchfrog)
I don't know where to get a mod to allow me to load it. I did a search for "modAnimatedMapObject.onCreate" but it's all FS19.
So yeah I would think it would load, I kept thinking I'm stupid and doing it wrong.

Off topic, did ever tell you Stegei you are the best coder? :)

Ed Propsner (crotchfrog) 16.01.2022 01:35
https://ls-modcompany.com/forum/thread/9652-animated-map-object-mit-autotrigger/. Just a side note, always try to download your mods from the original author. All of these re-posting sites are destroying the mod scene and becoming a real problem. Most times they are posted and/or altered and re-posted without permission. They rarely care about the quality of the mod and pump out pure garbage more often than not. Of course, this is just my opinion, and one is entitled to do as they wish, but I'm sure they wouldn't feel the same if it was their mod up there getting trashed.

So you tried through the placeable's XML and it's loading but not working and no errors. I'll kick that one around for a bit.

If I ever feel like Stegei needs to laugh so hard he's bound to break a rib, I'll be sure to tell him! I'm actually a decent coder, but just getting into LUA. A blind, one-legged man in a bouncy house could probably make better progress in his situation than I am with LUA at the moment! I think all languages are withing a stone's throw of each other. Each consecutive one you learn gets progressively easier because of the similarities, so I'm sure it won't be long!

Gregg Macfarlane (SirCuddlesWorth) 16.01.2022 02:36
@Ed Propsner (crotchfrog)

"all of these re-posting sites are destroying the mod scene and becoming a real problem." Oh ok I did not know, I always try to check but can't always find the source. I'll try to add that .Lua and see. Just linking it in <additionalFiles> <additionalFile filename="maps/mapUS/scripts/AnimatedMapObjects.lua" />
don't work.. I'm not sure how to ingrate it. I'll mess with it later. Thanks again.

Ed Propsner (crotchfrog) 16.01.2022 02:56
@Gregg: Just an FYI that I DL'd the exact gate you are working with there to get a first-hand look at what is going on and well ... it worked perfectly right out of the box. Probably not what you wanted to hear :)

If you're interested in knowing, it's a pretty nice gate with a fancy flashing light on top when it opens and closes. I might have to use it somewhere now that I have it :)

I added 2 lines and changed 1 to install.

My placeables setup is a bit different than yours.

> Mod_Map_US
>> maps
>> placeables

placeables.xml:
<placeable mapBoundId="gateGreen" filename="$mapdir$/placeables/electricGate/electricslidinggate_green.xml" position="164.49000549 87.99797821 95.24832916" rotation="0 -89.66252899 0" />

storeitems.xml:
<storeItem xmlFilename="placeables/electricGate/electricslidinggate_green.xml" />

electricslidinggate_green.xml:
<base>
<filename>placeables/electricGate/electricslidinggate_green.i3d</filename>
</base>

All I did was download the mod, unzip into my placeables folder, and rename the mod folder to "electricGate."

If you still can't get it to work, you're invited to my farm to watch mine open and close as much as you want :)

Gregg Macfarlane (SirCuddlesWorth) 16.01.2022 23:51
@Ed Propsner (crotchfrog)
Thank you so much mate, I was going mad thinking it was bugged on my map or something. It works now.
The only thing I changed was the [ mapBoundId="gateGreen" ] then I noticed that the electricslidinggate_green.xml
was different from the one I downloaded a while back. The new prefab download works!

Now if I can just get the referenced FS22 Old Gate "fencesFarmLevel01Gate02" to work lol. It's not just a gate but fence pieces as well. Later I need to rest haha.

Ed Propsner (crotchfrog) 17.01.2022 17:44
I didn't catch the reference to FS22 Old Gate "fencesFarmLevel01Gate02" except for where Colin mentioned it, but I didn't see anything about it in previous posts, so I was a bit confused by that one.

Another gate not working? Animated gates seem to be your kryptonite :)

What's the deal with that gate?

Gregg Macfarlane (SirCuddlesWorth) 18.01.2022 18:35
@Ed Propsner (crotchfrog)
It's a gate from FS22, but it's part of a set. Fences and Gates.
Farming Simulator 22\data\placeables\lizard\fencesFarm\level01\fencesFarmLevel01.i3d

I want to use just the gate02 from that group, so trying to figure out how to make it just a gate prefab and work.
I can call gates in now and have them work thanks to everyone's help, I'm just not sure why it's not animating when placing the gate02.

Ed Propsner (crotchfrog) 22.01.2022 17:54
@Gregg: How did you make out with this?


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