Author Topic: Barriers?  (Read 976 times)

Hello everyone as you may see I am new here and was wondering if someone could point me in the right direction on how to make somthing go and come back for example, and if the player was to touch it the barrier would send an impulse to him/her and sending him back a phew steps like a force feild.

For 10 minutes a barrier would be there say like this_l_ and then after that time span the barrier will vanish for 5 minutes _ _ then respawn in a loop.


10(gone)=_ _, 5(after vanishing)=_l_,Another 10(vanish again)_ _


Could anyone seem to help me out here? Oh and also many thanks to those who help me out.

As in  a brick or an invisble forcefield.

An invisable forcefeild.

You'd have to have a model for an invisible wall, and make a datablock for it.

Then, the code is pretty straight-forward:
Code: [Select]
function MyInvisibleWallDataBlock::onCollision(%data, %wall, %obj, %pos)
{
      if( %obj.getClassName() $= "Player" )
      {
            %vel = %obj.getVelocity();
    %obj.setVelocity( VectorScale(%vel, -7) );
      }
}

function InvisibleWallLoop(%this)
{
      if( isObject(%this) )
      {
            $InvisibleWallTrans = %this.getTransform();
            $InvisibleWallClass = %this.getClassName();
            %this.delete();
            %time = 300000; // 5 mins
      }
      else
      {
            %this = new ($InvisibleWallClass)()
            {
                   dataBlock = MyInvisibleWallDataBlock;
            };
            %this.setTransform( $InvisibleWallTrans );
            %time = 600000; // 10 mins
      }

      schedule(%time, 0, "InvisibleWallLoop", %this);
}
Just replace MyInvisibleWallDataBlock with whatever the name is for the datablock of the invisible wall.
« Last Edit: April 06, 2008, 03:09:21 PM by exidyne »

You need to make a cmmd to spawn it.