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

MUI Spell Problemo

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2007
Messages
189
until now ive never needed to use mui so i read a tutorial about it and it works...almost. I based it off of wyrmlords http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/multi-instancible-gui-spell-making-34393/.

as you can see i changed some things to fit my needs (its basically a very simple bullet/shooting system). But it doesnt work. its flawless at first but something happens and all the bullets stop moving. Could anyone take a look please? i think 99% of it is bc i dont fully understand the stystem haha

  • Archers
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Stalker
    • Actions
      • Trigger - Run Archer Index <gen> (ignoring conditions)
      • Set TempPoint[1] = (Position of (Attacking unit))
      • Set TempPoint[2] = (Position of (Attacked unit))
      • Unit - Create 1 Arrow for (Owner of (Attacking unit)) at TempPoint[1] facing TempPoint[2]
      • Set ArcherUnit[ArcherCurrentIndex] = (Last created unit)
      • Set ArcherDistance[ArcherCurrentIndex] = 16.00
      • Set ArcherTime[ArcherCurrentIndex] = 500
      • Custom script: call RemoveLocation (udg_TempPoint[1])
      • Custom script: call RemoveLocation (udg_TempPoint[2])
  • Archer Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 50, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ArcherUnit[(Integer A)] Not equal to No unit
            • Then - Actions
              • Set ArcherTime[(Integer A)] = (ArcherTime[(Integer A)] - 16)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ArcherTime[(Integer A)] Greater than 0
                • Then - Actions
                  • Set TempPoint[2] = (Position of ArcherUnit[(Integer A)])
                  • Set TempPoint[1] = (TempPoint[2] offset by 16.00 towards (Facing of ArcherUnit[(Integer A)]) degrees)
                  • Unit - Move ArcherUnit[(Integer A)] instantly to ((Position of ArcherUnit[(Integer A)]) offset by 16.00 towards (Facing of ArcherUnit[(Integer A)]) degrees)
                • Else - Actions
                  • Set ArcherCurrentIndex = (Integer A)
                  • Unit - Kill ArcherUnit[(Integer A)]
                  • Trigger - Run Archer Index Return <gen> (ignoring conditions)
            • Else - Actions
  • Archer Index
    • Events
    • Conditions
    • Actions
      • Set ArcherIndex = (ArcherIndex + 1)
      • Set ArcherCurrentIndex = ArcherID[ArcherIndex]

  • Archer Index Return
    • Events
    • Conditions
    • Actions
      • Set ArcherID[ArcherIndex] = ArcherCurrentIndex
      • Set ArcherIndex = (ArcherIndex - 1)
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Funny, wyrmlord is a really old friend of mine (I taught him JASS years ago now).

Its also funny how you're doing a bullet, which was one of my first multi-instance-able JASS scripts.

You also read an out-of-date tutorial on multi-instance-ability because GUI users now have access to hashtables, which basically allows you to reference "saved" values from handles. In this case, you would save your data to the timer and then reference it using the "expiring timer" in the periodic trigger.

I was going to try and post some triggers to show you how it works, but it seems like my hashtable GUI functions are broken or something. I usually code in vJass so this isn't a typical problem, but I'm having troubles obtaining the "key of a handle" for non-handle types. It won't allow me to use any other type of variable and a variable is the only option. When I try to set the value of the handle-variable before-hand it won't let me select any values other than another variable, which is of no use.
 
Level 11
Joined
Apr 29, 2007
Messages
826
I was going to try and post some triggers to show you how it works, but it seems like my hashtable GUI functions are broken or something. I usually code in vJass so this isn't a typical problem, but I'm having troubles obtaining the "key of a handle" for non-handle types. It won't allow me to use any other type of variable and a variable is the only option. When I try to set the value of the handle-variable before-hand it won't let me select any values other than another variable, which is of no use.

That's because of JNGP, it's outdated.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
This is how it would go with hashtables. Didn't test it though.

  • Untitled Trigger 001
    • Events
      • Unit - Units is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Stalker
    • Actions
      • Set Temp_Unit_1 = (Attacking unit)
      • Set Temp_Unit_2 = (Attacked Unit)
      • Set Temp_Loc_1 = (Position of Temp_Unit_1)
      • Set Temp_Loc_1 = (Position of Temp_Unit_2)
      • Create Unit...
      • Hashtable - Save (Angle from Temp_Loc_1 to Temp_Loc_2 as (Key angle) of (Key (Last Created unit)) in Some_Hash
      • Hashtable - Save 500 as (Key distance) of (Key (Last Created unit)) in Some_Hash
      • Hashtable - Save 16 as (Key speed) of (Key (Last Created unit)) in Some_Hash
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
      • Custom script: call RemoveLocation(udg_Temp_Loc_2)
      • Unit Group - Add (Last Created Unit to Some_Group
      • Trigger - Turn on Untitled Trigger 003 <gen>
  • Untitled Trigger 003
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Some_Group and do (Actions)
        • Loop - Actions
          • Set Temp_Unit_1 = (Picked unit)
          • Set Temp_Real_1 = (Load (Key distance) of (Key (Picked unit)) from Some_Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Real_1 Greater than 0.00
              • (Temp_Unit_1 is alive) Equal to True
            • Then - Actions
              • Set Temp_Loc_1 = (Position of Temp_Unit_1)
              • Set Temp_Loc_2 = (Temp_Loc_1 offset by (Load (Key speed) of (Key (Picked unit)) from Some_Hash) towards (Load (Key angle) of (Key (Picked unit)) from Some_Hash) degrees)
              • Unit - Move Temp_Unit_1 instantly to Temp_Loc_2
              • Hashtable - Save (Temp_Real_1 - (Load (Key speed) of (Key (Picked unit)) from Some_Hash)) as (Key distance) of (Key (Picked unit)) in Some_Hash
              • Custom script: call RemoveLocation(udg_Temp_Loc_1)
              • Custom script: call RemoveLocation(udg_Temp_Loc_2)
            • Else - Actions
              • Unit Group - Remove Temp_Unit_1 from Some_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Some_Hash
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Some_Group is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 6
Joined
Jan 2, 2007
Messages
189
ohh ok well that makes sense thank you! + rep for all yay :) but i have another problem now...i cant find hashtables. i thought they come with one of the new patches but i dont have hashtables in my editor ): i know this is off topic now but could anyone explain that please?
 
Level 6
Joined
Jan 2, 2007
Messages
189
yeah the normal editor and the newest i guess current patch. idk if my frozen throne installed correctly so thats probaly it but its tft editor and everything.

Edit: hmm it looks like its bc tft didnt install correctly bc i cant open any war3x files including the .mpq which is the editor. and it says i only have patch 1.21 so it looks like im gonna find my cd and reinstall. hopefully thatll work. thanks for your help!
 
Status
Not open for further replies.
Top