Jump to content
Sign in to follow this  
kittycat

random selected positions?

Recommended Posts

How to set a random position for someone at mission start (selected from a few different positions)

Share this post


Link to post
Share on other sites

dont know if this is what you mean but here is how I would do it.

it but it works but dont know if there is a easier way to do it smile_o.gif

I have created a group with 3 different leaders

lead1

rank: Sargent

probability of presence 33%

Init: deleteVehicle lead2;deleteVehicle lead3;

lead2

rank: Sargent

probability of presence 50%

Init: deleteVehicle lead3;

lead3

rank: Sargent

probability of presence 100%

Init: deleteVehicle lead3;

and then I have grouped them all to lead1 and added 2 riflemen to the group that spawn in formation, the 2 riflemen has the rank of private so that the other units always will be leaders if they are present

the 3 different leaders can be placed around the map and the riflemen do spawn along the leader.

you can try out my demo mission, you can download it here

hope you can use it. smile_o.gif

Share this post


Link to post
Share on other sites

Would using an array of different position go too? The game should select one random

Share this post


Link to post
Share on other sites

I can make one of those too if you would like it, but with the way above you get around scripts

here is a random position script it uses markers for the positions

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_group = _this select 0;

_positions = _this select 1;

_selectedPos = random (count _positions);

{_x setPos getMarkerPos (_positions select _selectedPos);}forEach units _group;

if(true)exitwith{};

this is how its used through the editor

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul = [group sfLead,["p0","p1","p2"]] execVM "randomPos.sqf";

Share this post


Link to post
Share on other sites

I was looking for

this setposistion (random selection)

but I dont know how to use "random

Share this post


Link to post
Share on other sites

Try this in the init line of your unit:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">posarr=[pos1,pos2,pos3]; this setPos getPos (posarr select (random (count posarr)))

pos1,2,3,etc. would be the names of different game logics that are used to define random positions.

Share this post


Link to post
Share on other sites

hehe okay that was a easy way too :-)

I have just changed it so that you can move the hole group

still using gameLogic's use this in on of the members of a group

posarr=[pos1,pos2,pos3];rPos = random (count possarr); {_x setPos getPos (posarr select rPos);}forEach units group this;

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  

×