JazzJackrabbit Community Forums

JazzJackrabbit Community Forums (http://www.jazz2online.com/jcf/index.php)
-   JCS & Scripting (http://www.jazz2online.com/jcf/forumdisplay.php?f=5)
-   -   Custom .j2a files (http://www.jazz2online.com/jcf/showthread.php?t=19856)

Violet CLM Apr 6, 2015 07:01 PM

Custom .j2a files
 
JJ2+ version 5.0 includes two new .j2a files, but no instructions for how to make your own. Sorry. See, what happened is I came up with an internal tool for us to use, but then never found the time to make anything more user-friendly out of it, and didn't feel quite right bundling the internal tool with the main release.

But here you go, if you do want to make your own .j2a files.

It's just some very basic Python 2.x files using PIL. Run j2a-extract.py and type the filepath of one of your existing .j2a files to see what kind of file structure is expected of you, compile your own set of sprites, then run j2a-import.py. If you're extracting C:\Games\Jazz2\foo.j2a, the results will be stored in a few folder C:\Games\Jazz2\foo-j2a\ as a series of subfolders, one for each anim set in the file. Each subfolder will contain a series of subsubfolders, one for each animation, and those will each contain a series of .png files, one for each anim frame. Then later when you're importing, the file/folder name relation will be the same—import the folder C:\Games\Jazz2\bar-j2a\ to build C:\Games\Jazz2\bar.j2a.

The .png files store all the frame metadata in their filenames, using the format FRAMENUMBER,HOTSPOTX,HOTSPOTY,COLDSPOTX,COLDSPOTY, GUNSPOTX,GUNSPOTY.png. If the frame should be drawn as transparent by default, include the letter "t" right after FRAMENUMBER, e.g. 0t,-9,-11,0,0,0,0.png.

It hopefully sounds more complicated than it is. Look at one or more existing .j2a files and you should figure out how it works pretty quickly. What you shouldn't do is try to use this to rebuild anims.j2a, since this has absolutely no support for sounds, only sprites, and anims.j2a has hundreds of sounds in it that you would end up deleting. And if you can't figure how to run .py files, wait around and hope that someone will make an executable version.

Post any related questions here and I'll do my best to answer them, even if that answer is "google python", though consider also the general AngelScript help thread.

(thanks go to Stijn, whose code I modified, and Neobeo, whose research this was based on.)

FawFul Apr 7, 2015 01:04 PM

I have python, but i can't seem to get a prompt by just opening the file and selecting the python tool. This could use some more explanation i feel :0.

Violet CLM Apr 7, 2015 03:36 PM

You need to run the file, not just open it.

XxMoNsTeRXM Apr 8, 2015 07:02 AM

It doesn't work I run it with the specified arguments but still invalid syntax.
[img]http://i.imgur.com/SZpdWFq.png[/img]

Stijn Apr 8, 2015 07:16 AM

You probably installed Python 3. The scripts are only compatible with Python 2.x, so install that and try again.

XxMoNsTeRXM Apr 8, 2015 07:20 AM

Quote:

Originally Posted by Stijn (Post 486987)
You probably installed Python 3. The scripts are only compatible with Python 2.x, so install that and try again.

oh, ok... that explains everything...
EDIT: Another error: [img]http://i.imgur.com/OrIig71.png[/img]

FawFul Apr 8, 2015 11:33 AM

I have the same error as monster :(.

Violet CLM Apr 8, 2015 11:34 AM

Okay, that one's on me. I forgot misc.py in the zip. Sorry, try again now.

XxMoNsTeRXM Apr 8, 2015 11:59 AM

Quote:

Originally Posted by Violet CLM (Post 487000)
Okay, that one's on me. I forgot misc.py in the zip. Sorry, try again now.

Ok, what now? Another file that you forgot?
[img]http://i.imgur.com/wVOd0ty.png[/img]
I looked into the code, and the module is imported on j2a.py line 11

FawFul Apr 8, 2015 12:05 PM

"No module named image"

Violet CLM Apr 8, 2015 12:11 PM

Quote:

#needs python image library, http://www.pythonware.com/library/pil/
import Image
It's right there in the file.

FawFul Apr 8, 2015 01:36 PM

"please type the .j2a file you wish to extract"
Anims
file plus.j2a could not be read!

"please type the .j2a file you wish to extract"
plus
file plus.j2a could not be read!

"please type the .j2a file you wish to extract"
Anims.j2a
file plus.j2a could not be read!

"please type the .j2a file you wish to extract"
plus.j2a
file plus.j2a could not be read!

......

Also it was a pain finding the right PIL library, your link did not provide the right info. I think you meant:

http://www.pythonware.com/products/pil/

not,

http://www.pythonware.com/library/pil/

Even then it link for 2.7 was not working so i searched the internet. Apparently something named PILLOW took it place but i still manage to find the right library here: http://christianakesson.com/compiling-pil/ at the bottom of the article.

Still not working though...

Stijn Apr 8, 2015 01:39 PM

I'm not sure what happened for you, but the link in misc.py leads me to http://effbot.org/media/downloads/PI...in32-py2.7.exe after a few clicks. Is that what you installed?

Looking at j2a.py the error you're getting means the j2a file can't be read. Are you sure the path is right? Are you maybe entering "Anims" instead of "Anims.j2a"? The script needs the full filename, including extension.

FawFul Apr 8, 2015 01:57 PM

I can't open the link you just gave, it is the same link on the page i send. It gives a web-page error. 'Web page not available'.. or simply doesn't exist anymore. That's why i downloaded it elsewhere. I'm quite sure this what I have should also work.

Also no, i have D:\Games\Jazz2. so on the D: directory, not C:.
I entered D:\games\jazz2\j2a-extract.py in the command prompt.

Then received a message

"please type the .j2a file you wish to extract"

Anims

and then..

file Anims.j2a could not be read!

It is from C:\Users\Lennart> though, but imo asking 'which j2a I want to extract' shows it has the right .py file in the jazz2 folder.

Stijn Apr 8, 2015 02:01 PM

I think I opened the wrong file, and I edited my post accordingly. You need to enter the full file name, including the extension. So "Anims.j2a", not "Anims", unless you renamed your file to not include an extension. Make sure the file is in the same folder as the scripts too, I'm not certain it will work otherwise.

FawFul Apr 8, 2015 02:04 PM

jazz2 folder contains the pil library, the given .py extensions in the zip (also the misc). j2a files and i typed "Anims.j2a" and still it doesn't read. Folder is 1.23 if it's important.

XxMoNsTeRXM Apr 8, 2015 09:34 PM

Quote:

Originally Posted by FawFul (Post 487010)
jazz2 folder contains the pil library, the given .py extensions in the zip (also the misc). j2a files and i typed "Anims.j2a" and still it doesn't read. Folder is 1.23 if it's important.

Wait, you say the given .py extensions in the zip, you gotta extract them into the jazz2 folder.

EDIT: Wat?
[img]http://i.imgur.com/Ge3Iik2.png[/img]
And this is all it gave to me
[img]http://i.imgur.com/89UI1NT.png[/img]
This is the command I typed in Command Prompt: python j2a-extract.py "{path to jj2folder, not to .j2a file, I found that by myself}" after this it told me:
Please type the filename of the .j2a file you wish to extract:
So I type: plus.j2a
and then the error happens, and I only get two folders and only one file, fps.10

Violet CLM Apr 8, 2015 10:43 PM

Ah, yeah, it's been long enough since I used j2a-extract that I'd forgotten it wants a palette file. I've put that in the zip too.

You'll probably still have trouble with plus.j2a, but the other two .j2a files in your folder should work fine. FawFul noticed earlier that plus.j2a was accidentally assembled in a way that JJ2+ accepts but j2a-extract doesn't :(

XxMoNsTeRXM Apr 8, 2015 10:55 PM

Quote:

Originally Posted by Violet CLM (Post 487017)
Ah, yeah, it's been long enough since I used j2a-extract that I'd forgotten it wants a palette file. I've put that in the zip too.

You'll probably still have trouble with plus.j2a, but the other two .j2a files in your folder should work fine. FawFul noticed earlier that plus.j2a was accidentally assembled in a way that JJ2+ accepts but plus-extract doesn't :(

Now it works! Finally! Thanks!

EDIT: Now help me understand the images:
[img]http://i.imgur.com/GAfBbIH.png[/img]
The first zero is the frame, the next numbers I don't know what they are.

EDIT 2: nvm...

Violet CLM Apr 8, 2015 10:57 PM

Yay! That's both of you... now I've exhausted the market and don't need to worry about making a proper executable ever. /s

XxMoNsTeRXM Apr 9, 2015 12:06 AM

Quote:

Originally Posted by Violet CLM (Post 487019)
Yay! That's both of you... now I've exhausted the market and don't need to worry about making a proper executable ever. /s

Too many errors... ugh...
BTW... this is on j2a-import.py:
[img]http://i.imgur.com/nvFP9J1.png[/img]

Violet CLM Apr 9, 2015 09:25 AM

That'll happen if you have one or more improperly formatted image filenames.

FawFul Apr 9, 2015 09:55 AM

I used this script:

#pragma require "Mario.j2a"
#pragma name "Play as Mario!"

/************************************************/
/**********Play as Mario! by FawFuL**************/
/************************************************/

void onLevelLoad() {
jjAnimSets[ANIM::SPAZ].load(0, "mario.j2a");
jjAnimSets[ANIM::SPAZ2].load(1, "mario.j2a");
}

void onPlayer(jjPLAYER@ play) {
if (play.charCurr == CHAR::JAZZ || play.charCurr == CHAR::LORI) play.morphTo(CHAR::SPAZ);
}

And i ran into 2 problems:

1: Animation index
the animation indexes for 1.23 and 1.24 are different for set Anim::SPAZ. There are unused animations in 1.23 that clutter the animation order like spaz grabbing ledges, the j2a is based on 1.24. Apparently there are ways to fix this but it's really complicated. It also makes this preset stuff redundant if it doesn't takes differences in indexes into account.

2. Wrong animations on other online players
I overrided Anim::SPAZ and Anim::SPAZ2 and they look right for 1.24 users, however you get weird cluttered images on other players. (bird animations, bullets and a few of the custom animations, iirc). Vanilla jj2 draws your own sprites and others sprites right from Anim::SPAZ, why does my custom j2a make it show 2 different things on local and online players? Is this fixable?

I suggest that it's maybe useful to have a snippet that fixes these 2 problems, because i imagine more players would want to make their own custom j2a characters. afaik there were some already that ppl liked to import :(.. a snippet could be nice and reusable for this.

Violet CLM Apr 9, 2015 11:57 AM

This is what the RABBIT::Anim enum is for! Maybe once you get it working, you can be the one to write the snippet. :)

Additional hint.

Lark Apr 10, 2015 08:07 PM

eh I'm gonna play with this tomorrow when I have time to be awake late, but you're saying no support for extracting or viewing in game sfx (yet)?? :( bummer dude, I hope to see that soon ;)

Violet CLM Apr 10, 2015 09:05 PM

SFX over here

Seren Apr 11, 2015 01:08 AM

DJazz's site also lets you download an archive with all JJ2 sounds in wav format, although they're unnamed there.

FawFul Apr 11, 2015 07:04 AM

I made my anims script work by adding 3 additional sets for 1.23. I tried to do both 1.23 and TSF with a single set, but I didn't manage to make it work (sorry Violet!). It is probably possible with RABBIT::ANIM.

both 1.23 and TSF run the fully correct animation replacements now, however you still see other players wrong. The following explanation is what happens when seeing other online players:

For example RABBIT:: DIVE while it should be RABBIT::STAND, RABBIT::STAND while it should be RABBIT::IDLE2..... RABBIT:: DIVE while it should be RABBIT::JUMPING1. I found out that it does somewhat try to get the right frames, for example it stays stuck in the buttomp frame forever whenever a player buttstomps. It stays stuck in the airboard frame whenever someone had an airboard and whenever someone ducks it stays stuck in that frame aswell. It can even still load the latest 'normal' spaz sprite upon cycling. Is this a bug or can i do something about this in AS? all animations are loaded upon levelload so i don't understand why there is a 'refresh-rate' problem (eventhough some animations won't show at all even if you wait for a delay). when i duck, someone else will see the right animation index 3 seconds late and will only show a single frame instead of a complete animation. I'd like to add that the 'errors' are really consistent. Always the same frames where it gets stuck in and the same RABBIT::ANIM sets that will change with it. The only animation indexes that work somewhat well are RABBIT::AIRBOARD and RABBIT::CORPSE.

Maybe unimportant to say, but this was not the case if you shared custom j2a files back in the day.

DennisKainz Apr 26, 2015 02:20 PM

There's a problem. Whether I use Python 2 or Python 3, when I write "C:\", Python highlights the ":" in "C:\" as invalid syntax

Stijn Apr 26, 2015 02:23 PM

Try putting it between "quotes".

DennisKainz Apr 26, 2015 10:56 PM

[IMG]http://i.imgur.com/xYxRcu0.png[/IMG]

I don't want to give up! I really need that custom j2a file!

Stijn Apr 27, 2015 01:06 AM

...you're not supposed to run things inside the python interpreter.

Open the terminal, go to the right folder, then run "python j2a-extract.py plus.j2a". That's all.

DennisKainz Apr 27, 2015 01:45 AM

By terminal you mean cmd.exe in System 32, right?
Because there seems to be yet another problem ...

When I write the line "C:\Games\Jazz2>python j2a-extract.py" I get "Access Denied"

Stijn Apr 27, 2015 02:04 AM

https://technet.microsoft.com/en-us/...=ws.10%29.aspx

DennisKainz Apr 27, 2015 03:07 AM

[IMG]http://i.imgur.com/s0otDnF.png[/IMG]
EDIT: Solved.
If you get this message, it is because your PNGs aren't color-indexed.

P.S. Thanks for your help, admin! Now I can create my own j2a files!

XxMoNsTeRXM May 2, 2015 12:04 AM

Quote:

Originally Posted by DennisKainz (Post 487242)
[IMG]http://i.imgur.com/s0otDnF.png[/IMG]
If you get this message, it is because your PNGs aren't color-indexed.

What do you mean aren't colored-index? (I got this error too) :confused:

Violet CLM May 2, 2015 12:19 AM

You need to use 8-bit PNGs, not 24/32.

XxMoNsTeRXM May 2, 2015 03:13 AM

Quote:

Originally Posted by Violet CLM (Post 487319)
You need to use 8-bit PNGs, not 24/32.

Still doesn't work, I made them 23x31, same error.

cooba May 2, 2015 03:27 AM

Quote:

Originally Posted by XxMoNsTeRXM (Post 487323)
Still doesn't work, I made them 23x31, same error.

No offense but LOL.

8-bit means they need to be 256 colors and use the JJ2 palette.

XxMoNsTeRXM May 2, 2015 03:32 AM

Quote:

Originally Posted by cooba (Post 487324)
No offense but LOL.

8-bit means they need to be 256 colors and use the JJ2 palette.

AH ok. Thx
EDIT: Where can I get the jj2 palette?


All times are GMT -8. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
JCF © 2001-Infinity Jazz2Online