Jump to content
Sign in to follow this  
ben_s

Spawning Units?

Recommended Posts

No need for scripts for random spawn. Simply group your squad with one or more markers. You'll spawn either where you're placed in the Editor or at one of the grouped marker locations automatically.

I knew someone was going to tell me that. But, 'that's' my fault, because I was not more clear.

I want an initial, random spawn position without using markers. Isn't there a way to do that? Currently, on a patrol mission, I just have random troops placed and spawning over the entire map of Takistan. These troops (and vehicles) are using USPS to get placed at mission start, and so is my squad. But, when I spawn in, the first thing I have to do is get rid of my first waypoint, which is annoying.

BTW, I wonder if USPS is using a marker for the initial spawn. I really am not sure from looking at the script. I guess it has to?

Share this post


Link to post
Share on other sites

So do you want an entirely random starting spot, or a "random" starting spot in a specific area or something?

Share this post


Link to post
Share on other sites
So do you want an entirely random starting spot, or a "random" starting spot in a specific area or something?

Hi, kylania. ... An entirely random starting point. Yes, you can say a random starting point in one area... in this case, that area being the entire map of Takistan.

I placed one maker as close as I could to dead center in Takistan, with an axis of 6000x6000, and was trying to figure out how to spawn in randomly with my squad.

EDIT: BTW, thanks again for the vid, but at the 2 minute mark, you lost me. Heh. I played that thing over sooo many times.

EDIT: Man, I have been in the editor sooo long, everywhere I go on the Internet, I am trying to navigate by 'dragging' my mouse!

Edited by CyOp

Share this post


Link to post
Share on other sites

I read that thread. More than once, actually. I do not remember anything simple that I could use. Again, this is just for my squad. (I will read it again.)

That has been my prob. I can find (complicated) scripts like what are in that thread, but nothing simple.

Darn, that thread made my head hurt! ... Remember, I barely know anything, about anything, and know pretty much noth'n about everything (in regards to scripting). I just want 1 random spawn, for me and my squad, one time, at mission start, I know that much! ;)

Edited by CyOp

Share this post


Link to post
Share on other sites

Place your player on the map at 070066, save shk_pos.sqf to your mission folder and call it like this from your init.sqf:

SHK_pos = compile preprocessfile "SHK_pos.sqf";
player setPos ([getpos player, random 360, [10, 7000]] call SHK_pos);

Share this post


Link to post
Share on other sites

kylania, thanks.

But, I need the syntax for using this with a group. I tried just using the group name, and then looked through the script. The first did not work, and I see nothing about group in the script.

I am going to DL the shk original. Maybe there is something in there about groups.

Share this post


Link to post
Share on other sites

Well, I cannot get 'it' to take my group with me. They are always left at the original placement position. I tried different variations of group and forEach, but no go. EDIT: Every SHK_pos script I find on the Internet has 'player' in it. ... Oooops, I posted again. Sorry.

Edited by CyOp

Share this post


Link to post
Share on other sites

Just teleport them with! :)

Add this just below in your init.sqf:

teleportedGroup = units group player - [player];
{_x setPosATL [getPosATL player select 0, getPosATL player select 1, 0];} forEach teleportedGroup;
sleep 1;
commandStop units group player;

Edited by kylania

Share this post


Link to post
Share on other sites

Ha, good one. I did not think about teleport. I will go try that. Thanks for your continued support. :)

EDIT: It worked, but it did not work. Some units were still AWOL. Heh. A short sleep cured it, though.

EDIT: OK. After a little more testing, this is what I settled with:

SHK_pos = compile preprocessfile "RandomSpawn\SHK_pos.sqf";
player setPos ([getpos player, random 360, [25, 4500]] call SHK_pos);

sleep 1;

teleportedGroup = units group player - [player];
{_x setPosATL [getPosATL player select 0, getPosATL player select 1, 0];} forEach teleportedGroup;

It works, but with a couple of troops 'getting there' a little slow. I am content, though. Waaay better than having to get rid of an uneeded waypoint at mission start.

And, kylania, I am sure you know your stuff, but there was a missing ; . ... BTW, how did you come up with 070066?

Edited by CyOp

Share this post


Link to post
Share on other sites

This is something I have never got to grips with, spawning units :confused:

I'm using your code kylania, and for the TK side it's fine, but I can't get it working propperly using Guerillas.

GroupSquad1 = [getMarkerPos "Squad1", east, ["GUE_Soldier_MG","GUE_Soldier_Medic","GUE_Soldier_AT"]] call BIS_fnc_spawnGroup;

Using this it spawns 3 Guerilla \ Independent units, but their alligned to East, and I have tried using Independent and Guerillas for the side they should spawn alligned on, but nothing works apart from east.

Also second point, if I have a selection of Independent units spawning as a group, most of them tend to kill each other the second their spawned ?!?!

Share this post


Link to post
Share on other sites

Side for independent/guerillas is called resistance. Go figure. :)

Share this post


Link to post
Share on other sites
And, kylania, I am sure you know your stuff, but there was a missing ; . ... BTW, how did you come up with 070066?

Oops! Fixed!

I think I came up with 070066 since it was basically the middle of the map. :)

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  

×