Jump to content
Sign in to follow this  
Bon

JIP Problems

Recommended Posts

Hi mates,

have some serious trouble issues with creating an MP-Mission for ArmA2,

In my Init.sqf I defined some arrays containing what should be placed in ammunition crates, and configured the (only) existing Construction Manager Module. Just take a look (simplified Init.sqf):

//definig global variables;
myMoney=500;
...

//defining WeaopnPool
myWeaponPool=[];
myMagazinePool=[];
Common_WeaponPool=[["m16a4",50],["m16a4_acg",30]];
Common_MagazinePool=[["30Rnd_556x45_Stanag",300],["30Rnd_556x45_G36",300]];
AT_WeaponPool=[["JAVELIN",30],["M136",50],["M4A1_RCO_GL",100]];
AT_MagazinePool=[["JAVELIN",100],["M136",200]];
Medic_WeaponPool=.....
...

WaitUntil{not isNull player};

//fill ammo crates
switch (typeOf player) do{
case "USMC_Soldier_LAT": {
	MyWeaponPool=Common_WeaponPool+AT_WeaponPool;
        MyMagazinePool=Common_MagazinePool+AT_MagazinePool;
};
case "USMC_Soldier_Medic": {...};
....
};

{AmmoCrate addWeaponCargo _x} foreach MyWeaponPool;
{AmmoCrate addMagazineCargo _x} foreach MyMagazinePool;

//configuring Constr. Interface
bis_coin_0 setvariable ["BIS_COIN_funds",["myMoney"]];
....

Ok, the idea is clear I think. Well, of course it works, running the preview out of the editor or playing as the host in MP.

But for everyone else who connects afterwards (what is actually everyone if hosted dedicatelly) the following issues arrive:

AmmoCrate contains all the particular weapons, dependend on which soldier class the player chose.

But: It is not possible to take them. Doubleclicking on the weapons in the "gear window" of the ammo crate doesn't take any effects.

Second problem is that the "bis_coin_0 setvariable"-stuff seems to be ignored.

I really would appreciate some suggestions, JIP and MP aspects in editing always causes me getting headaches.

Edited by Bon

Share this post


Link to post
Share on other sites

Hi

First (and I put it in all my replies :-) a link to the Biki http://community.bistudio.com/wiki/6thSense.eu:EG.

There is a lot more to find there. Anyone wanting to do advanced/MP scripting should take look there (really take the time to take a good look at it).

I don't have Arma 2 yet but from what I know in Arma 1 the commands addMagazineCargo, addWeaponCargo, clearMagazineCargo and clearWeaponCargo have only a local effect and in a thread a BIS developer said these commands were somewhat bugged.

A general rule : ask yourself where the code is executed (client, hosted server or dedicated server). Use if controls around portions of code to have a control over where the code executes (isServer, isDedicated, isNull player, etc).

If a code like waitUntil {! isNull player} is executed on a dedicated server you must know that player is always objNull on a dedicated server (and not null in a hosted server).

What happens is : the server and clients execute the loop but on the server the loop condition will never return false.

That's why bis_coin_0 setvariable ["BIS_COIN_funds","myMoney"];

isn't executed. I guess bis_coin_0 is a game logic, and game logics placed in the editor are local to server.

Share this post


Link to post
Share on other sites

Bon the only thing you need to change is this:

{AmmoCrate addWeaponCargo _x} foreach MyWeaponPool;
{AmmoCrate addMagazineCargo _x} foreach MyMagazinePool;

to this:

AmmoCrate setvehicleinit '
{AmmoCrate addWeaponCargo _x} foreach MyWeaponPool;
{AmmoCrate addMagazineCargo _x} foreach MyMagazinePool;
';
processinitcommands;

as previously mentioned the addweapon commands are only local, unless they are set in a units init, thus the above change. oh and btw, if you only want the crate to be filled once you should only run the above code on the server, as otherwise the crate will be filled again for each player running the script.

Share this post


Link to post
Share on other sites

Hi,

many thanks for your replies. The side

http://community.bistudio.com/wiki/6thSense.eu:EG

I already knew, just read it once again.

That I have to use the setVehicleInit Command together with the processInitCommands I absolutely understand.

Unfortunately it didn't fix my problems.

And I absolutely cannot reproduce it, playing in singleplayer or as the hosting machine all works fine.

But as a client != server machine it doesn't.

Share this post


Link to post
Share on other sites

Hello again,

instead of setting the Construction Interface values (bis_coin_0 block) in the Init.sqf I placed it in the initialization line of the COM Module logic - once again no success.

Something I'm doin totally wrong. How is that done in Warfare/CTI?

Is there a possibility to get the extractable .pbo of these missions?

EDIT Solution of "Constr. Manager Problem":

OK I made it work by inserting a half a second of sleep (sleep 0.5) after every "setVariable" in the bis_coin_0 configuring block.

My only suspicion is that because I'm running on a quad core there are some process running in parallel and lock each other. Far-fetched, yes, but it is something :-D

The "WeaponsCargo Problem" is still uptodate.

Edited by Bon

Share this post


Link to post
Share on other sites

are u setting the vehicle's init from the server? a good way to test it is to host your own dedicated server and join it. im not sure whats going on, although i havent tried it in arma2 in arma1 setvehicleinit is the way to go :/.

Share this post


Link to post
Share on other sites
are u setting the vehicle's init from the server? a good way to test it is to host your own dedicated server and join it. im not sure whats going on, although i havent tried it in arma2 in arma1 setvehicleinit is the way to go :/.

Actually I dont really want to use the setVehicleInit command, because I dont want it to be propagated over MP. Every player, dependent on what class he is playing, should have an inidividual Crate content. Thats the point.

And yes, I am running an own dedicated server and then connect to it as a client. Thats how I'm testing the stuff.

It is so weired. The weapons are in the crate, like they are supposed to. But you cannot pick them up.

Share this post


Link to post
Share on other sites

oh if you want each crate to have local ammo then you need to use createvehiclelocal for each player (to create their crates), and then just use the normal addweaponcargo commands etc.

sorry didnt realise what you were after.

Share this post


Link to post
Share on other sites
oh if you want each crate to have local ammo then you need to use createvehiclelocal for each player (to create their crates), and then just use the normal addweaponcargo commands etc.

That did the trick. Many many thx.

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  

×