MoveObject & SetTimer in the same time
#1

Hey guys, I am working on a bombing system and I am having a little issue
Let's say I am launching a missile from my plane
I want the object to move from the plane to the ground (using ColAndreas to get the ground Z)
And once it reaches the ground, it will blow
Here is the code:
PHP код:
            MoveDynamicObject(MissileObject[vehicleid], xygroundfloatround(GetVehicleDistanceFromPoint(vehicleidxyground)));
            
SetTimerEx("BlowMissile"floatround(GetVehicleDistanceFromPoint(vehicleidxyground)) * 10000"iifff"vehicleidMissileObject[vehicleid], xyground); 
The object instantly moves to the ground, no delay, like the "time" parameter in moveobject doesn't matter
Anyone got a clue ?
Reply
#2

The object travels to the ground pretty much instantly, because you set a veeery high speed (depends on the distance to the ground)...

The parameter in MoveObject is not time, it is speed. Thus, the distance to travel does not matter, since the bombs should probably move at a fixed speed.

Also why do you do it so complicated? There is a callback named "OnDynamicObjectMoved".
Using this, you can apply a static speed to an object and do not need to calculate anything, also no timer required.
Reply
#3

Quote:
Originally Posted by NaS
Посмотреть сообщение
The object travels to the ground pretty much instantly, because you set a veeery high speed (depends on the distance to the ground)...

The parameter in MoveObject is not time, it is speed. Thus, the distance to travel does not matter, since the bombs should probably move at a fixed speed.

Also why do you do it so complicated? There is a callback named "OnDynamicObjectMoved".
Using this, you can apply a static speed to an object and do not need to calculate anything, also no timer required.
First of all thanks for the DynamicObjectMoved, didn't know about it
But, I want that the speed will be dependent on the distance
For example 8 meters distance will be 5 speed
10 meters will be 5 + X and so on
Reply
#4

Well speed is measured in units per second... So how long do you want it for the object to take to move?

speed = distance / seconds

For example, if I want the object to move from one point to the other in 12 seconds, speed = distance / 12
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Well speed is measured in units per second... So how long do you want it for the object to take to move?

speed = distance / seconds

For example, if I want the object to move from one point to the other in 12 seconds, speed = distance / 12
Thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)