Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » JCS & Scripting

AngelScript Requests & Help

Reply
 
Thread Tools
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Jul 23, 2016, 11:23 PM
Violet CLM is offline
Reply With Quote
I'm having trouble thinking of a sprite mode combination that would manage to draw all sprites in a single color but leave the background a different (translucent!) color, but I guess you could just do what PlusOJ does and grayscale the whole area:
Code:
jjDrawRectangle(TopLeft, TopRight, Width, Height, 0, SPRITE::BLEND_SATURATION, 255, 2);
__________________
AvalancheMaster AvalancheMaster's Avatar

JCF Member

Joined: Sep 2013

Posts: 89

AvalancheMaster is doing well so far

Jul 24, 2016, 01:27 AM
AvalancheMaster is offline
Reply With Quote
I know this is not an AngelScript functionality request thread, neither is this idea on the top of your priorities list, but would something like this be possible to implement:

SPRITE::TWOTONE, uint8, uint8

Where the first integer selects a color from the palette for the background (e.g. white), and the second integer selects a color from the palette for all the sprites and masked areas?
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Jul 24, 2016, 09:45 AM
Violet CLM is offline
Reply With Quote
Not really within the current framework, no.
__________________
MilloCz

JCF Member

Joined: Jan 2011

Posts: 24

MilloCz is doing well so far

Aug 21, 2016, 01:21 AM
MilloCz is offline
Reply With Quote
Hi, I hope this is still running, I've got 2 questions;

1) I assume it's not possible to trick drawString into drawing text with multiple lines? (unless I make more drawString's each one for each line)

2) What's some fancy way to prevent player from moving? I know every frame I can set his xPos and yPos, but it doesn't look too good - how do I make him standing still (even when he's pressing arrows)?
MilloCz

JCF Member

Joined: Jan 2011

Posts: 24

MilloCz is doing well so far

Aug 21, 2016, 01:34 AM
MilloCz is offline
Reply With Quote
3) I haven't yet quite figured out jjParameterGet, this code should tell me, how many of each gem is in the crate:

Code:
	jjAlert("----------------------------------");
	jjAlert(formatInt(jjParameterGet(26,19,4,0),"1"));
	jjAlert(formatInt(jjParameterGet(26,19,4,4),"1"));
	jjAlert(formatInt(jjParameterGet(26,19,4,8),"1"));
	jjAlert(formatInt(jjParameterGet(26,19,4,12),"1"));
	jjAlert("----------------------------------");
But it shows correct number only for the green, why?

It also doesn't seem to work properly on "Area ID", not giving area's ID.

EDIT: Meh, question 3 solved. sorry for spam

