Jump to content
Sign in to follow this  
Joe98

How to start 10 meters from a box?

Recommended Posts

I place a box on the map and name it box1

I place 3 markers on the map and group them with the box.

Every time the mission starts, the box will start at random on one of the 3 markers.

I place a soldier on the map and name him blue1.

In the soldier’s int field I type blue1 setPos (getPos box1)

When the mission starts, the soldier will start on top of the box (which means he will start at one of 3 places at random). This all works just fine.

Instead of starting on top of the box:

1. How do I start him 10 meters from the box

2. How do I specify he starts north east of the box.

.

Share this post


Link to post
Share on other sites
1. How do I start him 10 meters from the box

Assuming you mean 10 meters in a random direction, I'm pretty sure doing a random placement would require a small script.

2. How do I specify he starts north east of the box.

This will place "blue1" 10 meters North and East of box1:

blue1 setPos [(getPos box1 select 0) +10 (getPos box1 select 1) +10, 0];

Share this post


Link to post
Share on other sites

//Get a random area near the box
_target = box1;
_dist = 10; // 10 meters from the box
_dir = random 360; // random direction around the box
_pos = getpos _target;
_position = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0];

blue1 setPos _position

I use this script for pretty much the same effect on my randomized ammobox. :)

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  

×