Using Physics to Caculate when to do something.

Zanderist

New Member
Reaction score
5
I've made a trigger using the formula v= d/t (and it's other variants)

Trigger:
  • Replace On arrival to point
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Set Distance = ((Distance between (Position of (Ordered unit)) and (Target point of issued order)) / (Default movement speed of (Ordered unit)))
      • Game - Display to (All players) the text: (ETA: + (String(Distance)))
      • Wait Distance seconds
      • Unit - Replace (Ordered unit) with a Footman using The old unit's relative life and mana


But it has a problem, if you keep clicking on on the map while the unit(s) are selected you can end up creating an extra unit.

How can I prevent that extra unit for being created.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Instead of (Ordered Unit), try (Triggering Unit). I believe it is local to the function. (I am not positive though)
 

Dave312

Censored for your safe viewing
Reaction score
269
It is occurring because you are running multiple instances of the trigger for the same unit. Hence when it tries to replace the triggering unit, sometimes the unit has already been replaced, hence the triggering unit no longer exists and it will create a new unit. To solve this problem, you will need to add in some sort of check to see if the order that started that trigger is still that units current order. Using custom script to define local variables or custom value of a unit is probably your best way to go.

BTW. Using physics in this case can be very unreliable. Units will only use a straight path to travel from one point to another when there is nothing it has to move around (such as other units, doodads etc.)

EDIT: On second thought you could also use a check to see if the ordered unit is equal to no unit before trying to replace it.
 

Zanderist

New Member
Reaction score
5
The use of this formula (t = d/v) could allow players trying to develop a cinematic much easier.

Just take a unit that has the velocity you want the camera to move with, use the terrain brush to make point you want that camera to move to. Then move that unit to all the different points you want that camera to go to, and write down the time. Remove all the terrain points.

Now you know how long to apply to camera object for.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
the wait function in GUI is not 100% accurate (very inaccurate for short durations, and also does not work properly with player lag screens).
 

Zanderist

New Member
Reaction score
5
You can make it display only 3 significant figures if you like.

And what is the player lag screen?
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
the wait function in GUI is very inaccurate (try waiting 0 seconds, minimum wait is 0.27 or something, and it has a lot of variance)

the player lag screen is the screen that appears when one player is lagging (with the drop player button) - wait function will still tick down during that, when it really should not (except under special circumstances)
 

Zanderist

New Member
Reaction score
5
This was really more a science experiment than anything else, since I wanted to see if this would actually work under vacuum conditions.

The wait function seconds is set by the formula. And it will only use the first 3 figures of that variable (because you can only enter in 3 significant figures).

You can also introduce a if/then/else trigger if the wait time set by the variable is less than the wait minimum.

When will a unit get to the point it's ordered to move to in 0 seconds? The value will always be greater than zero, and teleportation doesn't count.

Besides I only want to see if it would work in a totally flat barren terrain, It has with the only side effect of extra units being created, it also proves that the formula does work which was my original objective (in a vacuum world).

However, when a unit is order to move through a forest an invisible line is created. From the unit and to the point, if the trigger could be modified to change when the slope of that line changes it could also work for when the unit has to move around objects.

The only thing I can say to player lag, is come up with a trigger that will add 'x' amount of seconds to the wait time. I don't think that can by done in the GUI but maybe in JASS.

Though I do not know what will happen when the unit moves over a hill. My guess it should still work because the only thing changing when it comes to a hill is the Z-axis, though I am not sure if the velocity is changing.

Edit:

I've now tested using 3 different situations, Hill, flat, and forest.

I found that it all worked untill the forest.

I think if I could make use the distance the unit has to travel, instead of the distance to the two points. It will work perfectly.
 

Dave312

Censored for your safe viewing
Reaction score
269
If you use 'wait - game time seconds' then that should take into account any lag.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 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 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