Dec 14, 2015, 10:04 AM | |
There's a new problem ... (Warn me if double posting is not authorized. I don't know all the rules)
I wrote a script. It works flawlessly on my computer, but Blaze the Movie Fan says it's extremely laggy on his computer, so I'll post it and see if you can help me. Hopefully I'll learn something new and useful! Code:
uint shownText = 0; bool textShift = false; uint textShiftTotal = 0; uint thunderCounter = 0; uint debugger = 0; uint killedDemons = 0; uint wallFall = 0; uint wallFall1 = 0; uint wallFall2 = 0; uint isSugarRush = 0; bool justMorphed = false; void onLevelLoad() { jjPalette.gradient(224, 192, 255, 0, 0, 0, 16, 8, 1); jjPalette.gradient(192, 255, 224, 0, 0, 0, 24, 8, 1); jjPalette.gradient(255, 255, 192, 0, 0, 0, 32, 8, 1); jjPalette.gradient(255, 192, 255, 0, 0, 0, 40, 8, 1); jjPalette.gradient(192, 255, 192, 0, 0, 0, 48, 8, 1); jjPalette.gradient(255, 192, 224, 0, 0, 0, 58, 6, 1); jjPalette.gradient(224, 224, 255, 0, 0, 0, 64, 8, 1); jjPalette.gradient(255, 192, 192, 0, 0, 0, 72, 8, 1); jjPalette.gradient(255, 224, 224, 0, 0, 0, 80, 8, 1); jjPalette.gradient(192, 255, 224, 0, 0, 0, 88, 8, 1); jjPalette.gradient(224, 192, 160, 0, 0, 0, 104, 12, 1); jjPalette.gradient(16, 0, 16, 32, 0, 0, 176, 32, 1); jjPalette.gradient(0, 0, 0, 0, 0, 0, 10, 1, 1); jjPalette.apply(); jjUseLayer8Speeds = true; jjTexturedBGTexture = TEXTURE::NORMAL; p.lives = 5; jjObjectPresets[OBJECT::BAT].energy = 5; jjObjectPresets[OBJECT::DEMON].energy = 25; jjObjectPresets[OBJECT::DOGGYDOGG].energy = 15; jjObjectPresets[OBJECT::DRAGON].energy = 10; jjObjectPresets[OBJECT::HELMUT].energy = 15; jjObjectPresets[OBJECT::MONKEY].energy = 20; jjObjectPresets[OBJECT::RAPIER].energy = 25; jjObjectPresets[OBJECT::RAVEN].energy = 10; jjObjectPresets[OBJECT::STANDMONKEY].energy = 25; jjObjectPresets[OBJECT::BOLLPLATFORM].behavior = myPlatform; jjObjectPresets[OBJECT::BOLLPLATFORM].deactivates = false; jjObjectPresets[OBJECT::SPIKEBOLL].energy = 0; jjObjectPresets[OBJECT::SPIKEPLATFORM].behavior = bruiser; } void onLevelReload() { jjPalette.gradient(224, 192, 255, 0, 0, 0, 16, 8, 1); jjPalette.gradient(192, 255, 224, 0, 0, 0, 24, 8, 1); jjPalette.gradient(255, 255, 192, 0, 0, 0, 32, 8, 1); jjPalette.gradient(255, 192, 255, 0, 0, 0, 40, 8, 1); jjPalette.gradient(192, 255, 192, 0, 0, 0, 48, 8, 1); jjPalette.gradient(255, 192, 224, 0, 0, 0, 58, 6, 1); jjPalette.gradient(224, 224, 255, 0, 0, 0, 64, 8, 1); jjPalette.gradient(255, 192, 192, 0, 0, 0, 72, 8, 1); jjPalette.gradient(255, 224, 224, 0, 0, 0, 80, 8, 1); jjPalette.gradient(192, 255, 224, 0, 0, 0, 88, 8, 1); jjPalette.gradient(224, 192, 160, 0, 0, 0, 104, 12, 1); jjPalette.gradient(16, 0, 16, 32, 0, 0, 176, 32, 1); jjPalette.gradient(0, 0, 0, 0, 0, 0, 10, 1, 1); jjPalette.apply(); jjUseLayer8Speeds = true; jjTexturedBGTexture = TEXTURE::NORMAL; wallFall = 0; wallFall1 = 0; wallFall2 = 0; } void onLevelBegin() { p.xPos = 5.5 * 32; p.yPos = 0; p.xOrg = 5.5 * 32; p.yOrg = 0; ActivateEventAt(27, 6); ActivateEventAt(32, 9); } jjOBJ@ ActivateEventAt(int xTile, int yTile) { if (jjParameterGet(xTile, yTile, -1, 1) == 1) return null; jjParameterSet(xTile, yTile, -1, 1, 1); return jjObjects[jjAddObject(jjEventGet(xTile, yTile), xTile * 32 + 15, yTile * 32 + 15, 0, CREATOR::LEVEL)]; } void onMain() { if (textShift == true && textShiftTotal < 70) textShiftTotal = textShiftTotal + 1; if (textShift == false && textShiftTotal > 0) textShiftTotal = textShiftTotal - 1; if (jjRandom() & 3500 == 0) thunderCounter = 16; if (thunderCounter > 0) thunderCounter = thunderCounter - 1; jjPalette.gradient(16 - thunderCounter + (thunderCounter * 16), 0 + (thunderCounter * 16), 16 - thunderCounter + (thunderCounter * 16), 32, 0, 0, 176, 32, 1); jjPalette.apply(); jjSetFadeColors(16 - thunderCounter + (thunderCounter * 16), 0 + (thunderCounter * 16), 16 - thunderCounter + (thunderCounter * 16)); if (killedDemons >= 1 && jjTriggers[0] == false) jjSwitchTrigger(0); if (wallFall > 0 && wallFall1 < 256) wallFall1 = wallFall1 + 8; if (wallFall1 == 256 && jjTriggers[30] == false) jjSwitchTrigger(30); if (wallFall > 1 && wallFall2 < 256) wallFall2 = wallFall2 + 8; if (wallFall2 == 256 && jjTriggers[31] == false) jjSwitchTrigger(31); if (killedDemons >= 5 && jjTriggers[5] == false) jjSwitchTrigger(5); if (p.health < 1) { textShift = false; textShiftTotal = 0; } if (isSugarRush > 0) isSugarRush = isSugarRush - 1; } void onPlayer() { if (p.yPos < 32 && p.ySpeed < 0) p.yPos = 32; if (p.food >= 1) { p.startSugarRush(1400); isSugarRush = 1400; p.food = 0; } if (p.health < 1) isSugarRush = 0; if (p.blink != 0 && isSugarRush < 1) { p.blink = 0; p.invincibility = 0; } p.fastfire = 6; if (isSugarRush == 0) p.jumpStrength = -8.5; if (isSugarRush > 0) p.jumpStrength = -11.5; if (p.yPos > 16 * 32 && p.health > 0) { p.health = 0; p.kill(); } for (int i = 1; i < jjObjectCount; i++) { jjOBJ@ o = jjObjects[i]; if (o.eventID == OBJECT::DEMON && o.state == STATE::KILL && o.justHit == 1) killedDemons = killedDemons + 1; } p.cameraFreeze(p.xPos, 272, true, true); } void onPlayerInput(jjPLAYER@ p) { if (isSugarRush == 0) p.keyRun = false; if (p.health < 1) { p.keyDown = false; p.keyFire = false; p.keyJump = false; p.keyLeft = false; p.keyRight = false; p.keySelect = false; p.keyUp = false; } if (jjKey[0x4A] == true && p.charCurr == CHAR::SPAZ) p.morphTo(CHAR::JAZZ, true); if (jjKey[0x53] == true && p.charCurr == CHAR::JAZZ) p.morphTo(CHAR::SPAZ, true); } void onFunction0() { textShift = false; } void onFunction1() { textShift = true; shownText = 1; } void onFunction2() { textShift = true; shownText = 2; } void onFunction5() { textShift = true; shownText = 5; } void onFunction20() { if (wallFall < 1) wallFall = 1; textShift = true; shownText = 10; } void onFunction21() { if (wallFall < 2) wallFall = 2; } void bruiser(jjOBJ@ bruise) { bruise.behave(BEHAVIOR::PLATFORM, true); bruise.playerHandling = HANDLING::ENEMYBULLET; bruise.animSpeed = 1; if (bruise.xOrg % 32 == 15) bruise.xOrg = bruise.xOrg - 16; if (p.health < 1) bruise.state = STATE::KILL; if (p.yPos < bruise.yPos + 32 && wallFall > 0) p.yPos = bruise.yPos + 32; if (wallFall > 0 && bruise.yOrg < 14 * 32) bruise.yOrg = bruise.yOrg + 0.5; debugger = jjParameterGet(27, 6, -1, 1); } void myPlatform(jjOBJ@ myPlat) { myPlat.behave(BEHAVIOR::PLATFORM, true); if (p.health < 1) myPlat.state = STATE::KILL; if (myPlat.yOrg % 32 == 15) myPlat.yOrg = myPlat.yOrg - 12; if (myPlat.var[0] == -35) myPlat.xOrg = myPlat.xOrg + myPlat.var[1]; if (myPlat.var[0] == 35) myPlat.xOrg = myPlat.xOrg - myPlat.var[1]; if (jjEventGet((myPlat.xOrg + 18) / 32, (myPlat.yOrg) / 32) == AREA::SLIDE && myPlat.var[0] < 35) { myPlat.var[0] = myPlat.var[0] + 1; } if (jjEventGet((myPlat.xOrg - 18) / 32, (myPlat.yOrg) / 32) == AREA::SLIDE && myPlat.var[0] > -35) { myPlat.var[0] = myPlat.var[0] - 1; } } void onDrawLayer4(jjPLAYER@ p, jjCANVAS@ screen) { jjDrawTile(233 * 32, (7 * 32) + (jjSin(wallFall1 - 256) * 64), 268, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(233 * 32, (8 * 32) + (jjSin(wallFall1 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(233 * 32, (9 * 32) + (jjSin(wallFall1 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(233 * 32, (10 * 32) + (jjSin(wallFall1 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(233 * 32, (11 * 32) + (jjSin(wallFall1 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(233 * 32, (12 * 32) + (jjSin(wallFall1 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(233 * 32, (13 * 32) + (jjSin(wallFall1 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(233 * 32, (14 * 32) + (jjSin(wallFall1 - 256) * 64), 268, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (7 * 32) + (jjSin(wallFall2 - 256) * 64), 268, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (8 * 32) + (jjSin(wallFall2 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (9 * 32) + (jjSin(wallFall2 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (10 * 32) + (jjSin(wallFall2 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (11 * 32) + (jjSin(wallFall2 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (12 * 32) + (jjSin(wallFall2 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (13 * 32) + (jjSin(wallFall2 - 256) * 64), 216, TILE::ALLQUADRANTS, 4, 4, -1); jjDrawTile(252 * 32, (14 * 32) + (jjSin(wallFall2 - 256) * 64), 268, TILE::ALLQUADRANTS, 4, 4, -1); } void onDrawLayer1(jjPLAYER@ p, jjCANVAS@ screen) { jjTEXTAPPEARANCE mytext; mytext.at = STRING::SPECIALSIGN; mytext.pipe = STRING::SPECIALSIGN; mytext.align = STRING::CENTER; if (shownText == 1) screen.drawString(p.cameraX + 320, -20 + textShiftTotal, "'Welcome' to Hell!@If you complete the test,@you'll obtain a reward!", STRING::SMALL, mytext, 0); if (shownText == 2) screen.drawString(p.cameraX + 320, -20 + textShiftTotal, "Press J to turn into Jazz.@Press S to turn into Spaz.", STRING::SMALL, mytext, 0); if (shownText == 5) screen.drawString(p.cameraX + 320, -20 + textShiftTotal, "Kill 5 demons@to open this door.", STRING::SMALL, mytext, 0); if (shownText == 10) screen.drawString(p.cameraX + 320, -20 + textShiftTotal, "I lied!@No reward for you!@Just pain!", STRING::SMALL, mytext, 0); screen.drawString(p.xPos, 64, "", STRING::SMALL, mytext, 0); }
__________________
Free will was a mistake. - God |
Dec 14, 2015, 11:24 AM | |
I suspect the issue is that you're calling
jjPAL::apply every single gametick, and it's one of the slowest operations in the game (for justifiable reasons). You should at least be able to only call it every second or third tick without much noticeable difference, and I'm fond of disabling it entirely when jjLowDetail is true.
|
Dec 14, 2015, 12:15 PM | |
More importantly there's no reason to call it at all when the palette doesn't change in the first place, which would be most of the time in your script. Also I don't think the bitwise AND operator & does what you think it does.
|
Dec 16, 2015, 01:38 PM | |
I'm looking for 2 things that are probably simple and straightforward to most readers here:
1: I'd like to have snow from ANIM::SNOW appear through jjParticle, with original coloring (not loading palette entries from other tilesets). 2: I'd like to set a textured background on levelload, like TEXTURE::WTF, and keep the original textured BG color range from the tileset in use (so just swapping the texture). This to polish up an old unreleased Xmas level I feel like releasing with proper modifications.
__________________
Add SlazRabbit on Xbox Live if you want to play some GoW1/2/3/J or Destiny1/2. Jazz Jackrabbit 2 Forever!! Civilian Defence Force - Jazz2 Visual Fantasers |
Dec 16, 2015, 08:13 PM | |
In both cases you seem to want to be (permanently) recoloring images, so you'll need jjPIXELMAP. The first one is pretty much the same as the
RecolorRain function from plusPixelMapEx, so look there, but work on ANIM::SNOW instead. For the second, I don't think they're covered in that level, but jjPIXELMAP does have both a constructor and a makeTexture method for working with textures specifically.
|
Dec 17, 2015, 09:04 AM | |
Thanks! I looked there and found something for the snow. For the texture, I just loaded a default one from Plus and reset it's color range through jjPalette. I didn't even need a pixelmap there.
__________________
Add SlazRabbit on Xbox Live if you want to play some GoW1/2/3/J or Destiny1/2. Jazz Jackrabbit 2 Forever!! Civilian Defence Force - Jazz2 Visual Fantasers |
Dec 21, 2015, 03:18 AM | |
I have this script:
Code:
void onLevelLoad() { jjAnimSets[ANIM::CUSTOM[0]].load(0, "sausage.j2a"); jjObjectPresets[OBJECT::WEENIE].determineCurAnim(ANIM::CUSTOM[0], 0); jjTileType[659] = 5; jjTileType[669] = 5; // White hot lava. jjPalette.gradient(128 + (jjP.cameraY / 16), 192 + (jjP.cameraY / 32), 255, 0 + (jjP.cameraY / 8), 32 + (jjP.cameraY / 12), 128, 144, 16, 1); jjPalette.gradient(112 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 24), 32 - (jjP.cameraY / 64), 0 + (jjP.cameraY / 12), 0, 0, 160, 16, 1); jjPalette.gradient(255, 128, 0, 0 + (jjP.cameraY / 16), 0 + (jjP.cameraY / 256), 0, 208, 24, 1); jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 96, 8, 1); jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 128, 8, 1); jjPalette.gradient(128 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 16), 0, 0, 176, 32, 1); jjPalette.gradient(192 + (jjP.cameraY / 32), 128 - (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0 + (jjP.cameraY / 32), 0, 0, 120, 8, 1); jjPalette.gradient(128 + (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 32), 0, 0, 136, 8, 1); jjPalette.gradient(192 + (jjP.cameraY / 64), 128 - (jjP.cameraY / 64), 32, 0, 0, 0, 104, 8, 1); jjPalette.apply(); } void onLevelReload() { jjPalette.gradient(128 + (jjP.cameraY / 16), 192 + (jjP.cameraY / 32), 255, 0 + (jjP.cameraY / 8), 32 + (jjP.cameraY / 12), 128, 144, 16, 1); jjPalette.gradient(112 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 24), 32 - (jjP.cameraY / 64), 0 + (jjP.cameraY / 12), 0, 0, 160, 16, 1); jjPalette.gradient(255, 128, 0, 0 + (jjP.cameraY / 16), 0 + (jjP.cameraY / 256), 0, 208, 24, 1); jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 96, 8, 1); jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 128, 8, 1); jjPalette.gradient(128 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 16), 0, 0, 176, 32, 1); jjPalette.gradient(192 + (jjP.cameraY / 32), 128 - (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0 + (jjP.cameraY / 32), 0, 0, 120, 8, 1); jjPalette.gradient(128 + (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 32), 0, 0, 136, 8, 1); jjPalette.gradient(192 + (jjP.cameraY / 64), 128 - (jjP.cameraY / 64), 32, 0, 0, 0, 104, 8, 1); jjPalette.apply(); } void onMain() { jjUseLayer8Speeds = true; // The long awaited feature that changed my gaming experience! jjSetFadeColors(200); jjTexturedBGTexture = TEXTURE::WTF; } void onPlayer(jjPLAYER@ jjP) { if (jjGameTicks % 7 == 6) { jjPalette.gradient(128 + (jjP.cameraY / 16), 192 + (jjP.cameraY / 32), 255, 0 + (jjP.cameraY / 8), 32 + (jjP.cameraY / 12), 128, 144, 16, 1); jjPalette.gradient(112 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 24), 32 - (jjP.cameraY / 64), 0 + (jjP.cameraY / 12), 0, 0, 160, 16, 1); jjPalette.gradient(255, 128, 0, 0 + (jjP.cameraY / 16), 0 + (jjP.cameraY / 256), 0, 208, 24, 1); jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 96, 8, 1); jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 128, 8, 1); jjPalette.gradient(128 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 16), 0, 0, 176, 32, 1); jjPalette.gradient(192 + (jjP.cameraY / 32), 128 - (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0 + (jjP.cameraY / 32), 0, 0, 120, 8, 1); jjPalette.gradient(128 + (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 32), 0, 0, 136, 8, 1); jjPalette.gradient(192 + (jjP.cameraY / 64), 128 - (jjP.cameraY / 64), 32, 0, 0, 0, 104, 8, 1); jjPalette.apply(); // The hues depend on how close to the lava the player is. } if (jjGameState == GAME::OVERTIME) jjMusicLoad("hurry_up.mod"); // Music changes along with overtime. if (jjP.yPos > (62.5 * 32) - jjLayerYOffset[2]) { jjP.xSpeed = 0; jjP.ySpeed = 1; } jjTexturedBGFadePositionY = 0.55 - (jjP.cameraY / 16384); jjPARTICLE@ lavaspecks = jjAddParticle(PARTICLE::SMOKE); // Creates fumes from the lava. lavaspecks.xPos = -480 + jjP.xPos + (jjRandom() % 960); lavaspecks.yPos = 63*32 - (jjRandom() % 256); lavaspecks.ySpeed = -1; jjPARTICLE@ raindrops = jjAddParticle(PARTICLE::RAIN); // Water drops from the ceiling. raindrops.xPos = -480 + jjP.xPos + (jjRandom() % 960); raindrops.yPos = 0 + (jjRandom() % 256); raindrops.ySpeed = 5 + (jjRandom() % 5); } void onDrawLayer2(jjPLAYER@ jjP, jjCANVAS@ canvas) { jjLayerYOffset[2] = jjSin(jjGameTicks) * 16; // Lava moving up and down. } void onDrawLayer7(jjPLAYER@ jjP, jjCANVAS@ screen) { jjPIXELMAP drawBigHills(0, 0, 6 * 32, 8 * 32, 7); jjANIMFRAME@ bigHills = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::SONICPLAT].firstAnim].firstFrame]; drawBigHills.save(bigHills); // Actually giving the game additional layers!!! screen.drawResizedSprite((-5 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0); screen.drawResizedSprite((4 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0); screen.drawResizedSprite((13 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0); screen.drawResizedSprite((22 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0); screen.drawResizedSprite((31 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0); screen.drawResizedSprite((40 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0); screen.drawResizedSprite((-5 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0); screen.drawResizedSprite((13 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0); screen.drawResizedSprite((31 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0); screen.drawResizedSprite((49 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0); } And yes, it is way too pixelated, but this is NOT the problem. The actual problem is: It works fine on Single Player mode, but on Multiplayer, the following problems occur: - The extra layers work, but are shifted far in the upper left corner (and 2 of their color indexes are incorrect) - I get the error message "memAlloc() Amnesia error: Out of Memory" after 4 seconds, divided by the amount of players in the game. And yes, it is important that it works fine on Multiplayer mode, since it's a Battle game.
__________________
Free will was a mistake. - God Last edited by DennisKainz; Dec 21, 2015 at 03:30 AM. |
Dec 21, 2015, 09:27 AM | |
Try moving the first three lines of
onDrawLayer7 into onLevelLoad ?
|
Dec 21, 2015, 10:23 AM | |
My bad. I always forget to make my expressions one-timed.
I still have the problem of the background's location. It seems that the calculation of the player's camera position is different in Multiplayer. And now that I put the expressions into OnLevel Load, I can't see the hills at all in Multiplayer. And yet in Single Player they're always there!
__________________
Free will was a mistake. - God |
Dec 21, 2015, 10:39 AM | |
Again just guessing, but you're using
ANIM::SONICPLAT , but I don't see any explicit calls to jjOBJ::determineCurAnim or jjANIMSET::load , the two ways of manually loading an animset. So I suspect you're loading the animations by placing one or more Sonic Platform events in the level... but those don't work in multiplayer unless they're set to MP-Only.Alternatively, use ANIM::CUSTOM[1] instead (after an appropriate allocate method call), since it doesn't look like you're interested in Sonic Platforms as Sonic Platforms?(None of the stuff you're doing in onMain needs to be done every gametick either, fwiw.)
|
Dec 21, 2015, 11:16 AM | |
All I had to do was set it to MP-Only? Great!
And yes, I definitely need to learn which expressions are one-time and which ones aren't. EDIT: I did it! No more sonic platforms needed. The level now creates the background automatically.
__________________
Free will was a mistake. - God Last edited by DennisKainz; Dec 21, 2015 at 11:48 AM. |
Dec 31, 2015, 08:06 AM | |
Sorry for being so terrible at programming, but is there some way of making a certain gun your default one?
Do I need to check if BLASTER is WEAPON::CURRENT on jjPLAYER and then change it on levelbegin?
__________________
Add SlazRabbit on Xbox Live if you want to play some GoW1/2/3/J or Destiny1/2. Jazz Jackrabbit 2 Forever!! Civilian Defence Force - Jazz2 Visual Fantasers |
Jan 9, 2016, 10:02 AM | |
AngelScript didn't exist when I left back in 2004, so it is a new thing to me. And I have a couple of question.
|
Jan 9, 2016, 10:11 AM | |
1. http://www.jazz2online.com/jj2plus/p...gelscript.html
2. Any text editor. You're going to have to write scripting code, there's no way around that. If you use Notepad++ there is a syntax highlighting module you can use. 3. There is no part of JJ2+'s AngelScript support specifically aimed at making cutscenes. You're probably best off reading the readme, seeing how other scripts do things (e.g. take a look at the RabbitCity scripts) and then ask specific questions in this thread. |
Jan 9, 2016, 11:44 AM | |
Jan 9, 2016, 12:35 PM | |
Oh. Well, that doesn't have much of anything to do with Angelscript requests, but here are some tilesets you might be interested in.
|
Jan 9, 2016, 12:55 PM | |
Thanks ViolentCLM.Welll it's like recreating EarthBound Zero using 16-bit style,but it's jRPG.I think Jazz Jackrabbit 1 Creation Station is created to remake Jazz 1 maps to make them looking like in jazz 2 style.I mean widescreen in jazz 1 was 4:9 in jazz 2 it's 16:9.
http://www.jazz2online.com/downloads/jj1-level/ |
Jan 9, 2016, 01:49 PM |
DennisKainz |
This message has been deleted by Stijn.
|
Jan 10, 2016, 02:48 AM |
DennisKainz |
This message has been deleted by Stijn.
|
Jan 10, 2016, 02:07 PM | ||
Quote:
Jungle Jackrabbit 2 will probably me the first levelpack where I use angelscript, it's likely not gonna be easy, and if I need help I will ask here. |
Jan 11, 2016, 02:05 PM | |
Is it possible to make it look like Spaz/Jazz is talking to the cellphone? The reason I'm asking is because I'm gonna make Spaz/Jazz do just that at several points during my next levelpack.
|
Jan 11, 2016, 02:38 PM | ||
Yes. I have no idea how you would want that to look, but whatever you have in mind is almost certainly possible.
EDIT: Quote:
onPlayer , presumably) and compare/set jjPLAYER::currWeapon based on whatever you think the right criteria are.And WEAPON::CURRENT looks like it's what you want, but unfortunately it's not. It's just some random magic number like -36 or 173 or something which certain functions understand to mean "ignore this number and look at jjPLAYER::currWeapon instead." In fact, I'm not sure I'd endorse using it at all—it works in the cases that it works, but that requires you to keep track of which cases those are, and that's a quirk of the API instead of a quirk of JJ2.
Last edited by Violet CLM; Jan 12, 2016 at 12:04 AM. |
Apr 22, 2016, 07:56 AM | |
In the new 5.2 plus update they were added privileges, but they don't work for me and I don't know why.
Here are the admin.ini settings: Code:
[Admin.Settings] Enabled=True Password=somepassword Spammers=false [Admin.IPs] [Admin.AllowedCommands] r c k start stop bluescore redscore greenscore yellowscore gamemode coop battle ctf treasure dom jb [Admin.BlockedCommands] [Admin.Privileges] *:admin Code:
bool pressed; void onPlayer(jjPLAYER@ p) { if (jjKey[0x5A] && !pressed) { jjAlert(p.hasPrivilege("admin", jjScriptModuleID) + ""); } pressed = jjKey[0x5A]; }
__________________
~XxMoNsTeR |
Apr 22, 2016, 08:32 AM | ||
Docs for hasPrivilege:
Quote:
On a side note, the privilege *:admin can be shortened to just admin for convenience.
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement. |
Apr 22, 2016, 09:48 AM | |
ah, ok
__________________
~XxMoNsTeR |
Jul 13, 2016, 10:13 AM | |
How do I address the banana of the monkey enemy? I want to make the monkey throw the regular food banana, which bounces off masked tiles, and explodes after 2 seconds, throwing off three smaller bananas (kind of like the banana bomb in Worms World Party).
Also, is it possible to use SPRITE::PLAYER in any way so that the darker fur on the animal is shifted to white? Or do I have to find a workaround this? EDIT: never mind the last part. I got the colors correctly; still struggling to address the banana. Last edited by AvalancheMaster; Jul 13, 2016 at 02:11 PM. |
Jul 13, 2016, 06:43 PM | |
What I would do is search for objects whose behavior is
BEHAVIOR::MONKEYBULLET and assign them a new behavior in your script that does the things you want it to do.
|
Jul 13, 2016, 07:04 PM | |
So I can change existing behavior, not only behavior of objects?
I thought the only thing I could do is search for existing objects, and assign a new behavior to them. I thought this would mean re-creating the monkey behavior from scratch. EDIT: To expand upon my question, MONKEYBULLET is a behavior without an object. I think the easiest way would be to create a new object, monkeyBanana, which will, in turn, when exploding, create three instances of MONKEYBULLET. Am I able to replace behavior with object? Last edited by AvalancheMaster; Jul 13, 2016 at 07:16 PM. |
Jul 13, 2016, 08:00 PM | |
Objects whose behavior is BEHAVIOR::MONKEY will create objects whose behavior is BEHAVIOR::MONKEYBULLET. You can in turn do a loop over existing objects, find the ones whose behavior is BEHAVIOR::MONKEYBULLET, and change their behaviors to something else.
It's also possible to recreate BEHAVIOR::MONKEY, either completely or just the tick in which it throws a banana, but that would be more work. |
Jul 13, 2016, 08:05 PM | |
So, for example, I can replace all instances of BEHAVIOR::MONKEYBULLET with BEHAVIOR:WITCHBULLET.
But if I want BEHAVIOR::MONKEYBULLET to be changed by a new behavior, which creates an instance of BEHAVIOR::MONKEYBULLET, I believe that will be problematic. Correct? |
Jul 13, 2016, 08:20 PM | |
You could replace instances of BEHAVIOR::MONKEYBULLET with a custom behavior that creates instances of (objects using ) a different custom behavior that calls
behave(BEHAVIOR::MONKEYBULLET)
|
Jul 13, 2016, 09:40 PM | |
Maybe I don't understand what you mean.
So, I have placed various MONKEY and STANDMONKEY enemies in my level. I want to modify the behavior of their MONKEYBULLETs. The new behavior will include in itself BEHAVIOR::MONKEYBULLET. For me to create this, I will need to recreate the MONKEY behavior, correct? |
Jul 13, 2016, 10:56 PM | |
Code:
void onMain() { for (int i = 1; i < jjObjectCount; ++i) { jjOBJ@ obj = jjObjects[i]; if (obj.behavior == BEHAVIOR::MONKEYBULLET) obj.behavior = BananaMaker; } } void BananaMaker(jjOBJ@ obj) { //bounce off walls and stuff, then eventually: jjAddObject(OBJECT::BULLET, obj.xPos, obj.yPos, obj.objectID, OBJECT::CREATOR, function(obj){ obj.behave(BEHAVIOR::MONKEYBULLET); }); } |
Jul 14, 2016, 01:24 AM | |
Wouldn't that cause the new object to spawn itself, since we are replacing all instances of BEHAVIOR:: MONKEYBULLET?
|
Jul 14, 2016, 01:57 AM |
AvalancheMaster |
This message has been deleted by AvalancheMaster.
Reason: Two instances of the same post. Lesson learned: do not refresh page immediately after posting.
|
Jul 14, 2016, 08:07 AM | |
No, that is and continues to be the point of
jjOBJ::behave
|
Jul 21, 2016, 07:58 AM | |
Yeah, you'd want to write an
onObjectHit that compared the jjPLAYER::team to a team variable specific to the enemy.
|
Jul 21, 2016, 08:00 AM | |
A little off-topic, but that is one of the more original uses of AngelScript I've heard here. I think it would be possible to make the smoke rings of the Caterpillar affect only one team.
|
Jul 23, 2016, 09:51 AM | |
Is there a way I can achieve this effect? I know for sure I'll have to use Pixelmapping, but I am stuck on the part where I need to define the player/object entering/leaving the area.
|
Tags |
angelscript, code, jcs, request |
«
Previous Thread
|
Next Thread
»
Thread Tools | |
|
|
All times are GMT -8. The time now is 03:18 PM.
Jazz2Online © 1999-INFINITY (Site Credits). Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats. Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Original site design by Ovi Demetrian. DrJones is the puppet master. Eat your lima beans, Johnny.