![]() |
Quote:
Code:
void onLevelBegin() { |
That doesn't seem to do the job. Also, doesn't lightType use names?
|
I'm guessing yours is a single player level and PJ is writing code for a multiplayer level (or at least testing it in a single screen). Try
o.deactivates = false;? |
Single Player indeed. I included that line, but it still doesn't seem to work.
|
Quote:
The following script has been tested and works perfectly for me, so if this still doesn't work it means that there may be an error elsewhere in your script. Code:
void onLevelBegin() { |
Thanks, that worked!
I'm also trying to make those areas one-way, as well as slide. Is there any way to do this? So far any attempt to achieve this has resulted either in Slide-only, or One-way-only tiles, depending on the ordering of the code. Code:
void onLevelBegin() {If you have a 10-frame animation, with frames a[1], a[2], a[3], a[4], a[5] ... a[9], a[10], instead of using speed to control the animation, you are using player's position. As the player moves in a positive direction (x and y get bigger), the frames move in chronological order. As the player moves in a negative direction (x and y get smaller), the animation runs in reverse. When the player stops moving, the animation also stops. This should apply to all layers, so an animation is the only feasible way I can imagine implementing this. I want to try to implement faux reflections in a tileset, that's the whole idea behind my question. |
So, I'm trying to code a custom boss that summons a bunch of enemies, including summoning low HP bosses as enemies, but I've run into an issue: I'm having a hard time making things immune to (or at least not 1HKO'd by) Spaz's kick and Jazz's uppercut. Setting things to use playerHandling mode HANDLING::SPECIAL "works"... but also removes non-bullet collision detection for most enemies and the main boss (the latter would actually be a good thing if it was consistent, since I don't want it to be hurt by anything other than time passing anyways, but it's too inconsistent to be useful). It also has an issue where setting the bosses to have that collision mode means they beat the level when killed, when you're only supposed to win the level by letting the main boss run out of HP. Basically, it's supposed to be a survival challenge.
Here's the full script for the level as of now, including an attempt at a work-around for the issue where killing bosses clears the level (the work-around works, but only about half the time for some reason): Code:
#include "MLLE-Include-1.4.asc"EDIT: Upon thinking about it further, I'm starting to think the easiest solution would be to disable Jazz's uppercut and Spaz's kick during the boss battle. Any easy way to go about doing that? EDIT 2: I managed to figure it out on my own, never mind. |
I was going to upload a small mutator that allows players to grab ledges and lift themselves on them (as in Earthworm Jim and Commander Keen). However, there are a few problems...
Here's the script: Code:
arrayI can't find a way to determine the animation of the player itself, so I had to make the player invisible and draw the sprite in front of him instead. This gives the player the default skin color while he's hanging, which is wrong. I need a way to determine the player's current animation, rather than drawing upon him. Oh, right! There also is this problem with the RABBIT::Anim where I simply can't find the one corresponding to Jazz grabbing the ledge. I had to use the numeral value, which probably differs between 1.23 and 1.24. |
That's a neat idea for a mutator!
Quote:
Quote:
|
hey, quick question.
is it possible to draw a custom scoreboard HUD in non-coop gametypes like CTF or battle? i've been trying to define "bool onDrawScore()", but that seems to only alter the co-op score. is it possible? thank you in advance. |
At present, the score display in game modes other than SP and coop may not be altered, aside from drastic measures such as overwriting font sprites, which certainly wouldn't be limited in scope to said display and would probably quite negatively affect the game. Remaining HUD functions such as
onDrawAmmo may still be used to display other information beside the usual. |
oh... that's a bummer.
oh well, i'm gonna hold off on my project until it's possible to draw over CTF score, i guess. thank you again. |
I'd like to use a regular enemy as a boss. I don't intend to change his behavior. I only change his sprites with tiles or replace them with JJ1Enemies sometimes.
I tried creating a behavior for the enemy and implement the if code below but it doesn't work. if ( boss.energy==0&&++boss.counter>2300) jjEventSet(play.xPos / 32, play.yPos / 32, AREA::EOL); Is there a practical way of putting a health bar and an automatic EOL event when his energy is 0? I am pretty new at scripting btw. Treat me as a noobie :) |
Quote:
A boss health bar is drawn for players if their bossActivated is true and boss refers to an object by its ID. There's also an accompanying activateBoss method, or you could use the traditional Activate Boss event. See especially the documentation for boss, as it describes how the health bar's size is determined. Most JJ2 boss behaviors work the following way: the boss starts out inactive and its behavior has a loop over all players that checks if any active player's bossActivated is true. If it is, the boss changes its state to something else, indicating that it's now active. Then, whenever the boss is active, it runs a loop that sets all players' boss to itself. This results in the health bar being drawn. When the boss is defeated and its energy is 0, the game doesn't despawn it, and instead (much like you, it seems) uses its behavior as a countdown to end the level. First, when the counter is 0, it might display some message much like showText. Then it waits between 4 and 6.5 seconds before it proceeds to the next level, depending on whether the player is firing bullets, for some weird reason (maybe under the assumption that if they're firing, they're getting impatient? Either way it's currently a speedrun strat to keep shooting after defeating a boss). Your magic number of 2300 seems pretty big as, at 70 ticks per second, that corresponds to over half a minute. Your strategy of spawning an EOL event seems valid, but it's generally a better idea to call jjNxt with default parameters. To sum up the order of events in a typical boss fight:
|
One possible additional consideration is your
boss.energy==0 condition. Several weapons do more than 1 damage, so it's easy for an enemy to end up with a negative energy number instead of exactly 0. (Some standard enemies/bosses check for this and immediately set energy to 0, others set it to -1, and probably others don't do anything at all.) |
JJNxt for the end boss
Quote:
Quote:
Code:
#include "Jazz1Enemies v05.asc" |
The main problem you're experiencing is this line:
jjNxt(bool warp = false, bool fast = false); Those bits inside the parentheses are supposed to indicate the default values for those arguments, meaning that if you just type jjNxt(); it'll be interpreted the same as if you had typed jjNxt(false, false);. Typing out the parameter names (and types) doesn't help.The next thing that's going to bite you is when you write jjObjectPresets[OBJECT::NORMTURTLE].behavior = NORMTURTBOSS; you are getting rid of the previous behavior, which included code for moving the object, drawing the object, and handling player collision and bullet collision. |
OK. Solved the problem. But sadly it doesn't work with JJ1 Enemies function. Because when I remove the JJ1Enemies function it works fine. It's main code probably considers it as a normal enemy and the counter does not start. So the level does not end. I tried removing the counter problem by trying to end the level when his energy=1 but it didn't work either. :(
|
Very delayed response, but I don't think I can tell exactly what you're doing from your description. Troubleshooting is generally easiest in response to actual code, like in your previous post, preferably the minimum amount of code that demonstrates the problem in question. What does "works fine" look like in code? What does not removing the JJ1Enemies function look like in code?
|
Turtle Boss
And another delayed response from me :D
It's been a while and I didn't keep the code. However I've tried using Normal Turtle animations and a new behavior in order to make it work and it helped. Here's the thing: Code:
bool boss=false; |
Have another question though. Is there a way to combine water level event with destruct scenery? I mean a shootable water level event like the ones in dreempipes.
|
Quote:
if (u==0||u==1) line which I assume refers to a variable you didn't include in that snippet. You are running into an issue where killing it using a physical attack fails to cause the level to end, but jObjectPresets[OBJECT::NORMTURTLE].playerHandling = HANDLING::ENEMY; should fix that. Also you probably don't want STATE::KILL to call boss.deactivate().Quote:
|
Walking Enemy
Quote:
Quote:
And I have a one last question. I am trying to create a walking enemy from Frog animations. It works but the animation plays under the ground sprite. Here's the code: Code:
|
First off, you could simplify all that like this:
Code:
void onLevelLoad() {BEHAVIOR::WALKINGENEMY is one of the only parts of the game that cares about jjANIMFRAME::coldSpotY, but the frog sprites are one of the only land-based animations that don't have that property defined. Walking enemies try to align their hotSpotY point to the surface of the ground they're on, but that number defaults to 0, which is the top of the sprite. Just move it upwards until it looks better:Code:
jjANIMATION@ frogWalkAnim = jjAnimations[jjObjectPresets[OBJECT::LIZARD].curAnim]; |
Solved
Quote:
|
I am trying to increase/decrease the player's x speed like this:
if(p.keyRight) p.xSpeed = 20; It works with void onPlayer but not in bool onObjectHit or void onFunction Any suggestions? |
There are a couple things you might be running into. One is that JJ2 is of course always changing the player's
xSpeed on its own, so if you make a single short-term change, in response to something like one of the onFunction# hooks, then that change is not going to last very long before JJ2's normal speed handling takes over. But onPlayer works constantly instead of as a one-time thing, so naturally it's going to have more visible impact. The other is that p is deprecated and may not (should not) work in all situations, and you should use the actual jjPLAYER@ argument available to onObjectHit and onFunction# instead. |
So even if I try with jjPLAYER I can’t make a constant speed change.
I could change the speed like this though, again with onPlayer. if(play.xPos>27 && play.yPos>43) if(play.keyRight) { play.xSpeed = 10; } if(play.keyLeft) { play.xSpeed = -10; } play.keyRun = true; } But that’s not the exact effect I want. I’d like to make a constant speed up (at least for ten seconds or so) regardless of the player pos |
Ah, okay, I see what you mean. Try something like this:
Code:
int SpeedUpUntil = 0;SpeedUpUntil = jjGameTicks + 10 * 70; where 10 is the number of seconds you want the effect to last.(if you want to support cooperative, SpeedUpUntil should be an array<int> instead of a int.) |
Worked like a charm. Thank you :)
|
| All times are GMT -8. The time now is 12:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
JCF © 2001-Infinity Jazz2Online