Jump to content
Dwevin

Object Random Spawn

Recommended Posts

I'm looking to make an ammo box spawn on some very specific predetermined locations. I placed this in the object's init and am sure that the variable name is set properly.

 

Quote

akCACHE setPos (selectRandom ["3158.96,5770.6,3.36632","3444.22,5934.86,6.1","3487.09,5941.93,5.83216"]); // I have a ton more locations in the array, 29 in total. I just chose not to put all for the sake not having a text wall. I double checked that all the " and , are positioned properly.

 

It's not giving me an error it's just simply NOT spawning some where else. It only spawns on it's default location, not one that is set in the array. I'm getting these locations by placing the object in eden, making sure it fits properly with out rotating it and right clicking to log the position. What am I doing wrong here?

Share this post


Link to post
Share on other sites

There is no reason to quote a position. Positions are arrays [ [3158.96,5770.6,3.36632],[3444.22,5934.86,6.1],[3487.09,5941.93,5.83216],...]

Share this post


Link to post
Share on other sites
56 minutes ago, pierremgi said:

[ [3158.96,5770.6,3.36632],[3444.22,5934.86,6.1],[3487.09,5941.93,5.83216],...]

Using this method gets rid of the errors how ever the box still hasn't moved. I'm not sure if it's the function not understanding this type of location or if there was something else I've done wrong.

Quote

akCACHE setPos (selectRandom [[3158.96,5770.6,3.36632],[3444.22,5934.86,6.1],[3487.09,5941.93,5.83216]]);

This is the new line that doesn't give me errors how ever just doesn't seem to work. 

 

Edit: 
Looking at setPos documentation it looks like it won't except 3d locations? But it'll take PosistionAGL which I'm not sure if that's something I can use. I will try using a 2D location here when I get a chance instead. See if that makes it move. It'll completely defeat the purpose of what I want to do if it works.
 

Edit 2:
I tried using setPosATL even tho it isn't supposed to work in arma 3, didn't work either.

Share this post


Link to post
Share on other sites
4 hours ago, Dwevin said:

I'm looking to make an ammo box spawn on some very specific predetermined locations. 

 

 

 

I presume you mean very specific predetermined RANDOM locations?  Is that right?  If so:

 

Place the ammo box on the map.  Click on the ammo box and empty the ammo box and then fill it with the required equipment.

 

Find a marker named:  Markers-System-Empty.  Place 5 of them on the map at very specific predetermined locations.

 

Right click on the box and select: Connect - Select Random Location and draw the line to the first marker. Do this for all the markers.

 

The ammo box will start at one of 6 locations at random. That is, its original location or one of the other 5.

 

.

 

 

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

setPos takes 3D locations, and a number of the examples on the wiki use z values. This line:

akCACHE setPos (selectRandom [[3158.96,5770.6,3.36632],[3444.22,5934.86,6.1],[3487.09,5941.93,5.83216]]);

Should work just fine, assuming you have named the object correctly (i.e. akCACHE). However, as the line is being placed in the object's init field, you can simply use this in place of the object's name, as this refers to that object. Hovering over the init field title (Init) gives you a tooltip that shows you various variables that can be used. Same goes for waypoints and triggers on their text fields.

 

Edit: setPosATL does work in ArmA 3. arma2_version.gif just means it was introduced in ArmA 2.

  • Like 3

Share this post


Link to post
Share on other sites

cache_1 allowdamage false;//cache_1 - name of ammo box, allowdamage to prevent damage during spawn
cache_1_pos_list = [[2792.17,5150.47,1.14975],[1935.53,4538.65,0.300816],[3371.74,4609.48,0.568662],[4854.12,4604.52,1.22188],[4956.52,4210.37,0.931324],[3472.92,4944.08,0.704975],[2864.42,4248.38,0.57999]]; 
//position - right click - copy position
cache_1_pos = selectRandom cache_1_pos_list;//select random position from list
cache_1 setPos cache_1_pos;// place on position
sleep 1; 
cache_1 allowdamage true;// allow damage 
//better to make all it as script and activate via init for example or anything else

  • Like 1

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

×