• 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.

Call Indexed arrays inside custom Scripts

Level 2
Joined
Aug 17, 2024
Messages
5
Hello everyone, I've been browsing and standing on the shoulders of giants for years, pretty much managing to caveman my way out of every problem, but now I'm trying to call a custom scrip to order computer units to cast a triggered jump (852600) based on channel, which seemed to work just fine with a 5 units test run, but the maps needs to handle +25 of these units. Now, after 4 or 5 of the 25 complete the jump, the rest just stand there with the icon of the ability active as if its being pressed, remaining completely freezing and unnreactive. I figured "maybe I need to index into arrays" (so that many instances can run at the same time), but the thing is, I cant find the way to syntax arrays inside the TargetOrderById function. It worked with simple numbered arrays like Example[1] but not with variables like Example[ExampleIndex]. Am I mixing pears with apples by trying ti handle things these way? Do I need to handle the incremental index on Jass on the map Custom Script Code? Any and all help would be greatly appreciated!

1727104652899.png
PD: Some Additional Context: The Follow Through Time is only (0.1) seconds / Unique cast is NOT selected / the spell is currently Point targeted, but (and correct me if I'm wrong) I think it could be Point / Unit targeted all the same.

1 compile error
call IssueTargetOrderById (udg_TRexOrder[JumpAttackIndex2]], 852600 , udg_EggtoBreak)
Symbol not declared (JumpAttackIndexTwo)
 
Last edited:
Level 2
Joined
Aug 17, 2024
Messages
5
K thanx for the formatting advice.
I've added udg_ to the array index variables, and changed the custom script to one more fitting (jump and bash system which I used for this spell uses points targets and no unit target, so I figured call IssuePointOrderByIdLoc would be more cohesive) ( and now its "working" (as in the game is launching and the map executing once again, units are jumping once again but they still get frozen and unresponsive)

For the record:
  • Eggs_toBreak was never returning empty.
  • Game - Display to (All players) the text: (Name of EggtoBreakarray[JumpAttackIndextwo]) back in the last version, when I was targeting units, this seemed to be triggering once for every attacking unit.
  • Only the first 4 or 5 units that enter combat were following the command, (the spell goes on cd for them, but it doesn't go on CD for the ones that get frozen).

  • JumperOrder
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Unit-type of (Attacking unit)) Equal to
  • Minor Therizinosaurus) or ((Unit-type of (Attacking unit)) Equal to Baryonix)
    • (Owner of (Attacking unit)) Equal to Player 11 (Dark Green)
    • Actions
      • Trigger - Turn off (This trigger)
      • Set JumpAttackIndextwo = (JumpAttackIndextwo + 1)
      • Set TRexOrder[JumpAttackIndextwo] = (Attacking unit)
      • Unit Group - Pick every unit in (Units within 700.00 of (Position of TRexOrder[JumpAttackIndextwo]) matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of Player 11 (Dark Green)) Equal to True)) and (((Unit-type of (Matching unit)) Equal to Surviv and do (Unit Group - Add (Picked unit) to Eggs_toBreak)
      • Set EggtoBreakarray[JumpAttackIndextwo] = (Random unit from Eggs_toBreak)
      • Set PosEggToBreak[JumpAttackIndextwo] = (Position of EggtoBreakarray[JumpAttackIndextwo])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Eggs_toBreak is empty) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Eggs To Break = Emp...
        • Else - Actions
          • Game - Display to (All players) the text: (Name of EggtoBreakarray[JumpAttackIndextwo])
          • Custom script: call IssuePointOrderByIdLoc (udg_TRexOrder[udg_JumpAttackIndextwo], 852600 , udg_PosEggToBreak[udg_JumpAttackIndextwo])
          • Unit Group - Remove EggtoBreakarray[JumpAttackIndextwo] from Eggs_toBreak
      • Set TRexOrder[JumpAttackIndextwo] = No unit
      • Custom script: call RemoveLocation (udg_PosEggToBreak[udg_JumpAttackIndextwo])
      • Set JumpAttackIndextwo = (JumpAttackIndextwo - 1)
      • Trigger - Turn on (This trigger)
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
First, make sure the Channel ability is setup properly. You should almost never enable "Disable Other Abilities" since it Pauses the caster.

Then restructure the trigger like so:
  • JumperOrder
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Unit-type of (Attacking unit)) Equal to Minor Therizinosaurus) or ((Unit-type of (Attacking unit)) Equal to Baryonix)
      • (Owner of (Attacking unit)) Equal to Player 11 (Dark Green)
      • ((Attacking unit) is in JumpCooldownGroup) Equal to False
    • Actions
      • Set JumpSource = (Attacking unit)
      • Set JumpTarget = No unit
      • Set JumpPoint = (Position of JumpSource)
      • Set JumpGroup = (Units within 700.00 of JumpPoint matching ((Matching unit) is alive) Equal to True) and ((Matching unit) belongs to an enemy of Player 11 (Dark Green)) Equal to True) and (Unit-type of (Matching unit) Equal to Surviv)
      • Set JumpTarget = (Random unit from JumpGroup)
      • Custom script: call RemoveLocation( udg_JumpPoint )
      • Custom script: call DestroyGroup( udg_JumpGroup )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (JumpTarget) Not equal to No unit
        • Then - Actions
          • Set JumpPoint = (Position of JumpTarget)
          • Custom script: call IssuePointOrderByIdLoc( udg_JumpSource, 852600 , udg_JumpPoint )
          • Trigger - Run JumperCooldown (ignoring conditions)
        • Else - Actions
  • JumperCooldown
    • Events
    • Conditions
    • Actions
      • Custom script: local unit u = udg_JumpSource
      • Unit Group - Add JumpSource to JumpCooldownGroup
      • Wait 5.00 game-time seconds
      • Custom script: set udg_JumpSource = u
      • Custom script: set u = null
      • Unit Group - Remove JumpSource from JumpCooldownGroup
^ This prevents the unit from running the JumperOrder trigger for 5.00 seconds. Change the duration of the Wait to modify what's essentially the cooldown of this effect.
 
Last edited:
Top