Author Topic: Brick plant - set events  (Read 824 times)

I can't, for the life of me, figure out how to make a brick spawn with events set on to it, i've looked through the JVS_Content script and I just can't figure it out. How do the JVS bricks get planted with all their events?

Have you tried looking through their .cs file?

I can't, for the life of me, figure out how to make a brick spawn with events set on to it, i've looked through the JVS_Content script and I just can't figure it out. How do the JVS bricks get planted with all their events?

Did you even read the OP?

Look at the Checkpoint brick that came with v18.

Look at the Checkpoint brick that came with v18.

/facedesk

I forgot those even existed. Thanks :D

There's a glitch with the checkpoint bricks, it recreates the events every time its loaded even if the events were already created. This is my way of applying events on plant:
Code: [Select]
package TreasureChest
{
function servercmdPlantbrick(%client)
{
parent::servercmdPlantBrick(%client);
%obj = %client.brickGroup.getObject(%client.brickGroup.getCount()-1);
if(%obj.getDatablock().getName() $= "brickTreasure_ChestData")
{
%enabled     = 1;
%delay       = 0;
%inputEvent  = "onActivate";
%target      = "Self";
%outputEvent = "openChest";
%obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent);
%enabled     = 1;
%delay       = 0;
%inputEvent  = "onChestOpened";
%target      = "Client";
%outputEvent = "bottomPrint";
%par1 = "You already opened this chest.";
%obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent,%par1,3);
}
}
};

There's a glitch with the checkpoint bricks, it recreates the events every time its loaded even if the events were already created. This is my way of applying events on plant:
Code: [Select]
package TreasureChest
{
function servercmdPlantbrick(%client)
{
parent::servercmdPlantBrick(%client);
%obj = %client.brickGroup.getObject(%client.brickGroup.getCount()-1);
if(%obj.getDatablock().getName() $= "brickTreasure_ChestData")
{
%enabled     = 1;
%delay       = 0;
%inputEvent  = "onActivate";
%target      = "Self";
%outputEvent = "openChest";
%obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent);
%enabled     = 1;
%delay       = 0;
%inputEvent  = "onChestOpened";
%target      = "Client";
%outputEvent = "bottomPrint";
%par1 = "You already opened this chest.";
%obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent,%par1,3);
}
}
};

I have the feeling that this method is incompatible with the duplicator because the duplicator makes more than one object when you call servercmdplantbrick.

I have the feeling that this method is incompatible with the duplicator because the duplicator makes more than one object when you call servercmdplantbrick.
It'd work fine. Like he said, that's only called when you plant the brick. So when you duplicate that brick, the events are already there, so they duplicate just fine.