Connectors?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
MadCatter
Posts: 34
Joined: Mon Nov 03, 2014 5:02 am
Location: Southampton, UK

Connectors?

Post 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.
User avatar
THOM
Posts: 1267
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Connectors?

Post by THOM »

Well, something has to trigger your door to open. Why do you not trigger in the same moment your script?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
MadCatter
Posts: 34
Joined: Mon Nov 03, 2014 5:02 am
Location: Southampton, UK

Re: Connectors?

Post 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.
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: Connectors?

Post by Prozail »

According to the script reference DoorComponents have onOpen and onClose events.

DoorComponent.onOpen(self)
DoorComponent.onClose(self)
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Connectors?

Post 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")
Post Reply

Return to “Mod Creation”