Jump to content
Sign in to follow this  
combat-agent

Detect if unit is in vehicle

Recommended Posts

As stated, How do i detect if a unit is in a vehicle? It needs to be dynamic because every soldier in the mission has an event handler, and if the the unit is in a vehicle, the event handler will be ran, but the script attached needs to exit the script.

Thanks,

Agent

Share this post


Link to post
Share on other sites

hmm - basically: vehicle _unit != _unit

or an eventhandler "GETIN".

Maybe you could be more specific about your eventhandler

and scripts what is running when.

~S~ CD

Share this post


Link to post
Share on other sites
Quote[/b] ]?(unitName in vehicleName)

Off course it's working too but then you gonna have to

ask for each vehicle seperately while <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">vehicle _unit != _unit will return wether the unit is inside any vehicle or

not.

~S~ CD

Share this post


Link to post
Share on other sites

Thanks for the replies. I havnt tested all of the it yet, but will soon.

Im going to explain the enitire situation here.

Each unit has a "killed" event handler. Everytime a unit is killed he will drop his weapon. This event handler is defined in the units .cpp file. Obviously, when a unit is killed in a vehicle, he should not drop his weapon. That is the case. So what I need, once again, is a way to check if a any unit is in any vehicle. It obviously has to be dynamic. Any number of these units could board any number of vehicles within a mission.

Like I said, I havnt tested all the proposed solution yet, but ill be doing that now.

Thanks again

Share this post


Link to post
Share on other sites

That's pretty simple then. At the top of your 'drop weapon' script, just add the condition CD mentioned:

? (vehicle _guy) != _guy : exit

...continue with code to drop weapon...

Obviously replace _guy with whatever variable you use to refer to the unit who will drop his weapon.

I'm a little confused about this though... you can already pick weapons up off of dead guys, so why do you need to 'separate' the weapon from the guy ("drop" it)?

Share this post


Link to post
Share on other sites

It worked without flaw.

Quote[/b] ]I'm a little confused about this though... you can already pick weapons up off of dead guys, so why do you need to 'separate' the weapon from the guy ("drop" it)?

I guess i just like it. No one else seems to be to fond about it. But really, when a units gets blown up, i hate seeing his gun attached to him like its part of his body. Also, I think its eye candy when you see a group of dead guys (perferably that you just killed) with their weapons all in diffrent positions near their body.

For one set of weapons, I actually created a model for each weapons so it had physics and would conform to the ground. Think about shooting at a group of guys with HE, Its great watching the weapons fly through the air.

1d.JPG

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  

×