
Your videos are really great, Skuggasveinn, I look forward to more.
Code: Select all
function getGraphicAtlas()
print(spawn("assassin_dagger").gfxAtlas:getGfxAtlas())
end
function getGraphicIndex()
print(spawn("assassin_dagger").gfxIndex:getGfxIndex())
end
Code: Select all
print(spawn("assassin_dagger").item:getGfxIndex())
Code: Select all
function surfaceContains(surface, item)
for v,i in surface:contents() do
if i.go.name == item then return true
end
end
end
function openPowerGemDoor()
if surfaceContains(castle_alcove_2,"peasant_cap_1") then
castle_door_portcullis_10.door:open()
end
end
Tested this, it works:blob wrote:Hi!
I'm unable to make the alcove code work.
I basically just copied the script from your video and changed the name of items to fit my map as a test but I get " attempt to call method 'contents' ( a nil value) " on line 2.
Code: Select all
function surfaceContains(object, item)
for _, i in object.surface:contents() do
if i.go.id == item then return true end
end
end
function openPowerGemDoor()
if surfaceContains(castle_alcove_2, "peasant_cap_1") then
castle_door_portcullis_10.door:open()
end
end
Me too! I had trouble with coding surfaces because contents() is not listed in the reference.blob wrote:Ah! Thanks a ton to the two of you!
I now understand my confusion with name and Ids, thanks.
surface.surface:contents() does work too btw! But now I'm confused as to why the example from the tutorial is missing the reference and seemed to be working for Skugga.