Last edited by MilloCz; Aug 21, 2016 at 01:45 AM.
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Aug 21, 2016, 06:41 AM
Seren is offline
Reply With Quote
Quote:
Originally Posted by MilloCz View Post
1) I assume it's not possible to trick drawString into drawing text with multiple lines? (unless I make more drawString's each one for each line)
Read up on jjTEXTAPPEARANCE. Properties of your interest are at and newline. See also the table in the constructor, showing that you can in fact avoid jjTEXTAPPEARANCE usage altogether if your case allows using STRING::SPIN. There is currently no way to customize vertical spacing of text.
Quote:
Originally Posted by MilloCz
2) What's some fancy way to prevent player from moving? I know every frame I can set his xPos and yPos, but it doesn't look too good - how do I make him standing still (even when he's pressing arrows)?
Setting key input properties to false achieves this most easily. It may require to be done in onPlayerInput.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
MilloCz

JCF Member

Joined: Jan 2011

Posts: 24

MilloCz is doing well so far

Aug 25, 2016, 08:44 AM
MilloCz is offline
Reply With Quote
Thanks for reply, I will check that out.


Also, could you help me with cameraFreeze? when you are near x position 0, camera freezes and doesn't move out of level border - can I do this with cameraFreeze on other positions too?

My code:
Code:
	if(p.xPos>260*32){

		if(did_he_set_it == 0){

			playerx = p.xPos;
			did_he_set_it = 1;
		}
		p.cameraFreeze(playerx ,p.yPos, true, true);
	}
	else{

		p.cameraUnfreeze(true);
		did_he_set_it = 0;
	}
The issue I'm having - it's laggy, the camera shakes a little when it's frozen, making it look pretty weird.. Any idea how do I overcome this? If I set isntant to false, then camera is kind of lazy and slow.
MilloCz

JCF Member

Joined: Jan 2011

Posts: 24

MilloCz is doing well so far

Aug 28, 2016, 02:15 PM
MilloCz is offline
Reply With Quote
Also, please, mind helping me with classes? I am not programmer and I have actually very poor knowledge at programming. I have trouble making classes work. Why is this not working?

Code:
class Character
{
	string name = "default";

	Character(){}

}

Character Guy;

Guy.name = "Peter";
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Aug 28, 2016, 02:43 PM
Violet CLM is offline
Reply With Quote
That's not a class problem so much as the fact you can't run non-initialization code outside of functions like that. Either of these would work:
Code:
class Character {
	string name = "default";
	Character(){}
}

Character Guy;
void onLevelLoad() {
	Guy.name = "Peter";
}
or
Code:
class Character {
	string name = "default";
	Character(){}
	Character(string newName) {
		name = newName;
	}
}
Character Guy("Peter");
__________________
Tonycake

JCF Member

Joined: Nov 2016

Posts: 7

Tonycake is doing well so far

Feb 2, 2017, 07:05 AM
Tonycake is offline
Reply With Quote
SpriteSheet question

Hi everyone, I already know some simple code to adjust things in single player such as fur color and adding hearts etc, but one thing I have been thinking about is the example I found where one could play as Mario. Is there any code out there (a simple would be awesome since Im not pro on programming haha xD) that I can use to for example play as Mario instead of jazz in any single player level? Actually I just want to be able to play as any other character from a spritesheet rather than the one's already exist. Thanks alot for reading my question and if you in any way don't like anything about my question, maybe it's not written correctly or I go against any rule, I will learn from this and never do such thing again. Thanks alot !
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Feb 2, 2017, 10:44 AM
Violet CLM is offline
Reply With Quote
You're talking about Play as Mario. That's a mutator, which means it can run in any level, including single player levels, though unfortunately there's not a good built-in interface for making that happen right now. What you can do though is create a dummy level, let's say marioifier.j2l, and then write the following marioifier.j2as script:

Code:
void onLevelBegin() {
	jjChat("/mutators mario on");
	jjNxt("diam1.j2l", true, true);
}
(but replacing "diam1.j2l" with whatever other level filename you want to play.)

That's not a great solution, but until we make some more code changes it's probably the best you'll get. :# As for other characters from other spritesheets, pretty much the exact same code would be involved, based on my snippet--the hard part is assembling the custom .j2a with the full roster of player sprites.
__________________
Tonycake

JCF Member

Joined: Nov 2016

Posts: 7

Tonycake is doing well so far

Feb 2, 2017, 03:58 PM
Tonycake is offline
Reply With Quote
Thanks alot for your reply Violet! I will attempt to do that! Yes that's the one I ment, though I forgot it wasn't among the snippets section but in the level section, I should have linked it to my post ofcourse sorry for this haha xD thanks!
Tonycake

JCF Member

Joined: Nov 2016

Posts: 7

Tonycake is doing well so far

Feb 3, 2017, 04:21 AM
Tonycake is offline
Reply With Quote
Wow! It did work out to play as mario on that level by activating the .mut to on It's really cool! Do you mind me asking one thing though, when you say "the hard part is assembling the custom -j2a with the full roaster of player sprites" do you mean that it's a bit difficult to put a sprite sheet together to make it work properly so that every picture works as one animation and having the exact required length between two pictures? By length I mean that if one animation is when the right leg is forward, and one animation is the left leg forward and that those two animation pictures doesn't "merge" into one so that you see both pictures at once? If this is the case, would it be possible to find a spritesheet that does work properly and kind of remake each picture with my own picture? Sorry if this is bad written I can rewrite it better if you want Thanks, btw I also saw this one - https://www.jazz2online.com/downloads/6648/sonic-jj2/ but the file extension .j2a is where the code for sonic animation is right?
Tonycake

JCF Member

Joined: Nov 2016

Posts: 7

Tonycake is doing well so far

Feb 3, 2017, 04:25 AM
Tonycake is offline
Reply With Quote
By the way I forgot to say, I saw your example of .j2a, do you possibly have a spritesheet that fits into that example so that I could understand this part? Thanks again

EDIT: I will edit my post a bit because I found this thread: https://www.jazz2online.com/jcf/showthread.php?t=19856 Should I follow this in order to complete my question?

Last edited by Tonycake; Feb 3, 2017 at 05:00 AM.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Feb 3, 2017, 09:58 AM
Violet CLM is offline
Reply With Quote
So, we don't have a tool that either imports .j2a files from sprite sheets or exports .j2a files to sprite sheets. That's one of the logical options, along with using animated gifs, but the only tool we have—which you found and linked to—works with a bunch of single .png images spread across various folders. Here, for example, is how one of Spaz's animations is represented (as viewed in Windows Explorer):



It's absolutely possible to use that tool to create a new set of sprites—the Mario mutator did exactly that. I'm just saying it takes a while to do, particularly because player characters have over 75 distinct animations. Not only do you have to find all the sprites, you have to spend time getting them into the right format so JJ2 can understand which ones to draw at what times and where. If you are interested, I'd suggest starting with something simpler like replacing the sprites for a single enemy first, so you can be sure you know how the process works before you start doing it over and over.

(The Sonic one is a similar concept but replaces your entire default anims.j2a file, because that was the only option available at the time it was made, rather than replacing only individual animations or animation sets like is allowed by JJ2+.)
__________________
Tonycake

JCF Member

Joined: Nov 2016

Posts: 7

Tonycake is doing well so far

Feb 3, 2017, 11:21 AM
Tonycake is offline
Reply With Quote
Thanks alot Violet! Good idea with starting with enemies im very interested in this and I will absolutely try it out! Thanks!
Darkhog Darkhog's Avatar

JCF Member

Joined: May 2012

Posts: 227

Darkhog is notorious for his worthless posts

Feb 5, 2017, 06:18 AM
Darkhog is offline
Reply With Quote
I'd really prefer if AngelScript would be deprecated in favor of Lua. Lua is much more mainstream scripting language, has easier to learn syntax and is faster (as in execution speed). Which means more people would be able to code their own stuff as Lua is used across the gaming/modding industry as the go-to scripting backend.

Lua is used in games such as:
- SMBX
- Gmod
- Prison Architect
- And many, many more (few are surprises on that list)

Of course AngelScript backend should remain in place, but only for the sake of compatibility with the older levels.

If news would go into the wild about JJ2 now supporting Lua, I'm sure this will bring more modders into it and maybe revitalize dying JJ2 level scene (yes, I call levels released by the same people over and over again, with no "new blood" dying).
__________________
Code:
    .──.
   │O_O │
   ││_╱ │
  ╱╱   │╲
 (|▔╲  │ )
╱'╲_▔ _╱`╲
╲___) (___╱  TUX LOVES YOU.
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Feb 5, 2017, 07:35 AM
Seren is offline
Reply With Quote
That is not an AngelScript request.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
Tonycake

JCF Member

Joined: Nov 2016

Posts: 7

Tonycake is doing well so far

Feb 5, 2017, 08:27 AM
Tonycake is offline
Reply With Quote
Hi once again!

It works very good with the python file I downloaded to extract images and import them, I tried remake some of the mario.j2a and it worked which made me very happy! Since alot of images have a background 0,0,0 the "colorkey" must be set to make that transparent or something I guess because of all zeros at the pictures (don't take this serious because it's just a guess im actually a begginner xD) anyway, I might have missed something obvious and I read about the Anims.j2a including sound files and that you should not try this method with that one. But if I want to replace the heart symbol (lives), and would change this picture to something else, how would I import the Anims.j2a folder when im done? I mean I read this snippet https://www.jazz2online.com/snippets...zs-animations/ is this the way to go? It says animation and im not sure if it means ONLY character animations or pictures aswell, if I missed something obvious im sorry for this, I will try to find the answer on internet or here meanwhile waiting for someone to tell me, thanks alot for every help I have recieved im glad!

EDIT: forget the 0,0,0 theory the numbers were explained in the first post how can I miss this

2nd EDIT: I forgot to mention, I understand the difference between the sonic.j2a and mario.j2a, I opened both of them so now I understand this clearer

3rd EDIT: I also thought that since you don't write "ANIM::LIVES" or something similar like you do "ANIM::JAZZ", my guess is the sonic way is the way to go since it alter the whole folder like Violet told me earlier, because the snippet Violet made "Replace Jazz's Animation" alter the main character that you play as right? Thanks, when I understood this I will stop asking so much haha xD thanks

4th EDIT: https://www.jazz2online.com/download...p?levelID=4041 must be it right

ABSOLUTELY LAST EDIT: I can edit Anims.j2a now with that program ! Im very happy for this thanks alot for every help and if someone else wants help with editing stuff in jazz jackrabbit 2 + send me a message and I help you! Thanks alot

Last edited by Tonycake; Feb 5, 2017 at 01:16 PM.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Feb 5, 2017, 01:36 PM
Violet CLM is offline
Reply With Quote
It looks like you made a lot of progress! Two clarificatory notes:

* When building a tileset, it's important that the first color in the palette be 0,0,0, but .j2a files do not care about that. You can use whatever palette you like.
* Jazz Sprite Dynamite can be used to edit anims.j2a, yes, but I wouldn't suggest doing that unless maybe if you truly intend to change a significant percent of the sprites in the game. Anims.j2a is an enormous file, in part because it includes almost all the game's sound effects, and it was not made to be distributed. Smaller, specific case .j2a files are to be preferred.

The reason there's no ANIM::LIVES is because unlike Jazz or Spaz, there's only a single animation for the 1up pickup, so it doesn't need its own animset. It's in the ANIM::PICKUPS set instead. In fact, the 1up pickup is literally the subject of the examples provided in the jjANIMSET documentation.

So, assuming you've loaded an animation that you want to use for 1up pickups from a custom .j2a set, you'll want to write something like
Code:
jjObjectPresets[OBJECT::EXTRALIFE].curAnim = myAnimationID;
or
Code:
jjAnimations[jjObjectPresets[OBJECT::EXTRALIFE].curAnim] = jjAnimations[myAnimationID];
or
Code:
jjAnimations[jjAnimSets[ANIM::PICKUPS].firstAnim] = jjAnimations[myAnimationID];
__________________
Tonycake

JCF Member

Joined: Nov 2016

Posts: 7

Tonycake is doing well so far

Feb 5, 2017, 02:43 PM
Tonycake is offline
Reply With Quote
Thanks alot for clarifying those two things I will definitely keep this information in mind!
Old Feb 7, 2017, 06:10 AM
Darkhog
This message has been deleted by Stijn. Reason: shut up about lua this isn't the thread for it
Old Feb 7, 2017, 11:43 AM
Violet CLM
This message has been deleted by Stijn.
Old Feb 8, 2017, 02:29 PM
Darkhog
This message has been deleted by Stijn.
Old Feb 8, 2017, 04:56 PM
cooba
This message has been deleted by Stijn.
Jelly Jam Jelly Jam's Avatar

JCF Member

Joined: Oct 2014

Posts: 775

Jelly Jam is doing well so far

May 22, 2017, 01:28 PM
Jelly Jam is offline
Reply With Quote
Quite new to scripting and sorry if I miss something completely obvious, but take a look: http://imgur.com/a/ohkoE

How do i make this look like the far right side of the level without changing the width of my level in JCS? And since I'm planning to make something on the other side of the wall as well, how do i make it look like the far LEFT side of the level? Can i make it happen ingame by touching a text area?

(not entirely to the left or right though, 2 or 3 vertical rows of tiles could be visible)

EDIT: oh and i meant to say that i want to make it look like the far left just a bit later, that's why i mentioned the text area.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

May 22, 2017, 07:18 PM
Violet CLM is offline
Reply With Quote
If I understand you right, you're looking for jjPLAYER::limitXScroll. Or depending on circumstances you might not even need angelscript, just the Limit X Scroll event.
__________________
Jelly Jam Jelly Jam's Avatar

JCF Member

Joined: Oct 2014

Posts: 775

Jelly Jam is doing well so far

May 24, 2017, 08:46 AM
Jelly Jam is offline
Reply With Quote
Well that worked!

Is there a way to change the player name color? Especialy without messing it all up if the player already has his/her name colored, thus changing into some other color. Can it be done even in CTF and its custom gamemodes? Without swapping teams, of course.
DoubleGJ DoubleGJ's Avatar

JCF Member

Joined: Sep 2002

Posts: 3,049

DoubleGJ has disabled reputation

Aug 15, 2017, 02:16 PM
DoubleGJ is offline
Reply With Quote
Thread revival!

I'm trying to make an enemy that periodically surrounds itself with a ring of hourglasses. The solution I came up with was to edit the Pizza event so that it's a gem ring with the event ID set to 90. The enemy would then spawn a pizza and constantly set its xPos and yPos to its own. However, I'm having trouble figuring out how to access the Gem Ring event value in the script. Here's what I have so far:

Code:
void onLevelLoad() {
	jjObjectPresets[OBJECT::PIZZA].behavior = freezeRing;
}

void freezeRing(jjOBJ@ obj) {
	obj.behavior = BEHAVIOR::GEMRING;
	obj.eventID = 90;	
	obj.var[2] = 90;
	obj.var[0] = 4;
	obj.var[1] = 4;
}
__________________
"So unless I overwrote my heart with yours, I think not. But I might have." - Violet CLM

Two Games Joined releases:
Control / Splinter (twin singles)
|| Ballistic Bunny (EP)
||
Beyond (maxi-single)
|| Beyond: Remixed (remix EP)
|| Inner Monsters OST (mini-album)
||
Shadows (album)
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Aug 15, 2017, 09:55 PM
Violet CLM is offline
Reply With Quote
My instinct would be to create an OBJECT::GEMRING on top of an event that you know has the right parameters to produce a gem ring with hourglasses, rather than using a pizza.
__________________
DoubleGJ DoubleGJ's Avatar

JCF Member

Joined: Sep 2002

Posts: 3,049

DoubleGJ has disabled reputation

Aug 16, 2017, 05:07 AM
DoubleGJ is offline
Reply With Quote
Okay, that does indeed work when I spawn the event at onLevelLoad. I can't make the enemy spawn it, however, though on paper this looks like it should work:

Code:
void onLevelLoad() {
	
	jjObjectPresets[OBJECT::BEE].behavior = testBee;
}

void testBee(jjOBJ@ bee) {
	int freeze;

	bee.behave(BEHAVIOR::BEE);
	
	if (bee.state == STATE::START) {
		freeze = jjAddObject(192, 50, 50, 0, CREATOR::OBJECT);
		
	}

	if (bee.state == STATE::FLY) {
		jjObjects[freeze].xPos = bee.xPos;
		jjObjects[freeze].yPos = bee.yPos;
	}

	if (bee.state == STATE::KILL) {
		jjObjects[freeze].state = STATE::KILL;
	}
}
__________________
"So unless I overwrote my heart with yours, I think not. But I might have." - Violet CLM

Two Games Joined releases:
Control / Splinter (twin singles)
|| Ballistic Bunny (EP)
||
Beyond (maxi-single)
|| Beyond: Remixed (remix EP)
|| Inner Monsters OST (mini-album)
||
Shadows (album)
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Aug 16, 2017, 09:01 AM
Violet CLM is offline
Reply With Quote
Three thoughts...
  • The very first time you call bee.behave(BEHAVIOR::BEE);, the state will stop being STATE::START, so jjAddObject won't get called. Move the behave line farther down.
  • int freeze; is a variable local to (and therefore reinitialized) each time the function is called, not a member property of an object that would persist over time. Replace freeze with bee.special or something like that.
  • While creating the gem ring, you might need to set its jjOBJ::deactivates to false so it doesn't go missing in the time between its being created and its starting to follow the bee around. (And then bee.state == STATE::KILL should be expanded to check for STATE::DEACTIVATE too.)
__________________
DoubleGJ DoubleGJ's Avatar

JCF Member

Joined: Sep 2002

Posts: 3,049

DoubleGJ has disabled reputation

Aug 16, 2017, 10:27 AM
DoubleGJ is offline
Reply With Quote
Great, it works! I don't really need #3 since this is going to be a boss fight, so the gem ring spawn point will always be nearby. Right now the last thing I'm trying to figure out is creating a new hourglass shield a while after the current one is destroyed by touching it. I can't really find what's wrong in the code, but for some reason it makes the bee create new rings regardless if it already has one or not:

Code:
void testBee(jjOBJ@ bee) {

	
	if (bee.state == STATE::START || bee.counter == 255) {
		bee.counter = 0;
		bee.special = jjAddObject(192, 50, 50, 0, CREATOR::OBJECT);
		
	}

	bee.behave(BEHAVIOR::BEE);

	if (bee.state == STATE::ATTACK || bee.state == STATE::FLY || bee.state == STATE::IDLE) {
		jjObjects[bee.special].xPos = bee.xPos;
		jjObjects[bee.special].yPos = bee.yPos;
		if (jjObjects[bee.special].state == STATE::KILL) {
			bee.counter++;
		}
	}
	
	if (bee.state == STATE::KILL) {
		jjObjects[bee.special].behavior = BEHAVIOR::EXPLOSION2;
	}
}
__________________
"So unless I overwrote my heart with yours, I think not. But I might have." - Violet CLM

Two Games Joined releases:
Control / Splinter (twin singles)
|| Ballistic Bunny (EP)
||
Beyond (maxi-single)
|| Beyond: Remixed (remix EP)
|| Inner Monsters OST (mini-album)
||
Shadows (album)
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Aug 16, 2017, 11:54 AM
Violet CLM is offline
Reply With Quote
Well, there are a couple issues, but the one you're facing at the moment is that BEHAVIOR::BEE also increments jjOBJ::counter.
__________________
Jelly Jam Jelly Jam's Avatar

JCF Member

Joined: Oct 2014

Posts: 775

Jelly Jam is doing well so far

Sep 30, 2017, 12:08 PM
Jelly Jam is offline
Reply With Quote
Can I somehow remove the lightning that appears behind the rabbit when it's moving and the one around bullets? I want to use it in a level.
Darkhog Darkhog's Avatar

JCF Member

Joined: May 2012

Posts: 227

Darkhog is notorious for his worthless posts

Dec 1, 2017, 12:25 PM
Darkhog is offline
Reply With Quote
Is there a way to keep custom data between levels? I'm thinking about making a central hub level where you can unlock paths and stuff by doing certain stuff in other levels and for that I need a way to keep some information when player moves between levels.

If that's not possible, treat it as a request.
__________________
Code:
    .──.
   │O_O │
   ││_╱ │
  ╱╱   │╲
 (|▔╲  │ )
╱'╲_▔ _╱`╲
╲___) (___╱  TUX LOVES YOU.
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Dec 1, 2017, 05:36 PM
Violet CLM is offline
Reply With Quote
The most intuitive way is to save the data to disk using jjSTREAM, which is effectively what JJ2 does when you enter a secret level like Gargoyle's Lair. Alternatively you can abuse JJ2 a little by storing values in the properties of higher-numbered players that never get erased, like jjPlayers[31].score or whatever.
__________________
PurpleJazz PurpleJazz's Avatar

JCF Member

Joined: Aug 2006

Posts: 852

PurpleJazz is OFF DA CHARTPurpleJazz is OFF DA CHARTPurpleJazz is OFF DA CHART

Dec 1, 2017, 05:57 PM
PurpleJazz is offline
Reply With Quote
Quote:
Originally Posted by Jelly Jam View Post
Can I somehow remove the lightning that appears behind the rabbit when it's moving and the one around bullets? I want to use it in a level.
OK so this doesn't remove the light trail created by running players (although non-local players don't see this anyway), but does remove the light the player emits normally and removes bullet lighting (except for the light produced by weapon explosions).

