Jump to content
Sign in to follow this  
shuko

SHK_startingPositionRandomizer

Recommended Posts

What does this one do?

It picks randomly a position based on preplaced markers and moves units there. Places are defined for each side, there can be different number of them for each. A start marker is created at the position, only shown for players on the specific side.

What about all my vehicles, tents etc to which I've used thousands of hours to place precisely?

It moves them as well, remembering all the relative positions.

Is it hard to use?

Yes.

Where do I get it?

SHK_startingPositionRandomizer.sqf

SHK_startingPositionRandomizer.rar with example mission

Usage instructions:

IMPORTANT!

The positions of all units and objects to be moved are based on their relative position to the

first marker (for example startpos_east_1). What this means is that you should place your

objects around/on top of the first marker.

For example, the randomizer decides that the starting position is startpos_east_2 instead of

startpos_east_1. All the objects will be moved and placed to same direction and distance from

the position 2 marker that they were from position marker 1.

-------------------------------------------------------------------------------------------------

Marker naming:

All markers need to start with "startpos", following an underscore, side or faction. After

those are an underscore and an incremental integer. First number is 1.

Examples:

startpos_east_1

startpos_west_1

startpos_usmc_3

startpos_guer_2

-------------------------------------------------------------------------------------------------

Valid sides and factions:

Sides:

"civ"

"east"

"guer"

"west"

Factions:

"civ_ru" (the normal civ faction is named civ, which is same as the civilian side)

"cdf"

"gue"

"ins"

"ru"

"usmc"

-------------------------------------------------------------------------------------------------

Syntax for all sides having same amount of possible location:

[number] call compile preprocessfile "SHK_startingPositionRandomizer.sqf";

Example:

[3] call compile preprocessfile "SHK_startingPositionRandomizer.sqf";

-------------------------------------------------------------------------------------------------

Parameters for sides having different amount of possible location:

[[side or faction,number],[side or faction,number]]

Example:

[["east",2],["west",3]]

[["usmc",2],["cdf",3],["east",5]]

If the values given contain both faction and side to which a unit belongs to, the one which is given first is used.

Example:

[["usmc",2],["west",3]]

In this example the unit will be moved to the usmc location instead of the west.

-------------------------------------------------------------------------------------------------

Parameters to move more objects than just players, for example empty vehicles or ammo crates:

Valid ways to pass objects:

- Listing their names

- Name them similarly and give the name "tag" and count of them

[side or faction,number,[objName1,objName2,[objNameTag,count of objects]]]

Example:

[["east",2,[uaz,truck,["eastobject",2]]],["west",3,[hmmvee,aav,["weststuff",3]]]]

In this example objects which will be moved are:

uaz, truck, hmmvee, aav and eastobject_1, eastobject_2, weststuff_1, weststuff_2 and weststuff_3

-------------------------------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

Moving my conversation from the wrong thread.

------

I'm using the old "SHK_randstapos.sqf" you had published a while back. I've made no changes to the actual script itself, and I'm calling it as the first line in my init script with:

[["west",10,[heliStart,heliKiller]]] call compile preprocessfile "shk_randstapos.sqf";

My mission has 8 units the players can choose from (not all of them may be in every game). I've also pre-populated the map with a bunch of startpos_west markers (startpos_west, startpos_west_1, startpos_west_2...) like you said to do in the script instructions.

If I'm running the server, my player is moved, along with the two named helicopters listed above, yet if anyone else plays while I'm running the server, when the mission stats, my unit and the helicopters have moved correctly to the randomized location, but the other players spawn in the original location all the units were (startpos_west) in the editor.

Share this post


Link to post
Share on other sites

It is a JIP issue

I had the same issue a long time ago , i cannot remember where that mission is now but i am sure this will solve it

INIT.sqf

if ((side player) == WEST) then {	
player setpos (getPos siteObjects );
};

Share this post


Link to post
Share on other sites

