• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Refer to variable in Custom Script

Status
Not open for further replies.
Level 10
Joined
Aug 25, 2004
Messages
473
Here is the problem
If i want to Issue order to a unit, you have to fill in Ability Command.
The problem is that i have 20 ability commands and i dont want to make 20+ functions to fill those in.
So i have created a variable AbilityComman[Array] of type Ability Command
Now, Blizzard was kind enough to NOT include the recognition to the variable "ability command". When i click the field "select ability command", the variable selection is empty!!!
Does anyone know how to write a custom script that refers to the variable "ability_command[tempInteger]"
Here is my trigger
  • Events
    • Dialog - Any Dialog Item is Clicked by Player Any Player
  • Local Variables
    • temp Integer = 0 <Integer>
  • Conditions
  • Actions
    • General - For each integer temp Integer from 1 to UI - Number of abilities with increment 1, do (Actions)
      • Actions
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • (Used dialog item) == UI - Abilities Button[temp Integer]
          • Then
            • Unit - Order UI - Last Selected Unit[(Triggering player)] to (Ability Command) <------------------ *******HERE IS THE PROBLEM, CANT SELECT ANY VARIABLES***********
          • Else
My variable for the ability commands

UI - Abilities Command = No Ability Command <Ability Command[20]>
(i did try to change it to every possible value, array, type etc )
 
Level 4
Joined
Aug 30, 2009
Messages
70
The problem is with ability command variables, that they can have different target types (point, unit, etc.) and you need the right one to select this variable for your order.
It will not work if you selected (All) in target type (see attachment).

For custom script, you would have to put "lv_" or "gv_" before the variable name, while gv stands for global variable and lv for local variable.
So, in custom script you would call your variable with "gv_ability_command[lv_tempInteger]", but not sure if this solves the target type problem.
 

Attachments

  • Abilities.jpg
    Abilities.jpg
    24.3 KB · Views: 78
Level 11
Joined
Aug 1, 2009
Messages
963
It wouldn't.

Some abilities require a target point, while some require a target unit and others require no target. Additionally, some abilities cannot be used on certain units and the like.

I would say just group together abilities with similar arguments, :\
 
Status
Not open for further replies.
Top