Thanks, god damn i feel stupidminmay wrote:Check the box that says "disableSelf".
Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
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...)
(Related to this thread and some others...)
Writer and sometimes artist of the very slightly acclaimed comic series Scrambled Circuits. A comic series about a robot written by a human.
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Re: Ask a simple question, get a simple answer
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...)
Re: Ask a simple question, get a simple answer
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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
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?
Re: Ask a simple question, get a simple answer
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
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
-
- Posts: 2
- Joined: Sun Dec 28, 2014 6:48 am
Re: Ask a simple question, get a simple answer
How do I put a delay in between the activate and deactivate ?
Code: Select all
function teleporterrotation()
teleporter_13.controller:activate()
teleporter_13.controller:deactivate()
end
Re: Ask a simple question, get a simple answer
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
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
-
- Posts: 2
- Joined: Sun Dec 28, 2014 6:48 am
Re: Ask a simple question, get a simple answer
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
Re: Ask a simple question, get a simple answer
Here's a simple question: I was trying to use setAiState to shift a monster from guard to its default ai state, but I really have no idea what i'm doing. Any help would be greatly appreciated.