Community Forum

Missing user attribute in strawbaleBaler.i3d

Forum Overview >> Farming Simulator 2011

CategoryFarming Simulator 2011
Created26.11.2010 17:26


Ellinor Ström (unknown) 26.11.2010 17:38
Hi

I have a bit of a problem here. The user attribute "isStrawbale" is missing from the strawbaleBaler.i3d from the default map. "isHaybale" is available in the haybaleBaler.i3d and the "isRoundbale" is available in the roundbales. It's the same in both Farming Simulator 2011 german and english version. I have update 2.0 installed.

I have a function that looks after a bale and locks it if a bale is within range and i identify these with

if getUserAttribute(item.item.nodeId, "isStrawbale") or getUserAttribute(item.item.nodeId, "isHaybale") or getUserAttribute(item.item.nodeId, "isRoundbale") then

what do i do to find the square strawbales if getUserAttribute( id, "isStrawbale") can't be used?


Stefan Geiger - GIANTS Software 30.11.2010 10:35
Actually the issue is, that some of the bales still have the user attribute but its not used anymore ;)

You can use this code to find out if the nodeId is a bale:

local object = g_currentMission:getNodeObject(nodeId);

if object ~= nil and object:isa(Bale) then
-- object is a bale
end;

Ellinor Ström (unknown) 30.11.2010 16:24
Thanks Stefan

I had already looked that up. So i know about that part. But what i need to know is what kind of bale i am currently having. Hay, straw or round.

Stefan Geiger - GIANTS Software 01.12.2010 11:13
There is user attribute isRoundbale which you can us to detect if it is a round bale.
local isRoundbale = Utils.getNoNil(getUserAttribute(nodeId, "isRoundbale"), false);

However there is no attribute to check if it is a hay or straw bale.
Maybe it is ok for you to test this based on the name of the i3d that was loaded.
At least for the default bales this would work.
The i3d filename is stored in the attribute of the object i3dFilename.

local object = g_currentMission:getNodeObject(nodeId);

if object ~= nil and object:isa(Bale) then
local isHaybale = false;
local splits = Utils.splitString("/", object.i3dFilename);
if splits[table.getn(splits)]:lower():find("hay") ~= nil then
isHaybale = truel
end;
end;

Ellinor Ström (unknown) 01.12.2010 14:10
Thank you again Stefan. Yes, that will do the trick.


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