Author Topic: Detect if a player has predator.  (Read 1083 times)

0 Members and 1 Guest are viewing this topic.

Offline Kentoss

  • Major(1)
  • Posts: 5
Detect if a player has predator.
« on: March 14, 2010, 11:16:42 pm »
How would I go about detecting this? AFAIK there's no bonus detection for GetPlayerStat, unless it's undocumented or something. So I'm wondering what other methods I could use to detect it?

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Detect if a player has predator.
« Reply #1 on: March 14, 2010, 11:58:40 pm »
There is no real way, but its possible to save a buffer of the previous health of every person and the number of flamer/pred/med/beserk boxes each second. And if the players health goes up and the predkit count goes down then you can assume that he has a pred. But this is very inaccurate.

IMO: Cant be done.


Offline Kentoss

  • Major(1)
  • Posts: 5
Re: Detect if a player has predator.
« Reply #2 on: March 15, 2010, 01:47:40 am »
How do I check the number of pred boxes? I suppose I could just check if someone ran over a pred-box by checking player X and Y relative to the box X and Y, then just doing a scripted timer to coincide with the in-game timer.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Detect if a player has predator.
« Reply #3 on: March 15, 2010, 01:51:24 am »
You would have to read in all the bonus spawns in a map and disable them. Then simulate them by using apponidle and spawnobject(). Very complicated and there is no way for this to work every time (if the player has full health when the box is gotten for example).
« Last Edit: March 15, 2010, 01:53:28 am by Hacktank »


Offline dnmr

  • Camper
  • ***
  • Posts: 315
  • emotionally handicapped
Re: Detect if a player has predator.
« Reply #4 on: March 15, 2010, 09:43:38 am »
You would have to read in all the bonus spawns in a map and disable them. Then simulate them by using apponidle and spawnobject().
or loop through all objects and look for style 19

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Detect if a player has predator.
« Reply #5 on: March 15, 2010, 04:37:33 pm »
But this is very inaccurate.

IMO: Cant be done.
Everything can be done :p


I think you can get pretty close with apponidle. Loop through objects, see if there are players near. You could find out how long exactly a pred stays in game, so if it disappears sooner it might have been picked up. Hackthank's health trick might help, but a player might have had full health before picking up a pred. Or worse might have been damaged after he picked it up, but before you check his health again.

Of course the problem is there will always be doubtful times, when a player is close to a pred but the pred is about to dissapear in the following second. Or when mutiple players approach the pred in the same second (who picked it up?).

But I can think of three four ways to deal with that:
- Use a threaded function (nsc says they're stable in 1.51), check more often than once a second, decreases the chance for doubtful moments
- Be creative with the velocity info of players and try to predict (hellz yeah!)
- Better safe then pretty sure: just give everybody a (extra) pred who's in the doubt zone.
- Improve Hacktank's health trick by damaging a full health player if a pred is about to disappear and you might be able to keep track of the damage done to that player after he picked it up. (pff)

Lotsa work though...
If anyone makes it please call the project 'Shrödinger'...
Sorry for thinking out loud so much :p
Come join: EliteCTF
Listen to: My Music

Offline Kentoss

  • Major(1)
  • Posts: 5
Re: Detect if a player has predator.
« Reply #6 on: March 17, 2010, 12:15:41 am »
I managed to accomplish what was discussed earlier. Every second it loops through all the objects with type 19, gets their X and Y, then loops through all the players, gets their X and Y, and checks if they're within 25 (what's the unit of measurement in Soldat?) pixels of the point.

I assumed that the time that it takes for Pred to wear off is whatever the default is (24 or 25, it's never accurate, though) and then counted it down manually for each player. This started giving me errors like something Out of Range and Access violation or something in the server, so it's limited in terms of FOR loops.

It's also not very accurate. Unless you get there RIGHT on the second it checks, it wont detect it. I don't see why there isn't a native method for checking these things, though. There's methods for all sorts of stuff about the player, including if the player has the flag, but not for bonuses. Would I be pushing it if I asked for a method to check this in a new update to the server?
« Last Edit: March 17, 2010, 10:43:08 am by Kentoss »