Jump to content
Sign in to follow this  
lone.wolf

Roe for ai.

Recommended Posts

Hi there,

A question about AI script...

Is it possible to make the AI dont open fire on other AI or player if they aint ARMED, even though the are from opposising side.

Its for a mission where i want the player to enter a city unarmed and find weapons inside...

If my question isnt unstandable plz tell me and i will try to explain it diffently..

Thanx!

Share this post


Link to post
Share on other sites

The easy, yet effective, way:

Create a script file, f.i: captive.sqf, and launch it from init.sqf in mission: execVM "captive.sqf";

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">removeAllWeapons player; // removes all weapons and magazines

player setCaptive true; // makes the player appear as if he's captured. Enemies will not engage.

waitUntil { count (weapons player) > 0 }; // Wait until the player has 1 or more weapons

player setCaptive false; // disable captured mode

If it must work constantly, so throughout the whole mission if player drops all his weapons he will not be engaged, if he picks up a single or more weapons, he will be engaged again, and so on:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while { true } do

{

waitUntil { count (weapons player) == 0 }; // Wait until player has no weapons

player setCaptive true; // makes the player appear as if he's captured. Enemies will not engage.

waitUntil { count (weapons player) > 0 }; // Wait until the player has 1 or more weapons

player setCaptive false; // disable captured mode

sleep 0.5;

};

to make it work for any other type of unit, exchange "player" with "_this", and start the script with: unitName execVM "captive.sqf";

unitName should be the editorname of the wanted unit

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  

×