Shoot, I think I may have run into something I can't do in GUI

Nureru

New Member
Reaction score
1
I have some abilities put into an array, and after I randomly picked a number I want the unit to cast the ability from the array at that number. I.E. if SpellArray[0] was Acid Bomb, and I picked 0, I want to order the unit to cast Acid Bomb, but if SpellArray[1] was Thunder Clap, and I picked 1, I want to order the unit to cast Thunder Clap.

Is there any way for me to do this? WC3 has an idiotic method of ordering units to cast spells.
 

Nureru

New Member
Reaction score
1
The unit is going to have whatever spell I pick. The spell array itself is dependent on what unit it is, so if the unit only has one spell the array will be 1 spell large and that will be picked every time.
 

kaboo

New Member
Reaction score
45
i dont think this is even possible, maybe if only one hero had the skill to cast random spell
 

Nureru

New Member
Reaction score
1
Kind of what I was afraid of. I guess I'm going to have to do it the long way.
 

perkeyone

something clever
Reaction score
71
it is possible
but not using the array
and not an a way that is convenient

you would have to code the entire process
 

Jak-Skell

New Member
Reaction score
0
So if I understand, you want to click a spell, and it casts a random spell from a list?
 

ZugZugZealot

New Member
Reaction score
33
The "which order" for issue order doesn't take variables in GUI. So it would require a long list of if then else, or doing it in Jass where it takes "whichOrder" as a string for a parameter which would allow an array.
 

Nureru

New Member
Reaction score
1
The "which order" for issue order doesn't take variables in GUI. So it would require a long list of if then else, or doing it in Jass where it takes "whichOrder" as a string for a parameter which would allow an array.

that's kind of what I figured. I can't work jass out though, so I guess I'm doing it the long way.

:(
 

ZugZugZealot

New Member
Reaction score
33
Uses a small amount of Jass, which is limited to the issue order action and location leak removal as GUI custom script.

Explaining the cast types...
0 = Issue order no point
1 = Issue point order
2 = Issue target order

Trigger:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Create 1 Water Elemental (Level 1) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set tempUnit = (Last created unit)
      • Unit - Add War Stomp (Neutral Hostile 1) to tempUnit
      • Set castType[0] = 0
      • Set abilityOrder[0] = stomp
      • Unit - Add Web to tempUnit
      • Set castType[1] = 2
      • Set abilityOrder[1] = web
      • Unit - Add Shockwave (Neutral Hostile) to tempUnit
      • Set castType[2] = 1
      • Set abilityOrder[2] = shockwave
      • -------- ... --------


Trigger:
  • Trigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set tempAttacker = (Attacking unit)
      • Set tempRandom = (Random integer number between 0 and 5)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • castType[tempRandom] Equal to 0
        • Then - Actions
          • Custom script: call IssueImmediateOrder( udg_tempAttacker, udg_abilityOrder[udg_tempRandom] )
        • Else - Actions
      • -------- End If --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • castType[tempRandom] Equal to 1
        • Then - Actions
          • Set tempPoints[0] = (Position of tempAttacker)
          • Set tempPoints[1] = (tempPoints[0] offset by 50.00 towards (Facing of tempAttacker) degrees)
          • Custom script: call IssuePointOrderLoc( udg_tempAttacker, udg_abilityOrder[udg_tempRandom], udg_tempPoints[1] )
          • Custom script: call RemoveLocation( udg_tempPoints[0] )
          • Custom script: call RemoveLocation( udg_tempPoints[1] )
        • Else - Actions
      • -------- End If --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • castType[tempRandom] Equal to 2
        • Then - Actions
          • Custom script: call IssueTargetOrder( udg_tempAttacker, udg_abilityOrder[udg_tempRandom], GetTriggerUnit() )
        • Else - Actions
      • -------- End If --------
 

Nureru

New Member
Reaction score
1
Here's the trigger I tried using
Custom script: call IssueTargetOrderById( udg_unit_list[1], udg_SpellArray[udg_temp_count], udg_temp_unit )

When I used IssueTargetOrder it complained about it being an integer, but it liked that all right. However, the unit just kind of stands there.

Here's the full trigger if it helps
Trigger:
  • Cast Spell on Enemy
    • Events
    • Conditions
    • Actions
      • Set temp_point = (Position of unit_list[1])
      • Set temp_real = 2000.00
      • Set temp_group = (Units within temp_real of temp_point matching ((((Matching unit) belongs to an enemy of (Owner of unit_list[1])) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in temp_group and do (Actions)
        • Loop - Actions
          • Set temp_point_2 = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between temp_point and temp_point_2) Less than temp_real
            • Then - Actions
              • Set temp_unit = (Picked unit)
              • Set temp_real = (Distance between temp_point and temp_point_2)
            • Else - Actions
      • Custom script: call RemoveLocation( udg_temp_point )
      • Custom script: call RemoveLocation( udg_temp_point_2 )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in temp_group) Greater than 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • debug Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: Executing AI routin...
              • Game - Display to (All players) the text: (Approaching target: + (Proper name of temp_unit))
            • Else - Actions
          • Set temp_count = (Load SpellSelected of (Key ActiveUnit) from Enemyspells)
          • Custom script: call IssueTargetOrderById( udg_unit_list[1], udg_SpellArray[udg_temp_count], udg_temp_unit )
        • Else - Actions
          • Trigger - Run End Turn <gen> (ignoring conditions)
      • Custom script: call DestroyGroup( udg_temp_group )


I really want to get this working so I can go back to doing less frustrating things :(
 

ZugZugZealot

New Member
Reaction score
33
[ljass]IssueTargetOrder()[/ljass] Takes a string as an order... For the strings you use, you need to goto the spell in object editor, and use the value from Text - Order String - Use/Turn On

Ability codes != Order codes...

If you want to use ById function then you'd need to know what the integer value of each spell's order is...
Trigger:
  • AnyOrder
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg( OrderId2String(GetIssuedOrderId()) + " is " + I2S(GetIssuedOrderId()) )


Anyways, I couldn't find the GUI function to display orders as integers, so I wrote it in custom script. You can use this to see what the integer value of each unit order is. Though I suggest you just use the string method instead, which you can find where the string values as said above.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top