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

Unit coordinates change but unit model doesn't move

Status
Not open for further replies.
Level 9
Joined
Apr 19, 2011
Messages
447
Hi.

I've recently started working again on my proyects, and I was doing fine until I found a problem I can't understand. I was using this trigger to move a unit:

  • Move
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: call SetUnitY(udg_TempUnit, GetUnitY(udg_TempUnit) - udg_REAL)
TempUnit: Unit variable. It's the unit I'm trying to move.
REAL: Obviously, a real variable.

Basicly, the unit should slowly move down in the map. Alright, I tested it, and the unit didn't move at all. I used the following trigger to periodically check the REAL variable and the unit's coordinates:

  • Check
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (REAL: + (String(REAL)))
      • Game - Display to (All players) the text: (X: + (String((X of (Position of TempUnit)))))
      • Game - Display to (All players) the text: (Y: + (String((Y of (Position of TempUnit)))))
To my surprise, I found that the unit's coordinates were correctly changing as they should be. But the unit's model didn't move! REAL had a value of about 6, so the movement should be noticeable.
The game says that the unit is moving, but my eyes say it's not. I don't really not what's going on. Anyone knows what can I do with this?

Kind Regards
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Is temp unit correctly set? Try adding to your check trigger also the unit name of tempunit to see - maybe some other trigger nulls temp unit.

Another thing you can try is calculate the y first hand and then move unit there.
Also, where do you set "Real" and value do you give it? In your check trigger I see that you check what value "real" has, but you don't check the "y" you're trying to calculate... you only check the y coordinate of your unit
 
Btw, you can not use the "SetUnitMoveSpeed" native to change a units move speed if the object editor data has "0" for movespeed.
What you can do, is setting the move speed in object editor to 1 and then set the movespeed via trigger back to 0.
if you then adjust the move speed again, you can even set it so something else than 0.
Seems that object editor overrides some internal data here.
 
Status
Not open for further replies.
Top