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
  • The Helper The Helper:
    I just got to watch the video because even though I was there I was trying to work out tech problems with the chat since I was the social media guy so I was distracted but check it out guys the video is super fucking great!
    +1
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top