• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Campaign coding question

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2007
Messages
1,433
If I am developing a campaign, is their any way to have coding synchronized between each individual map? I mean, similar to the way you can have edit units that are in each map from the campaign editor. For example, if I want to use a camera system, but I don't want to have to edit each map individually if I need to make changes to the system.
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Append Blizzard.j with your functions, systems (and other stuff) and import it campaign editor with name "Scripts\Blizzard.j"

Whenever you changed the code of some system, this would affect every map, that uses functions of that system.
I would like to learn more about this one.

So example, I have a test map in a campaign. I have made all triggers to a folder which will I always copy to all other maps of the campaign. Could this thing somehow put all triggers from this folder to all chapters? It would save a lot of time because every time I will do a new version of the campaign, I need to add all triggers from this folder to all 11 chapters. That usually takes about 2 hour...
 
Level 14
Joined
Nov 23, 2008
Messages
187
You need to copy all triggers' code to Blizzard.j and, of course, declare used global variables in proper place (globals...endglobals). If your system has some function, that should be executed when map loads, put call in initialization trigger, like this:

  • Events:
    • Map Initialization
  • Conditions:
  • Actions:
    • Custom script: call my_system_init()
Well, I think, the example is worth hundreds of words.

Also, if your code is BJ-free (contains no BJ functions), you can easily remove existing BJ's from your Blizzard.j to reduce file size.
 

Attachments

  • testcamp.w3n
    118.9 KB · Views: 31
Status
Not open for further replies.
Top