Thanks, god damn i feel stupidminmay wrote:Check the box that says "disableSelf".

Thanks, god damn i feel stupidminmay wrote:Check the box that says "disableSelf".
I haven't seen an update yet to the software so I don't think we can yet. It was my primary reason to set LoG2 coding aside and just lurk around the forums.cameronC wrote:I don't suppose anyone has an answer/work around to get addConnector to work with item hooks yet?
(Related to this thread and some others...)
So you can make this work...minmay wrote:What? Of course there is a workaround, you have scripting access to all the hooks that connectors do. In fact, all of the work has already been done for you, over a month ago.
Code: Select all
function myTestSpawn()
local o = spawn("rope", party.level, party.x, party.y, 0, party.elevation)
o.item:addConnector("onEquipItem", "lib", "aaa")
o.item:addConnector("onUnequipItem", "lib", "bbb")
end
function aaa()
print("A")
end
function bbb()
print("B")
end
Well, you cannot overwrite the native addConnector method as far as I know, so you can't use that exact code. You would use something like this:NutJob wrote:So you can make this work...minmay wrote:What? Of course there is a workaround, you have scripting access to all the hooks that connectors do. In fact, all of the work has already been done for you, over a month ago.
Code: Select all
function myTestSpawn() local o = spawn("rope", party.level, party.x, party.y, 0, party.elevation) o.item:addConnector("onEquipItem", "lib", "aaa") o.item:addConnector("onUnequipItem", "lib", "bbb") end function aaa() print("A") end function bbb() print("B") end
...without an error?
Code: Select all
function myTestSpawn()
local o = spawn("rope", party.level, party.x, party.y, 0, party.elevation)
fw.script:set(o.id..'@item.whateverNamespaceYouWant.onEquipItem',aaa)
fw.script:set(o.id..'@item.whateverNamespaceYouWant.onUnequipItem',bbb)
end
function aaa()
print("A")
end
function bbb()
print("B")
end
Code: Select all
function teleporterrotation()
teleporter_13.controller:activate()
teleporter_13.controller:deactivate()
end
Code: Select all
function teleporterrotation()
teleporter_13.controller:activate()
delayedCall("teleporter_13",1.5,"deactivate")
end
Thank you !minmay wrote:Since the teleporter object has a ControllerComponent named "controller", you can use the global delayedCall function:to deactivate the teleporter after 1.5 seconds.Code: Select all
function teleporterrotation() teleporter_13.controller:activate() delayedCall("teleporter_13",1.5,"deactivate") end