Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get a table
torch_holder_1:removeComponent("socket")
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get nil
torch_holder_1:createComponent("socket") -- ERROR. "socket X"
function cTest()
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get a table
torch_holder_1:removeComponent("socket")
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get nil
torch_holder_1:createComponent("Socket")
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get a table
end
it's stupid, but.... the class is case-sensitive on create... and ofc you need to set all the other parameters again afterwards.
function cTest()
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get a table
torch_holder_1:removeComponent("socket")
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get nil
torch_holder_1:createComponent("Socket")
c = torch_holder_1:getComponent("socket")
print(c) -- Works, get a table
end
it's stupid, but.... the class is case-sensitive on create... and ofc you need to set all the other parameters again afterwards.
Ack!! Yup that was it. Capitals on create and lower-case on get. Man, how did you guys figure that out! Thanks.
My very uneducated guess tells me that, "socket" (lowercase) is the instance name, whereas "Socket" is actually the classname where the "Component" part of "SocketComponent" gets removed by convention.