Object with timer
#1

Can any one plz give me idea on how i make like object or a explosion that hunt the target un til he dies


after he die it will go away
Reply
#2

You need to create the object first: https://sampwiki.blast.hk/wiki/CreateObject
Use the X, Y and Z you want to object to be created on.

Then, you need to get the X, Y and Z of your target. If you want the object to move after your target, you need to keep the X Y and Z of your target updated. So, get the X Y and Z of your target in any looping way. Such as OnPlayerUpdate. Check this for getting the players position https://sampwiki.blast.hk/wiki/Function:GetPlayerPos

Then, move the object towards your target, keep in mind, this also needs to be repeating if you want the object to move after your target, so again, put it in a timer or OnPlayerUpdate: https://sampwiki.blast.hk/wiki/MoveObject

Lastly, you need to create an explosion if you object reached it's target. This can be done easily by checking if the X, Y and Z of the object are equal to the X, Y and Z of your target. You can use the following for this: https://sampwiki.blast.hk/wiki/GetObjectPos and https://sampwiki.blast.hk/wiki/Function:GetPlayerPos

Remember, after that, you need to destroy the object: https://sampwiki.blast.hk/wiki/DestroyObject

If you need more help, just tell me and I'll try to get it working for you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)