Hey I just tried that from Lark
message.scrollitem:setScrollText("This is an important\nmessage!")
I removed the container:additem for message and staff and they all spawn next the to the wooden box.
attempt to call the method additem ( a nil value)
Adding it to that box if the issues. Should we name (id) the box ?
Spawning Sack sand boxes with loot in them
Re: Spawning Sack sand boxes with loot in them
function sackWithLongSword()
self.go:spawn("sack").containeritem:addItem(spawn("long_sword").item)
end
In LOG2 you would have to do this to make a sack with an item, in this case a long sword
You could also do this
function sackWithLongSword()
local sack = spawn("sack", 1, 15, 15, 0)
sack.containeritem:addItem(spawn("long_sword").item)
end
This is because components are different from strings
I would recommend steering clear of coding in LOG2 for anyone not used to lua
self.go:spawn("sack").containeritem:addItem(spawn("long_sword").item)
end
In LOG2 you would have to do this to make a sack with an item, in this case a long sword
You could also do this
function sackWithLongSword()
local sack = spawn("sack", 1, 15, 15, 0)
sack.containeritem:addItem(spawn("long_sword").item)
end
This is because components are different from strings
I would recommend steering clear of coding in LOG2 for anyone not used to lua
Re: Spawning Sack sand boxes with loot in them
Welcome to the forum TBWNight.TBWNight wrote:function sackWithLongSword()
self.go:spawn("sack").containeritem:addItem(spawn("long_sword").item)
end

This is the LoG(1) section of the forum, so the Lua script examples have to take into account the lack of a component model in LoG1.
*Meaning: self.go:spawn("sack").containeritem:addItem(spawn("long_sword").item) does not work in LoG1.
(Because there are no .go and no .containerItem, and no .item in the game objects.)
**Also, this thread is three years old.
