Jan 10, 2015, 07:12 AM | |
It should be possible as a simple sprite swap, I think.
Anyway, I'm having trouble getting an enemy surge working. The code is mostly a modified version of some code from plusEnscripted. It turns up no errors, and the "Surge incoming" text comes up, but no enemies spawn. The coordinates of where I want to spawn stuff is between 237 and 247 widthwise, and 35 heightwise, according to JCS. Code:
uint elapsed = 0; bool surge = false; int slain = 0; const int SLAINTARGET = 10; bool surgeover = false; void onMain() { if (surge == false) { elapsed = 0; } else { elapsed ++; } if ((jjTriggers[5] == true) && (surgeover == false) == true) { if (surge == false) { jjLocalPlayers[0].showText("@@@@@SURGE INCOMING!", STRING::LARGE); } doEnemySurge(); } } void doEnemySurge() { if (surge == false) { surge = true; } if (slain < SLAINTARGET) { if (elapsed % 70 == 0) { //Once per second uint16 randomTarget = (237 + (jjRandom()&15)) * 32; jjOBJ@ obj = jjObjects[jjAddObject(OBJECT::LIZARD, randomTarget, 1120)]; obj.state = STATE::FALL; } } else { //slain >= SLAINTARGET: surge is over surgeover = true; jjMusicLoad("carrotus.j2b"); jjLocalPlayers[0].showText("@@@@@SURGE COMPLETE!", STRING::LARGE); for (int i = 0; i < jjLocalPlayerCount; i++) { jjLocalPlayers[i].limitXScroll(43, 0); } elapsed = 0; } } EDIT: Turns out that they're just invisible. So, now my question is, why are they invisible, and how can I get them visible? EDIT 2: I've placed other lizards in the level, but the ones coming from this script are still invisible. EDIT 3: Wait, I fixed it. Turns out it was the "STATE::FALL" that was the problem. Switching it to either a Float Lizard or removing that line fixes it. I apologise for the slightly useless post. XD EDIT 4: New problem: void onObjectHit(jjOBJ@ object, jjOBJ@ bullet, jjPLAYER@ player, int force) isn't triggering. Last edited by Love & Thunder; Jan 10, 2015 at 08:08 AM. |
Jan 10, 2015, 11:50 AM | |
onObjectHit is only called for objects with scriptedCollisions set to true .The trouble with trying to make Devan a playable character in AngelScript is that you'd still see the rabbit sprites. You could do stuff with jjPLAYER::cameraFreeze, maybe offset layer 4 some number of tiles to the side and edit every behavior so it offsets its sprites accordingly, but that would be a pretty big hassle. Or you could stick Jazz in a wall somewhere and write your own platforming engine for Devan from scratch. Or you could decide it's probably not a great idea for 4.3. |
Jan 10, 2015, 01:55 PM | |
Bullets are now going through multiple enemies, and although it does kill them, the kill counter still isn't going up.
Also, enemies are invincible in the air, and they only spawn at the two edges of the area I've specified for them to spawn in. |
Jan 10, 2015, 02:15 PM | |
Without knowing what the code looks like, it's pretty much impossible to point at what you're doing wrong.
|
Jan 11, 2015, 01:02 AM | |
Code:
uint elapsed = 0; bool surge = false; int slain = 0; bool surgeover = false; void onMain() { if (surge == false) { elapsed = 0; } else { elapsed ++; } if ((jjTriggers[5] == true) && (surgeover == false) == true) { if (surge == false) { jjLocalPlayers[0].showText("@@@@@SURGE INCOMING!", STRING::LARGE); } doEnemySurge(); } } void doEnemySurge() { if (surge == false) { surge = true; } if (slain < 10) { if (elapsed % 70 == 0) { //Once per second uint16 randomTarget = (237 + (jjRandom()&8)) * 32; jjOBJ@ obj = jjObjects[jjAddObject(OBJECT::FLOATLIZARD, randomTarget, 1024)]; obj.state = STATE::FALL; obj.var[5] = 0; obj.scriptedCollisions = true; } } else { //slain >= 10: surge is over surgeover = true; jjMusicLoad("carrotus.j2b"); jjLocalPlayers[0].showText("@@@@@SURGE COMPLETE!", STRING::LARGE); for (int i = 0; i < jjLocalPlayerCount; i++) { jjLocalPlayers[i].limitXScroll(43, 0); } elapsed = 0; } } void onLevelReload() { slain = 0; elapsed = 0; } void onObjectHit(jjOBJ@ object, jjOBJ@ bullet, jjPLAYER@ player, int force) { if ((object.eventID == OBJECT::FLOATLIZARD || object.eventID == OBJECT::XMASFLOATLIZARD) && object.state != STATE::KILL) { if (player !is null) {//no TNT or turtle shells in this level, so shouldn't be necessary, but can't hurt if (force == 0) //normal collision, not using any buttstomps or whatever player.hurt(); else { //Here JJ2 would check to see if the object is frozen, and if so, //unfreeze it and (possibly; some objects do this and others don't) //alter the amount of damage it receives from the bullet. There's no //ice ammo in this level, so that's not required. if (force > 0) //probably a bullet object.energy -= force; else //special attack object.energy -= 4; if (object.energy <= 0) { if (bullet !is null) { if ((bullet.var[6] & 2) == 2) { //toaster and its ilk object.particlePixelExplosion(1); //burny explosion jjSample(object.xPos, object.yPos, SOUND::COMMON_BURN); } else { object.particlePixelExplosion(0); } object.grantPickup(player, (bullet.eventID == OBJECT::BLASTERBULLET) ? 5 : 10); //JJ2 only ever calls grantPickup for enemies/crates destroyed //by bullets, but you can branch out a bit if you like } else { object.particlePixelExplosion(2); //killed by physical contact jjSample(object.xPos, object.yPos, SOUND::COMMON_SPLAT1); } object.state = STATE::KILL; //let the object's behavior function take care of deleting it player.score += object.points; jjPARTICLE@ score = jjAddParticle(PARTICLE::STRING); //JJ2 checks that jjGameMode is SP or COOP before doing this, if (score !is null) { //and also makes sure that object.points is non-zero. We know both score.xPos = object.xPos; //are true here, so there's no need to bother. score.yPos = object.yPos; score.xSpeed = -0.5 - (jjRandom() & 0x3FFF) / 65536.; score.ySpeed = -1 - (jjRandom() & 0x7FFF) / 65536.; score.string.text = formatInt(object.points, "1"); } ++slain; //the only reason we're going to all this effort } else //not yet dead object.justHit = 5; //flash white for five ticks } } if (bullet !is null && (bullet.var[6] & 16) == 0) { //JJ2 also checks for var[6] & 4, aka the laser shield blast, but eh whatever bullet.state = STATE::EXPLODE; //EXPLODE, like START, means the bullet won't be checked for collisions with other objects/players //also, all normal bullet behaviors have code to dispose of themselves during EXPLODE, so that's nice } } } |
Jan 11, 2015, 01:24 AM | ||
Quote:
The other problems stem from your not writing obj.bulletHandling = HANDLING::DETECTBULLET; either while spawning the lizards or in their jjObjectPresets entry.
|
Jan 11, 2015, 02:08 AM | |
Ah, I thought it would be something simple like that.
Thank you very much. EDIT: Now having trouble adding a second wave to the surge. I've added the following code: Code:
} else if (slain < 30) { if (elapsed % 60 == 0) { //Once every just less than a second. uint16 randomTargetA = (237 + (jjRandom()%10)) * 32; jjOBJ@ obj = jjObjects[jjAddObject(OBJECT::FLOATLIZARD, randomTargetA, 1024)]; obj.state = STATE::FALL; obj.var[5] = 0; obj.scriptedCollisions = true; obj.bulletHandling = HANDLING::DETECTBULLET; } else if (elapsed % 70 == 0) { //Once every second uint16 randomTarget = (237 + (jjRandom()%10)) * 32; jjOBJ@ obj = jjObjects[jjAddObject(OBJECT::BAT, randomTarget, 1008)]; obj.scriptedCollisions = true; obj.bulletHandling = HANDLING::DETECTBULLET; } } else { //slain >= 30: surge is over EDIT 2: They can be killed with special attacks, but not bullets. Either way, though, they don't trigger the onObjectHit code. EDIT 3: By removing the bullet handling part, I've fixed them being invulnerable to bullets, but they still don't activate the onObjectHit code. EDIT 4: For debugging purposes, I've added the following code in the onObjectHit part, which should trigger every time I hit a bat: Code:
if (object.eventID == OBJECT::BAT) { jjLocalPlayers[0].showText("@@@@@HIT", STRING::LARGE); } EDIT 5: Tried swapping the bats out for ravens. Still didn't work. Last edited by Love & Thunder; Jan 11, 2015 at 04:16 AM. |
Jan 11, 2015, 01:22 PM | |
Try
obj.playerHandling = jjObjectPresets[OBJECT::FLOATLIZARD].playerHandling;
|
Jan 11, 2015, 10:18 PM | |
Is it possible to create a level script that shows radar in-game?
Here's a good example of radar taken from Halo, the radar is in the bottom-left corner: There's obviously precedent for finding other player's positions in the map, but I haven't seen what an HUD-based radar what look like in JJ2. |
Jan 12, 2015, 12:14 AM | |
This is defininely possible. All you have to do is get some sprites, parts of tiles or whatever to draw the dots that represent players and a background. Every player has the position of all other players it's just a matter of scaling this to the dot position and making a condition for when the dots to show up. It's ofcourse also possible to put pu's, carrots and bases on it.
__________________
[13:07:13] *** Foly is on a KILLING SPREE! [13:07:14] *** you killed yourself [13:07:14] *** Foly was looking good but died instead... |
Jan 12, 2015, 08:54 AM | |
I think you should ask Artem about the 5,478 lines of code he wrote for JJ2+ instead.
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Jan 15, 2015, 04:35 AM | ||
Quote:
__________________
~XxMoNsTeR |
Jan 15, 2015, 11:00 AM | |
We know you can, good luck.
Apropo, majoritatea pustilor de varsta ta sunt niste pitici enervanti care se cred buricul pamantului. Ma bucur ca exista persoane inteligente ca tine in Romania!
__________________
"Floppy ears and a big butt?" - Slaz |
Jan 22, 2015, 11:11 AM | ||
I am trying to remake "somehow" the JJ1 Bonus in JJ2 (But not 3D)
Quote:
__________________
~XxMoNsTeR Last edited by XxMoNsTeRXM; Jan 23, 2015 at 12:42 AM. |
Jan 23, 2015, 04:56 AM | |
Mar 24, 2015, 02:08 AM | |
It's not exactly a request but it would be if the answer is "yes".
Is it possible to combine a bridge and an Acc Belt? I'm thinking of modifying the MEZ03 serpentine belt so a custom "rolling" bridge can be made via Angelscript. |
Mar 24, 2015, 10:01 AM | |
heck, you can just put Acc Belt events in the area the bridge would take up in JCS. But more generally:
Code:
void onPlayer(jjPLAYER@ play) { jjOBJ@ platform = jjObjects[play.platform]; if (playform.behavior == WHATEVER) { play.xSpeed CHANGES SOMEHOW; } } |
Mar 25, 2015, 08:49 AM | |
Do you think a Tails-like NPC would be hard to get working?
|
Mar 25, 2015, 11:44 AM | |
The trickiest part would be writing all the logic for how to move around the level and what to react to and when to shoot and stuff. And that would be tricky. But that's because of AI, not AS.
|
Apr 7, 2015, 09:22 AM | |
Is it possible to do #include file.j2as?
EDIT: OF COURSE I CAN Because 5.0 IS SO AWESOME! it's just: #include "file.j2as";
__________________
~XxMoNsTeR Last edited by XxMoNsTeRXM; Apr 7, 2015 at 10:27 AM. |
Apr 7, 2015, 12:05 PM | |
ummm... it doesn't show errors in AS in 5.0
I think it's an error in the j2as I am using. I use #include and I think maybe it can't get the error or something?
__________________
~XxMoNsTeR |
Apr 7, 2015, 12:07 PM | |
If you overwrote your old plus.ini with the one from the zip, you need to enable it manually again.
__________________
Mystic Legends http://www.mysticlegends.org/ The Price of Admission - Hoarfrost Hollow - Sacrosanct - other - stuff |
Apr 7, 2015, 12:20 PM | ||
Quote:
Also I gotta learn more about the new version AS. Ok, it says a function with the same name and parameters already exist, I know why because I use some of the JJ2+ functions in the thing that I include and in the main j2as, hmmm... I think I need help.
__________________
~XxMoNsTeR |
Apr 7, 2015, 12:38 PM | |
Don't do that.
|
Apr 9, 2015, 09:20 AM | |
Ok, I need help!
__________________
~XxMoNsTeR |
Apr 9, 2015, 10:32 AM | |
|
Apr 9, 2015, 06:52 PM | |
Could someone explain how I can check if an object is using a specific set and animation?
I've tried searching the readme, but I haven't found anything. |
Apr 9, 2015, 08:18 PM | |
I suppose something like
Code:
bool doesObjectUseAnimation(jjOBJ@ obj, uint curAnim) { jjANIMATION@ anim = jjAnimations[curAnim]; return obj.curFrame >= anim.firstFrame && obj.curFrame < anim.firstFrame + anim.frameCount; } bool doesObjectUseAnimation(jjOBJ@ obj, ANIM::Set setID, uint animID) { return doesObjectUseAnimation(obj, jjAnimSets[setID].firstAnim + animID); } |
Apr 13, 2015, 10:36 AM | |
I'd try something like this (untested), if you're sure there'll be a time limit (maybe put some code in
onLevelBegin to ensure that):Code:
bool atLeastOneRedPlayerAlive() { for (uint i = 0; i < 32; ++i) { jjPLAYER@ play = jjPlayers[i]; if (play.team == TEAM::RED && play.isInGame) return true; } return false; } void onGameStop(bool firstTime) { if (!jjIsServer) return; if (firstTime) return; if (jjGameState == GAME::PAUSED) return; if (atLeastOneRedPlayerAlive()) //somehow indicate that you think blue lost } |
Apr 14, 2015, 09:23 AM | ||
Quote:
__________________
. |
Apr 14, 2015, 11:04 AM | |
First you figure out how many people are playing; then you do whatever math you have in mind; then you set the number of lives.
|
Apr 22, 2015, 07:07 AM | |
I need help... I don't know much of how to use jjSTREAM, and I wanna make a custom command "!rename name" that only renames yourself, and I need to send a packet to the server to do the command "/rename clientID name".
__________________
~XxMoNsTeR Last edited by XxMoNsTeRXM; Apr 23, 2015 at 03:26 AM. |
Apr 25, 2015, 03:34 AM | |
Ok, I learned quite more about jjStream, and now I think I know how to use it.
__________________
~XxMoNsTeR |
Apr 26, 2015, 07:57 AM | |
I wanted to insert a custom sprite in my level, replacing a food with another.
1st question: How do you change the amount of set IDs and their respective frames and animation amounts in your custom j2a file? You can't do it with Jazz Sprite Dynamite. 2nd question: What should I write in Angelscript to successfully replace a food sprite with one from my custom j2a file? |
Apr 26, 2015, 10:33 AM | |
1: Don't use Jazz Sprite Dynamite.
2: Suppose for the sake of simplicity that your food sprite is in animation 0 in anim set 0 in your custom j2a file. Then there are various approaches you could take, but these two are probably the most practical. Code:
jjAnimSets[ANIM::CUSTOM[0]].load(0, "myCustom.j2a"); //option 1: affects only apples jjObjectPresets[OBJECT::APPLE].determineCurAnim(ANIM::CUSTOM[0], 0); //option 2: affects any object that might try to use the apple animation jjAnimations[jjObjectPresets[OBJECT::APPLE].curAnim] = jjAnimations[jjAnimSets[ANIM::CUSTOM[0]]]; |
Apr 28, 2015, 06:04 AM | |
Thank you for the help! I now can make those custom objects I've been trying to make for years! (see "Campaign Mysteries" and other archaic levelpacks of mine)
I'm now experimenting the tile redrawing functions of AngelScript. Is there by chance an option that allows you to not only draw a tile on a specified layer, but also repeat it along with the JCS Tile Width / Height function? (as far as it is in the screen, ofcourse, otherwise it would cause a hyperlag) |
Tags |
angelscript, code, jcs, request |
«
Previous Thread
|
Next Thread
»
Thread Tools | |
|
|
All times are GMT -8. The time now is 04:12 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.