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

[Trigger] Making a unit with 0 speed base move

Status
Not open for further replies.
Level 2
Joined
Aug 17, 2005
Messages
22
For a map I'm working on, there is a world map in which groups of units are represented by single units, and instead of using warcraft's built in movement system, I have decided to make my own grid based one. However, all the units have 0 movement speed on the world map, so they wont get the buttons that come with movement (move, hold position, patrol, stop). However, when they use a dummy ability to move (move north, for example) setting their movement speed through triggers does not work. I can fake movement by moving them a little bit at a time with a loop and playing the walk abimation, but it looks horribly ugly and unprofessional.

I either need a way to make a convincing spoofed movement system, (I think I've seen it done in JASS, but I don't know enough to know if it was what Iwas seeing or not) or a way to give them "regular" movement. If it were only a few unit types, I would simply make "movement" versions of them and replace them when I needed to, but it isn't worth doing with so many types. If I make a spoofed movement system, it would need to be multi-instanceable, but only on seperate units.

Thanks in advance for all your help.
 
Level 2
Joined
Aug 17, 2005
Messages
22
Well, I think I'm going to spoof it, but I need to find a way to make it not look horribly jumpy. I need to move a unit 128.00 warcraft distance units (the space between the centers of two adjacent squares) and I want it to not look too jumpy, or be too slow. Right now, I'm using a loop (eg 1 to 10) and moving the unit a small distance (eg 12.8) then having a wait of 0.00 so the players can see the movement, is there a better way to do this that is smoother?


If I give ward classification, I wouldn't be able to use the dummy ability in the first place.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Erm, GUI or JASS?

The common way (GUI) is

  • ThisIsATrigger
    • Events
      • blahblah
    • Conditions
      • blahblah
    • Actions
      • blahblah
      • Trigger - Turn on ThisIsADisabledTrigger
  • ThisIsADisabledTrigger
    • Events
      • Every .01 seconds of Game Time
    • Conditions
    • Actions
      • Do stuff
That's the GUI way (not MUI!) If you want the JASS way, go to the tutorials section of www.wc3jass.com and look at Using Timers and the Handle Vars.
 
Level 2
Joined
Aug 17, 2005
Messages
22
I think you misunderstand what I want to do. Thie must be multi-instanceable, though, it can't be used twice on the same unit at one time.

Here is what I have, the chief problem coming from it being ugly to watch, and I have to choose from smooth slowness, or ugly speed. This isn't complete, since I have left out pausing so I can test it more.

  • Move North
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Move North waterelemental
    • Actions
      • Set TEMP_POINT = (Position of (Casting unit))
      • Set TEMP_POINT = (TEMP_POINT offset by (0.00, 128.00))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Region centered at TEMP_POINT with size (10.00, 10.00)) contains No unit) Equal to False
        • Then - Actions
          • Unit - Make (Casting unit) face TEMP_POINT over 0.00 seconds
          • Animation - Play (Casting unit)'s walk animation
          • For each (Integer A) from 1 to 8, do (Actions)
            • Loop - Actions
              • Set TEMP_POINT = (Position of (Casting unit))
              • Set TEMP_POINT = (TEMP_POINT offset by (0.00, (128.00 / 8.00)))
              • Unit - Move (Casting unit) instantly to TEMP_POINT
              • Wait 0.00 seconds
        • Else - Actions
          • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + 1.00)
          • Set TEMP_POINT = (Position of (Casting unit))
          • Floating Text - Create floating text that reads Cannot move there. at TEMP_POINT with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Also, I'm not sure "Contains no unit" works the way I thought it does. Some confrimation about how it works would help. Is "no unit" meaning a lack of a unit, or just a placeholder for something else?
 
Level 2
Joined
Aug 17, 2005
Messages
22
I don't know how this would be done "using timers" as you say, would you care to elaborate? The example you showed earlier doesn't help at all, since this must be able to effect multiple units at once.
 
Level 2
Joined
Aug 17, 2005
Messages
22
I know what I need to do, I know how programming works, but I don't know JASS, save for the little leak-fixes. While I am trying to learn it, I don't know how to make a function to move the unit right now. It would help a lot if someone could write a function that moves a unit smoothly up, down, right, or left, since I think I know enough to change it as needed. The function would have a unit as an input.

EDIT- Nevermind, I solved it, I was avoiding using unit groups, but I changed my mind and made a trigger that moves each unit in four unit groups in their direction every 0.01 seconds.
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
EDIT- Nevermind, I solved it, I was avoiding using unit groups, but I changed my mind and made a trigger that moves each unit in four unit groups in their direction every 0.01 seconds.
Actually, you could just make it one unit group, and when a unit casts the ability add it to the group, and when it reaches its destination remove it from the group.

And see? You used timers -.- (well, a time event, but there's not much of a difference really)
 
Level 2
Joined
Aug 17, 2005
Messages
22
That's exactly what I did, and no, I couldn't have just used one group, since they go in four different directions. Here's how I did it.

  • Movement
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in MOVE_GROUP_NORTH and do (Actions)
        • Loop - Actions
          • Set TEMP_POINT = (Position of (Picked unit))
          • Unit - Move (Picked unit) instantly to (TEMP_POINT offset by (0.00, 4.00))
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Equal to 32
            • Then - Actions
              • Unit Group - Remove (Picked unit) from MOVE_GROUP_NORTH
              • Animation - Play (Picked unit)'s stand animation
              • Unit - Unpause (Picked unit)
            • Else - Actions
      • Unit Group - Pick every unit in MOVE_GROUP_EAST and do (Actions)
        • Loop - Actions
          • Set TEMP_POINT = (Position of (Picked unit))
          • Unit - Move (Picked unit) instantly to (TEMP_POINT offset by (4.00, 0.00))
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Equal to 32
            • Then - Actions
              • Unit Group - Remove (Picked unit) from MOVE_GROUP_EAST
              • Animation - Play (Picked unit)'s stand animation
              • Unit - Unpause (Picked unit)
            • Else - Actions
      • Unit Group - Pick every unit in MOVE_GROUP_SOUTH and do (Actions)
        • Loop - Actions
          • Set TEMP_POINT = (Position of (Picked unit))
          • Unit - Move (Picked unit) instantly to (TEMP_POINT offset by (0.00, -4.00))
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Equal to 32
            • Then - Actions
              • Unit Group - Remove (Picked unit) from MOVE_GROUP_SOUTH
              • Animation - Play (Picked unit)'s stand animation
              • Unit - Unpause (Picked unit)
            • Else - Actions
      • Unit Group - Pick every unit in MOVE_GROUP_WEST and do (Actions)
        • Loop - Actions
          • Set TEMP_POINT = (Position of (Picked unit))
          • Unit - Move (Picked unit) instantly to (TEMP_POINT offset by (-4.00, 0.00))
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Picked unit)) Equal to 32
            • Then - Actions
              • Unit Group - Remove (Picked unit) from MOVE_GROUP_WEST
              • Animation - Play (Picked unit)'s stand animation
              • Unit - Unpause (Picked unit)
            • Else - Actions
 
Status
Not open for further replies.
Top