Jump to content
Sign in to follow this  
chartier

Disembarking ai when needed

Recommended Posts

Hi!

I'm doing a "duel" mission where two soldiers try to knock each other out. I have several vehicles to use all over the map and AI boards the closest one. Each soldier has a beacon sending a position info every 3 minutes and according to that position "SEEK AND DESTROY" waypoint is replaced. When other player is detected with "knowsAbout" -method AI soldier moves to Gunner -position, or if there is no gunner in vehicle he should disembark.

This is the problem: how do I make a check if current vehicle has a gunner position available? Any ideas?

Share this post


Link to post
Share on other sites

This condition is true when gunner position in vehicle is empty.

(isnull (gunner nameofvehicle))

Share this post


Link to post
Share on other sites

How about the command </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">canFire<span id='postcolor'>?

I wish I could remember if you could use that like

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(!canFire( my_bicycle ) ) <span id='postcolor'>

or something like that...

Share this post


Link to post
Share on other sites

Sorry for misleading question. I meant that how can I determine if the vehicle has a position for gunner in first place. For example:

?(is there a gunner pos in (vehicle AIplayer)):switch place from driver to gunner

for tank above would be true, for 5tTruck false etc...

Share this post


Link to post
Share on other sites

Thanks LauryThorn, I will try that "canFire" -method later!

Share this post


Link to post
Share on other sites

The "canFire" worked fine! If the vehicle is equipped with some weapon and gunner position canFire returns TRUE, otherwise FALSE. Thanks!

But now I encountered another problem:

How can I script AI soldier switch the place from driver to gunner position? I made a workaround for that by first disembarking the soldier and again assigning the solder as a gunner for that vehicle. That is not a clean solution though because it would be nice if soldier doesn't leave the vehicle at all. I tried already "moveInGunner" but nothing happened.

Again, any ideas?

Share this post


Link to post
Share on other sites

Yet again, I'm not sure but..

Have you tried to do something like

ai_gunner action[ something like "to gunners position" ]

or

ai_gunner assignasgunner the_vehicle

Do you have BTW the scripting reference thing?

You really like must to have that!

Share this post


Link to post
Share on other sites

I tried an action "toGunner", but I'm pretty sure that is not the right action string. Do you know where I can find the strings for actions in different situations? I have a comref but it doesn't tell anything about those...

Also, I have tried assignAsGunner but nothing happens. Propably because AI soldier is already assigned as driver and vehicle is moving.

Share this post


Link to post
Share on other sites

Thanks Bloodmixer! There is pretty complete list of actions in unofficial command reference guide!

Share this post


Link to post
Share on other sites

I still have problems with AIplayer (driver) to change to gunner seat inside a vehicle (not to jump off). I have tried several methods:

1. _AIunit assignAsGunner vehicle _AIUnit -> AI stops, jumps off the vehicle and boards it again

2. _AIunit action ["TO_GUNNER",vehicle _AIunit] -> does nothing

3. doStop _AIunit + above action -> AI stops the vehicle but doesn't change to gunner seat

4. _AIunit moveInGunner vehicle _AIunit -> does nothing

So, what's wrong? Any ideas?

Share this post


Link to post
Share on other sites

Oh yes, problem solved! biggrin.gif

Funny thing that directly switching a seat inside vehicle does not work for AI unit simply with moveInGunner -command. Instead first thing to do is remove AI unit from vehicle with setPos -command (_unit setPos [0,0,0]) and directly after that _unit moveInGunner _vehicle. Weird...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×