Jump to content
Sign in to follow this  
OnlineKenji

Does isnull ever work?

Recommended Posts

First off, I did search, and I did not find anything.

I need a way to determine if a "Playable" character is AI, Human, or disabled.

I am making a mission, and in the mission the guys are ejected from a chopper. Now this is easily accomplished by "eject" ing them one at a time, but some times they blow up, it's the weirdest thing, people actually explode...

Anyway, I did set the sleep to like 5 seconds, but this makes my intro too long, I'm trying to set it for when the ejected player is 35m away from the chopper, this is a safe distance. Another problem with the sleep is that in MP it works wrong, sometimes it ejects them like 1 second after the other. I think this has something to do with latency, and different times on client machines and whatnot, but I don't know enough about that to do anything. All I know is the sleep doesn't work all the time.

So in conclusion, if you know a way to detect if the AI is disabled it would be a help, because my mission gets stuck when it waits for the distance of a non existent Ai to be above 35m.

A way to detect NULL in general would be great. Thank you.

Share this post


Link to post
Share on other sites

You could have to make your eject script only work on the host machine would that help would stop people ejecting like 3 times or such.

there is probably a way to do what you ask i will look in to it unless someone gets here before me.

Share this post


Link to post
Share on other sites

Ok this is probably a verry bad way to do it and there is a mich simpler way to do it but...

im a script novice at OFP.

ok you have your eject script running on your host machine say...

then you get all client machines to broadcast the players names to the host script.

then you loop through all the people in your group...

and if the name does not match one of the ones in the list...of players in your game

that person is AI controlled...

But then again if someone gets disconnected it wont work...

Best ignore me and wait for a script guru smile.gif

Share this post


Link to post
Share on other sites

Hello...

What I do not get is why do u check the distance of null units?

Just create a list of units inside the chopper, with the crew command, and removing pilot and gunner of the chopper (you have to give them a name :

unitsInChopper= (crew chopper1) - [chopperPilot, chopperGunner]

unitsInChopper will contain the list of units inside the chopper, without counting disabled AI, as they are not inside smile.gif

Share this post


Link to post
Share on other sites

whisperFFW06,

That is a damn good Idea. It should work, but then I'll have to go through the exercise of naming the chopper pilot, and MG. Then wouldn't I have to start them seperately from the chopper? And, if I did that, wouldn't that mean that I couldn't start my chopper in the air flying? And, that would lead to problems where the chopper isn't in the right position when the camera shifts to it, and so on. Maybe I'm wrong, but I might give myself new problems doing it that way.

And, Azz, how? how do I make it only execute on the host? That would solve a lot of problems and not just this one. However, I wonder, wouldn't that make the client computers think they're still in the chopper?

This would be great if the "Alive" function worked.... I guess I'll have to set up another array of booleans and then use them both to determine who is used and who is unused. *sigh*

I'll still look at the thread for the next few days for another idea. Please feel free to let me know.

Share this post


Link to post
Share on other sites

Kenji, to name pilot and gunner, in the init field of your chopper, put :

chopperPilot=pilot this; chopperGunner=gunner this

and you have a flying chopper with named pilot and gunner smile.gif Isn't it a beautiful world? biggrin.gif

Whis'

Share this post


Link to post
Share on other sites

F'in A! I actualy never had to define both of them, I just captured them before I placed my team in them. Like this:

;script in Intro

_unusedPlayers = _unusedPlayers + (crew InsertionChopper)

"_x MoveInCargo InsertionChopper" forEach [a1,a2,...]

usedPlayers = (crew InsertionChopper) - _unusedPlayers

now my "usedPlayers" variable is a valid array of all the valid players. :-) thank you very much for the steer in the right direction whisperFFW06, and thank you Azz for the tips as well.

Thanks guys

Keywords: DisabledAI, Alive, IsNull

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  

×