Jump to content
Sign in to follow this  
strike0277

Several Questions.

Recommended Posts

I have several questions;

-How do I spawn in AI? (I know there are scripts, but thought I read somewhere there is a bis function I could throw in to a trigger)

-Is there any way I can set up the SpecOp with a trigger?

I have more, but I can't think of them now. thanks for any help guys.

Share this post


Link to post
Share on other sites
-How do I spawn in AI?

Simple. In the editor, double click on the unit you want to spawn as, and in the unit box find the "Control" option. Click on it, and set the unit as "playable". Then while ingame, press "T" to bring up the team switch window, and then click on the AI unit's name to spawn as him.

Or... have I missinterpreted your question?

Share this post


Link to post
Share on other sites
Simple. In the editor, double click on the unit you want to spawn as, and in the unit box find the "Control" option. Click on it, and set the unit as "playable". Then while ingame, press "T" to bring up the team switch window, and then click on the AI unit's name to spawn as him.

Or... have I missinterpreted your question?

I was referring to spawing in enemy ai groups.

Kylania is there any way you can clarify how to use what you put down? I'm not sure how to make it work. Do I put down a trigger and the commands in it's init line? And how do I put in the center?

Share this post


Link to post
Share on other sites

If you wanted to spawn groups, you can use the BIS Function BIS_fnc_spawnGroup. That's probably easiest maybe.

Otherwise, here's how I spawned a group of 4 CZ special forces in a recent script:

// Create the troops to disembark.
_troopsList = ["CZ_Special_Forces_TL_DES_EP1","CZ_Special_Forces_GL_DES_EP1","CZ_Special_Forces_MG_DES_EP1","CZ_Special_Forces_Scout_DES_EP1"];
_troops = createGroup west;
{_t = _troops createUnit [_x, [1,1,1], [], 0, "FORM"]} forEach _troopsList;

I didn't have to create the center since I already had BLUFOR units on the map. If I'd had no preexisting units I could have used _blufor = createCenter west; before that code.

If I just wanted to spawn an OPFOR sniper team 300m in front of me when I didn't have any other OPFOR units on the map from a trigger I could do this in the onAct:

centerEast = createCenter east;  
sniperGroup = createGroup east;  
sniper = sniperGroup createUnit ["TK_INS_Soldier_Sniper_EP1", player modelToWorld [0,300,0], [], 0, "FORM"];  
spotter = sniperGroup createUnit ["TK_INS_Soldier_AT_EP1", player modelToWorld [0,300,0], [], 0, "FORM"];
west setFriend [east, 0];
east setFriend [west, 0];  

Note that I have to setFriend since no units existed, otherwise they'll not react to me. You could also replace the player modelToWorld[0,300,0] with something like getMarkerPos "spawnpoint" to make them spawn on the marker.

The one "gotcha" with triggers is that they run in all clients, so if this was multiplayer and I ran that code from a trigger and 10 people were connected I'd end up with 20 units being spawned! So what you'd want to do with trigger spawns is run a script instead and wrap the spawn code like this:

Trigger onAct: _nil = [] execVM "spawnSnipers.sqf";

spawnSnipers.sqf:

if (isServer) then {
   // code from above, using the getMarkerPos option.
};

Edited by kylania

Share this post


Link to post
Share on other sites

Thanks. I need to work it quick though. I have a unit op tonight at 7pm est but I'm working till 5 today..lol

I was thinking about the functions module as I'd read some where it could be done with that on the map and a trigger.

Edited by strike0277

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  

×