• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[vJASS] Detect auto cast orders of preplaced units with vJass

Not open for further replies.
Level 24
Feb 2, 2006
Scenario: I have preplaced units which get calls like:
call IssueImmediateOrder(u, "blackarrowon")
because they have Black Arrow abilities and I enabled auto cast for them.
However, this is done in the generated function main in CreateAllUnits before any module or struct initialization and hence before my trigger which detects issued orders is created/has its event etc.
Hence, I have tried to solve the detection these orders with a vJass hook.
Now I see that the hook is generated as prototype:
//Struct method generated initializers/callers:
function sa___prototype15_BlackArrowSystem__IssueImmediateOrderHook takes nothing returns boolean
    call BlackArrowSystem__IssueImmediateOrderHook(f__arg_unit1,f__arg_string1)
    return true

function jasshelper__initstructs320175859 takes nothing returns nothing
    set st___prototype15[1]=CreateTrigger()
    call TriggerAddAction(st___prototype15[1],function sa___prototype15_BlackArrowSystem__IssueImmediateOrderHook)
    call TriggerAddCondition(st___prototype15[1],Condition(function sa___prototype15_BlackArrowSystem__IssueImmediateOrderHook))

call ExecuteFunc("s__BlackArrowSystem__S_BlackArrowSystem__Init__onInit")


I do not understand why this is done since the functions could be ordered in a way in which it is not necessary.

This is done AFTER the creation of the preplaced units (too late):
function main takes nothing returns nothing
    call SetCameraBounds(- 3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), - 3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), - 3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), - 3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM))
    call SetDayNightModels("Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
    call NewSoundEnvironment("Default")
    call SetAmbientDaySound("LordaeronSummerDay")
    call SetAmbientNightSound("LordaeronSummerNight")
    call SetMapMusic("Music", true, 0)
    call CreateAllItems()
    call CreateAllUnits()
    call InitBlizzard()

call ExecuteFunc("jasshelper__initstructs320175859")

    call InitGlobals()
    call InitCustomTriggers()
    call RunInitializationTriggers()

so I miss the orders once again.
How can I detect issued orders of preplaced units? I want to avoid the need for adding them manually.
Maybe I can somehow register the trigger event earlier? I do not want to inject the main function since I would have to call all the functions in it by myself and this is a system other people should use. I have attached the whole map script.


  • war3map.j
    52.3 KB · Views: 6
Not open for further replies.