I have several GO spawn…and when two of the same objects collide I have them deleting, but I can’t figure out why I can’t spawn new objects based on the previous object deletion. My issue appears that I can’t get my else if statement working properly. I can spawn a new object, but I want to do it based on what object was just deleted. So if an onion is deleted it spawns a red onion…if a red onion is deleted it spawns a radish. and if a radish is deleted it spawns a carrot.
When I print the object for my if statement it gives me one of the following:
DEBUG:SCRIPT: hash: [radish]
DEBUG:SCRIPT: hash: [onion]
DEBUG:SCRIPT: hash: [redonion]
but how do I test for that in my if statement? I’ve tried nearly everything I can think of. My issue appears to be in the If statement…I can’t test if that is true or not…everything comes back false so it ignores my if statement.
my currently else statemetn
function spawnnewVeggie(group, pos)
print(group)
--factory.create("main:/factories#carrotfactory")
if group == "#radish" then
factory.create("main:/factories#redonionfactory")
elseif group == "hash: [radish]" then
factory.create("main:/factories#raddishfactory")
elseif group == "hash: [radish]" then
factory.create("main:/factories#carrotfactory")
end
end