Jump to content
Sign in to follow this  
XSOF - Toxx

Spawn an AI soldier next to me

Recommended Posts

Hey,

please, why does this not work? Tried to keep it as simple as possible:

[getPos player, WEST, 1] call BIS_fnc_spawnGroup;

Cheers

Toxx

Share this post


Link to post
Share on other sites

Your syntax looks OK; it could be that the function tried to run before the BIS_fnc's were initialized. Try putting the following code in front of that line:

waituntil {!isnil "bis_fnc_init"};

Another method to create an AI unit is to use the following command:

unit = group player createUnit ["B_Soldier_F", getPos player, [], 0, "FORM"];

Additionally, you can create a random unit from a defined array of unit types:

unitList = ["B_medic_F","B_soldier_AR_F","B_Soldier_F","B_Soldier_GL_F"];
unit = group player createUnit [unitList select (round(random ((count unitList) - 1))), getPos player, [], 0, "FORM"];

Share this post


Link to post
Share on other sites

Thanks a lot skimmer! The createUnit function method works perfectly :)

Do you know how I can spawn the soldier depending on the side I am on? B_medic_F seems to be a blufor soldier. When I'm OPFOR I want the equivalent OPFOR soldier to spawn.

---------- Post added at 10:18 PM ---------- Previous post was at 10:06 PM ----------

Ahh got it :)

Easier than I tought, this will do for me:

unit = group player createUnit [typeOf player, getPos player, [], 0, "FORM"];

Thanks again! Thread marked as solved.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×