Author Topic: Adding an event to a spawned brick  (Read 927 times)

I was messing around with one of my old scripts
kinda like BrianSmith's tron
soo
I wanted to make it kill vehicles when it touches them
I looked at JVS and the Mining Mod for the event thing/kill person

jvs is
$JVS::Content::Type::eventInput[0] = "\"onActivate\"";
repeated and changed

Mning is
function minelava::mined(5this, %client, %brick, %mode)

sooo
I wanted some help with adding it here:


   %brick = new fxDTSBrick()
   {
      datablock = brick1x1fData;
      position = vectorAdd(%pos,"0 0 -0.3");
      isPlanted = 1;
   
         colorID = %obj.client.currentColor;
         colorfxid = 3;
      };
      
      if(!isObject(BrickGroup_10103))
      {
         new SimGroup(BrickGroup_10103)
         {
            bl_id = 10103;
            name = "MARBLE MAN";
         };
         
         MainBrickGroup.add(BrickGroup_10103);
      }
      
      %brick.setTrusted(1);
      %brick.plant();
      BrickGroup_10103.add(%brick);
      
      %trans = %obj.getTransform();
      %obj.setTransform(getWords(%trans,0,1) SPC getWord(%pos,2) - 0.05 SPC getWords(%trans,3));
      
      %obj.VehicleTrail = %brick;
   }



Please help me add the event "onvehicletouch" "vehicle" "destroy"


EDIT

I need help making the bricks be the operator(person who activated the script)'s bricks.
I also need help making the bricks kill players who have a different ID.
Could anyone give advice?
« Last Edit: May 15, 2012, 09:59:15 PM by MARBLE MAN »

From Brick_Checkpoint:
Code: [Select]
function brickCheckpointData::onPlant(%data, %obj)
{
   %obj.enableTouch = true;

   %enabled     = 1;
   %delay       = 0;
   %inputEvent  = "OnPlayerTouch";
   %target      = "Self";
   %outputEvent = "PlaySound";
   %par1        = Beep_Popup_Sound.getId();
   %obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent, %par1);
}

Figure out the rest yourself.

From Brick_Checkpoint:
Code: [Select]
function brickCheckpointData::onPlant(%data, %obj)
{
   %obj.enableTouch = true;

   %enabled     = 1;
   %delay       = 0;
   %inputEvent  = "OnPlayerTouch";
   %target      = "Self";
   %outputEvent = "PlaySound";
   %par1        = Beep_Popup_Sound.getId();
   %obj.addEvent(%enabled, %delay, %inputEvent, %target, %outputEvent, %par1);
}

Figure out the rest yourself.
*facepalm
thanks - i should have thought
« Last Edit: May 12, 2012, 11:08:30 PM by MARBLE MAN »

You LIE ... This doesnt work...

forgot something ...........
« Last Edit: May 12, 2012, 10:30:46 PM by MARBLE MAN »

If you don't know where to place it or use it in a way that it works, you shouldn't be scripting.

This topic hurts... almost as much as reading some peoples code...

This topic hurts... almost as much as reading some peoples code...
meh

I want to see you try

ahahahahaha, if I tried, I would have to post it. If I posted it, you would have the code with no work on your end.

Brb, trying and showing port.

ahahahahaha, if I tried, I would have to post it. If I posted it, you would have the code with no work on your end.

Brb, trying and showing port.
I've been working, i dont want your code...
I just want to see you do it (on your server)

I have some code to add specific events to a brick, I can get them for you tommorow.

Port practically gave him the code above.

I have some code to add specific events to a brick, I can get them for you tommorow.
Thankyou

Woah woah how is that hard to understand? That is so incredibly straightforward I never would have even guessed.


I've had trouble with named brick targets and the addEvent method.

Not sure how exactly they work with it.