Downloads containing script test.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Script Test szmol96 Custom / Concept N/A Download file

File preview

/*****Boolz**********************************************************************************/

bool weaponIsBouncer = false;
bool weaponIsFreezer = false;
bool weaponIsRF = false;
bool weaponIsToaster = false;
bool weaponIsTNT = false;
bool weaponIsGun8 = false;
bool shellMoved = false; 

/*****Integers*******************************************************************************/

int reloadTimer = 0;

/*****Object Modifiers***********************************************************************/

void onMain() {
	jjObjectPresets[OBJECT::RFBULLETPU].counterEnd = 2;
	jjObjectPresets[OBJECT::RFBULLETPU].xAcc = 25;
	jjObjectPresets[OBJECT::RFBULLETPU].xSpeed = 5;
	
//	jjObjectPresets[OBJECT::BLASTERBULLET].xAcc = 1000;
//	jjObjectPresets[OBJECT::BLASTERBULLET].xSpeed = 5;
//	jjObjectPresets[OBJECT::BLASTERBULLET].counterEnd = 254;
//	jjObjectPresets[OBJECT::BLASTERBULLET].determineCurAnim(ANIM::ROBOT, 0);

	jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 2;
	
	jjObjectPresets[OBJECT::BOUNCERBULLET].counterEnd = 5;
	jjObjectPresets[OBJECT::BOUNCERBULLET].determineCurAnim(ANIM::AMMO, 9);
	
//	jjObjectPresets[OBJECT::TOASTERBULLET].yAcc = 0;
//	jjObjectPresets[OBJECT::TOASTERBULLET].ySpeed = 5;
//	jjObjectPresets[OBJECT::TOASTERBULLET].light = 0;

	jjObjectPresets[OBJECT::TUFTURT].xSpeed = 50;
	jjObjectPresets[OBJECT::TUFTURT].energy = 100;
	jjObjectPresets[OBJECT::TUFTURT].determineCurAnim(ANIM::ROBOT, 15);
	
	jjObjectPresets[OBJECT::SEEKERBULLETPU].xSpeed = 0;
	jjObjectPresets[OBJECT::SEEKERBULLETPU].xAcc = 0;
	
	jjObjectPresets[OBJECT::ICEBULLET].xAcc = 0;
	jjObjectPresets[OBJECT::ICEBULLET].xSpeed = 0;
	jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::AMMO, 71);
	jjObjectPresets[OBJECT::ICEBULLET].counterEnd = 254;
	
/*****Weapon and ammo************************************************************************/

//	p.ammo[5] = (3);
	p.powerup[5] = (true);
//	p.ammo[6] = (3);
	p.ammo[4] = (3);
	p.powerup[4] = (true);
//	p.ammo[3] = (3);
	p.ammo[7] = (3);
//	p.ammo[1] = (3);
//	p.fastfire = (1);
	if (p.ammo[9] > 1) p.ammo[9] = 1;
//	if (p.ammo[9] < 1) p.currWeapon = (WEAPON::BLASTER);
	
/*****Regenerators***************************************************************************/

	if (jjGameTicks%70 == 0) p.ammo[5] = p.ammo[5]+1;
	if (p.ammo[5] > 25) p.ammo[5] = 25;
	if (p.ammo[5] <= 0) p.currWeapon = 5;
	
	if (jjGameTicks%10 == 0) p.ammo[2] = p.ammo[2]+1;
	if (p.ammo[2] > 25) p.ammo[2] = 25;
	if (p.ammo[2] < 2) p.ammo[2] = 2;
	if (p.ammo[2] == 2) p.noFire = true;
	
	if (jjGameTicks%140 == 0) p.ammo[6] = p.ammo[6]+1;
	if (p.ammo[6] > 10) p.ammo[6] = 10;
	if (p.ammo[6] < 1) p.currWeapon = 1;
	
	if (jjGameTicks%20 == 0) p.ammo[3] = p.ammo[3]+1;
	if (p.ammo[3] > 50) p.ammo[3] = 50;
	if (p.ammo[3] < 1) p.currWeapon = 1;
	
	if (jjGameTicks%350 == 0) p.ammo[8] = p.ammo[8]+1;
	if (p.ammo[8] > 10) p.ammo[8] = 10;
	if (p.ammo[8] < 1) p.currWeapon = 1;
	if (p.ammo[8] < 10) p.noFire;
	
