Community Forum

How to dispose of a Bale

Forum Overview >> Farming Simulator 2011

CategoryFarming Simulator 2011
Created27.12.2010 11:41


Mark Farrington (chorleyboy) 27.12.2010 11:46
Hi,

I'm trying to dispose of a bale similar to the bale sale trigger in the game. I'm using the following code (which worked in LS09):

g_currentMission:removeItemToSave(baleId);
delete(baleId);

This works and the bale disappears however I then receive errors in game log. I know that bales are treated differently in LS11 so I guess I need to make another call in addition/instead of the above?

Many thanks,
Mark

Stefan Geiger - GIANTS Software 27.12.2010 19:09
In LS11 the bales now are lua objects. Using the object, you can simply call object:delete() which both does delete the node and remove the bale from all lists.
You can get and delete the object associated with the baleId with this code:

local object = g_currentMission:getNodeObject(baleId);
if object ~= nil and object:isa(Bale) then
object:delete();
end;

Mark Farrington (chorleyboy) 28.12.2010 14:33
Hi Stefan, many thanks for the answer this has fixed my game log errors.

Another quick (I hope) question is does this technique also work for vehicles? The community created a big bag mod some time ago to enable in field filling of seed drills. I'd like to convert this into LS11 and would like to remove the "bag" (which is actually a trailer) when the bag is empty.

Thanks,
Mark

Stefan Geiger - GIANTS Software 03.01.2011 10:31
The vehicles are not mapped using this way.

However there is table called "nodeToVehicle" in the g_currentMission, which maps the vehicle component nodes to the vehicle object.
Further you should not call the delete function of the vehicle directly, but call g_currentMission:removeVehicle(vehicle). Also you should only do this on the server. Deleting the vehicle on the server also deletes the vehicle on the clients automatically.

So valid code could be:
if g_currentMission:getIsServer() then
local vehicle = g_currentMission.nodeToVehicle[nodeId];
if vehicle ~= nil then
g_currentMission:removeVehicle(vehicle);
end;
end;

Stefan K. Maan (unknown) 07.02.2012 16:14
is there a way to reverse the function. so you pay for getting a bale spawned?

123 Newsky (unknown) 22.06.2012 03:58
Who holds the craze issue? Many individuals strongly sense that when people get there with the requestment of trend, far more feelings about which can be arising around feasible. To the convenience and simplicity , splendor, great and cost tag and lots of crucial consciousness are soaring likewise.


Exploring forward to the targets of keeping contemporary, far extra as well as a good [url=http://www.christianlouboutinsp.com/christian-louboutin-bridal-shoes-c-4.html]christian louboutin wedding shoes[/url] deal much more methods need to have to get taken at the second. [url=http://www.christianlouboutinsp.com/]christian louboutin discount[/url] Within the occasion you choose some suitable steps , the earth will be the inspired current.


Christian Louboutin No Restrict Flat Sneakers Multicolor


Currently I'll offer you with this sort of selling price reduction Christian Louboutin footwear.


The pair of footwear known as Christian Louboutin No Restrict Flat Sneakers Multicolor. Due to the fact it has produced with best dot points, it isn't essentially a pair of [url=http://www.christianlouboutinsp.com/]christian louboutin shoes on sale[/url] footwear [url=http://www.christianlouboutinsp.com/christian-louboutin-bridal-shoes-c-4.html]christian louboutin daffodil[/url] that may be appropriate just after we are attending some significant occasions.


We are capable to realize the small print the pair of sneakers has opstitching and gold spikes and crystals [url=http://www.christianlouboutinsp.com/christian-louboutin-bridal-shoes-c-4.html]christian louboutin daffodil[/url] embellishment.Higher best rated layout,lace up,flat heel?and a lot more amazing facts.


A lot a lot more kinds of sneakers are on line obtaining website url to Louboutin footwear very low cost.


Manage your chance, maintain your terrific daily life. And that is we Christian Louboutin for you.


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