• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Quick JASS question

Status
Not open for further replies.
Level 4
Joined
Nov 18, 2007
Messages
79
Okay, I'm going to regret asking this question, I just know it.

Anyhow, I'm just beginning to learn JASS, I've read the tutorials, downloaded the editors, such and such. But the one thing that I cannot figure out how to do (after checking the forums, tutorials, chatroom) is how to make my JASS function work with my map.

Where do I put the .j files? Do I need to import them or something?
 
Level 11
Joined
Feb 18, 2004
Messages
394
WorldEditor allows you to edit War3map.j directly in the editor. It only lets you edit small sections (which it calls "triggers") of the script as a whole. Convert to custom text to edit a trigger in JASS.

JASS NewGen includes JASS Helper which has a //! include or something directive, which allows you to take the contents of any .j file and include them anywhere in the map. The latest NewGen also includes TESH, which has syntax highligting directly in the world editor.

common.j, common.ai, and blizzard.j are files that are automagically included in the execution of a map or AI script. common.j contains native functions, blizzard.j contains JASS-made functions (mostly used by the GUI) These functions can be found (in diffrent versions) in war3.mpq, war3x.mpq (i think...) and war3patch.mpq.
 
Level 4
Joined
Nov 18, 2007
Messages
79
Well, okay. I've written a simple .j file using JassCraft to show some special effects upon the casting of a spell. Except now what? I've tried just leaving it in the base folder with JassCraft, tried putting it in the folder with the map, and tried importing it.
 
Level 11
Joined
Feb 18, 2004
Messages
394
ok, lets try this again....

.j is the JASS script file extension
.ai is the JASS AI Script extension

when Warcraft 3 starts a map, it loads 3 script files:
common.j then blizzard.j then war3map.j

common.j and blizzard.j are contained within the game itself. You could use imported versions, but thats rather useless.

war3map.j is contained within a map archive. (Maps are just slightly special MPQ archives)

When you edit a "trigger" in the WorldEditor, you are simply editing a small portion of war3map.j. A large sum of the war3map.j script is automagically generated by the world editor.

When using external script files, you need a 3rd party tool that will combine the .j files with war3map.j, as there is no way to make warcraft 3 execute a .j file on the fly. (Meaning that things like the script file inclusion mechanism in JASS Helper work by taking the contents of a file and inlining it where the include directive is found)

JASS Craft and JASS Shop Pro are rather outdated tools as we now have Trigger Editor Syntax Highlighting. (Included in the latest NewGen release, link in my sig if wc3c is up today) The main way these tools where used was Copy and Pasting code from them in to the World Editor. (both JSP and JC use outdated versions of PJASS (Syntax Checker) and are unaware of syntactical additions, such as vJASS)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
.j files like (same as) texts they only contain text
You dont need anyprograms etc for that
But dont forget to download and use Jass NewGen Pack
its a cool tool for everything

Creating Function:
to create a new function well
[jass="Example"]function madmandied takes unit aloha, string effectpath returns nothing
call DestroyEffect(AddSpecialEffect(effectpath,GetUnitX(aloha),GetUnitY(aloha)))
call KillUnit(aloha)
endfunction[/code]



Using it:
For Example if you put the function to your map header (<map name>.mdx in trigger editor) you can call it later with call madmandied(<an unit>,<a special effect path>)
it creates the effect you pathed and kills unit
You can create your own functions like that

OR

If you are only gonna use that in one trigger
you can put the function to top of code and other things to bellow
 
Status
Not open for further replies.
Top