//	if (jjGameTicks%700 == 0) p.health = p.health+1;
//	if (p.health > 5) p.health = 5;
	
//	if (jjGameTicks%10 == 0 && p.currWeapon == 7) p.ammo[7] = p.ammo[7]-1;
//	if (jjGameTicks%35 == 0 && p.currWeapon != 7) p.ammo[7] = p.ammo[7]+1;

/*****Forces*********************************************************************************/

	if (p.currWeapon == WEAPON::TOASTER) {
		p.fireBullet(WEAPON::TOASTER, true, true, DIRECTION::LEFT);
		p.fireBullet(WEAPON::TOASTER, true, true, DIRECTION::RIGHT);
		p.fireBullet(WEAPON::TOASTER, true, true, DIRECTION::UP);
	}
	
	if (p.currWeapon == 2) {
		p.jumpStrength = (-20);
	} else {
		p.jumpStrength = (-10);
	}
	
	if (p.currWeapon == WEAPON::SEEKER) {
		p.warpToTile(jjRandom()%199+1, jjRandom()%99+1, true);
		jjChat("/me ||warped randomly.");
		p.currWeapon = (WEAPON::BLASTER);
	}
	
	if (p.currWeapon == WEAPON::TNT) {
		p.noFire = (true);
		p.shieldType = (2);
		p.shieldTime = (9*70);
		p.alreadyDoubleJumped = (true);
		if (p.xSpeed > 4) p.xSpeed = 4;
		if (p.xSpeed < -4) p.xSpeed = -4;
	} else {
		p.noFire = (false);
		p.shieldType = (0);
		p.shieldTime = (0);
	}
	
	if (p.currWeapon == WEAPON::RF) {
		if(p.xSpeed>8) {
			p.xPos=p.xPos+p.xSpeed-8;
		}
		if(p.xSpeed<-8) {
			p.xPos=p.xPos+p.xSpeed+8;
		}
	}
	
	if (p.currWeapon == 8) {
		if (p.ammo[8] == 10) {
			p.health = p.health+1;
			p.ammo[8] = 0;
		}
	}
	
/*****Force Anti-Spam************************************************************************/
	
	if (p.currWeapon == 2 && !weaponIsBouncer) {
		jjChat("/me ||||is using |Shocker / Force of High-jumping.");
		weaponIsBouncer = true;
	}
	if (p.currWeapon != 2 && weaponIsBouncer) {
		weaponIsBouncer = false;
	}
	if (p.currWeapon == 3 && !weaponIsFreezer) {
		jjChat("/me ||||is using |Freezer mines.");
		weaponIsFreezer = true;
	}
	if (p.currWeapon != 3 && weaponIsFreezer) {
		weaponIsFreezer = false;
	}
	if (p.currWeapon == 5 && !weaponIsRF) {
		jjChat("/me ||||is using |Super RF / Force of Speed.");
		weaponIsRF = true;
	}
	if (p.currWeapon != 5 && weaponIsRF) {
		weaponIsRF = false;
	}
	if (p.currWeapon == 6 && !weaponIsToaster) {
		jjChat("/me ||||is using |Force of Burning.");
		weaponIsToaster = true;
	}
	if (p.currWeapon != 6 && weaponIsToaster) {
		weaponIsToaster = false;
	}
	if (p.currWeapon == 7 && !weaponIsTNT) {
		jjChat("/me ||||is using |Force of Protection.");
		weaponIsTNT = true;
	}
	if (p.currWeapon != 7 && weaponIsTNT) {
		weaponIsTNT = false;
	}
	
	if (p.currWeapon == 8 && !weaponIsGun8) {
		jjChat("/me ||||is using |Force of Healing.");
		weaponIsGun8 = true;
	}
	if (p.currWeapon != 8 && weaponIsGun8) {
		weaponIsGun8 = false;
	}
	
