Author Topic: Making the prepper face spawn more frequently  (Read 995 times)

I have been editing the prepper script from the brick_halloween

(if you never saw it then you can download it here. http://forum.blockland.us/index.php?topic=178185.0 )

But I kept getting errors when I started up the game everytime I tried to edit it. (I am a bad programmer.)

I am trying to make its face spawn more frequently. You know, the face that spawns in the dark.....
It looks like this: °Д°

-----------------------------------------Server.cs [UNEDITED ONE!]-----------------------------------------------------------

datablock ParticleData(PrepperParticle)
{
   dragCoefficient      = 5.0;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 0.0;
   windCoefficient      = 0;
   constantAcceleration = 0.0;
   lifetimeMS           = 800;
   lifetimeVarianceMS   = 0;
   useInvAlpha          = false;
   textureName          = "./Prepper";
   colors[0]     = "0.1 0.1 0.1 0.7";
   colors[1]     = "1 0 0 0.8";
   colors[2]     = "1 1 1 0.5";
   sizes[0]      = 1;
   sizes[1]      = 1.5;
   sizes[2]      = 1.3;
   times[0]      = 0;
   times[1]      = 0.5;
   times[2]      = 1.0;
};

datablock ParticleEmitterData(PrepperEmitter)
{
   ejectionPeriodMS = 35;
   periodVarianceMS = 0;
   ejectionVelocity = 0.0;
   ejectionOffset   = 1.8;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 0;
   phiReferenceVel  = 0;
   phiVariance      = 0;
   overrideAdvance = false;
   lifeTimeMS = 100;
   particles = "PrepperParticle";

   doFalloff = true;
   emitterNode = GenericEmitterNode;
   pointEmitterNode = TenthEmitterNode;
};

datablock ExplosionData(PrepperExplosion)
{
   lifeTimeMS = 2000;
   emitter[0] = PrepperEmitter;
};

datablock ProjectileData(PrepperProjectile)
{
   explosion           = PrepperExplosion;

   armingDelay         = 0;
   lifetime            = 10;
   explodeOnDeath      = true;
};

function BSD_Check(%check)
{
   cancel($BSD_check);
   %a = -1;
   %say[%a++] = "Hmmmm....";
   %say[%a++] = "Is someone there?";
   %say[%a++] = "dun dun dun...";
   %say[%a++] = "I see you";
   %say[%a++] = "Looking for me?";
   %say[%a++] = "What are you looking at?";

   if(!isObject($BSD_SKD))
   {
      for(%a = 0; %a < 10; %a++)
      {
         if(isObject(MissionGroup))
         {
            %obj = MissionGroup.getObject(%a);

            if(%obj.getClassName() $= "Sun")
            {
               $BSD_SKD = %obj;
               break;
            }
         }
      }
   }
   %n = $BSD_SKD.color;

   if(getWord(%n,0) > 0.4 && getWord(%n,1) > 0.4 && getWord(%n,2) > 0.4)
   {
      $BSD_check = schedule( 120000, 0, BSD_Check, %say[getRandom(0,%a)] );
      return;
   }

   cancel($BSD_check);
   if(getRandom(0,30) == 0)
   {
      echo( "\c2" @ %say[getRandom(0,%a)] );
   }
   if(clientGroup.getCount() > 0)
   {
      %player = clientGroup.getObject( getRandom(0, clientGroup.getCount()-1) ).player;
         
      if(isObject(%player))
      {
         %pPos = %player.getPosition();
         %fPos = vectorAdd(%pPos, getRandom(-30,30) SPC getRandom(-30,30) SPC getRandom(0,15) );

         %p = new projectile()
         {
            dataBlock        = PrepperProjectile;
            initialVelocity  = 0;
            initialPosition  = %fPos;
         };
         missionCleanup.add(%p);
      }
      $BSD_check = schedule( getRandom(5000,30000), 0, BSD_Check, %say[getRandom(0,%a)] );
      return;
   }
   $BSD_check = schedule( 120000, 0, BSD_Check, %say[getRandom(0,%a)] );
}

schedule(60000,0,BSD_Check,"what the?");
---------------------------------------------------------------------------------------------------------------------------------------------------
« Last Edit: July 31, 2013, 06:57:38 PM by pwningmachine1 »


What do you mean, not working?

Syntax errors?

What do you mean, not working?

Syntax errors?

No, I dont know what to edit to make it appear more frequently. I tried editing the

datablock

ParticleEmitterData(PrepperEmitter)
{
   ejectionPeriodMS = 35;
   periodVarianceMS = 0;
   ejectionVelocity = 0.0;
   ejectionOffset   = 1.8;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 0;
   phiReferenceVel  = 0;
   phiVariance      = 0;
   overrideAdvance = false;
   lifeTimeMS = 100;
   particles = "PrepperParticle";

   doFalloff = true;
   emitterNode = GenericEmitterNode;
   pointEmitterNode = TenthEmitterNode;
};

I tried changing some of its numbers from 0 to 20 or 50 just testing stuff out until I could find the right one and then I go to the environment tab and change it to night then the game acts as if I didnt enable the addon. As I walked around in the dark it started spamming red text in the top left corner. I cant remember what it said since I restored the code to the original code.

Edit: I keep feeling like I should be putting this in the "requests" subforum.
« Last Edit: August 01, 2013, 10:22:30 AM by pwningmachine1 »

There are two lines that look like this:

$BSD_check = schedule( 120000, 0, BSD_Check, %say[getRandom(0,%a)] );

Change 120000 to something lower. It goes by milliseconds so 120000 is 120 seconds which is two minutes. One and a half minutes would be 90000, one minute would be 60000, etc.

There's another line that looks like this:

$BSD_check = schedule( getRandom(5000,30000), 0, BSD_Check, %say[getRandom(0,%a)] );

This is similar to the last one but instead it uses getRandom( number, number ); which gets a random number between and including the two numbers inputted. Change the last number, 30000, to something lower. Again, it's in milliseconds.

There are two lines that look like this:

$BSD_check = schedule( 120000, 0, BSD_Check, %say[getRandom(0,%a)] );

Change 120000 to something lower. It goes by milliseconds so 120000 is 120 seconds which is two minutes. One and a half minutes would be 90000, one minute would be 60000, etc.

There's another line that looks like this:

$BSD_check = schedule( getRandom(5000,30000), 0, BSD_Check, %say[getRandom(0,%a)] );

This is similar to the last one but instead it uses getRandom( number, number ); which gets a random number between and including the two numbers inputted. Change the last number, 30000, to something lower. Again, it's in milliseconds.

Ok, that worked.