Author Topic: [SOLVED] Adding an event to a brick under BrickGroup_888888  (Read 1837 times)

Now that the AIConnection class is deprecated, I don't know how to add events to a brick. Using ScriptObjects as clients results in "unknown command getBLID()" errors, and I can't override that function.
« Last Edit: January 14, 2015, 03:51:16 AM by Axo-Tak »

I've made a trust bypass before, which you can do: SetMutualBrickGroupTrust(bl_id,targetbl_id,trustlevel);
ex: SetMutualBrickGroupTrust(20490,888888,2); (Full trust)

I've made a trust bypass before, which you can do: SetMutualBrickGroupTrust(bl_id,targetbl_id,trustlevel);
ex: SetMutualBrickGroupTrust(20490,888888,2); (Full trust)
No I mean like directly adding events to a brick from script.

i feel like there are definitely methods to do this

if nothing else you can add the relevant variables directly, though this can get pretty fiddly depending on what you're doing

Take a look at the default door bricks as they add events when loaded, planted, or created by other methods.

Take a look at the default door bricks as they add events when loaded, planted, or created by other methods.

They add by directly modifying the variables.
Code: [Select]
...
        function fxDTSBrick::onPlant( %obj )
        {
                %data = %obj.getDataBlock();

                //apply events
                if( %data.isDoor && !%data.skipDoorEvents )
                {
                        %obj.eventDelay0 = 0;
                        %obj.eventEnabled0 = 1;
                        %obj.eventInput0 = "onActivate";
                        %obj.eventInputIdx0 = inputEvent_GetInputEventIdx( "onActivate" );
                        %obj.eventOutput0 = "door";
                        %obj.eventOutputAppendClient0 = 1;
                        %obj.eventOutputIdx0 = outputEvent_GetOutputEventIdx( "fxDTSBrick","door" );//37;
                        %obj.eventOutputParameter0_1 = 0;
                        %obj.eventTarget0 = "Self";
                        %obj.eventTargetIdx0 = 0;
                        %obj.numEvents = 1;
                }
...

Then you can do it too; check %obj.numEvents and then add your events after that index.

The checkpoint brick has a nice example.

The checkpoint brick has a nice example.
Checkpoint brick doesn't work with BrickGroup_888888 (I don't think so...?)

Checkpoint brick doesn't work with BrickGroup_888888 (I don't think so...?)
I meant look at the function onLoadPlant of how the events work