Page 1 of 1

Connectors?

Posted: Sat Dec 06, 2014 8:27 pm
by MadCatter
I have defined my own door object, and want to set it so that it can trigger an event or object when it is opened.

Is there a way to set up a "blank" connector for a certain trigger in the object definition, that can be later set to a target within the editor?

Setting the Component:addConnector(event, target, action) in the onInit stage seems to require a full definition and I haven't found a way of setting this so that it doesn't do something unwanted while still being valid.

Re: Connectors?

Posted: Sat Dec 06, 2014 8:31 pm
by THOM
Well, something has to trigger your door to open. Why do you not trigger in the same moment your script?

Re: Connectors?

Posted: Sat Dec 06, 2014 8:36 pm
by MadCatter
Sorry, I should probably clarify.

The door is already opened by clicking on it. (thanks Doridion).
I want it to be able to trigger an external secondary event when the door is opened, but I don't want to specify that within the script as I want it to do different things in different areas.

Re: Connectors?

Posted: Sat Dec 06, 2014 11:27 pm
by Prozail
According to the script reference DoorComponents have onOpen and onClose events.

DoorComponent.onOpen(self)
DoorComponent.onClose(self)

Re: Connectors?

Posted: Sat Dec 06, 2014 11:36 pm
by GoldenShadowGS
You can add connectors by script if they aren't showing up in the editor

Code: Select all

door_1.clickable:addConnector("onClick", "yourScript", "yourFunction")
or

Code: Select all

door_1.clickable:addConnector("onClick", "dungeon_door_2", "open")