Make unit face angle while moving ? :o

Komaqtion

You can change this now in User CP.
Reaction score
469
Ok, so I was planning of redoing (A little at least ;)) my Slide on Ice tutorial here on the forum, and one major flaw was that you could order the unit to move, ad it would slide faster... To fix this I thought I'd try to remove the ability to order units to move while sliding. This seemed quite easy at first, but I then noticed that there isn't really an easy way of doing this while still keeping the ability to order him to face angles...

This is what I have atm:
Trigger:
  • Slide on Ice
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set Temp_Group = (Units in (Playable map area) matching ((((Matching unit) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain type at TempPoint) Equal to Icecrown Glacier - Ice
                  • (Terrain type at TempPoint) Equal to Icecrown Glacier - Dark Ice
            • Then - Actions
              • Set TempPoint2 = (TempPoint offset by 7.00 towards (Facing of (Picked unit)) degrees)
              • Custom script: call SetUnitX(GetEnumUnit(),GetLocationX(udg_TempPoint2))
              • Custom script: call SetUnitY(GetEnumUnit(),GetLocationY(udg_TempPoint2))
              • Custom script: call RemoveLocation(udg_TempPoint2)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_Temp_Group)


Trigger:
  • Slide on Ice Object Order Check
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempPoint2 = (Position of (Target unit of issued order))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Terrain type at TempPoint) Equal to Icecrown Glacier - Ice
              • (Terrain type at TempPoint) Equal to Icecrown Glacier - Dark Ice
        • Then - Actions
          • Unit - Pause (Triggering unit)
          • Unit - Order (Triggering unit) to Stop
          • Unit - Unpause (Triggering unit)
          • Custom script: call SetUnitFacing(GetTriggerUnit(), AngleBetweenPoints(udg_TempPoint, udg_TempPoint2) )
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Trigger - Turn on (This trigger)


Trigger:
  • Slide on Ice Point Order Check
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempPoint2 = (Target point of issued order)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Terrain type at TempPoint) Equal to Icecrown Glacier - Ice
              • (Terrain type at TempPoint) Equal to Icecrown Glacier - Dark Ice
        • Then - Actions
          • Unit - Pause (Triggering unit)
          • Unit - Order (Triggering unit) to Stop
          • Unit - Unpause (Triggering unit)
          • Custom script: call SetUnitFacing(GetTriggerUnit(), AngleBetweenPoints(udg_TempPoint, udg_TempPoint2) )
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Trigger - Turn on (This trigger)


But this doesn't work properly, since the unit doesn't turn right away... It takes some time for it to turn, meaning that if I order him to move to a point 180 degrees from him (Behind him I mean :p) then he'll slide in a crescent (Half-moon) but he'll end up now sliding the the right angle (Facing before turn +- 180) but he'll be offset the real path by the diameter of the half-moon... XD

Hopefully someone'll understand this mixed up explanation :D

Thanks ;)
 

sLsIDK

New Member
Reaction score
13
tl;dr

I did however notice that you use SetUnitX and SetUnitY instead of move unit instantly. I suggest you use the move instantly action then use your second trigger. The reason it'll go in a cresant shape is because there is no "face instantly" trigger, and the current face trigger will use the unit's turning speed. (I doubt it, but someone correct me if I'm wrong). The only fix would be to lower their turning speed, I think.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
I did however notice that you use SetUnitX and SetUnitY instead of move unit instantly. I suggest you use the move instantly action then use your second trigger.

Huh ?!
Those are the same thing !
Just that [ljass]call SetUnitX and SetUnitY[/ljass] is much more efficient...

The reason it'll go in a cresant shape is because there is no "face instantly" trigger, and the current face trigger will use the unit's turning speed. (I doubt it, but someone correct me if I'm wrong).

I also already knew this, but anyways, I still just want to know if there's a way to remove this, (Not the cresent, but the real problem I'm having) without tempering with Unit settings :S
 

sLsIDK

New Member
Reaction score
13
Uh, they are not the same thing. Using SetUnitX and SetUnitY will make it so the unit keeps on doing whatever it was doing (like moving, so that's what makes it go faster), but move instantly doesn't. You could make it so that instead of creating a point in front of the unit you create it at an angle, like, first set the angle to in front of them, then when they try to move, change the angle to the angle between where they are and where they clicked (and make them face that angle). Then in the moving trigger, use the angle for that unit (use a hash table to store it I guess) to place the next point
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, then you can't even change direction at all !
And also, the problem is that the angle is saved...
I can't save the angle, and use that when he is moving in the cresent, as the same problem I'm currently having will emerge again...
 

canons200

New Member
Reaction score
50
i have this slide action in my map, i don't know will it help you.

Save your facing of unit as variable in the main moving trigger, create another trigger which performing the change facing of unit variable >> Set R_AngleWD = (Angle from (Position of Dodger) to (Target point of issued order))

so as your main trigger is running, by the facing toward. Your target a point(second trigger), the changing action take place and change your facing variable, thus effect your facing toward.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Ok, so I was planning of redoing (A little at least ;)) my Slide on Ice tutorial here on the forum, and one major flaw was that you could order the unit to move, ad it would slide faster... To fix this I thought I'd try to remove the ability to order units to move while sliding. This seemed quite easy at first, but I then noticed that there isn't really an easy way of doing this while still keeping the ability to order him to face angles...

I'm not sure I understand the problem or what you're trying to accomplish but...

...why not set a unit's movement speed by trigger to 1 when they start sliding? Then they will be able to turn and, for practical purposes, unable to move.
 

sLsIDK

New Member
Reaction score
13
i have this slide action in my map, i don't know will it help you.

Save your facing of unit as variable in the main moving trigger, create another trigger which performing the change facing of unit variable >> Set R_AngleWD = (Angle from (Position of Dodger) to (Target point of issued order))

so as your main trigger is running, by the facing toward. Your target a point(second trigger), the changing action take place and change your facing variable, thus effect your facing toward.

I said that in my last post and he said it isn't going to work for him so why'd you bother posting it again?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top