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 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 The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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