Code:
void onLevelLoad() {
    for (int eventID = OBJECT::BLASTERBULLET; eventID <= OBJECT::ELECTROBULLETPU; ++eventID) {
        jjObjectPresets[eventID].lightType = LIGHT::NONE;
    }
}

void onPlayer(jjPLAYER@ play) {
    play.lightType = LIGHT::NONE;
}
DoubleGJ DoubleGJ's Avatar

JCF Member

Joined: Sep 2002

Posts: 3,049

DoubleGJ has disabled reputation

Dec 1, 2017, 08:47 PM
DoubleGJ is offline
Reply With Quote
Quote:
Originally Posted by Violet CLM View Post
The most intuitive way is to save the data to disk using jjSTREAM, which is effectively what JJ2 does when you enter a secret level like Gargoyle's Lair. Alternatively you can abuse JJ2 a little by storing values in the properties of higher-numbered players that never get erased, like jjPlayers[31].score or whatever.
Keep in mind this will all work only in a single play-through, as there is currently no means to store AngelScript data in a save file. A workaround for your needs might be to provide necessary data values as soon as you load a non-hub level.
__________________
"So unless I overwrote my heart with yours, I think not. But I might have." - Violet CLM

Two Games Joined releases:
Control / Splinter (twin singles)
|| Ballistic Bunny (EP)
||
Beyond (maxi-single)
|| Beyond: Remixed (remix EP)
|| Inner Monsters OST (mini-album)
||
Shadows (album)
Darkhog Darkhog's Avatar

