Moving Unit Issues

Regga-Voska

New Member
Reaction score
0
I have created a trigger that looks like this.....
Trigger:
  • This is the stupid trigger that doesn't work as it should do.
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set Facing[1] = (Facing of ***** <gen>)
      • Custom script: set udg_X[1] = GetUnitX(udg_PlayerUnit[1]) + udg_Move[1] * Cos(udg_Facing[1] * bj_DEGTORAD)
      • Custom script: set udg_Y[1] = GetUnitY(udg_PlayerUnit[1]) + udg_Move[1] * Sin(udg_Facing[1] * bj_DEGTORAD)
      • Custom script: call SetUnitX(udg_PlayerUnit[1] , udg_X[1])
      • Custom script: call SetUnitY(udg_PlayerUnit[1] , udg_Y[1])
      • Unit - Make PlayerUnit[1] face (Facing[1] + Rotation[1]) over 0.00 seconds

And it suppose to move the unit(s), as you can see..... BUT THE UNIT STAYS AND THE SHADOW OF THE UNIT MOVES AS THE UNIT SHOULD!!!!!!!!!!:banghead:
And I hope you can give me a great answer:thup:
 

HydraRancher

Truth begins in lies
Reaction score
197
erm.. it might be in the custom script but where does it make the unit move? also its asked to rotate 4 times every 0.05 seconds so...
in one second it is ordered 80 times!
 

Regga-Voska

New Member
Reaction score
0
Trigger:
  • # Custom script: call SetUnitX(udg_PlayerUnit[GetForLoopIndexA()] , udg_X[GetForLoopIndexA()])
    • # Custom script: call SetUnitY(udg_PlayerUnit[GetForLoopIndexA()] , udg_Y[GetForLoopIndexA()])


There is the move unit function/action.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, we don't really know how those variables are set, or to what they're set.
Might wanna upload the triggers where those variables are set, too :D
 

Regga-Voska

New Member
Reaction score
0
Well, I will try to describe the functions.

The following action is for setting the cordinate called X in front of the unit[PlayerUnit] toward Move(Move is a real variable) with the Facing units facing degrees.

Trigger:
  • Custom script: set udg_X[1] = GetUnitX(udg_PlayerUnit[1]) + udg_Move[1] * Cos(udg_Facing[1] * bj_DEGTORAD)


The following action is for setting the cordinate called X in front of the unit[PlayerUnit] toward Move(Move is a real variable) with the Facing units facing degrees.

Trigger:
  • Custom script: set udg_Y[1] = GetUnitY(udg_PlayerUnit[1]) + udg_Move[1] * Sin(udg_Facing[1] * bj_DEGTORAD)


The following triggers are created for moving the units to the seted cordinates

Trigger:
  • Custom script: call SetUnitX(udg_PlayerUnit[1] , udg_X[1])

Trigger:
  • Custom script: call SetUnitY(udg_PlayerUnit[1] , udg_Y[1])

The other actions has been moved to an other trigger.
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
You say the shadow moves? Not the unit? That sounds like a map glitch if I ever heard of one. But those can't really be fixed easily so lets assume its something else.

Question one if you going to do all the action in custom script why not convert the whole trigger to Jass?

That said here's a few things you can do.

1.) Place a display text in between each line and test it.
That way you can see where the function is breaking if at all.

2.) Some variables don't do very well if they aren't first initialized. Check to see if all yours start at something, 0 is fine but you can't add anything to null for instance. This goes double for the udg_Move as you trigger could be working but could be moving them 0.
 

Regga-Voska

New Member
Reaction score
0
You say the shadow moves? Not the unit? That sounds like a map glitch if I ever heard of one. But those can't really be fixed easily so lets assume its something else.

Question one if you going to do all the action in custom script why not convert the whole trigger to Jass?

That said here's a few things you can do.

1.) Place a display text in between each line and test it.
That way you can see where the function is breaking if at all.

2.) Some variables don't do very well if they aren't first initialized. Check to see if all yours start at something, 0 is fine but you can't add anything to null for instance. This goes double for the udg_Move as you trigger could be working but could be moving them 0.

Well, I tried the things you said I could do, but it didn't work... The line where counted to the number it should do, so I don't think thats the problem.
 

Naga'sShadow

Ultra Cool Member
Reaction score
49
If you want to check if its your map and not the trigger copy the relevant pieces to another map and test it there. Same problem its in your code, works fine, sucks to be you as the problem would lie with your map.
 

Regga-Voska

New Member
Reaction score
0
If you want to check if its your map and not the trigger copy the relevant pieces to another map and test it there. Same problem its in your code, works fine, sucks to be you as the problem would lie with your map.

God damnit!
It was the map... And I tried to disable all the other triggers in it so I could be sure that it didn't "stuck" in an other...
 

Regga-Voska

New Member
Reaction score
0
Uhm, NVM !! It doesn't work with any map!
Everytime I use a variable called "Boolean" it stops working!!
(The thanks to the boolean some variables should change)
 

DarkRevenant

Mad Scientist
Reaction score
13
That problem is definitely a result of using the NONE movement type, or having a walk speed of 0. Give it a real movement type and give it a speed of 1 or more. It's best to remove the unit's collision using triggers, give it a foot movement type, and make the speed 1 or higher. Add crow form (and remove it) in order to set unit height at will.
 

Regga-Voska

New Member
Reaction score
0
that problem is definitely a result of using the none movement type, or having a walk speed of 0. Give it a real movement type and give it a speed of 1 or more. It's best to remove the unit's collision using triggers, give it a foot movement type, and make the speed 1 or higher. Add crow form (and remove it) in order to set unit height at will.

God bless you DarkRevenant!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
But now the unit gains abilities such "hold position" do you know how I can remove them?
And what about the animations?!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top