Jump to content

Recommended Posts

Hey,

Is there any way to make the AI stop doing anything after you stop controlling them? Specifically this time I'm wanting a helicopter pilot to stop changing his altitude after I switch to gunner. But also it's annoying when I'm trying to observe something like a flashlight or laserlight, so I turn it on as the character, and then switch to another character only for them to turn it off. I tried "disableAI" and I tried "stop", but no use.

Share this post


Link to post
Share on other sites

In order for the AI to leave the lasers and flashlight on they have to be set to setbehaviour "combat". You can also tell your team to use lasers and flashlights by selecting your team using (~), push number 6, then select laser or flashlight. But like I said their behaviour has to be combat.

Share this post


Link to post
Share on other sites

Is it possible to disable lots of AI without writing a book? I tried this [unit1, unit2] disableAI "anim" but sadly that command doesnt accept arrays. :(

Share this post


Link to post
Share on other sites

Sweet, thanks! ^^ May I ask where you learned this fancy command "structure".

Edited by ziiip

Share this post


Link to post
Share on other sites
{_x disableAI "anim"} forEach [unit1, unit2];

No, sorry, I did not research that 'line'. :o I am all searched out, and, since this is still on the first page, would you be so kind as to break that down. I am still trying to figure out old code from new, and what the variables are, etc. For instance, 'anim' would be all animations? (I like the wiki, but, for me, anyway, it's often confusing, and not always newbie friendly.)

Share this post


Link to post
Share on other sites

Well, disableAI "anim" will stop the AI unit from being able to change it's animation, not exactly prevent it from doing any specific ones.

The main parts to understand about that line are two things: _x and code blocks. The forEach command executes a code block (the text between the { } symbols for every element of the array (the values between the [ ] symbols) that follows it. The value from the array is held in the "magic" variable _x each time through. So what happens with that is that it runs two commands:

unit1 disableAI "anim"; then it runs unit2 disableAI "anim"; with the _x being replaced by unit1 the first run and unit2 the second run through.

Another example would be this in a unit's init field:

{this addMagazine "Handgrenade_West";} forEach [1,2,3,4];

It looks similar but works a bit differently. The units in the array (1,2,3 and 4) are simply there to "count" with. We want to give the unit 4 Handgrenades, so we put 4 numbers in the array so forEach runs 4 times. Since we don't care about the numbers we won't use _x this time, we'll just use this which in this case refers to the unit who's init field this code is run in. However, each step through _x would still be available and would equad 1, 2, 3 or 4 respectively for each step through the array.

Does that clear up anything for you?

Share this post


Link to post
Share on other sites

Well what about his original question? I have wanted this too. In helicopters you get where you want then you switch to gunner or whoever, then the helicopter raises back up to a higher altitude.

I don't think dostop or anything like that will work or writing any code for that unit. You may not know what vehicle you want to go in or switching between two different apaches so that they are set up in certain positions.

Is there a general kind of thing that you can script that lets your unit stay where it is after team switching. ESPECIALLY when you have a squad in stealth. It's no good to have a sniper team and you get in position and your AI spotter won't move where you want him, so you team switch and your original sniper unit stands up and starts shooting.

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  

×