JCF Member

Joined: May 2012

Posts: 227

Darkhog is notorious for his worthless posts

Dec 2, 2017, 08:25 AM
Darkhog is offline
Reply With Quote
Quote:
Originally Posted by DoubleGJ View Post
Keep in mind this will all work only in a single play-through, as there is currently no means to store AngelScript data in a save file. A workaround for your needs might be to provide necessary data values as soon as you load a non-hub level.
I see. Though I think ability to use disk I/O in AngelScript would solve the issue. And I want it to be a single playthrough deal anyway.
__________________
Code:
    .──.
   │O_O │
   ││_╱ │
  ╱╱   │╲
 (|▔╲  │ )
╱'╲_▔ _╱`╲
╲___) (___╱  TUX LOVES YOU.
Slaz Slaz's Avatar

JCF Member

Joined: Aug 2004

Posts: 1,314

Slaz is OFF DA CHARTSlaz is OFF DA CHARTSlaz is OFF DA CHART

Dec 8, 2017, 01:48 AM
Slaz is offline
Reply With Quote
Hey there,

I've imported some tiles to my level through jjTilesFromTileset to use in background layers. They generally look good with the native palette, but noticed there's 1 crucial color that looks ugly and corresponds to the darkest color used in the native ground tiles. So either the background will look partly ugly or the darkest color of the layer4 ground will.

You know I suck at scripting so the answer may be obvious, but is there some way to recolor or swap palette entries to one or more specific tiles by their ID? None of my jjPal fiddling seemed to work.

Any example or tip will be highly appreciated!
__________________
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
Seren Seren's Avatar

JCF Member

Joined: Feb 2010

Posts: 864

Seren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to allSeren is a name known to all

Dec 8, 2017, 02:30 AM
Seren is offline
Reply With Quote
jjTilesFromTileset accepts an extra parameter for that very purpose, named paletteColorMapping. You want most colors to be mapped to their current color (paletteColorMapping[i] == i), and those that look wrong to be mapped to something else.

If you find that it's more complicated than that, and some colors should be replaced with one color in one context and another in another context, jjPIXELMAP is there to give you a helping hand. The documentation offers an example that already does something quite similar.
__________________

I am an official JJ2+ programmer and this has been an official JJ2+ statement.
Slaz Slaz's Avatar

JCF Member

Joined: Aug 2004

Posts: 1,314

Slaz is OFF DA CHARTSlaz is OFF DA CHARTSlaz is OFF DA CHART

Dec 10, 2017, 04:39 PM
Slaz is offline
Reply With Quote
Quote:
Originally Posted by Sir Ementaler View Post
You want most colors to be mapped to their current color (paletteColorMapping[i] == i), and those that look wrong to be mapped to something else.
I somehow overlooked that parameter and had it set to null without questioning myself.. Thanks!
__________________
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
AvalancheMaster AvalancheMaster's Avatar

JCF Member

Joined: Sep 2013

Posts: 89

AvalancheMaster is doing well so far

Jan 6, 2018, 08:13 AM
AvalancheMaster is offline
Reply With Quote
Question time!

I want to combine the Slide event in my level with Steady Light. I'm using Mez03, and I want the neon-tube-like animated platforms to light up in the dark. So far I have no idea how to accomplish that.

Also, while on the same topic, is there a way to change the "Illuminate Surroundings" parameter to act as a steady light, rather than Flickering?
Reply

Tags
angelscript, code, jcs, request

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 03:26 AM.