Yeah, I tried that, but no go. I assume when you said siteObjects you meant to create an object and add it to the move call for randstapos. I added a wrench in the editor, called it startMoveObject, and put that as something to move with the move call. Then did the setpos on the getpos on the wrench. Had a friend test it out with me and he still spawned at the original location while I ended up at the randomized site.

If I add in AI, they do all move, it's just other players.

---------- Post added at 20:50 ---------- Previous post was at 19:22 ----------

Alright, I _think_ I know where the problem lies, I just don't have the slightest idea how to fix it. In the script after all the 'isserver' code, in the 'else' block, that code is actually running on the other players machines (I stuck a hint in there and they saw it pop up). Maybe this code no longer works in Arma 3?

} else {
 _this spawn {
   private ["_s","_m","_p"];
   waituntil {!isnull player};
   waituntil {!isnil "SHK_randstapos_selected"};

   _s = tolower(str(side player));

Just a guess.

Edited by MeatballCB

Share this post


Link to post
Share on other sites

Alright, I made it work, but it's a total kludge :)

First I created a publicVariable up in the server side script of the randomly generated number in the _rand > 0 section with the following:

spawnRand = _rand;

Then I forced that to a be a public variable at the end of the server block with:

publicvariable "spawnRand";

Then down in the client else block I added the following (lines 4-6 below):

_this spawn {
   private ["_s","_m","_p"];
   waituntil {!isnull player};
   waituntil {!isnil "spawnRand"};
_newPos = getmarkerpos format ["startpos_west_%1",spawnRand];
player setPos [((_newPos select 0) + (random(20)-10)), ((_newPos select 1) + (random(20)-10)),0];

It works, it's a mess, but it works. Player as the server actually sees the other players on the intro map in the wrong location until they fully load in, then it appears to update, but everyone spawns near each other.

Share this post


Link to post
Share on other sites

what is the difference between this long script and this easy version? to make it spawn randomly in some area just increase radius of marker.

Share this post


Link to post
Share on other sites

What you pointed to is respawn. So, when players die, that will control where/how they respawn. What this script does is set the location the players start in the first place, and let's you randomize it among a bunch of locations so it changes every time. If you want the players to always start in the exact same location, then you don't need this script.

Share this post


Link to post
Share on other sites

Wish I had noticed this earlier!! Thanks for releasing it!!

Is it hard to use?

Yes.

ahahahaha this made my day

Share this post


Link to post
Share on other sites

Still loving this script, but running into one issue I can't seem to figure out. I have about 10 points the players can randomly start from. I'm also having the players 'insertion' chopper being moved with the players with the following in the init.sqf:

[["west",11,[heliStart]]] call compile preprocessfile "shk_randstapos.sqf";

heliStart is a Ghosthawk I have set Flying near the players. Problem is, unless the players are randomly put at the first location, the helicopter starts on the ground, which in some locations may place it on top of rocks or trees, etc and it blows up. I've tried setting 'this flyInheight 40;" in the helicopter's init, but the heli still starts on the ground everywhere other than the primary 'startpos_west' marker.

Share this post


Link to post
Share on other sites
Still loving this script, but running into one issue I can't seem to figure out. I have about 10 points the players can randomly start from. I'm also having the players 'insertion' chopper being moved with the players with the following in the init.sqf:

[["west",11,[heliStart]]] call compile preprocessfile "shk_randstapos.sqf";

heliStart is a Ghosthawk I have set Flying near the players. Problem is, unless the players are randomly put at the first location, the helicopter starts on the ground, which in some locations may place it on top of rocks or trees, etc and it blows up. I've tried setting 'this flyInheight 40;" in the helicopter's init, but the heli still starts on the ground everywhere other than the primary 'startpos_west' marker.

That is because the script uses setpos command (obviously as there's nothing else) to move everything.

Here you go: http://forums.bistudio.com/showthread.php?162423-SHK_startingPositionRandomizer

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  

×