Is this doable?
#1

Hi, as you all know, Samp can't natively detect whether a Rustler destroys another vehicle the same way it can detect a player killing another. However, some time ago I saw something that gave me an idea: there's one server in which there are car races, and you can come with a Rustler and shoot the racers. Well, nothing related until here, but the key comes now: one day, in the forum of that server, some people were talking about preventing that (Rustlers attacking racers) from happening, and one of the scripters posted the following messages:

Quote:

It is not possible to detect bullet hits or who they came from accurately and efficiently.

[...]

It is possible however to detect the keys pressed by a rustler player, if the rustler is streamed in, if the player is a racer and there is also an event for when a player streams in/out..

Quote:

Was thinking more along the lines of...

Код:
OnFireKeyPressed:
  LoopRacers {
    If RacerIsStreamedForRustlerPilot() && RustlerPilotIsLookingInRacerDirection()
        SlowDownRustler(); // Decrease relative X and Y velocity so they fall back from the racer.
    OR
        MakeRustlerFlyUpwards(); // Set Z velocity upwards..thus making the rustler not aim at the players on the ground AND not crash as a side effect.
}
Hopefully that's readable.

Quote:

It is quite a simple solution once the math is figured out. This kind of mathematical function is common on the internet and should be quite easy to whip up using basic trigonometry.. it could run in it's own script too. Tidily and away from all our other code.

Although that's not strictly pawn code, you can see that apparently it's about a script that detects whenever a Rustler shoots to a racer, and in that case it bounces the Rustler upwards. And although this wasn't finally implemented in that server, it inspired me to think of a modified version of that script which might be useful for aircombats. For example, imagine that I'm flying a helicopter and another player (let's say that he's nicknamed "abc") comes with a Rustler and starts shooting to my heli: if the previous script detects that he is shooting to my vehicle AND if my vehicle takes damage, then the action taken by the script, instead of the attacking Rustler being bounced upwards, would be just that a timer starts counting X seconds (maybe 10, 15 or 20 to say a figure). If within that time my vehicle gets destroyed OR if I jump out of it, then the script would detect that player "abc" has destroyed my vehicle with a Rustler, even if I have survived to the attack.

But of course it can happen that the Rustler pilot needs to do several fly-by's to destroy my helicopter (for example if I'm flying slowly and/or in a different direction). In this case, the mentioned timer would be restarted with each new flyby in which my heli takes damage, so those X seconds would be always counted from the last flyby in which my heli has been damaged.
If there are several Rustlers shooting to me, then my downing would be scored by the last one in shooting me, like when fighting on foot.

If this worked well, it would be useful for aircombat stats: how many times you have destroyed other planes, how many times your own plane has been destroyed and an aircombat ratio.

With this example I have been focusing on Rustlers all the time, but I guess that it could apply also to other vehicles that have a gun mounted on them, like Seasparrows and RC Barons.

Do you think this would work with a reasonable scripting effort and without creating too much lag?
Reply
#2

Yes it is doable, you will need to use timers + camera functions.
Reply
#3

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
Yes it is doable, you will need to use timers + camera functions.
Would this script be too heavy, would it demand too many resources?
Reply
#4

afaik, Yes unless you're going to have it unaccurate, if you want it accurate it would be quite resource-hog.
Reply
#5

Well a lighter version of the script could be done with no timers, but actually those timers have a reason: you know that when you are flying a Rustler, you have two main ways to destroy another vehicle:

1-One of them, when you are chasing a fast vehicle (like another plane), is to keep yourself behind your target and shoot constantly until it's destroyed, like in this video:

[ame]http://www.youtube.com/watch?v=j9GwUO8oBo4[/ame]

and I guess that you would need no timers for this. However:

2-When you are chasing a slow vehicle, or just one that is moving in a different direction of yours, you have to do flyby's, like in this video:

[ame]http://www.youtube.com/watch?v=HQuwjsCYfUs[/ame]

which is what the timers would be needed for, because as you can see at the minute 1:56, the other plane starts falling after I have flown past it and while I'm giving my back to it (and I'm not shooting in that moment), so if there are no timers I won't score that downing. And same if for example I'm shooting to a standing helicopter: it can happen that the heli pilot jumps out of his heli after I have passed him (and before I make a new flyby), and in that moment I would be giving my back to him.

So in conclusion: if there's no timer, the Rustler pilot will score a downing ONLY IF he is shooting and looking to the other player WHILE that other player has his vehicle destroyed.
Reply
#6

Not really, a vehicle could also be at low health and you could simply ram the other vehicle with the rustler also there are more possibilities to kill a vehicle.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)