3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Help Me with this Script  (Read 128 times)

« on: March 28, 2014, 06:56:17 AM »
Hi

I made a Project that after contact the car with a rigidbody, my gun as skin mesh is shown. for fire and shoot bullets I wrote a script that disable work at start and work when the car contact with rigidbody, Now I want after finish the bullets, after contact again (the car with rigidbody) reset the bullet.

Please Guide Me.

Code: [Select]
int Bullet = 100;

void Main()
{
   OUT_66 = Bullet; // valuePrint
   if (iKeyDown(iKeyCode("DIK_SPACE")))
   {
      Bullet -= 1;
      if (Bullet <= 0)
      {
         Bullet = 0;
         iObjectHide (OBJ_22); // hide gun (as skin mesh)
      }
   }
}

this is my Project:
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
« Reply #1 on: March 28, 2014, 01:08:18 PM »
copy and paste this into your script replacing the current one.

Code: [Select]
int Bullet = 100;

void Main()
{
   OUT_66 = Bullet;
   if (iKeyDown(iKeyCode("DIK_SPACE")))
   {
      Bullet -= 1;
      if (Bullet <= 0)
      {
         Bullet = 0;
         iObjectHide (OBJ_22);
         iObjectStart (OBJ_44);
      }
   }
///  NEW Line added here
    if (IN_44>0 && Bullet==0) Bullet=100;
/// --------------------
}
« Reply #2 on: March 28, 2014, 03:03:13 PM »
Thanks TinSoldier.
work very well. ;)
My Game : Star Wars 1.0

http://behdadgame.com/index.php?topic=3.0

possible way, if we found will make a way.
Pages: [1]