Home   Help Search Login Register  

Author Topic: Exclude Air vehicles for Support Trucks  (Read 1332 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Exclude Air vehicles for Support Trucks
« on: 12 Apr 2008, 19:48:40 »
Searched all over but didn't found anything related to this.

The Situation:
I have an Repair truck with a "SUPPORT" waypoint. Also i have one or more planes created with createvehicle.

The problem:
If a plane get's dammaged, it calls repair truck for support. Not very helpful because the plane wont land anywhere and the support truck is gone. If i need the truck he'll be somewhere, following the plane to support it.

Question:
Is there a way to a.) disallow the plane/pilot to call for support on his own (will always be AI) or b.) disallow the truck to go for support calls from air vehicles?

Offline Loyalguard

  • Former Staff
  • ****
Re: Exclude Air vehicles for Support Trucks
« Reply #1 on: 17 Apr 2008, 14:17:35 »
Well I have been racking my brain with this one for a few days now and no solid leads.  Here are the only remote possibilities I could muster:

1. Add a damaged event handler to each of the planes so that when a plane(s) is damaged it runs code that changes the repair truck's waypoint (type) to change from support to something else.  If possible, it also means that when the plane is killed (proably need to add a killed event handler) or repaired (hopefully neither of which would occur too long after the initial support call) additional code is run to return the repair truck to a support waypoint (type).

If that is not viable I have one other idea but is probably even less liklely to work:

2. Assuming that assignedTarget will return friendly targets (big assumption) as well (like if ordered to "repair" another unit after responding to a support call) if assignedTarget returns a plane(s) then similarly temporarily change the repair truck's waypoint (type).

Maybe one of those will pan out or at least open up some new avenues.  Good luck and let us know.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Exclude Air vehicles for Support Trucks
« Reply #2 on: 17 Apr 2008, 15:16:13 »
@Loyalguard

Thanks for your suggestions. First of all i'm sorry, left out some info that might be important: this is not for a mission but for a scriptsuite, not designed for a specific mission. As the support vehicles aren't part of that suite (in fact a friend pointed that problem while he was testing the scripts) i have no direct access to any mission relevant vehicles or to their waypoints.

What the script does is to create one or more plane out of nowhere, send them to a target area where they'll fight any enemies (hopefully) and once they're damaged, out of fuel or out of weapons, they'll return to they're starting point and there they'll be deleted. As long they don't get shot down, they'll never touch the ground.

Maybe to get a better idea, this is the related topic of the script suite.

So coming back to your suggestions, the first one might not be achievable through my scripts. The second one might be worth a try if i can find a way to catch the called support truck. Will do some researches on this.

Offline Loyalguard

  • Former Staff
  • ****
Re: Exclude Air vehicles for Support Trucks
« Reply #3 on: 17 Apr 2008, 15:32:44 »
I figured it was for the your script suite but I assumed that the repair truck was part of it (being a carrier simulation that didn't make too much sense on my part :P )

So we know we have to narrow interaction down to just your planes without disturbing mission vehicles.  In that case perhaps consistently checking currentCommand of the planes when damaged may give you a opportunity to quickly change the command so it doesn't mess up any repair trucks operating under a support waypoint.  Good luck!

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Exclude Air vehicles for Support Trucks
« Reply #4 on: 17 Apr 2008, 17:55:35 »
This is a script-heavy non-ideal solution, but should work:

Use eventhandlers on planes (or a looping monitoring script) that always keeps their damage set to zero (undamaged).  And keep an array of plane objects and corresponding damage values, to track what the damage should be for each plane (each time a plane is hit, add the damage to the damage array value).  Your script can then destroy the plane, or disable it with a very high damage score, when the damage array value reaches some threshold.

If you want damaged planes to smoke, you could add an effect when the damage array value reaches some threshold.

This would allow the game engine to think "no support needed", but the planes are still not invincible, because you are managing their damage via scripts.

If this works for you, I want another Oscar for my mantle!
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Exclude Air vehicles for Support Trucks
« Reply #5 on: 17 Apr 2008, 18:39:24 »
@Loyalguard & johnnyboy

Thanks for your replies.

johnnyboy, i'll keep in mind your proposed way to solve this issue. Although this would need some major scriptings i'm not affraid to do this (the carrier script contains more than 400 lines of code) i'll try to find a easier way...whatever that means.  :D

What i will try for now: with the command vehicles i can get a list of all present vehicles and there i should be able to get theyr waypoints, At this point i should be able to check if a vehicle has a support waypoint. With the currentCommand i probably can catch a vehicle when it moves out for support and then i hopefully can get the vehicles target (the damaged plane) and then disable the support.

All this needs some time i have to research about the behaviours and what kind of information i can get from the vehicles. But it's a point to start with.

I'll report back as soon i have some results or further questions about.


But still, if someone knows an easy way to solve this, i would be happy to know.


OT: johnnyboy, only 1 Oscar per person and year.  ;)