Mathematic Help

jnZ

I
Reaction score
64
Ppl i need help, i got a spell that sends a unit to a targeted location and the unit is supposed to explode (die) as soon as it arrives the location. i want to add an expiration timer that kills the unit if it arrives at the location. all i need now is the mathematic part for the expiration timer duration. the movementspeed of the unit is 300.

you know something like Distance between point X and y / movementspeed, thats all i could come up with but it didnt work.

andy ideas
 

Vestras

Retired
Reaction score
248
Ppl i need help, i got a spell that sends a unit to a targeted location and the unit is supposed to explode (die) as soon as it arrives the location. i want to add an expiration timer that kills the unit if it arrives at the location. all i need now is the mathematic part for the expiration timer duration. the movementspeed of the unit is 300.

you know something like Distance between point X and y / movementspeed, thats all i could come up with but it didnt work.

andy ideas

What's wrong with creating a region and detecting when the unit enters the region?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Why don't you just slide the unit? Distance / Timer interval gives you the slide distance for it to reach it's destination after 1 second.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
( Distance between point X and Y ) / movementspeed
Nothing wrong with the maths. :D

However, WC3 units do not have a habit of moving in a straight line :confused:, they like to twist and curve.... If you want them to move and explode correctly, you need to slide them. :p

Also if your particular unit is not flying, you need to take into account blockade... like trees or other doodas
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> it didn't work.


Well, "it doesn't work" is not a very good problem description.
"Time = Distance / Speed" is correct.

On a related note, problems with triggers are best helped with by posting said triggers.
 

jnZ

I
Reaction score
64
Code:
Homing Sheep Cast
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Homing Sheep 
    Actions
        Set CasterUnit = (Triggering unit)
        Set TargetLoc = (Target point of ability being cast)
        Set CasterLoc = (Position of CasterUnit)
        Set OwnerPlayer = (Owner of CasterUnit)
        Unit - Create 1 Sheep (Homing) for OwnerPlayer at CasterLoc facing (Random real number between 0.00 and 360.00) degrees
        Set CreatedUnit = (Last created unit)
        Unit - Add Crow Form to CreatedUnit
        Unit - Remove Crow Form from CreatedUnit
        Unit - Order CreatedUnit to Move To TargetLoc
        Animation - Change CreatedUnit flying height to 100.00 at 1000000000.00
        Animation - Change CreatedUnit flying height to 0.00 at 200.00
        Special Effect - Create a special effect attached to the origin of CreatedUnit using Abilities\Spells\Human\Polymorph\PolyMorphTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Unit - Add a ((Distance between CasterLoc and TargetLoc) / (Current movement speed of CreatedUnit)) second Generic expiration timer to CreatedUnit
        Unit - Cause CreatedUnit to damage circular area after ((Distance between CasterLoc and TargetLoc) / (Current movement speed of CreatedUnit)) seconds of radius 300.00 at TargetLoc, dealing (100.00 x (Real((Level of Homing Sheep  for CasterUnit)))) damage of attack type Spells and damage type Magic
        Custom script:   call RemoveLocation( udg_TargetLoc )
        Custom script:   call RemoveLocation( udg_CasterLoc )

i think the sheep explodes to early/late because its created at a random facing and has to turn before it moves. how to create it so it faces the targeted location?

EDIT: the unit is flying so nothing should be able to block its way.

btw another thing would be rly helpful here. whats the mathematic for setting the flying height of the sheep from 100 to 0 so its reaches 0 when it arrives at the targeted location. (the formula for the rate)
 

jnZ

I
Reaction score
64
thanks that helps me out but still how to set the facing to the targeted location? facing of the casting unit wont helo because they sometimes cast and still dont face the targeted location
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Angle between points. Position of (triggering unit) and Target point of ability being cast.
 

jnZ

I
Reaction score
64
thanks that worked, now ill only have to work on the flying height rate

EDIT: its the following:

Animation - Change CreatedUnit flying height to 0.00 at (Current Flying Height of CreatedUnit / Distance Between pont X and Y / Movementspeed of Created Unit)
 
General chit-chat
Help Users

      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