Jump to content
shuko

SHK_startingPositionRandomizer

Recommended Posts

Since you guys insist on using my silly scripts, I've been forced to update this one as well. As usual, it's a port from A2, so it's most likely buggy, and certainly hard to use! ;)

The Arma 2 thread

SHK_startingPositionRandomizer.sqf

SHK_startingPositionRandomizer.Stratis.zip

Example video made for Kyllikki members

 Randomly selects a location for each side from predefined, editor placed, markers.

 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). What this means is that you should place your
   objects around/on top of the first marker.

   For example, if the randomizer decides that the starting position is startpos_east_2 instead of
   startpos_east. All the objects will be moved and placed to same direction and distance from
   the position 2 marker that they were from position marker startpos_east.

 Marker naming:
   All markers need to start with "startpos", following an underscore and side. Then an underscore
   and an incremental integer. Only exception is the first marker, it has no number.

   Examples:
     startpos_east
     startpos_east_1

     startpos_west
     startpos_west_1
     startpos_west_2

   Tip: if you first create the marker without number, you can copy & paste that and rest of the
   markers will be named correctly.

 Supported sides:
   "east", "west", "guer", "civ"

 Syntax:
   [["side",number,<objectrange>,[]],["side",number,[object1,object2],["color","type","text"]],...] call compile preprocessfile "SHK_startingPositionRandomizer.sqf"

 Parameters:
   0   String    One of the four sides.
   1   Integer   How many possible positions (markers) there is for this side.

 Optional parameters:
   2   Number    Range in meters from the first marker to move all vehicles etc objects.
       Array     List of objects to move besides playableunits.
   3   Array     If given an empty array ([]) a green "Start" type marker will be shown at the selected starting position.
                 Settings to define the appearance of the start marker.
                 0  Color  Valid colors: black, blue, green, orange, red, white, yellow
                 1  Type   Marker types: [url]http://community.bistudio.com/wiki/cfgMarkers[/url]
                 2  Text   Optional. Text to display next to the marker.

 Examples:
   [["west",3]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf"
   [["west",3],["east",2]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf"
   [["west",2,20],["east",5,[car1,truck4]]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf"
   [["west",3,0,[]]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf"
   [["west",3,50,["blue","b_inf","Infantry"]]] call compile preprocessfile "SHK_startingPositionRandomizer.sqf"

 Briefing:
   If marker parameter(s) is defined for a side, a marker with name "startpos" is created at the starting location.
   This marker will be different for each side, but has same name on each client, which means you can link to this marker
   in briefing and/or notes and it will point to a location of the player's starting position.

Edited by Shuko

Share this post


Link to post
Share on other sites

Arma 3 release frontpaged on the Armaholic homepage.

===================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Thanks for taking the time to work on this for ArmA 3!

This is probably not the ideal fix for the "players not moved" issue, but it's working for me as of A3 Beta 0.77. It takes a similar tack to Meatball's fix from the ArmA 2 thread, in that it trusts the client to move the local player to the new spawn position. Here's the diff and full SQF file as a GitHub gist:

https://gist.github.com/raws/6407872

Hopefully someone finds this useful as an interim fix, though I'll understand if not :)

Share this post


Link to post
Share on other sites
Hopefully someone finds this useful as an interim fix, though I'll understand if not :)

Thats very nice of you, thank you.

Originally server was made to move them so that briefing location would be correct already. However, if it doesnt work with A3, then making client move has to be enough.

I've uploaded a version with your changes until I or someone thinks of a solution.

Share this post


Link to post
Share on other sites
Thats very nice of you, thank you.

Originally server was made to move them so that briefing location would be correct already. However, if it doesnt work with A3, then making client move has to be enough.

I've uploaded a version with your changes until I or someone thinks of a solution.

Is this to move "players" as well in MP environment? In the version I'm using I am having issues like that in that AI is moved but not actual players.

---------- Post added at 17:06 ---------- Previous post was at 16:34 ----------

Shuko, your v0.3 script has issues. You have SHK_randstapos_fnc_move defined yet calling SHK_fnc_move in the client side parts which doesn't exist. I think you want SHK_randstapos_fnc_move there. I am going to test with that change and see. ​Update: Just tested and that seems to do the trick.

Edited by Delta99

Share this post


Link to post
Share on other sites

Version 0.4: Rewritten to use BIS_fnc_MP function.

All the bug reports are more than welcome. :)

Share this post


Link to post
Share on other sites
Version 0.4: Rewritten to use BIS_fnc_MP function.

All the bug reports are more than welcome. :)

I haven't looked at the code yet but does this mean one should only call it server side?

Share this post


Link to post
Share on other sites

New version frontpaged on the Armaholic homepage.

===================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites
I haven't looked at the code yet but does this mean one should only call it server side?

No, call it in init.sqf, because it has functions which client needs to load.

Share this post


Link to post
Share on other sites

Yet another rewrite as it's hard to be happy. Realized that I needed to change two things: I was sending unnecessary data (info the client already had access to) over the net and the fnc_MP is, in this case, overcomplicated when a simple PV will suffice. Plus, either I don't know how to use it, or there's something fishy about getting it to run the called function on server as well. Anyway, let's hope this will do for a while.

Oh and, since I needed to know which position the team was moved to in one of my missions, I added a global variable to hold that info. It's a simple array with numbers.

For example:

Our init.sqf script starting parameters are: [["west",4],["east",3]] call compile preprocessfilelinenumbers "SHK_startingPositionRandomizer.sqf";

The west would be placed in either 0 (original position), startpos_west_1, startpos_west_2 or startpos_west_3 marker position. And east would do same for 0, 1 or 2.

The SHK_RandStaPos_RandomResults array would hold the selected position number in the same order as the parameters. Meaning the first value would be for west and second for east. Let's say the random picked 2 as the west's starting position and 1 as east's. The variable would look like: [2,1]. You can use that to create the marker name with format command and get position of it.

Version 0.5

- Another rewrite to get rid of BIS_fnc_MP and use much simpler publicvariable solution instead.

- Amount of data send is decreased.

- Now the server randomized positions are accessible via global variable on clients.

Share this post


Link to post
Share on other sites

That's great. One of my biggest challenges with the original script was to figure out how to handle passing that randomly selected location to other players and be able to spawn JiP players in later in mission at the same random location the rest of the players started at.

Edited by Meatball

Share this post


Link to post
Share on other sites

Shuko, why did you even bother with changing to use fnc_MP stuff since the version previous to that worked perfectly fine it seemed.

Share this post


Link to post
Share on other sites
Shuko, why did you even bother with changing to use fnc_MP stuff since the version previous to that worked perfectly fine it seemed.

I was very very tired and lazy that evening. :)

Share this post


Link to post
Share on other sites

Is possible to use this script to just move all the sides between a given number of start locations?

What modifications should be made to acomplish that.

Share this post


Link to post
Share on other sites

[["west",4],["east",3],["guer",3],["civ",5]] call compile preprocessfilelinenumbers "SHK_startingPositionRandomizer.sqf";

Number is the amount of different starting positions for that side.

Share this post


Link to post
Share on other sites
[["west",4],["east",3],["guer",3],["civ",5]] call compile preprocessfilelinenumbers "SHK_startingPositionRandomizer.sqf";

Number is the amount of different starting positions for that side.

Yes I know that, but you need various startpos_side_i markers for each side and then the script do 1 selection for each side. I want to place all the sides in a global random selection of 4 start positions for all sides at once.

startpoint, startpoint_1, startpoint_2, startpoint_3 and the four sides start randomly in any of those for places.

I explain the whole thing.

I will post a general desing aobut 1 of the desings i have in mind. The first one and the easies is an Infantry MP game mode similar to Red Orchestra or Day of Defeat.

The Place.

I just about building a town in altis between Zaros and Therisa towns. It is a flat area of altis with some earth roads with no buildings and a size of 1.1 x 1.1 kilometers, so it could fit for my pourposes.

RlPvFPG.jpg[/img]

Gameplay.

As I said I want 4 teams NATO CSAT AAF and FIA (civilians with FIA gear).

Start Points should be selected at start at random.

Max Players As the game mode is designed only for infantry maybe it can handle lots of players maybe 20 players per team, 80 players in game.

Objective: Capture the town. The town should have 12 Points represented with 12 High capturable Buildings. Yellow squares at image.

Respawn. I would like to have a Wave respawn, as Red Orchestra or Day of Defeat, the first teammate who dies start a countdown and at the end of the countdown all the dead players of the team respawn at once.

Respawn Point The respawn points are moving from the start position to a closer position to the captured zones the team already have, so the teams are pushing each other outside of the town.

Wining Condition: The team that capture 7 of the 12 Capturable buildings win the match.

I am waiting for x-cam mod or the BIS 3D Editor to start doing the town. I tryed once with zeus giving something like this.

VUVE6PN.jpg[/img]

If someone could give me some lessons to achieve something like that the help ould be welcome.

Share this post


Link to post
Share on other sites

Your idea doesn't really have anything to do with this script. You should be looking into moving the respawn markers.

Share this post


Link to post
Share on other sites

The start positions where the flag markers are, should be created randomly at start. That's the first thing I want to do, then the respawns.

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

×