/*****Controlling the Turtle Shell***********************************************************/

	for(int i = 1; i < jjObjectCount; i++) {
		if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::TURTLESHELL) {
			if(p.xPos > 152*32 && p.xPos < 153*32 && p.yPos > 97*32 && p.yPos < 98*32) {
				p.xPos = 4880;
				p.yPos = 3120;
				p.cameraFreeze(jjObjects[i].xPos, jjObjects[i].yPos, true, true);
				jjObjects[i].xSpeed = p.xSpeed;
				jjObjects[i].determineCurAnim(ANIM::TURTLE, 5, false);
				
				if (shellMoved == false) {
					jjObjects[i].xPos = 5680;
					jjObjects[i].yPos = 400;
					shellMoved = true;
				}
			} else if (shellMoved == true) {
				jjObjects[i].xPos = 5008;
				jjObjects[i].yPos = 3120;
				shellMoved = false;
			}
		}
	}
	
/*****Other**********************************************************************************/

	if (p.xPos > 20*32 && p.yPos > 85*32 && p.xPos < 40*32) {
		p.cameraFreeze(20*32, 91*32, false, false);
	} else {
		p.cameraUnfreeze();
	}
	
	
	if (p.ammo[1] > 8) p.ammo[1] = 8;
	
	if (reloadTimer > 0) reloadTimer--;

	if (p.ammo[1] < 2) {
		reloadTimer = 4*70;
		p.ammo[1] = 8;
	}
	
	if (reloadTimer > 0 && p.currWeapon == 1) p.noFire = true;
}

/*****Object Modifiers 2*********************************************************************/

void onPlayer() {
	for (int p = 0; p < 32; p++) {
		for(int i = 1; i < jjObjectCount; i++) {
			if (jjObjects[i].isActive && jjObjects[i].creatorType == CREATOR::PLAYER) {
				if (jjObjects[i].eventID == OBJECT::BLASTERBULLET) {
//					jjObjects[i].ySpeed = jjRandom() % -12;
//					jjObjects[i].ySpeed = jjCos(jjGameTicks*16)*(0.5*4);
//					jjObjects[i].counterEnd = jjRandom() % 100+5;
//					if (jjObjects[i].counter > 5) {
//						jjObjects[i].counter = 5;
					}
				}
			}
		}
/**********		
		for(int i = 1; i < jjObjectCount; i++) {
			if (jjObjects[i].isActive && jjObjects[i].creatorType == CREATOR::PLAYER) {
				if (jjObjects[i].eventID == OBJECT::BLASTERBULLET) {
					switch(jjRandom() % 5) {
						case 0:
							jjObjects[i].ySpeed = 2;
							break;
						case 1:
							jjObjects[i].ySpeed = 3;
							break;
						case 2:
							jjObjects[i].ySpeed = 4;
							break;
						case 3:
							jjObjects[i].ySpeed = -2;
							break;
						case 4:
							jjObjects[i].ySpeed = -3;
							break;
						case 5:
							jjObjects[i].ySpeed = -4;
							break;
					}
				}
			}
		}
***********/		
		for(int i = 1; i < jjObjectCount; i++) {
			if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::TOASTERBULLET) {
				jjObjects[i].ySpeed = jjRandom() % -12;
//				jjObjects[i].freeze = (5);
			}
		}
		
		for(int i = 1; i < jjObjectCount; i++) {
			if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::ELECTROBULLET) {
				jjObjects[i].xPos = p.xPos+jjRandom() % -64;
				jjObjects[i].yPos = p.yPos+jjRandom() % -64;
			}
		}
		
		for(int i = 1; i < jjObjectCount; i++) {
			if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::GOLDCOIN) {
				jjObjects[i].ySpeed = jjRandom() % -5;
				jjObjects[i].xSpeed = jjRandom() % -5;
			}
		}
//	}
}

/*****onFunction*****************************************************************************/

void onFunction5() {
	jjChat("/spectate on", false);
}

void onFunction1() {
	p.morphTo(CHAR::JAZZ, true);
}

void onFunction2() {
	p.morphTo(CHAR::SPAZ, true);
}

void onFunction3() {
	p.morphTo(CHAR::LORI, true);
}

void onFunction10() {
	for(int i = 1; i < jjObjectCount; i++) {
		if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::CTFBASE) {
			jjObjects[i].var[1] = 0;
		}
	}
}

void onFunction11() {
	for(int i = 1; i < jjObjectCount; i++) {
		if(jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::CTFBASE) {
			jjObjects[i].var[1] = 1;
		}
	}
}