Category | Scripting |
Created | 05.12.2014 18:38 |
Jack O'niell (shadow250) | 05.12.2014 18:49 |
---|---|
im trying to fix this mod but the log gives an error on line 30. i think the sprayerfilltrigger is wrong. if i replace it with FillTrigger the mod will place but i cant fill a sprayer. if someone knows what i need to put here it would be awesome if you told me. also if not too much trouble the one for seed pallets too. waterTankPlaceable = {}; waterTankPlaceable_mt = Class(waterTankPlaceable, Placeable); InitObjectClass(waterTankPlaceable, "waterTankPlaceable"); function waterTankPlaceable:new(isServer, isClient, customMt) local self = Placeable:new(isServer, isClient, waterTankPlaceable_mt); registerObjectClassName(self, "waterTankPlaceable"); return self; end; function waterTankPlaceable:delete() removeTrigger(self.SprayerFillTriggerId); unregisterObjectClassName(self); waterTankPlaceable:superClass().delete(self); end; function waterTankPlaceable:deleteFinal() waterTankPlaceable:superClass().deleteFinal(self); end; function waterTankPlaceable:load(xmlFilename, x,y,z, rx,ry,rz, moveMode, initRandom) if not waterTankPlaceable:superClass().load(self, xmlFilename, x,y,z, rx,ry,rz, moveMode, initRandom) then return false; end; local xmlFile = loadXMLFile("TempXML", xmlFilename); self.TriggerId = Utils.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.SprayerFillTrigger#index")); SprayerFillTrigger:onCreate(self.SprayerFillTriggerId); <----(line 30) delete(xmlFile); return true; end; function waterTankPlaceable:update(dt) end; registerPlaceableType("waterTankPlaceable", waterTankPlaceable); |
John Doe (Unknown) | 05.12.2014 23:57 |
---|---|
And what is the exact error message ? |
Jack O'niell (shadow250) | 07.12.2014 22:40 |
---|---|
Error: Running LUA method 'mouseEvent'. C:/Users/iceman2/Documents/my games/FarmingSimulator2015/mods//placeable_fertilizerTank/waterTankPlaceable.lua:30: attempt to index global 'sprayerFillTrigger' (a nil value) |
Bjoern J (Bluebaby210) | 09.12.2014 18:18 |
---|---|
self.TriggerId = Utils.indexToObject(self.nodeId, getXMLString(xmlFile, "placeable.SprayerFillTrigger#index")); SprayerFillTrigger:onCreate(self.SprayerFillTriggerId); <----(line 30) self.TriggerId is Index to Trigger, from XML, but then you write self.SprayerFillTrigger. self.SprayerFillTrigger is nil. I think that this is your error. Try it with this: SprayerFillTrigger:onCreate(self.TriggerId); <----(line 30) |
Note: Log in to post. Create a new account here.