View Single Post
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Jul 4, 2018, 01:02 PM
Violet CLM is offline
Reply With Quote
Hi there! As you say, it's been a while--glad to see you jumping back in.

Quote:
Originally Posted by PT32 View Post
Zero Gravity
Code:
array<float> ZeroGravityVerticalPosition(jjLocalPlayerCount, -1);
void onFunction0(jjPLAYER@ play, bool enableZeroGravity) {
  ZeroGravityVerticalPosition[play.localPlayerID] = enableZeroGravity ? play.yPos : -1;
}
void onPlayer(jjPLAYER@ play) {
  if (ZeroGravityVerticalPosition[play.localPlayerID] != -1) {
    play.yPos = ZeroGravityVerticalPosition[play.localPlayerID];
    play.ySpeed = 0;
  }
}
Quote:
Location tracking (i.e., an arrow persistently pointing back to the start pos)
Look at Operation Cleanup for an example of arrow drawing.
Quote:
More turtle enemies (i.e., some of the Jazz1 enemies like Je-Turtles from Turtemple, or brand-new types)
Jazz 1 Enemies
Quote:
Rabbit enemies
Mutated monster enemies
These are too unspecific for there to be much I can say here. Consult the documentation for jjBEHAVIORINTERFACE I guess?
Quote:
Water-free zones (i.e., dry land below water level)
This can't be done at present, if you mean seeing the standard JJ2 water effect in one part of the screen and a waterless area below it on the same screen, unless you do some tricks with layer order (see below).
Quote:
Layer 1 supersceding the water layer (becuz water annoying that way)
This is the "WaterLayer" setting in the "JJ2+ Properties -> Level Properties" window in MLLE.
Quote:
Placeable static events of Jazz, Devan, Spaz and Lori
Placeable static event of the player character
Rabbit civilian NPCs
I'm interpreting these to all be pretty much the same thing, which looks something like this.
Code:
void onLevelLoad() {
  if (jjAnimSets[ANIM::DEVAN] == 0)
    jjAnimSets[ANIM::DEVAN].load();
  jjOBJ@ eventBeingUsedForNPCsInThisLevel = jjObjectPresets[OBJECT::APPLE]; //or whichever other event, up to you
  eventBeingUsedForNPCsInThisLevel.playerHandling = HANDLING::PARTICLE;
  eventBeingUsedForNPCsInThisLevel.behavior = NPC();
}
class NPC : jjBEHAVIORINTERFACE {
  array PossibleAnimationsForEachCharacter = {jjAnimSets[ANIM::JAZZ] + RABBIT::STAND, jjAnimSets[ANIM::SPAZ] + RABBIT::STAND, jjIsTSF ? jjAnimSets[ANIM::LORI] + RABBIT::STAND : 1, jjAnimSets[ANIM::DEVAN] + 1};
  void onBehave(jjOBJ@ obj) {
    switch (obj.state) {
    case STATE::START:
      obj.curAnim = PossibleAnimationsForEachCharacter[jjParameterGet(uint(obj.xPos) / 32, uint(obj.yPos) / 32, 0, 2)];
      obj.curFrame = jjAnimations[obj.curAnim];
      obj.putOnGround(true);
      obj.var[0] = jjParameterGet(uint(obj.xPos) / 32, uint(obj.yPos) / 32, 2, 5); //which player number to get fur colors from
      obj.state = STATE::IDLE;
      break;
    case STATE::DEACTIVATE:
      obj.deactivate();
      break;
    default: {
      const int nearestPlayerID = obj.findNearestPlayer(128 * 128);
      if (nearestPlayerID >= 0)
        obj.direction = jjPlayers[nearestPlayerID].xPos > obj.xPos ? 1 : -1;
      if (++obj.age == 7) {
        ++obj.frameID;
        obj.determineCurFrame();
        obj.age = 0;
      }
      break; }
    }
  }
  void onDraw(jjOBJ@ obj) {
    jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PLAYER, obj.var[0]);
  }
}
For defining how your various NPCs should look, you'll want some lines like this in onLevelLoad, where the numbers match up to gradients in the palette:
Code:
jjPlayers[1].furSet(24,32,40,48);
Finally you'll want to edit either MLLEProfile - JJ2.ini or MLLEProfile - TSF.ini, depending, to include this line in the "Events" group:
Code:
141=NPC                              |+|Scenery   |NPC    |     |Character:{Jazz,Spaz,Lori,Devan}2|Fur Colors:5
Quote:
The ability for hostile NPCs to shoot at each other (i.e., Rabbit and Turtle forces in combat)
The difficulty here is you stating the desired behavior clearly enough for it to be translatable into code. "[S]hoot at" is pretty vague and encompasses an infinitely wide range of possible implementations.
Quote:
Heat wave visual effects (may already exist, I'm not sure)
While hovering over a mouse in the Tileset pane of MLLE, press Shift+5.
Quote:
New weapon types (two I'd like to implement are the firework gun and energy blast from Press Garden, but I'll happily take suggestions for other new weapons, too)
You can find most custom weapons under the top gun contest downloads tag.
Quote:
Misc. UI display stuff (i.e., text appearing onscreen for an objective, then changing once objective is completed)
Code:
string CurrentObjective = "Get to the choppa";
bool onDrawScore(jjPLAYER@, jjCANVAS@ canvas) {
  canvas.drawString(10, 50, CurrentObjective);
  return false;
}
and change the value of the CurrentObjective variable when appropriate.
Quote:
Elimination of damage knockback
Code:
array<float> PlayerLastHorizontalSpeed(jjLocalPlayerCount), PlayerLastVerticalSpeed(jjLocalPlayerCount);
array<bool> PlayerWasHurtLastGameTick(jjLocalPlayerCount, false);
void onPlayer(jjPLAYER@ play) {
  const bool playerIsHurt = play.curAnim == jjAnimSets[play.setID] + RABBIT::HURT;
  if (playerIsHurt && !PlayerWasHurtLastGameTick[play.localPlayerID]) {
    play.xSpeed = PlayerLastHorizontalSpeed[play.localPlayerID];
    play.ySpeed = PlayerLastVerticalSpeed[play.localPlayerID];
  } else {
    PlayerLastHorizontalSpeed[play.localPlayerID] = play.xSpeed;
    PlayerLastVerticalSpeed[play.localPlayerID] = play.ySpeed;
  }
  PlayerWasHurtLastGameTick[play.localPlayerID] = playerIsHurt;
}
That's a literal interpretation of the statement, but there's the separate issue that players can't control their rabbits for half a second after they've been hurt, which isn't something you can get rid of as easily. The only alternative I'm thinking of is to have all damage done to the player done by editing jjPLAYER::health from within the script, instead of traditional built-in collision damage from enemies/bullets/hurt events, but that might be a bit more than you want to take on.
Quote:
(Both tilesets should have at least one black tile)
Right-click on a tile in the Tileset pane in MLLE and click "Edit Image..." from the context menu.

If you don't find specific tilesets with all the different components you need, instead you can use the "JJ2+ Properties -> Tilesets -> Add New..." dropdown menu option in MLLE to use tiles from multiple tilesets in a single level.
__________________