Smoke Ring Gun (based on Foly's Throwing Bombs script)

Version:

2.0

Added on:

10 Jul 2013 16:52

Tags:

Description:
This changes the Electroblaster projectiles to smoke rings, and that's it.

Credit to Foly.
const int cRingLifeTime = 55;
 
void CreateRing(int objectID) {
  int playerID = jjObjects[objectID].creator - 32768;
  int ringID = jjAddObject(OBJECT::SMOKERING, jjPlayers[playerID].xPos+(jjPlayers[playerID].direction*48), jjPlayers[playerID].yPos, jjPlayers[playerID].playerID, CREATOR::PLAYER);
  jjObjects[ringID].determineCurAnim(ANIM::CATERPIL, 6, true);
  jjObjects[ringID].direction = jjPlayers[playerID].direction;
}
 
void DestroyRing(int ringID) {
  int explosionID = jjAddObject(OBJECT::ELECTROBULLET, jjObjects[ringID].xPos, jjObjects[ringID].yPos, jjObjects[ringID].creator, CREATOR::PLAYER);
  jjDeleteObject(ringID);
  jjObjects[explosionID].determineCurAnim(ANIM::AMMO, 1, true);
  jjObjects[explosionID].state = STATE::EXPLODE;
}
 
void onMain() {

  p.ammo[9] = 3;
  
  for(int i = 1; i < jjObjectCount; i++) {
    if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::SMOKERING) {
      jjObjects[i].ySpeed = 0;
      jjObjects[i].xPos = jjObjects[i].xPos+(jjObjects[i].direction*10);
      if (jjObjects[i].counter > 10) jjDeleteObject(i);
    }
  }
  
  for (int i = 0;  i < jjObjectCount; i++)
    if (jjObjects[i].isActive && jjObjects[i].creatorType == CREATOR::PLAYER) {
    //Create smokering
    if (jjObjects[i].eventID == OBJECT::ELECTROBULLET && jjObjects[i].state != STATE::EXPLODE) {
      jjDeleteObject(i);
      CreateRing(i);
      continue;
    }
   
    //Destroy smokering
    if (jjObjects[i].eventID == OBJECT::SMOKERING) {
      jjObjects[i].age++;
        if (jjObjects[i].age > cRingLifeTime)
      DestroyRing(i);
      continue;
    }
    }
}