Is it possible to have a script delete an item once it's been used?

So, like this then?

_vehicle_158 = objNull;
if (true) then
{
infoArray [] = {
[1,1],[2,2], ... ...[100,100] };

randomloc = infoArray select (round (random 100));
_this = createVehicle ["Infostand_2_EP1", randomloc, [], 0, "CAN_COLLIDE"];
_vehicle_158 = _this;
};
 
I'll get corrected if I'm wrong but the array might need To be more like this:
infoArray [] = {
[x,y,z],
[x,y,z],
[x,y,z]
};

_rndloc = infoArray select (round (random 100));

And like he said, use the _rndloc as your pos in the createvehicle call.
I'm typing in my phone so it's taking me forever. Lol
 
_vehicle_158 = objNull;
if (true) then
{
infoArray [] = {
[dir[x,y,z]],
[dir[x,y,z]],
[dir[x,y,z]],
etc, etc, etc };

randomloc = infoArray select (round (random 100));
_this = createVehicle ["Infostand_2_EP1", randomloc, [], 0, "CAN_COLLIDE"];
_vehicle_158 = _this;
};

Is that right?
 
Pretty sure that would work. But trial an error is a friend sometime. Blanks will know more off the top of his head more than me.
I would just choose 3 locations close by and just test it.
 
if (isServer) then {

_vehicle_158 = objNull;
if (true) then
{
infoArray [] = {
[131.777,[8245.4,15465.1,0.0014081]],
[139.382,[8248.62,15468.3,0.00139236]],
[143.029,[8252.6,15472.2,0.00144339]]
};

randomloc = infoArray select (round (random 3));
_this = createVehicle ["Infostand_2_EP1", randomloc, [], 0, "CAN_COLLIDE"];
_vehicle_158 = _this;
};
};

This is what I just tested, and this is the error it spat out :(

14:17:06 Error in expression <8 = objNull;
if (true) then
{
infoArray [] = {
[131.777,[8245.4,15465.1,0.001408>
14:17:06 Error position: <[] = {
[131.777,[8245.4,15465.1,0.001408>
14:17:06 Error Missing ;
14:17:06 File z\addons\dayz_server\buildings\random_info.sqf, line 6
 
It might have to do with the format of the location array. Double check the createvehicle format and how to apply location with direction.
 
No, that's it. What I just tested is in a file called random_info.sqf that I made and called from the server_monitor.sqf
 
Same deal.

14:44:08 Error in expression <8 = objNull;
if (true) then
{
infoArray [] = {
[8245.4,15465.1,0.0014081],
[8248>
14:44:08 Error position: <[] = {
[8245.4,15465.1,0.0014081],
[8248>
14:44:08 Error Missing ;
14:44:08 File z\addons\dayz_server\buildings\random_info.sqf, line 6
 
I'll get corrected if I'm wrong but the array might need To be more like this:
infoArray [] = {
[x,y,z],
[x,y,z],
[x,y,z]
};
https://community.bistudio.com/wiki/Position
Positions in Arma could be either 2D, in which case it is in format [x,y], where x is the coordinate on the SouthNorth axis and y is the coordinate on WestEast axis, or 3D, in which case it is in format [x,y,z], where z is the height. The height relative to exactly what differs depending on the format of 3D position used.
 
Your positions are wrong
[131.777,[8245.4,15465.1,0.0014081]],
[139.382,[8248.62,15468.3,0.00139236]],
[143.029,[8252.6,15472.2,0.00144339]]

a position object is X, Y, Z (or X,Y as we saw) ... the vector is not part of the position
after creating your infostand you will align its direction with setdir.

Oh yah, that was already stated .. :oops:
 
i cant seem to figure out why hes getting a missing ; error though.
yea im confused as shit righ tnow. too many beers i guess.
 
the code for teh array I posted initially is wrong.

try this: No need for the if(true) either.
oops, edited it again, forgot the enclosing [ ]
Code:
if (isServer) then {
infoArray = [[8245.4,15465.1,0.0014081],[8248.62,15468.3,0.00139236],[8252.6,15472.2,0.00144339]];

randomloc = infoArray select (round (random 3));
_this = createVehicle ["Infostand_2_EP1", randomloc, [], 0, "CAN_COLLIDE"];

};
 
the take away message from this abortion of simple code is:
  1. Do not write code/forum posts on your cellphone.
  2. Do not write code/forum posts after midnight.
  3. Do not write code/forum posts after a 6pack ..
I am only guilty of #2 ...
 
haha. right?
im on my puter now. and i still didnt get it right. so i just went with this..
_vehicle_157 = objNull;
if (true) then
{
_this = createVehicle ["Infostand_2_EP1", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_vehicle_157 = _this;
_newpos = floor (random 3);
if (_newpos == 0) then {
_this setPos [4590,10145,0];
_this setDir -90;
};
if (_newpos == 1) then {
_this setPos [4600,10145,0];
_this setDir -180;
};
if (_newpos == 2) then {
_this setPos [4610,10145,0];
_this setDir -270;
};
};
 
that works .. of course there is still the surrounding if (true) block that does nothing useful.
The flow control method for this would be a switch statement though. It works same as what you have but purists would argue its more readable ..


Code:
_this = createVehicle ["Infostand_2_EP1", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_newpos = floor (random 3);
switch(_newpos) do {
case 0:{_this setPos [4590,10145,0];_this setDir -90;};
case 1:{_this setPos [4600,10145,0];_this setDir -180;};
case 2:{_this setPos [4610,10145,0];_this setDir -270;};
};
 
Back
Top