Author Topic: Wands that Spawn Triggers.  (Read 1299 times)

Title explains it really. How do you get a wand to spawn a trigger. I've tried this:

Code: [Select]
function lolplsProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
   %trigger = new Trigger()
   {
      dataBlock = lolpls;
      position = %pos;
   };
   MissionCleanup.add(%trigger);
}

Obviously lolpls is not actually what i've put but im using lolpls as an example.

(The triggers in the same file as the wand)

I think that would work, but it isn't very useful if it isn't the right size. If you want an example, check the Scale Changer or my Race Mod wands to see examples (They're packed with tons of stuff but you should be able to find it...).

I tried looking at you Finish maker thingy but i dont see what you did all you done was put the triggers at the end, and that thing up there dosent work it spawns a wierd green box that if you click on crash's BL lol.

The 'weird green box' is the trigger. Sometimes I crash while in F11 if I select something, go to F3 (Properties Inspector), delete it and attempt to edit its properties.

I think it's either related to the problem above, or to do with this:
Code: [Select]
if(getSubStr(%col.dataBlock,0,5) $= "brick")
{
                                   //Other coding above to do with other Team Set Gun modes
if(%obj.client.GunMode == 8)
{
     %i = new Trigger() {
    position = getWord(%col.getTransform(),0) - 0.5 SPC getWord(%col.getTransform(),1) + 0.5 SPC getWord(%col.getTransform(),2);
    rotation = "1 0 0 0";
    scale = "1 1 1.2";
    dataBlock = GreenTeamSetTrigger;
    polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
   };
  %i.isTeamDM = 1;
  %i.brick = %col;
  messageClient(%obj.client,"","\c3Brick set as Team 3 (\c2green\c3) Join Trigger.");
}
                                  //Other coding to do with checking modes.
}
(From Team DM Mod)

Try copying the Polyhedron line into your script, I think that may be the problem. You could use the Position and Is Brick check as well. 1 Torque Unit = 2 studs.

I don't think that triggers are a very good method - you hit them with your 'bounding box', which is much larger than the actual 'you' - look at yourself in F11. Try having this code:

Code: [Select]
function lolplsProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
              if(getSubStr(%col.dataBlock,0,5) $= "brick")
             {
                          if(%col.lolpls)
                          {
                                       messageClient(%obj.client,"","\5Brick no longer \c0lolpls\c5.");
                                       %col.lolpls = 0;
                          }
                          else
                          {
                                       messageClient(%obj.client,"","\5Brick now a \c0lolpls\c5 brick.");
                                       %col.lolpls = 0;
                          }
             }
}


package ImpactChecker
{
function Armor::onImpact(%this, %obj, %collidedObject, %vec, %vecLen)
{
   if(%collidedObject.lolpls)
   {
     //Execute whatever code you want.
   }
   Parent::OnImpact(%this, %obj, %collidedObject, %vec, %vecLen);
}
}
ActivatePackage("ImpactChecker");

I need it to be a trigger its the easyest way i could think of to make a homey. (im making tag)

Thanks Space, Adding the Polyhegron thing worked.
 Nvm, Got it to only work on bricks now. W00t almost finished.

I tryed adding a schedule to my trigger so that people cant be wimps and stay in the homey and now it dosent work. I also added summin to check if the person is an admin.
« Last Edit: May 26, 2007, 11:46:30 AM by MrPickel »