Community Forum

g_currentMission:addNodeObject() in mod script cause error

Forum Overview >> Scripting

CategoryScripting
Created10.02.2019 21:47


Heady Planet-ls (Headshot XXL) 10.02.2019 21:47
g_currentMission:addNodeObject(triggerId, self); does not work on Mod Script:

function OutputTrigger:load(nodeId)
addTrigger(triggerId, "triggerCallback", self)
g_currentMission:addNodeObject(triggerId, self)
end

2019-02-10 21:36 Error: Running LUA method 'update'.
2019-02-10 21:36 dataS/scripts/BaseMission.lua(1137) : Error: [BaseMission:addNodeObject] node(cowManureHeapShovelCol) object(table: 0x470dcd38)


A standard class does not work either: UnloadTrigger Line 68

MyClass:load(nodeId, xmlFile)
self.unloadPlace = UnloadTrigger:new(self.isServer, self.isClient)
if self.unloadPlace:load(nodeId, xmlFile2Nil, configKey, self) then
self.unloadPlace:register(true)
else
self.unloadPlace:delete()
return false
end
end

2019-02-10 21:25 Error: Running LUA method 'update'.
2019-02-10 21:25 dataS/scripts/BaseMission.lua(1137) : Error: [BaseMission:addNodeObject] node(Trigger_Bunker) object(table: 0x1048e3f8)


Does g_currentMission:addNodeObject(triggerId, self) work by someone?

Heady Planet-ls (Headshot XXL) 13.02.2019 20:41
I think I found the issue myself.

For others:
When creating a new placeable type with custom script. and a sub-script / class calls at the "g_currentMission: addNodeObject (triggerId, self);" is included, you have to be careful.

All static, dynamic and kinematic shapes in the placeable i3d are added to g_currentMission: addNodeObject (node, self) at MyPlaceable: load (xmlFilename, x, y, z, rx, ry, rz, initRandom).

With g_currentMission: addNodeObject (nodeId, self) the nodeId can only be added once. The next time there is an error, for example: "dataS / scripts / BaseMission.lua (1137): Error: [BaseMission: addNodeObject] node (cowManureHeapShovelCol) object (table: 0x470dcd38)"

For MyPlaceable: collectPickObjects (node) you have to add the triggerId of the sub-script / class. For example, see BgaPlaceable: collectPickObjects(). It prevents the node triggerId from being entered again.



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