Home   Help Search Login Register  

Author Topic: How to check if AI is disabled?  (Read 1494 times)

0 Members and 1 Guest are viewing this topic.

Thaatu

  • Guest
How to check if AI is disabled?
« on: 09 Oct 2005, 16:54:40 »
I tried searching for an answer, but couldn't find one so...

I'm trying to make an "exhibition" of how WWI air combat would work in OFP, so I made a TDM mission of an allied squadron vs. an axis jasta. The problem is, as they both start in air, that if one of the pilots is disabled, his plane will start in air and crash.

What I want to do is check if a pilot is disabled and if is, then deletevehicle his plane.

I tried the following:

Created a trigger checking if the pilot is present, on activation "pilotpresent = 1".

Created another trigger checking if pilot is NOT present, condition "this AND Not (pilotpresent == 1)", on activation "deletevehicle plane".

So what the first trigger would do is check if the pilot has been present at the beginning of the game, and the second trig. would check if the pilot isn't present and basically ask the first trig. if the pilot has died or dropped, in that case the sec.trig. won't activate.

But that doesn't work! Help me...

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to check if AI is disabled?
« Reply #1 on: 09 Oct 2005, 17:01:04 »
Hmmmmm............try:

this AND (NOT pilotpresent)

Maybe........ ::)

Ohh.......and welcome to OFPEC.   ;D


Planck
« Last Edit: 09 Oct 2005, 17:17:18 by Planck »
I know a little about a lot, and a lot about a little.

Thaatu

  • Guest
Re:How to check if AI is disabled?
« Reply #2 on: 09 Oct 2005, 17:17:21 »
The trigger thingy works in mission editor when I just manually delete the pilot then preview. Then the deletevehicle kicks in and deletes the plane.

But in MP the disabled pilot, I quess, sort of blinks in the beginning of the mission, activating the "pilotpresent = 1" trigger and it all goes to hell...


I need some alternative route here.

                   Ohh... and thanks  :)
« Last Edit: 09 Oct 2005, 17:19:06 by Thaatu »

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:How to check if AI is disabled?
« Reply #3 on: 09 Oct 2005, 18:30:30 »
First I assume U know about DisabledAI = 1 in Description.ext?
That means that the empty slots in MP are not AI.

Then U could do an engine  check on the vehicles with "IsEngineOn" a  second after the mission started.The Players will have engine On,the empty planes not and can be deleted.

In Your Planes initfields:
Code: [Select]
[this] exec "Checkvehicle.sqs"
Checkvehicle.sqs:

Code: [Select]
~1  
?(!Isengineon (_this select 0)) :DeleteVehicle (_this select 0)
exit




http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Thaatu

  • Guest
Re:How to check if AI is disabled?
« Reply #4 on: 09 Oct 2005, 19:31:55 »
----! I just tried it and it seems that empty planes have their engines on, so that doesn't work...
I also tried a simple "NOT (pilot in plane)", but if "pilot" is disabled then it doesn't exist and for ----- sake...  :P
I also tried something else, but my brain melt and I can't remember what... whatever it was, it didn't work.

About disabledAI, I do want to make AI wingmen available.


Oh by the way, that "isengineon" script's a very nice idea. It does work with land vehicles...
« Last Edit: 09 Oct 2005, 19:38:04 by Thaatu »

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:How to check if AI is disabled?
« Reply #5 on: 09 Oct 2005, 19:55:23 »
OMG I tried it with choppers,all went well...

Even Empty  Planes indeed return "IsEngineOn" true, :o ???


Quote
About disabledAI, I do want to make AI wingmen available.

With DisabledAI = 0 U have Human Players and AI players together,so when exactly do U have an empty Plane then?Or whats the condition that a AI pilot/plane should be disabled?

« Last Edit: 09 Oct 2005, 20:18:48 by Platoon Patton »
http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Thaatu

  • Guest
Re:How to check if AI is disabled?
« Reply #6 on: 09 Oct 2005, 20:09:29 »
I want to give players the choise to play a squadron encounter, or just a 1vs1 dogfight, or 3vs3 with AI wingmen etc. So they could adjust that by disabling AI players in multiplayer setup.

Now if you want to play 1vs1 and disable all AI, there'll be 19 empty planes crashing down at the same time, causing muchos lag and very muchos laughter...
« Last Edit: 09 Oct 2005, 20:10:23 by Thaatu »

Offline Platoon Patton

  • Members
  • *
  • "Barbecue" CreateVehicle getpos LLama
Re:How to check if AI is disabled?
« Reply #7 on: 09 Oct 2005, 20:24:19 »
Ok,because IsengineOn return true,we do a count crew check first and then turn the engine off :)

Code: [Select]
~1  
?(count crew (_this select 0)<=0): (_this select 0) EngineOn false
?(!Isengineon (_this select 0)):  DeleteVehicle (_this select 0)
exit


Or skip the engine part:
Code: [Select]
?(count crew (_this select 0)<=0) :DeleteVehicle (_this select 0)

Hope this works
« Last Edit: 09 Oct 2005, 20:29:14 by Platoon Patton »
http://www.platoon-clan.com/ We always wellcome dedicated OFP players :)

http://www.european-combat-league.com/index.php To play with us in the best OFP league ;)

Thaatu

  • Guest
Re:How to check if AI is disabled?
« Reply #8 on: 10 Oct 2005, 19:54:43 »
Yes! It works!  :D

Thanks PP... a lot!