Blockland Forums > Modification Help

Setting events on a Brick through Script

Pages: (1/1)

Ipquarx:

Hey, i'm trying to set a bricks events through script, and it's not working. Yes im trying to use zone events. More specifically, i'm trying to make it so the brick is evented so that when a player is on a brick, a client variable is set to true. when the person leaves, it sets to false. Here's what ive tryed:

--- Code: ---%brick.eventInput0 = "onPlayerEnterZone";
%brick.eventTarget0 = "Client";
%brick.eventOutput0 = "isInBrickTrue";
%brick.eventInput1 = "onPlayerLeaveZone";
%brick.eventTarget1 = "Client";
%brick.eventOutput1 = "isInBrickFalse";

--- End code ---
How can i get this to work?

jes00:

Look at the Checkpoint brick.

Do

--- Code: ---function YOURBRICKNAMEData::onPlant(%data, %obj)
{
   %obj.enableActivate = true;

   %enabled     = 1;
   %delay       = 0;
   %inputEvent  = "INPUT EVENT";
   %target      = "TARGET";
   %outputEvent = OUTPUT EVENT;
   %par1        = "PARAMETER(if you need it)";
   %par2        = "PARAMETER(if you need it)";
   %par3        = "PARAMETER(if you need it)";
   %par4        = "PARAMETER(if you need it)";
   %obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent, %par1(if you need it), %par2(if you need it), %par3(if you need it), %par4(if you need it));
}

function YOURBRICKData::onLoadPlant(%data, %obj)
{
   Parent::onLoadPlant(%data, %obj);
   %obj.enableActivate = true;
}

--- End code ---
That should work if you do it correctly.

Ipquarx:

Alright, i'll try that when I get home from school.

Ipquarx:

What would be the function names for a 32x32 baseplate?
Also, do both those need to be in packages?

Pages: (1/1)

Go to full version