Home   Help Search Login Register  

Author Topic: Problems with ammobox on dedicated server -- Issue resolved. its a"BUG"  (Read 2203 times)

0 Members and 1 Guest are viewing this topic.

Offline nuxil

  • Members
  • *
hello people.

i stumbled on a problem with ammoboxes and not sure how to solve this issue.

i have this script i call from support menu. "BIS_MENU_GroupCommunication"
and all seams fine. until i try to take ammo from it.
i can see in the ammobox the magazines. but i can not take any. its like the ammo box is locked.

here is my ammodrop script.

Code: [Select]

InitAmmoSupport =
{
if (isNil "WAsupport") then {WAsupport = true;publicVariable "WAsupport";};
if (isNil "EAsupport") then {EAsupport = true;publicVariable "EAsupport";};
if (isNil "GAsupport") then {GAsupport = true;publicVariable "GAsupport";};
};

AmmoSupport =
{
if ((!isServer) || (!isDedicaed)) exitwith {};
_caller = _this;
_pos = getpos _caller;
_x = _pos select 0;
_y = _pos select 1;
_z = 160;

_faction = faction _caller;
switch (_faction) do
{
case Wfaction :
{
if (WAsupport) then
{
[west,"HQ"] sideChat "Ammo drop on the way";
sleep 3;
private ["_ammobox","_para"];
WAsupport = false;
publicvariable "WAsupport";
_caller spawn AmmosupportTimer;

_para = "ParachuteMediumWest_EP1" createvehicle [0,0,0];
_para setpos [_x,_y,_z];
_ammobox = "USBasicAmmunitionBox" createvehicle [0,0,100];
_ammobox setpos [_x,_y,_z];
clearweaponcargo _ammobox;
clearmagazinecargo _ammobox;

for "_i" from 0 to (count westammo -1) do {_ammobox addmagazinecargo [westammo select _i,10];};
_ammobox attachTo [_para,[0,0,0]];

sleep 1;
waituntil {(getposatl _ammobox select 2) < 1.3};
detach _ammobox;
_ammobox setposatl [getposatl _ammobox select 0,getpos _ammobox select 1,0];
}else{
[west,"HQ"] sideChat "Ammo drop is not ready yet";
};
};
case Efaction :
{
if (EAsupport) then
{
[east,"HQ"] sideChat "Ammo drop on the way";
sleep 3;
private ["_ammobox","_para"];
EAsupport = false;
publicvariable "EAsupport";
_caller spawn AmmosupportTimer;

_para = "ParachuteMediumWest_EP1" createvehicle [0,0,0];
_para setpos [_x,_y,_z];
_ammobox = "RUBasicAmmunitionBox" createvehicle [0,0,100];
_ammobox setpos [_x,_y,_z];
clearweaponcargo _ammobox;
clearmagazinecargo _ammobox;
for "_i" from 0 to (count eastammo -1) do {_ammobox addmagazinecargo [eastammo select _i,10];};
_ammobox attachTo [_para,[0,0,0]];
sleep 1;
waituntil {(getposatl _ammobox select 2) < 1.3};
detach _ammobox;
_ammobox setposatl [getposatl _ammobox select 0,getpos _ammobox select 1,0];
}else{
[east,"HQ"] sideChat "Ammo drop is not ready yet";
};
};
case Gfaction :
{
if (GAsupport) then
{
[resistance,"HQ"] sideChat "Ammo drop on the way";
sleep 3;
private ["_ammobox","_para"];
GAsupport = false;
publicvariable "GAsupport";
_caller spawn AmmosupportTimer;

_para = "ParachuteMediumWest_EP1" createvehicle [0,0,0];
_para setpos [_x,_y,_z];
_ammobox = "USBasicAmmunitionBox" createvehicle [0,0,100];
_ammobox setpos [_x,_y,_z];
clearweaponcargo _ammobox;
clearmagazinecargo _ammobox;
for "_i" from 0 to (count eastammo -1) do {_ammobox addmagazinecargo [eastammo select _i,10];};
_ammobox attachTo [_para,[0,0,0]];
sleep 1;
waituntil {(getposatl _ammobox select 2) < 1.3};
detach _ammobox;
_ammobox setposatl [getposatl _ammobox select 0,getpos _ammobox select 1,0];
}else{
[resistance,"HQ"] sideChat "Ammo drop is not ready yet";
};
};
};
};
AmmoSupportTimer =
{
_caller = _this;
_faction = faction _caller;
switch (_faction) do
{
case Wfaction :
{
_tn = time;
_timer = paramsArray select 6; //
_tte = _tn + _timer;
_timerstate = true;
while {(_timerstate)} do
{
_timeRemein = (_tte - time);
if (_timeRemein < 0) then {_timerstate = false;};
sleep 1;
};
WAsupport = true;
publicvariable "WAsupport";

[WEST,"HQ"] sideChat "Ammo drop is now ready";
};
case Efaction :
{
_tn = time;
_timer = paramsArray select 6; //
_tte = _tn + _timer;
_timerstate = true;
while {(_timerstate)} do
{
_timeRemein = (_tte - time);
if (_timeRemein < 0) then {_timerstate = false;};
sleep 1;
};
EAsupport = true;
publicvariable "EAsupport";
[East,"HQ"] sideChat "Ammo drop is now ready";
};
case Gfaction :
{
_tn = time;
_timer = paramsArray select 6; //
_tte = _tn + _timer;
_timerstate = true;
while {(_timerstate)} do
{
_timeRemein = (_tte - time);
if (_timeRemein < 0) then {_timerstate = false;};
sleep 1;
};
GAsupport = true;
publicvariable "GAsupport";
[resistance,"HQ"] sideChat "Ammo drop is now ready";
};
};
};


