Home   Help Search Login Register  

Author Topic: transfer weapons and ammo in a MP campaign  (Read 4828 times)

0 Members and 1 Guest are viewing this topic.

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: transfer weapons and ammo in a MP campaign
« Reply #15 on: 17 Jul 2010, 10:56:48 »
I'm still losing time with that function...

Can't someone help me?!!

The campaign is ready for release, but as the scenario is civilians entering a resistance movement, it's important that the weapons they collect can be transfered to the next mission...

I'm using the weaponpool, I've got the weapons I (and other group units) had at the end of first mission added in the weaponpool all right, but when I reach the briefing of the second mission, if I select weapons in the briefing, they disappear from weapon pool...

It works perfectly when I'm not hosting the campaign and play the campaign in single player...

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: transfer weapons and ammo in a MP campaign
« Reply #16 on: 17 Jul 2010, 17:55:59 »
Maybe just a game bug or is there a working example?
Does the OA campaign use that feature?

If not, I'd suggest you to create a report at the CIT.

Maybe as workaround you can come up with a scripting solution.
Query the players weapon via script during the briefing phase constantly and readd it once the mission starts.

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: transfer weapons and ammo in a MP campaign
« Reply #17 on: 17 Jul 2010, 18:17:02 »
What is CTI? :dunno:
in the init.sqf of first mission I'm defining 2 arrays:
Code: [Select]
weapon_pool = [];
ammo_pool = [];

i'm using at mission ending a script including:

Code: [Select]
if (_x hasWeapon "ItemGPS") then {weapon_pool = weapon_pool + ["ItemGPS"]};
removeAllItems  _x;
_weps = weapons _x;
_mags = magazines _x;
{weapon_pool = weapon_pool + [_x]} foreach _weps;
{ammo_pool = ammo_pool + [_x]} foreach _mags;

} foreach units igor_team;

savevar "weapon_pool";
savevar "ammo_pool";

And in the following mission:
Code: [Select]
if (local server) then {
{crate_pool addweaponCargo [_x,1]} foreach weapon_pool;
{crate_pool addMagazineCargo [_x,1]} foreach ammo_pool;
};

crate_pool is an emptied ammo crate placed in the second mission.
when I display the weapons and ammo I want to save to next mission with
Code: [Select]
hint format ["%1,%2", weapon_pool, ammo_pool], I've got the entire both lists at the end of first mission, but these lists are empty in the next one... ???

How does the "savevar" command works?
How can I get these arrays in the next mission?
« Last Edit: 18 Jul 2010, 12:37:18 by fleepee »

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: transfer weapons and ammo in a MP campaign
« Reply #18 on: 19 Jul 2010, 07:50:18 »
first use diag_log:
http://community.bistudio.com/wiki/diag_log

second as BI uses saveVar in both a2 and OA, it does work
the way you use it looks, OK, but again check how BI uses it

you can use the campaignConfigFile namespace to check if your variables are in there
http://community.bistudio.com/wiki/campaignConfigFile

campaignConfigFile getVariable "myVar"

use a debug console like gaia's. see attachment. also works in mp

maybe just the weapon pool is broken and not saveVar

to explain your test setup precisely would help a lot obviously (client, server, host, etc)

CIT (not CTI): http://dev-heaven.net/projects/cis

hope it helps  :blink:

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: transfer weapons and ammo in a MP campaign
« Reply #19 on: 20 Jul 2010, 09:13:09 »
Apparently, the "savevar" commands doesn't work for a MP hosted campaign!!
That's so silly! >:(
I'm now using "savestatus" to transfer weapons and ammo...
the weapon pool in the briefing would have been greater than transfer crates or truck contents...

Offline ual002

  • Members
  • *
Re: transfer weapons and ammo in a MP campaign
« Reply #20 on: 20 Jul 2010, 19:44:03 »
If you get the finished product working Id be interested to see the scripting and an explanation of how to set it up between the two missions.  I'm sure this may end up being a very popular thread for MP campaign makers in ARMA2.

-Cheers