Jump to content

projectile hit position


Recommended Posts

Posted

hi, how can i get the position where projectile hit the ground/player/whatever?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
This does not trigger for projectiles based

For explosive projectiles you can use onClientExplosion

this is molotov projectile. after hitting ground it dont create the molotov explosion, so this will fail too. i need to create explosion "manually" after projectile hit the ground

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
doesnt proectile destroys when it hit ground?and getElementPosition dont works?

good.. but i dont see "onProjectileDestroy" event or anything like that..

or should i getElementPosition everyframe, until my element exist?

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
you could do that, but for performance reasons calculate aprox time when ti should land and get pos only then

omg, HOW?

sometimes ped is standing in front of SOMETHING, making the projectile hit in same time as created,

sometimes ped just throw molotov in open space

sometimes ped throwing molotov from the roof

sometimes ped even throw molotov from big mountain..

too much cases and random things

i thought is there any event that will help me get the time projectile destroy

edit:

I'll try that Gamesnert :)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

sweet.. well, almost

function molotovHit()
local px, py, pz = getElementPosition(source)
outputChatBox(getElementType(source))
outputChatBox(px.."."..py.."."..pz)
--createExplosion(lx, ly, lz, 1, getRootElement())
end
 
local projectile = createProjectile (ped, 18, lx, ly, zz+0.7, 1.0, getLocalPlayer(), rx, ry, rz, dx, dy)
addEventHandler("onClientElementDestroy", projectile, molotovHit)

chatbox:

projectile

0.0.0

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
edit:varez, try checking xyz every frame, bcoz may destroy is triggered to late

hehe, 1st you told me that this will be CPU consuming (indeed),

now you are changing your mind :P

you removed your idea bout attaching another element (you told bout vehicles :P) to it..

well, i think thats not a bad idea, i'll try to attach a very small object and on projectile remove ill check the object position, then remove the object.. hope this will work fine..

im waiting for another ideas anyway :)

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

hmm.. so im still waiting for ideas i think..

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
edit:varez, try checking xyz every frame, bcoz may destroy is triggered to late

hehe, 1st you told me that this will be CPU consuming (indeed),

This shouldn't be that CPU consuming, otherwise you have to be doing it wrong. Keep in mind that SA does over 9000x more calculations to draw images onto the screen and calculate physics. Yet, that doesn't lag all too much. It's perhaps not ideal, but CPU consuming? I doubt it.

An alternative way could be using onClientExplosion. Don't ask me how, but it should be possible. (in some way)

P.S. Did I just detect a double-double-post? :o Wait, nevermind

Projects:

Slothbot | Maximap

Posted
This shouldn't be that CPU consuming, otherwise you have to be doing it wrong. Keep in mind that SA does over 9000x more calculations to draw images onto the screen and calculate physics. Yet, that doesn't lag all too much. It's perhaps not ideal, but CPU consuming? I doubt it.

maybe.. but custom scripting could lag game easly even if game have milion things more to do :)

An alternative way could be using onClientExplosion. Don't ask me how, but it should be possible. (in some way)

i'll give it a try, but i shouldnt think molotov projectile hit makes a explosion (as i dont see any)

P.S. Did I just detect a double-double-post? :o

what??

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
maybe.. but custom scripting could lag game easly even if game have milion things more to do :)

There's a certain truth in here. Lua is a lot slower than C++, because Lua is extremely dynamic and C++ basically isn't. Dynamic means the PC needs to do a lot more calculations to actually do the same thing, but it's much easier for a person to script in. However, don't exaggerate the amount of more calculations need to be done. If onClientRender would really be that CPU consuming, the map editor would fry your PC in seconds, and Valhalla would simply turn your PC in a nuclear bomb. :P

i'll give it a try, but i shouldnt think molotov projectile hit makes a explosion (as i dont see any)

What do you mean, you "can't see any explosion"? Molotov projectiles should create an explosion.

what??

I didn't say anything D:

Projects:

Slothbot | Maximap

Posted
If onClientRender would really be that CPU consuming, the map editor would fry your PC in seconds, and Valhalla would simply turn your PC in a nuclear bomb. :P

Hmm, my friend's new GPU (but overclocked :P) was burned not on the newest game on max detail, but in MTA Map Editor ;)

i'll give it a try, but i shouldnt think molotov projectile hit makes a explosion (as i dont see any)

What do you mean, you "can't see any explosion"? Molotov projectiles should create an explosion.

ok, i think i figured it out..

when you set as creator ped that was created server side, the explosion dont show up..

thats why i was trying to create explosion "manually"..

if i set creator to local player everything is ok!

and if you create ped clientside, and set him as creator, everything is ok too

edit:

okay, what can be creator of projectile if not local player (as i dont want to sync the projectile)?

getRootElement() fails

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

It makes sense you don't get an explosion if you're not the creator. Projectiles only get synced with you specified as creator, and creating an explosion from a non-synced projectile would create desync.

Just use onClientRender to get the last position, and create an explosion from a molotov over there. See if that works.

Projects:

Slothbot | Maximap

Posted

i dont need a sync here, just want to create a projectile, that will explode just for one player, nobody else should see it.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...