as you can see it creates a parachute and ammobox.  clears the ammonbox for wepons and magazines, then adds new "defined" magazines to it. attach the ammobox etc so on.
westammo and eastammo is just an array with magnames in it.

any ideas why and how to solve this issue since i need to have it running on the dedicated server


ps. i posted in the wrong section 1st.and i tried to report it. but it said i could not report my own post. you can delete that thread,
« Last Edit: 04 Nov 2010, 03:28:01 by nuxil »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Problems with ammobox on dedicated server
« Reply #1 on: 03 Nov 2010, 06:03:51 »
Typo?

Quote
AmmoSupport =
{
   if ((!isServer) || (!isDedicaed)) exitwith {};
...
try { return true; } finally { return false; }

Offline nuxil

  • Members
  • *
Re: Problems with ammobox on dedicated server
« Reply #2 on: 03 Nov 2010, 15:44:51 »
 :whistle:

yeah why didnt i notice that.

however when i corrected that line nothing happend when i requested ammodrop.
so i took it out of the script..

but i still caan not access the ammo inside the box.
it still behaivs like its locked. i can see that the ammobox is filled tho.

 :weeping:



Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Problems with ammobox on dedicated server
« Reply #3 on: 03 Nov 2010, 16:29:39 »
Hmm, where are you calling this script from? Server or clients? Note that the effect of addMagazineCargo is local. So you have to fill the boxes on every single client.
try { return true; } finally { return false; }

Offline nuxil

  • Members
  • *
Re: Problems with ammobox on dedicated server
« Reply #4 on: 03 Nov 2010, 16:41:02 »
New Update.

there seams to be a bug with amra2oa. not sure about arma2.


after several houers of painstaking headscratching i finally found out why i could not accsess the items inside the ammobox

i did a small test with a ammobox. so in the editor i basicly did this.

i placed a ammobox . walked up to it. opend it. all fine. i could take out and put in items.,

then i attached the ammobox to a parachute. as i do im my orginal function,
then when i detahed it i could no longer access the items inside the ammobox alltho i could clearly see its contens.

so the workaround for this issue it to use a dummy ammobox that i use on the parachute. and replace it once it hit the ground.



« Last Edit: 04 Nov 2010, 03:30:31 by nuxil »

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Did you reveal the ammo box to the player after detaching it?

http://community.bistudio.com/wiki/reveal

Offline nuxil

  • Members
  • *
umm no..
why would i need to do that?

isnt reveal used to reveal  one unit to another unit or a group?.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
the engine reveals objects to the player (or AI) eventually when close
yet stuff like createVehicle, setPos and such make the engine take a while to do so
you can force a reveal yourself to make the interaction possible faster  :)

Offline nuxil

  • Members
  • *
right,

did some more testing.

there is defently a bug if you attach a ammobox to a parachute.
i tried with reveal after detaching it. it didnt help.

i tried to attach the ammobox to other object. static ones. had no problems to access the items after detaching it.
« Last Edit: 04 Nov 2010, 22:53:23 by nuxil »

Offline Zonekiller

  • Members
  • *
    • Zonekiller Page
im making a ammo create with random ammo , i found out if the server and client both do the random choice the weapons are there but you cant take them out , so you just have to get the server to choose the weapons and publicVariable the array to the players, YEA i thought , fixed it , but the people that join after the create is made dont see any weapons, anyone know a way around this too.