PDA

View Full Version : Need help to one script



SG1_sandokito
Oct-08-2014, 19:30
Who can i destroy planes out of battle area.
If the plane is 30sg out of the area?
whe are testing new version of HRCODWAR, and need implement this funcion.
thx

ATAG_Lolsav
Oct-08-2014, 19:36
yo no estoy capacitado para te responder. Pero tu pergunta es "duvidosa", quieres saber quiem pode destruir o como destruir los aviones qui estan fuera de la zona? (perdon por mi espanol :) )

SG1_sandokito
Oct-08-2014, 19:48
Mi ingles es igual de malo.

Quiero saber como destruir los aviones que estan fuera de la zona de combate 30 segundos despues de estar fuera de zona.

I want how to destroy the planes are out of the combat zone 30 seconds after being out of area.

Pd: thanks for trying written in Spanish :)

ATAG_Lolsav
Oct-08-2014, 19:51
spanish: Reddog tenia un script que destruia los aviones qui atravessavam una barriera. Penso que sera algo parecido con isso, certo?

english: Reddog had a script who would destroy planes crossing a line, a barrier. I guess its something alike?

SG1_sandokito
Oct-08-2014, 19:54
YES out off battle area:):)

ATAG_Colander
Oct-08-2014, 20:53
Get the position of the plane and calculate the distance from the area center, then if bigger than that:
aircraft.cutLimb(part.LimbNames.XXXXX)
(aircraft is an AiAircraft class)

ATAG_Lolsav
Oct-08-2014, 21:40
Get the position of the plane and calculate the distance from the area center, then if bigger than that:
aircraft.cutLimb(part.LimbNames.XXXXX)
(aircraft is an AiAircraft class)

Can you place a example for future reference? It could be usefull for some others :)

SoW Reddog
Oct-09-2014, 04:18
Best way would be to use the battle grid IMO. Return the battlegrid of the plane, if it's a null return then it's outside the grid, so destroy it/warn them to turn back/whatever you want to do.

SG1_sandokito
Oct-09-2014, 17:22
Best way would be to use the battle grid IMO. Return the battlegrid of the plane, if it's a null return then it's outside the grid, so destroy it/warn them to turn back/whatever you want to do.

Hello Reddog, thanks in advice, the logical idea its clear to develop the function, but i need some of the logic description, like if its overriding some method that exists in AMission, if not, how to avoid make a lot of calls from any plane to check the position in grid, etc. If u want to share something more privately, please, let me know, it would be a big help.

(a friend its translating me, thanks!)

Thanks!

SoW Reddog
Oct-09-2014, 17:30
Hi Sandokito,

I'm in the middle of some stuff of my own so I can't test, but I'd do something like this:

Put a call within OnTickGame every 20 seconds( or whatever interval makes sense to you )to a public void method/function, which loops though all airgroups, and all aircraft within that airgroup and returns the battlegrid. If it's Null, or whatever the exact response is when the plane's not in the grid (can't remember off top of my head) then destroy the plane/Warn the pilot etc etc.

If you're in no rush, I can write the function for you, but it'll be a week at least before I can look at it.

SG1_sandokito
Oct-09-2014, 19:51
Hi Sandokito,

I'm in the middle of some stuff of my own so I can't test, but I'd do something like this:

Put a call within OnTickGame every 20 seconds( or whatever interval makes sense to you )to a public void method/function, which loops though all airgroups, and all aircraft within that airgroup and returns the battlegrid. If it's Null, or whatever the exact response is when the plane's not in the grid (can't remember off top of my head) then destroy the plane/Warn the pilot etc etc.

If you're in no rush, I can write the function for you, but it'll be a week at least before I can look at it.

Hi Reddog, i appreciate your answers. what I´m trying to do is avoid the X time calls to method for not use much resources, and, only, having the battle grid, and supposing every airgroup is inside it, if any planego out, any event by coordinates, position, etc, jumps and do something, warn, destroy, cut limb, etc.

Anyway, im not in rush, and i appreciate if u can help us with that, we have a rookie programmer between us, we´ll keeping searching and trying loofing for solutions, we´re in contact!, when u have time, let me know!, this "little" function can help us to avoid cheaters!

Thanks so much!

SoW Reddog
Oct-10-2014, 04:39
Sandokito,

Unfortunately you're going to have to loop on some sort of time base in order to repeatedly check where stuff is. There's no resource "issue" that I've come across in running loops of this nature within OnTickGame. Several of my missions use 10 or 20 second intervals with no appreciable difference in performance.